html, body {
  margin: 0;
  height: 100%;
  background: #cfc4ad;
  overflow: hidden;
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  touch-action: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hud-buttons {
  position: fixed;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}

.hud-buttons button {
  pointer-events: auto;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid rgba(29, 27, 26, 0.45);
  background: rgba(239, 232, 218, 0.82);
  color: #1d1b1a;
  font: 12px ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  cursor: pointer;
}

.hud-buttons button:hover,
.hud-buttons button:focus-visible {
  border-color: #1d1b1a;
  outline: 2px solid #d9402b;
  outline-offset: 2px;
}

#continue-btn {
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  min-height: 32px;
  padding: 0 16px;
  border: 1.5px solid #1d1b1a;
  background: #efe8da;
  color: #1d1b1a;
  font: bold 12px ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  cursor: pointer;
}

#continue-btn:hover,
#continue-btn:focus-visible {
  background: #d9402b;
  color: #efe8da;
  outline: 2px solid #1d1b1a;
  outline-offset: 2px;
}

#continue-btn[hidden] {
  display: none;
}

.mode-select {
  position: fixed;
  top: 52px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 2;
}

.mode-select[hidden] {
  display: none;
}

.mode-select button {
  min-height: 34px;
  padding: 0 18px;
  border: 1.5px solid #1d1b1a;
  background: #efe8da;
  color: #1d1b1a;
  font: bold 12px ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  cursor: pointer;
}

.mode-select button:hover,
.mode-select button:focus-visible {
  background: #d9402b;
  color: #efe8da;
  outline: 2px solid #1d1b1a;
  outline-offset: 2px;
}

.touch-buttons {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: none;
  gap: 10px;
}

.touch-buttons button {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  border: 2px solid rgba(29, 27, 26, 0.5);
  background: rgba(239, 232, 218, 0.82);
  color: #1d1b1a;
  font: bold 13px ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  touch-action: none;
}

@media (hover: none) and (pointer: coarse) {
  .touch-buttons { display: flex; }
}

dialog {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(360px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 20px;
  border: 2px solid #1d1b1a;
  border-radius: 2px;
  background: #efe8da;
  color: #1d1b1a;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  box-shadow: 0 18px 60px rgba(29, 27, 26, 0.35);
}

dialog::backdrop {
  background: rgba(29, 27, 26, 0.55);
}

dialog h2 {
  margin: 0 0 12px;
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 30px;
  font-style: italic;
}

dialog .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 10px 0;
  font-size: 13px;
}

dialog .row input[type="range"] {
  width: 150px;
  accent-color: #d9402b;
}

dialog .row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #d9402b;
}

dialog .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

dialog button {
  min-height: 38px;
  padding: 0 14px;
  border: 1.5px solid #1d1b1a;
  background: #efe8da;
  color: #1d1b1a;
  font: 13px ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  cursor: pointer;
}

dialog button:hover,
dialog button:focus-visible {
  background: #d9402b;
  color: #efe8da;
  outline: 2px solid #1d1b1a;
  outline-offset: 2px;
}

dialog button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.draft-cards {
  display: grid;
  gap: 8px;
  margin: 6px 0;
}

.draft-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-height: 0;
  padding: 10px 12px;
  text-align: left;
}

.draft-card strong {
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 18px;
}

.draft-meta {
  color: #6b6252;
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.draft-blurb {
  font-size: 12px;
  line-height: 1.35;
}
