/* world.css — shared arcade-bright skin for Sunny world pages.
   Chunky ink borders, hard offset shadows, flat bold color, zero gradients. */
:root {
  --ink: #241E4E;
  --paper: #FFF6E9;
  --card: #FFFFFF;
  --gold: #FFC93C;
  --green: #3DDC84;
  --red: #FF6B6B;
  --accent: #29B6FF;        /* overridden per world */
  --accent-soft: #E3F6FF;
  --shadow: 0 6px 0 var(--ink);
  --shadow-sm: 0 4px 0 var(--ink);
  --radius: 18px;
  --font: "Arial Rounded MT Bold", "Trebuchet MS", "Segoe UI", Verdana, sans-serif;
}
body[data-world="math"]    { --accent: #29B6FF; --accent-soft: #E3F6FF; }
body[data-world="grammar"] { --accent: #FF5CA8; --accent-soft: #FFEAF4; }
body[data-world="space"]   { --accent: #7C5CFF; --accent-soft: #EFE9FF; }
body[data-world="money"]   { --accent: #F5B301; --accent-soft: #FFF3C9; }
body[data-world="arcade"]  { --accent: #FF8A3C; --accent-soft: #FFF0E4; }
body[data-world="server"]  { --accent: #3DDC84; --accent-soft: #E7FFF3; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); color: var(--ink); background: var(--paper);
  background-image: radial-gradient(#F0E4D0 1.6px, transparent 1.6px);
  background-size: 26px 26px;
  min-height: 100vh; padding-bottom: 60px;
}
button { font-family: inherit; color: var(--ink); }
a { color: var(--ink); }

.wrap { max-width: 860px; margin: 0 auto; padding: 0 16px; }

/* header */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 14px 0 4px; }
.brandline { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 900; font-size: 1.02rem; }
.brandline .sunny-svg { width: 34px; height: 34px; display: block; }
.brandline .mini { width: 34px; height: 34px; display: block; }
.world-tag {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--accent); color: var(--ink); border: 3px solid var(--ink);
  border-radius: 999px; padding: 5px 14px; font-weight: 900; font-size: 0.85rem;
  box-shadow: 0 3px 0 var(--ink);
}
.stats { display: flex; gap: 8px; flex-wrap: wrap; }
.stat {
  background: var(--card); border: 3px solid var(--ink); border-radius: 999px;
  padding: 5px 13px; font-weight: 900; font-size: 0.85rem; box-shadow: 0 3px 0 var(--ink);
  display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums;
}
.stat svg { width: 16px; height: 16px; display: block; }

/* cards */
.card {
  background: var(--card); border: 3px solid var(--ink); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; margin-top: 16px;
}
h2.card-title { margin: 0; font-size: 1.3rem; line-height: 1.25; }
.subtitle { color: #6B639A; margin: 6px 0 0; line-height: 1.5; font-size: 0.95rem; }
.badge {
  display: inline-block; background: var(--accent-soft); border: 2.5px solid var(--ink);
  border-radius: 999px; padding: 5px 13px; font-weight: 900; font-size: 0.75rem; white-space: nowrap;
}
.headrow { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }

/* sunny + speech */
.sunny-row { display: flex; gap: 14px; align-items: center; }
.sunny-holder { flex: 0 0 auto; width: 92px; }
.sunny-svg { width: 100%; height: auto; display: block; }
.sunny-svg .rays { transform-origin: 60px 60px; animation: rayspin 26s linear infinite; }
.sunny-svg.celebrate .rays { animation: rayspin 1.4s linear infinite; }
.sunny-svg.bounce { animation: sunbounce 0.55s ease; }
.sunny-svg.wobble { animation: sunwobble 0.5s ease; }
.sunny-svg .eye { animation: blink 4.2s infinite; }
@keyframes rayspin { to { transform: rotate(360deg); } }
@keyframes sunbounce { 0%,100% { transform: translateY(0); } 40% { transform: translateY(-12px) scale(1.05); } }
@keyframes sunwobble { 0%,100% { transform: rotate(0); } 30% { transform: rotate(-7deg); } 70% { transform: rotate(6deg); } }
@keyframes blink { 0%,93%,100% { transform: scaleY(1); } 96% { transform: scaleY(0.1); } }
.speech {
  position: relative; flex: 1; min-width: 0; background: var(--card);
  border: 3px solid var(--ink); border-radius: 16px; padding: 12px 16px;
  box-shadow: 0 4px 0 var(--ink); font-size: 0.97rem; line-height: 1.5;
}
.speech::before {
  content: ""; position: absolute; left: -12px; top: 50%; margin-top: -9px;
  border: 9px solid transparent; border-right-color: var(--ink); border-left: 0;
}
.speech .who { display: block; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.09em; color: #6B639A; font-weight: 900; margin-bottom: 3px; }

/* lesson list */
.lesson-list { display: flex; flex-direction: column; gap: 10px; }
.lesson-item {
  display: flex; align-items: center; gap: 10px; text-align: left; cursor: pointer;
  background: var(--card); border: 3px solid var(--ink); border-radius: 14px;
  padding: 11px 14px; font-weight: 800; font-size: 0.92rem; box-shadow: var(--shadow-sm);
  transition: transform 0.08s ease;
}
.lesson-item:hover { transform: translateX(4px); }
.lesson-item:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--ink); }
.lesson-item.active { background: var(--accent-soft); }
.lesson-item.done { background: var(--accent); color: var(--ink); }
.lesson-item.done .li-sub { color: rgba(36,30,78,0.75); }
.lesson-item .li-check { flex: 0 0 22px; }
.lesson-item .li-label { flex: 1; min-width: 0; }
.lesson-item .li-sub { display: block; font-size: 0.72rem; color: #6B639A; font-weight: 700; }
.lesson-item .daily-flag {
  flex: 0 0 auto; background: var(--gold); border: 2.5px solid var(--ink); border-radius: 999px;
  font-size: 0.62rem; font-weight: 900; padding: 3px 8px; text-transform: uppercase; letter-spacing: 0.05em;
}

/* builder */
.builder-slot {
  min-height: 60px; border: 3px dashed var(--ink); border-radius: 14px;
  background: var(--paper); padding: 10px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
}
.builder-slot .placeholder { color: #6B639A; font-weight: 800; font-size: 0.88rem; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.token-chip {
  background: var(--card); border: 3px solid var(--ink); border-radius: 999px;
  padding: 8px 15px; font-weight: 900; font-size: 0.92rem; cursor: pointer;
  box-shadow: 0 3px 0 var(--ink); transition: transform 0.08s ease;
}
.token-chip:hover { transform: translateY(-2px); }
.token-chip:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }
.token-chip:active { transform: translateY(1px); box-shadow: 0 1px 0 var(--ink); }
.token-chip.t-keyword { background: var(--accent-soft); }
.token-chip.t-value { background: #FFF3C9; }
.builder-chip {
  background: var(--accent); color: var(--ink); border: 3px solid var(--ink); border-radius: 999px;
  padding: 7px 12px; font-weight: 900; font-size: 0.9rem; display: inline-flex; gap: 7px; align-items: center;
  cursor: pointer; box-shadow: 0 3px 0 var(--ink);
}
.builder-chip .rm {
  background: rgba(255,255,255,0.35); border-radius: 50%; width: 18px; height: 18px;
  display: inline-flex; align-items: center; justify-content: center; font-size: 0.7rem;
}
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.btn {
  border: 3px solid var(--ink); border-radius: 14px; cursor: pointer;
  font-weight: 900; font-size: 0.95rem; padding: 11px 20px; box-shadow: 0 4px 0 var(--ink);
  transition: transform 0.08s ease;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.btn:focus-visible, .token-chip:focus-visible, .lesson-item:focus-visible, .builder-chip:focus-visible {
  outline: 3px solid var(--gold); outline-offset: 2px;
}
.btn-primary { background: var(--accent); color: var(--ink); }
.btn-ghost { background: var(--card); }
.btn-next { display: none; }
.btn-next.show { display: inline-block; }
.feedback {
  margin-top: 14px; border: 3px solid var(--ink); border-radius: 14px;
  padding: 12px 16px; font-weight: 800; font-size: 0.95rem; line-height: 1.5;
}
.feedback.info { background: var(--accent-soft); }
.feedback.good { background: #E2FFEE; }
.feedback.bad { background: #FFECEC; }

/* answer display */
.answer-display {
  background: var(--ink); color: #FFE066; font-family: "Courier New", monospace;
  border-radius: 14px; padding: 13px 16px; font-size: 1rem; font-weight: 700;
  overflow-wrap: anywhere; margin-bottom: 12px;
}

/* scenes (chunky restyle of v2 scenes) */
.scene-stage { min-height: 80px; margin-top: 10px; }
.scene-caption { color: #6B639A; font-size: 0.9rem; font-style: italic; }
.cabinet { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.drawer { background: var(--paper); border: 3px solid var(--ink); border-radius: 12px; padding: 10px; box-shadow: 0 3px 0 var(--ink); }
.drawer-title { font-weight: 900; font-size: 0.82rem; margin-bottom: 7px; }
.paper { background: #fff; border: 2px solid var(--ink); border-radius: 8px; padding: 5px 8px; font-size: 0.78rem; margin-bottom: 5px; color: #55507E; }
.sheet-grid { display: inline-block; }
.grid-row { display: flex; gap: 4px; margin-bottom: 4px; }
.cell { background: #fff; border: 2.5px solid var(--ink); border-radius: 8px; padding: 6px 11px; font-size: 0.84rem; min-width: 70px; text-align: center; }
.cell.header { background: var(--paper); font-weight: 900; }
.cell.highlight { background: #FFF3C9; font-weight: 900; }
.table-shell { overflow-x: auto; }
.table-shell table { border-collapse: collapse; width: 100%; font-size: 0.88rem; }
.table-shell th { background: var(--paper); padding: 8px 10px; text-align: left; font-size: 0.75rem; border-bottom: 3px solid var(--ink); }
.table-shell td { padding: 8px 10px; border-bottom: 2px solid #F0E4D0; }
.table-shell tr.flash { animation: rowflash 0.8s ease both; }
@keyframes rowflash { 0% { background: #FFF3C9; } 100% { background: transparent; } }
.groups-row { display: flex; flex-wrap: wrap; gap: 12px; }
.group { background: var(--paper); border: 3px solid var(--ink); border-radius: 14px; padding: 10px 14px; text-align: center; font-size: 1.4rem; box-shadow: 0 3px 0 var(--ink); }
.group small { display: block; font-size: 0.66rem; color: #6B639A; font-weight: 900; }
.pizza { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.pizza-slice { width: 110px; height: 110px; border-radius: 50%; border: 4px solid var(--ink); background: conic-gradient(var(--accent) 0 180deg, #fff 180deg 360deg); }
.pizza-slice.thirds { background: conic-gradient(var(--accent) 0 120deg, #fff 120deg 360deg); }
.pizza-label { font-weight: 800; font-size: 0.9rem; color: #6B639A; max-width: 220px; }
.steps-row { display: flex; flex-direction: column; gap: 10px; }
.step-card { background: var(--paper); border: 3px solid var(--ink); border-radius: 12px; padding: 11px 15px; font-weight: 800; display: flex; gap: 10px; align-items: center; box-shadow: 0 3px 0 var(--ink); }
.step-card .n { background: var(--accent); color: var(--ink); width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 0.78rem; flex: 0 0 auto; }
.grid100 { display: grid; grid-template-columns: repeat(10, 1fr); gap: 3px; max-width: 340px; }
.grid100 i { aspect-ratio: 1; border-radius: 4px; border: 1.5px solid var(--ink); background: #fff; }
.grid100 i.on { background: var(--accent); }
.sentence-line { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 1.1rem; font-weight: 900; }
.word-chip { border-radius: 10px; padding: 7px 13px; border: 3px solid var(--ink); background: #fff; }
.word-chip.w-noun { background: #E3F6FF; }
.word-chip.w-verb { background: #FFEAF4; }
.word-chip.w-adj { background: #E2FFEE; }
.word-legend { display: flex; gap: 12px; margin-top: 10px; font-size: 0.72rem; color: #6B639A; font-weight: 800; flex-wrap: wrap; }
.word-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; border: 2px solid var(--ink); margin-right: 4px; }
.timeline-row { display: flex; gap: 10px; flex-wrap: wrap; }
.tense-card { background: var(--paper); border: 3px solid var(--ink); border-radius: 12px; padding: 11px 16px; text-align: center; font-weight: 900; flex: 1; min-width: 105px; box-shadow: 0 3px 0 var(--ink); }
.tense-card small { display: block; color: #6B639A; font-size: 0.7rem; margin-top: 3px; }
.tense-card.hot { background: #FFF3C9; }
.pair-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); gap: 10px; }
.pair-card { background: var(--paper); border: 3px solid var(--ink); border-radius: 12px; padding: 11px; text-align: center; font-weight: 800; box-shadow: 0 3px 0 var(--ink); }
.pair-card.anti { background: #FFECEC; }
.pair-card small { display: block; color: #6B639A; font-size: 0.68rem; margin-top: 3px; font-weight: 700; }
.orbit-wrap { display: flex; flex-direction: column; gap: 8px; }
.orbit-row { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 0.9rem; }
.planet-dot { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--ink); flex: 0 0 auto; }
.sun-mini { width: 42px; height: 42px; border-radius: 50%; background: var(--gold); border: 3px solid var(--ink); flex: 0 0 auto; }
.daynight { display: flex; align-items: center; justify-content: center; gap: 26px; padding: 12px 0; flex-wrap: wrap; }
.globe { width: 104px; height: 104px; border-radius: 50%; border: 4px solid var(--ink); background: radial-gradient(circle at 32% 32%, #9BE7FF, #2F9DE0 62%); position: relative; overflow: hidden; }
.globe .land { position: absolute; background: #3DDC84; border-radius: 45% 55% 52% 48%; }
.sun-ball { width: 72px; height: 72px; border-radius: 50%; background: var(--gold); border: 4px solid var(--ink); }
.moon-ball { width: 56px; height: 56px; border-radius: 50%; background: #F4F1FA; border: 4px solid var(--ink); }
.daynight small { width: 100%; text-align: center; color: #6B639A; font-weight: 700; }
.moon-row { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.moon-phase { text-align: center; font-size: 0.7rem; color: #6B639A; font-weight: 800; }
.moon-disc { width: 50px; height: 50px; border-radius: 50%; margin: 0 auto 6px; background: var(--ink); position: relative; overflow: hidden; }
.moon-disc::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: #F4F1FA; }
.moon-disc.m-new::after { transform: translateX(-100%); }
.moon-disc.m-cres::after { transform: translateX(-58%); }
.moon-disc.m-half::after { transform: translateX(-50%); }
.moon-disc.m-full::after { transform: translateX(0); }
.gravity-stage { display: flex; align-items: flex-end; justify-content: center; gap: 40px; padding: 4px 0 0; min-height: 140px; }
.apple { font-size: 2.1rem; }
.ground-line { width: 210px; height: 8px; border-radius: 999px; background: var(--green); border: 2.5px solid var(--ink); }

/* confetti + celebration + toast */
.confetti-layer { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 60; }
.confetti-piece { position: absolute; width: 10px; height: 10px; top: -14px; border: 2px solid var(--ink); border-radius: 3px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(660deg); } }
.celebration {
  position: fixed; left: 50%; top: 22%; transform: translate(-50%,-50%) scale(0.7);
  background: var(--card); border: 3px solid var(--ink); border-radius: 20px;
  box-shadow: 0 8px 0 var(--ink); padding: 20px 30px; font-weight: 900; font-size: 1.25rem;
  opacity: 0; pointer-events: none; transition: opacity 0.22s ease, transform 0.22s ease;
  z-index: 70; text-align: center; max-width: 88vw;
}
.celebration.show { opacity: 1; transform: translate(-50%,-50%) scale(1); }

footer { text-align: center; color: #6B639A; font-size: 0.76rem; padding: 26px 12px 30px; }

@media (max-width: 700px) {
  .card { padding: 15px; }
  .sunny-holder { width: 74px; }
  .topbar { padding-top: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .sunny-svg .rays, .sunny-svg .eye, .sunny-holder { animation: none !important; }
  .sunny-svg.bounce, .sunny-svg.wobble { animation: none !important; }
  .lesson-item:hover { transform: none; }
}
[hidden] { display: none !important; }

/* world banner (Phase 2 deep art pass) */
.world-banner {
  margin-top: 12px;
  border: 4px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  background: var(--accent-soft);
}
.world-banner svg { display: block; width: 100%; height: auto; }
.banner-float { animation: bannerFloat 5.5s ease-in-out infinite alternate; }
@keyframes bannerFloat { to { transform: translateY(7px); } }
@media (prefers-reduced-motion: reduce) { .banner-float { animation: none; } }

/* read-aloud toggle (shared across pages) */
.icon-btn {
  background: var(--card); border: 3px solid var(--ink); border-radius: 12px;
  box-shadow: 0 3px 0 var(--ink); font-size: 1rem; padding: 6px 10px;
  cursor: pointer; font-family: inherit; color: var(--ink); line-height: 1;
}
.icon-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.icon-btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.speech { cursor: pointer; }
