:root {
  /* Core palette (cream/peach + soft orange) */
  --bg:           #fdf3e3;
  --bg-soft:      #fef8ec;
  --card:         #ffffff;
  --ink:          #2c2c44;
  --ink-soft:     #8a8aa3;
  --ink-muted:    #c4c4d0;

  --orange:       #f5a623;
  --orange-dark:  #d68910;
  --orange-soft:  #ffd9b3;

  /* Pastel accents (category & choice tiles) */
  --pastel-green:    #c4e7c8;
  --pastel-green-d:  #7cc485;
  --pastel-yellow:   #fef0c4;
  --pastel-yellow-d: #f5d36e;
  --pastel-orange:   #ffd9c2;
  --pastel-orange-d: #f5a06b;
  --pastel-purple:   #ddd0f7;
  --pastel-purple-d: #9c84e0;
  --pastel-blue:     #cae4f5;
  --pastel-blue-d:   #5fa5d4;
  --pastel-pink:     #ffd1e0;
  --pastel-pink-d:   #f08fb6;

  /* Strong choice-tile colors (matches reference letter tiles) */
  --tile-purple:  #a78bfa;
  --tile-purple-soft: #ede4ff;
  --tile-green:   #82d49a;
  --tile-green-soft: #def5e3;
  --tile-yellow:  #fcd34d;
  --tile-yellow-soft: #fff4cc;
  --tile-gray:    #d1d5db;
  --tile-gray-soft: #f3f4f6;
  --tile-orange:  #f5a623;
  --tile-orange-soft: #ffe4c2;
  --tile-pink:    #f08fb6;
  --tile-pink-soft: #ffe0eb;

  --green:        #5bd16a;
  --red:          #ff6b6b;

  --shadow-sm:    0 2px 8px rgba(70,30,0,0.06);
  --shadow-md:    0 8px 24px rgba(70,30,0,0.08);
  --shadow-lg:    0 16px 40px rgba(245,166,35,0.18);
  --shadow-press: 0 4px 0 var(--orange-dark);

  --radius-sm:    12px;
  --radius-md:    20px;
  --radius-lg:    28px;
  --radius-xl:    36px;
  --radius-2xl:   44px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: 'Fredoka', 'Nunito', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  padding: 1.25rem 1rem 1.5rem;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  font-size: 16px;
}
body.has-bottom-nav {
  padding-bottom: calc(96px + env(safe-area-inset-bottom));
}

button, a { font-family: inherit; cursor: pointer; border: none; text-decoration: none; color: inherit; }
button { background: transparent; }

/* ===== Icons (Fluent 3D PNG via <img>) ===== */
.icon {
  width: 1em;
  height: 1em;
  display: inline-block;
  vertical-align: middle;
  object-fit: contain;
  /* PNGs are color-baked; can't inherit currentColor */
}
img.icon { background: transparent; }
.icon-xs { width: 16px; height: 16px; }
.icon-sm { width: 22px; height: 22px; }
.icon-md { width: 32px; height: 32px; }
.icon-lg { width: 48px; height: 48px; }
.icon-xl { width: 72px; height: 72px; }
.icon-2xl { width: 96px; height: 96px; }
.icon-3xl { width: 140px; height: 140px; }

/* ===== App shell ===== */
.app {
  max-width: 460px;
  margin: 0 auto;
}
.app-wide { max-width: 1200px; margin: 0 auto; }

/* ===== Greeting card (dashboard) ===== */
.greeting-card {
  background: var(--card);
  border-radius: var(--radius-2xl);
  padding: 1.5rem 1.25rem 1.5rem;
  box-shadow: var(--shadow-md);
  text-align: center;
  margin-bottom: 1.25rem;
}
.greeting-card .salute {
  color: var(--ink-soft);
  font-weight: 500;
  font-size: 1rem;
}
.greeting-card .name {
  color: var(--orange);
  font-weight: 800;
  font-size: 1.7rem;
  margin-top: 0.1rem;
  letter-spacing: 0.3px;
}
.greeting-card .subtitle {
  margin-top: 0.6rem;
  color: var(--ink-soft);
  font-size: 0.85rem;
}
.greeting-card .edit-name {
  margin-top: 0.6rem;
  background: var(--bg-soft);
  color: var(--ink-soft);
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: background .15s;
}
.greeting-card .edit-name:hover { background: var(--pastel-orange); color: var(--ink); }

/* ===== Section headings ===== */
.section {
  margin-bottom: 1.5rem;
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  padding: 0 0.25rem;
  gap: 0.5rem;
}
.section-head h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.2px;
}
.section-head a.see-all {
  font-size: 0.78rem;
  color: var(--orange);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  white-space: nowrap;
}

/* Category section header (icon + title + count) */
.cat-section-head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 0.5rem 0.25rem 0.75rem;
}
.cat-section-head .cat-mini {
  width: 42px; height: 42px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}
.cat-section-head .cat-mini .icon { width: 30px; height: 30px; }
.cat-section-head .cat-mini.cat-green  { background: var(--pastel-green); }
.cat-section-head .cat-mini.cat-yellow { background: var(--pastel-yellow); }
.cat-section-head .cat-mini.cat-orange { background: var(--pastel-orange); }
.cat-section-head .cat-mini.cat-purple { background: var(--pastel-purple); }
.cat-section-head .cat-mini.cat-pink   { background: var(--pastel-pink); }
.cat-section-head .cat-titles { flex: 1; min-width: 0; }
.cat-section-head .cat-titles h2 {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--ink);
}
.cat-section-head .cat-titles p {
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin-top: 0.1rem;
}

/* ===== Featured strip (horizontal scroll) ===== */
.featured-strip {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding: 0.25rem 0.25rem 0.5rem;
  margin: 0 -0.25rem;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.featured-strip::-webkit-scrollbar { display: none; }

.featured-card {
  flex: 0 0 78%;
  scroll-snap-align: start;
  background: var(--card);
  border-radius: var(--radius-xl);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  gap: 0.85rem;
  align-items: center;
  min-height: 110px;
  transition: transform .15s ease, box-shadow .15s ease;
}
.featured-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.featured-card .feat-icon {
  width: 84px; height: 84px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.featured-card .feat-icon .icon { width: 64px; height: 64px; }
.featured-card .feat-body { flex: 1; min-width: 0; }
.featured-card .feat-cat {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--orange);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.25rem;
}
.featured-card .feat-title {
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--ink);
  line-height: 1.2;
  margin-bottom: 0.35rem;
}
.featured-card .feat-meta {
  font-size: 0.75rem;
  color: var(--ink-soft);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.featured-card .feat-meta .icon { width: 14px; height: 14px; }

/* ===== Category grid ===== */
.category-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.85rem;
}
.cat-card {
  border-radius: var(--radius-xl);
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  min-height: 160px;
  box-shadow: var(--shadow-sm);
  transition: transform .15s ease, box-shadow .15s ease;
  position: relative;
  overflow: hidden;
}
.cat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.cat-card .cat-icon {
  width: 64px; height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.5rem;
}
.cat-card .cat-icon .icon { width: 56px; height: 56px; }
.cat-card .cat-title { font-weight: 800; font-size: 1.05rem; color: var(--ink); }
.cat-card .cat-sub { font-size: 0.78rem; color: var(--ink-soft); margin-top: 0.15rem; }

/* Category color variants */
.cat-green  { background: var(--pastel-green); }
.cat-green  .cat-title { color: var(--pastel-green-d); }
.cat-yellow { background: var(--pastel-yellow); }
.cat-yellow .cat-title { color: var(--orange-dark); }
.cat-orange { background: var(--pastel-orange); }
.cat-orange .cat-title { color: var(--pastel-orange-d); }
.cat-purple { background: var(--pastel-purple); }
.cat-purple .cat-title { color: var(--pastel-purple-d); }
.cat-blue   { background: var(--pastel-blue); }
.cat-blue   .cat-title { color: var(--pastel-blue-d); }
.cat-pink   { background: var(--pastel-pink); }
.cat-pink   .cat-title { color: var(--pastel-pink-d); }

/* ===== Category list page (drill-in) ===== */
.cat-hero {
  background: var(--card);
  border-radius: var(--radius-2xl);
  padding: 1.25rem;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.cat-hero .cat-hero-icon {
  width: 80px; height: 80px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.cat-hero .cat-hero-icon .icon { width: 64px; height: 64px; }
.cat-hero h1 { font-size: 1.4rem; font-weight: 800; }
.cat-hero p  { font-size: 0.8rem; color: var(--ink-soft); margin-top: 0.2rem; }

.game-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.85rem;
}
.game-tile {
  background: var(--card);
  border-radius: var(--radius-xl);
  padding: 1rem 0.85rem 1.1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  box-shadow: var(--shadow-sm);
  text-align: center;
  transition: transform .15s ease, box-shadow .15s ease;
  position: relative;
}
.game-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.game-tile .tile-thumb {
  width: 100%;
  aspect-ratio: 1/1;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-soft);
}
.game-tile .tile-thumb .icon { width: 70%; height: 70%; }
.game-tile .tile-title {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--ink);
  line-height: 1.25;
}
.game-tile.soon { opacity: 0.7; }
.game-tile.soon::after {
  content: 'Coming soon';
  position: absolute;
  top: 8px; right: 8px;
  background: var(--ink-muted);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  letter-spacing: 0.3px;
}

/* ===== Tile thumb background variants ===== */
.thumb-green  { background: var(--pastel-green) !important; }
.thumb-yellow { background: var(--pastel-yellow) !important; }
.thumb-orange { background: var(--pastel-orange) !important; }
.thumb-purple { background: var(--pastel-purple) !important; }
.thumb-blue   { background: var(--pastel-blue) !important; }
.thumb-pink   { background: var(--pastel-pink) !important; }

/* ===== Game page (in-game) ===== */
.game-shell {
  max-width: 460px;
  margin: 0 auto;
  background: var(--card);
  border-radius: var(--radius-2xl);
  padding: 1.25rem 1.1rem 2rem;
  box-shadow: var(--shadow-md);
  min-height: 92vh;
  display: flex;
  flex-direction: column;
}
.game-topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  margin-bottom: 1rem;
  gap: 0.5rem;
}
.game-topbar .right { display: flex; justify-content: flex-end; }
.icon-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-soft);
  color: var(--ink);
  transition: background .15s, transform .12s;
}
.icon-btn:hover { background: var(--pastel-orange); }
.icon-btn:active { transform: scale(0.9); }
.icon-btn .icon { width: 24px; height: 24px; }

.level-pill {
  background: transparent;
  color: var(--ink);
  font-weight: 700;
  font-size: 1.1rem;
  padding: 0.4rem 1rem;
  border-radius: 999px;
}

.hearts {
  display: flex;
  gap: 0.3rem;
  align-items: center;
  justify-content: flex-end;
}
.heart { width: 26px; height: 26px; transition: opacity .2s; }
.heart.lost { opacity: 0.25; filter: grayscale(1); }

.game-title {
  text-align: center;
  color: var(--ink);
  font-weight: 800;
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  line-height: 1.2;
}
.game-prompt {
  text-align: center;
  color: var(--ink-soft);
  font-size: 1.05rem;
  margin-bottom: 1.1rem;
  line-height: 1.4;
}

/* Big illustration card */
.hero-card {
  background: var(--bg-soft);
  border-radius: var(--radius-2xl);
  padding: 1.75rem 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  min-height: 230px;
  position: relative;
}
.hero-card .hero-illust { width: 170px; height: 170px; }
.hero-card .hero-illust.sm { width: 120px; height: 120px; }
.hero-card .hero-caption {
  margin-top: 0.6rem;
  font-weight: 800;
  font-size: 1.6rem;
  letter-spacing: 0.4em;
  color: var(--ink);
}

/* Pastel choice tiles (reference letter tiles) */
.choice-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
  margin: 0 auto 1rem;
  width: 100%;
}
.choice-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.choice-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }

.choice-tile {
  --tile-c: var(--tile-gray);
  --tile-s: var(--tile-gray-soft);
  background: var(--tile-s);
  color: var(--ink);
  font-weight: 800;
  font-size: 2rem;
  border-radius: var(--radius-md);
  aspect-ratio: 1/1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px dashed transparent;
  transition: transform .12s ease, background .15s, border-color .15s, color .15s;
  position: relative;
  cursor: pointer;
  min-height: 70px;
}
.choice-tile:hover { transform: translateY(-2px); }
.choice-tile.active,
.choice-tile.picked {
  background: var(--tile-c);
  color: #fff;
  border-color: rgba(255,255,255,0.7);
}
.choice-tile.correct {
  background: var(--tile-green) !important;
  color: #fff;
  border-color: rgba(255,255,255,0.7);
  animation: pop .35s ease;
}
.choice-tile.wrong {
  background: var(--tile-pink) !important;
  color: #fff;
  border-color: rgba(255,255,255,0.7);
  animation: shake .35s ease;
}
.choice-tile.tone-purple { --tile-c: var(--tile-purple); --tile-s: var(--tile-purple-soft); }
.choice-tile.tone-green  { --tile-c: var(--tile-green);  --tile-s: var(--tile-green-soft); }
.choice-tile.tone-yellow { --tile-c: var(--tile-yellow); --tile-s: var(--tile-yellow-soft); color: var(--ink); }
.choice-tile.tone-orange { --tile-c: var(--tile-orange); --tile-s: var(--tile-orange-soft); }
.choice-tile.tone-pink   { --tile-c: var(--tile-pink);   --tile-s: var(--tile-pink-soft); }
.choice-tile.tone-blue   { --tile-c: var(--pastel-blue-d); --tile-s: var(--pastel-blue); }

.choice-tile:disabled { cursor: not-allowed; opacity: 0.6; }

/* ===== CTA (orange Next button) ===== */
.cta-row { display: flex; justify-content: center; gap: 0.6rem; margin-top: auto; padding-top: 0.5rem; }
.cta {
  background: var(--orange);
  color: #fff;
  font-weight: 800;
  padding: 1.1rem 2.4rem;
  border-radius: 999px;
  font-size: 1.15rem;
  letter-spacing: 0.5px;
  box-shadow: var(--shadow-press);
  transition: transform .1s, box-shadow .1s, background .15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-width: 240px;
  text-align: center;
}
.cta:hover { background: #ff9c00; }
.cta:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--orange-dark); }
.cta:disabled { background: var(--ink-muted); box-shadow: 0 4px 0 #a8a8b8; cursor: not-allowed; opacity: 0.8; }

.cta-secondary {
  background: var(--bg-soft);
  color: var(--ink);
  box-shadow: 0 4px 0 #e0d4be;
}
.cta-secondary:hover { background: var(--pastel-orange); }
.cta-secondary:active { box-shadow: 0 1px 0 #e0d4be; }

.cta .icon { width: 18px; height: 18px; }

/* ===== Numpad ===== */
.numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  max-width: 340px;
  margin: 0 auto 1rem;
  width: 100%;
}
.numpad button {
  background: var(--bg-soft);
  border-radius: var(--radius-md);
  padding: 1.1rem 0;
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--ink);
  transition: transform .1s, background .15s;
  border: 3px dashed transparent;
  min-height: 64px;
}
.numpad button:hover { background: var(--pastel-orange); transform: translateY(-2px); }
.numpad button.num-zero { grid-column: 2; }
.numpad button:disabled { cursor: not-allowed; opacity: 0.6; }
.numpad button.correct { background: var(--tile-green); color: #fff; animation: pop .35s ease; }
.numpad button.wrong   { background: var(--tile-pink); color: #fff; animation: shake .35s ease; }
.numpad button .icon { width: 28px; height: 28px; vertical-align: middle; }

.answer-display {
  font-size: 3.2rem;
  font-weight: 800;
  background: var(--bg-soft);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  margin: 0.4rem auto 1.1rem;
  max-width: 220px;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  letter-spacing: 0.1em;
}

/* ===== Feedback ===== */
.feedback {
  text-align: center;
  font-weight: 700;
  font-size: 1.1rem;
  min-height: 1.4em;
  margin: 0.6rem 0;
  color: var(--ink-soft);
}
.feedback.win  { color: var(--pastel-green-d); }
.feedback.lose { color: var(--red); }

/* ===== Toast ===== */
.toast {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%) translateY(-200%);
  background: var(--ink);
  color: #fff;
  padding: 0.85rem 1.4rem;
  border-radius: 999px;
  font-weight: 700;
  z-index: 1000;
  transition: transform .3s cubic-bezier(.34,1.6,.64,1);
  box-shadow: var(--shadow-md);
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.win  { background: var(--pastel-green-d); }
.toast.lose { background: var(--red); }

/* ===== Summary overlay (sunburst + badge) ===== */
.summary-overlay {
  position: fixed; inset: 0;
  background: rgba(254,245,231,0.88);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 999;
  backdrop-filter: blur(6px);
}
.summary-overlay.show { display: flex; }
.summary-card {
  background: var(--card);
  border-radius: var(--radius-2xl);
  padding: 2rem 1.5rem;
  max-width: 380px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: pop .35s ease;
  position: relative;
  overflow: hidden;
}
.summary-card h2 {
  color: var(--orange);
  font-size: 1.6rem;
  font-weight: 800;
}
.summary-card .sub { color: var(--ink-soft); margin-top: 0.3rem; font-size: 0.9rem; }
.summary-card .badge-wrap {
  position: relative;
  width: 180px; height: 180px;
  margin: 1.4rem auto 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.summary-card .badge-rays {
  position: absolute; inset: -20px;
  background:
    conic-gradient(from 0deg,
      #ffe6c2 0deg 30deg, transparent 30deg 60deg,
      #ffe6c2 60deg 90deg, transparent 90deg 120deg,
      #ffe6c2 120deg 150deg, transparent 150deg 180deg,
      #ffe6c2 180deg 210deg, transparent 210deg 240deg,
      #ffe6c2 240deg 270deg, transparent 270deg 300deg,
      #ffe6c2 300deg 330deg, transparent 330deg 360deg);
  border-radius: 50%;
  mask: radial-gradient(circle, transparent 38%, #000 38%);
  -webkit-mask: radial-gradient(circle, transparent 38%, #000 38%);
  animation: spinSlow 18s linear infinite;
}
.summary-card .badge-circle {
  position: relative;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: var(--bg-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 4px solid #fff;
  box-shadow: 0 8px 24px rgba(245,166,35,0.25);
}
.summary-card .badge-circle .icon { width: 80px; height: 80px; }
.summary-card .badge-ribbon {
  position: absolute;
  bottom: -10px;
  width: 50px;
  height: 30px;
  background: var(--orange);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 70%, 0 100%);
}
.summary-card .stars {
  margin: 0.4rem 0 0.6rem;
  display: flex;
  gap: 0.35rem;
  justify-content: center;
}
.summary-card .stars .icon { width: 36px; height: 36px; }
.summary-card .stars .icon.dim { opacity: 0.2; filter: grayscale(1); }
.summary-card .score { font-size: 1rem; margin-bottom: 1.25rem; color: var(--ink-soft); }
.summary-card .actions {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  flex-wrap: nowrap;
}
.summary-card .actions .cta {
  flex: 1 1 0;
  min-width: 0;
  padding: 0.9rem 0.5rem;
  font-size: 1rem;
}

/* ===== Coming soon ===== */
.coming-soon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  text-align: center;
  gap: 0.85rem;
  padding: 2rem 0;
}
.coming-soon .hero-bubble {
  width: 140px; height: 140px;
  border-radius: 50%;
  background: var(--bg-soft);
  display: flex;
  align-items: center;
  justify-content: center;
}
.coming-soon .hero-bubble .icon { width: 90px; height: 90px; }
.coming-soon h2 { color: var(--orange); font-size: 1.6rem; }
.coming-soon p  { color: var(--ink-soft); max-width: 300px; }

/* ===== Scene-style game (3D claymation look) ===== */
.scene-game {
  position: relative;
  background: var(--card);
  border-radius: var(--radius-2xl);
  padding: 0.85rem 0.65rem 1rem;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 460px;
  margin: 0 auto;
}

/* Progress dots between topbar items */
.progress-dots {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  justify-content: center;
  padding: 0.2rem 0.5rem;
}
.progress-dots .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ink-muted);
  transition: background .2s, transform .2s;
}
.progress-dots .dot.done    { background: var(--pastel-green-d); }
.progress-dots .dot.current {
  background: var(--orange);
  transform: scale(1.4);
  box-shadow: 0 0 0 3px rgba(245,166,35,0.25);
}

/* 3D-looking pill title at top */
.title-pill {
  align-self: center;
  background: linear-gradient(180deg, #ffc266 0%, #f5a623 60%, #d68910 100%);
  color: #fff;
  padding: 0.7rem 1.8rem;
  border-radius: 999px;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.4px;
  text-shadow: 0 1px 0 rgba(0,0,0,0.15);
  box-shadow:
    0 5px 0 rgba(180,100,10,0.45),
    0 8px 16px rgba(245,166,35,0.35),
    inset 0 -3px 6px rgba(180,100,10,0.35),
    inset 0 3px 6px rgba(255,255,255,0.45);
  margin-bottom: 0.75rem;
  position: relative;
}
.title-pill::after {
  content: '';
  position: absolute;
  top: 5px; left: 18px; right: 18px;
  height: 6px;
  border-radius: 6px;
  background: rgba(255,255,255,0.55);
  filter: blur(2px);
  pointer-events: none;
}

/* Scene background (sky + hills inside container) */
.scene-stage {
  position: relative;
  border-radius: var(--radius-xl);
  overflow: hidden;
  min-height: 260px;
  margin-bottom: 0.85rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(180deg, #ffe9c2 0%, #ffd9a3 50%, #ffc985 100%);
}
.scene-bg-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
.scene-deco {
  position: absolute;
  pointer-events: none;
}
.scene-deco.cloud-1 { top: 8%;  left: 8%;  width: 64px; height: 40px; opacity: 0.92; }
.scene-deco.cloud-2 { top: 14%; right: 14%; width: 48px; height: 30px; opacity: 0.78; }
.scene-deco.sun     { top: 6%;  right: 6%;  width: 60px; height: 60px; }
.scene-deco.fence-1 { bottom: 6%; left: -10%; width: 50%; height: 50px; opacity: 0.95; }
.scene-deco.fence-2 { bottom: 6%; right: -10%; width: 50%; height: 50px; opacity: 0.95; }
.scene-deco.grass-1 { bottom: 1%; left: 6%;  width: 36px; height: 18px; }
.scene-deco.grass-2 { bottom: 1%; right: 12%; width: 30px; height: 16px; }
.scene-deco.grass-3 { bottom: 1%; left: 48%; width: 34px; height: 18px; }

/* Character + speech bubble */
.character {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 84px;
  height: 84px;
  z-index: 3;
  animation: floatChar 3s ease-in-out infinite;
  transition: transform .25s ease;
}
.character .icon { width: 100%; height: 100%; filter: drop-shadow(0 5px 8px rgba(0,0,0,0.22)); }
.character.cheer { animation: cheerHop 0.6s ease-out 2; }
.character.sad   { animation: sadShake 0.5s ease; }

.speech-bubble {
  position: absolute;
  top: 18px;
  left: 100px;
  right: 14px;
  background: #fff;
  color: var(--ink);
  padding: 0.55rem 0.85rem;
  border-radius: 18px;
  font-weight: 700;
  font-size: 0.92rem;
  line-height: 1.25;
  box-shadow: 0 4px 10px rgba(0,0,0,0.12);
  z-index: 3;
  border: 2px solid #fff;
}
.speech-bubble::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 18px;
  width: 12px;
  height: 12px;
  background: #fff;
  border-radius: 2px;
  transform: rotate(45deg);
  box-shadow: -1px 1px 2px rgba(0,0,0,0.06);
}

/* Counter card showing the items to count, with shadow drop slot */
.count-area {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 0.5rem;
  gap: 0.75rem;
  margin-top: 96px;
}
.count-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 0.9rem 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: center;
  align-items: center;
  max-width: 90%;
  box-shadow:
    0 6px 18px rgba(0,0,0,0.18),
    inset 0 2px 0 rgba(255,255,255,0.8);
  border: 3px solid #fff;
  animation: cardPopIn 0.4s ease-out;
}
.count-card .item-3d {
  width: 56px;
  height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 3px 4px rgba(0,0,0,0.2));
  animation: itemPop 0.4s ease-out backwards;
}
.count-card .item-3d:nth-child(1) { animation-delay: 0.05s; }
.count-card .item-3d:nth-child(2) { animation-delay: 0.1s; }
.count-card .item-3d:nth-child(3) { animation-delay: 0.15s; }
.count-card .item-3d:nth-child(4) { animation-delay: 0.2s; }
.count-card .item-3d:nth-child(5) { animation-delay: 0.25s; }
.count-card .item-3d:nth-child(6) { animation-delay: 0.3s; }
.count-card .item-3d:nth-child(7) { animation-delay: 0.35s; }
.count-card .item-3d:nth-child(8) { animation-delay: 0.4s; }
.count-card .item-3d:nth-child(9) { animation-delay: 0.45s; }
.count-card .item-3d:nth-child(10) { animation-delay: 0.5s; }
.count-card .item-3d .icon { width: 100%; height: 100%; }

.drop-slot {
  width: 110px;
  height: 110px;
  border-radius: var(--radius-lg);
  background: #ffffff;
  border: 4px dashed rgba(180,100,10,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: transform .15s, background .15s, border-color .15s;
  box-shadow: 0 4px 14px rgba(0,0,0,0.18), inset 0 2px 6px rgba(0,0,0,0.04);
}
.drop-slot.hover {
  background: rgba(255,255,255,0.85);
  border-color: var(--orange);
  transform: scale(1.06);
}
.drop-slot .slot-hint {
  font-weight: 800;
  color: rgba(180,100,10,0.6);
  font-size: 2.5rem;
  animation: pulseHint 1.6s ease-in-out infinite;
}
.drop-slot .dropped-num {
  font-weight: 800;
  font-size: 3.5rem;
  color: var(--orange-dark);
  text-shadow: 0 2px 0 rgba(255,255,255,0.7);
  animation: pop 0.4s ease;
}
.drop-slot.correct {
  background: var(--pastel-green);
  border-color: var(--pastel-green-d);
  border-style: solid;
  animation: pop .35s ease;
}
.drop-slot.correct .dropped-num { color: var(--pastel-green-d); }
.drop-slot.wrong {
  background: var(--pastel-pink);
  border-color: var(--red);
  border-style: solid;
  animation: shake .35s ease;
}
.drop-slot.wrong .dropped-num { color: var(--red); }

/* Wooden number bar */
.wood-bar {
  background:
    repeating-linear-gradient(90deg, transparent 0 30px, rgba(0,0,0,0.04) 30px 31px),
    linear-gradient(180deg, #d6a268 0%, #b0793f 50%, #8a5a26 100%);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem;
  position: relative;
  box-shadow:
    inset 0 2px 0 rgba(255,255,255,0.35),
    inset 0 -2px 0 rgba(0,0,0,0.18),
    0 6px 12px rgba(0,0,0,0.15);
  display: flex;
  gap: 0.55rem;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  margin-top: auto;
  margin-bottom: calc(env(safe-area-inset-bottom, 0) + 0.25rem);
}
.wood-bar::before,
.wood-bar::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 8px;
  height: 8px;
  background: radial-gradient(circle at 30% 30%, #f0e0c0, #6a3b0a);
  border-radius: 50%;
  transform: translateY(-50%);
  box-shadow: inset 0 1px 1px rgba(0,0,0,0.4);
}
.wood-bar::before { left: 6px; }
.wood-bar::after  { right: 6px; }

.num-tile {
  flex: 1;
  min-width: 0;
  max-width: 56px;
  height: 56px;
  background: linear-gradient(180deg, #ffffff 0%, #fff5e0 100%);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.6rem;
  color: var(--ink);
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  box-shadow:
    0 3px 0 rgba(140,90,30,0.5),
    0 5px 8px rgba(0,0,0,0.15),
    inset 0 1px 0 rgba(255,255,255,0.8);
  transition: transform .12s ease, box-shadow .12s ease;
  animation: tilePop 0.4s ease-out backwards;
}
.num-tile:nth-child(1) { animation-delay: 0.05s; }
.num-tile:nth-child(2) { animation-delay: 0.1s; }
.num-tile:nth-child(3) { animation-delay: 0.15s; }
.num-tile:nth-child(4) { animation-delay: 0.2s; }
.num-tile:nth-child(5) { animation-delay: 0.25s; }
.num-tile:nth-child(6) { animation-delay: 0.3s; }
.num-tile:hover { transform: translateY(-3px); box-shadow: 0 4px 0 rgba(140,90,30,0.5), 0 6px 10px rgba(0,0,0,0.2); }
.num-tile:active,
.num-tile.dragging {
  cursor: grabbing;
  transform: translateY(0) scale(1.08);
  box-shadow: 0 8px 14px rgba(0,0,0,0.25);
  z-index: 100;
}
.num-tile.active {
  background: linear-gradient(180deg, #ffe1ad 0%, #f5a623 100%);
  color: var(--ink);
  box-shadow: 0 2px 0 #8a4f0a, 0 4px 6px rgba(0,0,0,0.2), inset 0 -2px 4px rgba(140,90,30,0.3);
}
.num-tile.used { opacity: 0.25; pointer-events: none; transform: scale(0.85); }
.num-tile.shake { animation: shake 0.4s ease; }

/* Drag ghost (floating clone during drag) */
.drag-ghost {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 8px 14px rgba(0,0,0,0.3));
}

/* ===== Memory match (Padanan Safari) ===== */
.memo-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  width: 100%;
  margin: 0 auto 1rem;
}
.memo-card {
  aspect-ratio: 1/1;
  perspective: 1000px;
  cursor: pointer;
}
.memo-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.4s ease;
  transform-style: preserve-3d;
}
.memo-card.flipped .memo-card-inner { transform: rotateY(180deg); }
.memo-card-face, .memo-card-back {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-md);
  backface-visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.memo-card-face {
  background: linear-gradient(180deg, #f5a623, #d68910);
  color: #fff;
  font-size: 1.8rem;
  font-weight: 800;
  box-shadow: inset 0 -3px 6px rgba(180,100,10,0.35), inset 0 3px 6px rgba(255,255,255,0.45);
}
.memo-card-back {
  background: var(--bg-soft);
  transform: rotateY(180deg);
  border: 3px solid var(--pastel-orange);
}
.memo-card-back .icon { width: 70%; height: 70%; }
.memo-card.matched .memo-card-back {
  background: var(--pastel-green);
  border-color: var(--pastel-green-d);
}

/* ===== Find-grid (Misi Mencari Huruf / Cari Objek) ===== */
.find-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.55rem;
  width: 100%;
  margin: 0 auto 1rem;
}
.find-tile { font-size: 1.8rem; }
.find-tile {
  background: var(--bg-soft);
  border-radius: var(--radius-md);
  aspect-ratio: 1/1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.6rem;
  color: var(--ink);
  cursor: pointer;
  border: 3px solid transparent;
  transition: transform .12s, background .15s, border-color .15s;
}
.find-tile .icon { width: 70%; height: 70%; }
.find-tile:hover { transform: translateY(-2px); background: var(--pastel-orange); }
.find-tile.hit {
  background: var(--pastel-green);
  border-color: var(--pastel-green-d);
  animation: pop .35s ease;
  pointer-events: none;
}
.find-tile.miss {
  background: var(--pastel-pink);
  border-color: var(--red);
  animation: shake .35s ease;
}
.find-counter {
  text-align: center;
  font-weight: 700;
  color: var(--ink-soft);
  margin-bottom: 0.5rem;
}
.find-counter strong { color: var(--orange); font-size: 1.2rem; }

/* ===== Spell-word slots & letter bank ===== */
.word-slots {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  margin: 0 auto 1rem;
  flex-wrap: wrap;
  width: 100%;
}
.slot-letter {
  width: 42px;
  height: 52px;
  border: 3px dashed var(--ink-muted);
  border-radius: 10px;
  background: var(--bg-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.5rem;
  color: var(--orange-dark);
  transition: background .15s, border-color .15s, transform .12s;
}
.slot-letter.filled {
  background: var(--pastel-orange);
  border-style: solid;
  border-color: var(--orange);
  animation: pop 0.25s ease;
}
.slot-letter.correct {
  background: var(--pastel-green);
  border-color: var(--pastel-green-d);
  color: var(--pastel-green-d);
}
.slot-letter.wrong {
  background: var(--pastel-pink);
  border-color: var(--red);
  color: var(--red);
  animation: shake 0.35s ease;
}

.letter-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  width: 100%;
  margin: 0 auto 1rem;
}
.letter-key {
  width: 44px;
  height: 50px;
  background: linear-gradient(180deg, #ffffff 0%, #fff5e0 100%);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.5rem;
  color: var(--ink);
  cursor: pointer;
  user-select: none;
  border: none;
  box-shadow: 0 3px 0 rgba(140,90,30,0.5), 0 5px 8px rgba(0,0,0,0.15), inset 0 1px 0 rgba(255,255,255,0.8);
  transition: transform .12s, box-shadow .12s, opacity .15s;
  animation: tilePop 0.4s ease-out backwards;
}
.letter-key:hover { transform: translateY(-3px); }
.letter-key:active { transform: translateY(0); box-shadow: 0 1px 0 rgba(140,90,30,0.5); }
.letter-key.used { opacity: 0.25; pointer-events: none; transform: scale(0.85); }

/* ===== Bola arena ===== */
.ball-arena {
  position: relative;
  width: 100%;
  height: 320px;
  background: var(--bg-soft);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin: 0 auto 1rem;
}
.ball {
  position: absolute;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: inset -6px -6px 10px rgba(0,0,0,0.18), 0 3px 6px rgba(0,0,0,0.15);
  transition: transform .12s ease;
}
.ball:hover { transform: scale(1.1); }
.ball.pop { animation: pop .25s ease forwards; pointer-events: none; }

/* ===== Modal (name entry) ===== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(254,245,231,0.92);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 1100;
  backdrop-filter: blur(6px);
}
.modal-overlay.show { display: flex; }
.modal-card {
  background: var(--card);
  border-radius: var(--radius-2xl);
  padding: 1.75rem 1.25rem;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: pop .35s ease;
  box-sizing: border-box;
}
.modal-card h2 { color: var(--orange); font-size: 1.4rem; margin-bottom: 0.4rem; }
.modal-card p  { color: var(--ink-soft); font-size: 0.9rem; margin-bottom: 1rem; }
.modal-card input {
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: 999px;
  border: 2px solid var(--bg-soft);
  background: var(--bg-soft);
  font-family: inherit;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--ink);
  text-align: center;
  margin-bottom: 1rem;
  box-sizing: border-box;
}
.modal-card input:focus { outline: none; border-color: var(--orange); background: #fff; }

/* Modal CTAs: side-by-side, fill available width */
.modal-card .row {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.6rem;
  margin-top: 0.25rem;
}
.modal-card .row .cta {
  flex: 1 1 0;
  min-width: 0;
  padding: 0.9rem 0.5rem;
  font-size: 1rem;
}

/* ===== Avatar ===== */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--pastel-orange);
  flex-shrink: 0;
}
.avatar .icon { width: 60%; height: 60%; }
.avatar-green  { background: var(--pastel-green); }
.avatar-yellow { background: var(--pastel-yellow); }
.avatar-orange { background: var(--pastel-orange); }
.avatar-purple { background: var(--pastel-purple); }
.avatar-pink   { background: var(--pastel-pink); }
.avatar-blue   { background: var(--pastel-blue); }
.avatar-empty  { background: var(--bg-soft); }

/* ===== Avatar picker grid (in modal) ===== */
.avatar-picker {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin: 0.5rem 0 1.25rem;
  justify-items: center;
}
.avatar-pick {
  border: 3px solid transparent;
  border-radius: 50%;
  padding: 3px;
  background: transparent;
  cursor: pointer;
  transition: border-color .15s, transform .12s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.avatar-pick:hover { transform: scale(1.08); }
.avatar-pick.sel { border-color: var(--orange); }
.avatar-pick .avatar { width: 56px !important; height: 56px !important; }

/* ===== Profile switcher rows ===== */
.profile-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
  text-align: left;
}
.profile-row {
  display: flex;
  align-items: stretch;
  gap: 0.4rem;
  background: var(--bg-soft);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: background .15s;
}
.profile-row:hover { background: var(--pastel-orange); }
.profile-row.active { background: var(--pastel-orange); }
.profile-row-main {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
}
.profile-row-main .row-body { flex: 1; min-width: 0; }
.profile-row-main .row-title { font-weight: 700; font-size: 0.95rem; color: var(--ink); }
.profile-row-main .row-sub { font-size: 0.78rem; color: var(--ink-soft); margin-top: 0.1rem; }
.profile-row-main .row-chip {
  background: var(--orange);
  color: #fff;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
}
.profile-row-main .row-chevron { color: var(--ink-muted); display: flex; align-items: center; }
.profile-row-main .row-chevron .icon { width: 18px; height: 18px; }
.profile-row-del {
  background: transparent;
  border: none;
  padding: 0 0.85rem;
  cursor: pointer;
  color: var(--ink-muted);
  transition: color .15s, background .15s;
}
.profile-row-del:hover { color: var(--red); background: rgba(255,107,107,0.1); }
.profile-row-del .icon { width: 20px; height: 20px; }

/* ===== Active profile chip (in greeting card) ===== */
.active-profile-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-soft);
  padding: 0.4rem 0.8rem 0.4rem 0.4rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--ink);
  margin-top: 0.75rem;
  border: none;
  cursor: pointer;
  transition: background .15s;
}
.active-profile-chip:hover { background: var(--pastel-orange); }
.active-profile-chip .avatar { width: 30px; height: 30px; }
.active-profile-chip .chip-arrow { color: var(--ink-soft); display: flex; align-items: center; }
.active-profile-chip .chip-arrow .icon { width: 14px; height: 14px; transform: rotate(180deg); }

/* ===== Leaderboard list ===== */
.lb-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.lb-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  background: var(--bg-soft);
  border-radius: var(--radius-md);
  text-align: left;
}
.lb-item.podium-1 { background: linear-gradient(135deg, #fff4cc, #ffd23f33); border: 2px solid var(--tile-yellow); }
.lb-item.podium-2 { background: linear-gradient(135deg, #f3f4f6, #cbd5e133); }
.lb-item.podium-3 { background: linear-gradient(135deg, #ffe4c2, #ff8c3a33); }
.lb-rank {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--ink-muted);
  color: #fff;
  font-weight: 800;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.lb-item.podium-1 .lb-rank { background: var(--orange); }
.lb-item.podium-2 .lb-rank { background: #9ca3af; }
.lb-item.podium-3 .lb-rank { background: #ed8936; }
.lb-name {
  flex: 1;
  font-weight: 700;
  font-size: 0.95rem;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lb-stars {
  font-weight: 800;
  color: var(--orange);
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  gap: 0.1rem;
}
.lb-stars .icon { width: 14px; height: 14px; }
.lb-stars .icon.dim { opacity: 0.25; filter: grayscale(1); }
.lb-stars-num {
  font-weight: 800;
  color: var(--orange);
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
.lb-stars-num .icon { width: 18px; height: 18px; }
.lb-meta {
  font-size: 0.75rem;
  color: var(--ink-soft);
}

/* ===== Summary leaderboard ===== */
.summary-leaderboard {
  margin: 0.75rem 0 1.25rem;
  text-align: left;
}
.summary-leaderboard h3 {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink-soft);
  text-align: center;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.summary-leaderboard .lb-list { gap: 0.35rem; }
.summary-leaderboard .lb-item { padding: 0.5rem 0.7rem; }

/* ===== New best banner in summary ===== */
.new-best {
  background: var(--pastel-green);
  color: var(--pastel-green-d);
  border-radius: 999px;
  padding: 0.45rem 1rem;
  font-weight: 800;
  font-size: 0.85rem;
  display: inline-block;
  margin-bottom: 0.75rem;
  animation: pop .4s ease;
}

/* ===== Profile / Settings shared ===== */
.profile-hero {
  background: var(--card);
  border-radius: var(--radius-2xl);
  padding: 1.5rem 1.25rem 1.75rem;
  box-shadow: var(--shadow-md);
  text-align: center;
  margin-bottom: 1.25rem;
}
.profile-avatar {
  width: 120px; height: 120px;
  border-radius: 50%;
  background: var(--pastel-orange);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.85rem;
  border: 5px solid var(--card);
  box-shadow: var(--shadow-md);
}
.profile-avatar .icon { width: 78px; height: 78px; color: var(--orange); }
.profile-name { font-size: 1.5rem; font-weight: 800; color: var(--ink); }
.profile-sub  { color: var(--ink-soft); font-size: 0.9rem; margin-top: 0.15rem; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.stat-card {
  background: var(--card);
  border-radius: var(--radius-xl);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
  text-align: center;
}
.stat-card .stat-icon {
  width: 52px; height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.4rem;
}
.stat-card .stat-icon .icon { width: 36px; height: 36px; }
.stat-card .stat-num   { font-size: 1.6rem; font-weight: 800; color: var(--ink); line-height: 1; }
.stat-card .stat-label { font-size: 0.78rem; color: var(--ink-soft); margin-top: 0.2rem; }

.settings-list {
  background: var(--card);
  border-radius: var(--radius-xl);
  padding: 0.5rem;
  box-shadow: var(--shadow-sm);
}
.setting-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 0.75rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background .15s;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  text-decoration: none;
}
.setting-row:hover { background: var(--bg-soft); }
.setting-row .row-icon {
  width: 42px; height: 42px;
  border-radius: var(--radius-sm);
  background: var(--pastel-orange);
  color: var(--orange-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.setting-row .row-icon .icon { width: 22px; height: 22px; }
.setting-row.danger .row-icon { background: var(--tile-pink-soft); color: var(--red); }
.setting-row .row-body { flex: 1; min-width: 0; }
.setting-row .row-title { font-weight: 700; font-size: 0.95rem; color: var(--ink); }
.setting-row .row-sub   { font-size: 0.78rem; color: var(--ink-soft); margin-top: 0.1rem; }
.setting-row .row-chevron { color: var(--ink-muted); }
.setting-row .row-chevron .icon { width: 18px; height: 18px; transform: rotate(180deg); }
.setting-divider { height: 1px; background: var(--bg-soft); margin: 0.15rem 0.75rem; }

.page-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  margin-bottom: 1rem;
  gap: 0.5rem;
}
.page-header h1 {
  font-size: 1.25rem;
  font-weight: 800;
  text-align: center;
  color: var(--ink);
}

/* ===== Bottom nav (4 items) ===== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 90;
  background: var(--card);
  border-top: 1px solid var(--bg-soft);
  padding: 0.55rem 0.5rem calc(0.55rem + env(safe-area-inset-bottom));
  box-shadow: 0 -6px 24px rgba(70,30,0,0.06);
}
.bottom-nav-inner {
  max-width: 460px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.3rem;
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.6rem 0.3rem;
  border-radius: var(--radius-md);
  color: var(--ink-soft);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  transition: color .15s, background .15s;
  text-decoration: none;
  min-height: 56px;
}
.nav-item .icon { width: 32px; height: 32px; }
.nav-item:hover { color: var(--ink); background: var(--bg-soft); }
.nav-item.active {
  color: #fff;
  background: var(--orange);
}
.nav-item.active .icon { color: #fff; }

/* ===== Helpers ===== */
.row { display: flex; gap: 0.6rem; flex-wrap: wrap; justify-content: center; align-items: center; }
.center-col { display: flex; flex-direction: column; align-items: center; gap: 0.8rem; }
.hidden { display: none !important; }

/* ===== Animations ===== */
@keyframes pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.12); }
  100% { transform: scale(1); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes spinSlow {
  to { transform: rotate(360deg); }
}
@keyframes floatChar {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-5px); }
}
@keyframes cheerHop {
  0%, 100% { transform: translateY(0) rotate(0); }
  30%      { transform: translateY(-22px) rotate(-8deg); }
  60%      { transform: translateY(-10px) rotate(8deg); }
}
@keyframes sadShake {
  0%, 100% { transform: translateX(0) rotate(0); }
  25%      { transform: translateX(-5px) rotate(-4deg); }
  75%      { transform: translateX(5px)  rotate(4deg); }
}
@keyframes itemPop {
  0%   { opacity: 0; transform: scale(0.4) translateY(8px); }
  60%  { transform: scale(1.1) translateY(-3px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes cardPopIn {
  0%   { opacity: 0; transform: scale(0.85); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes tilePop {
  0%   { opacity: 0; transform: translateY(20px) scale(0.8); }
  100% { opacity: 1; transform: translateY(0)    scale(1); }
}
@keyframes pulseHint {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50%      { opacity: 1;   transform: scale(1.12); }
}
.fade-in { animation: fadeIn .3s ease; }

/* ===== Responsive ===== */
@media (max-width: 480px) {
  body { padding: 0.6rem 0.5rem 1rem; }
  body.has-bottom-nav { padding-bottom: calc(92px + env(safe-area-inset-bottom)); }
  .game-shell { padding: 0.85rem 0.7rem 1.25rem; border-radius: var(--radius-xl); }
  .scene-game { padding: 0.7rem 0.5rem 1rem; }
  .game-title { font-size: 1.35rem; }
  .game-prompt { font-size: 1rem; }
  .hero-card { padding: 1.25rem 0.85rem; min-height: 200px; }
  .hero-card .hero-illust { width: 150px; height: 150px; }
  .choice-grid { gap: 0.5rem; }
  .choice-tile { font-size: 1.85rem; min-height: 70px; }
  .find-grid { gap: 0.5rem; }
  .find-tile { font-size: 2rem; }
  .find-tile .icon { width: 75%; height: 75%; }
  .memo-grid { gap: 0.45rem; }
  .numpad { gap: 0.5rem; max-width: none; }
  .numpad button { padding: 1rem 0; font-size: 1.6rem; min-height: 62px; }
  .answer-display { font-size: 2.8rem; min-height: 78px; }
  .cta { padding: 1rem 1.8rem; font-size: 1.05rem; min-width: 200px; }
  /* Per-game inline grids that used to have max-width 380px */
  .pick-grid, .img-grid, .zone-grid, .binary-grid, .food-grid, .group-grid,
  .color-grid, .compare-grid, .action-grid, .bakery-grid, .feed-area,
  .scenario-card, .basket, .order-card {
    max-width: 100% !important;
  }
  .slot-letter { width: 38px; height: 50px; font-size: 1.4rem; }
  .letter-key { width: 42px; height: 50px; font-size: 1.4rem; }
}

@media (max-width: 480px) {
  .modal-card { padding: 1.5rem 1rem; max-width: calc(100vw - 1.5rem); }
  .avatar-pick .avatar { width: 50px !important; height: 50px !important; }
  .avatar-picker { gap: 0.4rem; }
  .modal-card .row .cta { padding: 0.85rem 0.4rem; font-size: 0.95rem; }
}

@media (max-width: 360px) {
  body { padding: 0.5rem 0.4rem 1rem; }
  .game-shell { padding: 0.7rem 0.55rem 1rem; }
  .scene-game { padding: 0.55rem 0.4rem 0.8rem; }
  .avatar-pick .avatar { width: 44px !important; height: 44px !important; }
  .modal-card { padding: 1.25rem 0.85rem; }
  .cat-card { padding: 0.85rem 0.7rem; min-height: 130px; }
  .cat-card .cat-icon { width: 48px; height: 48px; }
  .cat-card .cat-icon .icon { width: 42px; height: 42px; }
  .cat-card .cat-title { font-size: 0.9rem; }
  .hero-card .hero-illust { width: 120px; height: 120px; }
  .choice-tile { font-size: 1.55rem; min-height: 60px; }
  .find-tile { font-size: 1.7rem; }
  .numpad button { font-size: 1.4rem; padding: 0.85rem 0; min-height: 54px; }
  .slot-letter { width: 32px; height: 42px; font-size: 1.2rem; }
  .letter-key { width: 36px; height: 44px; font-size: 1.25rem; }
}
