:root {
  color-scheme: light;
  --ink: #41536d;
  --muted: #748198;
  --line: #b8c4d7;
  --paper: #fffdfa;
  --sky: #dff6fa;
  --sky-strong: #bdebf2;
  --green: #75cd78;
  --green-dark: #45a959;
  --orange: #f4a04f;
  --pink: #ff78a3;
  --yellow: #ffd86b;
  --navy: #25384a;
  --shadow: 0 16px 40px rgba(58, 77, 104, 0.14);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  background:
    radial-gradient(circle at 16% 12%, rgba(255, 255, 255, 0.82), transparent 18rem),
    linear-gradient(145deg, #cdecfa 0%, #e7f8ff 52%, #f5fbff 100%);
  color: var(--ink);
  overflow-x: hidden;
}

body[data-screen="game"] {
  overflow: hidden;
}

body[data-screen="game"] .app-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
}

body[data-screen="game"] .screen[data-screen="game"] {
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
  touch-action: manipulation;
}

button:disabled {
  cursor: default;
}

.app-shell {
  width: min(1180px, 100%);
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 22px max(22px, env(safe-area-inset-bottom));
}

.topbar {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
}

.topbar-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.brand {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: left;
}

.eyebrow,
.kicker {
  display: block;
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0;
}

.brand h1,
.page-heading h2,
.modal-card h2 {
  margin: 0;
  color: var(--ink);
  letter-spacing: 0;
}

.brand h1 {
  font-size: clamp(1.55rem, 5vw, 2.35rem);
  line-height: 1;
}

.brand-logo {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  overflow: hidden;
  background: #d6f1ff;
  box-shadow: 0 8px 18px rgba(70, 86, 112, 0.12);
  flex: 0 0 auto;
}

.brand-logo img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.icon-button,
.close-button {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  box-shadow: 0 8px 18px rgba(70, 86, 112, 0.12);
  display: inline-grid;
  place-items: center;
  font-size: 1.8rem;
  font-weight: 800;
}

.icon-button:active,
.primary-button:active,
.secondary-button:active,
.accent-button:active,
.tool-button:active,
.guess-cell:active,
.level-card:active {
  transform: translateY(1px);
}

.screen {
  display: block;
}

.is-hidden {
  display: none !important;
}

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

.hero-panel {
  position: relative;
  min-height: min(660px, calc(100dvh - 120px));
  border: 0;
  border-radius: 0;
  background:
    radial-gradient(circle at 10% 18%, rgba(255, 255, 255, 0.76), transparent 18rem),
    radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.42), transparent 15rem),
    linear-gradient(155deg, #d7f3ff 0%, #cbeeff 48%, #e9f9ff 100%);
  box-shadow: var(--shadow);
  overflow: hidden;
  padding: clamp(24px, 6vw, 72px);
}

.hero-panel::before,
.hero-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hero-panel::before {
  background:
    radial-gradient(circle at 28% 58%, rgba(255, 255, 255, 0.42), transparent 19rem),
    radial-gradient(circle at 82% 70%, rgba(255, 208, 75, 0.14), transparent 14rem);
}

.hero-panel::after {
  background-image: linear-gradient(rgba(255, 255, 255, 0.16) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.14) 1px, transparent 1px);
  background-size: 68px 68px;
  opacity: 0.26;
}

.hero-copy {
  position: relative;
  z-index: 2;
  width: min(58%, 610px);
  padding-top: 0;
}

.title-sticker {
  position: relative;
  display: block;
  width: min(380px, 100%);
  margin: 0;
  transform: translateY(-32px) rotate(-3deg);
  filter: drop-shadow(0 14px 14px rgba(79, 130, 188, 0.2));
}

.title-sticker img {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
  pointer-events: none;
}

.hero-subtitle {
  width: min(440px, 100%);
  margin: 20px 0 0 24px;
  color: #4d7899;
  font-size: clamp(1rem, 2.2vw, 1.18rem);
  font-weight: 900;
  line-height: 1.7;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.78);
}

.floating-card {
  position: absolute;
  z-index: 1;
  width: clamp(105px, 13vw, 174px);
  aspect-ratio: 0.9;
  border-radius: 25%;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.42);
  font-size: clamp(2.9rem, 7vw, 5.6rem);
  font-weight: 950;
  line-height: 0.92;
  box-shadow: 12px 12px 0 rgba(87, 154, 201, 0.18);
  transform: rotate(var(--rotate));
}

.floating-card span {
  position: absolute;
  top: 16%;
  color: rgba(255, 255, 255, 0.46);
  font-size: clamp(1.05rem, 2.4vw, 1.9rem);
  font-weight: 950;
}

.card-one {
  --rotate: -14deg;
  left: -42px;
  top: -10px;
  background: linear-gradient(145deg, #fff1c9, #ffe0a0);
  color: rgba(238, 156, 80, 0.28);
}

.card-two {
  --rotate: 3deg;
  left: 23%;
  top: -28px;
  background: linear-gradient(145deg, #ffa956, #ff914d);
}

.card-three {
  --rotate: -9deg;
  left: 55%;
  top: -46px;
  background: linear-gradient(145deg, #b9c5ff, #9d93e9);
}

.card-four {
  --rotate: 12deg;
  right: -24px;
  top: 12%;
  background: linear-gradient(145deg, #aebdff, #8fa4ee);
}

.card-five {
  --rotate: -10deg;
  left: 38%;
  bottom: -56px;
  background: linear-gradient(145deg, #8aa9ff, #6f8be8);
}

.music-note {
  position: absolute;
  z-index: 2;
  color: #5fcf82;
  font-weight: 950;
  line-height: 1;
  text-shadow: 0 6px 0 rgba(76, 137, 185, 0.13);
}

.note-one {
  right: 26%;
  top: 21%;
  font-size: clamp(3rem, 6vw, 5rem);
  transform: rotate(17deg);
}

.note-two {
  right: 6%;
  bottom: 8%;
  color: #62d28f;
  font-size: clamp(4.6rem, 8.5vw, 7.2rem);
  transform: rotate(11deg);
}

.spark {
  position: absolute;
  z-index: 2;
  width: 96px;
  height: 80px;
}

.spark::before,
.spark::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 58px;
  border-radius: 999px;
  background: #ff6798;
  transform: rotate(-32deg);
}

.spark::after {
  left: 42px;
  top: 18px;
  height: 18px;
  background: #ffde62;
  transform: rotate(0deg);
}

.spark-one {
  right: 34%;
  top: 32%;
}

.spark-two {
  display: none;
}

.mascot-card {
  position: absolute;
  z-index: 2;
  right: clamp(22px, 6vw, 86px);
  bottom: clamp(58px, 10vw, 118px);
  width: clamp(250px, 38vw, 450px);
  aspect-ratio: 1.28;
  border-radius: 43% 46% 39% 41%;
  background: linear-gradient(145deg, #ff6aa8 0%, #f23887 68%, #d82875 100%);
  box-shadow: 0 18px 0 #303257, 0 30px 32px rgba(66, 99, 132, 0.26);
  transform: rotate(2deg);
}

.mascot-card::before {
  content: "";
  position: absolute;
  right: 10%;
  top: 24%;
  width: 45%;
  height: 22%;
  border-radius: 52% 48% 44% 56%;
  background: #29284f;
  transform: rotate(-2deg);
}

.speech-bubble {
  position: absolute;
  top: -76px;
  right: -6px;
  width: clamp(78px, 9vw, 112px);
  height: clamp(78px, 9vw, 112px);
  border-radius: 50%;
  background: linear-gradient(145deg, #ffd84d, #ffbf29);
  color: #3b2d28;
  display: grid;
  place-items: center;
  font-size: clamp(2.8rem, 5.2vw, 4.4rem);
  font-weight: 950;
  box-shadow: 8px 9px 0 rgba(88, 140, 183, 0.16);
}

.speech-bubble::after {
  content: "";
  position: absolute;
  right: 18%;
  bottom: -9px;
  width: 28%;
  height: 28%;
  background: #ffbf29;
  clip-path: polygon(0 0, 100% 20%, 20% 100%);
}

.mascot-face {
  position: absolute;
  left: 20%;
  top: 37%;
  display: flex;
  gap: clamp(18px, 3vw, 30px);
  transform: rotate(4deg);
}

.mascot-face span {
  width: clamp(64px, 8.6vw, 96px);
  height: clamp(64px, 8.6vw, 96px);
  border: clamp(8px, 1.15vw, 13px) solid #303257;
  border-radius: 50%;
  background: white;
  position: relative;
}

.mascot-face span::after {
  content: "";
  position: absolute;
  width: 24%;
  height: 24%;
  border-radius: 50%;
  background: #061935;
  left: 48%;
  top: 45%;
}

.mascot-mouth {
  position: absolute;
  width: 37%;
  height: 15%;
  left: 22%;
  bottom: 18%;
  border-radius: 0 0 90px 90px;
  background: rgba(115, 37, 82, 0.42);
}

.home-actions {
  position: absolute;
  z-index: 3;
  left: clamp(34px, 6.5vw, 88px);
  bottom: clamp(20px, 2vw, 28px);
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  width: min(232px, calc(100% - 68px));
}

.primary-button,
.secondary-button,
.accent-button,
.tool-button {
  min-height: 50px;
  border-radius: 18px;
  font-weight: 900;
  letter-spacing: 0;
}

.primary-button {
  background: var(--green);
  color: white;
  box-shadow: 0 8px 0 var(--green-dark);
}

.secondary-button {
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  border: 2px solid rgba(116, 129, 152, 0.18);
}

.home-actions .secondary-button:last-child {
  background: rgba(255, 255, 255, 0.88);
  border-color: rgba(117, 205, 120, 0.42);
  color: var(--green-dark);
}

.home-actions .primary-button,
.home-actions .secondary-button {
  min-width: 0;
  width: 100%;
  border-radius: 999px;
  padding: 0 22px;
}

.home-actions .primary-button {
  background: #ff6a9f;
  box-shadow: 0 8px 0 #cf3d74, 0 12px 20px rgba(209, 66, 117, 0.16);
}

.home-actions .secondary-button {
  background: rgba(255, 255, 255, 0.9);
  color: #3867b7;
  border: 2px solid rgba(82, 128, 219, 0.18);
  box-shadow: 0 7px 0 rgba(103, 154, 199, 0.16);
}

.stats-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.stats-strip div {
  min-width: 0;
  border-radius: 20px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.72);
  text-align: center;
  box-shadow: 0 8px 20px rgba(65, 83, 109, 0.08);
}

.stats-strip strong {
  display: block;
  color: var(--green-dark);
  font-size: 1.55rem;
  line-height: 1;
}

.stats-strip span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.page-heading {
  margin: 8px 0 18px;
}

.page-heading h2 {
  font-size: clamp(1.55rem, 5vw, 2.3rem);
}

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

.level-card {
  min-height: 132px;
  border-radius: 20px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  border: 2px solid rgba(116, 129, 152, 0.16);
  box-shadow: var(--shadow);
  text-align: left;
}

.level-card span,
.level-card em {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-style: normal;
  font-weight: 700;
}

.level-card strong {
  display: block;
  margin: 12px 0;
  font-size: 1.2rem;
  color: var(--ink);
}

.level-card.is-passed {
  border-color: rgba(117, 205, 120, 0.55);
  background: linear-gradient(145deg, #ffffff, #ecffec);
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.95fr) minmax(360px, 1.05fr);
  gap: clamp(18px, 4vw, 44px);
  align-items: stretch;
  min-height: 0;
}

body[data-screen="game"] .game-layout {
  height: 100%;
}

.question-card,
.answer-panel,
.modal-card {
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow);
  border: 2px solid rgba(116, 129, 152, 0.16);
}

.question-card {
  padding: clamp(16px, 3vw, 26px);
}

body[data-screen="game"] .question-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  min-height: 0;
  overflow: hidden;
}

.question-meta,
.round-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-weight: 800;
}

.question-meta span,
.round-info span {
  min-width: 0;
}

.image-board {
  display: grid;
  gap: 14px;
  margin: 16px 0 14px;
}

body[data-screen="game"] .image-board {
  min-height: 0;
  overflow: hidden;
  grid-auto-rows: minmax(0, 1fr);
}

.image-board.is-single {
  grid-template-columns: 1fr;
}

.clue-panel {
  min-height: clamp(165px, 28vw, 240px);
  border-radius: 18px;
  background: var(--clue-bg);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  overflow: hidden;
  position: relative;
}

.clue-panel--image {
  min-height: 0;
  background: #fffaf0;
}

body[data-screen="game"] .clue-panel {
  min-height: 0;
}

body[data-screen="game"] .clue-panel--image {
  align-self: stretch;
}

.clue-panel::before {
  content: "";
  position: absolute;
  inset: 12px;
  border: 2px dashed rgba(255, 255, 255, 0.28);
  border-radius: 15px;
}

.clue-panel--image::before {
  display: none;
}

.clue-panel--image img {
  display: block;
  width: 100%;
  height: auto;
  max-height: clamp(220px, 48vh, 520px);
  object-fit: contain;
  border-radius: 18px;
}

body[data-screen="game"] .clue-panel--image img {
  height: 100%;
  max-height: none;
}

.clue-panel strong {
  position: relative;
  color: #111827;
  font-size: clamp(1.25rem, 4vw, 1.9rem);
}

.clue-art {
  position: relative;
  width: clamp(88px, 18vw, 150px);
  height: clamp(88px, 18vw, 150px);
  display: grid;
  place-items: center;
}

.clue-art span {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: #8b5b2e;
  font-weight: 950;
  font-size: clamp(2.6rem, 8vw, 4.9rem);
  text-shadow: 0 3px 0 rgba(255, 255, 255, 0.34);
}

.ginger-shape {
  border-radius: 47% 28% 50% 34%;
  background: #f1b84c;
  transform: rotate(14deg);
  box-shadow: inset 0 0 0 7px #9a6f2d;
}

.heart-shape {
  border-radius: 48% 48% 46% 46%;
  background: #f1b84c;
  clip-path: path("M75 134 C28 100 4 70 22 38 C38 10 66 22 75 43 C84 22 112 10 128 38 C146 70 122 100 75 134 Z");
  box-shadow: none;
}

.clam-shape {
  border-radius: 50% 50% 42% 42%;
  background: #c48042;
  box-shadow: inset 0 0 0 7px #8d552b;
}

.moving-shape {
  border-radius: 44% 42% 50% 38%;
  background: #f6d9a4;
  box-shadow: -42px -10px 0 #c48042, inset 0 -9px 0 rgba(141, 85, 43, 0.25);
}

.paper-shape {
  border-radius: 16px;
  background: #fffdfa;
  box-shadow: inset 0 0 0 7px #7ebca6, 12px 12px 0 rgba(54, 112, 96, 0.18);
}

.fish-shape {
  border-radius: 54% 45% 48% 52%;
  background: #ffb45c;
  box-shadow: inset 0 0 0 7px #b86a32;
}

.stamp-shape {
  border-radius: 18px 18px 34px 34px;
  background: #ff6f8d;
  box-shadow: inset 0 0 0 7px #b63d5a;
}

.jump-shape {
  border-radius: 50%;
  background: #90d778;
  box-shadow: 24px -24px 0 #ffd86b, inset 0 0 0 7px #52a64e;
}

.question-text {
  min-height: 58px;
  color: #5b6f89;
  font-size: 1rem;
  line-height: 1.6;
}

.tag-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}

.type-tag {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 12px;
  background: var(--pink);
  color: white;
  font-weight: 900;
}

.progress-dots {
  display: flex;
  gap: 6px;
  align-items: center;
}

.dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #b3bdd4;
}

.dot.is-current {
  width: 26px;
  border-radius: 999px;
  background: var(--yellow);
}

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

.answer-panel {
  display: grid;
  align-content: start;
  gap: 18px;
  min-height: 100%;
  padding: clamp(18px, 4vw, 32px);
}

body[data-screen="game"] .answer-panel {
  grid-template-rows: auto minmax(0, 1fr) auto auto auto auto auto;
  align-content: stretch;
  min-height: 0;
  overflow: hidden;
}

.guess-history {
  --answer-length: 4;
  display: grid;
  align-content: start;
  gap: 9px;
  min-height: clamp(210px, 34vh, 360px);
  padding: 4px 0 18px;
  border-bottom: 3px solid rgba(116, 129, 152, 0.2);
}

body[data-screen="game"] .guess-history {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.guess-row {
  display: grid;
  grid-template-columns: 4.6rem 1fr;
  gap: 10px;
  align-items: center;
}

.guess-row.is-entering .guess-cell {
  animation: guessRowIn 300ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: var(--cell-delay, 0ms);
}

.guess-index {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-align: right;
}

.guess-cells {
  display: grid;
  grid-template-columns: repeat(var(--answer-length), minmax(46px, 68px));
  justify-content: center;
  gap: 8px;
}

.guess-cell,
.sample-tile {
  border-radius: 16px;
  border: 2px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  display: grid;
  place-items: center;
  box-shadow: 0 6px 0 rgba(116, 129, 152, 0.14);
}

.guess-cell {
  width: min(100%, 68px);
  aspect-ratio: 1;
  font-weight: 950;
  align-content: center;
  gap: 4px;
}

.guess-cell strong {
  display: block;
  font-size: 1.6rem;
  line-height: 1;
}

.guess-cell small {
  color: #78869a;
  font-size: 0.68rem;
  line-height: 1;
  font-weight: 900;
}

.guess-cell.is-correct,
.sample-tile.correct {
  background: var(--green);
  border-color: var(--green);
  color: white;
}

.guess-cell.is-misplaced,
.sample-tile.misplaced {
  background: rgba(255, 255, 255, 0.86);
  border-color: var(--line);
  color: var(--orange);
}

.guess-cell.is-wrong,
.sample-tile.wrong {
  background: rgba(255, 255, 255, 0.86);
  border-color: var(--line);
  color: #8d98a9;
}

.guess-cell small.is-correct,
.sample-tile.tone-correct {
  color: var(--green);
}

.guess-cell small.is-misplaced,
.sample-tile.tone-misplaced,
.sample-tile.tone {
  color: var(--orange);
}

.guess-cell.is-correct small {
  color: rgba(255, 255, 255, 0.82);
}

.sample-tile.tone-correct,
.sample-tile.tone-misplaced,
.sample-tile.tone {
  background: #fff7db;
  border-color: var(--yellow);
}

.current-answer-slots {
  --answer-length: 4;
  display: grid;
  grid-template-columns: repeat(var(--answer-length), minmax(46px, 68px));
  justify-content: center;
  gap: 8px;
  min-height: 76px;
}

.current-slot {
  display: grid;
  place-items: center;
  width: min(100%, 68px);
  aspect-ratio: 1;
  border-radius: 16px;
  border: 2px solid var(--line);
  background: rgba(255, 255, 255, 0.42);
  color: var(--ink);
  font-weight: 950;
  box-shadow: 0 6px 0 rgba(116, 129, 152, 0.12);
  transition:
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.current-slot strong {
  display: block;
  font-size: 1.6rem;
  line-height: 1;
}

.current-slot.is-filled {
  background: rgba(255, 255, 255, 0.92);
  border-color: var(--green);
  box-shadow: 0 7px 0 rgba(69, 169, 89, 0.18);
  animation: slotFill 220ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: var(--slot-delay, 0ms);
}

.current-answer-slots.is-lifting .current-slot.is-filled {
  animation: slotLift 240ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: var(--slot-delay, 0ms);
}

.input-row {
  display: grid;
  grid-template-columns: 1fr minmax(96px, 130px);
  gap: 10px;
}

.input-row input {
  min-width: 0;
  height: 52px;
  border-radius: 17px;
  border: 2px solid var(--line);
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  font-weight: 800;
  outline: 0;
}

.input-row input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(117, 205, 120, 0.18);
}

.input-row input:disabled,
button:disabled {
  opacity: 0.72;
}

.accent-button {
  background: var(--yellow);
  color: #8b5b2e;
  box-shadow: 0 7px 0 rgba(139, 91, 46, 0.2);
}

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

.hint-feedback {
  min-height: 48px;
  margin: 0;
  padding: 12px 14px;
  border-radius: 16px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.54);
  line-height: 1.5;
  font-weight: 800;
}

.hint-feedback:empty {
  display: block;
}

.hint-feedback[data-kind="success"] {
  color: #28783d;
  background: rgba(117, 205, 120, 0.18);
}

.hint-feedback[data-kind="warn"] {
  color: #93662f;
  background: rgba(255, 216, 107, 0.24);
}

@keyframes slotFill {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(0.92);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes slotLift {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  100% {
    opacity: 0;
    transform: translateY(-36px) scale(0.88);
  }
}

@keyframes guessRowIn {
  0% {
    opacity: 0;
    transform: translateY(30px) scale(0.92);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.tool-button {
  background: rgba(255, 255, 255, 0.68);
  color: var(--muted);
  border: 2px solid rgba(116, 129, 152, 0.22);
}

.tool-button.is-selected {
  color: white;
  background: var(--green);
  border-color: var(--green);
}

.rating-panel {
  display: grid;
  gap: 12px;
  justify-items: center;
  padding-top: 6px;
}

.rating-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
  font-weight: 900;
}

.rating-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(86px, 120px));
  justify-content: center;
  gap: 10px;
  width: 100%;
}

.rating-submit {
  width: min(260px, 100%);
}

.feedback {
  min-height: 48px;
  margin: 0;
  padding: 12px 14px;
  border-radius: 16px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.54);
  line-height: 1.5;
}

.feedback[data-kind="success"] {
  color: #28783d;
  background: rgba(117, 205, 120, 0.18);
}

.feedback[data-kind="warn"] {
  color: #93662f;
  background: rgba(255, 216, 107, 0.24);
}

.feedback[data-kind="danger"] {
  color: #9f3454;
  background: rgba(255, 120, 163, 0.16);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(65, 83, 109, 0.38);
  backdrop-filter: blur(7px);
}

.modal-card {
  position: relative;
  width: min(780px, 100%);
  max-height: min(760px, calc(100dvh - 44px));
  overflow: auto;
  padding: clamp(24px, 5vw, 46px);
}

.close-button {
  position: absolute;
  top: 14px;
  right: 14px;
  background: var(--pink);
  color: white;
}

.modal-card h2 {
  text-align: center;
  font-size: 2rem;
  margin-bottom: 26px;
}

.submit-card {
  width: min(560px, 100%);
}

.submit-form {
  display: grid;
  gap: 16px;
}

.submit-form label {
  display: grid;
  gap: 8px;
  color: var(--ink);
  font-weight: 900;
}

.submit-form input[type="text"],
.submit-form textarea {
  min-width: 0;
  height: 52px;
  border-radius: 16px;
  border: 2px solid var(--line);
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  font-weight: 800;
  outline: 0;
}

.submit-form textarea {
  min-height: 78px;
  height: auto;
  padding: 12px 14px;
  resize: vertical;
  line-height: 1.45;
}

.submit-form input[type="text"]:focus,
.submit-form textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(117, 205, 120, 0.18);
}

.upload-field {
  min-height: 112px;
  padding: 16px;
  border-radius: 18px;
  border: 2px dashed rgba(116, 129, 152, 0.38);
  background: rgba(255, 255, 255, 0.58);
  cursor: pointer;
}

.upload-field input {
  width: 100%;
}

.upload-field em {
  color: var(--muted);
  font-style: normal;
  font-weight: 800;
  word-break: break-all;
}

.submit-status {
  min-height: 44px;
  margin: 0;
  padding: 10px 12px;
  border-radius: 14px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.54);
  line-height: 1.5;
}

.account-meta {
  margin: 0;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.54);
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1.45;
  word-break: break-all;
}

.submit-status:empty {
  display: none;
}

.submit-status[data-kind="success"] {
  color: #28783d;
  background: rgba(117, 205, 120, 0.18);
}

.submit-status[data-kind="warn"] {
  color: #93662f;
  background: rgba(255, 216, 107, 0.24);
}

.submit-button {
  width: 100%;
}

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

.help-grid div {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 14px;
  align-items: center;
}

.sample-tile {
  width: 58px;
  height: 58px;
  font-weight: 950;
  font-size: 1.3rem;
}

.help-grid p {
  margin: 0;
  color: #65758c;
  line-height: 1.6;
  font-weight: 700;
}

.gift-effect {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(2px);
}

.gift-effect.is-playing {
  animation: giftBackdrop 1.45s ease both;
}

.gift-glow {
  position: absolute;
  width: min(76vw, 520px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 216, 107, 0.52), rgba(117, 205, 120, 0.22) 48%, transparent 68%);
  transform: scale(0.5);
  animation: giftGlow 1.2s ease-out both;
}

.gift-title {
  position: absolute;
  left: 50%;
  top: 50%;
  min-width: 9rem;
  border-radius: 30px;
  padding: 18px 34px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--green-dark);
  font-size: clamp(2.6rem, 11vw, 6.2rem);
  font-weight: 950;
  text-align: center;
  line-height: 1.04;
  white-space: nowrap;
  text-shadow: 0 5px 0 rgba(255, 216, 107, 0.55);
  box-shadow: 0 18px 44px rgba(65, 83, 109, 0.18);
  transform: translate(-50%, -50%) scale(0.78);
  opacity: 0;
  animation: giftTitle 1.2s 0.05s cubic-bezier(0.18, 0.9, 0.25, 1.15) both;
}

.gift-box {
  position: absolute;
  left: var(--left);
  bottom: 18vh;
  width: clamp(54px, 12vw, 92px);
  height: clamp(58px, 13vw, 100px);
  transform: translate(-50%, 80px) scale(var(--scale));
  opacity: 0;
  animation: giftPop 1.15s var(--delay) cubic-bezier(0.18, 0.9, 0.25, 1.18) both;
}

.gift-lid,
.gift-body {
  position: absolute;
  left: 0;
  right: 0;
  display: block;
  background:
    linear-gradient(90deg, transparent 42%, rgba(255, 255, 255, 0.85) 42% 58%, transparent 58%),
    linear-gradient(145deg, #ff78a3, #f05e8e);
  border: 3px solid rgba(143, 52, 83, 0.22);
  box-shadow: 0 8px 0 rgba(143, 52, 83, 0.18);
}

.gift-lid {
  top: 0;
  height: 30%;
  border-radius: 12px 12px 8px 8px;
}

.gift-lid::before,
.gift-lid::after {
  content: "";
  position: absolute;
  top: -18px;
  width: 26px;
  height: 20px;
  border: 5px solid #ff78a3;
  border-radius: 50% 50% 0 50%;
  background: transparent;
}

.gift-lid::before {
  left: 18%;
  transform: rotate(-26deg);
}

.gift-lid::after {
  right: 18%;
  transform: scaleX(-1) rotate(-26deg);
}

.gift-body {
  bottom: 0;
  height: 68%;
  border-radius: 8px 8px 14px 14px;
}

.gift-box:nth-of-type(odd) .gift-lid,
.gift-box:nth-of-type(odd) .gift-body {
  background:
    linear-gradient(90deg, transparent 42%, rgba(255, 255, 255, 0.85) 42% 58%, transparent 58%),
    linear-gradient(145deg, #75cd78, #44b464);
}

.gift-box:nth-of-type(3n) .gift-lid,
.gift-box:nth-of-type(3n) .gift-body {
  background:
    linear-gradient(90deg, transparent 42%, rgba(255, 255, 255, 0.88) 42% 58%, transparent 58%),
    linear-gradient(145deg, #ffd86b, #f4a04f);
}

.confetti {
  position: absolute;
  left: var(--left);
  top: -24px;
  width: 12px;
  height: 20px;
  border-radius: 4px;
  background: var(--color);
  opacity: 0;
  transform: translateX(-50%) rotate(0deg);
  animation: confettiFall 1.35s var(--delay) ease-in both;
}

.confetti:nth-of-type(3n) {
  width: 18px;
  height: 10px;
  border-radius: 999px;
}

.confetti:nth-of-type(4n) {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

@keyframes giftBackdrop {
  0% {
    opacity: 0;
  }
  12%,
  74% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes giftGlow {
  0% {
    opacity: 0;
    transform: scale(0.35);
  }
  36% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(1.18);
  }
}

@keyframes giftTitle {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.72);
  }
  28%,
  74% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -52%) scale(0.92);
  }
}

@keyframes giftPop {
  0% {
    opacity: 0;
    transform: translate(-50%, 90px) scale(calc(var(--scale) * 0.7)) rotate(-6deg);
  }
  24% {
    opacity: 1;
    transform: translate(-50%, 0) scale(calc(var(--scale) * 1.06)) rotate(4deg);
  }
  50% {
    opacity: 1;
    transform: translate(-50%, 14px) scale(var(--scale)) rotate(-3deg);
  }
  78% {
    opacity: 1;
    transform: translate(-50%, -8px) scale(var(--scale)) rotate(2deg);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, 40px) scale(calc(var(--scale) * 0.82)) rotate(0deg);
  }
}

@keyframes confettiFall {
  0% {
    opacity: 0;
    transform: translate(-50%, -20px) rotate(0deg);
  }
  12% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--drift)), 105vh) rotate(520deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .gift-effect,
  .gift-glow,
  .gift-title,
  .gift-box,
  .confetti {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media (max-width: 860px) {
  .app-shell {
    padding-left: 14px;
    padding-right: 14px;
  }

  .topbar {
    grid-template-columns: 44px 1fr auto;
  }

  body[data-screen="game"] .app-shell {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    height: 100dvh;
    overflow: hidden;
    padding-top: max(10px, env(safe-area-inset-top));
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }

  body[data-screen="game"] .topbar {
    margin-bottom: 10px;
  }

  .icon-button,
  .close-button {
    width: 44px;
    height: 44px;
  }

  .hero-panel {
    min-height: calc(100dvh - 188px);
    padding: 24px;
  }

  .hero-copy {
    width: min(62%, 420px);
    padding-top: 56px;
  }

  .mascot-card {
    right: 18px;
    bottom: 154px;
    width: min(44vw, 250px);
  }

  .home-actions {
    right: auto;
    left: 24px;
    width: min(220px, calc(100% - 48px));
    gap: 10px;
  }

  .floating-card {
    width: clamp(84px, 16vw, 128px);
  }

  .card-two {
    left: 26%;
  }

  .card-three {
    left: 58%;
  }

  .card-five {
    left: 32%;
  }

  .note-one {
    right: 31%;
    top: 24%;
  }

  .spark-one {
    right: 33%;
    top: 34%;
  }

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

  .screen[data-screen="game"] {
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }

  .question-card,
  .answer-panel {
    border-radius: 22px;
  }

  .answer-panel {
    min-height: 0;
  }

  .image-board {
    grid-template-columns: 1fr 1fr;
  }

  .image-board.is-single {
    grid-template-columns: 1fr;
  }

  .clue-panel {
    min-height: 172px;
  }

  .question-text {
    min-height: auto;
  }

  .answer-panel {
    gap: 14px;
  }
}

@media (max-width: 560px) {
  .topbar {
    grid-template-columns: 42px minmax(0, 1fr) 92px;
    gap: 8px;
  }

  .brand {
    gap: 7px;
  }

  .brand h1 {
    max-width: 100%;
    overflow: hidden;
    font-size: clamp(1.22rem, 5.2vw, 1.45rem);
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .brand .eyebrow {
    font-size: 0.74rem;
  }

  .hero-subtitle {
    width: min(18rem, 70vw);
    margin: 10px auto 0;
    font-size: 0.9rem;
    text-align: center;
  }

  .mascot-card {
    right: 18px;
    bottom: 176px;
    width: min(46vw, 190px);
    opacity: 0.95;
  }

  .hero-panel {
    min-height: calc(100dvh - 184px);
    padding: 18px;
  }

  .hero-copy {
    width: 100%;
    padding-top: 44px;
  }

  .title-sticker {
    width: min(80vw, 300px);
    margin: 0 auto;
  }

  .floating-card {
    width: 78px;
    font-size: 2.35rem;
    border-radius: 24%;
    opacity: 0.9;
  }

  .floating-card span {
    font-size: 0.86rem;
  }

  .card-one {
    left: -34px;
    top: 18px;
  }

  .card-two {
    left: 58%;
    top: -28px;
  }

  .card-three {
    left: 78%;
    top: 68px;
  }

  .card-four {
    right: auto;
    left: -28px;
    top: 48%;
  }

  .card-five {
    left: 42%;
    bottom: -28px;
  }

  .note-one {
    right: 18%;
    top: 35%;
    font-size: 2.8rem;
  }

  .note-two {
    right: 8%;
    bottom: 17%;
    font-size: 4rem;
  }

  .spark-one {
    right: 14%;
    top: 42%;
    transform: scale(0.65);
  }

  .speech-bubble {
    top: -42px;
    right: -10px;
    width: 64px;
    height: 64px;
    font-size: 2.5rem;
  }

  .mascot-face {
    left: 18%;
    top: 38%;
    gap: 8px;
  }

  .mascot-face span {
    width: 46px;
    height: 46px;
    border-width: 7px;
  }

  .home-actions {
    left: 16px;
    right: 16px;
    bottom: 18px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 9px;
    width: min(220px, calc(100% - 32px));
  }

  .home-actions .primary-button,
  .home-actions .secondary-button {
    min-height: 44px;
    min-width: 0;
  }

  .stats-strip {
    gap: 8px;
  }

  .stats-strip div {
    border-radius: 16px;
    padding: 12px 6px;
  }

  .level-grid {
    grid-template-columns: 1fr;
  }

  .question-meta,
  .round-info {
    font-size: 0.86rem;
  }

  .question-card {
    padding: 13px;
  }

  .screen[data-screen="game"] {
    height: 100%;
  }

  .screen[data-screen="game"] .game-layout {
    height: 100%;
    grid-template-rows: minmax(0, 0.92fr) minmax(0, 1.08fr);
    gap: 8px;
  }

  .screen[data-screen="game"] .question-card {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    min-height: 0;
    overflow: hidden;
  }

  .image-board {
    gap: 9px;
    margin: 10px 0;
    min-height: 0;
  }

  .image-board.is-single {
    grid-template-columns: 1fr;
  }

  .clue-panel {
    min-height: 0;
    border-radius: 14px;
  }

  .clue-panel--image {
    align-self: stretch;
  }

  .clue-panel--image img {
    width: 100%;
    height: 100%;
    max-height: none;
    object-fit: contain;
  }

  .clue-art {
    width: 68px;
    height: 68px;
  }

  .clue-art span {
    font-size: 1.95rem;
  }

  .clue-panel strong {
    font-size: 0.96rem;
  }

  .tag-row {
    align-items: flex-start;
  }

  .progress-dots {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .guess-history {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    gap: 7px;
    padding: 0 0 8px;
  }

  .answer-panel {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto auto auto auto auto;
    align-content: stretch;
    gap: 8px;
    min-height: 0;
    overflow: hidden;
    padding: 12px;
  }

  .guess-row {
    grid-template-columns: 3.6rem 1fr;
    gap: 8px;
  }

  .guess-cells {
    grid-template-columns: repeat(var(--answer-length), minmax(0, 1fr));
    gap: 6px;
  }

  .guess-cell {
    border-radius: 13px;
  }

  .guess-cell strong {
    font-size: 1.25rem;
  }

  .guess-cell small {
    font-size: 0.58rem;
  }

  .current-answer-slots {
    grid-template-columns: repeat(var(--answer-length), minmax(0, 1fr));
    justify-content: center;
    min-height: 54px;
    gap: 6px;
  }

  .current-slot {
    border-radius: 13px;
    max-height: 54px;
  }

  .input-row {
    grid-template-columns: minmax(0, 1fr) 88px;
    gap: 8px;
  }

  .input-row input,
  .accent-button,
  .tool-button {
    min-height: 40px;
    height: 40px;
    border-radius: 14px;
  }

  .action-row {
    gap: 8px;
  }

  .hint-feedback {
    min-height: 42px;
    padding: 10px 12px;
  }

  .feedback {
    min-height: 42px;
    padding: 10px 12px;
  }

  .hint-feedback:empty,
  .feedback:empty {
    display: none;
  }

  body.is-answer-focused {
    overflow: hidden;
  }

  body.is-answer-focused .app-shell {
    grid-template-rows: minmax(0, 1fr);
    height: var(--app-viewport-height, 100dvh);
    min-height: var(--app-viewport-height, 100dvh);
    padding-top: max(8px, env(safe-area-inset-top));
    padding-bottom: 8px;
  }

  body.is-answer-focused .topbar,
  body.is-answer-focused .screen[data-screen="game"] .question-card {
    display: none;
  }

  body.is-answer-focused .screen[data-screen="game"] .game-layout {
    grid-template-rows: minmax(0, 1fr);
    gap: 0;
  }

  body.is-answer-focused .answer-panel {
    min-height: 0;
    height: min(100%, calc(var(--app-viewport-height, 100dvh) - 16px));
    border-radius: 20px;
    grid-template-rows: auto minmax(92px, 1fr) auto auto auto auto auto;
    padding: 14px;
  }

  body.is-answer-focused .guess-history {
    min-height: 92px;
    border-bottom-width: 2px;
  }

  body.is-answer-focused .current-answer-slots {
    min-height: 52px;
  }

  body.is-answer-focused .current-slot {
    max-height: 52px;
  }

  body.is-answer-focused .hint-feedback,
  body.is-answer-focused .feedback {
    max-height: 60px;
    overflow: auto;
  }

  .rating-row {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .help-grid {
    grid-template-columns: 1fr;
  }

  .help-grid div {
    grid-template-columns: 54px 1fr;
  }

  .modal-backdrop {
    padding: 14px;
  }

  .modal-card {
    padding: 22px 18px;
  }

  .modal-card h2 {
    font-size: 1.55rem;
    margin-bottom: 18px;
  }

  .submit-form input[type="text"] {
    height: 48px;
  }

  .submit-form textarea {
    min-height: 72px;
  }

  .sample-tile {
    width: 50px;
    height: 50px;
  }
}

@media (max-width: 380px) {
  .app-shell {
    padding-left: 10px;
    padding-right: 10px;
  }

  body[data-screen="game"] .app-shell {
    padding-left: 8px;
    padding-right: 8px;
  }

  .topbar {
    gap: 8px;
  }

  .topbar-actions {
    gap: 6px;
  }

  .brand-logo {
    width: 1.86rem;
    height: 1.86rem;
  }

  .brand h1 {
    font-size: 1.22rem;
  }

  .hero-panel {
    padding: 20px;
  }

  .hero-subtitle {
    max-width: 16rem;
  }

  .mascot-card {
    width: 142px;
    bottom: 176px;
  }

  .question-meta {
    display: grid;
    gap: 3px;
  }

  .screen[data-screen="game"] .game-layout {
    grid-template-rows: minmax(0, 0.88fr) minmax(0, 1.12fr);
    gap: 7px;
  }

  .screen[data-screen="game"] .question-card {
    padding: 10px;
  }

  .answer-panel {
    gap: 7px;
    padding: 10px;
  }

  .round-info,
  .question-meta {
    font-size: 0.78rem;
  }

  .tag-row {
    margin-top: 6px;
  }

  .type-tag {
    min-height: 30px;
    padding: 0 11px;
    font-size: 0.82rem;
  }

  .current-answer-slots {
    min-height: 48px;
  }

  .current-slot {
    max-height: 48px;
  }

  .current-slot strong,
  .guess-cell strong {
    font-size: 1.12rem;
  }

  .input-row {
    grid-template-columns: minmax(0, 1fr) 78px;
    gap: 7px;
  }

  .input-row input,
  .accent-button,
  .tool-button {
    min-height: 38px;
    height: 38px;
  }

  .input-row input {
    padding: 0 12px;
  }

  .action-row {
    gap: 7px;
  }

  body.is-answer-focused .answer-panel {
    border-radius: 18px;
    padding: 10px;
    grid-template-rows: auto minmax(80px, 1fr) auto auto auto auto auto;
  }

  body.is-answer-focused .guess-history {
    min-height: 80px;
  }

  body.is-answer-focused .current-answer-slots {
    min-height: 46px;
  }

  body.is-answer-focused .current-slot {
    max-height: 46px;
  }
}
