:root {
  color-scheme: light;
  --ink: #071223;
  --muted: #6f6a62;
  --paper: #fffdf8;
  --cream: #f6efe4;
  --line: #d5cec2;
  --green: #3f914a;
  --green-soft: #f1f8ed;
  --mustard: #d39a0b;
  --gold: #d9ab2c;
  --gold-soft: #fff8e8;
  --red: #df4658;
  --red-soft: #fff0ec;
  --blue: #0d2643;
  --teal: #14827f;
  --purple: #5a2f75;
  --shadow: 0 18px 38px rgba(21, 16, 10, 0.12);
  --serif: Georgia, "Times New Roman", serif;
  --hand: "Bradley Hand", "Segoe Print", "Comic Sans MS", cursive;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  background: #fff;
  color: var(--ink);
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(211, 154, 11, 0.52);
  outline-offset: 3px;
}

.app-shell {
  min-height: 100vh;
  padding: 18px 32px 44px;
}

.topbar {
  position: relative;
  z-index: 2;
  display: grid;
  width: min(100%, 1440px);
  min-height: 160px;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  margin: 0 auto 2px;
  padding: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

.brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: center;
  width: 166px;
  min-height: 166px;
  grid-column: 2;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.brand img {
  display: block;
  width: 166px;
  height: 166px;
  object-fit: contain;
  object-position: center;
}

.main-nav {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  justify-self: start;
  gap: 24px;
  grid-column: 1;
  grid-row: 1;
}

.ghost-button,
.icon-button,
.text-button,
.close-button,
.sun-button,
.avatar-button {
  min-height: 34px;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-size: 14px;
  font-weight: 650;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  text-decoration: none;
}

.ghost-button:hover,
.icon-button:hover,
.close-button:hover,
.sun-button:hover,
.avatar-button:hover {
  background: rgba(7, 18, 35, 0.06);
}

.top-actions {
  display: flex;
  justify-self: end;
  width: max-content;
  min-width: 82px;
  height: 36px;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 0 12px;
  border: 1px solid rgba(7, 18, 35, 0.09);
  border-radius: 999px;
  background: #fff;
  box-shadow: none;
}

.metric {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 12px;
  white-space: nowrap;
}

.metric strong {
  font-family: Inter, sans-serif;
  font-size: 12px;
  font-weight: 800;
}

.metric.fire {
  color: #c82334;
}

.metric.fire strong {
  color: var(--ink);
}

.top-separator {
  width: 1px;
  height: 38px;
  background: rgba(7, 18, 35, 0.22);
}

.sun-button {
  width: 40px;
  padding: 0;
  font-size: 34px;
  line-height: 1;
}

.avatar-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 78px;
  padding: 0;
  font-size: 19px;
}

.avatar-button span {
  width: 34px;
  height: 34px;
  border: 2px solid #fff;
  border-radius: 50%;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 35%, #1a0c06 0%, #1a0c06 20%, transparent 38%),
    radial-gradient(ellipse at 50% 58%, #e8a870 0%, #c07840 28%, transparent 50%),
    linear-gradient(170deg, #2a1408, #8c5030 45%, #e8c090);
}

.avatar-button span + span {
  margin-left: -13px;
  background:
    radial-gradient(ellipse at 50% 34%, #1e1008 0%, #1e1008 20%, transparent 36%),
    radial-gradient(ellipse at 50% 58%, #f0b888 0%, #ca8850 28%, transparent 50%),
    linear-gradient(170deg, #301808, #a06038 45%, #f0cca0);
}

.entry-button {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border: 1px solid rgba(7, 18, 35, 0.12);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  font-weight: 850;
  text-decoration: none;
  white-space: nowrap;
}

.entry-button:hover {
  background: rgba(7, 18, 35, 0.06);
}

.game-layout {
  display: grid;
  max-width: 1440px;
  grid-template-columns: minmax(1014px, 1fr) minmax(240px, 280px);
  gap: 28px;
  align-items: start;
  margin: 0 auto;
}

.scrapbook-rail {
  display: grid;
  gap: 22px;
  align-content: start;
}

.puzzle-card,
.scribble-note,
.photo-strip,
.memory-panel {
  position: relative;
  background: #fffaf0;
  box-shadow: 0 8px 18px rgba(24, 16, 8, 0.14);
}

.puzzle-card {
  min-height: 184px;
  padding: 34px 22px 18px;
  border: 1px solid rgba(112, 99, 76, 0.18);
  border-radius: 2px;
}

.puzzle-card::before {
  position: absolute;
  inset: 10px;
  border: 1px dashed rgba(7, 18, 35, 0.24);
  content: "";
}

.pin,
.paper-pin {
  position: absolute;
  z-index: 2;
  width: 19px;
  height: 19px;
  border: 1px solid rgba(88, 66, 19, 0.7);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f5da6c, #9b7415 70%);
  box-shadow: 0 3px 7px rgba(24, 16, 8, 0.3);
}

.puzzle-card .pin {
  top: 12px;
  left: 50%;
}

.puzzle-card strong {
  position: relative;
  z-index: 1;
  display: block;
  margin-top: 12px;
  font-family: var(--serif);
  font-size: 58px;
  font-weight: 500;
  line-height: 1;
  text-align: center;
}

.puzzle-card em {
  position: relative;
  z-index: 1;
  display: block;
  margin-top: 12px;
  color: #bd3446;
  font-family: var(--hand);
  font-size: 26px;
  font-style: normal;
  text-align: center;
  transform: rotate(-4deg);
}

.smile {
  position: absolute;
  right: 22px;
  bottom: 18px;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--ink);
  border-radius: 50%;
  font-size: 23px;
}

.scribble-note {
  width: 250px;
  min-height: 104px;
  margin-left: 12px;
  padding: 20px 18px;
  transform: rotate(-3deg);
}

.scribble-note p,
.hand-note,
.photo-strip em {
  margin: 0;
  color: #181818;
  font-family: var(--hand);
  font-size: 18px;
  line-height: 1.45;
}

.scribble-note span {
  position: absolute;
  right: 26px;
  bottom: 15px;
  color: #c62e3e;
  font-family: var(--hand);
  font-size: 31px;
}

.photo-strip {
  width: 194px;
  margin-left: 40px;
  padding: 18px 16px 20px;
  background: #fff;
  transform: rotate(-8deg);
}

.strip-tape {
  position: absolute;
  top: -13px;
  left: -11px;
  width: 100px;
  height: 27px;
  background: rgba(202, 103, 91, 0.44);
  transform: rotate(-9deg);
}

.photo-strip div {
  height: 82px;
  margin-bottom: 10px;
  background:
    radial-gradient(ellipse at 30% 15%, #2a2a2a 0%, #2a2a2a 24%, transparent 44%),
    radial-gradient(ellipse at 70% 14%, #222 0%, #222 22%, transparent 42%),
    radial-gradient(ellipse at 32% 52%, #e8e8e8 0%, #c4c4c4 18%, transparent 36%),
    radial-gradient(ellipse at 68% 52%, #f0f0f0 0%, #cccccc 18%, transparent 36%),
    radial-gradient(ellipse at 50% 84%, #666 0%, #444 16%, transparent 34%),
    linear-gradient(180deg, #252525 0%, #383838 40%, #2a2a2a 100%);
  filter: grayscale(1) contrast(1.1) brightness(1.05);
}

.photo-strip div:nth-child(2) {
  background:
    radial-gradient(ellipse at 35% 13%, #282828 0%, #282828 26%, transparent 46%),
    radial-gradient(ellipse at 65% 13%, #222 0%, #222 24%, transparent 44%),
    radial-gradient(ellipse at 37% 52%, #e4e4e4 0%, #c0c0c0 20%, transparent 38%),
    radial-gradient(ellipse at 64% 52%, #eeeeee 0%, #cacaca 20%, transparent 38%),
    linear-gradient(160deg, #1c1c1c 0%, #303030 45%, #242424 100%);
  filter: grayscale(1) contrast(1.15) brightness(1.0);
}

.photo-strip div:nth-child(4) {
  background:
    radial-gradient(ellipse at 50% 18%, #282828 0%, #282828 30%, transparent 50%),
    radial-gradient(ellipse at 50% 56%, #e0e0e0 0%, #bbbbbb 24%, transparent 42%),
    linear-gradient(180deg, #1e1e1e 0%, #2e2e2e 50%, #222 100%);
  filter: grayscale(1) contrast(1.1) brightness(1.05);
}

.photo-strip em {
  display: block;
  text-align: center;
  transform: rotate(-2deg);
}

.hardcore-rail {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 10px;
  padding-left: 14px;
}

.rail-toggle {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 36px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-family: var(--serif);
  font-size: 20px;
}

.switch {
  position: relative;
  width: 60px;
  height: 34px;
  border-radius: 999px;
  background: #ddd8cf;
}

.switch span {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 2px 4px rgba(24, 16, 8, 0.22);
  transition: transform 180ms ease;
}

.rail-toggle.active .switch,
.toggle-button.active .switch {
  background: #173551;
}

.rail-toggle.active .switch span,
.toggle-button.active .switch span {
  transform: translateX(26px);
}

.info-dot {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border: 1px solid #afa99f;
  border-radius: 50%;
  background: transparent;
  color: #7a7268;
  cursor: pointer;
  font-family: var(--serif);
  font-weight: 700;
}

.game-column {
  min-width: 0;
  padding-top: 0;
}

.game-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.8fr);
  gap: 24px;
  align-items: end;
  margin: 0 0 18px;
  padding: 6px 0 14px;
  border-bottom: 1px solid rgba(7, 18, 35, 0.12);
}

.intro-title {
  min-width: 0;
}

.game-intro h1 {
  margin: 4px 0 0;
  font-family: var(--serif);
  font-size: 38px;
  line-height: 1;
  letter-spacing: 0;
}

.game-intro p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.puzzle-stage {
  min-width: 0;
}

.board-corner-timer-wrap {
  width: 820px;
  max-width: 100%;
  display: flex;
  justify-content: center;
  margin: 0 auto 10px;
}

.board-corner-timer {
  width: max-content;
  justify-content: center;
  min-width: 74px;
  height: 32px;
  border-radius: 999px;
}

.clue-divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  width: 820px;
  max-width: 100%;
  margin: 0 auto 18px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.clue-divider span {
  height: 1px;
  background: rgba(7, 18, 35, 0.34);
}

.column-clues {
  display: grid;
  width: 820px;
  max-width: none;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 0 0 14px auto;
}

.criterion {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: center;
}

.criterion:hover .criterion-label {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.clue-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 35px;
  color: var(--teal);
  font-family: var(--serif);
  font-size: 38px;
  font-weight: 700;
  line-height: 1;
}

.clue-icon svg {
  display: block;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
}

.column:nth-child(2) .clue-icon {
  color: var(--mustard);
}

.column:nth-child(3) .clue-icon {
  color: var(--red);
}

.criterion-label {
  max-width: 190px;
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.08;
}

.board-composition {
  display: grid;
  grid-template-columns: 40px 130px minmax(0, 820px);
  gap: 12px;
  align-items: stretch;
  justify-content: center;
}

.row-axis {
  display: grid;
  grid-template-rows: 1fr auto 1fr;
  align-items: center;
  justify-items: center;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.row-axis span {
  width: 1px;
  height: 100%;
  background: rgba(7, 18, 35, 0.32);
}

.row-axis strong {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.row-clues {
  display: grid;
  grid-template-rows: repeat(3, 1fr);
  gap: 10px;
}

.row-clues .criterion {
  min-height: 188px;
}

.row-clues .clue-icon {
  color: var(--purple);
}

.row-clues .criterion:nth-child(2) .clue-icon {
  color: var(--teal);
}

.row-clues .criterion:nth-child(3) .clue-icon {
  color: #257299;
}

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

.game-cell {
  position: relative;
  display: flex;
  min-height: 188px;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 26px 20px;
  border: 1px solid rgba(7, 18, 35, 0.15);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-family: var(--serif);
  text-align: center;
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.game-cell:hover {
  box-shadow: 0 14px 26px rgba(24, 16, 8, 0.12);
  transform: translateY(-2px);
}

.game-cell.tone-1 {
  background: linear-gradient(135deg, rgba(240, 248, 235, 0.96), rgba(248, 252, 242, 0.96));
}

.game-cell.tone-2 {
  background: linear-gradient(135deg, rgba(255, 248, 231, 0.96), rgba(255, 252, 242, 0.96));
}

.game-cell.tone-3 {
  background: linear-gradient(135deg, rgba(255, 240, 236, 0.96), rgba(255, 247, 244, 0.96));
}

.game-cell.revealed-empty.tone-1,
.game-cell.correct.tone-1 {
  background: linear-gradient(135deg, rgba(239, 249, 232, 0.98), rgba(246, 251, 241, 0.98));
}

.game-cell.revealed-empty.tone-2,
.game-cell.golden.tone-2,
.game-cell.correct.tone-2 {
  background: linear-gradient(135deg, rgba(255, 247, 223, 0.98), rgba(255, 252, 240, 0.98));
}

.game-cell.revealed-empty.tone-3,
.game-cell.wrong.tone-3,
.game-cell.correct.tone-3 {
  background: linear-gradient(135deg, rgba(255, 238, 235, 0.98), rgba(255, 247, 244, 0.98));
}

.game-cell.correct,
.game-cell.correct.tone-1,
.game-cell.correct.tone-2,
.game-cell.correct.tone-3 {
  border-color: rgba(63, 145, 74, 0.38);
  background: linear-gradient(135deg, rgba(237, 249, 232, 0.98), rgba(247, 253, 242, 0.98));
  box-shadow: inset 0 0 0 2px rgba(63, 145, 74, 0.08);
}

.game-cell.wrong,
.game-cell.wrong.tone-1,
.game-cell.wrong.tone-2,
.game-cell.wrong.tone-3 {
  border-color: rgba(223, 70, 88, 0.28);
  background: linear-gradient(135deg, rgba(255, 239, 240, 0.98), rgba(255, 248, 247, 0.98));
  box-shadow: inset 0 0 0 2px rgba(223, 70, 88, 0.06);
}

.game-cell.golden,
.game-cell.golden.tone-1,
.game-cell.golden.tone-2,
.game-cell.golden.tone-3 {
  border-color: rgba(186, 130, 0, 0.46);
  background: linear-gradient(135deg, rgba(255, 242, 188, 0.99), rgba(255, 250, 227, 0.99));
  box-shadow: inset 0 0 0 2px rgba(217, 171, 44, 0.18), 0 16px 30px rgba(164, 105, 0, 0.14);
}

.game-cell.feedback-correct {
  animation: correct-pop 640ms cubic-bezier(0.2, 0.85, 0.25, 1.15) both;
}

.game-cell.feedback-wrong {
  animation: wrong-shake 440ms ease both;
}

.game-cell.feedback-golden {
  animation: golden-pop 1100ms cubic-bezier(0.18, 0.9, 0.24, 1.2) both;
}

.cell-answer {
  position: relative;
  z-index: 1;
  max-width: 220px;
  font-size: 28px;
  line-height: 1.25;
}

.cell-placeholder {
  position: relative;
  z-index: 1;
  color: rgba(7, 18, 35, 0.46);
  font-family: Inter, sans-serif;
  font-size: 13px;
  font-weight: 800;
}

.cell-status {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  background: var(--green);
  color: white;
  font-family: Inter, sans-serif;
  font-size: 17px;
  font-weight: 900;
}

.game-cell.correct .cell-status {
  background: var(--green);
}

.game-cell.wrong .cell-status {
  background: var(--red);
}

.game-cell.golden .cell-status {
  background: var(--mustard);
}

.golden-shine {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.golden-shine::before {
  position: absolute;
  top: -45%;
  left: -70%;
  width: 38%;
  height: 190%;
  background: rgba(255, 255, 255, 0.6);
  content: "";
  transform: rotate(22deg);
  animation: shine 2.6s ease infinite;
}

@keyframes shine {
  from {
    left: -70%;
  }
  to {
    left: 140%;
  }
}

@keyframes correct-pop {
  0% {
    transform: scale(0.96);
    box-shadow: inset 0 0 0 2px rgba(63, 145, 74, 0.08), 0 0 0 rgba(63, 145, 74, 0);
  }
  52% {
    transform: scale(1.045);
    box-shadow: inset 0 0 0 2px rgba(63, 145, 74, 0.14), 0 18px 34px rgba(63, 145, 74, 0.18);
  }
  100% {
    transform: scale(1);
    box-shadow: inset 0 0 0 2px rgba(63, 145, 74, 0.08);
  }
}

@keyframes wrong-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  18% {
    transform: translateX(-5px);
  }
  38% {
    transform: translateX(4px);
  }
  58% {
    transform: translateX(-3px);
  }
  78% {
    transform: translateX(2px);
  }
}

@keyframes golden-pop {
  0% {
    transform: scale(0.94) rotate(-1deg);
    box-shadow: inset 0 0 0 2px rgba(217, 171, 44, 0.12), 0 0 0 rgba(217, 171, 44, 0);
  }
  42% {
    transform: scale(1.06) rotate(1deg);
    box-shadow: inset 0 0 0 2px rgba(217, 171, 44, 0.22), 0 20px 38px rgba(217, 171, 44, 0.28);
  }
  100% {
    transform: scale(1) rotate(0);
    box-shadow: inset 0 0 0 2px rgba(217, 171, 44, 0.18), 0 16px 30px rgba(164, 105, 0, 0.14);
  }
}

.confetti-field {
  position: fixed;
  inset: 0;
  z-index: 80;
  overflow: hidden;
  pointer-events: none;
}

.confetti-piece {
  position: absolute;
  top: -28px;
  left: var(--x);
  width: 9px;
  height: 15px;
  border-radius: 3px;
  background: var(--color);
  opacity: 0;
  animation: confetti-fall var(--duration) ease-out var(--delay) both;
}

.confetti-piece:nth-child(3n) {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.confetti-piece:nth-child(4n) {
  width: 13px;
  height: 6px;
}

@keyframes confetti-fall {
  0% {
    opacity: 0;
    transform: translate3d(0, -20px, 0) rotate(0deg);
  }
  10% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate3d(var(--drift), 108vh, 0) rotate(var(--spin));
  }
}

@media (prefers-reduced-motion: reduce) {
  .game-cell.feedback-correct,
  .game-cell.feedback-wrong,
  .game-cell.feedback-golden,
  .golden-shine::before,
  .confetti-piece {
    animation: none;
  }

  .confetti-field {
    display: none;
  }
}

.legend {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 14px 0 20px;
  font-family: Inter, sans-serif;
  font-size: 12px;
  font-weight: 800;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.legend-dot {
  display: grid;
  width: 14px;
  height: 14px;
  place-items: center;
  border-radius: 50%;
  color: white;
  font-family: Inter, sans-serif;
  font-size: 8px;
  font-style: normal;
  font-weight: 900;
}

.correct-dot {
  background: var(--green);
}

.hidden-dot {
  background: var(--mustard);
}

.wrong-dot {
  background: var(--red);
}

.control-strip {
  display: grid;
  width: min(100%, 820px);
  grid-template-columns: 1fr 1.45fr;
  gap: 16px;
  margin: 0 auto;
}

.outline-button,
.reveal-button,
.neutral-button,
.primary-button,
.danger-button,
.toggle-button {
  min-height: 58px;
  padding: 0 22px;
  border-radius: 10px;
  cursor: pointer;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
}

.outline-button {
  border: 1px solid rgba(7, 18, 35, 0.22);
  background: white;
  color: var(--ink);
}

.reveal-button {
  background: linear-gradient(180deg, #14324f, #0d243d);
  color: white;
  box-shadow: 0 10px 18px rgba(13, 36, 61, 0.18);
}

.outline-button:disabled,
.reveal-button:disabled,
.neutral-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.memory-panel {
  position: sticky;
  top: 96px;
  min-height: 0;
  padding: 20px;
  border: 1px solid rgba(7, 18, 35, 0.12);
  border-radius: 12px;
  background: #fff;
  box-shadow: none;
}

.memory-panel::before {
  display: none;
}

.memory-panel > * {
  position: relative;
}

.side-section + .side-section {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(7, 18, 35, 0.1);
}

.memory-panel h2,
.memory-panel h3 {
  margin: 5px 0 14px;
  font-family: var(--serif);
  line-height: 1.08;
}

.memory-panel h2 {
  font-size: 32px;
}

.memory-panel h3 {
  font-size: 24px;
}

.side-stats {
  display: grid;
  gap: 8px;
  margin: 0;
}

.side-stats div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(7, 18, 35, 0.08);
}

.side-stats div:last-child {
  border-bottom: 0;
}

.side-stats dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.side-stats dd {
  margin: 0;
  font-weight: 900;
}

.polaroid-section {
  display: flex;
  justify-content: center;
}

.polaroid-card {
  width: min(100%, 252px);
  margin: 0;
  padding: 12px 12px 36px;
  border: 1px solid rgba(7, 18, 35, 0.08);
  border-radius: 2px;
  background: #fff;
  box-shadow: 0 16px 26px rgba(24, 16, 8, 0.13);
  transform: rotate(-2deg);
}

.polaroid-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: 50% 48%;
  background: #1d1d1d;
}

.polaroid-card figcaption {
  display: flex;
  min-height: 34px;
  align-items: flex-end;
  justify-content: center;
  padding: 10px 4px 0;
  color: #162033;
  font-family: var(--hand);
  font-size: 18px;
  line-height: 1.05;
  text-align: center;
  transform: rotate(-1deg);
}

.powered-smallprint {
  max-width: 1440px;
  margin: 26px auto 0;
  color: rgba(7, 18, 35, 0.54);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.02em;
  text-align: center;
}

.memory-panel .toggle-button {
  display: flex;
  width: 100%;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  border: 1px solid rgba(7, 18, 35, 0.14);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font-family: Inter, sans-serif;
  font-size: 14px;
  font-weight: 850;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(7, 18, 35, 0.38);
  backdrop-filter: blur(10px);
}

.modal {
  position: relative;
  width: min(100%, 540px);
  max-height: min(760px, calc(100vh - 44px));
  overflow: auto;
  padding: 26px;
  border: 1px solid rgba(7, 18, 35, 0.12);
  border-radius: 16px;
  background: var(--paper);
  box-shadow: 0 22px 70px rgba(7, 18, 35, 0.18);
}

.answer-modal,
.answer-list-modal,
.archive-modal {
  width: min(100%, 560px);
}

.close-button {
  position: absolute;
  top: 14px;
  right: 14px;
  min-height: 32px;
  padding: 0 12px;
  background: rgba(7, 18, 35, 0.06);
  font-size: 13px;
  font-weight: 800;
}

.modal h2 {
  margin: 6px 48px 10px 0;
  font-family: var(--serif);
  font-size: 34px;
  line-height: 1;
}

.panel-kicker,
.status-label,
.input-label {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.modal-desc {
  color: var(--muted);
  line-height: 1.5;
}

.input-label {
  display: block;
  margin: 18px 0 7px;
}

#answer-input {
  width: 100%;
  min-height: 48px;
  padding: 0 12px;
  border: 2px solid var(--line);
  border-radius: 9px;
  background: white;
  color: var(--ink);
  font-size: 16px;
  font-weight: 800;
}

.station-picker,
.revealed-list,
.archive-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.station-picker {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-height: 220px;
  overflow: auto;
  padding: 2px;
}

.station-picker button,
.revealed-list button,
.archive-list button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid rgba(7, 18, 35, 0.12);
  border-radius: 9px;
  background: white;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.station-picker button:hover,
.revealed-list button:hover,
.archive-list button:hover,
.archive-list .current {
  background: #fff5dc;
}

.station-picker button.matched {
  border-color: rgba(186, 130, 0, 0.44);
  background: #fff5dc;
  box-shadow: inset 0 0 0 2px rgba(186, 130, 0, 0.16);
}

.station-picker span {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 850;
}

.revealed-list small,
.archive-list small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.golden-row {
  border-color: rgba(186, 130, 0, 0.4) !important;
  background: var(--gold-soft) !important;
}

.golden-modal {
  text-align: center;
}

.golden-modal h2 {
  margin-right: 0;
}

.golden-burst {
  display: grid;
  width: 96px;
  height: 96px;
  place-items: center;
  margin: 18px auto;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, #fff7c7, #e7b72d 56%, #b87906 100%);
  color: white;
  font-size: 52px;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 2px 8px rgba(88, 52, 0, 0.34);
  box-shadow: 0 16px 34px rgba(164, 105, 0, 0.22);
}

.warning,
.typed-answer-copy {
  padding: 10px 12px;
  border-radius: 9px;
  background: #fff3dd;
  color: #795300;
  font-size: 13px;
  font-weight: 800;
}

.warning {
  background: var(--red-soft);
  color: #912929;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.rules-list {
  display: grid;
  gap: 10px;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.45;
}

.memory-card-visual {
  display: block;
  margin-top: 20px;
  padding: 18px;
  border: 1px solid rgba(7, 18, 35, 0.1);
  border-radius: 12px;
  background: #fff;
}

.memory-photo {
  display: none;
}

.memory-facts {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 18px 0;
}

.memory-facts div {
  padding: 10px;
  border-radius: 9px;
  background: white;
}

.memory-facts dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.memory-facts dd {
  margin: 3px 0 0;
  font-weight: 900;
}

.result-grid {
  display: grid;
  width: 126px;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin: 18px auto;
}

.result-grid span {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #e4dbce;
}

.result-grid .hit {
  background: var(--green);
}

.result-grid .star {
  background: var(--gold);
}

.share-box {
  width: 100%;
  min-height: 126px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: white;
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  resize: vertical;
}

@media (max-width: 1280px) {
  .topbar {
    min-height: 152px;
    grid-template-columns: 1fr auto 1fr;
  }

  .brand {
    width: 156px;
  }

  .brand img {
    width: 156px;
    height: 156px;
  }

  .top-actions {
    gap: 14px;
    padding: 0 14px;
  }

  .game-layout {
    grid-template-columns: minmax(0, 1fr) 260px;
    gap: 22px;
  }

  .puzzle-card strong {
    font-size: 48px;
  }

  .photo-strip {
    margin-left: 18px;
  }
}

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

  .memory-panel {
    position: static;
    min-height: auto;
  }
}

@media (max-width: 980px) {
  .app-shell {
    padding: 14px 16px 28px;
  }

  .topbar {
    min-height: 162px;
    grid-template-columns: 1fr auto 1fr;
    gap: 10px;
  }

  .brand {
    width: 166px;
    min-height: 166px;
  }

  .brand img {
    width: 166px;
    height: 166px;
  }

  .main-nav,
  .top-separator,
  .metric.fire {
    display: none;
  }

  .top-actions {
    height: 36px;
    box-shadow: none;
  }

  .game-layout {
    grid-template-columns: 1fr;
  }

  .memory-panel {
    position: static;
    min-height: auto;
  }

  .game-intro {
    grid-template-columns: 1fr;
    gap: 8px;
    padding-top: 4px;
  }

  .game-intro h1 {
    font-size: 31px;
  }

  .board-corner-timer-wrap {
    width: calc(100% - 108px);
  }

  .board-composition {
    grid-template-columns: 32px 98px minmax(0, 1fr);
    gap: 10px;
  }

  .column-clues {
    max-width: calc(100% - 108px);
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 12px 8px 24px;
  }

  .brand {
    width: 166px;
    min-height: 166px;
  }

  .brand img {
    width: 166px;
    height: 166px;
  }

  .top-actions {
    gap: 8px;
    min-width: 74px;
    height: 30px;
    padding: 0 10px;
  }

  .metric {
    font-size: 12px;
  }

  .metric strong {
    font-size: 12px;
  }

  .entry-button {
    min-height: 32px;
    padding: 0 9px;
    font-size: 12px;
  }

  .game-layout {
    display: block;
    width: 100%;
    max-width: none;
    margin: 0 auto;
  }

  .game-layout > * + * {
    margin-top: 28px;
  }

  .game-layout,
  .game-column,
  .puzzle-stage,
  .puzzle-card,
  .scribble-note,
  .clue-divider,
  .column-clues,
  .board-composition,
  .memory-panel {
    min-width: 0;
    width: 100%;
    max-width: 100%;
  }

  .game-layout {
    width: 100%;
    max-width: none;
  }

  .game-intro h1 {
    font-size: 28px;
    line-height: 0.98;
  }

  .legend {
    gap: 8px;
    margin: 10px 0 16px;
    font-size: 10px;
  }

  .legend-dot {
    width: 12px;
    height: 12px;
    font-size: 7px;
  }

  .game-column {
    --mobile-board-gap: clamp(4px, 1.4vw, 6px);
    --mobile-row-clue-size: clamp(58px, 18vw, 74px);
    --mobile-available-board-width: calc(100vw - 16px);
    --mobile-cell-size: min(96px, calc((var(--mobile-available-board-width) - var(--mobile-row-clue-size) - var(--mobile-board-gap) - var(--mobile-board-gap) - var(--mobile-board-gap)) / 3));
  }

  .board-corner-timer-wrap {
    width: calc(var(--mobile-cell-size) + var(--mobile-cell-size) + var(--mobile-cell-size) + var(--mobile-board-gap) + var(--mobile-board-gap));
    margin: 0 0 8px calc(var(--mobile-row-clue-size) + var(--mobile-board-gap));
  }

  .puzzle-stage {
    width: max-content;
    max-width: 100%;
    margin: 0 auto;
  }

  .clue-divider {
    width: calc(var(--mobile-cell-size) + var(--mobile-cell-size) + var(--mobile-cell-size) + var(--mobile-board-gap) + var(--mobile-board-gap));
    margin: 8px 0 10px calc(var(--mobile-row-clue-size) + var(--mobile-board-gap));
    gap: 10px;
    font-size: 11px;
  }

  .column-clues {
    width: calc(var(--mobile-cell-size) + var(--mobile-cell-size) + var(--mobile-cell-size) + var(--mobile-board-gap) + var(--mobile-board-gap));
    max-width: none;
    grid-template-columns: repeat(3, var(--mobile-cell-size));
    gap: var(--mobile-board-gap);
    margin: 0 0 8px calc(var(--mobile-row-clue-size) + var(--mobile-board-gap));
  }

  .board-composition {
    width: max-content;
    max-width: 100%;
    grid-template-columns: var(--mobile-row-clue-size) max-content;
    gap: var(--mobile-board-gap);
    justify-content: center;
  }

  .row-axis {
    display: none;
  }

  .row-clues {
    width: auto;
    min-width: 0;
    max-width: none;
    grid-template-columns: 1fr;
    grid-template-rows: repeat(3, var(--mobile-cell-size));
    gap: var(--mobile-board-gap);
  }

  .answer-grid {
    width: auto;
    min-width: 0;
    max-width: none;
    grid-template-columns: repeat(3, var(--mobile-cell-size));
    gap: var(--mobile-board-gap);
  }

  .row-clues .criterion {
    min-height: var(--mobile-cell-size);
  }

  .criterion-label {
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: normal;
    font-size: clamp(9px, 2.6vw, 11px);
    line-height: 1.04;
  }

  .criterion {
    gap: 4px;
  }

  .clue-icon {
    min-height: 22px;
    font-size: 24px;
  }

  .clue-icon svg {
    width: 22px;
    height: 22px;
  }

  .game-cell {
    min-width: 0;
    min-height: var(--mobile-cell-size);
    padding: 10px 6px;
  }

  .cell-answer {
    max-width: 100%;
    overflow-wrap: anywhere;
    font-size: 14px;
  }

  .cell-placeholder {
    font-size: 9px;
  }

  .cell-status {
    top: 6px;
    right: 6px;
    width: 22px;
    height: 22px;
    font-size: 12px;
  }

  .control-strip {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .memory-card-visual,
  .memory-facts {
    grid-template-columns: 1fr;
  }

  .station-picker {
    grid-template-columns: 1fr;
    max-height: 190px;
  }
}
