:root {
  --bg: #14121c; --panel: #1f1b2bee; --line: #3a3350; --text: #ece8f6; --dim: #9a93b0;
  --g: #e0524a;   /* 格闘＝赤 */
  --c: #d9b44a;   /* 剣術＝金 */
  --p: #4a86e0;   /* 魔法＝青 */
  --ok: #5fc48a; --ng: #e0524a;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: system-ui, -apple-system, "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif; overflow: hidden; }
body { display: flex; flex-direction: column; }
button { background: #1f1b2b; color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px 14px; font-size: 14px; cursor: pointer; font-family: inherit; }
button:hover { border-color: var(--c); }
h2 { margin: 0 0 8px; font-size: 15px; color: var(--dim); font-weight: 600; }
.hint { margin: 0; color: var(--dim); font-size: 13px; }

/* 上の帯 */
#bar { display: flex; align-items: center; gap: 14px; padding: 8px 16px; background: #0e0c14; border-bottom: 1px solid var(--line); }
#bar button { flex: none; }
#bar h1 { margin: 0 8px 0 0; font-size: 18px; letter-spacing: .04em; }
.mini b { font-size: 22px; font-variant-numeric: tabular-nums; }
.mini small { margin-left: 3px; color: var(--dim); font-size: 12px; }
.mini.dim b { color: var(--dim); }
.conn { color: var(--dim); font-size: 13px; min-width: 0; flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conn.ok { color: var(--ok); } .conn.ng { color: var(--ng); }
.grow { flex: 1; }

#screen { flex: 1; position: relative; min-height: 0; overflow: hidden; container-type: size; background: #000 center / cover no-repeat; }

/* つながずに試す */
.sim { display: none; gap: 18px; align-items: center; padding: 8px 16px; background: #0e0c14; border-top: 1px solid var(--line); flex-wrap: wrap; }
.sim.on { display: flex; }
.sim label { display: flex; align-items: center; gap: 8px; }
.sim input[type=range] { width: min(280px, 30vw); }
output { font-variant-numeric: tabular-nums; min-width: 60px; }

/* ダイアログ */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal[hidden] { display: none; }
.modal .box { background: #1f1b2b; border: 1px solid var(--line); border-radius: 12px; padding: 16px; width: min(460px, 92vw); max-height: 92vh; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }   /* 設定が長くなっても、画面に収まって、スクロールで閉じるまで届く */
.modal label { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.modal input[type=number] { width: 80px; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; }
#picker-list { list-style: none; padding: 0; margin: 0; max-height: 50vh; overflow: auto; }
#picker-list li { margin: 0 0 6px; }
#picker-list button { width: 100%; text-align: left; }

/* 主人公を選ぶ */
.select { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; background: rgba(10,8,16,.45); padding: 16px; }
.select h2 { color: var(--text); font-size: 22px; text-shadow: 0 2px 6px #000; }
.heroes { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; }
.hero-card { width: 250px; background: var(--panel); border: 2px solid var(--line); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; text-align: center; }
.hero-card:hover { transform: translateY(-3px); }
.hero-card.g { border-color: var(--g); } .hero-card.c { border-color: var(--c); } .hero-card.p { border-color: var(--p); }
.hero-card img { height: 30vh; max-height: 260px; }
.hero-card .name { font-size: 18px; font-weight: 700; }
.hero-card .style { font-size: 14px; }
.hero-card .how { font-size: 12px; color: var(--dim); min-height: 3em; }

/* 戦闘 */
.battle { position: absolute; inset: 0; }
.spr { position: absolute; bottom: 4%; height: 62%; transition: transform .15s; }
.spr img { height: 100%; display: block; }
#spr-hero { left: 6%; }
#spr-enemy { right: 6%; }
#spr-enemy img { transform: scaleX(-1); }
.spr.lunge-r { transform: translateX(8%); } .spr.lunge-l { transform: translateX(-8%); }
.spr.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-10px); } 75% { transform: translateX(10px); } }
.plate { position: absolute; top: 3%; width: 30%; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
#plate-hero { left: 3%; } #plate-enemy { right: 3%; }
.plate .name { font-weight: 700; display: flex; justify-content: space-between; gap: 8px; }
.plate .sub { color: var(--dim); font-size: 12px; font-weight: 400; }
.hp { height: 12px; background: #0008; border-radius: 6px; overflow: hidden; margin-top: 6px; }
.hp > i { display: block; height: 100%; background: var(--ok); transition: width .3s; }
.gauge { height: 6px; background: #0008; border-radius: 3px; overflow: hidden; margin-top: 6px; }
.gauge > i { display: block; height: 100%; background: var(--ng); }
.gauge-label { font-size: 11px; color: var(--dim); margin-top: 4px; }

/* スロット */
.slot[hidden] { display: none; }
.slot { position: absolute; left: 50%; top: 22%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.reels { display: flex; gap: 10px; padding: 12px; background: #0b0911ee; border: 2px solid var(--c); border-radius: 14px; }
.reel { width: min(13vh, 120px); height: min(13vh, 120px); background: #1b1726; border: 2px solid var(--line); border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.reel img { width: 86%; height: 86%; }
.reel.spin img { opacity: .55; filter: blur(1.5px); }
.reel.now { border-color: var(--text); box-shadow: 0 0 14px #fff6; }
.reel.stopped { border-color: var(--c); }
.cond { width: min(56vh, 460px); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.cond .what { font-size: 14px; display: flex; justify-content: space-between; gap: 8px; }
.cond .what b { font-variant-numeric: tabular-nums; }
.cond.in { border-color: var(--ok); }
.cond.go { border-color: var(--ng); animation: pulse .5s infinite alternate; }
@keyframes pulse { to { box-shadow: 0 0 18px var(--ng); } }
.track { position: relative; height: 18px; background: #0008; border-radius: 4px; margin-top: 8px; }
.track .band { position: absolute; top: 0; bottom: 0; background: #5fc48a55; border-left: 2px solid var(--ok); border-right: 2px solid var(--ok); }
.track .mark { position: absolute; top: -3px; bottom: -3px; width: 4px; margin-left: -2px; background: var(--text); border-radius: 2px; }
.progress { height: 8px; background: #0008; border-radius: 4px; overflow: hidden; margin-top: 8px; }
.progress > i { display: block; height: 100%; background: var(--c); }
.banner:empty { visibility: hidden; }
.banner { padding: 2px 16px; background: #0b0911cc; border-radius: 10px; min-height: 1.6em; font-size: 22px; font-weight: 800; text-shadow: 0 2px 6px #000; text-align: center; }
.banner.trisk { color: var(--c); font-size: 30px; }
.banner.g { color: var(--g); } .banner.c { color: var(--c); } .banner.p { color: var(--p); }

.pop { position: absolute; font-size: 34px; font-weight: 900; color: #fff; text-shadow: 0 2px 6px #000, 0 0 2px #000; pointer-events: none; animation: pop 1s forwards; }
.pop.hurt { color: #ff8a80; }
@keyframes pop { from { transform: translateY(0); opacity: 1; } to { transform: translateY(-60px); opacity: 0; } }
.fx { position: absolute; width: 22%; pointer-events: none; mix-blend-mode: screen; animation: fx .5s forwards; }
@keyframes fx { from { opacity: 1; transform: scale(.7); } to { opacity: 0; transform: scale(1.2); } }

.end { position: absolute; inset: 0; background: rgba(0,0,0,.55); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; }
.end h2 { font-size: 44px; color: var(--text); margin: 0; text-shadow: 0 2px 8px #000; }
.end .buttons { display: flex; gap: 12px; }

.slot .target, .select > .hint { background: #0b0911cc; color: var(--text); padding: 4px 12px; border-radius: 8px; }

/* 挑戦者のカードのボタン */
.card-buttons { display: flex; gap: 8px; margin-top: 4px; }
.card-buttons button { white-space: nowrap; }
.card-buttons .go { border-color: var(--c); }

/* 加護 */
.buffs { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.buffs:empty { display: none; }
.buff { font-size: 11px; padding: 1px 8px; border-radius: 999px; background: #d9b44a33; border: 1px solid var(--c); color: var(--text); }
.banner.appear { color: var(--text); }

/* フィールド */
.field { position: absolute; inset: 0; overflow: hidden; background: #000; }
.scene { position: absolute; inset: 0; background: center / cover no-repeat; opacity: 0; transition: opacity 3s; transform: scale(1.14); }
.scene.on { opacity: 1; }
.walker { left: 14%; bottom: 3%; height: 60%; transition: transform .04s; }
.place { position: absolute; top: 18%; left: 50%; transform: translateX(-50%); font-size: 30px; font-weight: 800; letter-spacing: .1em; text-shadow: 0 2px 10px #000, 0 0 2px #000; opacity: 0; transition: opacity 1.5s; white-space: nowrap; }
.place.on { opacity: 1; }
.fplate { left: 3%; }
.fnext { right: 3%; width: auto; min-width: 22%; }
.fnext .next { font-weight: 700; margin-top: 4px; }
.talk { position: absolute; left: 50%; bottom: 4%; transform: translateX(-50%); width: min(760px, 70%); background: #0b0911e6; border: 2px solid var(--line); border-radius: 14px; padding: 12px 18px 10px; }
.talk .who { display: inline-block; font-weight: 700; color: var(--c); margin-bottom: 4px; }
.talk.by-hero .who { color: var(--p); }
.talk.by-sys .text { color: var(--dim); }
.talk .text { font-size: 19px; line-height: 1.6; min-height: 3.2em; }
.talk .effect { color: var(--c); font-weight: 700; min-height: 1.2em; }
.talk .hint { text-align: right; font-size: 11px; }
.idle { position: absolute; top: 40%; left: 50%; transform: translateX(-50%); background: #0b0911cc; padding: 8px 18px; border-radius: 10px; font-size: 18px; }
.idle[hidden] { display: none; }

/* 旅の記録 */
.summary { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; background: rgba(10,8,16,.55); }
.summary h2 { font-size: 34px; color: var(--text); margin: 0; text-shadow: 0 2px 8px #000; }
.summary table { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 18px; border-spacing: 18px 6px; }
.summary th { text-align: left; color: var(--dim); font-weight: 400; }
.summary td { text-align: right; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* 挑戦者を選ぶ：FTP と時間 */
.ftp-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: center; background: #0b0911cc; padding: 8px 14px; border-radius: 10px; }
.ftp-row.first { border: 1px solid var(--c); }
.select > .habit { background: #0b0911cc; padding: 4px 14px; border-radius: 10px; font-size: var(--fs-s); }
.trial-btn { border-color: var(--c); }
.minutes { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: center; background: #0b0911cc; padding: 6px 12px; border-radius: 10px; }
.minutes span { margin-right: 6px; }
.minutes button { padding: 5px 10px; }
.minutes button.on { background: var(--c); color: #14121c; border-color: var(--c); font-weight: 700; }
.select .hero-card img { height: 24vh; }

/* 女王の試練 */
.trial { position: absolute; inset: 0; }
.trial .queen { right: 7%; bottom: 3%; height: 64%; }
.trial .queen img { transform: scaleX(-1); }
.trial .queen img[hidden] { display: none; }
.trial-panel { position: absolute; top: 6%; left: 42%; transform: translateX(-50%); width: min(560px, 80%); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px 20px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.trial-panel .phase { color: var(--dim); font-size: 16px; }
.trial-panel .target b { font-size: 72px; font-variant-numeric: tabular-nums; line-height: 1; }
.trial-panel .target small { color: var(--dim); margin-left: 6px; font-size: 20px; }
.trial-panel .now { font-size: 18px; font-variant-numeric: tabular-nums; }
.trial-panel .meter { position: relative; width: 100%; height: 16px; background: #0008; border-radius: 4px; }
.trial-panel .meter .fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--ok); border-radius: 4px; }
.trial-panel .meter.low .fill { background: var(--ng); }
.trial-panel .meter .line { position: absolute; top: -4px; bottom: -4px; width: 3px; margin-left: -1px; background: var(--text); }
.trial-panel .progress { width: 100%; }
.trial-panel .info { font-size: 14px; font-variant-numeric: tabular-nums; text-align: center; }
.trial .talk .buttons { display: flex; gap: 10px; margin-top: 8px; }

/* 旅のまとめ */
.report { position: absolute; inset: 0; overflow: auto; background: var(--bg); padding: 14px 20px; display: flex; flex-direction: column; gap: 10px; }
.report-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.report-head h2 { font-size: 24px; color: var(--text); margin: 0; }
.report-head .sub { color: var(--dim); font-size: 13px; margin-top: 2px; }
.report-buttons { display: flex; gap: 8px; }
.tiles { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; }
.tile { background: #1f1b2b; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.tile .k { color: var(--dim); font-size: 12px; }
.tile .v { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile .v small { font-size: 12px; color: var(--dim); margin-left: 3px; font-weight: 400; }
.peaks { color: var(--dim); font-size: 13px; }
.peaks b { color: var(--text); font-variant-numeric: tabular-nums; }
.charts { display: grid; grid-template-columns: 3fr 2fr; gap: 10px; min-height: 0; flex: 1; }
.chart-box { background: #1f1b2b; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; display: flex; flex-direction: column; min-height: 220px; }
.chart-title { font-size: 13px; color: var(--dim); display: flex; gap: 14px; align-items: center; }
.chart-title .key { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; }
.chart-title .key i { display: inline-block; width: 14px; height: 10px; border-radius: 2px; }
.chart-title .key i.band { background: rgba(224, 82, 74, 0.35); }
.chart-title .key i.ftp { height: 1px; background: var(--dim); }
.chart { position: relative; flex: 1; min-height: 180px; overflow: hidden; }
.chart canvas { position: absolute; inset: 0; }
.chart .tip { position: absolute; background: #0b0911; border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px; font-size: 12px; pointer-events: none; white-space: nowrap; }
.zones { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.zrow { display: grid; grid-template-columns: 120px 1fr; align-items: center; gap: 8px; }
.zname { font-size: 13px; display: flex; flex-direction: column; }
.zname small { color: var(--dim); font-size: 11px; }
.zbar { display: flex; align-items: center; gap: 8px; }
.zbar i { display: block; height: 18px; border-radius: 0 4px 4px 0; }
.zbar span { font-size: 12px; color: var(--dim); white-space: nowrap; font-variant-numeric: tabular-nums; }
.game-row { display: flex; gap: 22px; flex-wrap: wrap; font-size: 14px; color: var(--dim); }
.game-row b { color: var(--text); }
.king { background: #1f1b2b; border-left: 3px solid var(--c); padding: 8px 12px; border-radius: 6px; }
.king b { color: var(--c); margin-right: 8px; }
.saved { display: flex; align-items: center; gap: 8px; }
.saved[hidden] { display: none; }

/* タイトルロゴ */
.select .logo { height: 14vh; max-height: 120px; filter: drop-shadow(0 3px 8px #000c); }
.select .subtitle { margin-top: -10px; font-size: 18px; font-weight: 700; letter-spacing: .15em; color: #f3dc8a; text-shadow: 0 2px 6px #000, 0 0 2px #000; }
.report-head .brand { display: flex; flex-direction: column; align-items: center; }
.report-head .subtitle-sm { font-size: 10px; letter-spacing: .1em; color: var(--c); margin-top: -2px; }
.select { gap: 12px; }
.select .hero-card img { height: 22vh; }
.report-head .logo-sm { height: 48px; }
.report-head .grow { flex: 1; }

/* FIT と Strava */
.fit-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--dim); }
.fit-row[hidden] { display: none; }
.fit-row button.strava { border-color: #fc4c02; }

/* フリーライド：コースを選ぶ */
.free-btn { margin-left: 10px; border-color: #ffb347; }
.courses h2 { color: var(--text); font-size: 20px; text-shadow: 0 2px 6px #000; }
.course-cards { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.course-card { width: 250px; background: var(--panel); border: 2px solid #c08a50; border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.course-card .name { font-size: 17px; font-weight: 700; }
.course-card canvas { width: 100%; height: 54px; background: #0006; border-radius: 6px; }
.course-card .how { font-size: 12px; color: var(--dim); min-height: 3em; }
.course-card .stat { font-size: 12px; }
.course-card .stat.dim { color: var(--dim); }

/* フリーライド：走る画面 */
.ride { position: absolute; inset: 0; }
.ride3d { position: absolute; inset: 0; }
.ride3d canvas { display: block; }
.rplate { left: 2%; width: 32%; }
.rplate .progress { margin-top: 6px; }
.gradebox { position: absolute; top: 3%; left: 50%; transform: translateX(-50%); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 6px 18px; text-align: center; }
.gradebox .g { display: block; font-size: 34px; font-variant-numeric: tabular-nums; }
.gradebox .h { color: var(--dim); font-size: 12px; }
.gradebox.up .g { color: #f3dc8a; } .gradebox.steep .g { color: #ff8a65; } .gradebox.down .g { color: #8fd3ff; }
.minimap { position: absolute; top: 3%; right: 2%; width: 22%; aspect-ratio: 1377 / 1142; border-radius: 10px; border: 1px solid var(--line); background: #2a5a8c; }
.profile { position: absolute; left: 2%; bottom: 3%; width: 96%; height: 12%; background: #0b091199; border-radius: 10px; }
.ride .place { top: 26%; }

/* ===== 昔の RPG 風（2026-10-19）：ドット文字、黒地に白いふちの窓、ドット絵はぼかさない ===== */
@font-face { font-family: 'DotGothic16'; src: url('fonts/DotGothic16-Regular.ttf') format('truetype'); font-display: swap; }
:root { --panel: #000000e6; --line: #ffffff; --dim: #b8b4c8; --win: 3px solid #fff; }
html, body, button, input, select { font-family: 'DotGothic16', "Hiragino Sans", "Yu Gothic UI", sans-serif; }
body { -webkit-font-smoothing: none; }
img.pixel, canvas.pixel { image-rendering: pixelated; }
button { background: #000; border: 2px solid #fff; border-radius: 6px; }
button:hover, button:focus-visible { border-color: #f3dc8a; color: #f3dc8a; outline: none; }
button:hover::before, button:focus-visible::before { content: '▶ '; }
.win, .modal .box { background: var(--panel); border: var(--win); border-radius: 8px; box-shadow: 0 0 0 2px #000, 0 4px 14px #0008; }
.hp { height: 10px; border-radius: 0; border: 1px solid #fff; background: #000; }
.hp > i { background: #fff; }
.progress, .gauge, .track { border-radius: 0; }
#bar { background: #000; border-bottom: 2px solid #fff; }
.select { background: rgba(0,0,0,.35); }

/* 挑戦者のカード */
.hero-card { width: 220px; border-radius: 8px; border: var(--win); background: var(--panel); }
.hero-card.g, .hero-card.c, .hero-card.p { border-color: #fff; }
.hero-card img, .select .hero-card img { height: auto; max-height: none; margin: 4px 0; }
.hero-card .style { color: #f3dc8a; }

/* 戦闘：上に主人公の窓、まん中に敵、下にメッセージの窓 */
.battle .status { position: absolute; top: 3%; left: 50%; transform: translateX(-50%); width: min(420px, 46%); padding: 8px 14px; }
.battle .status .name { display: flex; justify-content: space-between; gap: 8px; font-size: 18px; }
.battle .status .sub { color: var(--dim); font-size: 13px; }
.battle .status.hurt { animation: hurt .6s; }
@keyframes hurt { 30% { background: #a01818e6; } }
.foe { position: absolute; left: 50%; bottom: 36%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; transition: transform .15s, opacity .8s; }
.foe img { display: block; max-height: 44cqh; width: auto; filter: drop-shadow(0 6px 4px #0008); }
.foe.blink img { animation: blink .5s steps(2) ; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
.foe.lunge { transform: translateX(-50%) scale(1.08); }
.foe.gone { opacity: 0; }
.hp.thin { height: 6px; margin-top: 4px; }
.battle.quake { animation: quake .4s; }
@keyframes quake { 20% { transform: translate(-8px, 4px); } 40% { transform: translate(8px, -4px); } 60% { transform: translate(-6px, 2px); } 80% { transform: translate(4px, 0); } }
.battle .msg { position: absolute; left: 3%; right: 3%; bottom: 3%; height: 31%; padding: 10px 18px; display: flex; flex-direction: column; gap: 8px; }
.battle .msg .line { font-size: 22px; min-height: 1.4em; line-height: 1.4; }
.battle .msg .line.trisk { color: #f3dc8a; } .battle .msg .line.hurt { color: #ff8a80; } .battle .msg .line.go { color: #ffb347; }
.battle .msg .line.g { color: #ff9a8a; } .battle .msg .line.c { color: #f3dc8a; } .battle .msg .line.p { color: #9ac0ff; }
.battle .slot { position: static; transform: none; flex-direction: row; align-items: stretch; gap: 16px; flex: 1; min-height: 0; }
.battle .reels { border: 2px solid #fff; border-radius: 6px; background: #000; padding: 8px; gap: 8px; }
.battle .reel { width: min(11vh, 100px); height: min(11vh, 100px); border-radius: 4px; background: #111; border-color: #555; }
.battle .reel.now { border-color: #fff; box-shadow: none; }
.battle .reel.stopped { border-color: #f3dc8a; }
.battle .cond { flex: 1; width: auto; background: transparent; border: none; padding: 0; }
.battle .cond.in .value { color: var(--ok); }
.battle .cond.go { animation: none; box-shadow: none; }
.battle .cond .target { margin-top: 4px; font-size: 13px; color: var(--dim); }
.battle .cond .wo { margin-top: 6px; font-size: 14px; color: #f3dc8a; }
.battle .msg .buttons { display: flex; gap: 12px; }

/* フィールド */
.walker { position: absolute; bottom: 6%; }
.walker { left: 18%; }
.npc.on { opacity: 1; transform: none; }
.walker img { display: block; filter: drop-shadow(0 4px 3px #0008); }
.talk { border-radius: 8px; border: var(--win); background: var(--panel); }
.talk .who { color: #f3dc8a; }
.talk .text { font-size: 20px; }
.place { font-weight: 400; }

/* 女王の試練 */
.trial .queen { position: absolute; right: 9%; bottom: 6%; }
.trial .queen img { transform: none; }
.trial-panel { border-radius: 8px; }

/* フリーライド */
.ride3d canvas.pixel { image-rendering: pixelated; }
.course-card { border: var(--win); border-radius: 8px; }
.gradebox, .rplate { border-radius: 8px; }
.minimap { border: 2px solid #fff; border-radius: 6px; }
.profile { border-radius: 6px; }

/* まとめ */
.tile, .chart-box, .king { background: #000; border: 2px solid #fff; border-radius: 6px; }

/* 旅の3D の世界：3D の上に、フィールドと戦闘の層を重ねる */
.world3d { position: absolute; inset: 0; }
.world3d canvas { display: block; }
.world3d canvas.pixel { image-rendering: pixelated; }
.layer { position: absolute; inset: 0; z-index: 1; }
.field.on-world { background: transparent; }
.world-place { position: absolute; top: 30%; left: 50%; transform: translateX(-50%); z-index: 2; font-size: 30px; letter-spacing: .1em; text-shadow: 0 2px 10px #000, 0 0 2px #000; opacity: 0; transition: opacity 1.5s; white-space: nowrap; pointer-events: none; }
.world-place.on { opacity: 1; }
.world-place.hide { transition: none; opacity: 0; }
.fnext .skip { margin-top: 8px; width: 100%; }

/* 走行データの表示（アクションカメラの重ね表示のように、遊んでいる間はいつも出す） */
#stage { flex: 1; position: relative; min-height: 0; display: flex; container-type: size; }
#stage > #screen { flex: 1; }
#hud { position: absolute; inset: 0; pointer-events: none; z-index: 20; color: #fff;
  --num: "Arial Black", "Helvetica Neue", "Hiragino Sans", "Yu Gothic UI", sans-serif; }
#hud[hidden] { display: none; }
.hud-col { position: absolute; display: flex; flex-direction: column; gap: 1.2cqh; }
.hud-col.left { left: 2%; top: 16%; }
.hud-col.right { right: 2.5%; top: 31%; align-items: flex-start; }
.hud-item .k { font-size: 3.4cqh; text-shadow: 0 1px 3px #000, 0 0 2px #000; }
.hud-item .v { line-height: 1; white-space: nowrap; }
.hud-item .v b { font: italic 900 7cqh var(--num); letter-spacing: -.01em; text-shadow: 0 3px 6px #000c, 0 0 3px #000; }
.hud-item .v small { font: italic 900 2.8cqh var(--num); margin-left: .5cqh; text-shadow: 0 2px 4px #000; }
.hud-item .note { font-size: 3.4cqh; color: #f3dc8a; text-shadow: 0 1px 3px #000, 0 0 2px #000; margin-top: .4cqh; }
.hud-item[hidden] { display: none; }
.hud-speed { position: absolute; right: 1.5%; bottom: 2%; width: 28cqh; height: 28cqh; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.hud-speed svg { position: absolute; inset: 0; width: 100%; height: 100%; filter: drop-shadow(0 2px 4px #000a); overflow: visible; }
.hud-speed .track { fill: none; stroke: #ffffff40; stroke-width: 8; stroke-linecap: round; }
.hud-speed .fill { fill: none; stroke: #fff; stroke-width: 8; stroke-linecap: round; }
.hud-speed .seg { fill: none; stroke-width: 7; }
.hud-speed .needle { fill: #fff; }
.hud-speed b { font: italic 900 9cqh var(--num); line-height: 1; text-shadow: 0 3px 6px #000c; margin-top: 2cqh; }
.hud-speed small { font: italic 900 2.8cqh var(--num); text-shadow: 0 2px 4px #000; }

/* 走行データの表示と重ならないように */
.battle .msg { left: 15%; right: 21%; }
.talk { width: min(760px, 62%); }
.profile { width: 74%; }

/* 文字の大きさは3段だけ（走行中に読めるように）：大＝メッセージ・場所、中＝窓の中、小＝補い */
#stage { --fs-l: 5.4cqh; --fs-m: 3.4cqh; --fs-s: 2.6cqh; --num: "Arial Black", "Helvetica Neue", "Hiragino Sans", "Yu Gothic UI", sans-serif; }
#screen button { font-size: var(--fs-s); padding: .8cqh 1.6cqh; }
.world-place, .place { font-size: var(--fs-l); font-weight: 400; }
.minimap { width: 15%; }

/* 戦闘：まん中に敵と名前、下に大きなメッセージとドラムだけ */
.foe { bottom: 40%; }
.battle .msg { left: 15%; right: 21%; bottom: 3%; height: auto; padding: 2cqh 3cqh; gap: 2cqh; align-items: flex-start; }
.battle .msg .line { font-size: var(--fs-l); min-height: 1.3em; line-height: 1.3; }
.battle .msg .reels { display: flex; gap: 2cqh; padding: 0; border: none; background: none; }
.battle .msg .reels[hidden] { display: none; }
.battle .reel { position: relative; width: 17cqh; height: 17cqh; border: 3px solid #555; border-radius: 6px; background: #111; display: flex; align-items: center; justify-content: center; }
.battle .reel img { width: 86%; height: 86%; }
.battle .reel.now.ok { border-color: var(--ok); box-shadow: 0 0 2cqh #5fc48a88; }
.battle .reel.now.ng { border-color: var(--ng); box-shadow: 0 0 2cqh #e0524a88; }
.battle .reel .left { position: absolute; right: 4%; bottom: 2%; font: italic 900 var(--fs-m) var(--num, sans-serif); text-shadow: 0 2px 4px #000; }
.battle .msg .buttons button { font-size: var(--fs-m); }

/* フィールド：右上に「つぎの戦闘まで」とボタンだけ。会話は大きく */
.fnext { top: 3%; right: 2%; min-width: 0; padding: 1.4cqh 2cqh; }
.fnext .next { font-size: var(--fs-m); font-weight: 400; margin: 0; white-space: nowrap; }
.fnext .skip { margin-top: 1.2cqh; }
.talk { width: min(1100px, 62%); padding: 2cqh 3cqh; }
.talk .who { font-size: var(--fs-s); margin-bottom: .6cqh; }
.talk .text { font-size: var(--fs-m); line-height: 1.5; min-height: 3em; }
.talk .effect { font-size: var(--fs-s); font-weight: 400; }
.talk .hint { display: none; }
.idle { font-size: var(--fs-m); }

/* 女王の試練：上に目標パワー、左に女王、下にせりふ */
.trial-panel { top: 4%; left: 50%; width: auto; min-width: 36%; padding: 2cqh 4cqh; gap: 1cqh; }
.trial-panel .phase { font-size: var(--fs-m); }
.trial-panel .target b { font: italic 900 12cqh var(--num, sans-serif); }
.trial-panel .target small { font-size: var(--fs-m); }
.trial-panel .info { font-size: var(--fs-s); }
.trial .queen { left: 18%; right: auto; bottom: 30%; }
.trial .talk .buttons button { font-size: var(--fs-s); }

/* フリーライド */
.rplate { padding: 1.4cqh 2cqh; }
.rplate .name { font-size: var(--fs-m); }
.rplate .sub { font-size: var(--fs-s); }

/* 戦闘（2026-10-19 ユーザー要望）：主人公は隠れて敵に寄る。敵を大きく、メッセージの窓はなくし、下いっぱいをスロットのドラムに */
.foe { bottom: 44%; }
.foe img { max-height: 52cqh; }
.battle .say { position: absolute; left: 15%; right: 21%; bottom: 35%; text-align: center; font-size: var(--fs-l); line-height: 1.3; min-height: 1.3em;
  text-shadow: 0 0 .4cqh #000, 0 0 .4cqh #000, 0 .4cqh 1cqh #000; }
.battle .say.go { color: #ffd166; } .battle .say.crit { color: #f3dc8a; } .battle .say.hurt { color: #ff8a80; }
.battle .slots { position: absolute; left: 15%; right: 21%; bottom: 3%; height: 30cqh; display: flex; gap: 2cqh; }
.battle .slots[hidden] { display: none; }
.battle .slots .reel { position: relative; flex: 1; height: 100%; width: auto; overflow: hidden; border: .6cqh solid #666; border-radius: 1.2cqh;
  background: linear-gradient(#000 0%, #1b1726 22%, #1b1726 78%, #000 100%); display: block; }
.battle .slots .reel.now.ok { border-color: var(--ok); box-shadow: 0 0 3cqh #5fc48aaa; }
.battle .slots .reel.now.ng { border-color: var(--ng); box-shadow: 0 0 3cqh #e0524aaa; }
.battle .slots .reel.stopped { border-color: #f3dc8a; }
.battle .slots .left { position: absolute; right: 4%; bottom: 3%; font: italic 900 var(--fs-m) var(--num, sans-serif); text-shadow: 0 2px 4px #000; }
.battle > .buttons { position: absolute; left: 50%; bottom: 10%; transform: translateX(-50%); display: flex; gap: 2cqh; }
.battle > .buttons button { font-size: var(--fs-m); }

/* 会話：話す人は、会話の窓の左上からこちらを向いて話す */
.talk .talk-face { position: absolute; left: 2cqh; bottom: 100%; margin-bottom: -1.2cqh; filter: drop-shadow(0 .4cqh .6cqh #000a); }
.talk .talk-face[hidden] { display: none; }

/* 旅の右上：島の現在地。フィールドの「つぎの戦闘まで」はまん中の上に */
.world-map { top: 3%; right: 2%; width: 15%; z-index: 2; }
.field.on-world .fnext { right: auto; left: 50%; transform: translateX(-50%); }

/* 逃げていく敵と、ミッション */
.foe.flee { transform: translateX(-50%) translateY(-8cqh) scale(.4); opacity: 0; transition: transform 1.6s, opacity 1.6s; }
.fnext .mission { margin-top: 1cqh; font-size: var(--fs-m); padding: .6cqh 1.2cqh; border-radius: .8cqh; white-space: nowrap; }
.fnext .mission.ok { background: #1e5a36; } .fnext .mission.ng { background: #6a1e1e; }
.fnext .mission[hidden] { display: none; }
/* ミッションの今の目標の回転数は、まん中に大きく（左右の列と速度メーターに重ならない幅で） */
.mcall { position: absolute; left: 15%; right: 21%; bottom: 30%; text-align: center; font-size: var(--fs-l); line-height: 1.3;
  text-shadow: 0 0 .4cqh #000, 0 0 .4cqh #000, 0 .4cqh 1cqh #000; }
.mcall.ok { color: #9be7b4; } .mcall.ng { color: #ff9a8a; } .mcall[hidden] { display: none; }
.place.ok { color: #9be7b4; } .place.ng { color: #ff9a8a; }
.field.on-world .place { top: 30%; font-size: var(--fs-l); }

/* フリーライドの名札は上のまん中に（左は走行データ） */
.rplate { left: 50%; transform: translateX(-50%); width: auto; min-width: 30%; }

/* コースを選ぶ画面はスクロールさせない（2026-10-21 ユーザー要望）：カードは「1 2 3」のページに分け、残りの高さに収める */
.select.courses { justify-content: flex-start; overflow: hidden; padding: 1.6cqh 16px; gap: 1.2cqh; }
.select.courses > * { flex: none; }
.select.courses h2 { font-size: var(--fs-m); }
.course-card { padding: 1cqh 1.2cqh; gap: .6cqh; min-height: 0; overflow: hidden; }
.course-card .stat.dim { display: none; }

/* 星（2026-10-20）：回せたドラムに星、フィールドの窓に集めた星の数 */
.battle .slots .reel .star { position: absolute; left: 4%; top: 2%; font-style: normal; font-size: var(--fs-m); color: #e4e9f0; text-shadow: 0 0 1cqh #000, 0 0 2cqh #ffffff66; opacity: 0; transform: scale(.3); transition: opacity .3s, transform .4s cubic-bezier(.3, 1.8, .5, 1); }
.battle .slots .reel.got .star { opacity: 1; transform: scale(1); }
.fnext .stars { font-size: var(--fs-m); color: #ffd84a; margin-top: .4cqh; }
/* 敵が震える：回せたドラムで小さく、ダメージで大きく（点滅もする） */
.foe.hit-s img { animation: foe-shake .4s linear; }
.foe.hit img { animation: foe-shake .7s linear, blink .7s steps(2); }
@keyframes foe-shake { 0%, 100% { transform: translateX(0); } 10% { transform: translateX(-4%); } 25% { transform: translateX(4%); } 40% { transform: translateX(-3%); } 55% { transform: translateX(3%); } 70% { transform: translateX(-1.5%); } 85% { transform: translateX(1.5%); } }
/* 敵はいつも息をするように、少し上下する */
.foe img { animation: foe-idle 1.6s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes foe-idle { 50% { transform: translateY(-1.2%) scaleY(1.015); } }

/* フリーライドの ERG の強さ（◀ ▶ で変える）。高低図の上のまん中 */
.ergbox { position: absolute; left: 50%; bottom: 16%; transform: translateX(-50%); display: flex; align-items: center; gap: 2cqh; padding: .6cqh 2cqh; }   /* 分かれ道の矢印（.turn、bottom 27%）に重ならないよう、1行にして低くした */
.ergbox[hidden] { display: none; }
.ergbox .erg-v { display: flex; flex-direction: row; align-items: baseline; justify-content: center; gap: 1.6cqh; min-width: 30cqh; }
.ergbox .erg-v b { font-size: var(--fs-l); font-weight: 400; line-height: 1.1; }
.ergbox .erg-v small { font-size: var(--fs-s); color: #f3dc8a; }
#screen .ergbox button { font-size: var(--fs-m); padding: .7cqh 2cqh; }

/* 与えたダメージの数字：敵の上に落ちてきて、2回弾んで消える */
.dmg-bounce { position: absolute; z-index: 5; transform: translate(-50%, -100%); font: italic 900 12cqh var(--num, sans-serif); color: #fff; -webkit-text-stroke: .5cqh #000; paint-order: stroke fill; text-shadow: 0 1cqh 1.5cqh #000a; pointer-events: none; animation: dmg-bounce 1.8s forwards; }
.dmg-bounce.crit { color: #f3dc8a; }
@keyframes dmg-bounce {
  0%   { transform: translate(-50%, -260%) scale(.6); opacity: 0; animation-timing-function: ease-in; }
  20%  { transform: translate(-50%, -100%) scale(1.15, .85); opacity: 1; animation-timing-function: ease-out; }
  35%  { transform: translate(-50%, -160%) scale(1); animation-timing-function: ease-in; }
  50%  { transform: translate(-50%, -100%) scale(1.08, .92); animation-timing-function: ease-out; }
  60%  { transform: translate(-50%, -125%) scale(1); animation-timing-function: ease-in; }
  70%  { transform: translate(-50%, -100%) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -100%); opacity: 0; }
}

/* ドラムは合致率の数字（2026-10-20）：十の位はその時点の値、一の位は回り続ける。判定の前は「--」、会心は紋章が回る */
.battle .slots .reel .num { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font: italic 900 19cqh var(--num, sans-serif); line-height: 1; text-shadow: 0 .6cqh 1cqh #000; }
.battle .slots .reel .num small { font-size: 6cqh; align-self: flex-end; margin: 0 0 6cqh .6cqh; }
.battle .slots .reel .d1 { position: relative; display: inline-block; width: .82em; margin: 0 -.06em; height: 1em; overflow: hidden; text-align: center;   /* 斜体の傾きの分、幅を広げて（並びは変えない）右が欠けないように。上下は battle-view.js が数字の高さで切る */
  -webkit-mask-image: linear-gradient(transparent, #000 25%, #000 75%, transparent); mask-image: linear-gradient(transparent, #000 25%, #000 75%, transparent); }
.battle .slots .reel .d1 .strip { position: absolute; left: 0; right: 0; top: 0; display: flex; flex-direction: column; will-change: transform; }
.battle .slots .reel .d1 .strip span { display: block; height: 1em; }
.battle .slots .reel .d1 .dash { display: none; }
.battle .slots .reel.waiting .d1 .strip { display: none; }
.battle .slots .reel.waiting .d1 .dash { display: block; }
.battle .slots .reel.waiting .num { color: #ffffff99; }
.battle .slots .reel.stopped .d1 { -webkit-mask-image: none; mask-image: none; }
.battle .slots .reel .attr { position: absolute; right: 4%; top: 4%; width: 7cqh; height: 7cqh; opacity: .85; }
.battle .slots .reel .crit { position: absolute; left: 50%; top: 50%; width: 22cqh; height: 22cqh; margin: -11cqh 0 0 -11cqh; display: none; }
.battle .slots .reel.is-crit .num { display: none; }
.battle .slots .reel.is-crit .crit { display: block; animation: crit-spin 1.2s linear infinite; filter: drop-shadow(0 0 2cqh #f3dc8a); }
@keyframes crit-spin { from { transform: rotateY(0); } to { transform: rotateY(360deg); } }
.battle .slots .reel.land .num { animation: reel-land .3s ease-out; }
@keyframes reel-land { 0% { transform: translateY(-8%); } 60% { transform: translateY(4%); } 100% { transform: none; } }
.battle .slots .reel.got.gold .star { color: #ffd84a; text-shadow: 0 0 1cqh #000, 0 0 2cqh #ffd84a88; }

/* 敵は1体か、小さな雑魚3体（2026-10-20）。ウェーブが変わると、次の敵が出てくる */
.battle .foes { position: absolute; left: 15%; right: 21%; bottom: 44%; display: flex; justify-content: center; align-items: flex-end; gap: 6cqh; pointer-events: none; }
.battle .foes .foe { position: relative; left: auto; bottom: auto; transform: none; }
.battle .foes .foe.lunge { transform: scale(1.08); }
.battle .foes .foe.flee { transform: translateY(-8cqh) scale(.4); }
.battle .foes.trio .foe img { max-height: 26cqh; }
.battle .foes .foe.enter { animation: foe-enter .5s ease-out; }
@keyframes foe-enter { from { opacity: 0; transform: translateY(-4cqh); } to { opacity: 1; transform: none; } }
.hero-card .plan { font-size: var(--fs-s); color: #f3dc8a; }

/* 旅の途中で FTP を変える窓（左上。走行データの左の列の上） */
.ftpbox { position: absolute; left: 2%; top: 3%; z-index: 21; display: flex; align-items: center; gap: 1.4cqh; padding: .8cqh 1.4cqh; }
.ftpbox[hidden] { display: none; }
.ftpbox .ftp-v { display: flex; align-items: baseline; gap: 1cqh; min-width: 16cqh; justify-content: center; }
.ftpbox .ftp-v small { font-size: var(--fs-s); color: #f3dc8a; }
.ftpbox .ftp-v b { font-size: var(--fs-m); font-weight: 400; }
#stage .ftpbox button { font-size: var(--fs-s); padding: .6cqh 1.4cqh; }

/* 合致率が90%以上のときの一の位：その時点の値が、その場でくるくる回る */
.battle .slots .reel.locked .d1 .strip { animation: digit-spin .8s linear infinite; }
@keyframes digit-spin { from { transform: var(--d1-pos, none) rotateY(0); } to { transform: var(--d1-pos, none) rotateY(360deg); } }

/* 試練の間は、地名を試練の窓の下に出す */
#screen:has(.trial.on-world) .world-place { top: 42%; }

/* コースを選ぶ画面：左に島の地図、右に「1 2 3」のページとコースのカード（3×2）。残りの高さいっぱいに */
.select.courses > .course-body { flex: 1 1 0; min-height: 0; display: flex; gap: 16px; align-items: stretch; width: min(1240px, 100%); }
.course-body .course-map { flex: none; height: 100%; max-width: 50%; aspect-ratio: 1377 / 1142; object-fit: contain; padding: 0; background: #1b3f9a; align-self: flex-start; }
.course-side { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 1cqh; }
.course-pages { flex: none; align-self: center; }
.course-pages[hidden] { display: none; }
.course-side .course-cards { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); gap: 1.2cqh; }
.course-side .course-card { width: auto; }
.course-card .name { font-size: var(--fs-m); font-weight: 400; flex: none; }
.course-card canvas { flex: 1 1 0; min-height: 0; height: auto; }
.course-card .how, .course-card .stat { font-size: var(--fs-s); flex: 0 1 auto; min-height: 0; overflow: hidden; line-height: 1.3; }
.course-card .how { flex: 0 1 auto; min-height: 0; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.course-card .name { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
#screen .course-card .go-btn { flex: none; align-self: center; font-size: var(--fs-s); padding: .5cqh 1.4cqh; background: #14121c; color: #fff; border: .4cqh solid #fff; }
#screen .course-card .go-btn:hover, #screen .course-card .go-btn:focus-visible { color: #ffd84a; border-color: #ffd84a; }
.minutes .sep { margin-left: 1.6cqh; }
.course-foot { display: flex; align-items: center; gap: 12px; width: min(1240px, 100%); }
/* 選んだカード：名前・数字・スタートを優先。説明は1行で「…」、入りきらなければ隠す（app.js の fitSel） */
.course-card.on .stat { flex: none; }
.course-card.on .how { flex: none; display: block; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.course-card.on.tight .how { display: none; }
.course-card.on.tight2 .stat { white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.course-foot .hint { flex: 1; min-width: 0; font-size: var(--fs-s); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero-card .lv { font-size: var(--fs-s); color: var(--dim, #bbb); }

/* 装備のコレクション */
.select.collection { justify-content: flex-start; overflow-y: auto; padding-top: 2cqh; gap: 1.4cqh; }
.col-hero { width: min(1100px, 94%); padding: 1.2cqh 2cqh; }
.col-name { font-size: var(--fs-m); margin-bottom: 1cqh; }
.col-items { display: grid; grid-template-columns: repeat(6, 1fr); gap: 1.2cqh; }
.col-item { display: flex; flex-direction: column; align-items: center; gap: .6cqh; text-align: center; }
.col-pic { width: 11cqh; height: 11cqh; border: .4cqh solid #f3dc8a; border-radius: .8cqh; background: #111; display: flex; align-items: center; justify-content: center; font-size: var(--fs-l); color: #f3dc8a; }
.col-pic img { width: 100%; height: 100%; object-fit: contain; }
.col-n { font-size: var(--fs-s); }
.col-d { font-size: var(--fs-s); color: #bbb; line-height: 1.4; }
.col-item.locked .col-pic { border-color: #555; color: #555; }
.col-item.locked .col-n { color: #777; }

/* 分かれ道の矢印：手前で左右に出す。何もしないで曲がる向きを点灯、反対側を点滅 */
.turn { position: absolute; left: 50%; bottom: 27%; transform: translateX(-50%); z-index: 3; display: flex; gap: 14cqh; pointer-events: none; }
.turn[hidden] { display: none; }
.turn-side { display: flex; flex-direction: column; align-items: center; min-width: 24cqh; padding: 1cqh 2cqh; opacity: .45; }
.turn-side b { font-size: var(--fs-l); font-weight: 400; line-height: 1.1; }
.turn-side small { font-size: var(--fs-s); color: var(--dim, #ccc); }
.turn-side.lit { opacity: 1; color: #ffd84a; }
.turn-side.lit small { color: #fff; }
.turn-side.blink { animation: turn-blink 1s steps(2, end) infinite; }
@keyframes turn-blink { 0% { opacity: .95; } 50% { opacity: .15; } }

/* コースを選ぶ：カードを選び、右回り／左回りで走り出す */
.course-card { cursor: pointer; }
/* 選んだコース：窓を金地・黒文字に反転し、ふちを太く、名前の頭に ▶。ほかのコースは暗く（2026-10-21 ユーザー要望） */
.course-card:not(.on) { filter: brightness(0.55); }
.course-card:not(.on):hover { filter: brightness(0.8); }
.course-card.on { background: var(--c); color: #14121c; border: 4px solid #fff; box-shadow: 0 0 0 3px #000, 0 0 16px var(--c); }
.course-card.on .name::before { content: '▶ '; }
.course-card.on .how, .course-card.on .stat { color: #14121c; }
.course-card.on canvas { background: #14121c; }
.course-start { justify-content: center; }

.modal input[type=text] { background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; min-width: 0; }

/* 設定：出典・クレジット（小さい文字）。設定が長くても「閉じる」は窓の下に見えたまま */
.modal .credits { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 2px; font-size: 12px; }
#settings-close { position: sticky; bottom: 0; box-shadow: 0 12px 0 12px var(--panel), 0 -6px 10px 4px var(--panel); }

/* レース（docs/impl-race.md）：スタート前の数えと、順位の窓。文字の大きさは 3 段のまま（数えは大を拡大して見せる） */
.ride .countdown { position: absolute; left: 50%; top: 30%; transform: translate(-50%, -50%); font-size: var(--fs-l); color: #fff; text-shadow: 0 .4cqh 0 #000, 0 0 2cqh #000; pointer-events: none; }
.ride .countdown[hidden] { display: none; }
.ride .countdown.pop { animation: cd-pop .9s ease-out both; }
@keyframes cd-pop { from { transform: translate(-50%, -50%) scale(3); opacity: 0; } 25% { opacity: 1; } to { transform: translate(-50%, -50%) scale(2.2); opacity: 1; } }
.rplate .r-rank { font-size: var(--fs-l); color: #f3dc8a; line-height: 1.2; }
.race-info { text-align: center; line-height: 1.7; font-size: var(--fs-m); }
.race-info b { color: #f3dc8a; font-weight: 400; }
.race-list { display: grid; grid-template-columns: auto 1fr auto; gap: .2cqh 2cqh; font-size: var(--fs-s); max-width: 60%; margin: 0 auto; text-align: left; }
.race-list .me { color: #f3dc8a; }

/* まとめのゾーン別の時間：6段が窓に収まるよう、名前と W を1行にし、残りの高さに並べる（窓の外へはみ出して下の行と重なっていた。2026-10-21） */
.zones-box { overflow: hidden; }
.zones-box .zones { flex: 1; min-height: 0; justify-content: space-around; gap: 2px; margin-top: 4px; }
.zones-box .zrow { grid-template-columns: 150px 1fr; }
.zones-box .zname { flex-direction: row; align-items: baseline; gap: 6px; white-space: nowrap; }
.zones-box .zbar i { height: 14px; }
/* まとめが窓に入りきらないとき（960×600 など）、行が縮んで重ならないよう、縮めずに下へスクロールさせる */
.report > * { flex-shrink: 0; }
.report > .charts { flex: 1 0 auto; }

/* 上の帯：ロゴの文字・数字・ボタンは折り返さず縮めない。狭いときは、曲名から先に「…」で縮め、次に接続の表示を縮める（2026-10-21） */
#bar h1, #bar .mini { flex: none; white-space: nowrap; }
#bar #conn { flex: 0 1 auto; }
#bar #now-playing { flex: 0 100 auto; }
@media (max-width: 1180px) {
  #bar { gap: 8px; padding: 6px 10px; }
  #bar h1 { font-size: 16px; margin-right: 2px; }
  .mini b { font-size: 18px; }
  #bar button { padding: 5px 8px; font-size: 13px; }
}

/* タッチの画面（ブラウザ版。docs/impl-web.md）：分かれ道の矢印は押せる（押すとその向き）。指で押すボタンは 44px 以上 */
.turn .turn-side { pointer-events: auto; cursor: pointer; }
.trial-panel .giveup { margin-top: 4px; }
.trial-panel .giveup[hidden] { display: none; }
#b-pause[hidden] { display: none; }
@media (pointer: coarse) {
  #screen button, #bar button, .modal button { min-height: 44px; min-width: 44px; }
}


/* 横から見る戦闘（2026-10-22 ユーザー判断。battle-view.js）：ドラムの上で、左に右向きの主人公、右に左向きの敵。
   --push（battle-view.js が入れる）だけ、両方が押し合う向きに動く。戦闘中は場所の名前も看板も出さない（今のまま） */
.battle.side .arena { position: absolute; left: 15%; right: 21%; bottom: 41%; height: 52cqh; pointer-events: none; --push: 0cqh; }
.battle.side .arena .hero-side { position: absolute; right: 51%; bottom: 0; transform: translateX(var(--push)); z-index: 2; }
.battle.side .arena .hero-side img { display: block; filter: drop-shadow(0 6px 4px #0008); transform-origin: 50% 100%; animation: foe-idle 1.4s ease-in-out infinite; }
.battle.side .arena .foes { position: absolute; left: 49%; right: 0; bottom: 0; top: auto; display: flex; justify-content: flex-start; align-items: flex-end; gap: 1.5cqh; transform: translateX(var(--push)); }
.battle.side .arena .foes .foe { position: relative; left: auto; bottom: auto; transform: none; transition: transform .25s, opacity .8s; }
.battle.side .arena .foes .foe img { max-height: 52cqh; }
.battle.side .arena .foes.trio .foe:not(.front) { transform: translateX(2cqh) scale(.92); opacity: .9; }
.battle.side .arena .foes.trio .foe.front { transform: translateX(-1cqh); z-index: 1; }
/* つばぜり合いの火花：合っていれば金、外れていれば灰。まん中（押し合う所）でまたたく */
.battle.side .arena .spark { position: absolute; left: 48%; bottom: 40%; transform: translate(-50%, 0) translateX(var(--push)); font-size: var(--fs-l); color: #bbb; text-shadow: 0 0 1.5cqh #fff; opacity: 0; z-index: 3; }
.battle.side .arena.clash .spark { animation: spark .25s steps(2) infinite; }
.battle.side .arena.clash.ok .spark { color: #ffd84a; text-shadow: 0 0 2cqh #ffd84a; }
@keyframes spark { 0% { opacity: 1; transform: translate(-50%, 0) translateX(var(--push)) scale(1); } 50% { opacity: .3; transform: translate(-50%, -1cqh) translateX(var(--push)) scale(.7); } }
/* 必殺技：踏み込んで戻る。画面が白く（会心は金に）閃く */
.battle.side .arena .hero-side.strike img { animation: hero-strike .65s ease-out; }
@keyframes hero-strike { 0% { transform: none; } 25% { transform: translateX(14cqh) scaleX(1.08); } 55% { transform: translateX(14cqh); } 100% { transform: none; } }
.battle .flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.battle .flash.on { animation: flash .4s ease-out; }
.battle .flash.gold { background: #f3dc8a; animation: flash .4s ease-out; }
@keyframes flash { 0% { opacity: .55; } 100% { opacity: 0; } }
/* 反撃：敵が飛びかかり、主人公がよろけて赤く点滅する。受けた数字は赤 */
.battle.side .arena .foes .foe.counter img { animation: foe-counter .55s ease-in-out; }
@keyframes foe-counter { 0%, 100% { transform: none; } 40% { transform: translateX(-12cqh) scale(1.05); } }
.battle.side .arena .hero-side.stagger img { animation: hero-stagger .7s ease-out, blink .7s steps(4); filter: sepia(1) saturate(5) hue-rotate(-30deg) drop-shadow(0 6px 4px #0008); }
@keyframes hero-stagger { 0% { transform: none; } 30% { transform: translateX(-5cqh) rotate(-10deg); } 100% { transform: none; } }
.dmg-bounce.hurt { color: #ff8a80; }
/* 倒せなかった敵：最後に飛びかかってから、右へ逃げていく */
.battle.side .arena .foes .foe.lunge { transform: translateX(-8cqh) scale(1.05); }
.battle.side .arena .foes .foe.flee { transform: translateX(40cqh) scale(.8); opacity: 0; transition: transform 1.6s, opacity 1.6s; }
.battle.side .arena .foes .foe.gone { opacity: 0; }

/* 戦闘中に分かれ道が来たとき：矢印は小さくして、ミニマップの左の上の端へ寄せる（「○○ RPM で まわせ！」・ドラム・主人公と敵に重ならないように）。フィールドとフリーライドは今の大きさのまま */
#screen:has(.battle) .turn { left: auto; right: 18.5%; top: 3%; bottom: auto; transform: none; gap: 1.6cqh; }
#screen:has(.battle) .turn-side { min-width: 0; padding: .5cqh 1.4cqh; flex-direction: row; gap: 1.2cqh; align-items: center; }
#screen:has(.battle) .turn-side b { font-size: var(--fs-m); }
#screen:has(.battle) .turn-side small { font-size: var(--fs-s); white-space: nowrap; }
