/* NEKO DASH — Tokyo Rush · UI layer over the three.js canvas
   Mobile-first (iPhone 13: 390×844), scales up to 1440p+. */

:root {
  --bg: #0c0718;
  --bg-2: #160d2e;
  --surface: rgba(22, 13, 48, 0.82);
  --surface-solid: #1b1138;
  --surface-2: rgba(255, 255, 255, 0.06);
  --surface-3: rgba(255, 255, 255, 0.1);
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.2);
  --text: #fbf8ff;
  --muted: #bcb0dd;
  --dim: #8b80b3;
  --pink: #ff3b9a;
  --pink-2: #ff7ab8;
  --pink-deep: #c41f6f;
  --cyan: #00f0ff;
  --cyan-2: #7af4ff;
  --gold: #ffd23e;
  --gold-2: #ffe27a;
  --gold-deep: #c99a12;
  --orange: #ff9a3e;
  --purple: #a864f0;
  --mint: #00ff88;
  --danger: #ff5a6e;
  --rare: #4a9cff;
  --epic: #a864f0;
  --legend: #ffd23e;
  --r-sm: 10px;
  --r: 16px;
  --r-lg: 22px;
  --r-pill: 999px;
  --font-ui: 'Outfit', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Fredoka', 'Outfit', system-ui, sans-serif;
  --font-jp: 'Zen Maru Gothic', 'Outfit', 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);
  --pad: clamp(14px, 3.6vw, 24px);
  --shadow: 0 14px 40px rgba(4, 1, 12, 0.55);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-back: cubic-bezier(0.34, 1.56, 0.64, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
button:disabled { cursor: default; }
img { display: block; }
:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; border-radius: 8px; }
.ico { width: 1.25em; height: 1.25em; flex: none; }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- shell */
.app { position: fixed; inset: 0; overflow: hidden; background: radial-gradient(120% 80% at 50% 0%, #2a1458 0%, var(--bg) 60%); }
#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.touch { position: absolute; inset: 0; touch-action: none; display: none; }
.app.is-running .touch { display: block; }

.screen {
  position: absolute; inset: 0;
  display: none; flex-direction: column;
  padding: calc(var(--safe-t) + 12px) calc(var(--safe-r) + var(--pad)) calc(var(--safe-b) + 14px) calc(var(--safe-l) + var(--pad));
  pointer-events: none;
}
.screen.is-active { display: flex; animation: screen-in 0.35s var(--ease-out); }
/* Desktop/tablet: scale the whole UI layer with the viewport (set from JS as --ui-scale). */
.screen, .overlay, .toasts, .mystery { zoom: var(--ui-scale, 1); }
.screen > * { pointer-events: auto; }
@keyframes screen-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.eyebrow { margin: 0; font-family: var(--font-jp); font-size: 12px; letter-spacing: 0.32em; color: var(--cyan-2); font-weight: 900; }
.muted { color: var(--muted); margin: 6px 0 14px; font-size: 14px; line-height: 1.45; }
.small { font-size: 12px; }

/* ---------------------------------------------------------------- logo */
.logo { margin: 0; display: flex; flex-direction: column; align-items: center; line-height: 0.82; font-family: var(--font-display); font-weight: 700; letter-spacing: 0.02em; }
.logo__neko { font-size: clamp(64px, 19vw, 132px); color: var(--text); text-shadow: 0 0 18px rgba(255, 59, 154, 0.75), 0 6px 0 var(--pink-deep), 0 10px 30px rgba(0, 0, 0, 0.6); }
.logo__dash { font-size: clamp(64px, 19vw, 132px); color: var(--gold); text-shadow: 0 0 18px rgba(255, 210, 62, 0.6), 0 6px 0 #b8761a, 0 10px 30px rgba(0, 0, 0, 0.6); margin-top: 0.04em; }
.logo--sm .logo__neko, .logo--sm .logo__dash { font-size: clamp(30px, 8.5vw, 46px); text-shadow: 0 0 12px rgba(255, 59, 154, 0.6), 0 3px 0 var(--pink-deep); }
.logo--sm .logo__dash { text-shadow: 0 0 12px rgba(255, 210, 62, 0.5), 0 3px 0 #b8761a; }
.logo--sm { flex-direction: row; gap: 0.25em; line-height: 1; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 0 22px; border-radius: var(--r-pill);
  font-weight: 800; font-size: 15px; letter-spacing: 0.05em;
  transition: transform 0.12s var(--ease-out), filter 0.15s, background-color 0.15s;
}
.btn:active:not(:disabled) { transform: translateY(2px) scale(0.98); }
.btn--primary { background: var(--gold); color: #2a1406; box-shadow: 0 5px 0 var(--gold-deep), 0 10px 26px rgba(255, 170, 40, 0.35); }
.btn--primary:active:not(:disabled) { box-shadow: 0 2px 0 var(--gold-deep); }
.btn--gold { background: var(--pink); color: #fff; box-shadow: 0 5px 0 var(--pink-deep), 0 10px 26px rgba(255, 59, 154, 0.35); }
.btn--gold:active:not(:disabled) { box-shadow: 0 2px 0 var(--pink-deep); }
.btn--ghost { background: var(--surface-2); border: 1px solid var(--line-strong); color: var(--text); }
.btn--danger { background: rgba(255, 90, 110, 0.12); border: 1px solid rgba(255, 90, 110, 0.4); color: #ff9aa6; }
.btn--link { min-height: 40px; color: var(--muted); font-weight: 600; letter-spacing: 0.02em; text-decoration: underline; text-underline-offset: 3px; }
.btn--block { width: 100%; }
.btn--xl { min-height: 60px; font-size: 18px; padding: 0 30px; }
.btn:disabled { filter: grayscale(0.8) brightness(0.7); box-shadow: none; }

.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--surface); border: 1px solid var(--line-strong); color: var(--text);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: transform 0.12s var(--ease-out);
}
.icon-btn:active { transform: scale(0.92); }

.pill {
  display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 14px 0 6px;
  border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--line-strong);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  font-family: var(--font-display); font-weight: 600; font-size: 17px; letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
}
.pill__img { width: 28px; height: 28px; object-fit: contain; }
.pill--coin b { color: var(--gold-2); }
.pill--key b { color: var(--cyan-2); }
.fallback-coin, .fallback-key, .fallback-board { display: inline-block; border-radius: 50%; }
.fallback-coin { background: radial-gradient(circle at 35% 35%, #fff2b0, var(--gold) 45%, #d79c12); box-shadow: inset 0 0 0 2px rgba(120, 70, 0, 0.35); }
.fallback-key { background: radial-gradient(circle at 35% 35%, #d8fdff, var(--cyan) 50%, #0094a8); border-radius: 30% 50%; }
.fallback-board { background: linear-gradient(90deg, var(--pink), var(--purple)); border-radius: 8px; }

/* ---------------------------------------------------------------- loading */
.loading { align-items: center; justify-content: center; text-align: center; isolation: isolate; z-index: 1; }
.loading__bg {
  position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(180deg, rgba(12, 7, 24, 0.25) 0%, rgba(12, 7, 24, 0.55) 55%, rgba(12, 7, 24, 0.95) 100%),
    url('../assets/img/bg_city.jpg') center / cover no-repeat,
    radial-gradient(100% 70% at 50% 20%, #3a1a6e, var(--bg));
}
.loading__content { display: flex; flex-direction: column; align-items: center; gap: 18px; width: min(420px, 100%); margin-top: auto; margin-bottom: 8vh; }
.loading__bar { width: min(300px, 80%); height: 10px; border-radius: var(--r-pill); background: rgba(255, 255, 255, 0.12); overflow: hidden; border: 1px solid var(--line); }
.loading__bar i { display: block; height: 100%; width: 0%; border-radius: inherit; background: linear-gradient(90deg, var(--pink), var(--gold)); box-shadow: 0 0 14px rgba(255, 59, 154, 0.8); transition: width 0.25s var(--ease-out); }
.loading__status { margin: 0; font-size: 13px; letter-spacing: 0.12em; color: var(--muted); font-weight: 700; min-height: 1.2em; }
.loading__tip { margin: 0; font-size: 13px; color: var(--dim); }
.loading__start { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.05); } }

/* ---------------------------------------------------------------- home */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; max-width: 1100px; margin: 0 auto; }
.wallet { display: flex; gap: 8px; }
.home__brand { margin-top: 10px; display: flex; flex-direction: column; align-items: center; gap: 4px; pointer-events: none; }
.home__side { position: absolute; right: calc(var(--safe-r) + var(--pad)); top: 34%; display: flex; flex-direction: column; gap: 12px; }
.side-btn {
  position: relative; width: 64px; padding: 10px 0 8px; border-radius: var(--r);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: var(--surface); border: 1px solid var(--line-strong); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.side-btn .ico { width: 28px; height: 28px; color: var(--gold); }
.side-btn__label { font-size: 10px; font-weight: 800; letter-spacing: 0.12em; color: var(--muted); }
.mult-badge { font-family: var(--font-display); font-weight: 700; font-size: 22px; line-height: 28px; color: var(--gold); text-shadow: 0 0 10px rgba(255, 210, 62, 0.5); }
.dot { position: absolute; top: -4px; right: -4px; width: 14px; height: 14px; border-radius: 50%; background: var(--pink); border: 2px solid var(--bg); box-shadow: 0 0 10px var(--pink); }

.home__bottom { margin-top: auto; width: 100%; max-width: 440px; align-self: center; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.home__hero { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 18px; border-radius: var(--r); }
.home__name { font-family: var(--font-display); font-weight: 700; font-size: 28px; letter-spacing: 0.06em; text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6); }
.home__role { font-size: 11px; letter-spacing: 0.2em; font-weight: 800; color: var(--cyan-2); }
.btn--play { width: 100%; min-height: 66px; font-size: 24px; font-family: var(--font-display); font-weight: 700; letter-spacing: 0.08em; }
.btn--play .ico { width: 26px; height: 26px; }
.headstart { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.headstart input { width: 18px; height: 18px; accent-color: var(--pink); }
.home__nav { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; }
.nav-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; min-height: 64px;
  border-radius: var(--r); background: var(--surface); border: 1px solid var(--line-strong);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  font-size: 11px; font-weight: 800; letter-spacing: 0.12em; transition: transform 0.12s var(--ease-out), border-color 0.15s;
}
.nav-btn .ico { width: 24px; height: 24px; color: var(--pink-2); }
.nav-btn:active { transform: scale(0.96); }
.home__best { margin: 0; font-size: 12px; color: var(--dim); letter-spacing: 0.04em; }
.home__best b { color: var(--text); font-family: var(--font-display); font-weight: 600; font-size: 14px; }

/* ---------------------------------------------------------------- sheet screens */
.sheet-head { display: flex; align-items: center; gap: 12px; width: 100%; max-width: 1100px; margin: 0 auto; }
.sheet-head h2 { flex: 1; margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 22px; letter-spacing: 0.08em; text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6); }
.sheet {
  margin-top: auto; width: 100%; max-height: 62%; overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-lg);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); padding: 16px; box-shadow: var(--shadow);
  scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent;
}
.sheet--chars { max-height: 52%; display: flex; flex-direction: column; gap: 14px; }
.sheet-note { margin: 0 0 14px; font-size: 13px; color: var(--muted); line-height: 1.45; }

.char-info { display: flex; flex-direction: column; gap: 6px; }
.char-info__top { display: flex; align-items: center; gap: 10px; }
.char-info__name { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 26px; letter-spacing: 0.05em; }
.char-info__role { font-size: 11px; letter-spacing: 0.18em; font-weight: 800; color: var(--cyan-2); }
.char-info__desc { margin: 0; font-size: 14px; color: var(--muted); line-height: 1.45; }
.char-info__perk { margin: 0; font-size: 13px; font-weight: 700; color: var(--gold-2); }
.char-info__cta { margin-top: 6px; }
.rarity { font-size: 10px; font-weight: 800; letter-spacing: 0.14em; padding: 4px 9px; border-radius: var(--r-pill); border: 1px solid currentColor; }
.rarity--RARE { color: var(--rare); background: rgba(74, 156, 255, 0.12); }
.rarity--EPIC { color: var(--epic); background: rgba(168, 100, 240, 0.14); }
.rarity--LEGEND { color: var(--legend); background: rgba(255, 210, 62, 0.14); }

.char-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.char-card {
  position: relative; aspect-ratio: 4 / 5; border-radius: var(--r); overflow: hidden;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
  border: 2px solid var(--line); transition: transform 0.15s var(--ease-out), border-color 0.15s;
}
.char-card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.char-card::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--stripe, var(--rare)); box-shadow: 0 0 10px var(--stripe, var(--rare)); }
.char-card__name { position: absolute; left: 0; right: 0; bottom: 6px; text-align: center; font-size: 11px; font-weight: 800; letter-spacing: 0.1em; text-shadow: 0 1px 4px #000; }
.char-card.is-selected { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(255, 210, 62, 0.25), 0 8px 24px rgba(255, 210, 62, 0.25); }
.char-card.is-viewing { transform: translateY(-4px); border-color: var(--cyan-2); }
.char-card.is-locked img { filter: grayscale(0.85) brightness(0.55); }
.char-card__lock { position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: rgba(0, 0, 0, 0.55); color: var(--muted); }
.char-card__lock .ico { width: 13px; height: 13px; }
.char-card__fallback { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-display); font-size: 32px; font-weight: 700; color: rgba(255, 255, 255, 0.85); }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.item-card {
  position: relative; display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: var(--r);
  background: var(--surface-2); border: 2px solid var(--line); text-align: left;
}
.item-card.is-selected { border-color: var(--gold); }
.item-card__img { aspect-ratio: 1; width: 100%; object-fit: contain; border-radius: 12px; background: radial-gradient(70% 70% at 50% 45%, rgba(255, 255, 255, 0.1), transparent); }
.item-card__name { font-weight: 800; font-size: 13px; letter-spacing: 0.06em; }
.item-card__desc { font-size: 12px; color: var(--muted); line-height: 1.35; min-height: 2.7em; }
.item-card .btn { min-height: 40px; font-size: 13px; padding: 0 14px; }

.tabs { display: flex; gap: 6px; padding: 4px; border-radius: var(--r-pill); background: rgba(0, 0, 0, 0.25); margin-bottom: 14px; }
.tab { flex: 1; min-height: 40px; border-radius: var(--r-pill); font-weight: 800; font-size: 13px; letter-spacing: 0.1em; color: var(--muted); }
.tab.is-active { background: var(--gold); color: #2a1406; }

.list { display: flex; flex-direction: column; gap: 10px; }
.row-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); }
.row-item__img { width: 54px; height: 54px; object-fit: contain; flex: none; }
.row-item__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.row-item__title { font-weight: 800; font-size: 14px; letter-spacing: 0.03em; }
.row-item__desc { font-size: 12px; color: var(--muted); line-height: 1.35; }
.row-item .btn { min-height: 42px; padding: 0 14px; font-size: 13px; flex: none; }
.pips { display: flex; gap: 4px; margin-top: 2px; }
.pips i { width: 18px; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.14); }
.pips i.on { background: var(--gold); box-shadow: 0 0 6px rgba(255, 210, 62, 0.6); }
.price { display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-display); font-weight: 600; }
.price img, .price .fallback-coin { width: 18px; height: 18px; }

/* missions */
.mult-hero { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0 14px; text-align: center; }
.mult-hero__label { font-size: 11px; letter-spacing: 0.2em; font-weight: 800; color: var(--muted); }
.mult-hero__value { font-family: var(--font-display); font-weight: 700; font-size: 56px; line-height: 1.05; color: var(--gold); text-shadow: 0 0 22px rgba(255, 210, 62, 0.45); }
.mult-hero__hint { font-size: 12px; color: var(--dim); }
.missions { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.mission { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); }
.mission__icon { width: 36px; height: 36px; flex: none; border-radius: 12px; display: grid; place-items: center; background: rgba(255, 59, 154, 0.16); color: var(--pink-2); }
.mission.is-done .mission__icon { background: rgba(0, 255, 136, 0.16); color: var(--mint); }
.mission__body { flex: 1; min-width: 0; }
.mission__text { font-size: 14px; font-weight: 700; line-height: 1.3; }
.mission__bar { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.12); margin-top: 8px; overflow: hidden; }
.mission__bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--pink), var(--gold)); border-radius: inherit; }
.mission.is-done .mission__bar i { background: var(--mint); }
.mission__count { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; margin-top: 4px; }
.mini-missions { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 6px; text-align: left; }
.mini-missions li { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); }
.mini-missions li .ico { width: 16px; height: 16px; color: var(--dim); }
.mini-missions li.is-done { color: var(--text); }
.mini-missions li.is-done .ico { color: var(--mint); }
.mini-missions li.is-new { color: var(--mint); font-weight: 700; }

/* ---------------------------------------------------------------- HUD */
.hud { padding-top: calc(var(--safe-t) + 10px); }
.hud__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; pointer-events: none; }
.hud__top > * { pointer-events: auto; }
.hud__score { display: flex; align-items: center; gap: 8px; pointer-events: none; }
.hud__score-num {
  font-family: var(--font-display); font-weight: 700; font-size: clamp(30px, 8.5vw, 44px); line-height: 1;
  font-variant-numeric: tabular-nums; letter-spacing: 0.01em;
  text-shadow: 0 3px 0 rgba(20, 8, 40, 0.85), 0 0 18px rgba(0, 0, 0, 0.5);
}
.hud__mult {
  font-family: var(--font-display); font-weight: 700; font-size: 18px; padding: 2px 10px; border-radius: var(--r-pill);
  background: rgba(255, 210, 62, 0.16); border: 1px solid rgba(255, 210, 62, 0.45); color: var(--gold);
}
.hud__mult.is-boost { background: var(--gold); color: #2a1406; box-shadow: 0 0 16px rgba(255, 210, 62, 0.7); }
.hud__right { display: flex; align-items: center; gap: 8px; }
.pill--hud { height: 40px; font-size: 19px; }
.icon-btn--hud { width: 42px; height: 42px; }
.hud__meta { display: flex; gap: 12px; margin-top: 4px; font-size: 13px; font-weight: 700; color: rgba(255, 255, 255, 0.75); text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7); font-variant-numeric: tabular-nums; pointer-events: none; }
.hud__powers { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; width: 150px; pointer-events: none; }
.power {
  display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: var(--r-pill);
  background: rgba(14, 8, 30, 0.7); border: 1px solid var(--line-strong); animation: power-in 0.35s var(--ease-back);
}
.power img, .power .fallback-coin { width: 32px; height: 32px; object-fit: contain; flex: none; }
.power__bar { flex: 1; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.14); overflow: hidden; }
.power__bar i { display: block; height: 100%; border-radius: inherit; background: var(--c, var(--gold)); box-shadow: 0 0 8px var(--c, var(--gold)); }
.power.is-ending { animation: blink 0.4s steps(2) infinite; }
@keyframes power-in { from { transform: translateX(-20px); opacity: 0; } }
@keyframes blink { 50% { opacity: 0.4; } }

.hud__popups { position: absolute; left: 0; right: 0; top: 30%; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.popup {
  font-family: var(--font-display); font-weight: 700; font-size: 26px; letter-spacing: 0.04em; color: var(--c, #fff);
  text-shadow: 0 3px 0 rgba(20, 8, 40, 0.9), 0 0 20px var(--c, #fff); animation: popup 1.1s var(--ease-out) forwards;
}
.popup--big { font-size: 40px; }
@keyframes popup { 0% { transform: scale(0.4); opacity: 0; } 18% { transform: scale(1.12); opacity: 1; } 30% { transform: scale(1); } 80% { opacity: 1; } 100% { transform: translateY(-30px); opacity: 0; } }

.zone-banner {
  position: absolute; left: 50%; top: 22%; transform: translate(-50%, 0); display: flex; flex-direction: column; align-items: center;
  opacity: 0; pointer-events: none; text-align: center; white-space: nowrap;
}
.zone-banner.is-show { animation: zone 3s var(--ease-out) forwards; }
.zone-banner b { font-family: var(--font-display); font-weight: 700; font-size: clamp(28px, 8vw, 44px); letter-spacing: 0.12em; text-shadow: 0 0 20px var(--pink), 0 3px 0 rgba(20, 8, 40, 0.9); }
.zone-banner__jp { font-family: var(--font-jp); font-weight: 900; font-size: 15px; letter-spacing: 0.5em; color: var(--cyan-2); }
@keyframes zone { 0% { opacity: 0; letter-spacing: 0.4em; } 15% { opacity: 1; letter-spacing: 0.12em; } 80% { opacity: 1; } 100% { opacity: 0; } }

.tutorial {
  /* sits between the HUD and the horizon: never over the runner or the obstacle */
  position: absolute; left: 50%; top: calc(var(--safe-t) + 118px); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 12px 22px; border-radius: var(--r-lg); background: rgba(14, 8, 30, 0.78); border: 1px solid var(--line-strong);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); pointer-events: none; text-align: center; min-width: 220px; white-space: nowrap;
}
.tutorial b { font-family: var(--font-display); font-size: 22px; font-weight: 700; letter-spacing: 0.06em; color: var(--gold); }
.tutorial span:last-child { font-size: 14px; color: var(--muted); }
.tutorial__arrow { font-size: 38px; line-height: 1; color: var(--text); animation: nudge 0.8s ease-in-out infinite; }
.tutorial__arrow[data-dir="up"] { --nx: 0; --ny: -12px; }
.tutorial__arrow[data-dir="down"] { --nx: 0; --ny: 12px; }
.tutorial__arrow[data-dir="side"] { --nx: 12px; --ny: 0; }
@keyframes nudge { 50% { transform: translate(var(--nx, 0), var(--ny, -10px)); } }

.board-btn {
  position: absolute; right: calc(var(--safe-r) + var(--pad)); bottom: calc(var(--safe-b) + 22px);
  width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(14, 8, 30, 0.72); border: 1px solid var(--line-strong); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.board-btn img, .board-btn .fallback-board { width: 50px; height: 50px; object-fit: contain; transform: rotate(-20deg); }
.board-btn .fallback-board { height: 18px; }
.board-btn b { position: absolute; right: -4px; top: -4px; min-width: 24px; height: 24px; padding: 0 6px; border-radius: var(--r-pill); background: var(--pink); font-size: 13px; font-weight: 800; display: grid; place-items: center; border: 2px solid var(--bg); }
.board-btn__ring { position: absolute; inset: -2px; width: calc(100% + 4px); height: calc(100% + 4px); transform: rotate(-90deg); pointer-events: none; }
.board-btn__ring circle { fill: none; stroke-width: 3; }
.board-btn__ring circle:first-child { stroke: transparent; }
.board-btn__prog { stroke: var(--cyan); stroke-linecap: round; stroke-dasharray: 125.7; stroke-dashoffset: 125.7; filter: drop-shadow(0 0 4px var(--cyan)); }
.board-btn.is-empty { opacity: 0.45; }
.board-btn.is-active { border-color: var(--cyan); box-shadow: 0 0 18px rgba(0, 240, 255, 0.45); }

/* ---------------------------------------------------------------- overlays & cards */
.overlay {
  position: absolute; inset: 0; z-index: 20; display: grid; place-items: center;
  padding: calc(var(--safe-t) + 16px) calc(var(--safe-r) + 16px) calc(var(--safe-b) + 16px) calc(var(--safe-l) + 16px);
  background: rgba(8, 4, 18, 0.62); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  animation: fade-in 0.25s ease-out;
}
.overlay--clear { background: rgba(8, 4, 18, 0.25); backdrop-filter: none; -webkit-backdrop-filter: none; }
@keyframes fade-in { from { opacity: 0; } }
.card {
  position: relative; width: min(380px, 100%); max-height: 100%; overflow-y: auto;
  background: linear-gradient(180deg, #24164a, #170e33); border: 1px solid var(--line-strong);
  border-radius: var(--r-lg); padding: 22px; box-shadow: var(--shadow); text-align: center;
  animation: card-in 0.4s var(--ease-back);
}
@keyframes card-in { from { transform: translateY(16px) scale(0.96); opacity: 0; } }
.card h3 { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 26px; letter-spacing: 0.06em; }
.card__close { position: absolute; top: 12px; right: 12px; width: 38px; height: 38px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.row-2 .btn { padding: 0 12px; white-space: nowrap; font-size: 14px; }
.card .btn--block + .row-2 { margin-top: 10px; }

.countdown { font-family: var(--font-display); font-size: 120px; font-weight: 700; color: var(--gold); text-shadow: 0 6px 0 #b8761a, 0 0 40px rgba(255, 210, 62, 0.6); animation: count 1s var(--ease-out) infinite; }
@keyframes count { 0% { transform: scale(1.5); opacity: 0; } 30% { transform: scale(1); opacity: 1; } 100% { transform: scale(0.9); opacity: 0.8; } }

.card--revive { padding-top: 26px; }
.revive-ring { position: relative; width: 120px; height: 120px; margin: 0 auto 12px; display: grid; place-items: center; }
.revive-ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.revive-ring circle { fill: none; stroke-width: 8; }
.revive-ring__bg { stroke: rgba(255, 255, 255, 0.1); }
.revive-ring__fg { stroke: var(--cyan); stroke-linecap: round; stroke-dasharray: 339.3; stroke-dashoffset: 0; filter: drop-shadow(0 0 6px var(--cyan)); }
.revive-ring img, .revive-ring .fallback-key { width: 68px; height: 68px; object-fit: contain; animation: bob 1.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-6px) rotate(-6deg); } }

.card--results { width: min(420px, 100%); text-align: left; }
.results__head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.results__portrait { width: 76px; height: 95px; object-fit: cover; object-position: top; border-radius: 14px; background: rgba(255, 255, 255, 0.06); }
.results__score { display: flex; flex-direction: column; align-items: center; padding: 12px 0; border-radius: var(--r); background: rgba(0, 0, 0, 0.22); margin: 10px 0 12px; }
.results__score .label { font-size: 11px; letter-spacing: 0.2em; font-weight: 800; color: var(--muted); }
.results__score b { font-family: var(--font-display); font-weight: 700; font-size: 48px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.badge { font-size: 11px; font-weight: 800; letter-spacing: 0.12em; padding: 4px 10px; border-radius: var(--r-pill); }
.badge--gold { background: var(--gold); color: #2a1406; animation: pulse 1.2s ease-in-out infinite; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 0 0 14px; }
.stats div { padding: 8px 4px; border-radius: 12px; background: var(--surface-2); text-align: center; }
.stats dt { font-size: 10px; letter-spacing: 0.14em; font-weight: 800; color: var(--dim); }
.stats dd { margin: 2px 0 0; font-family: var(--font-display); font-weight: 600; font-size: 17px; font-variant-numeric: tabular-nums; }

.daily { list-style: none; padding: 0; margin: 0 0 16px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.daily li { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12px; }
.daily li span { font-size: 10px; font-weight: 800; letter-spacing: 0.1em; color: var(--dim); }
.daily li b { font-family: var(--font-display); font-weight: 600; font-size: 14px; }
.daily li.is-claimed { opacity: 0.45; }
.daily li.is-today { border-color: var(--gold); background: rgba(255, 210, 62, 0.12); box-shadow: 0 0 14px rgba(255, 210, 62, 0.25); }
.daily li.is-today span { color: var(--gold); }
.daily li:last-child { grid-column: span 2; }

.card--settings { text-align: left; }
.card--settings h3 { margin-bottom: 14px; }
.field { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 52px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 14px; font-weight: 600; }
.field input[type="range"] { width: 52%; accent-color: var(--pink); }
.segmented { display: inline-flex; padding: 3px; border-radius: var(--r-pill); background: rgba(0, 0, 0, 0.3); }
.segmented button { min-height: 34px; padding: 0 10px; border-radius: var(--r-pill); font-size: 12px; font-weight: 800; color: var(--muted); }
.segmented button[aria-checked="true"] { background: var(--gold); color: #2a1406; }
.switch { appearance: none; -webkit-appearance: none; width: 50px; height: 30px; border-radius: var(--r-pill); background: rgba(255, 255, 255, 0.16); position: relative; cursor: pointer; transition: background 0.2s; flex: none; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform 0.2s var(--ease-out); }
.switch:checked { background: var(--pink); }
.switch:checked::after { transform: translateX(20px); }
.controls-help { margin: 12px 0; font-size: 13px; color: var(--muted); line-height: 1.55; }
.controls-help summary { cursor: pointer; font-weight: 700; color: var(--text); min-height: 32px; }
.credits { margin-top: 12px; text-align: center; }

.mystery {
  position: absolute; z-index: 15; left: 50%; top: calc(var(--safe-t) + 70px); transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px; padding: 8px 18px 8px 8px; border-radius: var(--r-pill);
  background: rgba(30, 16, 64, 0.92); border: 1px solid rgba(168, 100, 240, 0.6); box-shadow: 0 0 24px rgba(168, 100, 240, 0.45);
  animation: card-in 0.4s var(--ease-back);
}
.mystery__img { width: 52px; height: 52px; object-fit: contain; animation: shake 0.5s ease-in-out 2; }
.mystery b { display: block; font-family: var(--font-display); font-size: 20px; font-weight: 700; color: var(--gold-2); }
@keyframes shake { 25% { transform: rotate(-14deg); } 75% { transform: rotate(14deg); } }

.toasts { position: absolute; z-index: 30; left: 50%; bottom: calc(var(--safe-b) + 110px); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; width: min(92%, 420px); }
.toast { padding: 10px 16px; border-radius: var(--r-pill); background: rgba(14, 8, 30, 0.92); border: 1px solid var(--line-strong); font-size: 14px; font-weight: 700; text-align: center; animation: toast 2.6s var(--ease-out) forwards; }
.toast--warn { border-color: rgba(255, 90, 110, 0.6); color: #ffc2ca; }
.toast--good { border-color: rgba(0, 255, 136, 0.5); color: #b8ffd9; }
.toast--mission { border-color: rgba(255, 210, 62, 0.6); color: var(--gold-2); }
@keyframes toast { 0% { transform: translateY(12px); opacity: 0; } 10% { transform: none; opacity: 1; } 85% { opacity: 1; } 100% { opacity: 0; } }

.flash { position: absolute; inset: 0; z-index: 12; pointer-events: none; opacity: 0; background: radial-gradient(circle at 50% 62%, var(--c, #fff) 0%, transparent 70%); mix-blend-mode: screen; }
.flash.is-on { animation: flash 0.45s ease-out; }
@keyframes flash { 0% { opacity: 0.85; } 100% { opacity: 0; } }
.bump { animation: bump 0.22s var(--ease-back); }
@keyframes bump { 40% { transform: scale(1.14); } }


/* ---------------------------------------------------------------- larger screens */
@media (min-width: 900px) and (min-aspect-ratio: 1/1) {
  .sheet-screen .sheet { position: absolute; right: calc(var(--safe-r) + 32px); top: 90px; width: 420px; max-height: calc(100% - 122px); margin: 0; }
  .sheet-screen .sheet--chars { justify-content: flex-start; }
  .home__bottom { position: absolute; left: 50%; bottom: 28px; transform: translateX(-50%); }
  .home__side { right: 40px; top: 40%; }
  .hud__powers { width: 190px; }
  .board-btn { width: 84px; height: 84px; }
  .toasts { bottom: 40px; }
}
/* Phones held sideways: very little height, so everything moves to the sides. */
@media (orientation: landscape) and (max-height: 520px) {
  .home__brand { display: none; }
  .home__bottom {
    position: absolute; right: calc(var(--safe-r) + 16px); bottom: calc(var(--safe-b) + 10px);
    width: min(330px, 42vw); margin: 0; gap: 8px; transform: none; left: auto;
  }
  .home__hero { padding: 0; }
  .home__name { font-size: 22px; }
  .btn--play { min-height: 54px; font-size: 21px; }
  .nav-btn { min-height: 52px; gap: 3px; }
  .home__best { display: none; }
  .home__side { right: auto; left: calc(var(--safe-l) + var(--pad)); top: 26%; flex-direction: row; }
  .sheet-screen .sheet {
    position: absolute; right: calc(var(--safe-r) + 16px); top: calc(var(--safe-t) + 64px);
    width: min(380px, 48vw); max-height: calc(100% - 80px); margin: 0;
  }
  .sheet--chars { max-height: calc(100% - 80px); }
  .char-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .hud__powers { width: 150px; }
  .card { max-height: calc(100dvh - 24px); }
}
@media (min-width: 1440px) {
  :root { --pad: 32px; }
  .home__bottom { max-width: 480px; }
  .hud__score-num { font-size: 52px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
.app.reduce-motion *, .app.reduce-motion *::before, .app.reduce-motion *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
