:root {
  --bg: #02030a;
  --text: #eef0ff;
  --muted: #8f96c8;
  --cyan: #4fe3ff;
  --pink: #ff4f8b;
  --gold: #ffd84a;
  --panel: rgba(8, 12, 32, 0.78);
  --line: rgba(79, 227, 255, 0.35);
  --pad-h: 0px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --display: "Orbitron", system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--bg); color: var(--text);
  font-family: system-ui, "Hiragino Sans", "Yu Gothic UI", sans-serif;
  touch-action: none; user-select: none; -webkit-user-select: none;
}
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; padding: 0; }
[hidden] { display: none !important; }

/* 3D表示。スマホのプレイ中は十字ボタンの分だけ上に詰める */
#stage { position: fixed; left: 0; top: 0; width: 100%; height: calc(100% - var(--pad-h)); display: block; }
body[data-device="touch"][data-screen="play"],
body[data-device="touch"][data-screen="pause"] { --pad-h: min(22vh, 170px); }

.screen { position: fixed; left: 0; right: 0; top: 0; bottom: var(--pad-h); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px; }
.screen.dim { background: rgba(2, 3, 10, 0.6); backdrop-filter: blur(4px); }

/* 操作の案内は、最後に使った機器のものだけ出す */
.kbd-only, .pad-only, .touch-only { display: none; }
body[data-device="key"] .kbd-only,
body[data-device="pad"] .pad-only,
body[data-device="touch"] .touch-only,
body[data-device="mouse"] .mouse-only { display: inline; }
.mouse-only { display: none; }
/* タッチ・マウスのときだけ出す 1回で効く ボタン */
.ptr-only { display: none; }
body[data-device="touch"] .ptr-only, body[data-device="mouse"] .ptr-only { display: block; }

/* ---- タイトル ---- */
.logo {
  font-family: var(--display); font-weight: 800; font-size: clamp(26px, 12vw, 110px); letter-spacing: 0.02em; white-space: nowrap; line-height: 1;
  color: #fff; text-shadow: 0 0 18px var(--cyan), 0 0 42px rgba(79, 227, 255, 0.6);
}
.logo span { color: var(--pink); text-shadow: 0 0 18px var(--pink), 0 0 42px rgba(255, 79, 139, 0.6); }
.press { margin-top: 12vh; font-family: var(--display); font-size: clamp(18px, 5vw, 28px); letter-spacing: 0.3em; color: var(--gold); text-shadow: 0 0 12px rgba(255, 216, 74, 0.7); }
.blink { animation: blink 1.2s ease-in-out infinite; }
/* キー・パッドのとき、タイトルで えらんでいないものは 暗く、えらんでいるものだけ 光らせる（タッチ・マウスでは 暗くしない） */
:is(body[data-device="key"], body[data-device="pad"]) #pressStart:not(.focus) { animation: none; opacity: 0.35; text-shadow: none; }
/* せってい と だくまたゲームス: 押せると分かる 細いネオンの枠。押すと 沈む */
.title-opt, #title .site-back {
  display: block; margin-top: 14px; padding: 7px 20px; border-radius: 999px; text-decoration: none;
  border: 1px solid var(--line); background: rgba(8, 12, 32, 0.7); color: var(--muted);
  box-shadow: 0 3px 0 rgba(79, 227, 255, 0.18), inset 0 0 10px rgba(79, 227, 255, 0.08);
  transition: transform 0.08s, box-shadow 0.08s, color 0.1s, border-color 0.1s;
}
.title-opt { margin-top: 22px; font-size: 15px; letter-spacing: 0.3em; color: var(--text); }
#title .site-back { font-size: 12px; letter-spacing: 0.06em; }
.title-opt:active, #title .site-back:active { transform: translateY(3px); box-shadow: 0 0 0 rgba(79, 227, 255, 0.18), inset 0 0 10px rgba(79, 227, 255, 0.08); }
body[data-device="mouse"] .title-opt:hover, body[data-device="mouse"] #title .site-back:hover { color: #fff; border-color: var(--cyan); }
.title-opt.focus, #title .site-back.focus { color: #fff; border-color: var(--cyan); text-shadow: 0 0 10px rgba(79, 227, 255, 0.8); box-shadow: 0 3px 0 rgba(79, 227, 255, 0.35), 0 0 16px rgba(79, 227, 255, 0.45); }
.title-opt.focus::before, #title .site-back.focus::before { content: "▶ "; color: var(--pink); }
/* 光の点滅を控えめに: タイトルの PRESS START を 明滅させない */
body.calm .blink { animation: none; }
@keyframes blink { 50% { opacity: 0.25; } }
.how { margin-top: 10px; font-size: 13px; color: var(--muted); }
#title { cursor: pointer; }

/* ---- 共通のメニュー ---- */
.menu { list-style: none; margin: 0; padding: 0; width: 100%; display: flex; flex-direction: column; gap: 8px; }
.item {
  display: flex; align-items: center; gap: 6px; min-height: 52px; padding: 0 10px;
  background: var(--panel); border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 10px;
  transition: transform 0.08s, border-color 0.08s, background 0.08s;
}
.item .k { flex: 0 0 34%; color: var(--muted); font-size: 14px; }
.item .k.wide { flex: 1; text-align: center; color: var(--text); font-size: 17px; font-weight: 700; letter-spacing: 0.08em; }
.item .v { flex: 1; text-align: center; font-weight: 700; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .arrow { width: 44px; height: 44px; border-radius: 8px; color: var(--cyan); font-size: 16px; }
.item .arrow:active { background: rgba(79, 227, 255, 0.2); }
.item.action { cursor: pointer; justify-content: center; }
.item.primary .k.wide { font-family: var(--display); color: var(--gold); letter-spacing: 0.25em; font-size: 20px; }
.item.focus {
  border-color: var(--cyan); background: rgba(20, 50, 90, 0.85);
  box-shadow: 0 0 0 1px var(--cyan), 0 0 18px rgba(79, 227, 255, 0.35); transform: scale(1.02);
}
.item.focus .k { color: #fff; }
body[data-device="mouse"] .item.action:hover { border-color: var(--line); background: rgba(20, 50, 90, 0.6); }

/* ---- 曲選び（スクロールしない。上：筒の枠／下：選択肢） ---- */
#select {
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto; grid-template-columns: 100%;
  align-items: stretch; justify-content: stretch; gap: 0; padding: 0;
  padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom);
}
.sel-head { text-align: center; padding: 10px 56px 0; }
#selBack { position: absolute; left: 10px; top: 10px; z-index: 2; color: var(--cyan); }
.bar-title { font-family: var(--display); font-size: clamp(14px, 2.6vh, 20px); letter-spacing: 0.2em; color: var(--cyan); text-shadow: 0 0 10px rgba(79, 227, 255, 0.6); }
.song-no { margin-top: 2px; font-family: var(--display); font-size: clamp(11px, 1.7vh, 14px); letter-spacing: 0.12em; color: var(--muted); font-variant-numeric: tabular-nums; }
.song-stars { margin-top: 2px; font-size: clamp(12px, 1.9vh, 16px); letter-spacing: 0.06em; color: #ffd84a; text-shadow: 0 2px 8px #000; white-space: nowrap; }
.song-stars b { font-weight: 600; color: var(--muted); }
.song-name { margin-top: 4px; font-size: clamp(16px, 3vh, 24px); font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-shadow: 0 2px 8px #000; }
.sel-stage { position: relative; min-height: 0; }
/* 曲名・★・操作の案内は枠の外に置かず、枠の中に重ねる（本人指示・2026-09-21「枠内に入れてほしい」） */
:is(body[data-device="key"], body[data-device="pad"]) #select:not(.open) .sel-stage { grid-row: 1 / -1; }
:is(body[data-device="key"], body[data-device="pad"]) #select:not(.open) .sel-head { position: absolute; left: 0; right: 0; top: 0; }
:is(body[data-device="key"], body[data-device="pad"]) #select:not(.open) .sel-hint { position: absolute; left: 0; right: 0; bottom: 0; }
/* スマホ縦持ちは筒が上下にはみ出すので、文字の後ろを暗くして読めるようにする */
.sel-head { position: relative; z-index: 1; padding-bottom: 8px; background: linear-gradient(180deg, rgba(5, 6, 13, 0.92) 70%, rgba(5, 6, 13, 0)); }
@media (orientation: portrait) {
  .sel-panel { position: relative; z-index: 1; padding-top: 14px; background: linear-gradient(0deg, rgba(5, 6, 13, 0.94) 88%, rgba(5, 6, 13, 0)); width: 100%; }
}
body[data-device="touch"] .sel-touch-hint.touch-only, body[data-device="mouse"] .sel-touch-hint.mouse-only { display: block; margin-top: 2px; font-size: clamp(11px, 1.6vh, 13px); color: var(--muted); }
.sel-stage.focus { box-shadow: inset 0 0 0 2px rgba(79, 227, 255, 0.5); border-radius: 12px; }
.nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 1;
  width: clamp(40px, 7vh, 56px); height: clamp(56px, 11vh, 84px); border-radius: 12px;
  font-size: 20px; color: var(--cyan); background: rgba(8, 12, 32, 0.7); border: 1px solid var(--line);
}
.nav:active { background: rgba(79, 227, 255, 0.3); }
/* 左右ボタンは、下の選択ボタン群（幅560px・内側12px）の端と同じ縦の線にそろえる */
.nav.prev { left: max(8px, calc((100% - 560px) / 2 + 12px)); } .nav.next { right: max(8px, calc((100% - 560px) / 2 + 12px)); }

.sel-panel {
  width: min(560px, 100%); justify-self: center; padding: 6px 12px 10px;
  display: flex; flex-direction: column; gap: clamp(4px, 0.9vh, 8px);
}
.row { display: flex; align-items: center; gap: 8px; padding: 3px 6px; border-radius: 12px; border: 1px solid transparent; }
.row.focus { border-color: var(--cyan); background: rgba(20, 50, 90, 0.5); box-shadow: 0 0 14px rgba(79, 227, 255, 0.25); }
.row .k { flex: 0 0 5.2em; font-size: clamp(11px, 1.7vh, 14px); color: var(--muted); }
.chips { flex: 1; display: flex; gap: 6px; align-items: center; min-width: 0; }
.chip {
  flex: 1; min-width: 0; height: clamp(34px, 5.6vh, 48px); border-radius: 10px;
  background: var(--panel); border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: clamp(12px, 1.9vh, 16px); font-weight: 700; white-space: nowrap; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1;
}
.chip small { font-size: 0.68em; font-weight: 400; color: var(--muted); }
.chip.on { background: linear-gradient(180deg, rgba(79, 227, 255, 0.35), rgba(20, 60, 120, 0.9)); border-color: var(--cyan); color: #fff; box-shadow: 0 0 10px rgba(79, 227, 255, 0.4); }
.chip.on small { color: #d8f6ff; }
.chip-value { flex: 1.2; text-align: center; font-weight: 700; font-size: clamp(13px, 2vh, 17px); font-variant-numeric: tabular-nums; }
.add-row .chip.add { flex: 0 0 auto; padding: 0 14px; }
.add-note { flex: 1; min-width: 0; margin: 0; font-size: clamp(10px, 1.5vh, 12px); line-height: 1.35; color: var(--muted); }
/* キー・パッドで選んでいるボタン（割り当ての行など） */
.chip.sel { outline: 3px solid #fff; outline-offset: 2px; background: rgba(79, 227, 255, 0.28); box-shadow: 0 0 14px rgba(255, 255, 255, 0.45); }
.row-help { margin: 2px 0 0; text-align: center; font-size: clamp(11px, 1.7vh, 14px); color: #cfe9ff; }
.row-help b { display: inline-block; padding: 0 6px; margin: 0 2px; border-radius: 5px; border: 1px solid var(--line); background: var(--panel); color: #fff; }
.row-help.wait { color: var(--gold); }
body[data-device="touch"] .row-help, body[data-device="mouse"] .row-help { display: none; }
.note { margin: 0; min-height: 1.2em; text-align: center; font-size: 12px; color: var(--muted); }

/* キー・パッドでは、設定（選択肢）は X で開いたときだけ出す。スマホは常に全部出す */
.sel-hint { display: none; grid-column: 1 / -1; text-align: center; padding: 10px 12px 18px; font-size: clamp(13px, 2.2vh, 17px); color: var(--muted); letter-spacing: 0.06em; }
.sel-hint b { display: inline-block; min-width: 1.8em; padding: 2px 8px; margin: 0 4px; border-radius: 6px; border: 1px solid var(--line); color: #fff; background: var(--panel); }
:is(body[data-device="key"], body[data-device="pad"]) #select:not(.open) .sel-panel { display: none; }
:is(body[data-device="key"], body[data-device="pad"]) #select:not(.open) .sel-hint { display: block; }
:is(body[data-device="key"], body[data-device="pad"]) #select:not(.open) { grid-template-columns: 100%; grid-template-rows: auto minmax(0, 1fr) auto; }

/* 背の低い横長画面（スマホ横持ちなど）は、筒を左・選択肢を右に並べる */
@media (orientation: landscape) and (max-height: 560px) {
  #select { grid-template-columns: minmax(0, 1fr) min(430px, 52vw); grid-template-rows: auto minmax(0, 1fr); }
  .sel-head { grid-column: 1; grid-row: 1; }
  .sel-stage { grid-column: 1; grid-row: 2; }
  .sel-panel { grid-column: 2; grid-row: 1 / 3; align-self: stretch; justify-content: center; position: relative; z-index: 1; background: linear-gradient(90deg, rgba(5, 6, 13, 0), rgba(5, 6, 13, 0.94) 14px); }
  .chip { height: clamp(30px, 9vh, 44px); }
  .nav.prev { left: 8px; } .nav.next { right: 8px; }
}

/* ---- 読み込み中 ---- */
.spinner { width: 64px; height: 64px; border-radius: 50%; border: 4px solid rgba(79, 227, 255, 0.2); border-top-color: var(--cyan); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { margin-top: 18px; font-family: var(--display); letter-spacing: 0.35em; color: var(--cyan); }

/* ---- プレイ中 ---- */
#hud { pointer-events: none; justify-content: flex-start; padding: 0; }
.progress { width: 100%; height: 4px; background: rgba(255, 255, 255, 0.08); }
#progressBar { height: 100%; width: 0; background: linear-gradient(90deg, var(--cyan), var(--pink)); box-shadow: 0 0 8px var(--cyan); }
.hud-top { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top)); }
.hud-song { flex: 1; min-width: 0; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hud-score { text-align: right; font-family: var(--display); line-height: 1; }
.hud-score small { display: block; font-size: 9px; letter-spacing: 0.3em; color: var(--muted); }
.life { display: flex; align-items: center; gap: 8px; width: min(420px, calc(100% - 24px)); margin: 0 auto; }
.life small { font-family: var(--display); font-size: 10px; letter-spacing: 0.25em; color: var(--muted); }
.life-bar { flex: 1; height: 8px; border-radius: 4px; background: rgba(255, 255, 255, 0.08); border: 1px solid var(--line); overflow: hidden; }
#lifeBar { height: 100%; width: 100%; background: var(--cyan); box-shadow: 0 0 8px var(--cyan); transition: width 0.2s ease-out, background-color 0.4s; }
#lifeBar.mid { background: var(--gold); box-shadow: 0 0 8px var(--gold); }
#lifeBar.low { background: #ff6b6b; box-shadow: 0 0 8px #ff6b6b; }
/* ゲームオーバー: 画面をゆっくり暗く赤くし、文字を浮かび上がらせる（点滅はしない） */
#stage { transition: filter 1.4s ease-out; }
body.failing #stage { filter: saturate(0.35) brightness(0.55) sepia(0.4) hue-rotate(-40deg); }
#gameover {
  position: absolute; left: 0; right: 0; top: 42%; transform: translateY(-50%); text-align: center; opacity: 0; pointer-events: none;
  font-family: var(--display); font-weight: 800; font-size: clamp(36px, 10vw, 72px); letter-spacing: 0.12em; color: #ff6b6b; text-shadow: 0 0 24px rgba(255, 107, 107, 0.8);
}
body.failing #gameover { animation: gameover 2.8s ease-out forwards; }
@keyframes gameover { 0% { opacity: 0; transform: translateY(-50%) scale(1.3); letter-spacing: 0.4em; } 30% { opacity: 1; transform: translateY(-50%) scale(1); letter-spacing: 0.12em; } 85% { opacity: 1; } 100% { opacity: 0; } }
.hud-score span { font-size: 22px; font-variant-numeric: tabular-nums; text-shadow: 0 0 10px rgba(79, 227, 255, 0.6); }
.pause-key { font-family: var(--display); font-size: 10px; letter-spacing: 0.1em; color: var(--muted); white-space: nowrap; }
.icon-btn { pointer-events: auto; width: 40px; height: 40px; border-radius: 10px; background: rgba(8, 12, 32, 0.6); border: 1px solid rgba(255,255,255,0.15); color: #fff; font-size: 14px; }
#ready { position: absolute; left: 0; right: 0; top: 42%; text-align: center; font-family: var(--display); font-size: 34px; letter-spacing: 0.3em; color: #fff; text-shadow: 0 0 16px var(--cyan); }
#judge {
  position: absolute; left: 0; right: 0; top: 76%; transform: translateY(-50%); text-align: center;
  font-family: var(--display); font-size: clamp(26px, 7vw, 40px); font-weight: 800; letter-spacing: 0.08em; text-shadow: 0 0 16px currentColor; opacity: 0;
}
#judge.pop { animation: pop 0.6s ease-out; }
@keyframes pop { 0% { opacity: 1; transform: translateY(-50%) scale(1.12); } 30% { opacity: 1; transform: translateY(-50%) scale(1); } 100% { opacity: 0; transform: translateY(-70%) scale(1); } }
#combo { position: absolute; left: 0; right: 0; top: calc(76% + 26px); text-align: center; font-family: var(--display); font-size: 15px; font-weight: 800; color: #fff; letter-spacing: 0.1em; }

/* ---- 一時停止・結果 ---- */
.dialog { width: min(420px, 100%); padding: 22px 18px; background: rgba(8, 12, 32, 0.92); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 0 40px rgba(79, 227, 255, 0.15); max-height: 100%; overflow-y: auto; }
.dialog-title { text-align: center; margin-bottom: 14px; font-family: var(--display); font-size: 22px; letter-spacing: 0.35em; color: var(--cyan); }
.rank { text-align: center; font-family: var(--display); font-weight: 800; font-size: 88px; line-height: 1; color: var(--gold); text-shadow: 0 0 24px rgba(255, 216, 74, 0.8); }
.final-score { text-align: center; margin: 6px 0 14px; font-family: var(--display); font-size: 30px; font-variant-numeric: tabular-nums; }
.stats { width: 100%; border-collapse: collapse; margin-bottom: 16px; font-size: 15px; }
.stats td { padding: 3px 2px; }
.stats td:last-child { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.stats .p { color: var(--gold); } .stats .g { color: var(--cyan); } .stats .o { color: #9dff8a; } .stats .m { color: #ff6b6b; }

/* ---- 画面下のスライダー ---- */
#slider {
  position: fixed; left: 0; right: 0; bottom: 0; height: var(--pad-h);
  padding: 12px 10px calc(12px + var(--safe-b));
  background: linear-gradient(180deg, rgba(2,3,10,0.2), rgba(10, 14, 36, 0.95) 20%);
  border-top: 1px solid var(--line);
  touch-action: none; user-select: none; -webkit-user-select: none;
}
#slider .track { position: relative; height: 100%; display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
#slider i { border-radius: 14px; background: linear-gradient(180deg, rgba(var(--lc), 0.22), rgba(20, 30, 70, 0.85)); border: 1px solid rgba(var(--lc), 0.45); }
#slider .k0, .chip.key.k0 { --lc: 255, 107, 213; }
#slider .k1, .chip.key.k1 { --lc: 255, 216, 74; }
#slider .k2, #slider .k4, .chip.key.k2, .chip.key.k4 { --lc: 79, 227, 255; }
#slider .k3, .chip.key.k3 { --lc: 157, 255, 138; }
#slider i.off { opacity: 0.25; } /* その曲で使わないボタン */
#slider .track b {
  position: absolute; top: 0; bottom: 0; width: 18%; transform: translateX(-50%); border-radius: 16px; pointer-events: none;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.55), rgba(79, 227, 255, 0.15) 70%); box-shadow: 0 0 24px rgba(79, 227, 255, 0.7);
}
.chip.key:not(.reset) { border-color: rgba(var(--lc), 0.55); }

.corner { position: fixed; right: 12px; bottom: calc(12px + var(--safe-b)); z-index: 5; }
body[data-screen="play"] .corner, body[data-screen="pause"] .corner { display: none; }
/* 曲選びでは右下が START なので、右上へ */
body[data-screen="select"] .corner { bottom: auto; top: calc(10px + env(safe-area-inset-top)); }
/* 横持ちの低い画面の曲選びでは、右上が選択肢なので左下へ */
@media (orientation: landscape) and (max-height: 560px) {
  body[data-screen="select"] .corner { top: auto; right: auto; left: 12px; bottom: calc(10px + var(--safe-b)); }
}

/* ---- 結果の画面の「つぎに遊ぶゲーム」（/more.js が #moreBox に中身を作る） ----
   曲選びのジャケットと同じく正方形のジャケットに見立て、ネオンの輪で縁取る。縦持ちは結果の下、横持ちは結果の右。
   中身が届く前から大きさを決めておき、結果のメニューを動かさない */
#result { gap: 12px; }
#moreBox { --jk: min(76px, 11vh); flex: none; width: min(420px, 100%); }
@media (orientation: landscape) { #result { flex-direction: row; gap: 24px; } #moreBox { --jk: min(96px, 17vh); width: auto; } }
#moreBox .d9m-more { padding: 10px 16px 12px; background: rgba(8, 12, 32, 0.92); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 0 40px rgba(255, 79, 139, 0.12), inset 0 1px 0 rgba(79, 227, 255, 0.25); }
#moreBox .d9m-head { margin: 0 0 8px; text-align: center; font-size: 13px; font-weight: 700; letter-spacing: 0.2em; color: var(--cyan); text-shadow: 0 0 10px rgba(79, 227, 255, 0.6); }
#moreBox ul { gap: 14px; height: calc(var(--jk) + 34px); }
#moreBox li { flex: 0 0 auto; width: var(--jk); max-width: none; }
#moreBox li.d9m-empty { height: var(--jk); border-radius: 8px; border: 1px solid var(--line); background: rgba(20, 50, 90, 0.35); }
#moreBox img { height: var(--jk); aspect-ratio: 1 / 1; border-radius: 8px; border: 1px solid var(--cyan); box-shadow: 0 0 10px rgba(79, 227, 255, 0.45); transition: box-shadow 0.2s, border-color 0.2s, transform 0.2s; }
#moreBox li a:hover img, #moreBox li a:focus-visible img { border-color: var(--pink); box-shadow: 0 0 16px rgba(255, 79, 139, 0.7); transform: scale(1.04); }
#moreBox .d9m-title { margin-top: 4px; text-align: center; font-size: 11px; font-weight: 700; color: var(--text); }
#moreBox .d9m-why { text-align: center; font-family: var(--display); font-size: 9px; letter-spacing: 0.1em; color: var(--gold); }
#moreBox .d9m-top { margin-top: 8px; font-size: 12px; letter-spacing: 0.08em; color: var(--muted); text-decoration: none; }
#moreBox .d9m-top::after { content: " ▶"; color: var(--pink); font-size: 10px; }
#moreBox .d9m-top:hover { color: #fff; }
#moreBox li a.focus img { border-color: var(--pink); box-shadow: 0 0 0 2px var(--pink), 0 0 16px rgba(255, 79, 139, 0.7); transform: scale(1.04); }
#moreBox .d9m-top.focus { color: #fff; text-shadow: 0 0 10px rgba(79, 227, 255, 0.8); }
/* 縦持ちで背の低い画面は、結果の表を少し詰めて下の欄まで1画面に収める（スクロールさせない） */
@media (orientation: portrait) and (max-height: 760px) {
  /* 右下の全画面ボタンと「つぎに遊ぶゲーム」の欄が重ならないよう、下を空ける */
  #result { gap: 8px; padding-bottom: 60px; }
  #moreBox { --jk: min(64px, 10vh); }
  #moreBox .d9m-more { padding: 8px 14px 10px; }
  #result .dialog { padding: 10px 18px; }
  #result .dialog-title { margin-bottom: 6px; font-size: 20px; }
  #result .rank { font-size: 64px; }
  #result .final-score { margin: 2px 0 8px; font-size: 26px; }
  #result .stats { margin-bottom: 10px; font-size: 14px; }
  #result .stats td { padding: 1px 2px; }
}

/* ---- せってい（タイトル・曲選び・一時停止から開く。スクロールしない1画面） ---- */
#options { z-index: 10; }
.opt-dialog { width: min(760px, 100%); padding: 14px 18px 12px; overflow: hidden; }
.opt-dialog .dialog-title { margin-bottom: 8px; }
.opt-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; }
.opt-col { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
#optKeys { display: flex; flex-direction: column; gap: inherit; }
.opt-head { margin: 4px 0 1px; font-size: 12px; font-weight: 700; letter-spacing: 0.2em; color: var(--cyan); }
.opt-head small { margin-left: 8px; font-weight: 400; letter-spacing: 0.05em; color: var(--muted); }
.opt-row {
  display: flex; align-items: center; gap: 8px; min-height: clamp(32px, 5.4vh, 42px); padding: 0 10px;
  background: var(--panel); border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 10px; cursor: pointer;
}
.opt-row .k { flex: 1; min-width: 0; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.opt-row .k.wide { text-align: center; font-weight: 700; letter-spacing: 0.1em; }
.opt-row.focus { border-color: var(--cyan); background: rgba(20, 50, 90, 0.85); box-shadow: 0 0 0 1px var(--cyan), 0 0 14px rgba(79, 227, 255, 0.35); }
body[data-device="mouse"] .opt-row:hover { border-color: var(--line); }
.opt-row.act { justify-content: center; }
.opt-row.back { margin-top: 6px; }
/* 音量: 10本の目盛り。点いている本数が大きさ */
.vol { display: flex; align-items: center; gap: 4px; }
.vol .arrow { width: 30px; height: 30px; border-radius: 8px; color: var(--cyan); font-size: 12px; }
.vol .arrow:active { background: rgba(79, 227, 255, 0.25); }
.vol .bars { display: flex; align-items: flex-end; gap: 3px; height: 22px; }
.vol .bars i { width: 8px; height: 100%; border-radius: 2px; background: rgba(255, 255, 255, 0.1); }
.vol .bars i:nth-child(1) { height: 40%; } .vol .bars i:nth-child(2) { height: 46%; } .vol .bars i:nth-child(3) { height: 52%; } .vol .bars i:nth-child(4) { height: 58%; }
.vol .bars i:nth-child(5) { height: 64%; } .vol .bars i:nth-child(6) { height: 70%; } .vol .bars i:nth-child(7) { height: 76%; } .vol .bars i:nth-child(8) { height: 82%; }
.vol .bars i:nth-child(9) { height: 90%; }
.vol .bars i.on { background: linear-gradient(0deg, var(--cyan), #b8f5ff); box-shadow: 0 0 6px rgba(79, 227, 255, 0.6); }
.vol .num { width: 1.6em; text-align: right; font-family: var(--display); font-size: 13px; font-variant-numeric: tabular-nums; }
/* オン／オフ */
.sw { flex: 0 0 auto; min-width: 58px; height: 28px; border-radius: 999px; font-size: 13px; font-weight: 700; color: var(--muted); border: 1px solid rgba(255, 255, 255, 0.15); background: rgba(255, 255, 255, 0.04); }
.sw.on { color: #fff; border-color: var(--cyan); background: linear-gradient(180deg, rgba(79, 227, 255, 0.4), rgba(20, 60, 120, 0.9)); box-shadow: 0 0 8px rgba(79, 227, 255, 0.4); }
/* ボタンの割り当て: 色の点は 筒の ラインと 同じ色 */
.opt-row .dot { display: inline-block; width: 10px; height: 10px; margin-right: 8px; border-radius: 50%; background: rgb(var(--lc)); box-shadow: 0 0 6px rgb(var(--lc)); }
.opt-row .dot.k0 { --lc: 255, 107, 213; } .opt-row .dot.k1 { --lc: 255, 216, 74; } .opt-row .dot.k2, .opt-row .dot.k4 { --lc: 79, 227, 255; } .opt-row .dot.k3 { --lc: 157, 255, 138; }
.opt-row .kv, .opt-row .pv { flex: 0 0 auto; min-width: 44px; padding: 2px 8px; text-align: center; border-radius: 6px; border: 1px solid var(--line); font-size: 13px; }
.opt-row .kv { color: #fff; }
.opt-row .pv { color: var(--muted); font-weight: 400; }
.opt-row.wait { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold), 0 0 14px rgba(255, 216, 74, 0.4); }
.opt-row.wait .kv { color: var(--gold); border-color: var(--gold); }
.opt-help { margin: 8px 0 0; min-height: 1.3em; text-align: center; font-size: 12px; color: #cfe9ff; white-space: nowrap; overflow: hidden; }
.opt-help b { display: inline-block; padding: 0 6px; margin: 0 2px; border-radius: 5px; border: 1px solid var(--line); background: var(--panel); color: #fff; }
.opt-help.wait { color: var(--gold); }
/* 縦持ちは1列に並べ、行を詰める */
@media (orientation: portrait) {
  .opt-cols { grid-template-columns: 1fr; gap: 2px; }
  .opt-row { min-height: clamp(30px, 4.6vh, 40px); }
  .opt-help { white-space: normal; }
}
/* 背の低い横長画面（スマホ横持ち）は さらに詰める */
@media (orientation: landscape) and (max-height: 520px) {
  .opt-dialog { padding: 8px 14px; }
  .opt-dialog .dialog-title { margin-bottom: 2px; font-size: 16px; }
  .opt-head { margin: 1px 0 0; font-size: 11px; }
  .opt-row { min-height: 27px; }
  .opt-col { gap: 3px; }
  .opt-help { margin-top: 4px; }
  .opt-row.back { margin-top: 4px; }
}
