:root {
  color-scheme: light;
  --ink: #1b1a17;
  --muted: #706b60;
  --paper: #fffaf1;
  --panel: #ffffff;
  --line: #ded6c9;
  --accent: #d8422f;
  --accent-dark: #ad2f21;
  --blue: #1f5f78;
  --green: #34785a;
  --gold: #c68a27;
  --shadow: 0 16px 40px rgba(44, 36, 24, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(rgba(255, 250, 241, 0.86), rgba(255, 250, 241, 0.92)),
    repeating-linear-gradient(90deg, #efe2cc 0 1px, transparent 1px 38px),
    repeating-linear-gradient(0deg, #efe2cc 0 1px, transparent 1px 38px);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  border: 0;
}

.app-shell {
  width: min(100%, 720px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 16px 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

.mark {
  display: grid;
  width: 44px;
  min-width: 44px;
  height: 58px;
  place-items: center;
}

.mark-image {
  display: block;
  width: 44px;
  height: 58px;
  object-fit: contain;
  filter: drop-shadow(3px 3px 0 var(--ink));
}

.title {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.05;
}

.subtitle {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.credit {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
}

.version {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
  font-size: 0.84rem;
  white-space: nowrap;
}

.screen {
  display: grid;
  gap: 16px;
}

.connection-notice {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
  border: 1px solid #d7b863;
  border-radius: 8px;
  padding: 12px;
  background: #fff6d8;
  font-size: 0.9rem;
  line-height: 1.4;
}

.connection-notice[hidden] {
  display: none;
}

.action-error {
  margin-bottom: 16px;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.panel-pad {
  padding: 18px;
}

.hero {
  min-height: calc(100vh - 88px);
  display: grid;
  align-content: center;
  gap: 16px;
}

.hero-card {
  min-width: 0;
  padding: 22px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 8px 8px 0 var(--ink);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h2,
h3 {
  margin: 0;
  line-height: 1.08;
}

.hero h2 {
  max-width: 12ch;
  overflow-wrap: break-word;
  font-size: clamp(2.25rem, 14vw, 5.4rem);
}

.lead {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.45;
}

.setup-grid {
  display: grid;
  gap: 14px;
}

.home-actions {
  display: grid;
  gap: 14px;
}

.how-to {
  display: grid;
  gap: 10px;
}

.how-to ol {
  margin: 0;
  padding-left: 22px;
}

.how-to li {
  margin: 6px 0;
}

.field {
  display: grid;
  gap: 8px;
}

.field label,
.section-label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

input,
textarea,
select {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 11px 12px;
}

textarea {
  min-height: 82px;
  resize: vertical;
}

.player-list {
  display: grid;
  gap: 8px;
}

.player-row {
  display: grid;
  grid-template-columns: 1fr 42px;
  gap: 8px;
}

.icon-btn {
  display: inline-grid;
  width: 42px;
  min-width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.extend-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}

.mode-field {
  grid-column: 1 / -1;
}

.mode-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(125px, 1fr));
  gap: 8px;
}

.mode-option {
  display: grid;
  min-height: 70px;
  gap: 4px;
  align-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  padding: 10px 8px;
  text-align: left;
}

.mode-option span {
  font-weight: 900;
}

.mode-option small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.mode-option.selected {
  border-color: var(--ink);
  background: #fff6e6;
  box-shadow: inset 0 0 0 2px var(--ink);
}

.mode-option:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.mode-hint {
  margin: 0;
}

.btn {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-radius: 8px;
  padding: 0 16px;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  text-align: center;
}

.btn.primary {
  background: var(--accent);
}

.btn.secondary {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.btn.ghost {
  min-height: 42px;
  background: transparent;
  color: var(--muted);
  padding: 0;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.btn.full {
  width: 100%;
}

.btn.compact {
  min-height: 40px;
  padding-inline: 12px;
  font-size: 0.9rem;
}

.round-head {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 12px;
}

.prompt-card {
  display: grid;
  min-width: 0;
  min-height: 174px;
  align-content: space-between;
  gap: 20px;
  padding: 18px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #111;
  color: #fff;
  box-shadow: 7px 7px 0 #d6c6aa;
}

.prompt-card .prompt {
  margin: 0;
  overflow-wrap: break-word;
  font-size: clamp(1.65rem, 9vw, 3.2rem);
  font-weight: 900;
  line-height: 1.02;
}

.prompt-card .meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: #d8d1c5;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.score-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 10px;
}

.score-chip {
  min-width: 112px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  padding: 10px;
}

.score-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 0.8rem;
}

.score-value {
  margin-top: 4px;
  font-size: 1.45rem;
  font-weight: 900;
}

.score-value.judge-label {
  color: var(--blue);
  font-size: 0.95rem;
  text-transform: uppercase;
}

.share-card {
  display: grid;
  gap: 10px;
}

.share-code {
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #f7cf64;
  padding: 12px;
  box-shadow: 4px 4px 0 var(--ink);
  font-size: clamp(1.4rem, 8vw, 2.5rem);
  font-weight: 900;
  line-height: 1.05;
}

.qr-box {
  display: grid;
  width: min(100%, 232px);
  min-height: 232px;
  place-items: center;
  justify-self: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 18px;
}

.qr-box img,
.qr-box canvas {
  width: 196px;
  height: 196px;
}

.hunt-status {
  position: sticky;
  top: 8px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.hunt-status .eyebrow {
  margin-bottom: 4px;
}

.timer {
  min-width: 92px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #f7cf64;
  padding: 10px 12px;
  box-shadow: 4px 4px 0 var(--ink);
  font-size: 1.45rem;
  font-weight: 900;
  text-align: center;
}

.hunt-track {
  display: flex;
  gap: 14px;
  margin-inline: -16px;
  overflow-x: auto;
  padding: 2px 16px 18px;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.hunt-track::-webkit-scrollbar {
  display: none;
}

.hunt-nav {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.prompt-count {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 900;
  text-align: center;
}

.prompt-overview-toggle {
  display: grid;
  gap: 2px;
  padding: 6px 10px;
  font-size: 0.75rem;
  line-height: 1.2;
}

.prompt-overview,
.prompt-overview-heading {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.prompt-overview-heading .eyebrow {
  margin-bottom: 6px;
}

.prompt-overview-heading .tiny {
  margin: 8px 0 0;
}

.prompt-overview-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.prompt-overview-filters [aria-pressed="true"] {
  border-color: var(--ink);
  background: #f7cf64;
}

.prompt-overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 10px;
}

.prompt-overview-item {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 12px;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--panel);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.prompt-overview-item.current {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
}

.prompt-overview-item:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

.prompt-overview-thumb {
  display: grid;
  width: 72px;
  height: 88px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8f1e7;
  color: var(--muted);
  font-size: 1.5rem;
  font-weight: 800;
}

.prompt-overview-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.prompt-overview-copy {
  display: grid;
  gap: 6px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.prompt-overview-copy strong {
  font-size: 0.95rem;
  line-height: 1.3;
}

.prompt-overview-meta,
.prompt-overview-status {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.3;
}

.prompt-overview-status.saved {
  color: var(--green);
}

.prompt-overview-status.pending {
  color: var(--blue);
}

.prompt-overview-status.needs-retry {
  color: var(--accent-dark);
}

.prompt-overview-arrow {
  color: var(--muted);
  font-size: 1.4rem;
}

.host-readiness {
  display: grid;
  gap: 12px;
}

.host-readiness h3 {
  margin: 0;
  font-size: 1.15rem;
}

.host-recovery-options {
  border-top: 1px solid var(--line);
}

.host-recovery-options summary {
  min-height: 44px;
  padding-block: 12px;
  color: var(--blue);
  font-weight: 800;
  cursor: pointer;
}

.host-recovery-actions {
  display: grid;
  gap: 12px;
  padding-top: 8px;
}

.host-recovery-actions p {
  margin: 0;
}

.readiness-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.readiness-pill {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 9px;
  background: #fff;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.readiness-pill.complete {
  border-color: rgba(52, 120, 90, 0.4);
  background: #edf8ef;
  color: var(--green);
}

.hunt-slide {
  display: grid;
  flex: 0 0 100%;
  min-width: 0;
  align-content: start;
  gap: 14px;
  scroll-snap-align: center;
}

.turn-card {
  display: grid;
  gap: 14px;
}

.turn-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.turn-title h3 {
  font-size: 1.45rem;
}

.uploader {
  position: relative;
  display: grid;
  min-height: 210px;
  place-items: center;
  overflow: hidden;
  border: 2px dashed #b8ad9e;
  border-radius: 8px;
  background: #f8f1e7;
}

.uploader input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  opacity: 0;
}

.uploader:focus-within {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

.photo-actions {
  display: grid;
  gap: 8px;
  text-align: center;
}

.photo-status {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8f1e7;
  line-height: 1.4;
}

.photo-status.saved {
  border-color: #8ab79c;
  background: #edf7ef;
  color: var(--green);
  font-weight: 800;
}

.uploader input:disabled {
  cursor: progress;
}

.upload-label {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 22px;
  text-align: center;
}

.upload-symbol {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: #fff;
  font-size: 1.7rem;
  font-weight: 900;
}

.preview {
  display: block;
  width: 100%;
  height: clamp(280px, 55vh, 520px);
  background: #ece4d8;
  object-fit: contain;
}

.submission-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.submission-card {
  display: grid;
  gap: 10px;
  align-content: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.submission-card.winner-card {
  border: 2px solid var(--green);
  background: #f4fbf5;
}

.submission-card img {
  display: block;
  width: 100%;
  height: clamp(260px, 48vh, 480px);
  border-radius: 6px;
  background: #ece4d8;
  object-fit: contain;
}

.submission-letter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.winner-banner {
  display: grid;
  gap: 8px;
  border-left: 5px solid var(--green);
  background: #edf7ef;
  padding: 14px;
}

.winner-banner strong {
  font-size: 1.1rem;
}

.tiny {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

.divider {
  height: 1px;
  background: var(--line);
  margin: 4px 0;
}

.prompt-picker {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 10px;
}

.recap-list,
.recap-prompt {
  display: grid;
  gap: 14px;
}

.prompt-tab {
  display: inline-grid;
  width: 48px;
  min-width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-weight: 900;
}

.prompt-tab span {
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1;
}

.prompt-tab.selected {
  border: 2px solid var(--ink);
  background: #f7cf64;
}

.prompt-tab.awarded {
  background: #edf7ef;
  border-color: #8ab79c;
}

.game-over {
  display: grid;
  gap: 14px;
}

.leaderboard {
  display: grid;
  gap: 8px;
}

.leader-row {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.rank {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-weight: 900;
}

.error {
  border: 1px solid #e6a19a;
  border-radius: 8px;
  background: #fff2f0;
  color: #8d2118;
  padding: 10px 12px;
}

@media (min-width: 680px) {
  .app-shell {
    padding-top: 28px;
  }

  .setup-grid.two {
    grid-template-columns: 1fr 1fr;
  }

  .prompt-overview-heading {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
  }

  .home-actions {
    grid-template-columns: 1fr 1fr;
  }

  .hero-card {
    padding: 30px;
  }
}
