/* ============================================================
   東京ライン・タイピング  —  styles (map version)
   ============================================================ */
:root {
  --bg:        #0b0e13;
  --bg-2:      #10151d;
  --panel:     rgba(18, 24, 33, 0.82);
  --panel-solid: #141a23;
  --line:      rgba(255, 255, 255, 0.10);
  --line-soft: rgba(255, 255, 255, 0.06);
  --text:      #eaf0f6;
  --text-mid:  #aab4c0;
  --text-dim:  #6c7885;
  --accent:    #4fc3f7;   /* UIアクセント（路線色とは別のニュートラル系） */
  --warn:      #ff6b6b;
  --warn-soft: rgba(255, 107, 107, 0.18);
  --r-card: 18px;
  --r-pill: 999px;
  --font-jp: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Noto Sans JP",
             "Yu Gothic", "YuGothic", "Meiryo", system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code",
               "Roboto Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  font-family: var(--font-jp); color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; overflow: hidden;
}
.app { position: relative; height: 100dvh; width: 100%; }

.screen { position: absolute; inset: 0; opacity: 0; visibility: hidden; transition: opacity 0.45s var(--ease); }
.screen.is-active { opacity: 1; visibility: visible; }
/* overflow時に上端が切れてスクロール不能になるのを防ぐ（safe center・社長報告 2026-07-15） */
.screen--select, .screen--result {
  display: flex; justify-content: center; overflow-y: auto;
  align-items: center; align-items: safe center;
  padding: clamp(20px, 4vw, 56px);
  padding-top: max(clamp(20px, 4vw, 56px), env(safe-area-inset-top, 0px));
  padding-bottom: max(clamp(20px, 4vw, 56px), env(safe-area-inset-bottom, 0px));
}
@media (prefers-reduced-motion: reduce) { .screen { transition: none; } }

/* ---------- buttons ---------- */
.btn {
  font-family: var(--font-jp); font-size: 1rem; font-weight: 700;
  display: inline-flex; align-items: center; gap: 0.6em; padding: 0.9em 1.6em;
  border: 1px solid transparent; border-radius: var(--r-pill); cursor: pointer; white-space: nowrap;
  transition: transform 0.12s var(--ease), background 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.btn:active { transform: translateY(1px) scale(0.985); }
.btn--primary { color: #04121c; background: linear-gradient(180deg, #7fd6fb, var(--accent)); box-shadow: 0 10px 30px -12px rgba(79, 195, 247, 0.6); }
.btn--ghost { color: var(--text-mid); background: var(--panel-solid); border-color: var(--line); }
.btn--ghost:hover { color: var(--text); border-color: rgba(255, 255, 255, 0.22); }
.btn kbd { font-family: var(--font-mono); font-size: 0.72em; font-weight: 600; padding: 0.25em 0.55em; border-radius: 7px; background: rgba(4, 18, 28, 0.25); color: #05202e; }

/* ============ SELECT ============ */
.select__inner { max-width: 760px; width: 100%; }
.brand { display: flex; align-items: center; gap: 11px; margin-bottom: 22px; }
.brand__dot { width: 11px; height: 11px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 14px var(--accent); }
.brand__label { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.26em; color: var(--text-dim); font-weight: 600; }
.select__title { font-size: clamp(1.85rem, 7vw, 3.8rem); line-height: 1.06; letter-spacing: -0.02em; font-weight: 800; }
.select__title .accent { color: var(--accent); text-shadow: 0 0 36px rgba(79, 195, 247, 0.4); }
.select__lead { margin-top: 18px; max-width: 40em; color: var(--text-mid); font-size: clamp(0.96rem, 2.2vw, 1.08rem); line-height: 1.7; }

/* mode buttons (quiz / profile) */
.modes { margin-top: 30px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.modebtn {
  text-align: left; cursor: pointer; font-family: inherit; color: inherit;
  background: linear-gradient(120deg, rgba(79,195,247,0.10), var(--panel-solid));
  border: 1px solid rgba(79,195,247,0.28); border-radius: 14px; padding: 16px 20px;
  transition: transform 0.14s var(--ease), border-color 0.2s, box-shadow 0.2s;
}
.modebtn:hover { transform: translateY(-3px); border-color: rgba(79,195,247,0.5); box-shadow: 0 16px 40px -20px rgba(0,0,0,0.8); }
.modebtn:active { transform: translateY(-1px); }
.modebtn__title { display: block; font-size: 1.2rem; font-weight: 800; }
.modebtn__desc { display: block; margin-top: 3px; font-size: 0.8rem; color: var(--text-mid); }

/* region tabs (地域切替) */
.region-tabs { margin-top: 30px; display: flex; flex-wrap: wrap; gap: 8px; }
.region-tab {
  font-family: inherit; font-size: 0.92rem; font-weight: 700; color: var(--text-mid); cursor: pointer;
  background: var(--panel-solid); border: 1px solid var(--line); border-radius: var(--r-pill);
  padding: 0.5em 1em; display: inline-flex; align-items: center; gap: 7px;
  transition: color 0.18s, border-color 0.18s, background 0.18s;
}
.region-tab:hover { color: var(--text); border-color: rgba(255, 255, 255, 0.22); }
.region-tab.is-active { color: #04121c; background: linear-gradient(180deg, #7fd6fb, var(--accent)); border-color: transparent; }
.region-tab__n { font-family: var(--font-mono); font-size: 0.72em; opacity: 0.7; }
.region-tab.is-active .region-tab__n { opacity: 0.85; }

.lines__label { margin-top: 24px; font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.2em; color: var(--text-dim); text-transform: uppercase; }
.lines { margin-top: 12px; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.linecard {
  position: relative; text-align: left; cursor: pointer;
  background: linear-gradient(180deg, var(--panel-solid), var(--bg-2));
  border: 1px solid var(--line); border-left: 5px solid var(--lc, #888);
  border-radius: 14px; padding: 18px 20px;
  transition: transform 0.14s var(--ease), border-color 0.2s, box-shadow 0.2s;
  font-family: inherit; color: inherit;
}
.linecard:hover { transform: translateY(-3px); border-color: rgba(255, 255, 255, 0.2); box-shadow: 0 16px 40px -20px rgba(0, 0, 0, 0.8); }
.linecard:active { transform: translateY(-1px); }
.linecard__name { font-size: 1.35rem; font-weight: 800; display: flex; align-items: center; gap: 9px; }
.linecard__badge { width: 12px; height: 12px; border-radius: 50%; background: var(--lc); box-shadow: 0 0 10px var(--lc); flex: none; }
.linecard__en { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-dim); margin-top: 4px; letter-spacing: 0.02em; }
.linecard__meta { margin-top: 12px; font-size: 0.82rem; color: var(--text-mid); }
.select__note { margin-top: 26px; color: var(--text-dim); font-size: 0.82rem; line-height: 1.6; }

/* ============ REGION PICKER (地図から地域選択) ============ */
.region-picker { margin-top: 28px; }
.country-toggle { display: inline-flex; gap: 4px; padding: 4px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-pill); }
.country-btn { padding: 8px 24px; border: 0; border-radius: var(--r-pill); background: transparent; color: var(--text-mid); font: inherit; font-weight: 700; cursor: pointer; transition: color .2s var(--ease), background .2s var(--ease); }
.country-btn:hover { color: var(--text); }
.country-btn.is-active { color: #04121c; background: linear-gradient(180deg, #7fd6fb, var(--accent)); }
.special-regions { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 8px; }
.special-chip { padding: 9px 16px; border: 1px solid var(--line); border-radius: var(--r-pill); background: var(--bg-2); color: var(--text-mid); font: inherit; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; transition: color .2s var(--ease), border-color .2s var(--ease), transform .15s var(--ease); }
.special-chip:hover { color: var(--text); border-color: rgba(255, 255, 255, 0.22); transform: translateY(-1px); }
.special-chip__n { font-family: var(--font-mono); font-size: 0.72em; opacity: 0.7; }
.region-map { margin-top: 16px; height: 440px; border-radius: var(--r-card); overflow: hidden; border: 1px solid var(--line); background: var(--bg-2); z-index: 1; }
.region-map__hint { margin-top: 12px; font-family: var(--font-mono); font-size: 0.74rem; letter-spacing: 0.14em; color: var(--text-dim); text-align: center; }
.region-lines { margin-top: 8px; }
.region-lines__title { margin: 16px 0 2px; font-size: 1.5rem; font-weight: 800; }
.iconbtn--tomap { display: inline-flex; align-items: center; background: var(--bg-2); border: 1px solid var(--line); color: var(--text-mid); padding: 9px 16px; border-radius: var(--r-pill); cursor: pointer; font: inherit; font-weight: 700; transition: color .2s var(--ease), border-color .2s var(--ease); }
.iconbtn--tomap:hover { color: var(--text); border-color: rgba(255, 255, 255, 0.22); }
/* Leaflet divIcon で作る地域ピン（既定の白背景クラスは付かない） */
.region-pin { display: flex; align-items: center; justify-content: center; background: linear-gradient(180deg, #7fd6fb, var(--accent)); border: 1px solid rgba(255, 255, 255, 0.35); border-radius: var(--r-pill); box-shadow: 0 6px 16px -8px rgba(0, 0, 0, 0.85); cursor: pointer; transition: transform .12s var(--ease); }
.region-pin:hover { transform: scale(1.12); z-index: 500; }
.region-pin__name { font-weight: 800; font-size: 0.8rem; color: #04121c; white-space: nowrap; letter-spacing: -0.01em; }
/* 3D日本地図ステージ（高級感：濃紺＋シアン発光） */
.stage3d { position: relative; margin-top: 18px; border-radius: var(--r-card); overflow: hidden; aspect-ratio: 3 / 2; background: #04101f; border: 1px solid rgba(90, 150, 220, 0.28); box-shadow: 0 34px 90px -34px rgba(0, 24, 66, 0.95), inset 0 0 60px rgba(0, 20, 50, 0.6); }
.stage3d__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; user-select: none; -webkit-user-drag: none; }
.stage3d__glow { position: absolute; inset: 0; z-index: 2; pointer-events: none; background: radial-gradient(120% 85% at 28% -5%, rgba(90, 190, 255, 0.16), transparent 55%); }
.stage3d__pins { position: absolute; inset: 0; z-index: 3; }
.pin3d { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 6px; background: none; border: 0; padding: 0; cursor: pointer; }
.pin3d__dot { width: 11px; height: 11px; border-radius: 50%; background: #eaf7ff; box-shadow: 0 0 0 4px rgba(80, 180, 255, 0.22), 0 0 14px 3px rgba(90, 200, 255, 0.9); animation: pin3dpulse 2.6s var(--ease) infinite; }
.pin3d__label { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: var(--r-pill); font-weight: 800; font-size: 0.82rem; color: #eaf6ff; background: rgba(9, 24, 46, 0.55); border: 1px solid rgba(120, 190, 255, 0.35); box-shadow: 0 8px 20px -8px rgba(0, 0, 0, 0.85); white-space: nowrap; transition: transform .15s var(--ease), background .2s var(--ease), border-color .2s var(--ease); }
.pin3d__n { font-family: var(--font-mono); font-size: 0.72em; opacity: 0.72; }
.pin3d:hover { z-index: 10; }
.pin3d:hover .pin3d__label { transform: translateY(-2px); background: rgba(28, 68, 118, 0.8); border-color: rgba(150, 215, 255, 0.75); }
.pin3d:hover .pin3d__dot { box-shadow: 0 0 0 5px rgba(80, 180, 255, 0.32), 0 0 22px 6px rgba(130, 218, 255, 1); }
@keyframes pin3dpulse { 0%, 100% { box-shadow: 0 0 0 4px rgba(80, 180, 255, 0.22), 0 0 14px 3px rgba(90, 200, 255, 0.85); } 50% { box-shadow: 0 0 0 7px rgba(80, 180, 255, 0.06), 0 0 22px 6px rgba(130, 218, 255, 1); } }
@media (max-width: 560px) { .region-map { height: 360px; } .pin3d__label { font-size: 0.72rem; padding: 4px 9px; } }

/* ============ PLAY (map) ============ */
.map { position: absolute; inset: 0; background: var(--bg); z-index: 1; }
/* カラー地図(voyager)。少しだけ彩度を上げてくっきり（社長要望 2026-07-15） */
.leaflet-tile-pane { filter: saturate(1.1); }
.overlay { position: absolute; inset: 0; z-index: 2; pointer-events: none; display: flex; flex-direction: column; }
.overlay > * { pointer-events: auto; }

.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: max(14px, env(safe-area-inset-top, 0px)) clamp(14px, 3vw, 26px) 14px;
  background: linear-gradient(180deg, rgba(11, 14, 19, 0.92), rgba(11, 14, 19, 0));
}
.iconbtn { font-family: inherit; font-size: 0.9rem; font-weight: 700; color: var(--text-mid); background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-pill); padding: 0.55em 1em; cursor: pointer; backdrop-filter: blur(8px); transition: color 0.2s, border-color 0.2s; }
.iconbtn:hover { color: var(--text); border-color: rgba(255, 255, 255, 0.22); }
.topbar__line { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.02rem; }
.topbar__line .dot { width: 11px; height: 11px; border-radius: 50%; background: var(--tbc, #9acd32); box-shadow: 0 0 10px var(--tbc, #9acd32); }
.topbar__stats { margin-left: auto; display: flex; gap: clamp(8px, 2vw, 18px); }
.tstat { font-family: var(--font-mono); font-size: 0.82rem; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.tstat b { color: var(--text); font-size: 1.05rem; font-weight: 700; }
.tstat--prog b { color: var(--accent); }

/* speedometer (Rail Typer style) */
.speedo {
  position: absolute; top: clamp(64px, 12vh, 104px); left: 50%; transform: translateX(-50%);
  display: flex; align-items: baseline; gap: 6px; pointer-events: none;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.9);
}
.speedo__val {
  font-family: var(--font-mono); font-weight: 800; font-variant-numeric: tabular-nums;
  font-size: clamp(3rem, 12vw, 5.2rem); line-height: 1; letter-spacing: -0.03em;
  color: #fff; transition: color 0.25s, text-shadow 0.25s;
}
.speedo.fast .speedo__val { color: var(--lc2, #9acd32); text-shadow: 0 0 30px var(--lc2, #9acd32); }
.speedo__unit { font-family: var(--font-mono); font-size: clamp(0.9rem, 2.4vw, 1.15rem); font-weight: 700; color: var(--text-mid); }
.combo {
  margin-left: 12px; font-family: var(--font-mono); font-size: 0.95rem; color: var(--accent);
  opacity: 0; transform: translateY(4px); transition: opacity 0.2s, transform 0.2s;
  align-self: center;
}
.combo[data-on="true"] { opacity: 1; transform: none; }
.combo b { font-size: 1.5rem; font-weight: 800; }
.combo__x { margin-left: 4px; color: var(--text-dim); font-size: 0.72rem; letter-spacing: 0.08em; }
@media (prefers-reduced-motion: reduce) { .speedo__val, .combo { transition: none; } }

/* typing card, bottom-center floating */
.typecard {
  margin: auto auto clamp(20px, 5vh, 46px); width: min(560px, calc(100% - 28px));
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-card);
  padding: clamp(18px, 3.5vw, 28px); backdrop-filter: blur(16px) saturate(1.2);
  box-shadow: 0 24px 70px -30px rgba(0, 0, 0, 0.95), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.typecard__head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.typecard__kanji { font-size: clamp(1.9rem, 6vw, 2.8rem); font-weight: 800; line-height: 1.05; }
.typecard__kana { font-size: clamp(0.85rem, 2.2vw, 1rem); color: var(--text-dim); letter-spacing: 0.06em; }
.typecard__romaji { margin-top: 16px; font-family: var(--font-mono); font-weight: 600; font-size: clamp(1.5rem, 5vw, 2.3rem); letter-spacing: 0.02em; word-break: break-all; line-height: 1.35; min-height: 1.4em; }
.typecard__romaji .ch { color: var(--text-dim); transition: color 0.08s; }
.typecard__romaji .ch.done { color: var(--lc2, #9acd32); }
.typecard__romaji .ch.cur { color: var(--text); border-bottom: 3px solid var(--lc2, #9acd32); border-radius: 2px; animation: caret 1.1s steps(1) infinite; }
.typecard__romaji .ch.err { color: var(--warn); background: var(--warn-soft); border-radius: 4px; }
@keyframes caret { 50% { border-color: transparent; } }
@media (prefers-reduced-motion: reduce) { .typecard__romaji .ch.cur { animation: none; } }
.typecard.shake { animation: shake 0.24s var(--ease); }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
@media (prefers-reduced-motion: reduce) { .typecard.shake { animation: none; } }
.typecard__next { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line-soft); display: flex; align-items: center; gap: 11px; color: var(--text-mid); font-size: 0.92rem; }
.next-cap { font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.2em; color: var(--text-dim); border: 1px solid var(--line); border-radius: 6px; padding: 3px 7px; }

/* ---- leaflet marker: station dots & train ---- */
.stn-dot { border-radius: 50%; background: #0b0e13; border: 2px solid var(--text-dim); box-sizing: border-box; }
.stn-dot.done { background: var(--lc3, #9acd32); border-color: #fff; }
.train-marker { border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.25), 0 0 18px 4px var(--tc, #9acd32); border: 2px solid var(--tc, #9acd32); }
.stn-label { font-family: var(--font-jp); font-size: 11px; font-weight: 700; color: #dfe7ef; text-shadow: 0 1px 3px #000, 0 0 6px #000; white-space: nowrap; pointer-events: none; }

/* Leaflet attribution: keep readable on dark */
.leaflet-control-attribution { background: rgba(11, 14, 19, 0.7) !important; color: #7b8794 !important; }
.leaflet-control-attribution a { color: #9aa6b2 !important; }

/* ============ RESULT ============ */
.result__inner { max-width: 560px; width: 100%; text-align: center; }
.result__eyebrow { font-family: var(--font-mono); font-size: 0.8rem; letter-spacing: 0.24em; color: var(--accent); margin-bottom: 12px; }
.result__time { font-size: clamp(3.6rem, 15vw, 6.4rem); font-weight: 800; line-height: 0.9; letter-spacing: -0.03em; font-family: var(--font-mono); }
.result__time .u { font-size: 0.28em; color: var(--text-dim); margin-left: 0.2em; font-family: var(--font-jp); font-weight: 700; }
.result__speed { margin-top: 14px; font-size: 1.15rem; color: var(--text-mid); }
.result__speed b { font-family: var(--font-mono); font-size: 1.7rem; font-weight: 800; color: var(--accent); }
.result__speed .u2 { font-family: var(--font-mono); font-size: 0.9rem; color: var(--text-dim); }
.result__speed-best { display: block; margin-top: 4px; font-size: 0.8rem; color: var(--text-dim); }
.result__sub { margin-top: 12px; color: var(--text-mid); font-size: 0.98rem; }
.result__grid { margin: 32px 0 26px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.rcell { display: flex; flex-direction: column; gap: 6px; padding: 16px 8px; background: var(--panel-solid); border: 1px solid var(--line); border-radius: 14px; }
.rcell--best { border-color: rgba(79, 195, 247, 0.32); background: rgba(79, 195, 247, 0.06); }
.rfig { font-family: var(--font-mono); font-size: clamp(1.25rem, 5vw, 1.8rem); font-weight: 700; font-variant-numeric: tabular-nums; }
.rfig small { font-size: 0.5em; color: var(--text-dim); }
.rcell--best .rfig { color: var(--accent); }
.rlbl { font-size: 0.72rem; color: var(--text-dim); }
.result__actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.result__share { display: inline-block; margin-top: 16px; color: var(--text-dim); font-size: 0.86rem; background: none; border: none; border-bottom: 1px solid transparent; cursor: pointer; font-family: inherit; transition: color 0.2s, border-color 0.2s; }
.result__share:hover { color: var(--text); border-color: var(--text-dim); }
.result.is-new-best .rcell--best { animation: pulseBest 1.6s var(--ease) infinite; }
@keyframes pulseBest { 0%, 100% { box-shadow: 0 0 0 0 rgba(79, 195, 247, 0); } 50% { box-shadow: 0 0 0 4px rgba(79, 195, 247, 0.18); } }
@media (prefers-reduced-motion: reduce) { .result.is-new-best .rcell--best { animation: none; } }

/* ============ SPRINT SPLIT ============ */
.sprint {
  position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center;
  background: rgba(6, 9, 13, 0.55); backdrop-filter: blur(3px);
}
.sprint__card {
  width: min(460px, calc(100% - 32px)); text-align: center;
  background: linear-gradient(180deg, var(--panel-solid), var(--bg-2));
  border: 1px solid rgba(79, 195, 247, 0.35); border-radius: var(--r-card);
  padding: clamp(24px, 5vw, 40px); box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.95);
  animation: sprintIn 0.4s var(--ease);
}
@keyframes sprintIn { 0% { opacity: 0; transform: translateY(14px) scale(0.97); } 100% { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .sprint__card { animation: none; } }
.sprint__eyebrow { font-family: var(--font-mono); font-size: 0.9rem; letter-spacing: 0.14em; color: var(--accent); }
.sprint__eyebrow b, .sprint__eyebrow span { font-weight: 800; }
.sprint__range { margin-top: 8px; font-size: clamp(1.3rem, 4.5vw, 1.9rem); font-weight: 800; }
.sprint__stats { margin: 22px 0 18px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.sprint__stat { display: flex; flex-direction: column; gap: 4px; padding: 12px 6px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); border-radius: 12px; }
.sprint__stat b { font-family: var(--font-mono); font-size: 1.5rem; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }
.sprint__stat:nth-child(2) b { color: var(--accent); }
.sprint__stat span { font-size: 0.72rem; color: var(--text-dim); }
.sprint__cont { color: var(--text-mid); font-size: 0.9rem; }
.sprint__cont kbd { font-family: var(--font-mono); font-size: 0.8em; padding: 0.25em 0.6em; border-radius: 7px; background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); color: var(--text-dim); }

/* ============ QUIZ ============ */
.screen--quiz { display: flex; align-items: stretch; justify-content: stretch; padding: 0; }
.quiz { width: 100%; display: flex; flex-direction: column; }
.quiz__hud { display: flex; align-items: center; gap: 14px; padding: 16px clamp(14px,3vw,26px); border-bottom: 1px solid var(--line-soft); }
.quiz__stats { margin-left: auto; display: flex; gap: clamp(10px,2vw,20px); }
.quiz__body { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 24px; text-align: center; }
.quiz__hint { font-family: var(--font-mono); font-size: 0.85rem; letter-spacing: 0.06em; color: var(--accent); }
.quiz__kanji { font-size: clamp(3.4rem, 14vw, 7rem); font-weight: 800; letter-spacing: 0.04em; line-height: 1.05; }
.quiz__romaji { font-family: var(--font-mono); font-weight: 600; font-size: clamp(1.6rem, 6vw, 2.6rem); letter-spacing: 0.04em; min-height: 1.4em; }
.quiz__romaji .ch { color: var(--text-dim); transition: color 0.08s; }
.quiz__romaji .ch.done { color: var(--accent); }
.quiz__romaji .ch.cur { color: var(--text); border-bottom: 3px solid var(--accent); border-radius: 2px; animation: caret 1.1s steps(1) infinite; }
.quiz__romaji .ch.err { color: var(--warn); background: var(--warn-soft); border-radius: 4px; }
.quiz__reveal { min-height: 1.4em; font-size: 1.05rem; color: var(--text-mid); }
.quiz__reveal.show { color: #7fe0a8; }
.quiz.shake .quiz__romaji { animation: shake 0.24s var(--ease); }
@media (prefers-reduced-motion: reduce) { .quiz__romaji .ch.cur, .quiz.shake .quiz__romaji { animation: none; } }
.quiz__end { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; padding: 24px; }
.quiz__end-eyebrow { font-family: var(--font-mono); font-size: 0.8rem; letter-spacing: 0.22em; color: var(--accent); }
.quiz__end-score { font-family: var(--font-mono); font-size: clamp(3.6rem, 15vw, 6rem); font-weight: 800; line-height: 0.9; }
.quiz__end-score .u { font-size: 0.32em; color: var(--text-dim); }
.quiz__end-sub { color: var(--text-mid); }
.quiz__end-actions { margin-top: 14px; display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

/* ============ PROFILE ============ */
.profile { max-width: 760px; width: 100%; margin: 0 auto; }
.profile__head { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; }
.profile__title { font-size: 1.6rem; font-weight: 800; }
.profile__summary { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin-bottom: 20px; }
.psum { background: var(--panel-solid); border: 1px solid var(--line); border-radius: 14px; padding: 16px; text-align: center; }
.psum b { display: block; font-family: var(--font-mono); font-size: 1.7rem; font-weight: 800; color: var(--accent); }
.psum span { font-size: 0.74rem; color: var(--text-dim); }
.profile__table { display: flex; flex-direction: column; gap: 8px; }
.prow { display: grid; grid-template-columns: 1fr auto auto; gap: 14px; align-items: center; padding: 12px 16px; background: var(--panel-solid); border: 1px solid var(--line); border-left: 5px solid var(--pc,#888); border-radius: 12px; }
.prow__name { font-weight: 700; }
.prow__stat { font-family: var(--font-mono); font-size: 0.9rem; color: var(--text-mid); font-variant-numeric: tabular-nums; }
.prow__stat b { color: var(--text); }
.profile__empty { color: var(--text-dim); text-align: center; padding: 40px 0; }

@media (max-width: 640px) {
  .modes { grid-template-columns: 1fr; }
  .profile__summary { grid-template-columns: 1fr 1fr; }
  .prow { grid-template-columns: 1fr auto; }
  .topbar { flex-wrap: wrap; }
  .topbar__stats { width: 100%; margin-left: 0; justify-content: space-between; order: 3; }
  .result__grid { grid-template-columns: repeat(2, 1fr); }
}
