:root {
  --bg: #f6f1e7;
  --bg-deep: #ece3d3;
  --surface: #fffaf1;
  --surface-strong: #fffdf7;
  --ink: #2a261f;
  --muted: #6e6558;
  --line: #ddd1bc;
  --green: #1f8f58;
  --green-strong: #1f8f58;
  --amber: #c8922c;
  --amber-strong: #c47a12;
  --red: #c84b44;
  --red-strong: #c84b44;
  --navy-card: #1f6a43;
  --shadow: 0 14px 30px rgba(84, 62, 27, 0.14);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 10%, rgba(200, 146, 44, 0.12), transparent 24%),
    radial-gradient(circle at 88% 4%, rgba(31, 106, 67, 0.1), transparent 22%),
    linear-gradient(180deg, #fbf7ef 0%, var(--bg) 36%, var(--bg-deep) 100%);
}

button,
input {
  font: inherit;
}

.page-shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px 14px 32px;
}

.section-label,
.meta-label {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.74rem;
}

h1,
h2 {
  margin: 0;
}

.meta-card,
.stat-card {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.meta-card strong,
.stat-card strong {
  display: block;
  margin-top: 6px;
  font-size: 1.1rem;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(300px, 0.95fr);
  gap: 18px;
}

.main-column,
.side-column {
  display: grid;
  gap: 18px;
  align-content: start;
  min-width: 0;
}

.panel {
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(14, 24, 43, 0.08);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  min-width: 0;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}

.panel-head h2 {
  font-size: 1.12rem;
}

.play-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.play-banner {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #1f6a43;
  color: #fffaf1;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.panel-head-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  justify-content: flex-end;
}

.panel-head-inline {
  margin-bottom: 6px;
}

.section-label,
.meta-label {
  color: var(--muted);
}

.pill {
  border-radius: 999px;
  padding: 8px 12px;
  background: #efe5d2;
  color: #4e412f;
  font-size: 0.84rem;
  font-weight: 700;
}

.pill-timer {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #f0ae33, #c96f14);
  color: #ffffff;
  box-shadow: 0 10px 18px rgba(201, 111, 20, 0.2);
}

.pill-timer strong {
  color: #ffffff;
  font-size: 0.95rem;
}

.county-clue-pill.green {
  background: var(--green-strong);
  color: #ffffff;
}

.county-clue-pill.red {
  background: var(--red-strong);
  color: #ffffff;
}

.play-surface {
  overflow: hidden;
}

.clue-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.clue-chip {
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(78, 65, 47, 0.1);
  background: #fbf6ec;
}

.clue-chip-label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.clue-chip strong {
  display: block;
  color: #3f3427;
  font-size: 0.92rem;
}

.guess-chip-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
  margin-bottom: 10px;
}

.guess-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: #f3eadb;
  color: #4e412f;
  font-size: 0.76rem;
  font-weight: 700;
}

.guess-chip.is-close {
  background: #faecd0;
  color: #7a5310;
}

.guess-chip.is-solved {
  background: var(--green-strong);
  color: #ffffff;
}

.guess-chip.is-empty {
  background: transparent;
  border: 1px dashed rgba(78, 65, 47, 0.2);
  color: var(--muted);
}

.panel-note,
.selected-player,
.callout,
.empty-state,
.rules-list {
  color: var(--muted);
}

.guess-area-head {
  display: grid;
  gap: 4px;
  margin-bottom: 10px;
}

.guess-area-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

.unlock-banner,
.solved-banner {
  margin-bottom: 10px;
  padding: 11px 12px;
  border-radius: 14px;
  font-weight: 700;
  line-height: 1.35;
}

.unlock-banner {
  border: 1px solid rgba(196, 122, 18, 0.28);
  background: rgba(196, 122, 18, 0.12);
  color: #7a5310;
}

.solved-banner {
  border: 1px solid rgba(31, 143, 88, 0.28);
  background: rgba(31, 143, 88, 0.12);
  color: #185238;
}

.status-panel {
  background:
    radial-gradient(circle at top right, rgba(208, 138, 22, 0.1), transparent 30%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(244, 248, 253, 0.98));
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.status-strip-compact {
  margin-bottom: 12px;
}

.status-card {
  padding: 14px;
  border-radius: 18px;
  background: #f7f9fd;
  border: 1px solid rgba(14, 24, 43, 0.08);
}

.status-card.highlight {
  background: #1f6a43;
  border-color: #1f6a43;
  color: #ffffff;
}

.status-card.highlight .meta-label {
  color: rgba(255, 255, 255, 0.72);
}

.status-card strong {
  display: block;
  margin-top: 6px;
}

.county-grid,
.stats-grid,
.share-actions,
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.county-choice,
.primary-button,
.secondary-button,
.text-button {
  border: 0;
  cursor: pointer;
}

.county-choice {
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fbf6ec;
  color: var(--ink);
  font-weight: 700;
}

.county-choice.used {
  opacity: 0.55;
}

.county-choice.green {
  background: var(--green-strong);
  border-color: var(--green-strong);
  color: #ffffff;
  opacity: 1;
}

.county-choice.red {
  background: var(--red-strong);
  border-color: var(--red-strong);
  color: #ffffff;
  opacity: 1;
}

.surname-rows {
  display: grid;
  gap: 8px;
  overflow-x: clip;
}

.panel-subsection {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(14, 24, 43, 0.08);
}

.surname-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.surname-row.is-first-reveal .tile {
  opacity: 0;
  transform: translateY(10px) scale(0.92);
  animation: tileRevealIn 0.42s cubic-bezier(0.2, 0.9, 0.2, 1) forwards;
}

.surname-row.is-first-reveal .tile:nth-child(2) { animation-delay: 0.04s; }
.surname-row.is-first-reveal .tile:nth-child(3) { animation-delay: 0.08s; }
.surname-row.is-first-reveal .tile:nth-child(4) { animation-delay: 0.12s; }
.surname-row.is-first-reveal .tile:nth-child(5) { animation-delay: 0.16s; }
.surname-row.is-first-reveal .tile:nth-child(6) { animation-delay: 0.20s; }
.surname-row.is-first-reveal .tile:nth-child(7) { animation-delay: 0.24s; }
.surname-row.is-first-reveal .tile:nth-child(8) { animation-delay: 0.28s; }
.surname-row.is-first-reveal .tile:nth-child(9) { animation-delay: 0.32s; }
.surname-row.is-first-reveal .tile:nth-child(10) { animation-delay: 0.36s; }
.surname-row.is-first-reveal .tile:nth-child(11) { animation-delay: 0.40s; }
.surname-row.is-first-reveal .tile:nth-child(12) { animation-delay: 0.44s; }
.surname-row.is-first-reveal .tile:nth-child(13) { animation-delay: 0.48s; }
.surname-row.is-first-reveal .tile:nth-child(14) { animation-delay: 0.52s; }
.surname-row.is-first-reveal .tile:nth-child(15) { animation-delay: 0.56s; }

.surname-row.is-placeholder {
  display: grid;
  grid-template-columns: repeat(var(--tile-count, 8), minmax(0, 1fr));
  gap: 6px;
  align-items: center;
  padding: 12px;
  border-radius: 18px;
  border: 1px solid rgba(18, 34, 64, 0.1);
  background:
    radial-gradient(circle at top right, rgba(200, 146, 44, 0.1), transparent 30%),
    linear-gradient(180deg, #fffdf8, #f7efe1);
}

.surname-placeholder-copy {
  grid-column: 1 / -1;
  width: 100%;
  margin-bottom: 2px;
}

.surname-placeholder-label {
  display: inline-block;
  margin-bottom: 4px;
  color: #223556;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.surname-placeholder-hint {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.3;
}

.tile {
  position: relative;
  width: 38px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fffdf8;
  font-weight: 800;
  letter-spacing: 0.01em;
  font-size: 0.9rem;
}

.tile-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.tile.placeholder {
  position: relative;
  color: #223556;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(230, 238, 249, 0.98));
  border-color: rgba(34, 53, 86, 0.22);
  box-shadow:
    inset 0 -4px 0 rgba(18, 34, 64, 0.08),
    0 3px 10px rgba(18, 34, 64, 0.05);
}

.tile.placeholder .tile-mark {
  font-size: 1.05rem;
  font-weight: 900;
  color: #223556;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.55);
}

.tile.placeholder::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(120deg, transparent 0%, rgba(255, 255, 255, 0.32) 45%, transparent 100%);
  transform: translateX(-120%);
  animation: tileShimmer 2.4s ease-in-out infinite;
}

.tile.placeholder:nth-child(3n)::after {
  animation-delay: 0.25s;
}

.tile.placeholder:nth-child(4n)::after {
  animation-delay: 0.45s;
}

.tile.placeholder .tile-index {
  position: absolute;
  bottom: 4px;
  right: 5px;
  font-size: 0.54rem;
  font-weight: 700;
  color: rgba(34, 53, 86, 0.42);
}

.tile.placeholder-short {
  position: relative;
  color: #ffffff;
  background: linear-gradient(180deg, #b64343, var(--red-strong));
  border-color: var(--red-strong);
  box-shadow: inset 0 -4px 0 rgba(70, 10, 10, 0.22);
}

.tile.placeholder-short::after {
  content: none;
}

.tile.placeholder-short .tile-mark {
  font-size: 0.98rem;
  font-weight: 900;
}

.tile.placeholder-short .tile-index {
  color: rgba(255, 255, 255, 0.65);
}

.tile.green {
  background: var(--green-strong);
  border-color: var(--green-strong);
  color: #ffffff;
}

.tile.amber {
  background: var(--amber-strong);
  border-color: var(--amber-strong);
  color: #ffffff;
}

.tile.red {
  background: var(--red-strong);
  border-color: var(--red-strong);
  color: #ffffff;
}

.search-shell {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
  align-items: stretch;
}

.mobile-search-trigger {
  display: none;
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fffdf8;
  color: var(--muted);
  text-align: left;
  box-shadow: 0 8px 16px rgba(14, 24, 43, 0.06);
}

.mobile-search-trigger.has-selection {
  border-color: rgba(31, 106, 67, 0.26);
  background: linear-gradient(180deg, #fffdf8, #eef7f1);
  color: #184f32;
  font-weight: 700;
}

.search-shell.is-suggesting {
  margin-bottom: 0;
}

.search-shell.is-mobile-picker #player-search {
  cursor: pointer;
  border-color: rgba(34, 53, 86, 0.16);
  box-shadow: 0 8px 16px rgba(14, 24, 43, 0.06);
}

.search-shell.is-mobile-picker.has-selection #player-search {
  border-color: rgba(31, 106, 67, 0.26);
  background: linear-gradient(180deg, #fffdf8, #eef7f1);
  color: #184f32;
  font-weight: 700;
}

.search-stack {
  display: grid;
  gap: 6px;
  flex: 1 1 auto;
  min-width: 0;
  position: relative;
}

#player-search {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fffdf8;
  color: var(--ink);
}

.primary-button,
.secondary-button {
  padding: 12px 15px;
  border-radius: 14px;
  font-weight: 700;
}

.primary-button {
  background: #1f6a43;
  color: #ffffff;
}

.danger-button {
  padding: 12px 15px;
  border-radius: 14px;
  font-weight: 700;
  border: 0;
  background: #f6e7e7;
  color: var(--red-strong);
}

.primary-button:disabled,
.secondary-button:disabled,
.danger-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.secondary-button,
.text-button {
  background: #f2eadb;
  color: var(--ink);
}

.text-button {
  padding: 0;
  text-decoration: underline;
}

.action-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.action-note {
  color: var(--muted);
  font-size: 0.88rem;
}

.selected-player-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.selected-player-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
  padding: 12px;
  border-radius: 18px;
  border: 1px solid rgba(14, 24, 43, 0.08);
  background: linear-gradient(180deg, #fffdf8, #f8f0e4);
}

.selected-player-card.is-empty {
  background: #fbf6ec;
}

.selected-player-card.is-active {
  background:
    radial-gradient(circle at top right, rgba(200, 146, 44, 0.18), transparent 28%),
    linear-gradient(135deg, #1f6a43, #184f32);
  border-color: #1f6a43;
  box-shadow: 0 14px 28px rgba(31, 106, 67, 0.18);
}

.selected-player-label {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.selected-player-status {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(34, 53, 86, 0.08);
  color: #223556;
  font-size: 0.76rem;
  font-weight: 700;
}

.selected-player-card.is-active .selected-player-label {
  color: rgba(255, 255, 255, 0.72);
}

.selected-player-card.is-active .selected-player-status {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.selected-player {
  font-weight: 700;
}

.selected-player-card.is-active .selected-player {
  color: #ffffff;
}

.suggestions {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 30;
  display: grid;
  gap: 6px;
  max-height: 220px;
  padding: 6px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #fffdf8;
  box-shadow: 0 16px 28px rgba(10, 22, 48, 0.14);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.search-stack.is-suggesting #player-search {
  border-color: rgba(31, 106, 67, 0.42);
  box-shadow: 0 0 0 3px rgba(31, 106, 67, 0.1);
}

.suggestions:empty {
  display: none;
}

.suggestion {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fffdf8;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(10, 22, 48, 0.06);
}

.search-picker-body {
  display: grid;
  gap: 12px;
}

#search-picker-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fffdf8;
  color: var(--ink);
}

.search-picker-results {
  display: grid;
  gap: 8px;
  max-height: min(52dvh, 380px);
  overflow-y: auto;
  padding-right: 2px;
}

.search-picker-result {
  box-shadow: none;
}

.intro-dialog-body {
  max-width: 540px;
}

.intro-step {
  display: grid;
  gap: 12px;
}

.intro-step[hidden] {
  display: none !important;
}

.intro-result-callout {
  border-style: solid;
}

.intro-result-callout.is-hit {
  background: rgba(31, 143, 88, 0.12);
  border-color: rgba(31, 143, 88, 0.38);
  color: #1d5e3d;
}

.intro-result-callout.is-miss {
  background: rgba(200, 75, 68, 0.12);
  border-color: rgba(200, 75, 68, 0.34);
  color: #7b2d29;
}

.intro-result-county {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.95rem;
  background: #f3eadb;
  color: #4e412f;
}

.intro-result-county.is-hit {
  background: var(--green-strong);
  color: #ffffff;
}

.intro-result-county.is-miss {
  background: var(--red-strong);
  color: #ffffff;
}

.county-grid-intro {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.suggestion strong {
  display: block;
  margin-bottom: 3px;
}

.suggestion span {
  font-size: 0.88rem;
  color: var(--muted);
}

.history-feedback {
  margin-top: 2px;
  color: #3e6446;
  font-size: 0.82rem;
  font-weight: 700;
}

.history-wrap {
  overflow-x: auto;
}

.history-cards {
  display: none;
}

.history-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(14, 24, 43, 0.08);
  background: linear-gradient(180deg, #fffdf8, #f8f0e4);
}

.history-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.history-card-player {
  font-weight: 700;
  color: #10213f;
}

.history-card-sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

.history-card-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  min-height: 34px;
  padding: 0 10px;
  border-radius: 999px;
  background: #1f6a43;
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 800;
}

.history-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.history-card-note {
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(31, 106, 67, 0.08);
  color: #20563a;
  font-size: 0.88rem;
  font-weight: 700;
}

.history-card-stat {
  display: grid;
  gap: 6px;
  padding: 10px;
  border-radius: 14px;
  background: #fffdf8;
  border: 1px solid rgba(34, 53, 86, 0.1);
}

.history-card-label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#win-time {
  margin: 6px 0 0;
  color: var(--muted);
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid rgba(23, 32, 24, 0.08);
  text-align: left;
  vertical-align: middle;
}

th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.result-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 11px;
  border-radius: 12px;
  font-weight: 700;
}

.result-main {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.result-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  font-size: 0.84rem;
  line-height: 1;
  font-weight: 800;
}

.result-arrow.is-higher {
  color: var(--green-strong);
}

.result-arrow.is-lower {
  color: var(--red-strong);
}

.result-pill.green {
  background: var(--green-strong);
  color: #ffffff;
}

.result-pill.amber {
  background: var(--amber-strong);
  color: #ffffff;
}

.result-pill.red {
  background: var(--red-strong);
  color: #ffffff;
}

.result-pill.info-result {
  background: #f3eadb;
  color: #4e412f;
  border: 1px solid rgba(78, 65, 47, 0.12);
}

.hidden-result {
  background: #f4ecdf;
  color: #8b7b67;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-width: 0;
}

.stat-card {
  background: #fffdf8;
  border: 1px solid rgba(14, 24, 43, 0.08);
  min-width: 0;
}

.share-box {
  min-height: 180px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #2d3c2e;
  white-space: pre-wrap;
  font-family: "Courier New", monospace;
  color: #fffaf1;
}

.callout {
  padding: 14px;
  border-radius: 16px;
  border: 1px dashed rgba(18, 34, 64, 0.18);
  background: #fbf6ec;
  line-height: 1.45;
}

.compact-note {
  margin-top: -2px;
  margin-bottom: 12px;
}

.panel.is-collapsed > :not(.panel-head) {
  display: none;
}

.panel.is-collapsed::after {
  content: attr(data-collapsed-note);
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.4;
}

.rules-list {
  margin: 0;
  padding-left: 18px;
  line-height: 1.45;
}

.rules-title {
  white-space: nowrap;
}

.rules-section + .rules-section {
  margin-top: 14px;
}

.rules-heading {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.84rem;
  color: var(--muted);
}

.page-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
  padding: 18px 10px 6px;
}

.footer-link {
  border: 0;
  background: transparent;
  color: #4e412f;
  text-decoration: underline;
  font-weight: 700;
  padding: 0;
}

.footer-link.is-disabled {
  opacity: 0.78;
  cursor: not-allowed;
}

.footer-note {
  color: rgba(78, 65, 47, 0.74);
  font-size: 0.88rem;
}

.swatch {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  display: inline-block;
}

.swatch.green {
  background: var(--green-strong);
}

.swatch.amber {
  background: var(--amber-strong);
}

.swatch.red {
  background: var(--red-strong);
}

dialog {
  border: 0;
  border-radius: 22px;
  padding: 0;
  max-width: 420px;
  width: calc(100% - 32px);
}

dialog::backdrop {
  background: rgba(3, 8, 20, 0.62);
}

.dialog-body {
  padding: 24px;
  background: var(--surface);
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.dialog-body h2 {
  margin-top: 8px;
  font-size: 1.4rem;
}

.icon-close {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #f2eadb;
  color: var(--ink);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.dialog-actions {
  margin-top: 18px;
}

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

@keyframes tileShimmer {
  0% {
    transform: translateX(-120%);
  }
  55% {
    transform: translateX(120%);
  }
  100% {
    transform: translateX(120%);
  }
}

@keyframes tileRevealIn {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(0.92);
  }
  55% {
    opacity: 1;
    transform: translateY(-2px) scale(1.03);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .side-column {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  .status-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .status-card.highlight {
    grid-column: 1 / -1;
  }

  .rules-title {
    font-size: 1.12rem;
  }

  .rules-list {
    padding-left: 16px;
    font-size: 0.94rem;
    line-height: 1.38;
  }
}

@media (max-width: 640px) {
  .page-shell {
    padding: 8px 8px 12px;
    min-height: 100dvh;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .status-strip,
  .stats-grid {
    min-width: 0;
  }

  .meta-card,
  .stat-card,
  .status-card {
    padding: 12px;
    border-radius: 16px;
  }

  .meta-card strong,
  .stat-card strong,
  .status-card strong {
    font-size: 1rem;
  }

  .panel {
    padding: 12px;
    border-radius: 18px;
  }

  .main-column,
  .side-column,
  .layout {
    gap: 8px;
  }

  .mobile-order-surname {
    order: 1;
  }

  .mobile-order-county {
    order: 2;
  }

  .mobile-order-reveals {
    order: 3;
  }

  .mobile-order-feedback {
    order: 4;
  }

  .side-column {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  body[data-mobile-stage="play"][data-game-status="live"] .mobile-secondary-panel,
  body[data-mobile-stage="play"][data-game-status="live"] .side-column,
  body[data-mobile-stage="play"][data-game-status="live"] .page-footer {
    display: none;
  }

  .mobile-order-county,
  .mobile-order-reveals {
    display: none;
  }

  body[data-mobile-stage="intro"] .page-shell {
    display: none;
  }

  body[data-mobile-stage="play"][data-game-status="live"] .play-surface > .panel-note,
  body[data-mobile-stage="play"][data-game-status="live"] .play-surface .panel-subsection > .panel-note,
  body[data-mobile-stage="play"][data-game-status="live"] .play-surface .action-note,
  body[data-mobile-stage="play"][data-game-status="live"] .play-surface .action-note {
    display: none;
  }

  body[data-mobile-stage="play"][data-game-status="live"] .play-surface {
    min-height: auto;
    max-height: none;
    display: block;
  }

  body[data-mobile-stage="play"][data-game-status="live"] .play-surface .panel-head {
    margin-bottom: 6px;
  }

  body[data-mobile-stage="play"][data-game-status="live"] .play-surface .panel-subsection {
    margin-top: 8px;
    padding-top: 8px;
  }

  body[data-mobile-stage="play"][data-game-status="live"] .play-surface .selected-player-card {
    display: none;
  }

  body[data-mobile-stage="play"][data-game-status="live"] .play-surface .status-card.highlight {
    display: none;
  }

  body[data-mobile-stage="play"][data-game-status="live"] .play-surface .guess-area-note {
    font-size: 0.78rem;
  }

  body[data-mobile-stage="play"][data-game-status="live"] .play-surface .surname-rows {
    padding-right: 2px;
  }

  body[data-mobile-stage="play"][data-game-status="live"] .play-surface .surname-rows.is-scrollable {
    max-height: none;
    overflow: visible;
  }

  body[data-mobile-stage="play"][data-game-status="live"] .play-surface .surname-rows.is-placeholder-state {
    max-height: none;
    overflow: visible;
  }

  body[data-mobile-stage="play"][data-game-status="live"] .play-surface .guess-area {
    margin-top: 8px;
  }

  .search-shell,
  .panel-head,
  .action-row,
  .split-actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .panel-head {
    gap: 8px;
  }

  .panel-head-actions {
    width: 100%;
    align-items: flex-start;
    justify-content: flex-start;
  }

  .play-title-row {
    width: 100%;
    justify-content: space-between;
    gap: 8px;
  }

  #how-to-play-toggle {
    display: inline-flex;
    align-items: center;
  }

  body[data-mobile-stage="play"][data-game-status="live"] .panel-head-actions {
    gap: 6px;
  }

  .selected-player-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .status-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .status-card.highlight {
    grid-column: 1 / -1;
  }

  .primary-button,
  .secondary-button,
  .danger-button {
    width: 100%;
  }

  #player-search {
    font-size: 16px;
    min-height: 42px;
    padding: 10px 12px;
  }

  .search-stack.is-drop-up .suggestions {
    position: absolute;
    top: auto;
    bottom: calc(100% + 8px);
    left: 0;
    right: 0;
    z-index: 40;
    max-height: 176px;
    margin-top: 0;
  }

  .search-shell.is-mobile-picker .search-stack {
    display: none;
  }

  .search-shell.is-mobile-picker .mobile-search-trigger {
    display: block;
  }

  .search-shell.is-suggesting #submit-guess,
  .search-shell.is-suggesting + .action-row {
    display: none;
  }

  .suggestions {
    position: static;
    max-height: 176px;
    width: 100%;
    margin-top: 8px;
    padding: 6px;
    box-shadow: 0 10px 18px rgba(10, 22, 48, 0.1);
  }

  #search-picker-dialog {
    width: calc(100% - 20px);
    max-width: none;
  }

  .search-picker-body {
    padding: 18px 16px;
    gap: 10px;
  }

  .search-picker-results {
    max-height: min(56dvh, 430px);
  }

  .suggestion {
    padding: 8px 10px;
    border-radius: 12px;
  }

  .suggestion strong {
    font-size: 0.9rem;
    margin-bottom: 2px;
  }

  .suggestion span {
    font-size: 0.74rem;
    line-height: 1.2;
  }

  .county-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    overflow-x: visible;
    padding-bottom: 0;
    width: 100%;
  }

  .county-choice {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    min-width: 0;
    text-align: center;
    padding: 6px 7px;
    font-size: 0.76rem;
    line-height: 1.15;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .surname-row {
    display: grid;
    grid-template-columns: repeat(var(--tile-count, 8), minmax(0, 1fr));
    gap: 3px;
    flex-wrap: nowrap;
  }

  .tile {
    width: 100%;
    min-width: 0;
    height: 30px;
    border-radius: 9px;
    font-size: 0.7rem;
    letter-spacing: 0.01em;
  }

  .tile.placeholder .tile-mark {
    font-size: 0.88rem;
  }

  .tile.placeholder-short .tile-mark {
    font-size: 0.84rem;
  }

  .surname-row.is-placeholder {
    grid-template-columns: repeat(var(--tile-count, 8), minmax(0, 1fr));
    gap: 3px;
  }

  .surname-placeholder-copy {
    grid-column: 1 / -1;
    margin-bottom: 4px;
  }

  .surname-placeholder-hint {
    font-size: 0.74rem;
  }

  .tile .tile-index {
    bottom: 2px;
    right: 3px;
    font-size: 0.46rem;
  }

  .action-note,
  .panel-note {
    font-size: 0.76rem;
    line-height: 1.28;
  }

  .clue-strip {
    gap: 6px;
    margin-bottom: 8px;
  }

  .clue-chip {
    padding: 7px 8px;
    border-radius: 12px;
  }

  .clue-chip strong {
    font-size: 0.78rem;
  }

  .guess-chip-row {
    margin-top: 6px;
    margin-bottom: 6px;
  }

  .guess-chip {
    min-height: 24px;
    padding: 0 7px;
    font-size: 0.66rem;
  }

  .unlock-banner,
  .solved-banner {
    margin-bottom: 8px;
    padding: 9px 10px;
    font-size: 0.8rem;
  }

  .page-footer {
    flex-direction: column;
    gap: 6px;
    padding-top: 14px;
  }

  .selected-player-card {
    margin-bottom: 0;
  }

  .status-strip-compact {
    gap: 6px;
    margin-bottom: 8px;
  }

  .status-strip-compact .status-card {
    padding: 8px;
    border-radius: 12px;
  }

  .status-strip-compact .status-card strong {
    margin-top: 3px;
    font-size: 0.84rem;
  }

  .status-strip-compact .meta-label {
    font-size: 0.62rem;
  }

  .legend {
    gap: 8px;
  }

  .legend-item {
    font-size: 0.76rem;
  }

  .history-wrap {
    display: none;
  }

  .history-cards {
    display: grid;
    gap: 10px;
  }

  .history-card-grid {
    grid-template-columns: 1fr;
  }

  .county-grid-intro {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  #intro-dialog {
    width: calc(100% - 20px);
    max-width: 460px;
  }
}

@media (max-width: 360px) {
  .mobile-order-reveals .stats-grid {
    grid-template-columns: 1fr;
  }

  .county-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
