/* The cosmos is always night: one dark theme by design. */
:root {
  --bg: #02030a;
  --glass: rgba(10, 14, 32, 0.62);
  --glass-strong: rgba(9, 12, 28, 0.86);
  --glass-border: rgba(140, 170, 255, 0.16);
  --text: #e8ecff;
  --muted: #8f99c2;
  --accent: #ffd27a;
  --warn: #ffb36b;
  --radius: 14px;
  --font: 'Inter', 'Segoe UI', system-ui, -apple-system, 'Microsoft YaHei', 'PingFang SC', 'Noto Sans', sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none;
  background: var(--bg); color: var(--text); font: 14px/1.5 var(--font);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { touch-action: manipulation; }

#scene { position: fixed; inset: 0; }
#scene canvas { display: block; cursor: grab; touch-action: none; }
#scene canvas:active { cursor: grabbing; }
.label-layer { position: absolute; inset: 0; pointer-events: none; }

#loading {
  position: fixed; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px;
  color: var(--muted); letter-spacing: 0.2em; text-transform: uppercase; font-size: 12px; z-index: 50;
}

.glass {
  position: fixed; z-index: 10;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
}

/* ── HUD ── */
#hud { position: fixed; top: 18px; left: 22px; z-index: 12; pointer-events: none; }
#hud h1 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: 0.04em; white-space: nowrap; }
#hud h1 span { font-weight: 300; color: var(--muted); margin-left: 6px; }
#hud p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }
.hud-actions { display: none; gap: 8px; pointer-events: auto; }
.icon-btn {
  width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; cursor: pointer;
  background: var(--glass); border: 1px solid var(--glass-border);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.icon-btn:active { transform: scale(0.94); }
.icon-btn svg { width: 21px; height: 21px; fill: none; stroke: var(--text); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
#btn-sound .mute { display: none; }
#btn-sound.off .wave { display: none; }
#btn-sound.off .mute { display: inline; }
#btn-sound.off svg { stroke: var(--muted); }

/* ── Shared list / panel / legend content ── */
.overlay-head { display: none; }
.list-tools { display: flex; gap: 6px; padding: 10px; border-bottom: 1px solid var(--glass-border); }
.list-tools input, .list-tools select, #legend select {
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--glass-border); border-radius: 8px; padding: 6px 8px; outline: none;
}
.list-tools input { flex: 1; min-width: 0; }
.list-tools input:focus { border-color: rgba(255, 210, 122, 0.6); }
select option { background: #0b1024; }
#lang-list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; flex: 1; overscroll-behavior: contain; }
#lang-list li {
  display: grid; grid-template-columns: 10px 1fr auto; grid-template-rows: auto auto; column-gap: 9px;
  padding: 6px 8px; border-radius: 8px; cursor: pointer;
}
#lang-list li:hover { background: rgba(255, 255, 255, 0.06); }
#lang-list li.active { background: rgba(255, 210, 122, 0.12); }
#lang-list li i { grid-row: span 2; align-self: center; width: 10px; height: 10px; border-radius: 50%; background: var(--c); box-shadow: 0 0 10px var(--c); }
#lang-list .n { font-weight: 500; }
#lang-list .nat { grid-column: 2; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#lang-list .metric { grid-row: 1 / span 2; grid-column: 3; align-self: center; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

#panel { display: flex; flex-direction: column; overflow: hidden; }
.sheet-handle { display: none; }
#panel-body { flex: 1; overflow-y: auto; padding: 20px 22px; overscroll-behavior: contain; }
#panel h2 { margin: 0 0 6px; font-size: 22px; }
#panel h3 { margin: 18px 0 6px; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
#panel p { margin: 0 0 10px; }
#panel .howto { padding-left: 18px; margin: 8px 0; }
#panel .howto li { margin-bottom: 6px; }
.lead { color: var(--accent); font-size: 13px; letter-spacing: 0.02em; }
kbd { border: 1px solid var(--glass-border); border-radius: 4px; padding: 0 5px; font-size: 12px; background: rgba(255,255,255,0.06); }
.muted { color: var(--muted); }
.warn { color: var(--warn); font-size: 12px; display: block; }
.stat { margin-top: 18px !important; color: var(--accent); font-size: 12px; letter-spacing: 0.08em; }
.only-touch { display: none; }

.ev-scale div { display: grid; grid-template-columns: 104px 1fr; gap: 8px; align-items: start; margin-bottom: 6px; font-size: 12.5px; color: var(--muted); }
.badge {
  display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
  color: var(--c); border: 1px solid color-mix(in srgb, var(--c) 55%, transparent); background: color-mix(in srgb, var(--c) 12%, transparent);
  white-space: nowrap; width: fit-content;
}

.lang-head { border-left: 3px solid var(--c); padding-left: 12px; margin-bottom: 14px; }
.native-big { font-size: 30px; font-weight: 600; color: var(--c); text-shadow: 0 0 22px color-mix(in srgb, var(--c) 60%, transparent); line-height: 1.2; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stats > div { background: rgba(255,255,255,0.04); border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; min-width: 0; }
.stats > div:first-child { grid-column: span 2; }
.stats small { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; }
.stats b { font-size: 17px; font-variant-numeric: tabular-nums; }
.stats span.muted { font-size: 12px; }

.branch { margin-top: 14px; }
.branch h3 { color: var(--c) !important; display: flex; align-items: center; gap: 8px; }
.branch h3 i, .chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px var(--c); display: inline-block; flex: none; }
.branch h3 small { color: var(--muted); letter-spacing: 0; text-transform: none; font-weight: 400; }
.leaf-row, .bridge-row, .back {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; width: 100%; text-align: left;
  background: rgba(255,255,255,0.03); border: 1px solid transparent; border-radius: 9px; padding: 7px 10px; margin-bottom: 5px; cursor: pointer;
}
.leaf-row:hover, .bridge-row:hover, .back:hover { border-color: var(--glass-border); background: rgba(255,255,255,0.07); }
.leaf-row .t { flex: 1; min-width: 60%; }
.leaf-row .ex { width: 100%; color: var(--muted); font-size: 12px; }
.back { width: auto; display: inline-flex; color: var(--muted); }
.item-head { border-left: 3px solid var(--c); padding-left: 12px; margin: 10px 0 12px; }
.item-head small { color: var(--c); text-transform: uppercase; letter-spacing: 0.1em; font-size: 11px; }
.item-head .muted { font-size: 12px; display: block; margin-top: 4px; }
.example { font-size: 16px; color: var(--accent); background: rgba(255,210,122,0.07); border-radius: 10px; padding: 8px 12px; overflow-wrap: anywhere; }
.refs { padding-left: 18px; margin: 0; font-size: 12.5px; color: #c4cbec; }
.refs li { margin-bottom: 5px; }
.study { border: 1px dashed rgba(110, 231, 168, 0.4); border-radius: 10px; padding: 8px 12px; }
textarea#notes {
  width: 100%; min-height: 120px; resize: vertical; background: rgba(255,255,255,0.04);
  border: 1px solid var(--glass-border); border-radius: 10px; padding: 10px; outline: none;
}

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 4px 11px; border-radius: 999px; cursor: pointer;
  background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.08); color: var(--muted); font-size: 12.5px;
  transition: background .15s, border-color .15s, color .15s;
}
.chip small { color: var(--muted); font-size: 11px; }
.chip.on { color: var(--text); border-color: color-mix(in srgb, var(--c) 50%, transparent); background: color-mix(in srgb, var(--c) 10%, transparent); }
.chip:not(.on) i { background: transparent; box-shadow: none; border: 1px solid var(--c); }
.controls { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; font-size: 12.5px; color: var(--muted); }
.controls label { display: inline-flex; gap: 6px; align-items: center; }
.controls .tog input { accent-color: var(--accent); }
.controls input[type="range"] { width: 76px; accent-color: var(--accent); }
.controls .sound { gap: 8px; }
.controls button {
  background: rgba(255,210,122,0.1); border: 1px solid rgba(255,210,122,0.35); color: var(--accent);
  border-radius: 8px; padding: 5px 12px; cursor: pointer;
}
.controls button:hover { background: rgba(255,210,122,0.2); }

/* ── Personality radar & lens ── */
.persona { margin-top: 16px; }
.persona h3 small, .tl-stage h3 small { color: var(--muted); letter-spacing: 0; text-transform: none; font-weight: 400; }
.radar { width: 100%; max-width: 330px; display: block; margin: 0 auto; }
.radar .grid polygon, .radar .grid line { fill: none; stroke: rgba(160, 180, 255, 0.14); stroke-width: 1; }
.radar .neutral { fill: none; stroke: rgba(255, 255, 255, 0.45); stroke-dasharray: 3 3; }
.radar .shape { fill: color-mix(in srgb, var(--c) 28%, transparent); stroke: var(--c); stroke-width: 1.6; filter: drop-shadow(0 0 6px var(--c)); }
.radar text { fill: var(--muted); font-size: 10.5px; text-anchor: middle; dominant-baseline: middle; font-family: var(--font); }
.radar text.up { fill: var(--accent); font-weight: 600; }
.radar text.down { fill: #8fa4ff; font-weight: 600; }
.small { font-size: 12px; }
.traits { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.trait-row { display: grid; grid-template-columns: minmax(0, 1fr) 96px; gap: 2px 10px; align-items: center; }
.trait-row .tn { font-size: 13px; }
.trait-row .tn small { color: var(--muted); }
.trait-row .from { grid-column: span 2; font-size: 11.5px; color: var(--muted); }
.tilt { position: relative; height: 6px; border-radius: 3px; background: rgba(255,255,255,0.07); }
.tilt::before { content: ''; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: rgba(255,255,255,0.35); }
.tilt i { position: absolute; top: 0; bottom: 0; border-radius: 3px; }
.tilt i.up { background: var(--accent); box-shadow: 0 0 6px var(--accent); }
.tilt i.down { background: #6f8cff; box-shadow: 0 0 6px #6f8cff; }
.up { color: var(--accent); }
.down { color: #8fa4ff; }
.measured { margin-top: 10px; padding: 8px 12px; border-radius: 10px; font-size: 13px; background: rgba(94, 240, 160, 0.06); border: 1px solid rgba(94, 240, 160, 0.25); }
.meta-row { display: flex; flex-wrap: wrap; gap: 6px; margin: -2px 0 12px; }
.meta { font-size: 12px; padding: 2px 9px; border-radius: 999px; background: rgba(255,255,255,0.05); border: 1px solid var(--glass-border); }
.meta.trait.up { border-color: rgba(255, 210, 122, 0.4); }
.meta.trait.down { border-color: rgba(111, 140, 255, 0.45); }
#lens-key {
  position: fixed; z-index: 13; top: 18px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 12px; align-items: center; padding: 7px 14px; font-size: 12.5px; cursor: pointer; border-radius: 999px;
}
#lens-key[hidden] { display: none; }
#lens-key .x { color: var(--muted); }
.core-label .lens { font-size: 11px; font-weight: 600; color: var(--muted); }
.core-label .lens[data-dir="up"] { color: var(--accent); }
.core-label .lens[data-dir="down"] { color: #8fa4ff; }
body:not(.lens-on) .core-label .lens { display: none; }

/* ── Mother tongue origin & timeline ── */
.origin-label {
  display: flex; flex-direction: column; align-items: center; pointer-events: auto; cursor: pointer; user-select: none;
  text-shadow: 0 0 10px #000, 0 0 3px #000;
}
.origin-label .zh { font-size: 15px; font-weight: 700; color: #ffd9a8; letter-spacing: 0.2em; }
.origin-label .en { font-size: 10.5px; color: #e9d6bd; letter-spacing: 0.06em; }
.start-btn {
  display: block; width: 100%; text-align: left; margin: 6px 0 4px; padding: 10px 12px; border-radius: 12px; cursor: pointer;
  background: linear-gradient(90deg, rgba(255, 217, 168, 0.16), rgba(255, 217, 168, 0.04)); border: 1px solid rgba(255, 217, 168, 0.4); color: #ffe7c6;
}
.start-btn:hover { background: rgba(255, 217, 168, 0.2); }
.lessons { display: flex; flex-direction: column; gap: 6px; margin: 10px 0 6px; font-size: 13px; }
.lessons div { background: rgba(255,255,255,0.04); border-radius: 10px; padding: 8px 10px; }
.timeline { position: relative; margin-top: 8px; padding-left: 16px; border-left: 1px solid rgba(255, 217, 168, 0.3); }
.tl-stage { position: relative; margin-top: 14px; }
.tl-stage h3 { color: #ffd9a8 !important; display: flex; align-items: center; gap: 8px; }
.tl-stage h3 i { position: absolute; left: -21px; width: 9px; height: 9px; border-radius: 50%; background: #ffd9a8; box-shadow: 0 0 10px #ffd9a8; }
.tl-item { background: rgba(255,255,255,0.03); border-radius: 10px; padding: 8px 10px; margin-bottom: 8px; }
.tl-title { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 4px; }
.tl-item p { margin: 0 0 6px !important; font-size: 13px; }
.tl-item .why { color: #ffe7c6; }
.tl-feats small { color: var(--muted); display: block; margin-bottom: 4px; }

/* ── Shadow side ── */
.thorn { color: #ff5c78; font-size: 10px; margin-left: 4px; }
.shadow-sec { margin-top: 18px; border: 1px solid rgba(255, 70, 100, 0.28); border-radius: 12px; padding: 4px 12px 10px; background: rgba(255, 40, 80, 0.05); }
.shadow-sec h3 { color: #ff7a90 !important; }
.shadow-sec .small { font-size: 12px; }
.shadow-row { display: block; width: 100%; text-align: left; background: rgba(0,0,0,0.18); border: 1px solid transparent; border-radius: 9px; padding: 8px 10px; margin-bottom: 6px; cursor: pointer; }
.shadow-row:hover { border-color: rgba(255, 70, 100, 0.35); }
.shadow-row b { display: block; margin-bottom: 2px; }
.shadow-item p { margin: 0 0 6px !important; }
.shadow-item .refs { margin-bottom: 6px; }
.shadow-tog { color: #ff8a9c; }
.controls .shadow-tog input { accent-color: #ff5c78; }

/* ── 3D labels ── */
.core-label {
  display: flex; flex-direction: column; align-items: center; pointer-events: auto; cursor: pointer;
  text-shadow: 0 0 8px #000, 0 0 2px #000; transition: opacity .3s; user-select: none; -webkit-user-select: none;
}
.core-label .name { font-size: 12.5px; font-weight: 600; letter-spacing: 0.04em; white-space: nowrap; }
.core-label .native { font-size: 11px; color: #b9c3ee; white-space: nowrap; }
.core-label.dim { filter: brightness(0.55); }
.core-label.focus .name { font-size: 15px; color: var(--accent); }
.leaf-label {
  font-size: 11px; color: var(--c); background: rgba(4, 6, 18, 0.72); border: 1px solid color-mix(in srgb, var(--c) 35%, transparent);
  padding: 1px 7px; border-radius: 999px; white-space: nowrap; pointer-events: auto; cursor: pointer; user-select: none; -webkit-user-select: none;
}
.leaf-label:hover { background: rgba(20, 26, 60, 0.9); }

#tooltip {
  position: fixed; top: 0; left: 0; z-index: 40; pointer-events: none; max-width: 300px;
  background: rgba(6, 9, 24, 0.92); border: 1px solid var(--glass-border); border-radius: 10px; padding: 8px 11px; font-size: 12.5px;
}

/* ── Desktop layout (mobile block below overrides) ── */
#list { top: 122px; left: 18px; width: 268px; bottom: 150px; display: flex; flex-direction: column; overflow: hidden; }
#panel { top: 18px; right: 18px; width: 380px; bottom: 150px; }
#legend { left: 18px; right: 18px; bottom: 18px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
#scrim { display: none; }

/* Touch devices: labels must not swallow drags; taps go to the canvas,
   which picks the nearest star or leaf within a finger's reach. */
@media (hover: none) {
  .core-label, .leaf-label, .origin-label { pointer-events: none; }
  #tooltip { display: none !important; }
  .only-touch { display: revert; }
  .only-mouse { display: none; }
}

/* ── Mobile layout: top bar + bottom sheet + slide-up overlays ── */
@media (max-width: 980px), (max-height: 520px) {
  #hud {
    top: calc(var(--safe-t) + 10px); left: calc(var(--safe-l) + 12px); right: calc(var(--safe-r) + 12px);
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
  }
  #hud h1 { font-size: 17px; }
  #hud h1 span { font-size: 13px; margin-left: 4px; }
  #hud p { display: none; }
  .hud-actions { display: flex; }

  /* Bottom sheet; JS sets translateY for peek / half / full. */
  #panel {
    top: auto; left: calc(var(--safe-l)); right: calc(var(--safe-r)); bottom: 0; width: auto;
    height: calc(100dvh - var(--safe-t) - 70px);
    border-radius: 20px 20px 0 0; border-bottom: none;
    background: var(--glass-strong);
    transition: transform .38s cubic-bezier(.2, .85, .25, 1);
    will-change: transform; z-index: 14;
  }
  #panel.dragging { transition: none; }
  .sheet-handle {
    display: grid; place-items: center; height: 26px; flex: none; cursor: grab; touch-action: none;
  }
  .sheet-handle span { width: 42px; height: 5px; border-radius: 3px; background: rgba(200, 210, 255, 0.35); }
  #panel-body { padding: 4px 18px calc(var(--safe-b) + 24px); }
  #panel[data-state="peek"] #panel-body { overflow: hidden; }
  #panel h2 { font-size: 20px; }
  .native-big { font-size: 26px; }

  /* Languages and Filters slide up over everything. */
  #list.overlay, #legend.overlay {
    top: auto; left: 0; right: 0; bottom: 0; width: auto;
    border-radius: 20px 20px 0 0; border-bottom: none;
    background: var(--glass-strong);
    transform: translateY(105%); transition: transform .35s cubic-bezier(.2, .85, .25, 1);
    z-index: 30; padding-bottom: var(--safe-b);
  }
  #list.overlay.open, #legend.overlay.open { transform: none; }
  .overlay-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px 6px; font-size: 16px;
  }
  .overlay-head .close {
    width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--glass-border);
    background: rgba(255,255,255,0.05); cursor: pointer;
  }
  #list { height: 78dvh; top: auto; }
  #legend { padding: 0 16px 16px; gap: 14px; max-height: 80dvh; overflow-y: auto; }
  #scrim {
    display: block; position: fixed; inset: 0; z-index: 25; background: rgba(0, 0, 0, 0.45);
    opacity: 0; transition: opacity .3s;
  }
  #scrim.show { opacity: 1; }
  #scrim[hidden] { display: none; }

  /* Bigger touch targets; 16px inputs stop iOS from zooming on focus. */
  .list-tools input, .list-tools select, #legend select, textarea#notes { font-size: 16px; }
  .list-tools input, .list-tools select { padding: 9px 10px; }
  #lang-list li { padding: 10px 10px; }
  .chip { padding: 8px 13px; font-size: 13px; }
  .leaf-row, .bridge-row, .back { padding: 10px 12px; }
  .controls { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; font-size: 14px; }
  .controls select { width: 100%; min-width: 0; }
  .controls label:not(.tog) { flex-direction: column; align-items: stretch; gap: 4px; }
  .controls .sound { grid-column: span 2; }
  .controls input[type="range"] { flex: 1; width: auto; }
  .controls input[type="checkbox"] { width: 20px; height: 20px; }
  .controls button { padding: 11px 12px; font-size: 14px; }

  .core-label .name { font-size: 11px; }
  .core-label .native { display: none; }
  #lens-key { top: calc(var(--safe-t) + 60px); max-width: calc(100vw - 24px); flex-wrap: wrap; justify-content: center; }
  .origin-label .en { display: none; }
  .core-label.focus .native { display: block; }
  .core-label.focus .name { font-size: 13px; }
  .leaf-label { font-size: 10px; padding: 0 6px; max-width: 46vw; overflow: hidden; text-overflow: ellipsis; }
}

/* Landscape phones: sheet docks to the right instead of the bottom. */
@media (max-height: 520px) and (orientation: landscape) {
  #panel {
    top: calc(var(--safe-t) + 8px); bottom: 8px; right: calc(var(--safe-r) + 8px); left: auto;
    width: min(46vw, 400px); height: auto; border-radius: 18px; border-bottom: 1px solid var(--glass-border);
  }
  .sheet-handle { display: none; }
  #panel[data-state="peek"] #panel-body { overflow-y: auto; }
  #list.overlay, #legend.overlay { left: auto; right: 0; width: min(60vw, 460px); height: 100dvh; max-height: none; top: 0; border-radius: 18px 0 0 18px; transform: translateX(105%); }
  #list.overlay.open, #legend.overlay.open { transform: none; }
  #hud { right: calc(min(46vw, 400px) + 24px + var(--safe-r)); }
}

/* Narrow phones: drop the English subtitle and tighten the action buttons. */
@media (max-width: 430px) {
  #hud h1 span { display: none; }
  .hud-actions { gap: 6px; }
  .icon-btn { width: 40px; height: 40px; }
}

/* ════════════════ Mode switch, family labels ════════════════ */
.mode-pill {
  pointer-events: auto; margin-top: 8px; display: inline-flex; gap: 8px; align-items: center; cursor: pointer;
  padding: 4px 12px; border-radius: 999px; font-size: 12.5px; color: var(--text);
  background: var(--glass); border: 1px solid var(--glass-border); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.mode-pill:hover { border-color: rgba(255, 210, 122, 0.5); }
.mode-pill .swap { color: var(--muted); }
.kids .research-only { display: none !important; }
.family-label {
  font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase; font-weight: 600; white-space: nowrap;
  color: color-mix(in srgb, var(--c) 75%, white); text-shadow: 0 0 12px rgba(0,0,0,0.9); pointer-events: none; transition: opacity .4s;
}

/* ════════════════ Map key & "at a glance" infographics ════════════════ */
.map-key { display: grid; grid-template-columns: 1fr; gap: 6px; }
.map-key div { display: flex; gap: 10px; align-items: center; font-size: 12.5px; color: var(--muted); }
.map-key svg { width: 28px; height: 28px; flex: none; }
.map-key b { color: var(--text); font-weight: 600; margin-right: 4px; }
.start-btn.tour { background: linear-gradient(90deg, rgba(91, 140, 255, 0.18), rgba(91, 140, 255, 0.04)); border-color: rgba(120, 160, 255, 0.45); color: #dbe5ff; }

.glance { display: flex; flex-direction: column; gap: 12px; }
.rank-bars { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rb { background: rgba(255,255,255,0.04); border-radius: 12px; padding: 9px 11px; display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 2px 6px; min-width: 0; }
.rb-l { grid-column: span 2; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.rb b { font-size: 18px; font-variant-numeric: tabular-nums; }
.rb small { color: var(--accent); font-size: 11.5px; font-weight: 600; }
.rb .bar { grid-column: span 2; height: 5px; border-radius: 3px; background: rgba(255,255,255,0.07); margin: 4px 0 2px; overflow: hidden; }
.rb .bar i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, #7fb4ff, #b7d3ff); box-shadow: 0 0 8px #7fb4ff; }
.rb .bar.sp i { background: linear-gradient(90deg, #6ee7a8, #b8f5d4); box-shadow: 0 0 8px #6ee7a8; }
.rb-src { grid-column: span 2; font-size: 11px; color: var(--muted); line-height: 1.35; }
.warnc { color: var(--warn); }
.typo { display: flex; flex-wrap: wrap; gap: 6px; }
.typo span { font-size: 12.5px; background: rgba(255,255,255,0.04); border-radius: 8px; padding: 4px 9px; }
.typo small { color: var(--muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; margin-right: 5px; }
.glance-row { display: grid; grid-template-columns: 104px 1fr; gap: 14px; align-items: center; }
.donut { width: 104px; height: 104px; filter: drop-shadow(0 0 8px rgba(120, 160, 255, 0.25)); }
.donut .dn { fill: var(--text); font-size: 20px; font-weight: 700; text-anchor: middle; font-family: var(--font); }
.donut .dl { fill: var(--muted); font-size: 9px; text-anchor: middle; letter-spacing: 0.1em; text-transform: uppercase; font-family: var(--font); }
.glance-side { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.glance-side > small { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; }
.ev-strip { display: flex; height: 9px; border-radius: 5px; overflow: hidden; gap: 2px; }
.ev-strip i { display: block; }
.ev-legend { display: flex; flex-wrap: wrap; gap: 3px 10px; font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.ev-legend i { display: inline-block; width: 7px; height: 7px; border-radius: 2px; margin-right: 4px; }
.stage-dots { display: grid; grid-template-columns: repeat(6, 1fr); gap: 2px; position: relative; }
.stage-dots::before { content: ""; position: absolute; left: 8%; right: 8%; top: 10px; height: 1px; background: rgba(255, 217, 168, 0.3); }
.stage-dots div { display: flex; flex-direction: column; align-items: center; gap: 2px; position: relative; }
.stage-dots i { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 10.5px; font-weight: 700;
  background: #11162c; border: 1px solid rgba(255, 217, 168, 0.25); color: #1a1206; }
.stage-dots .on i { background: #ffd9a8; box-shadow: 0 0 10px rgba(255, 217, 168, 0.7); }
.stage-dots span { font-size: 9.5px; color: var(--muted); }

/* ════════════════ Welcome / cinematic opening ════════════════ */
#welcome {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(ellipse at center, rgba(2, 3, 10, 0.72), rgba(2, 3, 10, 0.9));
  backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
  opacity: 0; transition: opacity .8s;
}
#welcome.show { opacity: 1; }
#welcome[hidden] { display: none; }
.wel-inner { text-align: center; max-width: 640px; }
.wel-title {
  font-size: clamp(44px, 11vw, 92px); font-weight: 800; letter-spacing: 0.12em;
  background: linear-gradient(120deg, #ffe7c6, #ffd27a 30%, #b7c9ff 70%, #ff9fc8);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 28px rgba(255, 210, 122, 0.35));
  animation: rise 1.4s cubic-bezier(.2, .8, .2, 1) both .3s;
}
.wel-sub { font-size: clamp(14px, 3vw, 20px); letter-spacing: 0.5em; text-transform: uppercase; color: #c8d2f5; animation: rise 1.4s both .6s; }
.wel-tag { color: var(--muted); margin: 14px 0 26px; animation: rise 1.4s both .9s; }
.wel-q { font-size: 18px; font-weight: 600; margin-bottom: 12px; animation: rise 1.4s both 1.2s; }
.wel-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; animation: rise 1.4s both 1.4s; }
.wel-choices button {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 20px 16px; border-radius: 20px; cursor: pointer;
  background: var(--glass); border: 1px solid var(--glass-border); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  transition: transform .2s, border-color .2s, box-shadow .2s;
}
.wel-choices button:hover { transform: translateY(-4px); border-color: rgba(255, 210, 122, 0.6); box-shadow: 0 12px 40px rgba(255, 210, 122, 0.15); }
.wel-choices span { font-size: 44px; }
.wel-choices b { font-size: 17px; }
.wel-choices small { color: var(--muted); font-size: 12.5px; }
.wel-foot { display: block; margin-top: 14px; color: var(--muted); animation: rise 1.4s both 1.6s; }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

/* ════════════════ Explorer (kids) panels ════════════════ */
.kid-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer;
  padding: 11px 16px; border-radius: 14px; font-weight: 600; font-size: 14.5px;
  background: linear-gradient(135deg, #ffd27a, #ffb547); color: #1d1405; border: none;
  box-shadow: 0 6px 20px rgba(255, 181, 71, 0.25); transition: transform .15s;
}
.kid-btn:active { transform: scale(0.96); }
/* No text-selection popups when kids long-press buttons and cards. */
.kid-btn, .power, .tone-card, .blue-tile, .pp-stamp, .chip, .icon-btn, .leaf-row, .kid-greet {
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.voice-credit { font-size: 11px; color: var(--muted); margin-top: 6px; }
.voice-credit a { color: var(--muted); }
.kid-btn.speaking { animation: speak 0.9s ease-in-out infinite; }
@keyframes speak { 50% { box-shadow: 0 0 0 10px rgba(255, 210, 122, 0), 0 0 26px rgba(255, 210, 122, 0.8); transform: scale(1.04); } }
.kid-btn.ghost { background: rgba(255,255,255,0.06); color: var(--text); border: 1px solid var(--glass-border); box-shadow: none; }
.kid-btn.ghost:hover { border-color: rgba(255, 210, 122, 0.5); }
.kid-btn.wide { width: 100%; margin-top: 8px; }
.kid-btn.small { padding: 6px 11px; font-size: 12.5px; border-radius: 10px; margin-top: 6px; }
.kid-btn.right { background: #5ef0a0 !important; color: #06210f !important; }
.kid-btn.wrong { background: #ff6b7d !important; color: #2a0409 !important; }
.kid-btn:disabled { opacity: 0.85; cursor: default; }
.kid-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.kid-row .kid-btn { font-size: 12.5px; padding: 10px 6px; flex-direction: column; }
.kid-intro { text-align: center; }
.kid-intro p { font-size: 15px; }
.kid-big-emoji { font-size: 54px; line-height: 1.1; margin: 4px 0 6px; animation: bob 3s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-6px); } }
.kid-hero { text-align: center; border-radius: 18px; padding: 16px 12px 12px; position: relative;
  background: radial-gradient(ellipse at top, color-mix(in srgb, var(--c) 22%, transparent), transparent 70%); }
.kid-greet { font-size: 40px; font-weight: 700; color: var(--c); text-shadow: 0 0 24px color-mix(in srgb, var(--c) 60%, transparent); line-height: 1.2; }
.kid-roman { color: var(--muted); margin-bottom: 8px; }
.kid-sign { font-size: 14px; color: #dfe5ff; }
.kid-hero h2 { margin-top: 12px !important; }
.stamp { position: absolute; top: 10px; right: 10px; font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 8px;
  border: 2px solid #5ef0a0; color: #5ef0a0; transform: rotate(8deg); }
.stamp.new { animation: stampIn .6s cubic-bezier(.3, 1.6, .5, 1) both; }
@keyframes stampIn { from { transform: rotate(8deg) scale(2.4); opacity: 0; } to { transform: rotate(8deg) scale(1); opacity: 1; } }
.kid-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0 4px; }
.kid-facts div { background: rgba(255,255,255,0.05); border-radius: 12px; padding: 10px; text-align: center; display: flex; flex-direction: column; }
.kid-facts b { font-size: 17px; color: var(--accent); }
.kid-facts span { font-size: 12px; color: var(--muted); }
.power { display: flex; gap: 12px; align-items: flex-start; padding: 12px; margin-bottom: 8px; border-radius: 16px; cursor: pointer;
  background: rgba(255,255,255,0.045); border: 1px solid var(--glass-border); transition: transform .15s, border-color .15s; }
.power:hover { transform: translateY(-2px); border-color: rgba(255, 210, 122, 0.4); }
.power-emoji { font-size: 34px; line-height: 1; }
.power-body b { font-size: 15.5px; }
.power-body p { margin: 4px 0 6px !important; font-size: 14px; }
.power.big { cursor: default; padding: 18px; }
.power.big .power-emoji { font-size: 52px; }
.power.big b { font-size: 19px; }
.sure { display: inline-block; font-size: 12px; color: var(--accent); }
.kid-timeline { margin-top: 10px; border-left: 2px solid rgba(255, 217, 168, 0.35); padding-left: 16px; }
.kt-step { position: relative; margin-bottom: 12px; }
.kt-dot { position: absolute; left: -23px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: #ffd9a8; box-shadow: 0 0 10px #ffd9a8; }
.kt-step p { margin: 2px 0 2px !important; font-size: 14px; }

/* Tour & quiz */
.tour-card { text-align: center; }
.tour-card p { font-size: 15px; }
.tour-progress { display: flex; gap: 5px; justify-content: center; margin-bottom: 6px; }
.tour-progress i { width: 18px; height: 4px; border-radius: 2px; background: rgba(255,255,255,0.12); }
.tour-progress i.done { background: rgba(255, 210, 122, 0.5); }
.tour-progress i.now { background: var(--accent); box-shadow: 0 0 8px var(--accent); width: 28px; }
.tour-step { color: var(--muted); text-transform: uppercase; letter-spacing: 0.12em; font-size: 11px; }
.tour-nav { display: grid; grid-template-columns: 1fr 1.6fr; gap: 8px; margin-top: 12px; }
.link-btn { background: none; border: none; color: var(--muted); text-decoration: underline; margin-top: 10px; cursor: pointer; font-size: 13px; }
.quiz-opts { display: flex; flex-direction: column; }
.quiz-why { margin-top: 10px !important; font-size: 14px; }

/* Passport */
.pp-bar { height: 8px; border-radius: 4px; background: rgba(255,255,255,0.08); overflow: hidden; }
.pp-bar i { display: block; height: 100%; background: linear-gradient(90deg, #5ef0a0, #ffd27a); }
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.kbadge { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; padding: 10px 6px; border-radius: 14px;
  background: rgba(255,255,255,0.03); border: 1px dashed rgba(255,255,255,0.12); opacity: 0.45; filter: grayscale(1); }
.kbadge.got { opacity: 1; filter: none; border: 1px solid rgba(255, 210, 122, 0.5); background: rgba(255, 210, 122, 0.08); }
.kbadge span { font-size: 26px; }
.kbadge b { font-size: 12px; }
.kbadge small { font-size: 10.5px; color: var(--muted); }
.stamp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.pp-stamp { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 4px; border-radius: 12px; cursor: pointer;
  background: rgba(255,255,255,0.03); border: 1px dashed rgba(255,255,255,0.14); }
.pp-stamp .pp-g { font-size: 15px; font-weight: 700; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pp-stamp small { font-size: 10.5px; color: var(--muted); }
.pp-stamp.got { border: 2px solid color-mix(in srgb, var(--c) 70%, transparent); background: color-mix(in srgb, var(--c) 10%, transparent); }
.pp-stamp.got .pp-g { color: var(--c); }

/* ════════════════ Games ════════════════ */
#game { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 16px;
  background: rgba(2, 3, 10, 0.6); opacity: 0; transition: opacity .25s; }
#game.show { opacity: 1; }
#game[hidden] { display: none; }
.game-card { position: relative; width: min(560px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 22px 20px;
  background: var(--glass-strong); border-radius: 22px; transform: scale(.96); transition: transform .25s; }
#game.show .game-card { transform: none; }
.game-x { position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border-radius: 10px; cursor: pointer;
  background: rgba(255,255,255,0.06); border: 1px solid var(--glass-border); }
.game-head { text-align: center; }
.game-head h2 { margin: 2px 0 4px; }
.game-head p { color: #cfd6f5; margin: 0 0 12px; }
.game-emoji { font-size: 42px; }
.game-actions { display: flex; gap: 8px; justify-content: center; margin: 12px 0; flex-wrap: wrap; }
.game-note { font-size: 12px; color: var(--muted); text-align: center; }
.tone-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tone-card { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 8px; border-radius: 16px; cursor: pointer;
  background: rgba(255,255,255,0.05); border: 1px solid var(--glass-border); transition: transform .15s, border-color .15s; }
.tone-card:hover { border-color: rgba(255, 210, 122, 0.5); }
.tone-card.ping { animation: ping .5s; }
@keyframes ping { 40% { transform: scale(1.06); border-color: var(--accent); } }
.tone-card.right { background: rgba(94, 240, 160, 0.18); border-color: #5ef0a0; }
.tone-card.wrong { background: rgba(255, 107, 125, 0.18); border-color: #ff6b7d; }
.tone-emoji { font-size: 32px; }
.tone-char { font-size: 26px; font-weight: 700; }
.tone-py { font-size: 20px; color: var(--accent); font-weight: 600; }
.tone-en { font-size: 12.5px; color: var(--muted); }
.contour { width: 64px; height: 40px; }
.contour polyline { fill: none; stroke: #4fd1ff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 4px #4fd1ff); }
.number-card { text-align: center; padding: 18px; border-radius: 18px; background: rgba(255,255,255,0.05); margin-bottom: 14px; }
.number-say { font-size: 40px; font-weight: 700; color: var(--accent); }
.number-roman { color: #cfd6f5; font-size: 16px; }
.number-literal { color: #4fd1ff; margin-top: 6px; font-size: 15px; }
.num-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.num-options .kid-btn { font-size: 24px; padding: 14px; }
.blue-demo { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; text-align: center; }
.blue-demo span { width: 54px; height: 54px; border-radius: 12px; }
.blue-demo p { width: 100%; font-size: 14px; color: #cfd6f5; }
.blue-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 340px; margin: 0 auto; }
.blue-tile { aspect-ratio: 1; border-radius: 14px; border: 2px solid transparent; cursor: pointer; transition: transform .1s; }
.blue-tile:active { transform: scale(.94); }
.blue-tile.right { border-color: #5ef0a0; box-shadow: 0 0 18px #5ef0a0; }
.blue-tile.wrong { animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.game-end { text-align: center; }
.big-stars { font-size: 48px; color: var(--accent); letter-spacing: 6px; text-shadow: 0 0 22px rgba(255, 210, 122, 0.6); animation: stampIn .7s both; }
.rt-chart { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; text-align: left; }
.rt-chart div { display: grid; grid-template-columns: 1fr 52px; gap: 2px 8px; align-items: center; font-size: 13px; }
.rt-chart span { grid-column: span 2; color: var(--muted); }
.rt-chart i { height: 12px; border-radius: 6px; background: linear-gradient(90deg, #2d6bff, #7fb4ff); }
.rt-chart b { text-align: right; }

/* Toast */
#toast { position: fixed; z-index: 80; left: 50%; top: 22px; transform: translate(-50%, -140%); padding: 10px 18px; border-radius: 999px;
  background: linear-gradient(135deg, rgba(255, 210, 122, 0.95), rgba(255, 181, 71, 0.95)); color: #1d1405; font-size: 14.5px;
  box-shadow: 0 10px 40px rgba(255, 181, 71, 0.35); transition: transform .45s cubic-bezier(.3, 1.4, .5, 1); pointer-events: none; }
#toast.show { transform: translate(-50%, 0); }
#toast[hidden] { display: none; }

/* Kids mode: friendlier type */
.kids #panel-body { font-size: 15px; }
.kids .leaf-label { font-size: 12px; }

@media (max-width: 980px), (max-height: 520px) {
  .mode-pill { margin-top: 4px; padding: 3px 10px; font-size: 11.5px; }
  .wel-choices { grid-template-columns: 1fr; }
  .wel-choices button { flex-direction: row; text-align: left; padding: 14px; }
  .wel-choices span { font-size: 36px; }
  .wel-choices button b, .wel-choices button small { display: block; }
  .glance-row { grid-template-columns: 88px 1fr; }
  .donut { width: 88px; height: 88px; }
  #toast { top: calc(var(--safe-t) + 64px); max-width: calc(100vw - 24px); }
  .map-key div { font-size: 12px; }
  .family-label { font-size: 9px; letter-spacing: 0.16em; }
}
@media (prefers-reduced-motion: reduce) {
  .kid-big-emoji, .wel-title, .wel-sub, .wel-tag, .wel-q, .wel-choices, .wel-foot { animation: none; }
}

/* ════════════════ World Shops ════════════════ */
#shop { position: fixed; inset: 0; z-index: 75; background: #070a1a; opacity: 0; transition: opacity .35s; }
#shop.show { opacity: 1; }
#shop[hidden] { display: none; }
.shop-frame { position: absolute; inset: 0; display: flex; flex-direction: column; max-width: 980px; margin: 0 auto; }
.shop-x { position: absolute; top: 10px; right: 10px; z-index: 3; width: 38px; height: 38px; border-radius: 12px; cursor: pointer;
  background: rgba(10, 14, 32, 0.7); border: 1px solid var(--glass-border); color: var(--text); backdrop-filter: blur(8px); }
.start-btn.shop { background: linear-gradient(90deg, rgba(46, 158, 110, 0.22), rgba(46, 158, 110, 0.04)); border-color: rgba(80, 200, 150, 0.45); color: #d9fbe9; }
.kid-btn.shop-btn { background: linear-gradient(135deg, #3ddc97, #1f9e6e); color: #04170e; box-shadow: 0 6px 20px rgba(61, 220, 151, 0.25); }

/* Picker */
.shop-picker { position: relative; overflow-y: auto; height: 100%; padding: calc(var(--safe-t) + 22px) 18px calc(var(--safe-b) + 24px); }
.picker-head { text-align: center; margin-bottom: 16px; }
.picker-head span { font-size: 48px; }
.picker-head h2 { margin: 4px 0; font-size: 26px; }
.picker-head p { color: var(--muted); max-width: 520px; margin: 0 auto; }
.shop-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.shop-card { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; text-align: left; padding: 14px; border-radius: 18px; cursor: pointer;
  background: rgba(255,255,255,0.04); border: 1px dashed rgba(255,255,255,0.14); color: var(--text); transition: transform .15s, border-color .15s; }
.shop-card:disabled { cursor: default; opacity: 0.6; }
.shop-card.ready { border: 1px solid rgba(61, 220, 151, 0.5); background: linear-gradient(160deg, rgba(61, 220, 151, 0.14), rgba(255,255,255,0.03)); }
.shop-card.ready:hover { transform: translateY(-3px); }
.sc-flag { font-size: 34px; }
.sc-native { font-size: 18px; font-weight: 700; color: var(--accent); }
.shop-card small { color: var(--muted); }
.sc-teach { font-size: 12.5px; color: #cfd6f5; margin-top: 4px; }
.sc-cta { margin-top: 8px; font-weight: 700; font-size: 13px; color: #3ddc97; }
.shop-card:disabled .sc-cta { color: var(--muted); }

/* Stage: illustrated scene + rain + HUD */
.shop-stage { position: relative; flex: 0 0 auto; height: min(46vh, 440px); overflow: hidden; }
.shop-scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.shop-rain { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.shop-stage::after { content: ""; position: absolute; inset: auto 0 0 0; height: 30px; background: linear-gradient(transparent, #070a1a); pointer-events: none; }
.shop-hud { position: absolute; top: calc(var(--safe-t) + 10px); left: 10px; right: 56px; display: flex; flex-wrap: wrap; gap: 6px; z-index: 2; }
.shop-hud .shop-x { right: -46px; top: 0; }
.hud-pill { padding: 4px 10px; border-radius: 999px; font-size: 12.5px; background: rgba(8, 12, 30, 0.7); border: 1px solid var(--glass-border); backdrop-filter: blur(8px); white-space: nowrap; }
.hud-pill small { color: var(--muted); }
.hud-weather b { color: #9fd4ff; }
.scene-cat { animation: catBob 1.6s ease-in-out infinite; }
@keyframes catBob { 50% { transform: translateY(-1px); } }

/* Counter */
.shop-counter { position: relative; flex: 1; overflow-y: auto; padding: 14px 16px calc(var(--safe-b) + 20px); background: linear-gradient(#0b1026, #070a1a); }
.counter-body { max-width: 640px; margin: 0 auto; }
.shop-counter.intro { text-align: center; }
.intro-flag { font-size: 40px; }
.intro-learn { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 8px 0 14px; }
.intro-learn span { font-size: 12.5px; padding: 4px 10px; border-radius: 999px; background: rgba(61, 220, 151, 0.1); border: 1px solid rgba(61, 220, 151, 0.35); }
.shop-counter .row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }
.waiting { text-align: center; color: var(--muted); margin-top: 30px; animation: pulseText 1.6s ease-in-out infinite; }
@keyframes pulseText { 50% { opacity: 0.4; } }
.cust { display: flex; gap: 10px; align-items: flex-start; animation: slideIn .4s cubic-bezier(.2, .9, .3, 1) both; }
@keyframes slideIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }
.cust-portrait { width: 82px; flex: none; }
.chibi { width: 100%; height: auto; display: block; }
.bubble { position: relative; flex: 1; background: #fdfbf4; color: #1d1b26; border-radius: 16px; padding: 9px 12px; }
.bubble::before { content: ""; position: absolute; left: -7px; top: 22px; border: 7px solid transparent; border-right-color: #fdfbf4; border-left: 0; }
.bubble .who { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: #6c6a78; font-weight: 600; }
.bubble .who small { color: #9a98a6; }
.bubble .mood { margin-left: auto; font-size: 18px; }
.bubble .attitude { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: #efe8ff; color: #5a3fa0; margin: 2px 0 4px; }
.bubble b.jp, .bubble b { display: block; font-size: 19px; }
.bubble small { color: #6c6a78; }
.attitude-note { font-size: 12.5px; color: #cdbfff; margin: 8px 0 0 !important; padding: 6px 10px; border-left: 3px solid #9b7bff; background: rgba(155, 123, 255, 0.08); border-radius: 6px; }
.patience { height: 6px; border-radius: 3px; background: rgba(255,255,255,0.08); margin-top: 8px; overflow: hidden; }
.patience i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #ff6b6b, #ffd27a); }
.tray { text-align: center; min-height: 8px; }
.tray-items { display: inline-block; font-size: 34px; letter-spacing: 4px; padding: 4px 14px; margin-top: 8px; border-radius: 14px;
  background: linear-gradient(#c79a6b, #9f774e); box-shadow: inset 0 -4px 0 rgba(0,0,0,0.2); animation: pop .35s both; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }
.task .prompt { font-size: 15.5px; margin: 12px 0 8px !important; }
.task .jp-big { font-size: 22px; color: var(--accent); }
.task .big-num { font-size: 22px; color: var(--accent); }
.staff-line, .reply-line { margin-top: 10px; padding: 8px 12px; border-radius: 12px; font-size: 13px; color: var(--muted); }
.staff-line { background: rgba(61, 220, 151, 0.08); border: 1px solid rgba(61, 220, 151, 0.3); }
.reply-line { background: rgba(255,255,255,0.05); border: 1px solid var(--glass-border); }
.staff-line b, .reply-line b { color: var(--text); font-size: 17px; margin: 0 4px; }
.staff-line small, .reply-line small { display: block; }
.opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.opt { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 10px; border-radius: 14px; cursor: pointer;
  background: rgba(255,255,255,0.06); border: 1px solid var(--glass-border); color: var(--text); transition: transform .12s, border-color .12s;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.opt:hover:not(:disabled) { border-color: rgba(255, 210, 122, 0.5); transform: translateY(-2px); }
.opt b { font-size: 19px; }
.opt small { color: var(--muted); font-size: 12px; text-align: center; }
.opt.right { background: rgba(94, 240, 160, 0.16); border-color: #5ef0a0; }
.opt.wrong { background: rgba(255, 107, 125, 0.16); border-color: #ff6b7d; animation: shake .3s; }
.opt:disabled { cursor: default; }
.explain { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 210, 122, 0.07); border: 1px solid rgba(255, 210, 122, 0.25); font-size: 14px; }
.explain p { margin: 0 0 6px !important; }

/* Results */
.results { text-align: center; position: relative; }
.results h3 { margin: 18px 0 8px; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.learned { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; text-align: left; }
.learned div { display: flex; flex-direction: column; padding: 8px 10px; border-radius: 10px; background: rgba(255,255,255,0.04); }
.learned b { font-size: 17px; }
.learned span { font-size: 12px; color: #9fd4ff; }
.learned small { font-size: 12px; color: var(--muted); }
.attitudes, .fact { text-align: left; }
.attitudes { display: flex; flex-direction: column; gap: 6px; }
.attitudes > div, .fact { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 12px; background: rgba(155, 123, 255, 0.07); border: 1px solid rgba(155, 123, 255, 0.22); }
.fact { background: rgba(255,255,255,0.04); border-color: var(--glass-border); margin-bottom: 6px; }
.attitudes span, .fact > span { font-size: 24px; }
.attitudes small, .fact small { display: block; color: var(--muted); font-size: 12px; }
.fact p { margin: 2px 0 !important; font-size: 13.5px; }

@media (max-width: 980px), (max-height: 520px) {
  .shop-stage { height: 40vh; }
  .cust-portrait { width: 68px; }
  .opts { grid-template-columns: 1fr 1fr; }
  .hud-pill small { display: none; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .shop-frame { flex-direction: row; max-width: none; }
  .shop-stage { height: 100%; flex: 1 1 50%; }
  .shop-counter { flex: 1 1 50%; }
}

/* Favourite snacks */
.sc-snacks { display: flex; gap: 4px; font-size: 20px; margin-top: 6px; }
.sc-snacks i { font-style: normal; }
.snack-h { margin: 6px 0 6px !important; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.snack-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 10px; }
.snack-row span { display: flex; flex-direction: column; align-items: center; min-width: 74px; padding: 8px 6px; border-radius: 14px; background: rgba(255, 210, 122, 0.07); border: 1px solid rgba(255, 210, 122, 0.25); }
.snack-row i { font-style: normal; font-size: 26px; }
.snack-row b { font-size: 13px; }
.snack-row small { font-size: 10.5px; color: var(--muted); }
.snack-fact { font-size: 12.5px; color: #ffe2b0; margin: 8px auto 0 !important; max-width: 520px; padding: 6px 10px; border-radius: 10px; background: rgba(255, 210, 122, 0.07); }

/* ════════════════ Walkable 3D street ════════════════ */
.world { position: absolute; inset: 0; overflow: hidden; background: #0a1130; transition: opacity .6s; }
.world.fade-out { opacity: 0; }
.world-canvas, .world-canvas canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.world-hud { position: absolute; top: calc(var(--safe-t) + 12px); left: 12px; right: 60px; display: flex; flex-wrap: wrap; gap: 6px; z-index: 2; pointer-events: none; }
.world-hud .w-found { color: var(--accent); }
.world > .shop-x { top: calc(var(--safe-t) + 10px); }
.world-hint { position: absolute; left: 50%; bottom: calc(var(--safe-b) + 14px); transform: translateX(-50%); z-index: 2; font-size: 12.5px; color: #cdd6f5;
  padding: 6px 14px; border-radius: 999px; background: rgba(8, 12, 30, 0.6); backdrop-filter: blur(8px); white-space: nowrap; }
.world-hint .link-btn { margin: 0; color: var(--accent); }
.read-card { position: absolute; left: 0; top: 0; z-index: 3; width: 250px; padding: 10px 14px 12px; border-radius: 16px; text-align: center; pointer-events: auto;
  background: rgba(253, 251, 244, 0.95); color: #1d1b26; box-shadow: 0 12px 40px rgba(0,0,0,0.45); }
.read-card::after { content: ""; position: absolute; left: 50%; bottom: -8px; transform: translateX(-50%); border: 8px solid transparent; border-top-color: rgba(253, 251, 244, 0.95); border-bottom: 0; }
.read-card .jp { display: block; font-size: 26px; font-family: 'Hiragino Sans','Yu Gothic','Noto Sans JP',var(--font); }
.read-card .rom { display: block; color: #8a5a00; font-weight: 600; }
.read-card .en { display: block; font-weight: 700; }
.read-card p { margin: 6px 0 0 !important; font-size: 12.5px; color: #4a4858; }
.read-card .say { position: absolute; top: 8px; right: 8px; border: none; background: #ffe7b0; border-radius: 10px; width: 32px; height: 32px; cursor: pointer; }
.world-toast { position: absolute; top: calc(var(--safe-t) + 54px); left: 50%; transform: translate(-50%, -30px); opacity: 0; z-index: 3; padding: 8px 16px; border-radius: 999px;
  background: linear-gradient(135deg, rgba(255,210,122,.95), rgba(255,181,71,.95)); color: #1d1405; font-size: 14px; white-space: nowrap; transition: transform .4s, opacity .4s; pointer-events: none; }
.world-toast.show { transform: translate(-50%, 0); opacity: 1; animation: toastOut 3.2s forwards; }
@keyframes toastOut { 85% { opacity: 1; } 100% { opacity: 0; } }
.world-toast .jp { font-size: 17px; }
.joy { display: none; position: absolute; left: calc(var(--safe-l) + 22px); bottom: calc(var(--safe-b) + 56px); width: 116px; height: 116px; border-radius: 50%; z-index: 3;
  background: rgba(255,255,255,0.08); border: 2px solid rgba(255,255,255,0.22); touch-action: none; }
.joy i { position: absolute; left: 50%; top: 50%; width: 48px; height: 48px; margin: -24px 0 0 -24px; border-radius: 50%; background: rgba(255,255,255,0.55); box-shadow: 0 0 16px rgba(255,255,255,0.4); }
@media (hover: none) { .joy { display: block; } }
.world-title { position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; padding: 20px; text-align: center;
  background: radial-gradient(ellipse at center, rgba(6, 10, 30, 0.35), rgba(6, 10, 30, 0.85)); transition: opacity .6s; }
.world-title.gone { opacity: 0; pointer-events: none; }
.wt-inner { max-width: 460px; }
.wt-jp { font-size: clamp(46px, 12vw, 84px); font-weight: 800; letter-spacing: 0.1em; color: #fff; text-shadow: 0 0 30px rgba(120, 200, 255, 0.6), 0 0 4px #000;
  font-family: 'Hiragino Sans','Yu Gothic','Noto Sans JP',var(--font); animation: rise 1.2s both .2s; }
.wt-sub { letter-spacing: 0.4em; text-transform: uppercase; color: #b9c7ff; font-size: 13px; animation: rise 1.2s both .5s; }
.wt-inner p { color: #dfe5ff; animation: rise 1.2s both .8s; }
.wt-inner .kid-btn { animation: rise 1.2s both 1.1s; }

.wt-loading { margin-top: 10px; font-size: 12.5px; color: #b9c7ff; min-height: 1em; }
.wt-credit { margin-top: 14px; font-size: 10.5px; color: rgba(185, 199, 255, 0.6); }

/* ════════════════ Konbini interior ════════════════ */
.world.interior { background: #f4f1e8; }
.shop-list { position: absolute; z-index: 3; top: calc(var(--safe-t) + 52px); left: 12px; width: min(300px, calc(100vw - 24px));
  background: #fffdf5; color: #2a2733; border-radius: 6px 16px 16px 6px; padding: 10px 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  background-image: repeating-linear-gradient(transparent 0 25px, rgba(80, 120, 200, 0.12) 25px 26px); transform: rotate(-1deg); }
.sl-head { display: flex; align-items: center; gap: 6px; font-weight: 700; font-family: 'Hiragino Sans','Yu Gothic','Noto Sans JP',var(--font); margin-bottom: 4px; }
.sl-head small { font-weight: 500; color: #7a7686; font-family: var(--font); }
.sl-en { margin-left: auto; border: 1px solid #c9c4d6; background: #fff; border-radius: 6px; font-size: 11px; padding: 1px 6px; cursor: pointer; color: #5a5468; }
.sl-line { display: grid; grid-template-columns: 22px 1fr auto; gap: 6px; align-items: center; padding: 4px 0; }
.sl-check { font-weight: 800; color: #9a96a8; text-align: center; }
.sl-line.done .sl-check { color: #1f9e6e; }
.sl-line.over .sl-check { color: #d9534f; }
.sl-line.done .sl-text b { text-decoration: line-through; text-decoration-color: #1f9e6e; text-decoration-thickness: 2px; }
.sl-text b { display: block; font-size: 18px; font-family: 'Hiragino Sans','Yu Gothic','Noto Sans JP',var(--font); }
.sl-text small { color: #8a5a00; font-size: 12px; }
.sl-mean { display: none; font-style: normal; font-size: 11.5px; color: #5a5468; }
.shop-list.show-en .sl-mean { display: block; }
.sl-got { font-size: 12px; font-weight: 700; color: #5a5468; font-variant-numeric: tabular-nums; }

.zone-prompt { position: absolute; z-index: 3; left: 50%; bottom: calc(var(--safe-b) + 56px); transform: translateX(-50%);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; max-width: calc(100vw - 24px);
  padding: 10px 12px; border-radius: 18px; background: rgba(255, 253, 245, 0.96); color: #2a2733; box-shadow: 0 10px 30px rgba(0,0,0,0.25); }
.zone-prompt[hidden], .read-card[hidden], .world-toast[hidden] { display: none; }
.zone-prompt .zp-label { display: flex; align-items: center; gap: 6px; width: 100%; justify-content: center; }
.zone-prompt .zp-label i { font-style: normal; font-size: 26px; }
.zone-prompt .zp-label b { font-size: 19px; font-family: 'Hiragino Sans','Yu Gothic','Noto Sans JP',var(--font); }
.zone-prompt .zp-label small { color: #6c6878; }
.zone-prompt .kid-btn.ghost { color: #2a2733; background: #efeaf8; border-color: #d8d0ea; }
.world.interior .world-hint { background: rgba(40, 44, 70, 0.75); }
.world.interior kbd { color: #fff; }

/* Till dialogue */
.checkout { position: absolute; z-index: 5; left: 50%; bottom: calc(var(--safe-b) + 12px); transform: translate(-50%, 30px); opacity: 0;
  width: min(620px, calc(100vw - 20px)); max-height: 72dvh; overflow-y: auto; padding: 14px; border-radius: 22px;
  background: rgba(253, 251, 244, 0.97); color: #2a2733; box-shadow: 0 16px 50px rgba(0,0,0,0.35); transition: transform .3s, opacity .3s; }
.checkout.show { transform: translate(-50%, 0); opacity: 1; }
.co-row { display: flex; gap: 10px; align-items: flex-start; }
.co-clerk { width: 70px; flex: none; }
.co-bubble { flex: 1; background: #e9f7f1; border-radius: 16px; padding: 8px 12px; border: 1px solid #b8e2cf; }
.co-who { display: block; font-size: 11px; color: #1f9e6e; font-weight: 700; }
.co-bubble .jp { display: block; font-size: 22px; font-family: 'Hiragino Sans','Yu Gothic','Noto Sans JP',var(--font); }
.co-bubble small { display: block; color: #8a5a00; }
.co-en { display: block; font-size: 12.5px; color: #5a5468; }
.co-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; margin-top: 10px; }
.checkout .opt { background: #fff; color: #2a2733; border: 1px solid #ddd6ea; }
.checkout .opt small { color: #6c6878; }
.checkout .kid-btn.ghost { color: #2a2733; background: #efeaf8; border-color: #d8d0ea; }
.co-scan { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; padding: 8px 12px; border-radius: 12px; background: #f3f0e6; font-size: 14px; }
.co-scan span { display: flex; justify-content: space-between; gap: 8px; }
.co-scan i { font-style: normal; color: #6c6878; font-variant-numeric: tabular-nums; }
.co-scan b { text-align: right; border-top: 1px dashed #c9c2b0; padding-top: 4px; }
.co-tip { margin: 10px 0 0 !important; padding: 8px 12px; border-radius: 12px; background: #fff4d6; font-size: 13.5px; }
.co-tray { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 12px; }
.coin { width: 62px; height: 62px; border-radius: 50%; border: none; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center;
  box-shadow: inset 0 -4px 0 rgba(0,0,0,0.18), 0 4px 10px rgba(0,0,0,0.18); font-weight: 800; color: #3a2f12; transition: transform .1s;
  -webkit-user-select: none; user-select: none; }
.coin:active { transform: scale(0.92); }
.coin b { font-size: 17px; line-height: 1; }
.coin small { font-size: 11px; }
.coin.c500 { background: radial-gradient(circle at 35% 30%, #fff1b8, #d9b44a 70%); }
.coin.c100, .coin.c50 { background: radial-gradient(circle at 35% 30%, #ffffff, #b9bec6 70%); }
.coin.c10 { background: radial-gradient(circle at 35% 30%, #f4c49a, #b8733f 70%); }
.coin.note { width: 100px; border-radius: 10px; background: linear-gradient(135deg, #d6e8f5, #9cc0dc); color: #1d3a55; }
.coin.note.rm10 { width: 84px; background: linear-gradient(135deg, #ffb3a7, #d9433a); color: #4a0f0a; }
.coin.note.rm5 { width: 84px; background: linear-gradient(135deg, #c6efb5, #4fa64a); color: #12380f; }
.coin.note.rm1 { width: 84px; background: linear-gradient(135deg, #cfe2ff, #4a7fd1); color: #0f2a55; }
.coin.sen50, .coin.sen20 { background: radial-gradient(circle at 35% 30%, #fff1b8, #c9a440 70%); }
.coin.sen20 { width: 54px; height: 54px; }
.coin.sen10 { width: 48px; height: 48px; background: radial-gradient(circle at 35% 30%, #ffffff, #b9bec6 70%); }
.co-paid { text-align: center; margin-top: 8px; font-size: 14px; }

/* Shopping result */
.shop-result { position: absolute; z-index: 6; left: 50%; top: 50%; transform: translate(-50%, -46%); opacity: 0; transition: transform .35s, opacity .35s;
  width: min(560px, calc(100vw - 20px)); max-height: 86dvh; overflow-y: auto; padding: 18px 16px; border-radius: 22px; text-align: center;
  background: rgba(253, 251, 244, 0.98); color: #2a2733; box-shadow: 0 20px 60px rgba(0,0,0,0.4); }
.shop-result.show { transform: translate(-50%, -50%); opacity: 1; }
.shop-result h2 { margin: 4px 0 10px; }
.shop-result h3 { margin: 14px 0 6px; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: #7a7686; }
.sr-lines { display: flex; flex-direction: column; gap: 6px; text-align: left; }
.sr-lines > div { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border-radius: 12px; background: #eef8f3; }
.sr-lines > div.bad { background: #fdeeee; }
.sr-lines b { font-size: 17px; font-family: 'Hiragino Sans','Yu Gothic','Noto Sans JP',var(--font); }
.sr-lines small { color: #8a5a00; }
.sr-lines p { margin: 2px 0 0 !important; font-size: 13px; }
.shop-result .learned div { background: #f3f0e6; }
.shop-result .learned span { color: #8a5a00; }
.shop-result .learned small { color: #6c6878; }
.shop-result .row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 12px; }
.shop-result .kid-btn.ghost { color: #2a2733; background: #efeaf8; border-color: #d8d0ea; }

@media (max-width: 980px), (max-height: 520px) {
  .shop-list { top: calc(var(--safe-t) + 48px); width: min(250px, calc(100vw - 24px)); padding: 8px 10px; }
  .sl-text b { font-size: 16px; }
  .zone-prompt { bottom: calc(var(--safe-b) + 186px); }
  .co-bubble .jp { font-size: 19px; }
  .coin { width: 56px; height: 56px; }
}

/* Music credit chip */
.music-chip { position: absolute; z-index: 3; right: 12px; bottom: calc(var(--safe-b) + 14px); max-width: min(360px, 46vw); font-size: 11.5px; color: #dfe5ff;
  padding: 6px 10px; border-radius: 12px; background: rgba(8, 12, 30, 0.6); backdrop-filter: blur(8px); line-height: 1.35; }
.music-chip:empty { display: none; }
.music-chip small { display: block; color: #aab4da; }
.music-chip a { color: #cfd8ff; }
.music-chip button { margin-left: 4px; border: 1px solid rgba(255,255,255,0.25); background: rgba(255,255,255,0.08); color: #fff; border-radius: 8px; cursor: pointer; padding: 0 6px; }
@media (max-width: 980px), (max-height: 520px) { .music-chip { left: 12px; right: auto; bottom: auto; top: calc(var(--safe-t) + 84px); max-width: 60vw; } .world.interior .music-chip { top: auto; bottom: calc(var(--safe-b) + 14px); left: auto; right: 12px; } }

.shop-frame > .music-chip.night-chip { position: fixed; right: 12px; bottom: calc(var(--safe-b) + 12px); top: auto; left: auto; }

/* ── World overlays: less crowding (all sizes, then phones) ─────────────── */
.zone-prompt { width: max-content; max-width: calc(100% - 24px); }
.zone-prompt .zp-label b { white-space: nowrap; }
.zone-prompt .zp-label small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60vw; }
.world-hint.quiet .hint-how { display: none; }
.world-toast { white-space: normal; width: max-content; max-width: min(560px, calc(100% - 24px)); text-align: center; border-radius: 16px; }
.world-toast i { font-style: normal; opacity: .75; }
.read-card { cursor: pointer; }
.read-card .rc-new { display: none; position: absolute; top: -11px; left: 50%; transform: translateX(-50%); padding: 2px 10px; border-radius: 999px;
  background: linear-gradient(135deg, #ffd27a, #ffb547); color: #1d1405; font-size: 11.5px; font-weight: 800; white-space: nowrap; box-shadow: 0 4px 12px rgba(0,0,0,.25); }
.read-card.is-new .rc-new { display: block; }
.read-card.is-new { box-shadow: 0 0 0 3px #ffc65c, 0 12px 40px rgba(0,0,0,0.45); }
.read-card p { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.read-card.open p { -webkit-line-clamp: unset; }
.shop-list .sl-text small { display: none; }
.shop-list.show-en .sl-text small { display: block; }
.sl-head { cursor: pointer; -webkit-user-select: none; user-select: none; }
.sl-sum { margin-left: auto; font-size: 12px; font-weight: 800; color: #1f9e6e; font-family: var(--font); }
.sl-sum + .sl-en { margin-left: 4px; }
.shop-list.folded { width: auto; }
.shop-list.folded .sl-line, .shop-list.folded .sl-sub, .shop-list.folded .sl-en { display: none; }
.shop-list.folded .sl-head { margin: 0; }
.music-chip { cursor: pointer; display: flex; align-items: flex-start; gap: 6px; }
.music-chip .mc-icon { flex: none; }
.music-chip.mini { padding: 0; width: 34px; height: 34px; border-radius: 50%; justify-content: center; align-items: center; }
.music-chip.mini .mc-body { display: none; }

@media (max-width: 700px) {
  .hud-long { display: none; }
  .world-hud .hud-pill { font-size: 12px; padding: 3px 9px; }
  /* Mum's list: top-left, half width, one line per item */
  .shop-list { width: auto; max-width: calc(50% - 16px); padding: 6px 9px; top: calc(var(--safe-t) + 46px); left: 8px; }
  .sl-head { font-size: 12.5px; gap: 4px; white-space: nowrap; }
  .sl-head .sl-sub { display: none; }
  .sl-line { grid-template-columns: 16px 1fr auto; gap: 4px; padding: 2px 0; }
  .sl-text b { font-size: 14px; }
  .sl-got { font-size: 11px; }
  /* The word card docks top-right instead of floating over the scene */
  .read-card.docked { left: auto; right: 8px; top: calc(var(--safe-t) + 46px); width: min(calc(50% - 12px), 230px); padding: 8px 10px 9px; transform: none !important; }
  .read-card.docked::after { display: none; }
  .read-card.docked .jp { font-size: 17px; line-height: 1.2; padding: 0 18px; }
  .read-card.docked .rom, .read-card.docked .en { font-size: 12.5px; }
  .read-card.docked p { font-size: 11.5px; }
  .read-card.docked .say { width: 26px; height: 26px; top: 6px; right: 6px; font-size: 12px; }
  /* Take / Put back: one compact row above the joystick */
  .zone-prompt { bottom: calc(var(--safe-b) + 180px); padding: 8px 10px; gap: 6px; border-radius: 16px; }
  .zone-prompt .zp-label b { font-size: 16px; }
  .zone-prompt .zp-label i { font-size: 22px; }
  .zone-prompt .zp-label small { font-size: 11px; max-width: 46vw; }
  .zone-prompt .kid-btn { padding: 8px 14px; font-size: 14px; }
  .world-toast { top: auto; bottom: calc(var(--safe-b) + 292px); width: max-content; font-size: 13px; padding: 7px 12px; }
  .world-toast .jp { font-size: 15px; }
  .world-hint { font-size: 11.5px; padding: 5px 12px; max-width: calc(100% - 24px); white-space: normal; text-align: center; }
  .world-hint.quiet { left: auto; right: 56px; transform: none; }
  .world .music-chip, .world.interior .music-chip { top: auto; left: auto; right: 10px; bottom: calc(var(--safe-b) + 46px); max-width: 55%; }
}
