/* Hello Thomas · app styles
   Single palette (see src/design/color-direction.json):
   white canvas, blue primary action, green brand/success, yellow streak, coral retry. */

:root {
  --ink: #172b24;
  --muted: #5f6f69;
  --line: #e6e9ee;
  --canvas: #ffffff;
  --surface: #f6f7f9;
  --shell: #f3f5f2;

  --primary: #1e4fe6;
  --primary-deep: #163cb8;
  --primary-tint: #e9efff;

  --green: #148366;
  --green-deep: #0e6b52;
  --mint: #dcf7e9;

  --yellow: #ffd600;
  --yellow-tint: #fff5ce;
  --yellow-ink: #6f4b00;

  --coral: #d0602f;  /* bar fill: 3.9:1 on white */
  --coral-tint: #fff0e8;
  --coral-ink: #a84128;

  --sky-tint: #e8f4ff;
  --sky-ink: #215f91;

  --violet: #70509a;
  --violet-tint: #f0eaff;

  --focus: #845cbe;
  --radius: 20px;
  --font: "Paperlogy", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;

  color-scheme: light;
  font-family: var(--font);
  color: var(--ink);
  background: var(--shell);
  font-size: 17px;
}

* { box-sizing: border-box; font-family: var(--font); }
body { margin: 0; background: var(--shell); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; color: inherit; touch-action: manipulation; }
button:disabled { cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 4px;
}
/* Route headings receive focus for screen readers, without a visual selection box. */
:is(h1, h2, .app)[tabindex="-1"]:focus { outline: none; }
a { color: var(--green); }
img { display: block; }
picture { display: contents; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 26px; line-height: 1.35; letter-spacing: -.8px; font-weight: 800; word-break: keep-all; }
h2 { font-size: 20px; line-height: 1.45; letter-spacing: -.5px; font-weight: 800; }
h3 { font-size: 18px; line-height: 1.5; font-weight: 800; }
h2, h3, small, strong, .bubble { word-break: keep-all; overflow-wrap: anywhere; }
p { line-height: 1.7; word-break: keep-all; }
small { font-size: 14px; line-height: 1.5; }
.eyebrow { display: block; font-size: 14px; font-weight: 700; line-height: 1.6; letter-spacing: .02em; }
.muted { color: var(--muted); }

/* ---------- Mobile-only shell, shared by every viewport ---------- */

.shell { width: 100%; max-width: 480px; min-height: 100dvh; margin: auto; }
.app {
  background: var(--canvas); min-height: 100dvh; display: flex;
  flex-direction: column; position: relative;
  box-shadow: 0 0 60px #244c3510;
}
html { scroll-padding-top: 90px; scroll-padding-bottom: 110px; }
button, input, a { scroll-margin-block: 100px; }

/* ---------- Screen transition ---------- */

.screen { display: flex; flex-direction: column; flex: 1; animation: appear .22s ease-out; }
@keyframes appear {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ---------- Top bar, stats ---------- */

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: max(12px, env(safe-area-inset-top)) 20px 10px; position: sticky; top: 0; z-index: 10; background: #fffffff5; border-bottom: 1px solid var(--line); }
.brand { font-weight: 800; letter-spacing: -1px; font-size: 25px; color: var(--green); }
.icon-button {
  border: 0; background: transparent; min-width: 44px; min-height: 44px; border-radius: 14px;
  display: inline-flex; align-items: center; justify-content: center; font-size: 22px;
}
.icon-button:hover { background: var(--surface); }
.icon { width: 22px; height: 22px; display: inline-block; vertical-align: middle; flex-shrink: 0; }
.top-title { font-size: 19px; font-weight: 800; }

.stats { display: flex; gap: 8px; padding: 14px 20px; }
.stat {
  border: 0; border-radius: 12px; padding: 0 12px; min-height: 44px; display: flex; align-items: center; gap: 7px;
  font-size: 15px; font-weight: 700; background: var(--surface); color: var(--ink);
}
.stat .icon { width: 20px; height: 20px; }
.stat.is-streak .icon { color: #d97a00; }
.stat.is-xp { margin-right: auto; }
.stat.is-xp .icon { color: var(--green); }
.stat.is-league .icon { color: var(--violet); }

/* ---------- Home ---------- */

.hero { margin: 0 20px 8px; padding: 20px 16px 18px; text-align: left; display: flex; align-items: center; background: var(--mint); border-radius: 24px; gap: 4px; }
.hero-copy { flex: 1; min-width: 0; }
.hero-copy .eyebrow { color: var(--green-deep); font-size: 14px; margin-bottom: 8px; }
.hero-note { display: block; font-size: 14px; color: var(--green-deep); margin-top: 14px; }
.hero .headline { font-size: 26px; line-height: 1.35; letter-spacing: -1.2px; font-weight: 800; color: var(--ink); }
.hero p { color: var(--muted); margin-top: 6px; }
.hero-scene { display: flex; justify-content: center; align-items: center; margin: 0 -8px 0 0; position: relative; isolation: isolate; flex: 0 0 112px; }
.hero-scene img { width: 120px; height: 140px; object-fit: contain; }
.hero-friends { flex-direction: column; padding: 0; border: 0; border-radius: 16px; background: transparent; }
.hero-friends-label { display: inline-flex; align-items: center; gap: 3px; min-height: 32px; padding: 5px 8px; border-radius: 12px; background: #ffffffc9; color: var(--green-deep); font-size: 12px; font-weight: 700; white-space: nowrap; }
.hero-friends-label .icon { width: 12px; height: 12px; }
.hero-friends:hover .hero-friends-label { background: #fff; }
.hero-scene.hero-friends::after { bottom: 38px; }
.hero-scene::after {  /* soft ground shadow so the character stands on something */
  content: ""; position: absolute; left: 50%; bottom: 6px; width: 90px; height: 12px; transform: translateX(-50%);
  border-radius: 50%; background: radial-gradient(closest-side, #244c3524, transparent); z-index: -1;
}
.hero-bubble {
  max-width: 140px; margin: 14px 0 0 -14px; flex-shrink: 0;
  background: var(--yellow-tint); color: var(--ink); border-radius: 16px 16px 16px 3px;
  padding: 10px 12px; font-size: 14px; font-weight: 700; line-height: 1.55; text-align: center;
}

.next-card {
  margin: 10px 24px 0; width: calc(100% - 48px); text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 18px 18px 20px; display: flex; align-items: center; gap: 14px;
}
.next-card .tag {
  display: inline-block; background: var(--mint); color: var(--green-deep);
  font-size: 14px; font-weight: 700; padding: 3px 9px; border-radius: 8px; margin-bottom: 8px;
}
.next-title { display: block; font-size: 20px; letter-spacing: -.5px; font-weight: 800; }
.next-card small { display: block; margin-top: 5px; color: var(--muted); }
.next-card .body { flex: 1; min-width: 0; }
.next-card .icon { color: var(--muted); }

.steps { list-style: none; margin: 18px 24px 6px; padding: 0; }
.step { display: flex; align-items: center; gap: 14px; width: 100%; padding: 10px 0; border: 0; background: none; text-align: left; }
.step + .step { border-top: 1px solid var(--line); }
.step-dot {
  width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
  background: var(--surface); color: var(--muted); border: 2px solid var(--line);
}
.step-dot .icon { width: 20px; height: 20px; }
.step.is-current .step-dot { background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: 0 0 0 5px var(--primary-tint); }
.step.is-done .step-dot { background: var(--mint); color: var(--green); border-color: #b7ddc7; }
.step-body { flex: 1; min-width: 0; }
.step-body strong { display: block; font-size: 17px; }
.step-body small { color: var(--muted); }
.step-xp { font-size: 14px; font-weight: 700; color: var(--muted); flex-shrink: 0; }
.step.is-current .step-xp { color: var(--primary); }
.step:disabled .step-dot { border-style: dashed; background: #fff; }
.step:disabled .step-body strong { color: var(--muted); }

.home-action { padding: 16px 24px 4px; }
.today-steps { margin: 20px 20px 8px; padding: 16px; border: 1px solid var(--line); border-radius: 22px; }
.today-steps .section-label { margin: 0 0 8px; }
.today-steps h2 { font-size: 18px; }
.today-steps .steps { margin: 0; }
.today-steps .step { gap: 12px; }
.today-steps .step-dot { width: 38px; height: 38px; }
.today-steps .step-body strong { font-size: 16px; }
.home-action p { text-align: center; font-size: 15px; color: var(--muted); margin-bottom: 12px; }

/* ---------- Buttons ---------- */

.primary, .secondary {
  width: 100%; min-height: 58px; border-radius: 17px; padding: 16px 19px; border: 0;
  border-bottom: 5px solid var(--primary-deep); background: var(--primary); color: #fff;
  font-size: 18px; font-weight: 800; line-height: 1.4; text-align: center;
  transition: transform .08s ease, border-bottom-width .08s ease, background .15s ease;
}
.primary:active, .secondary:active { transform: translateY(2px); border-bottom-width: 3px; }
.primary:disabled { background: #e6e9ee; border-color: #d4d9e0; color: #4d5c56; }
.secondary { background: #fff; border: 2px solid var(--line); border-bottom-width: 4px; color: var(--ink); margin-top: 12px; }
.secondary:disabled { color: #6b7872; }
.secondary:disabled:not([aria-pressed=true]) { border-style: dashed; }
.text-button { background: none; border: 0; color: var(--green); font-size: 14px; font-weight: 700; padding: 10px 0; min-height: 44px; }

.section-label { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 10px 0 15px; }
.page-body { padding: 8px 24px 26px; flex: 1; }
.page-intro { margin: 8px 0 24px; }
.page-intro p { margin-top: 9px; color: var(--muted); }

.friends-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 5px; }
.friend-small { padding: 8px 0 7px; border: 0; border-radius: 15px; background: var(--tint); font-size: 14px; font-weight: 700; color: var(--ink); }
.friend-small img { height: 56px; width: 100%; object-fit: contain; margin-bottom: 5px; }

/* ---------- Bottom nav ---------- */

.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; z-index: 20;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px;
  padding: 8px 10px max(8px, env(safe-area-inset-bottom)); border-top: 1px solid #e7ebe3; background: #fffefa; box-shadow: 0 -7px 24px #163d240a;
}
.screen:has(.bottom-nav) { padding-bottom: calc(108px + env(safe-area-inset-bottom)); }
.bottom-nav button {
  background: transparent; border: 0; border-radius: 19px; padding: 6px 1px; min-height: 76px;
  font-size: 14px; line-height: 1.25; color: var(--muted); font-weight: 700;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
}
.nav-home { --nav-ink: #2855ca; --nav-tint: #eaf0ff; --nav-icon-bg: #edf4ff; --nav-line: #d8e3ff; }
.nav-content { --nav-ink: #7950a4; --nav-tint: #f2eafa; --nav-icon-bg: #f5edff; --nav-line: #e6d8f5; }
.nav-league { --nav-ink: #a46813; --nav-tint: #fff4d4; --nav-icon-bg: #fff4d4; --nav-line: #f1dfaa; }
.nav-settings { --nav-ink: #a95b2d; --nav-tint: #fff0e3; --nav-icon-bg: #fff3e8; --nav-line: #f0ddc8; }
.nav-icon { display: grid; place-items: center; width: 44px; height: 40px; border-radius: 14px; background: var(--nav-icon-bg); }
.bottom-nav .icon { width: 32px; height: 32px; }
.nav-label { white-space: nowrap; }
.bottom-nav button[aria-current=page] { background: var(--nav-tint); color: var(--nav-ink); box-shadow: inset 0 0 0 1px var(--nav-line); }
.bottom-nav button[aria-current=page] .nav-icon { background: #ffffffb8; }
.bottom-nav button:hover { background: var(--nav-tint); }

/* ---------- Lesson ---------- */

.lesson-progress { flex: 1; }
.lesson-progress small { display: flex; justify-content: space-between; font-size: 14px; color: var(--primary); margin-bottom: 8px; }
progress { appearance: none; width: 100%; height: 13px; border: 0; border-radius: 20px; overflow: hidden; background: #e9ecf1; }
progress::-webkit-progress-bar { background: #e9ecf1; border-radius: 20px; }
progress::-webkit-progress-value { background: var(--primary); border-radius: 20px; transition: width .25s ease; }
progress::-moz-progress-bar { background: var(--primary); border-radius: 20px; }
.record-head progress::-webkit-progress-value { background: var(--green); }
.record-head progress::-moz-progress-bar { background: var(--green); }

.lesson-stage { padding: 16px 24px 24px; flex: 1; }
.lesson-stage .eyebrow { color: var(--green); margin-bottom: 9px; }
.scene { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 20px 0 18px; min-height: 180px; }
.scene img { height: 190px; width: 42%; object-fit: contain; flex-shrink: 0; }
.bubble {
  background: var(--tint, var(--surface)); border-radius: 20px 20px 20px 3px; padding: 18px 16px;
  font-size: 17px; line-height: 1.65; word-break: keep-all; font-weight: 700;
}
.prices { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 14px; margin: 0 0 20px; }
.price { padding: 10px 18px 10px 12px; border-radius: 15px; background: var(--yellow-tint); color: var(--yellow-ink); font-weight: 700; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.art { width: 34px; height: 34px; flex-shrink: 0; }
.art.is-large { width: 64px; height: 64px; }

.choices { display: grid; gap: 13px; }
.choice {
  display: flex; gap: 14px; align-items: center; width: 100%; padding: 17px 17px; background: #fff;
  border: 2px solid var(--line); border-bottom: 5px solid var(--line); border-radius: 18px; text-align: left;
  font-size: 18px; line-height: 1.6; word-break: keep-all; font-weight: 700; min-height: 72px;
  transition: background .15s ease, border-color .15s ease;
}
.choice .number { border-radius: 10px; border: 2px solid var(--line); font-size: 14px; min-width: 30px; height: 32px; display: grid; place-items: center; flex-shrink: 0; }
.choice[aria-pressed=true] { background: var(--primary-tint); border-color: #7ea0ff; color: var(--primary); }
.choice[aria-pressed=true] { border-color: var(--primary); }
.choice[aria-pressed=true] .number { border-color: var(--primary); background: var(--primary); color: #fff; }
.choice:disabled:not(.correct):not(.retry):not([aria-pressed=true]) { opacity: .55; }
.choice.correct { background: var(--mint); border-color: #4bb18a; color: var(--green-deep); }
.choice.correct .number { background: var(--green); border-color: var(--green); color: #fff; }
.choice.retry { background: var(--coral-tint); border-color: #eaa180; color: var(--coral-ink); }
.choice.retry .number { background: var(--coral-ink); border-color: var(--coral-ink); color: #fff; }

.action-panel { padding: 16px 20px max(16px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: #fff; position: sticky; bottom: 0; z-index: 5; margin-top: auto; }
.action-panel.correct { background: var(--mint); border-color: transparent; }
.action-panel.retry { background: var(--coral-tint); border-color: transparent; }
.feedback-title { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 19px; }
.action-panel.correct .feedback-title { color: var(--green-deep); }
.action-panel.retry .feedback-title { color: var(--coral-ink); }
.feedback p { font-size: 17px; margin-bottom: 18px; }
.gentle { text-align: center; font-size: 14px; color: var(--muted); margin-top: 16px; }

.concept { background: var(--sky-tint); border-radius: 24px; padding: 26px 20px; text-align: center; }
.concept small { color: var(--sky-ink); }
.concept strong, .concept .concept-word { display: block; letter-spacing: -.5px; line-height: 1.3; color: var(--sky-ink); font-size: 34px; margin: 10px 0 17px; font-weight: 800; }
.concept p { font-size: 18px; }

/* ---------- Deep learning steps ---------- */

.deep-stage .scene { min-height: 100px; margin: 16px 0; }
.deep-stage .scene img { height: 120px; width: 30%; }
.deep-stage .bubble { font-size: 17px; }
.story-art {
  display: flex; align-items: center; justify-content: center; gap: 14px; min-height: 150px;
  background: var(--surface); font-size: 26px; font-weight: 800; color: var(--primary);
  border: 1px solid var(--line); border-radius: 24px; text-align: center; padding: 20px; animation: appear .25s ease-out;
}
.story-caption { font-size: 19px; line-height: 1.8; margin: 24px 0; }
.story-controls { display: flex; gap: 10px; margin: 18px 0; }
.story-controls button { flex: 1; margin: 0; padding: 12px; font-size: 17px; }
.story-controls [aria-pressed=true] { background: var(--primary-tint); border-color: var(--primary); border-bottom-width: 2px; color: var(--primary); }
.lab { border: 1px solid var(--line); padding: 18px; border-radius: 22px; }
.lab .choice { font-size: 17px; padding: 12px; min-height: 58px; }
.budget-bars { padding: 20px 0 6px; }
.budget-bars small { display: block; margin: 12px 0 7px; }
.budget-bar { height: 20px; background: var(--primary); border-radius: 6px; transition: width .3s; }
.budget-bar.cost { background: var(--coral); }
.budget-result { margin-top: 6px; }
.resource-map { padding: 20px; border: 1px solid var(--line); border-radius: 20px; margin: 18px 0; line-height: 2; }
.resource-map b { color: var(--primary); white-space: nowrap; }
#explanation {
  font: inherit; font-size: 18px; line-height: 1.7; display: block; width: 100%; resize: vertical;
  padding: 16px; margin-top: 14px; border: 2px solid #c7cdd9; border-radius: 16px;
}
#explanation:focus { outline: 3px solid var(--primary-tint); border-color: var(--primary); }
.self-check { display: flex; gap: 12px; align-items: flex-start; line-height: 1.6; margin-top: 14px; }
.self-check input { min-width: 22px; height: 22px; accent-color: var(--primary); }

/* ---------- Result / record / misc ---------- */

.celebration { padding: 25px 24px; text-align: center; }
.celebration img { width: 220px; height: 220px; object-fit: contain; margin: 12px auto; }
.celebration h1 { margin: 5px 0 12px; }
.xp-big { font-size: 56px; font-weight: 800; color: var(--green); margin: 22px 0 9px; }
.xp-big span { font-size: 22px; }
.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 22px 0 0; }
.metric { padding: 19px 12px; background: var(--violet-tint); border-radius: 18px; }
.metric:nth-child(2) { background: var(--yellow-tint); }
.metric strong { display: block; font-size: 25px; margin-top: 9px; }

.map-tabs { display: flex; gap: 7px; overflow-x: auto; scrollbar-width: none; margin: -6px -24px 14px; padding: 8px 24px; }
.map-tabs::-webkit-scrollbar { display: none; }
.map-tabs button { flex-shrink: 0; background: var(--surface); border: 0; padding: 0 14px; min-height: 44px; border-radius: 12px; font-size: 14px; font-weight: 700; }
.map-tabs button[aria-pressed=true] { background: var(--ink); color: #fff; }
.course-summary { background: var(--tint, var(--sky-tint)); padding: 20px; border-radius: 20px; margin-bottom: 20px; }
.course-summary h3 { margin-bottom: 8px; }
.group-label { margin: 28px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line); font-size: 15px; font-weight: 800; color: var(--ink); }
.course {
  border: 1px solid var(--line); border-radius: 19px; padding: 16px 18px; margin: 10px 0; display: flex; gap: 14px;
  align-items: center; background: var(--tint, #fff); width: 100%; text-align: left;
}
.course.is-ready { border-color: #b7ddc7; }
.course.is-planned { background: var(--surface); padding: 12px 16px; margin: 6px 0; }
.course.is-planned .course-number { width: 34px; height: 34px; border-radius: 10px; font-size: 14px; }
.course.is-planned .course-name { font-size: 16px; font-weight: 700; }
.course-number { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; background: #fff; border: 1px solid var(--line); flex-shrink: 0; font-weight: 800; color: var(--green); }
.course.is-planned .course-number { color: var(--muted); }
.course-title { flex: 1; min-width: 0; }
.course-name { display: block; font-size: 18px; font-weight: 800; }
.course-title small { display: block; margin-top: 4px; color: var(--muted); }
.course-status { font-size: 14px; color: var(--green-deep); flex-shrink: 0; font-weight: 700; }
.course.is-planned .course-status { color: var(--muted); }

.friends-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.friend-card { border: 2px solid transparent; background: var(--tint); border-radius: 22px; padding: 18px 12px; text-align: center; position: relative; color: var(--ink); }
.friend-card[aria-pressed=true] { border-color: var(--green); box-shadow: 0 0 0 3px var(--mint); }
.friend-card img { width: 100%; height: 150px; object-fit: contain; margin-bottom: 10px; }
.friend-card strong { display: block; font-size: 20px; margin-bottom: 5px; }
.friend-card small { font-size: 14px; }
.friend-check { position: absolute; top: 10px; right: 11px; background: var(--green); color: #fff; border-radius: 50%; width: 25px; height: 25px; display: grid; place-items: center; font-size: 15px; }
.friend-detail { background: var(--tint); padding: 22px; border-radius: 22px; margin-bottom: 22px; display: flex; align-items: center; gap: 16px; }
.friend-detail img { width: 115px; height: 130px; object-fit: contain; }
.friend-detail > div, .record-head > div { min-width: 0; flex: 1; }
.friend-detail p { font-size: 16px; margin-top: 8px; }

.record-head { display: flex; align-items: center; gap: 20px; margin: 10px 0 20px; }
.record-head img { width: 115px; height: 125px; object-fit: contain; }
.record-head h1 { font-size: 23px; margin-bottom: 10px; }
.record-head progress { margin: 10px 0; }
.reward-card {
  border: 2px solid var(--line); border-radius: 18px; width: 100%; padding: 19px 16px; margin: 15px 0;
  text-align: left; background: #fff; display: flex; gap: 16px; align-items: center; color: var(--ink);
}
.reward-card:disabled { background: var(--surface); border-style: dashed; }
.reward-card:disabled .icon { color: var(--muted); }
.reward-card.is-unlocked { background: var(--yellow-tint); border-color: #efdb99; }
.reward-card .icon { width: 28px; height: 28px; color: var(--green); }
.reward-card strong { font-size: 18px; display: block; margin-bottom: 6px; }
.reward-card small { color: var(--muted); }
.notice { background: var(--sky-tint); padding: 18px; border-radius: 18px; font-size: 15px; line-height: 1.7; margin: 20px 0; color: var(--sky-ink); }

.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin: 24px 0; }
.day { font-size: 14px; text-align: center; color: var(--muted); }
.day span { display: grid; place-items: center; height: 39px; border-radius: 50%; background: var(--surface); margin-top: 9px; font-size: 18px; }
.day.done span { background: var(--green); color: #fff; }
.day.today { font-weight: 800; color: var(--green); }

.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 15px; border-bottom: 1px solid var(--line); padding: 20px 0; }
.settings-row small { display: block; color: var(--muted); margin-top: 6px; }
.toggle { border: 0; border-radius: 13px; padding: 0 12px; min-height: 44px; min-width: 68px; font-size: 15px; font-weight: 700; background: var(--surface); }
.toggle[aria-pressed=true] { background: var(--mint); color: var(--green-deep); }
input[type=range] { width: 100%; accent-color: var(--primary); margin: 12px 0; height: 44px; }
.sound-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 15px 0; }
.sound-grid button { border: 1px solid var(--line); padding: 15px 10px; background: #fff; border-radius: 14px; font-size: 14px; min-height: 50px; }

.empty-art { height: 210px; width: 100%; object-fit: contain; margin: 10px 0 20px; }
.empty { text-align: center; }
.empty p { margin: 14px 0; color: var(--muted); }
.inline-message { padding: 13px 20px; background: var(--yellow-tint); color: var(--yellow-ink); font-size: 14px; line-height: 1.6; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }


/* ---------- Card quizzes (match / sort / build / type) ---------- */

.scene.is-small { min-height: 100px; margin: 14px 0; }
.scene.is-small img { height: 112px; width: 30%; }
.quiz-guide { font-size: 14px; color: var(--muted); margin: 4px 0 12px; }

.quiz-card, .quiz-chip {
  border: 2px solid var(--line); border-bottom-width: 4px; background: #fff; color: var(--ink);
  border-radius: 14px; font-weight: 700; line-height: 1.45; word-break: keep-all; text-align: center;
  transition: background .15s ease, border-color .15s ease, opacity .15s ease, transform .08s ease;
  touch-action: none; user-select: none; -webkit-user-select: none;
}
.quiz-card { width: 100%; min-height: 64px; padding: 10px 10px; font-size: 15px; }
.quiz-chip { min-height: 44px; padding: 8px 14px; font-size: 15px; }
.quiz-card:active, .quiz-chip:active { transform: translateY(2px); border-bottom-width: 2px; }
.quiz-card.is-picked, .quiz-chip.is-picked { background: var(--primary-tint); border-color: var(--primary); color: var(--primary); }
.quiz-card.is-done, .quiz-chip.is-done { background: var(--mint); border-color: #4bb18a; color: var(--green-deep); }
.quiz-card.is-done:disabled { opacity: .7; }
.quiz-card.is-miss, .quiz-chip.is-miss { background: var(--coral-tint); border-color: var(--coral); color: var(--coral-ink); animation: shake .3s ease; }
.quiz-chip.is-used { opacity: .35; }
.quiz-chip.is-placed { background: var(--primary-tint); border-color: #b9c9ff; color: var(--primary); }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.match-col { display: grid; gap: 10px; align-content: start; }

.sort-pool { display: flex; flex-wrap: wrap; gap: 8px; min-height: 52px; padding: 10px; border-radius: 16px; background: var(--surface); margin-bottom: 12px; }
.sort-bins { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sort-bin { border: 2px dashed var(--line); border-radius: 18px; padding: 8px; min-height: 150px; display: flex; flex-direction: column; gap: 8px; transition: border-color .15s ease, background .15s ease; }
.sort-bin-head { width: 100%; min-height: 44px; border: 0; border-radius: 12px; background: var(--surface); color: var(--ink); font-size: 15px; }
.sort-bin-head:not(:disabled) { background: var(--primary-tint); color: var(--primary); }
.sort-items { display: flex; flex-direction: column; gap: 6px; }
.sort-items .quiz-chip { width: 100%; font-size: 14px; }
.sort-empty { font-size: 14px; color: var(--muted); padding: 8px; }

.build-line { min-height: 64px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 4px; border-bottom: 2px solid var(--line); margin-bottom: 16px; transition: border-color .15s ease, background .15s ease; }
.build-prompt { font-weight: 800; font-size: 17px; margin-right: 2px; }
.build-bank { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

.type-card { border: 1px solid var(--line); border-radius: 22px; padding: 18px; }
.type-prompt { font-size: 17px; margin-bottom: 14px; }
.type-entry { position: relative; display: block; width: 100%; cursor: text; }
/* One native input preserves Korean IME composition, paste and screen-reader support. */
.type-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; font-size: 24px; border: 0; padding: 0; }
.type-boxes { display: flex; justify-content: center; gap: 8px; }
.type-cell { display: grid; place-items: center; flex: 0 1 56px; min-width: 0; height: 60px; border: 2px solid #c7cdd9; border-radius: 14px; background: #fff; font-size: 26px; font-weight: 800; position: relative; }
.type-entry:focus-within .type-cell.is-active { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); }
.type-entry:focus-within .type-cell.is-active:empty::after { content: ''; width: 2px; height: 26px; background: var(--primary); }
.type-entry.is-correct .type-cell { background: var(--mint); border-color: #4bb18a; color: var(--green-deep); }

.lab-label { font-weight: 800; margin-bottom: 4px; }
.lab-controls { flex-wrap: wrap; }
.lab-controls button { flex: 1 1 22%; min-width: 64px; font-size: 15px; padding: 10px 6px; }

.is-drop-target { border-color: var(--primary) !important; background: var(--primary-tint); }
.is-dragging { opacity: .4; }
.drag-ghost { position: fixed; left: 0; top: 0; z-index: 50; pointer-events: none; opacity: .92; box-shadow: 0 12px 30px #172b2433; transform-origin: center; }

/* ---------- Lesson path on home ---------- */

.units { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 8px; }
.unit-row { width: 100%; display: flex; align-items: center; gap: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 18px; background: #fff; text-align: left; color: var(--ink); }
.unit-row.is-current { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); }
.unit-row.is-done { background: var(--surface); }
.unit-num { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: var(--surface); font-weight: 800; color: var(--green); flex-shrink: 0; }
.unit-row.is-current .unit-num { background: var(--primary); color: #fff; }
.unit-progress { display: flex; gap: 4px; flex-shrink: 0; }
.unit-progress i { width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.unit-progress i.on { background: var(--green); }


/* ---------- Settings: account ---------- */

.icon-spacer { width: 44px; height: 44px; flex-shrink: 0; }
.settings-page section + section { margin-top: 28px; }
.settings-head { font-size: 15px; color: var(--muted); letter-spacing: .02em; margin: 6px 0 10px; }
.account-card { border: 1px solid var(--line); border-radius: 20px; padding: 18px; background: var(--surface); margin-bottom: 12px; }
.account-card p { margin-bottom: 6px; }
.account-card.is-signed { display: flex; align-items: center; gap: 14px; background: #fff; }
.avatar { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; overflow: hidden; flex-shrink: 0; background: var(--primary-tint); color: var(--primary); font-weight: 800; font-size: 20px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.account-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.account-body small { color: var(--muted); overflow-wrap: anywhere; }
.account-body .ok-line { display: flex; align-items: center; gap: 4px; color: var(--green-deep); margin-top: 4px; }
.account-body .ok-line .icon { width: 16px; height: 16px; }
.google-button {
  width: 100%; min-height: 54px; display: flex; align-items: center; justify-content: center; gap: 12px;
  border: 1px solid #747775; border-radius: 27px; background: #fff; color: #1f1f1f; font-size: 16px; font-weight: 700;
}
.google-button:hover { background: #f8f9fa; }
.google-button:disabled { opacity: .6; }
.g-logo { width: 20px; height: 20px; flex-shrink: 0; }
.inline-error { color: var(--coral-ink); background: var(--coral-tint); border-radius: 14px; padding: 12px 14px; font-size: 15px; margin-top: 8px; }
.settings-page .text-button { display: block; margin: 4px auto 0; }

/* ---------- Responsive ---------- */

/* Phones fill the screen; wider devices show the same 480px app. */
@media (max-width: 480px) {
  :root, body { background: #fff; }
  .app { box-shadow: none; }
}
@media (max-width: 370px) {
  h1 { font-size: 24px; }
  .hero { margin-inline: 16px; padding: 18px 12px; }
  .hero .headline { font-size: 23px; }
  .hero p { font-size: 14px; }
  .hero-scene { flex-basis: 88px; }
  .hero-scene img { width: 96px; height: 125px; }
  .today-steps { margin-inline: 16px; padding: 12px; }
  .today-steps .steps { margin: 0; }
  .today-steps .step { gap: 8px; }
  .course { padding: 12px; gap: 10px; }
  .friend-detail { padding: 16px; gap: 10px; }
  .friend-detail img { width: 85px; height: 110px; }
  .record-head img { width: 90px; height: 110px; }
  .hero-bubble { max-width: 118px; padding: 8px 10px; }
  .prices { gap: 10px; }
  .price { padding: 10px 12px 10px 10px; }
  .map-tabs { margin-left: -19px; margin-right: -19px; padding-left: 19px; padding-right: 19px; }
  .page-body, .lesson-stage { padding-left: 19px; padding-right: 19px; }
  .stats { padding-left: 18px; padding-right: 18px; }
  .stat { font-size: 14px; padding: 0 9px; }
  .next-card, .steps { margin-left: 18px; margin-right: 18px; }
  .next-card { width: calc(100% - 36px); }
  .scene { gap: 0; }
  .scene img { width: 40%; height: 170px; }
  .bubble { font-size: 16px; padding: 15px 12px; }
  .choice { font-size: 17px; padding: 15px 13px; }
  .friend-card img { height: 130px; }
  .friends-strip { gap: 4px; }
  .friend-small img { height: 46px; }
  .primary, .secondary { font-size: 17px; }
  .record-head { gap: 12px; }
}
@media (max-width: 370px) {
  .match-grid, .sort-bins { gap: 6px; }
  .quiz-card { font-size: 14px; padding: 8px 6px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

.map-legend > span { display: inline-flex; align-items: center; gap: 5px; }
.legend-dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; border: 1px solid; }
.topic-bubble { position: fixed; width: calc(100% - 42px); max-width: 410px; max-height: calc(100dvh - 100px); overflow-y: auto; padding: 32px 24px 22px; border: 2px solid #b4dcc8; border-radius: 32px 32px 32px 8px; background: #fffdf5; color: var(--ink); box-shadow: 0 10px 0 #a7d9c0, 0 24px 70px #20382433; }
.topic-bubble::backdrop { background: #233c3166; backdrop-filter: blur(5px); }
.topic-bubble .eyebrow { padding-right: 25px; color: #648159; font-size: 12px; }
.topic-bubble h2 { margin-top: 12px; font-size: 27px; }
.topic-bubble p { font-size: 17px; color: #52634c; margin: 18px 0 24px; }
.topic-bubble .bubble-question { font-size: 18px; font-weight: 700; margin: 14px 0 10px; color: #354d31; }
.bubble-close { position: absolute; right: 12px; top: 12px; border: 0; border-radius: 50%; width: 44px; height: 44px; background: #eef1e5; font-size: 25px; color: #58714c; }

/* ---------- Economic arcade: lobby, stage board, play feedback ---------- */
:root { --ink: #253450; --muted: #63718a; --shell: #eef0f8; --line: #e5e8f2; --primary: #5261e8; --primary-deep: #3848c6; --primary-tint: #eef0ff; }
.screen-home, .screen-content { background: #fafbff; }
.brand { color: #4358c7; }
.stats { gap: 7px; padding: 12px 20px; }
.stat { background: #fff; border: 1px solid var(--line); border-bottom-width: 3px; padding: 0 10px; }
.stat.is-xp { color: #5261ba; background: #f0eeff; border-color: #e2ddfc; }
.stat.is-league { color: #966017; background: #fff5d6; border-color: #f4e3ae; }
.game-kicker { display: block; font-size: 11px; letter-spacing: 1.3px; line-height: 1.4; font-weight: 800; }
.arcade-hero { position: relative; isolation: isolate; margin: 4px 20px 0; min-height: 250px; border-radius: 28px; background: #6575ef; padding: 28px 24px; color: #fff; overflow: hidden; }
.arcade-hero::before { content: ''; position: absolute; width: 280px; height: 280px; border: 48px solid #9eacff66; border-radius: 50%; right: -100px; top: -70px; z-index: -1; }
.arcade-hero::after { content: ''; position: absolute; width: 200px; height: 100px; transform: rotate(-20deg); background: #5161d7; border-radius: 50%; right: -25px; bottom: -40px; z-index: -1; }
.arcade-hero > .game-kicker { color: #e9ecff; }
.arcade-hero h1 { font-size: clamp(28px, 7.8vw, 38px); letter-spacing: -1.6px; line-height: 1.3; margin-top: 13px; position: relative; z-index: 2; width: 62%; pointer-events: none; }
.arcade-mascot { position: absolute; right: 8px; bottom: 18px; width: 49%; background: transparent; border: 0; display: flex; align-items: center; flex-direction: column; padding: 0; border-radius: 20px; }
.arcade-mascot img { width: 100%; height: 190px; object-fit: contain; filter: drop-shadow(0 8px 0 #273c7d16); transform: rotate(8deg); animation: mascot-entry .65s cubic-bezier(.2,.9,.3,1.3); }
.arcade-mascot .hero-friends-label { position: relative; z-index: 3; color: #354497; background: #ffffffec; padding: 5px 10px; }
.hero-orbit { position: absolute; display: grid; place-items: center; border: 3px solid #ffffff7a; box-shadow: 0 5px 0 #22388b20; }
.orbit-one { width: 40px; height: 40px; background: #ffcd4f; color: #925900; border-radius: 13px; right: 24px; top: 25px; transform: rotate(18deg); }
.orbit-two { width: 29px; height: 29px; border-radius: 50%; background: #ad92f5; color: #fff; right: 47%; bottom: 33px; transform: rotate(-12deg); }
.orbit-two .icon { width: 16px; height: 16px; }
.launch-card { position: relative; z-index: 2; margin: 16px 20px 0; padding: 18px; border: 1px solid #e1e5f4; border-bottom: 4px solid #e1e5f4; background: #fff; border-radius: 24px; }
.launch-heading { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; }
.stage-number { flex-shrink: 0; width: 46px; height: 50px; display: grid; place-items: center; border-radius: 14px; background: #edf0ff; font-size: 23px; font-weight: 800; color: #5062d2; }
.launch-heading .game-kicker { color: #71809c; font-size: 10px; letter-spacing: 1px; }
.launch-heading h2 { font-size: 24px; margin-top: 3px; }
.xp-ticket { margin-left: auto; flex-shrink: 0; border-radius: 8px; color: #8a610c; background: #fff4cc; padding: 6px 8px; font-size: 12px; font-weight: 800; }
.play-button { display: flex; align-items: center; justify-content: center; gap: 12px; color: #463b22; background: #ffce4a; border-color: #dca82e; font-size: 21px; min-height: 62px; border-radius: 18px; }
.play-button:hover { background: #ffdb70; }
.play-button .icon:last-child { margin-left: auto; width: 20px; }
.play-button .icon:first-child { margin-right: auto; }
.sound-invite { display: flex; align-items: center; justify-content: center; gap: 5px; width: 100%; min-height: 44px; margin-top: 8px; border: 0; background: #f0f2ff; color: #4c5cb2; border-radius: 12px; font-size: 14px; font-weight: 700; }
.sound-invite .icon { width: 18px; height: 18px; }
.mode-steps { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; margin: 17px 0 0; }
.mode-steps .step { flex-direction: column; gap: 7px; padding: 6px 0; text-align: center; border-radius: 14px; }
.mode-steps .step-dot { width: 36px; height: 36px; border-radius: 12px; }
.mode-steps .step-body strong { font-size: 12px; letter-spacing: -.5px; }
.mode-steps .step-xp { font-size: 11px; }
.daily-quest { display: flex; align-items: center; gap: 14px; margin: 18px 20px 0; padding: 16px; background: #fff1de; border: 1px solid #f5ddbc; border-radius: 21px; }
.daily-quest h2 { font-size: 17px; }
.quest-emblem { width: 48px; height: 48px; border-radius: 15px; background: #ffcf78; box-shadow: 0 4px 0 #e9ad50; color: #83551a; display: grid; place-items: center; transform: rotate(-7deg); }
.quest-emblem .icon { width: 30px; height: 30px; }
.quest-value { display: block; color: #8a5817; font-size: 15px; font-weight: 800; margin-top: 3px; }
.daily-quest > .icon-button, .quest-check { margin-left: auto; }
.daily-quest.is-complete { background: #e8f6ee; border-color: #cce9d7; }
.is-complete .quest-emblem { background: #b0e2c0; box-shadow: 0 4px 0 #8ac9a0; color: #256542; }
.is-complete .quest-value { color: #256542; }
.lobby-stages { padding-top: 24px; }
.section-label .text-button { display: inline-flex; gap: 2px; align-items: center; font-size: 13px; }
.section-label .text-button .icon { width: 15px; height: 15px; }
.stage-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 15px; }
.stage-tile { position: relative; display: flex; align-items: center; flex-direction: column; padding: 12px 12px 15px; min-height: 177px; border: 2px solid #e0e4ef; border-bottom-width: 6px; border-radius: 23px; background: #f1f3f8; text-align: center; color: #68738b; }
.tile-top { display: flex; width: 100%; justify-content: space-between; font-size: 12px; font-weight: 800; }
.tile-top .icon { width: 16px; height: 16px; }
.tile-graphic { display: grid; place-items: center; width: 58px; height: 58px; margin: 4px 0 12px; background: #e0e5f0; color: #7c8da9; border-radius: 20px; box-shadow: 0 4px 0 #d0d7e5; }
.tile-graphic > .icon { width: 33px; height: 33px; stroke-width: 1.7; fill: #ffffff6b; }
.tile-graphic .stage-art { width: 49px; height: 49px; filter: drop-shadow(0 2px 0 #24355412); }
.is-locked .stage-art { opacity: .62; filter: saturate(.55); }
.tile-graphic.motif-1 { transform: rotate(-9deg); border-radius: 50%; }
.tile-graphic.motif-2 { transform: rotate(7deg); border-radius: 14px; }
.tile-graphic.motif-3 { border-radius: 50% 50% 16px 16px; }
.stage-tile strong { font-size: 18px; line-height: 1.4; }
.tile-stars { display: flex; gap: 5px; margin-top: 9px; }
.tile-stars i { display: block; color: #a6b0c4; }
.tile-stars .icon { width: 15px; height: 15px; }
.tile-stars i.earned { color: #aa790e; }
.tile-stars i.earned .icon { fill: #ffd96f; }
.stage-tile.is-ready { border-color: #ead07e; background: #fff6d8; color: #76520d; }
.is-ready .tile-graphic { background: #ffdb74; box-shadow: 0 4px 0 #e6ba4e; color: #946213; }
.stage-tile.is-done { background: #e6f6ec; border-color: #b9dec6; color: #277a51; }
.is-done .tile-graphic { background: #b6e6c9; color: #2a8254; box-shadow: 0 4px 0 #94d3ad; }
.stage-tile.is-next { outline: 3px solid #7583e9; outline-offset: 3px; }
.stage-tile:active { transform: translateY(3px); border-bottom-width: 3px; margin-bottom: 3px; }
.compact-stages .stage-tile { min-height: 150px; }
.compact-stages .tile-graphic { width: 44px; height: 44px; margin: 0 0 8px; }
.compact-stages .tile-graphic .icon { width: 27px; height: 27px; }
.compact-stages .tile-graphic .stage-art { width: 39px; height: 39px; }
.world-tabs { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 9px; margin-bottom: 20px; }
.world-tabs button { display: flex; align-items: center; justify-content: center; gap: 5px; border: 2px solid #e0e4f0; border-bottom-width: 4px; min-height: 58px; padding: 7px 2px; border-radius: 16px; background: #fff; font-weight: 800; font-size: 14px; }
.world-tabs .icon { width: 19px; height: 19px; color: #8873bb; }
.world-tabs button[aria-pressed=true] { background: #5365d9; color: #fff; border-color: #394dba; }
.world-tabs button[aria-pressed=true] .icon { color: #ffdc6b; }
.world-banner { position: relative; display: flex; align-items: center; min-height: 170px; padding: 23px 20px; border-radius: 25px; background: #e4eaff; overflow: hidden; }
.world-banner > div { flex: 1; position: relative; z-index: 1; }
.world-banner h1 { font-size: 25px; max-width: 180px; margin: 8px 0 15px; }
.world-banner .game-kicker { color: #5366ae; }
.world-banner img { width: 42%; height: 150px; object-fit: contain; transform: rotate(7deg); margin-right: -10px; }
.world-banner.world-1 { background: #fff0cf; }
.world-banner.world-2 { background: #e8defa; }
.world-count { display: inline-block; border-radius: 9px; background: #ffffffc7; padding: 6px 9px; color: #435b9a; font-size: 12px; font-weight: 800; }
.topic-arena { text-align: center; }
.topic-podium { position: relative; width: 230px; max-width: 100%; margin: 0 auto 20px; border-radius: 50%; background: radial-gradient(ellipse at 50% 70%,#e4e9ff 0 56%,transparent 57%); }
.topic-podium img { width: 100%; height: 200px; object-fit: contain; }
.podium-star { position: absolute; right: 6px; top: 15px; color: #bf8f15; transform: rotate(13deg); }
.podium-star .icon { width: 42px; height: 42px; fill: #ffdc6b; }
.topic-arena h1 { font-size: 32px; }
.challenge-modes { margin: 24px 0; }
.challenge-modes .step { border: 2px solid #e2e6f1; border-bottom-width: 5px; border-radius: 18px; padding: 16px 12px; margin: 12px 0; background: #fff; }
.challenge-modes .step.is-current { background: #eff0ff; border-color: #b7c0f5; }
.challenge-modes .step.is-done { background: #e9f7ee; border-color: #bddfc9; }
.explain-fold { text-align: left; margin: 16px 0; border: 1px solid var(--line); border-radius: 15px; background: #fff; }
.explain-fold summary { padding: 14px 16px; font-size: 15px; font-weight: 700; color: #64748c; cursor: pointer; min-height: 48px; }
.explain-fold p { padding: 0 16px 17px; font-size: 16px; }
summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 10px; }
.primary { box-shadow: 0 2px 0 #1e2a7e0d; }
.primary:active:not(:disabled) { transform: translateY(3px); }
.lesson-stage { padding-top: 22px; }
.lesson-stage h1 { font-size: 25px; }
.screen-lesson .scene { min-height: 105px; margin: 14px 0 20px; gap: 10px; }
.screen-lesson .scene img { width: 28%; height: 112px; }
.screen-lesson .bubble { font-size: 16px; padding: 14px; line-height: 1.55; border: 2px solid #dfe7ed; background: #fff; box-shadow: 0 3px 0 #dfe7ed; }
.screen-lesson .bubble { border-color: color-mix(in srgb,var(--tint) 65%,#bdcecd); box-shadow: 0 3px 0 color-mix(in srgb,var(--tint) 65%,#bdcecd); }
.story-art { background: #fff0d5; border: 2px solid #f0d7aa; box-shadow: 0 5px 0 #f3e4c9; }
.story-art .art.is-large { width: 84px; height: 84px; }
.story-caption { font-size: 18px; margin: 18px 0; }
.quiz-guide { font-size: 16px; color: #536681; font-weight: 700; }
.match-grid { padding: 14px; margin-inline: -8px; border-radius: 23px; background: #f1edfc; }
.sort-pool { background: #fff4d9; border-color: #edd8a3; }
.sort-bin:first-child { background: #edf4ff; border-color: #bed0ef; }
.sort-bin:last-child { background: #fff0e9; border-color: #efcdba; }
.build-line { background: #eef8f2; border-color: #badcc8; }
.type-card { background: #f1effc; border-radius: 22px; padding: 20px 14px; }
.lab { background: #f7faff; border-color: #cdddf0; }
.budget-bar { border-bottom: 4px solid #3848ba; height: 24px; }
.budget-bar.cost { border-color: #aa532a; }
.answer-explain { margin-bottom: 12px; }
.answer-explain h3 { font-size: 15px; margin-top: 12px; color: #276750; }
.answer-explain p { margin: 6px 0 14px; font-size: 16px; line-height: 1.6; }
.role-principle { margin-top: 12px; font-weight: 700; }
.screen-lesson .action-panel { max-height: 65dvh; overflow-y: auto; overscroll-behavior: contain; }
.screen-lesson.answer-hit .scene img { animation: character-cheer .55s ease-out; }
.arcade-result { background: radial-gradient(ellipse at 50% 25%,#efebff,transparent 58%); padding-top: 28px; }
.clear-ribbon { display: inline-block; background: #6556c4; color: #fff; padding: 10px 25px; border-radius: 12px; font-size: 18px; letter-spacing: 1.5px; font-weight: 800; transform: rotate(-3deg); box-shadow: 0 5px 0 #d4cbf5; }
.winner-art { position: relative; width: 230px; margin: auto; }
.winner-art img { animation: character-cheer .7s ease-out; width: 200px; height: 200px; margin-bottom: 0; }
.winner-star { position: absolute; color: #c59727; }
.winner-star .icon { width: 43px; height: 43px; fill: #ffdf77; }
.star-left { left: 0; top: 70px; transform: rotate(-20deg); }
.star-right { right: 0; top: 25px; transform: rotate(15deg); }
.arcade-result h1 { font-size: 29px; }
.round-final strong { display: block; font-size: 60px; line-height: 1.2; font-weight: 800; color: #6552c1; letter-spacing: -2px; animation: score-in .45s ease-out; }
.round-final strong span { font-size: 22px; margin-left: 5px; }
.result-rewards { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 20px 0 12px; }
.result-rewards > span { display: inline-flex; gap: 5px; align-items: center; padding: 10px; border-radius: 12px; background: #f0edfb; color: #605095; font-size: 13px; font-weight: 800; }
.result-rewards > span:first-child { background: #fff2cf; color: #8d661b; }
.result-rewards .icon { width: 18px; height: 18px; }
.level-meter { margin: 22px 10px 4px; text-align: left; }
.level-meter b { font-size: 13px; color: #666095; }
.level-meter progress { margin: 9px 0; }
.game-fx { pointer-events: none; position: fixed; top: 0; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; overflow: hidden; z-index: 80; }
@keyframes mascot-entry { from { opacity: 0; transform: translateY(30px) rotate(-8deg); } to { opacity: 1; transform: translateY(0) rotate(8deg); } }
@keyframes character-cheer { 0%,100% { transform: translateY(0) rotate(0); } 35% { transform: translateY(-14px) rotate(-7deg); } 65% { transform: translateY(-5px) rotate(6deg); } }
@keyframes gentle-shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
@keyframes score-in { from { transform: scale(.7); opacity: .2; } to { transform: scale(1); opacity: 1; } }
/* ---------- Play HUD: one bar with progress, combo, score and mission pips ---------- */
.lesson-top.game-hud { display: flex; align-items: center; gap: 10px; padding: max(14px, env(safe-area-inset-top)) 14px 12px; position: sticky; top: 0; z-index: 10; background: #fffffff5; border-bottom: 1px solid #ecedf6; }
.lesson-top.game-hud .icon-button { flex-shrink: 0; }
.lesson-progress { position: relative; flex: 1; min-width: 0; }
.lesson-progress progress { display: block; height: 16px; }
.lesson-progress progress::-webkit-progress-value { background: linear-gradient(#7d8bff 0 40%, var(--primary) 40%); transition: width .45s cubic-bezier(.2,.9,.3,1.2); }
.lesson-progress progress.is-hot::-webkit-progress-value { background: linear-gradient(#ffc166 0 40%, #ff8a1f 40%); }
.lesson-progress progress.is-hot::-moz-progress-bar { background: #ff8a1f; }
.combo-meter { position: absolute; left: 4px; top: -15px; display: inline-flex; align-items: center; gap: 2px; padding: 1px 7px 1px 4px; border-radius: 9px; background: #fff3dc; color: #b45a00; font-size: 12px; font-weight: 800; line-height: 1.4; animation: combo-in .35s cubic-bezier(.2,.9,.3,1.5); }
.combo-meter .icon { width: 14px; height: 14px; color: #ff8a1f; fill: #ffc166; }
.combo-meter.is-hot { background: #ff8a1f; color: #fff; }
.combo-meter.is-hot .icon { color: #fff; fill: #ffd27a; animation: flame-flicker .6s ease-in-out infinite alternate; }
.combo-meter.is-idle { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; padding: 0; }
.round-score { display: inline-flex; align-items: center; gap: 3px; min-width: 58px; justify-content: flex-end; font-weight: 800; }
.round-score b { font-size: 21px; color: #5f51c6; font-variant-numeric: tabular-nums; }
.round-score .icon { width: 24px; height: 24px; color: #d19a12; fill: #ffd34d; }
.round-score.is-bump { animation: score-bump .5s cubic-bezier(.2,.9,.3,1.6); }
.mini-mission { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.mini-mission .icon { width: 22px; height: 22px; color: #8260b9; fill: #e6dcff; }
.mini-mission .pips { display: flex; gap: 2px; }
.mini-mission .pips i { width: 7px; height: 5px; border-radius: 3px; background: #e1e5f6; }
.mini-mission .pips i.on { background: #9278e4; }

/* Pip rows replace "n / total" helper text inside challenges. */
.pip-row { display: flex; justify-content: center; gap: 6px; margin: 14px 0 4px; }
.pip-row i { width: 22px; height: 8px; border-radius: 4px; background: #e1e5f1; transition: background .2s; }
.pip-row i.on { background: var(--primary); }

/* ---------- Answer feedback: bottom sheet slides up ---------- */
.screen-lesson .action-panel.correct, .screen-lesson .action-panel.retry { border-top: 0; animation: sheet-up .32s cubic-bezier(.2,.9,.3,1.15) both; }
.screen-lesson .action-panel.correct { background: #d9f7e4; }
.screen-lesson .action-panel.retry { background: #ffe3dc; }
.feedback-title { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; font-size: 22px; font-weight: 800; }
.feedback-badge { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: #fff; flex-shrink: 0; }
.feedback-badge .icon { width: 20px; height: 20px; stroke-width: 3; }
.correct .feedback-badge { color: #14935f; animation: badge-pop .45s .1s cubic-bezier(.2,.9,.3,1.8) both; }
.retry .feedback-badge { color: #d64a2b; }
.feedback-title .earned { margin-left: auto; padding: 3px 10px; border-radius: 10px; background: #ffd34d; color: #6a4513; font-size: 17px; animation: badge-pop .45s .18s cubic-bezier(.2,.9,.3,1.8) both; }
.screen-lesson .action-panel.correct .primary { background: #1fae6f; border-color: #138a55; }
.screen-lesson .action-panel.retry .primary { background: #ef6a4a; border-color: #c94d30; }
.choice.correct, .quiz-card.is-done, .type-entry.is-correct .type-cell { animation: pop-in .35s cubic-bezier(.2,.9,.3,1.6); }
.screen-lesson.answer-miss .lesson-stage { animation: gentle-shake .32s ease-out; }

/* ---------- Floating score, mission card, confetti burst ---------- */
.game-fx { pointer-events: none; position: fixed; top: 0; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; overflow: hidden; z-index: 80; }
.score-pop { position: absolute; top: 36%; left: 50%; translate: -50% -50%; white-space: nowrap; padding: 10px 20px; border: 3px solid #fff; border-radius: 20px; background: #7659d2; color: #fff; font-size: 30px; font-weight: 800; box-shadow: 0 6px 0 #3a258533; animation: score-fly 1s cubic-bezier(.5,0,.6,1) both; }
.score-pop.is-combo { background: #ff8a1f; box-shadow: 0 6px 0 #a3480033; }
.mission-card { position: absolute; top: 34%; left: 50%; translate: -50% -50%; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 22px 34px 20px; border: 4px solid #fff; border-radius: 28px; background: #ffd34d; color: #6a4513; box-shadow: 0 10px 0 #b9851a55, 0 20px 50px #3a258533; animation: mission-in 2s cubic-bezier(.2,.9,.3,1.3) both; }
.mission-card strong { font-size: 26px; }
.mission-card b { font-size: 34px; color: #7a3fd0; }
.mission-gift { display: grid; place-items: center; width: 66px; height: 66px; border-radius: 22px; background: #fff; animation: gift-wiggle .5s .3s ease-in-out 2; }
.mission-gift .icon { width: 42px; height: 42px; color: #8260b9; fill: #e6dcff; }
.game-confetti { position: absolute; left: 50%; top: var(--oy, 38%); width: 9px; height: 15px; border-radius: 3px; background: var(--color); animation: confetti-burst 1.15s var(--delay) cubic-bezier(.15,.7,.4,1) both; }
.game-confetti.is-round { width: 11px; height: 11px; border-radius: 50%; }
.game-fx.is-finish .game-confetti { animation-duration: 1.7s; }
.game-fx.is-still .score-pop, .game-fx.is-still .mission-card { animation: none; }
.game-fx.is-still .score-pop { opacity: 1; top: 90px; font-size: 20px; padding: 6px 12px; }
.round-final b { font: inherit; font-variant-numeric: tabular-nums; }
.result-rewards > span { animation: pop-in .4s cubic-bezier(.2,.9,.3,1.6) both; }
.result-rewards > span:nth-child(2) { animation-delay: .5s; }
.result-rewards > span:nth-child(3) { animation-delay: .7s; }
.result-rewards > span:first-child { animation-delay: .3s; }
.result-rewards .is-bonus { background: #e2f6ea; color: #23744a; }
.result-rewards b { font: inherit; }

@keyframes sheet-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes badge-pop { from { transform: scale(0); } to { transform: scale(1); } }
@keyframes pop-in { 0% { transform: scale(1); } 40% { transform: scale(1.06); } 100% { transform: scale(1); } }
@keyframes score-bump { 0% { transform: scale(1); } 35% { transform: scale(1.35); } 100% { transform: scale(1); } }
@keyframes combo-in { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes flame-flicker { from { transform: scale(1) rotate(-6deg); } to { transform: scale(1.15) rotate(6deg); } }
@keyframes score-fly {
  0% { opacity: 0; transform: translate(0, 24px) scale(.5); }
  22% { opacity: 1; transform: translate(0, 0) scale(1.12); }
  55% { opacity: 1; transform: translate(0, 0) scale(1); }
  100% { opacity: 0; transform: translate(var(--tx, 0), var(--ty, -200px)) scale(.3); }
}
@keyframes mission-in {
  0% { opacity: 0; transform: scale(.3) rotate(-8deg); }
  18% { opacity: 1; transform: scale(1.08) rotate(2deg); }
  28%, 82% { opacity: 1; transform: scale(1) rotate(0); }
  100% { opacity: 0; transform: scale(.85) translateY(-30px); }
}
@keyframes gift-wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-14deg) scale(1.1); } 75% { transform: rotate(14deg) scale(1.1); } }
@keyframes confetti-burst {
  0% { opacity: 1; transform: translate(-50%, 0) scale(.3) rotate(0); }
  35% { opacity: 1; transform: translate(calc(-50% + var(--dx)), var(--dy)) scale(1) rotate(calc(var(--turn) * .5)); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx) * 1.25), calc(var(--dy) + 260px)) scale(.8) rotate(var(--turn)); }
}
@media (max-width: 370px) {
  .lesson-top.game-hud { gap: 7px; padding-inline: 10px; }
  .round-score { min-width: 48px; }
  .round-score b { font-size: 18px; }
  .score-pop { font-size: 26px; }
  .mission-card { padding: 18px 26px; }
}
.reduce-motion *, .reduce-motion *::before, .reduce-motion *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media (max-width: 370px) {
  .arcade-hero { margin-inline: 16px; padding: 24px 18px; min-height: 230px; }
  .arcade-mascot img { height: 165px; }
  .launch-card { margin-inline: 16px; padding: 15px; }
  .launch-heading { gap: 9px; }
  .launch-heading h2 { font-size: 22px; }
  .xp-ticket { font-size: 10px; padding: 5px; }
  .daily-quest { margin-inline: 16px; padding: 14px; gap: 10px; }
  .daily-quest h2 { font-size: 15px; }
  .mode-steps .step-body strong { font-size: 11px; }
  .stage-grid { gap: 12px; }
  .stage-tile { padding: 12px 7px; }
  .stage-tile strong { font-size: 16px; }
  .world-tabs button { font-size: 12px; gap: 4px; }
  .world-banner { padding: 19px 15px; }
  .world-banner h1 { font-size: 23px; }
}

/* Competition lobby: real participants, personal records remain one tap away. */
.top-actions { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.record-shortcut { display: inline-flex; align-items: center; gap: 5px; min-height: 44px; padding: 6px 8px; border: 0; background: #eff6ef; border-radius: 13px; color: #287657; font-size: 13px; font-weight: 800; white-space: nowrap; }
.record-shortcut .icon { width: 19px; height: 19px; }
.ranking-page { padding: 16px 18px 22px; }
.rank-hero { display: flex; align-items: center; justify-content: space-between; gap: 5px; position: relative; overflow: hidden; border-radius: 28px; padding: 26px 22px 20px; background: linear-gradient(125deg,#5b59d7,#8f72e9); color: white; }
.rank-season { font-size: 10px; font-weight: 800; letter-spacing: 1.6px; color: #e8ddff; }
.rank-hero h1 { font-size: 29px; line-height: 1.25; margin: 12px 0 0; letter-spacing: -1.2px; color: #fff; }
.rank-hero h1 span { color: #ffe783; font-size: 42px; }
.rank-hero-art { position: relative; width: 136px; flex-shrink: 0; align-self: flex-end; }
.rank-hero-art img { width: 136px; height: 136px; object-fit: contain; position: relative; z-index: 1; filter: drop-shadow(0 9px 0 #453da72a); }
.rank-hero-art > .icon { position: absolute; top: -15px; right: -3px; width: 57px; height: 57px; color: #ffda67; fill: #ffda6744; transform: rotate(16deg); }
.rank-podium { display: flex; align-items: flex-end; justify-content: center; gap: 8px; margin: 24px 0 16px; }
.podium-place { display: flex; flex: 1; min-width: 0; position: relative; flex-direction: column; align-items: center; padding: 12px 3px; background: #f0edff; border-radius: 22px 22px 12px 12px; border-bottom: 5px solid #d8cff2; }
.podium-place picture img { width: 80px; height: 80px; object-fit: contain; }
.podium-place b { font-size: 11px; overflow-wrap: anywhere; text-align: center; }
.podium-place > span:last-child { font-size: 13px; font-weight: 800; color: #7a6132; margin-top: 5px; }
.podium-1 { order: 2; padding-top: 24px; background: #fff3cd; border-color: #efd17f; }
.podium-1 picture img { width: 96px; height: 96px; }
.podium-2 { order: 1; background: #edf2fa; border-color: #c9d5e7; }
.podium-3 { order: 3; background: #ffecdf; border-color: #eac4ab; }
.podium-medal { position: absolute; top: -13px; font-size: 13px; font-weight: 800; background: #fff; padding: 3px 9px; border-radius: 20px; box-shadow: 0 3px 0 #0000000a; }
.rank-join { text-align: center; margin: 18px 0; border: 1px solid #e7e2fb; border-radius: 23px; padding: 20px 18px; background: #faf8ff; }
.rank-join h2 { font-size: 22px; margin: 0; }
.rank-join p { font-size: 14px; margin: 8px 0 16px; color: #6d6b80; }
.rank-join .primary { background: #7160ce; border-color: #5545aa; }
.my-rank-button { width: 100%; display: flex; justify-content: space-between; align-items: center; margin: 18px 0; padding: 12px 15px; border: 2px solid #aa92e9; border-bottom-width: 5px; border-radius: 22px; background: #f1ebff; color: #51428b; text-align: left; }
.my-rank-button > span:first-child { display: flex; align-items: center; gap: 8px; }
.my-rank-button picture img { width: 55px; height: 55px; object-fit: contain; }
.my-rank-button b { display: block; font-size: 13px; }
.my-rank-button strong { display: block; font-size: 26px; }
.my-rank-xp { display: flex; align-items: center; gap: 5px; font-size: 17px; font-weight: 800; }
.rank-list-heading { display: flex; justify-content: space-between; align-items: center; margin: 26px 0 12px; }
.rank-list-heading h2 { font-size: 22px; }
.rank-list-heading button { display: flex; align-items: center; font-size: 12px; gap: 4px; }
.rank-list-heading .icon { width: 16px; height: 16px; }
.rank-list, .rank-track { list-style: none; padding: 0; margin: 0; }
.rank-row { display: flex; align-items: center; gap: 9px; padding: 11px 10px; min-height: 75px; border: 1px solid #eceaf3; border-bottom-width: 3px; border-radius: 19px; margin-bottom: 8px; background: #fff; }
.rank-row.is-me { border-color: #a596e5; background: #eee9ff; box-shadow: 0 3px 0 #d4c8f2; }
.rank-number { min-width: 24px; text-align: center; font-size: 18px; font-weight: 800; color: #777287; }
.rank-avatar { width: 46px; height: 46px; object-fit: contain; }
.rank-name { flex: 1; min-width: 0; font-size: 13px; font-weight: 800; overflow-wrap: anywhere; }
.rank-name em { display: inline-block; margin-left: 5px; padding: 1px 5px; font-style: normal; font-size: 10px; color: #fff; background: #8062c9; border-radius: 6px; }
.rank-row > strong { white-space: nowrap; font-size: 17px; color: #6e5ba8; }
.rank-row small { display: block; font-size: 10px; text-align: right; color: #91879f; }
.rank-empty { text-align: center; padding: 22px 12px 28px; border: 2px dashed #ded9ec; border-radius: 24px; background: #fcfbff; }
.rank-empty > .icon { width: 47px; height: 47px; color: #c6a244; fill: #fff0b6; }
.rank-empty h2 { font-size: 18px; margin: 12px 0 6px; }
.rank-empty p, .rank-footnote, .rank-status { font-size: 13px; color: #7f7a8e; }
.rank-footnote { text-align: center; margin-top: 12px; }
.rank-play { margin: 20px 0 16px; }
.rank-play .primary { display: flex; justify-content: center; align-items: center; gap: 9px; }
.rank-rules { font-size: 13px; line-height: 1.6; }
.rank-dialog { width: min(420px,calc(100vw - 24px)); max-height: calc(100dvh - 32px); overflow: auto; border: 0; border-radius: 28px; padding: 14px 18px 20px; background: #faf8ff; box-shadow: 0 24px 80px #29204755; color: var(--ink); }
.rank-dialog::backdrop { background: #29204799; backdrop-filter: blur(4px); }
.rank-dialog-top { display: flex; justify-content: flex-end; }
.rank-dialog h2 { font-size: 27px; text-align: center; margin: 0; color: #6350a6; }
.rank-count { display: flex; justify-content: center; align-items: baseline; color: #7656c4; line-height: 1.2; margin-top: 8px; }
.rank-count b { font-size: 70px; font-variant-numeric: tabular-nums; }
.rank-count span { font-size: 25px; font-weight: 800; margin-left: 4px; }
.rank-change { text-align: center; color: #817293; font-size: 14px; margin: 6px 0 20px; }
.rank-track { position: relative; overflow: hidden; padding: 3px 0 8px; }
.rank-dialog > button { width: 100%; margin-top: 9px; }
.rank-dialog.is-climbing .rank-row.is-me { position: relative; z-index: 2; animation: rank-rise 1.4s cubic-bezier(.18,.7,.24,1) both; }
.rank-dialog.is-climbing .rank-row.is-me ~ .rank-row { animation: rank-yield 1.4s cubic-bezier(.18,.7,.24,1) both; }
@keyframes rank-rise { from { transform: translateY(var(--climb-distance,150px)) scale(1.04); box-shadow: 0 8px 24px #7959b844; } to { transform: translateY(0) scale(1); } }
@keyframes rank-yield { from { transform: translateY(-74px); } to { transform: translateY(0); } }
@media (max-width:360px) {
  .topbar { padding-inline: 12px; gap: 5px; }
  .brand { font-size: 21px; }
  .top-title { font-size: 18px; }
  .record-shortcut { font-size: 12px; padding-inline: 6px; }
  .record-shortcut .icon { display: none; }
  .ranking-page { padding-inline: 12px; }
  .rank-hero { padding: 22px 16px 18px; }
  .rank-hero h1 { font-size: 25px; }
  .rank-hero-art, .rank-hero-art img { width: 110px; height: 124px; }
  .podium-place picture img { width: 70px; height: 70px; }
  .podium-1 picture img { width: 80px; height: 80px; }
  .rank-row { gap: 6px; padding-inline: 8px; }
}
@media (prefers-reduced-motion: reduce) { .rank-dialog .rank-row { animation: none !important; } }
.reduce-motion .rank-dialog .rank-row { animation: none !important; }

/* ---------- Launch card: which of the three parts is next ---------- */
.part-tag { display: inline-flex; align-items: center; gap: 4px; margin-top: 5px; padding: 3px 9px 3px 6px; border-radius: 9px; font-size: 12px; font-weight: 800; background: #eef0ff; color: #4a59c4; }
.part-tag .icon { width: 14px; height: 14px; }
.part-tag.part-review { background: #e6f6ec; color: #23744a; }
.part-tag.part-apply { background: #fff1d6; color: #95600f; }

/* ---------- Stage board: big world cards, stages in a sheet ---------- */
.world-list { display: grid; gap: 16px; }
.world-card { position: relative; display: flex; align-items: center; gap: 8px; min-height: 168px; padding: 22px 12px 22px 22px; border: 0; border-bottom: 6px solid #00000014; border-radius: 28px; text-align: left; color: #fff; overflow: hidden; isolation: isolate; }
.world-card::before { content: ""; position: absolute; z-index: -1; width: 230px; height: 230px; right: -60px; top: -50px; border-radius: 50%; border: 40px solid #ffffff26; }
.world-card.world-0 { background: #5d6df0; }
.world-card.world-1 { background: #f2a93b; }
.world-card.world-2 { background: #9a6fe0; }
.world-card.is-soon { filter: saturate(.75); }
.world-card:active { transform: translateY(3px); border-bottom-width: 3px; }
.world-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.world-no { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 800; letter-spacing: 1px; opacity: .9; }
.world-no .icon { width: 16px; height: 16px; }
.world-card strong { font-size: 34px; line-height: 1.2; margin: 6px 0 2px; letter-spacing: -1px; }
.world-sub { font-size: 15px; font-weight: 700; opacity: .92; }
.world-meter { display: block; height: 10px; margin: 14px 0 7px; border-radius: 6px; background: #ffffff40; overflow: hidden; max-width: 170px; }
.world-meter i { display: block; height: 100%; border-radius: 6px; background: #fff; min-width: 4px; }
.world-card .world-count { background: none; padding: 0; color: #fff; font-size: 12px; }
.world-card img { width: 128px; height: 140px; object-fit: contain; flex-shrink: 0; transform: rotate(6deg); filter: drop-shadow(0 6px 0 #00000018); }

.world-sheet { position: fixed; inset: auto 0 0; margin: auto auto 0; width: 100%; max-width: 480px; max-height: 86dvh; overflow-y: auto; padding: 0 16px max(20px, env(safe-area-inset-bottom)); border: 0; border-radius: 28px 28px 0 0; background: #fafbff; color: var(--ink); box-shadow: 0 -10px 40px #1d244f33; }
.world-sheet[open] { animation: sheet-up .32s cubic-bezier(.2,.9,.3,1.1); }
.world-sheet::backdrop { background: #1d244f80; backdrop-filter: blur(3px); }
.sheet-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 10px; margin: 0 -16px 14px; padding: 18px 12px 14px 20px; color: #fff; border-radius: 28px 28px 0 0; }
.world-sheet.world-0 .sheet-head { background: #5d6df0; }
.world-sheet.world-1 .sheet-head { background: #f2a93b; }
.world-sheet.world-2 .sheet-head { background: #9a6fe0; }
.sheet-head > div { flex: 1; }
.sheet-head h2 { font-size: 26px; color: #fff; }
.sheet-head .world-count { background: #ffffff33; color: #fff; }
.sheet-head .icon-button { color: #fff; }
.stage-grid.is-three, .compact-stages { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.is-three .stage-tile, .compact-stages .stage-tile { min-height: 132px; padding: 9px 5px 11px; border-radius: 18px; border-bottom-width: 5px; }
.is-three .tile-graphic, .compact-stages .tile-graphic { width: 44px; height: 44px; margin: 2px 0 7px; border-radius: 15px; }
.is-three .tile-graphic .stage-art, .compact-stages .tile-graphic .stage-art { width: 36px; height: 36px; }
.is-three .stage-tile strong, .compact-stages .stage-tile strong { font-size: 14px; line-height: 1.3; letter-spacing: -.4px; }
.is-three .tile-stars, .compact-stages .tile-stars { gap: 2px; margin-top: auto; padding-top: 6px; }
.is-three .tile-stars .icon, .compact-stages .tile-stars .icon { width: 13px; height: 13px; }
.is-three .tile-top, .compact-stages .tile-top { font-size: 11px; padding-inline: 3px; }

/* ---------- Friends: featured friend + picker strip ---------- */
.friends-page { padding-top: 14px; }
.friend-stage { position: relative; text-align: center; padding: 22px 18px 20px; border-radius: 30px; background: radial-gradient(circle at 50% 38%, #ffffffb3 0 30%, transparent 31%), var(--tint); border-bottom: 6px solid color-mix(in srgb, var(--tint) 70%, #6b7a99); }
.friend-animal { position: absolute; left: 16px; top: 16px; padding: 4px 11px; border-radius: 10px; background: #fff; font-size: 13px; font-weight: 800; color: #4b5874; }
.friend-mate { position: absolute; right: 14px; top: 16px; display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 10px; background: #ff7a93; color: #fff; font-size: 12px; font-weight: 800; }
.friend-mate .icon { width: 14px; height: 14px; fill: #fff; }
.friend-figure img { width: 210px; max-width: 70%; height: 210px; object-fit: contain; margin: 14px auto 0; animation: friend-bob 2.6s ease-in-out infinite; }
.friend-stage h1 { font-size: 32px; margin-top: 6px; }
.friend-role { font-size: 15px; font-weight: 700; color: #5a6680; margin-top: 2px; }
.friend-quote { display: inline-block; margin: 14px 0 16px; padding: 10px 16px; border-radius: 16px; background: #fff; font-size: 16px; font-weight: 700; box-shadow: 0 3px 0 #00000010; }
.friend-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.friend-stats span { display: flex; flex-direction: column; padding: 10px 4px; border-radius: 16px; background: #ffffffb3; font-size: 12px; font-weight: 700; color: #5a6680; }
.friend-stats b { font-size: 22px; color: var(--ink); }
.mate-button { width: 100%; margin-top: 14px; display: flex; align-items: center; justify-content: center; gap: 6px; background: #ff7a93; border-color: #d9566f; }
.mate-button .icon { fill: #fff; }
.friends-page .section-label { margin-top: 24px; }
.led-list { display: flex; flex-wrap: wrap; gap: 8px; }
.led-chip { display: inline-flex; align-items: center; gap: 5px; min-height: 40px; padding: 7px 13px; border: 2px solid #e0e4f0; border-bottom-width: 4px; border-radius: 14px; background: #fff; font-size: 14px; font-weight: 800; color: var(--ink); }
.led-chip .icon { width: 16px; height: 16px; color: #f2a93b; }
.led-chip.is-done { background: #e6f6ec; border-color: #b9dec6; }
.led-chip.is-done .icon { color: #23744a; }
.led-chip.is-soon { color: #8a94a8; background: #f1f3f8; }
.led-chip.is-soon .icon { color: #a6b0c4; }
.friend-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.friend-thumb, .avatar-card { position: relative; display: flex; flex-direction: column; align-items: center; padding: 10px 4px 9px; border: 3px solid transparent; border-bottom-width: 5px; border-radius: 20px; background: var(--tint); color: var(--ink); }
.friend-thumb img, .avatar-card img { width: 100%; height: 78px; object-fit: contain; }
.friend-thumb strong, .avatar-card strong { font-size: 15px; margin-top: 4px; }
.friend-thumb[aria-pressed=true], .avatar-card[aria-pressed=true] { border-color: #5d6df0; box-shadow: 0 0 0 3px #dfe3ff; }
.friend-thumb .friend-check { background: #ff7a93; }
.friend-thumb .friend-check .icon, .avatar-card .friend-check .icon { width: 14px; height: 14px; }
.friend-thumb .friend-check .icon { fill: #fff; }
.avatar-card .friend-check { background: #5d6df0; }

/* ---------- Profile ---------- */
.profile-page { padding-top: 14px; }
.profile-hero { text-align: center; padding: 20px 16px 18px; border-radius: 30px; background: radial-gradient(circle at 50% 42%, #ffffffb3 0 34%, transparent 35%), var(--tint); }
.profile-hero img { width: 150px; height: 150px; object-fit: contain; animation: friend-bob 2.6s ease-in-out infinite; }
.profile-hero h1 { font-size: 28px; margin-top: 4px; word-break: break-all; }
.profile-level { display: inline-flex; align-items: center; gap: 5px; margin-top: 8px; padding: 5px 11px; border-radius: 10px; background: #fff; font-size: 13px; font-weight: 800; color: #966017; }
.profile-level .icon { width: 16px; height: 16px; }
.nickname-form { margin: 22px 0 6px; }
.nickname-form label { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; font-size: 15px; }
.nickname-form label span { font-size: 13px; color: var(--muted); font-weight: 700; }
.nickname-row { display: flex; gap: 8px; }
.nickname-row input { flex: 1; min-width: 0; min-height: 54px; padding: 0 16px; border: 2px solid #dfe3ef; border-radius: 16px; font: inherit; font-size: 18px; font-weight: 700; color: var(--ink); background: #fff; }
.nickname-row input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); }
.nickname-row .primary { width: auto; flex-shrink: 0; padding-inline: 22px; min-height: 54px; }
.avatar-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.avatar-card img { height: 88px; }
.profile-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 2px solid #e5e8f2; border-bottom-width: 4px; border-radius: 18px; background: #fff; text-align: left; color: var(--ink); }
.profile-row img { width: 52px; height: 52px; object-fit: contain; border-radius: 14px; background: var(--surface); }
.profile-row > span { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.profile-row b { font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-row small { font-size: 13px; color: var(--muted); }
.profile-row .icon { color: #9aa3b8; }
@keyframes friend-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@media (max-width: 370px) {
  .world-card { padding-left: 18px; min-height: 150px; }
  .world-card strong { font-size: 28px; }
  .world-card img { width: 100px; height: 118px; }
  .is-three .stage-tile strong, .compact-stages .stage-tile strong { font-size: 13px; }
  .friend-thumb img, .avatar-card img { height: 66px; }
}
