:root {
  --ink: #27463e;
  --muted: #678178;
  --cream: #fffaf0;
  --paper: #f8efd9;
  --mint: #dff6e9;
  --mint-dark: #5a9b7e;
  --coral: #ff936e;
  --sun: #ffd978;
  --blue: #dff0ff;
  --line: #e5d5bb;
  --shadow: 0 16px 36px rgba(68, 78, 57, 0.12);
  font-family: "Trebuchet MS", "Arial", sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 8% 4%, rgba(255, 255, 255, 0.86) 0 4px, transparent 5px),
    radial-gradient(circle at 91% 18%, rgba(255, 255, 255, 0.75) 0 3px, transparent 4px),
    linear-gradient(145deg, #f8efdc, #fff9eb 42%, #e9f8ec);
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.app {
  width: min(1120px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px 0 42px;
}

.loading-card,
.panel,
.menu-card,
.category-card,
.family-card,
.setup-card,
.result-card,
.game-stage {
  border: 2px solid rgba(226, 205, 171, 0.9);
  box-shadow: var(--shadow);
}

.loading-card {
  width: min(380px, 100%);
  margin: 24vh auto 0;
  padding: 44px 28px;
  border-radius: 32px;
  text-align: center;
  background: var(--cream);
}

.loading-star {
  display: inline-block;
  color: var(--coral);
  font-size: 46px;
  animation: bob 1.5s ease-in-out infinite;
}

.topbar,
.screen-heading,
.game-top,
.collection-top,
.category-header,
.result-actions,
.choice-row,
.setting-row,
.player-score {
  display: flex;
  align-items: center;
}

.topbar,
.game-top,
.collection-top,
.category-header {
  justify-content: space-between;
  gap: 14px;
}

.topbar { margin-bottom: 24px; }

.brand,
.back-button,
.collection-link,
.ghost-button,
.primary-button,
.mode-button,
.chip,
.choice-card,
.category-card,
.family-card {
  border: 0;
  text-decoration: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-size: clamp(22px, 4vw, 31px);
  font-weight: 800;
}

.brand-mark,
.icon-bubble {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border: 2px solid rgba(72, 132, 104, 0.32);
  border-radius: 19px 15px 21px 14px;
  background: var(--mint);
  box-shadow: 0 5px 0 rgba(71, 132, 103, 0.1);
  font-size: 29px;
  transform: rotate(-3deg);
}

.collection-link,
.back-button,
.ghost-button {
  padding: 11px 15px;
  border: 2px solid #d3e7d9;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.75);
  font-weight: 800;
}

.collection-link small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.hero,
.collection-hero {
  position: relative;
  overflow: hidden;
  padding: clamp(26px, 5vw, 50px);
  border: 2px solid #d3eadc;
  border-radius: 38px;
  background: linear-gradient(125deg, #e5faed, #fdfdf5 65%, #ffecd2);
  box-shadow: var(--shadow);
}

.hero::after,
.collection-hero::after {
  position: absolute;
  right: -18px;
  bottom: -32px;
  width: 170px;
  height: 170px;
  border: 18px solid rgba(255, 209, 113, 0.34);
  border-radius: 50%;
  content: "";
}

.eyebrow {
  margin: 0 0 9px;
  color: #598a72;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }

h1 {
  max-width: 650px;
  margin-bottom: 12px;
  font-size: clamp(34px, 6vw, 58px);
  line-height: 0.98;
}

h2 {
  margin-bottom: 8px;
  font-size: clamp(28px, 4vw, 38px);
}

h3 { margin-bottom: 6px; }

.hero p:not(.eyebrow),
.collection-hero p:not(.eyebrow) {
  max-width: 550px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.45;
}

.mode-grid,
.category-grid,
.family-grid,
.choice-grid {
  display: grid;
  gap: 18px;
}

.mode-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 24px;
}

.menu-card {
  position: relative;
  min-height: 230px;
  padding: 24px;
  overflow: hidden;
  border-radius: 29px;
  background: var(--cream);
  text-align: left;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.menu-card:hover,
.menu-card:focus-visible,
.category-card:hover,
.family-card:hover,
.choice-card:hover,
.chip:hover {
  transform: translateY(-4px) rotate(-0.4deg);
  box-shadow: 0 18px 34px rgba(68, 78, 57, 0.16);
}

.menu-card.classic { background: linear-gradient(150deg, #fffef9, #ffeecf); }
.menu-card.timer { background: linear-gradient(150deg, #fff9e4, #ffe3bd); }
.menu-card.silhouette { background: linear-gradient(150deg, #eaf4ff, #dcefff); }
.menu-card.duo { background: linear-gradient(150deg, #f6eaff, #efe1ff); }

.mode-icon {
  display: grid;
  width: 64px;
  height: 64px;
  margin-bottom: 20px;
  place-items: center;
  border-radius: 22px 18px 23px 16px;
  background: rgba(255, 255, 255, 0.72);
  font-size: 34px;
}

.menu-card p,
.category-card p,
.family-card p {
  color: var(--muted);
  line-height: 1.4;
}

.mode-button,
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 18px;
  border-radius: 16px;
  background: var(--ink);
  color: white;
  font-weight: 900;
  transition: transform 160ms ease, background 160ms ease;
}

.mode-button { margin-top: 10px; }
.primary-button { background: #34795e; }
.primary-button:hover, .mode-button:hover { background: #173b31; transform: translateY(-2px); }

.collection-callout {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  margin-top: 24px;
  padding: 20px 24px;
  border: 2px solid #d8d1ef;
  border-radius: 26px;
  background: #fbf9ff;
  box-shadow: var(--shadow);
}

.collection-callout h2 { margin: 0 0 3px; font-size: 23px; }
.collection-callout p { margin: 0; color: var(--muted); }
.collection-callout .icon-bubble { background: #eee4ff; border-color: #d7c5f5; }

.panel {
  margin-top: 18px;
  padding: clamp(22px, 4vw, 34px);
  border-radius: 30px;
  background: rgba(255, 253, 247, 0.9);
}

.screen-heading { justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.screen-heading p { margin: 0; color: var(--muted); }

.progress-wrap { min-width: min(250px, 100%); }
.progress-label { display: flex; justify-content: space-between; gap: 14px; margin-bottom: 7px; font-size: 14px; font-weight: 900; }
.progress-bar { height: 14px; overflow: hidden; border-radius: 99px; background: #e6ece5; }
.progress-bar > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #84cda7, #ffd671); transition: width 400ms ease; }

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

.category-card {
  position: relative;
  min-height: 185px;
  padding: 17px;
  overflow: hidden;
  border: 2px solid #e5d7be;
  border-radius: 24px;
  background: #fffdf8;
  text-align: left;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.category-card.completed {
  border-color: #8ec8a9;
  background: linear-gradient(145deg, #effff4, #fff9de);
}

.category-art {
  display: block;
  width: 100%;
  height: 92px;
  margin-bottom: 10px;
  object-fit: contain;
}

.locked-art { filter: brightness(0) opacity(0.23); }
.category-card h3 { font-size: 18px; }
.category-card p { margin-bottom: 0; font-size: 14px; }
.completion-stamp {
  position: absolute;
  top: 13px;
  right: 10px;
  padding: 5px 8px;
  border: 2px solid #64a97f;
  border-radius: 10px;
  color: #4c916b;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transform: rotate(7deg);
}

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

.family-card {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  min-height: 230px;
  padding: 18px;
  border: 2px solid #e8dac3;
  border-radius: 25px;
  background: #fffefa;
  text-align: center;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.family-card.locked { background: #f4f0e8; }
.family-art { width: 100%; height: 130px; object-fit: contain; }
.family-name { grid-column: 1 / -1; margin: 0; font-size: 16px; font-weight: 900; }
.family-lock {
  position: absolute;
  top: 12px;
  right: 13px;
  color: #8c9992;
  font-size: 18px;
}

.setup-card,
.result-card {
  width: min(660px, 100%);
  margin: 32px auto;
  padding: clamp(27px, 5vw, 44px);
  border-radius: 34px;
  background: #fffdf8;
  text-align: center;
}

.setup-card p,
.result-card p { color: var(--muted); line-height: 1.45; }
.setting-row { justify-content: center; flex-wrap: wrap; gap: 10px; margin: 26px 0; }
.setting-label { width: 100%; margin-bottom: 2px; font-weight: 900; }

.chip {
  min-width: 74px;
  padding: 11px 16px;
  border: 2px solid #e1d4c2;
  border-radius: 15px;
  background: white;
  font-weight: 900;
}

.chip.active { border-color: #5a9b7e; background: var(--mint); color: #245f48; }

.game-stage {
  min-height: 670px;
  padding: clamp(16px, 4vw, 32px);
  border-radius: 34px;
  background: rgba(255, 253, 247, 0.96);
}

.game-top { padding-bottom: 17px; border-bottom: 2px dashed #e9dcc8; }
.game-top h2 { margin: 0; font-size: 21px; }
.game-top p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.game-status { display: flex; align-items: center; gap: 10px; font-weight: 900; }
.timer-badge { padding: 9px 12px; border-radius: 13px; background: #ffead5; color: #a34d2f; }

.prompt-area { padding: 26px 0 16px; text-align: center; }
.prompt-area h1 { max-width: none; margin: 0 0 4px; font-size: clamp(27px, 4vw, 38px); }
.prompt-area p { color: var(--muted); }
.baby-card {
  width: min(255px, 75vw);
  height: 245px;
  margin: 12px auto 5px;
  padding: 14px;
  border: 2px solid #eadfcf;
  border-radius: 32px 25px 30px 23px;
  background: linear-gradient(150deg, #fff, #fff5dd);
}

.baby-card img { width: 100%; height: 100%; object-fit: contain; }
.choice-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 850px; margin: 0 auto; }

.choice-card {
  min-height: 205px;
  padding: 11px;
  border: 2px solid #e5d6c0;
  border-radius: 25px;
  background: white;
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.choice-card:hover { border-color: #78b998; }
.choice-card:disabled { cursor: default; opacity: 0.75; }
.choice-card.correct { border-color: #50a875; background: #edfff2; }
.choice-card.wrong { border-color: #ee8b70; background: #fff0e9; }
.choice-card img { width: 100%; height: 145px; object-fit: contain; }
.choice-card span { display: block; min-height: 32px; font-size: 14px; font-weight: 900; }
.choice-card .silhouette { filter: brightness(0) opacity(0.7); }

.feedback {
  min-height: 29px;
  margin: 16px 0 0;
  text-align: center;
  color: #3d8460;
  font-weight: 900;
}

.player-score { justify-content: center; gap: 8px; margin: 14px 0 -4px; }
.player-pill { padding: 8px 12px; border-radius: 999px; background: #edf0ea; font-size: 13px; font-weight: 900; }
.player-pill.active { background: #ffdf91; }

.result-emoji { display: inline-grid; width: 90px; height: 90px; margin-bottom: 18px; place-items: center; border-radius: 32px; background: #fff0bf; font-size: 54px; transform: rotate(-4deg); }
.result-actions { justify-content: center; flex-wrap: wrap; gap: 10px; margin-top: 25px; }

.celebration {
  position: fixed;
  z-index: 4;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(39, 70, 62, 0.38);
  animation: appear 180ms ease;
}

.celebration-card {
  position: relative;
  width: min(460px, 100%);
  padding: 46px 30px 32px;
  overflow: hidden;
  border: 3px solid #f5cc5f;
  border-radius: 34px;
  background: #fffdf5;
  box-shadow: 0 22px 55px rgba(22, 42, 34, 0.25);
  text-align: center;
}

.celebration-card::before,
.celebration-card::after {
  position: absolute;
  color: #ffb845;
  content: "✦";
  font-size: 36px;
  animation: sparkle 1000ms ease-in-out infinite alternate;
}

.celebration-card::before { top: 18px; left: 24px; }
.celebration-card::after { right: 28px; bottom: 24px; animation-delay: 240ms; }
.celebration-card h2 { margin: 10px 0 8px; }
.celebration-card p { color: var(--muted); }

.confetti { position: absolute; inset: 0; pointer-events: none; }
.confetti i { position: absolute; width: 10px; height: 22px; border-radius: 6px; background: var(--coral); animation: fall 1.2s ease-in infinite; }
.confetti i:nth-child(2n) { background: #82caa3; animation-delay: 0.2s; }
.confetti i:nth-child(3n) { background: #ffd36b; animation-delay: 0.45s; }
.confetti i:nth-child(1) { left: 11%; top: -15px; }
.confetti i:nth-child(2) { left: 26%; top: -35px; }
.confetti i:nth-child(3) { left: 47%; top: -10px; }
.confetti i:nth-child(4) { left: 72%; top: -30px; }
.confetti i:nth-child(5) { left: 88%; top: -18px; }

@keyframes bob { 50% { transform: translateY(-8px) rotate(12deg); } }
@keyframes appear { from { opacity: 0; } to { opacity: 1; } }
@keyframes sparkle { to { transform: rotate(25deg) scale(1.2); } }
@keyframes fall { 70% { transform: translateY(370px) rotate(230deg); } 100% { opacity: 0; } }

@media (max-width: 760px) {
  .app { width: min(100% - 20px, 610px); padding-top: 12px; }
  .topbar { align-items: flex-start; }
  .collection-link { padding: 9px 10px; font-size: 13px; }
  .mode-grid, .family-grid { grid-template-columns: 1fr; }
  .category-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
  .collection-callout { grid-template-columns: auto 1fr; }
  .collection-callout .mode-button { grid-column: 1 / -1; width: 100%; }
  .game-stage { min-height: 0; }
  .choice-grid { gap: 8px; }
  .choice-card { min-height: 140px; padding: 5px; border-radius: 17px; }
  .choice-card img { height: 96px; }
  .choice-card span { font-size: 11px; }
  .baby-card { height: 195px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 1ms !important; transition-duration: 1ms !important; }
}
