:root {
  /* 太陽のような明るさ: クリーム地に、オレンジと黄色、差し色の青緑 */
  --paper: #fff7e3;
  --sun: radial-gradient(80% 45% at 50% -5%, #ffe27a 0%, rgba(255, 226, 122, 0) 70%);
  --ink: #3b2a12;
  --muted: #8a6d43;
  --soft: #c9ae84;
  --line: rgba(255, 138, 31, .25);
  --frame: #f2b24f;
  --card: #fffdf6;
  --panel: #fffdf6;
  --accent: #ff8a1f;
  --accent-grad: linear-gradient(90deg, #ffc21a, #ff8a1f 60%, #ff5a3c);
  --accent-shadow: #c45a00;
  --teal: #13a89e;
  --track: #fde6be;
  --score-grad: linear-gradient(180deg, #ffb21a, #ff6a1f);
  /* 4つの枠と結果のバーの色（音程一致率・ロングトーン・安定性・最大コンボ） */
  --m1: #ff8a1f;
  --m2: #13a89e;
  --m3: #ffc21a;
  --m4: #ff5a7a;
  --perfect: #ff8a1f;
  --great: #13a89e;
  --good: #e0a800;
  --miss: #d6c4a3;
  --vh: 100vh;
}
@supports (height: 100dvh) { :root { --vh: 100dvh; } }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body {
  margin: 0;
  height: 100%;
  color: var(--ink);
  font-family: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Hiragino Sans", system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  /* 二本指の横スワイプでブラウザーが「戻る」にならないように */
  overscroll-behavior: none;
  overscroll-behavior-x: none;
  touch-action: manipulation;
}
body {
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  background: var(--sun), var(--paper);
  background-attachment: fixed;
}
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- 1画面に収める ---------- */
.app {
  max-width: 560px;
  height: var(--vh);
  margin: 0 auto;
  padding: max(8px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
}
.app > :not(.stage) { flex-shrink: 0; }
.head { display: flex; align-items: center; gap: 10px; }
.title { flex: 1; min-width: 0; margin: 0; font-weight: 900; font-size: clamp(18px, 5.4vw, 24px); line-height: 1.2; white-space: nowrap; }
.title-btn { max-width: 100%; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; overflow: hidden; text-overflow: ellipsis; }
.title-btn::before { content: "⭐"; margin-right: .2em; }
.menu-btn { flex: none; padding: 5px 12px; border: 1.5px solid var(--accent); border-radius: 6px; background: var(--card); color: var(--accent); font-size: 12px; font-weight: 700; cursor: pointer; }

/* ---------- 再生中の曲 ---------- */
.now-playing { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; }
.jacket { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 10px; background: linear-gradient(135deg, #ffc21a, #ff8a1f); color: #fff; font-size: 28px; font-weight: 900; text-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
.song { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 2px 8px; min-width: 0; }
.song-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 18px; font-weight: 900; }
.song-artist { font-size: 11px; color: var(--muted); font-weight: 700; }
.song-time { grid-column: 1 / -1; font-size: 13px; font-variant-numeric: tabular-nums; color: var(--muted); }
.song-track { grid-column: 1 / -1; display: block; height: 7px; border: 1px solid var(--frame); border-radius: 4px; overflow: hidden; background: var(--card); }
#progress { display: block; height: 100%; background: var(--accent-grad); transform-origin: left; transform: scaleX(0); }
.quit-btn { display: grid; place-items: center; width: 44px; height: 44px; border: 2px solid var(--accent); border-radius: 50%; background: var(--card); color: var(--accent); cursor: pointer; visibility: hidden; }
.app.playing .quit-btn { visibility: visible; }

/* ---------- 採点: 点数の右に4項目を2×2で並べる ---------- */
.scoreboard { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 0 12px; }
.score-label { grid-column: 1; grid-row: 1; align-self: end; margin: 0; font-size: 12px; letter-spacing: .3em; font-weight: 700; color: var(--accent); }
.score { grid-column: 1; grid-row: 2; margin: -4px 0 0; font-size: clamp(34px, 11vw, 44px); font-weight: 900; line-height: 1.05; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; background: var(--score-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
/* 点数で列の幅が変わって右の4項目が動かないように、2桁の点数（最大で文字の約2.7倍）の幅に固定する。100点は縮めて収める */
.score { width: 2.75em; }
#score.wide { font-size: 88%; }
.meters { grid-column: 2; grid-row: 1 / 3; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 0; }
.meters > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 0 4px; padding: 3px 8px 4px; border: 1.5px solid var(--frame); border-radius: 10px; background: var(--card); box-shadow: 0 2px 0 var(--line); }
.meters dt { font-size: 10px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 幅が狭いときは短い項目名にする */
.meters .short { display: none; }
.meters dd { margin: 0; font-variant-numeric: tabular-nums; white-space: nowrap; }
.meters b { font-size: 16px; font-weight: 900; }
.meters small { font-size: 10px; font-weight: 900; margin-left: 1px; }
.meter { grid-column: 1 / -1; display: block; height: 4px; border-radius: 2px; overflow: hidden; background: var(--track); }
.meter span { display: block; height: 100%; background: var(--m1); transform-origin: left; transform: scaleX(0); }
.meters > div:nth-child(1) b { color: var(--m1); }
.meters > div:nth-child(2) .meter span { background: var(--m2); }
.meters > div:nth-child(3) .meter span { background: var(--m3); }
.meters > div:nth-child(4) .meter span { background: var(--m4); }

/* ---------- 歌詞 ---------- */
.lyrics { display: grid; gap: 2px; overflow: hidden; padding: 8px 12px; border: 1.5px solid var(--frame); border-radius: 12px; background: var(--card); text-align: center; font-weight: 900; }
/* 1行に収める。幅に合わせて文字を縮め、それでも長ければ省略する */
.lyrics p { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lyrics-now { min-height: 1.3em; font-size: clamp(15px, 5.2vw, 20px); line-height: 1.3; color: var(--muted); }
/* 区切りごとに、歌い終えた割合（--p）まで左から色を塗る */
.lyrics-now span { background: linear-gradient(90deg, var(--accent) var(--p, 0%), var(--muted) var(--p, 0%)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lyrics-next { min-height: 1.3em; font-size: clamp(11px, 3.4vw, 13px); color: var(--soft); }
/* 行が替わったら、次の行が今の行の位置へせり上がって大きくなり、その次の行が下から出てくる */
.lyrics-now.enter { animation: lyric-up .34s cubic-bezier(.2, .8, .2, 1); }
.lyrics-next.enter { animation: lyric-next .34s ease-out; }
@keyframes lyric-up { from { transform: translateY(70%) scale(.65); opacity: .5; } to { transform: none; opacity: 1; } }
@keyframes lyric-next { from { transform: translateY(90%); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .lyrics .enter { animation: none; } }

/* ---------- コンボと判定（ロールの右上に重ねる） ---------- */
.combo-row { position: absolute; top: 34px; right: 10px; z-index: 2; display: grid; justify-items: end; padding: 4px 10px; border-radius: 10px; background: rgba(255, 253, 246, .85); pointer-events: none; }
.combo { display: flex; align-items: baseline; gap: 4px; font-size: 11px; font-weight: 700; }
.combo b { font-size: 20px; font-weight: 900; font-variant-numeric: tabular-nums; }
.judge { margin: -4px 0 0; min-height: 1.1em; font-size: 20px; font-weight: 900; letter-spacing: .02em; transform-origin: right center; }
.judge:empty { display: none; }
.judge[data-judge="perfect"] { color: var(--perfect); }
.judge[data-judge="great"] { color: var(--great); }
.judge[data-judge="good"] { color: var(--good); }
.judge[data-judge="miss"] { color: var(--miss); }
.judge.pop { animation: pop .3s ease-out; }
@keyframes pop { from { transform: scale(1.25); opacity: .3; } to { transform: scale(1); opacity: 1; } }

/* ---------- 音程（スライダーとロール） ---------- */
.stage {
  position: relative;
  flex: 1 0 220px;
  min-height: 220px;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 4px;
}
.slider { position: relative; border: 1.5px solid var(--frame); border-radius: 14px; background: var(--card); touch-action: none; cursor: ns-resize; }
.slider-label { position: absolute; top: 6px; left: 0; right: 0; text-align: center; font-size: 13px; font-weight: 900; }
.slider-step { position: absolute; left: 50%; display: grid; place-items: center; width: 40px; height: 32px; margin-left: -20px; padding: 0; border: 0; background: none; color: var(--accent); cursor: pointer; touch-action: none; }
#upBtn { top: 28px; }
#downBtn { bottom: 4px; }
.slider-track { position: absolute; top: 62px; bottom: 40px; left: 50%; width: 8px; margin-left: -4px; border-radius: 4px; background: var(--track); }
/* 縦の位置（translateY）は、ロールの上端からのピクセル。スライダーとロールは上端がそろう */
.slider-thumb { position: absolute; top: -14px; left: 50%; width: 28px; height: 28px; margin-left: -14px; border: 2px solid #fff; border-radius: 50%; background: var(--accent); box-shadow: 0 3px 0 var(--accent-shadow); pointer-events: none; }
/* 今の音程の合い具合（ロールの点と同じ）で、つまみの色と光り方を変える */
.slider-thumb { transition: background-color .12s, box-shadow .12s, transform .05s; }
.slider-thumb[data-match="perfect"] { background: var(--perfect); box-shadow: 0 0 0 5px rgba(255, 138, 31, .25), 0 0 16px 2px rgba(255, 194, 26, .9); }
.slider-thumb[data-match="great"] { background: var(--great); box-shadow: 0 0 0 5px rgba(19, 168, 158, .22), 0 0 10px rgba(19, 168, 158, .6); }
.slider-thumb[data-match="good"] { background: var(--good); box-shadow: 0 0 0 4px rgba(224, 168, 0, .18); }
.slider-thumb[data-match="miss"] { background: var(--soft); box-shadow: none; }
.roll {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 1.5px solid var(--frame);
  border-radius: 10px;
  background: var(--card);
  touch-action: pan-y pinch-zoom;
  --roll-ink: #3b2a12;
  --roll-grid: #f6e7c8;
  --roll-label: #b0915e;
  --roll-note: #f3dfba;
  --roll-perfect: #ff8a1f;
  --roll-great: #13a89e;
  --roll-good: #e8b400;
  --roll-miss: #efe5d2;
  --roll-now: #13a89e;
  --roll-spark: #ffc21a;
}
.app.playing .roll { touch-action: none; cursor: ns-resize; }
.countdown {
  position: absolute;
  inset: 0 0 0 68px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(48px, 16vw, 88px);
  font-weight: 900;
  color: var(--accent);
  pointer-events: none;
}
.practice-badge { position: absolute; right: 8px; bottom: 8px; padding: 3px 10px; border-radius: 999px; background: rgba(59, 42, 18, .75); color: #fff; font-size: 11px; font-weight: 700; pointer-events: none; }
.message { display: flex; align-items: center; gap: 10px; margin: 0; min-height: 1.5em; font-size: clamp(12px, 3.6vw, 14px); font-weight: 700; color: var(--muted); }
.message::before, .message::after { content: ""; flex: 1; height: 1px; min-width: 16px; background: var(--line); }

/* ---------- 記録・ボタン ---------- */
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.app.playing .actions { display: none; }
.stats { grid-column: 1 / -1; display: flex; gap: 8px; margin: 0; }
.stats div { flex: 1; display: flex; align-items: baseline; justify-content: space-between; padding: 5px 10px; border: 1px solid var(--frame); border-radius: 8px; background: var(--card); }
.stats dt { font-size: 11px; color: var(--muted); font-weight: 700; }
.stats dd { margin: 0; font-size: 16px; font-weight: 900; font-variant-numeric: tabular-nums; }
.btn {
  display: grid;
  place-items: center;
  gap: 1px;
  min-height: 52px;
  padding: 8px 10px;
  border: 0;
  border-radius: 12px;
  font-size: 17px;
  font-weight: 900;
  cursor: pointer;
  transition: transform .08s;
}
.btn:active { transform: translateY(2px); }
.btn:disabled { opacity: .5; cursor: default; }
.btn small { font-size: 11px; font-weight: 700; opacity: .85; }
.btn-main { background: var(--accent-grad); color: #fff; box-shadow: 0 4px 0 var(--accent-shadow); }
.btn-sub { background: var(--card); border: 2px solid var(--accent); color: var(--ink); box-shadow: 0 4px 0 var(--line); }
.btn-x { grid-auto-flow: column; gap: 6px; min-height: 44px; background: var(--ink); color: #fff; font-size: 14px; }
.btn-wide { grid-column: 1 / -1; }
/* シェアのあとの案内。結果画面の上にも出せるよう、あとに置いて重ねる */
#shareDialog { z-index: 12; }
.share-panel { display: grid; gap: 8px; width: min(100%, 360px); padding: 22px 18px 18px; }
.share-dialog-title { margin: 0 24px 0 0; font-size: 18px; font-weight: 900; line-height: 1.4; color: var(--accent); }
.share-dialog-text { margin: 0; font-size: 14px; font-weight: 700; line-height: 1.5; color: var(--ink); }
.share-dialog-note { margin: 0 0 6px; font-size: 12px; font-weight: 700; line-height: 1.6; color: var(--muted); }
.share-panel .btn-x { text-decoration: none; }
#startBtn { grid-column: 1 / -1; }
/* 歌いはじめるの上の吹き出し。×で閉じたら出さない（Cookieに覚える） */
.share-hint { grid-column: 1 / -1; position: relative; margin: 2px 0 5px; padding: 7px 36px 7px 12px; border-radius: 12px; background: var(--ink); color: #fff; text-align: center; }
.share-hint[hidden] { display: none; }
.share-hint::after { content: ""; position: absolute; left: 50%; bottom: -6px; width: 12px; height: 12px; margin-left: -6px; background: var(--ink); transform: rotate(45deg); }
.share-hint p { margin: 0; font-size: 13px; font-weight: 900; line-height: 1.4; }
.share-hint small { display: block; font-size: 11px; font-weight: 700; color: #ffd98a; }
.share-hint-close { position: absolute; top: 50%; right: 4px; width: 30px; height: 30px; margin-top: -15px; padding: 0; border: 0; background: none; color: #fff; font-size: 18px; cursor: pointer; }

/* ---------- パネル ---------- */
.overlay { position: fixed; inset: var(--visible-top, 0px) 0 auto; height: var(--visible-height, var(--vh)); z-index: 10; display: grid; grid-template-rows: minmax(0, 1fr); place-items: center; padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); background: rgba(70, 40, 0, .35); overflow: hidden; }
.panel { position: relative; width: min(100%, 440px); max-height: 100%; overflow-y: auto; overscroll-behavior-y: contain; touch-action: pan-y pinch-zoom; padding: 18px 18px 16px; border-radius: 16px; background: var(--panel); box-shadow: 0 10px 40px rgba(0, 0, 0, .3); }
#resultPanel:focus { outline: none; }
.result-total { margin: 0; text-align: center; font-size: clamp(30px, 9vw, 40px); font-weight: 900; font-variant-numeric: tabular-nums; background: var(--score-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.result-title { margin: 0; text-align: center; font-size: 17px; font-weight: 900; color: var(--accent); }
.result-best { margin: 2px 0 0; min-height: 1em; text-align: center; font-size: 12px; font-weight: 900; color: var(--accent); }
.result-best:empty { display: none; }
.axes { margin: 10px 0 6px; padding: 0; list-style: none; display: grid; gap: 7px; }
.axes li { display: grid; grid-template-columns: 6em 1fr 4em; align-items: center; column-gap: 8px; }
.axis-name { font-size: 13px; font-weight: 900; }
.axis-track { height: 9px; border-radius: 5px; background: var(--track); overflow: hidden; }
.axis-track.axis-none { background: none; }
.axes li:nth-child(2) .axis-track span { background: var(--m2); }
.axes li:nth-child(3) .axis-track span { background: var(--m3); }
.axis-track span { display: block; height: 100%; background: var(--m1); transform-origin: left; transform: scaleX(0); transition: transform .7s cubic-bezier(.2, .8, .2, 1); }
.axis-score { text-align: right; font-size: 16px; font-weight: 900; font-variant-numeric: tabular-nums; }
.result-judges { margin: 0 0 10px; text-align: center; font-size: 12px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.panel-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* ---------- メニュー ---------- */
.menu-close { position: absolute; top: 8px; right: 10px; width: 36px; height: 36px; border: 0; background: none; font-size: 24px; cursor: pointer; }
.menu-label { margin: 6px 0 6px; font-size: 13px; color: var(--muted); }
.menu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.menu-item { display: block; padding: 10px; border: 1.5px solid var(--frame); border-radius: 10px; background: var(--card); color: var(--ink); text-align: center; text-decoration: none; font-size: 13px; font-weight: 700; cursor: pointer; }
.howto { margin: 0 0 8px; padding-left: 1.3em; font-size: 12.5px; line-height: 1.65; }
.credit { margin: 0 0 8px; padding: 0; list-style: none; font-size: 12.5px; line-height: 1.7; }
.credit a { color: var(--muted); }
.menu-links { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 12px; }
.menu-links a { color: var(--muted); }
.menu-reset { margin-left: auto; padding: 0; border: 0; background: none; color: #a33; font-size: 12px; text-decoration: underline; cursor: pointer; }

/* ---------- Xのアプリ内ブラウザで、ブラウザで開くよう案内する ---------- */
/* 案内のぶん画面の下をあけて、ボタンに重ねない。待機中だけ歌詞の枠を隠し、ロールを低くして収める（歌い始めれば戻る） */
body:has(.open-hint:not([hidden]):not([data-os="android"])) .app:not(.playing) { padding-bottom: calc(max(10px, env(safe-area-inset-bottom)) + 92px); }
body:has(.open-hint:not([hidden]):not([data-os="android"])) .app:not(.playing) .lyrics { display: none; }
body:has(.open-hint:not([hidden]):not([data-os="android"])) .app:not(.playing) .stage { flex-basis: 130px; min-height: 130px; }
.open-hint { position: fixed; left: 50%; bottom: max(6px, env(safe-area-inset-bottom)); z-index: 25; display: grid; justify-items: center; width: max-content; max-width: calc(100% - 32px); transform: translateX(-50%); pointer-events: none; }
.open-hint-card { position: relative; display: grid; gap: 1px; padding: 8px 34px 8px 14px; border-radius: 14px; background: var(--ink); color: #fff; box-shadow: 0 6px 20px rgba(59, 42, 18, .3); text-align: center; pointer-events: auto; }
.open-hint-card b { font-size: 14px; font-weight: 900; }
.open-hint-card span { font-size: 12px; font-weight: 700; color: #ffd98a; }
.open-hint-close { position: absolute; top: 50%; right: 4px; width: 30px; height: 30px; margin-top: -15px; padding: 0; border: 0; background: none; color: #fff; font-size: 18px; cursor: pointer; }
.open-hint-arrow { color: var(--accent); filter: drop-shadow(0 2px 2px rgba(59, 42, 18, .25)); animation: hint-bounce .9s ease-in-out infinite; }
@keyframes hint-bounce { 0%, 100% { translate: 0 0; } 50% { translate: 0 7px; } }
.app.playing ~ .open-hint { display: none; }
/* AndroidのXは、URL欄とツイートのカードをページの下に重ね、その高さ（ツイートの長さで変わる）をページに伝えない。
   下に出すと隠れるので、画面の真ん中に出して、下を指す */
.open-hint[data-os="android"] { top: 50%; bottom: auto; transform: translate(-50%, -50%); }
.open-hint-card .for-android { display: none; }
.open-hint[data-os="android"] .open-hint-card .for-android { display: inline; }
.open-hint[data-os="android"] .open-hint-card .for-ios { display: none; }
@media (prefers-reduced-motion: reduce) { .open-hint-arrow { animation: none; } }

/* 2行の案内も出すので、改行を生かして角丸の箱にする */
.snackbar { position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); z-index: 20; width: max-content; max-width: calc(100% - 32px); transform: translateX(-50%); padding: 8px 16px; border-radius: 14px; background: var(--ink); color: #fff; font-size: 13px; line-height: 1.5; text-align: center; white-space: pre-line; pointer-events: none; }
.snackbar:empty { display: none; }

@media (max-width: 360px) {
  .meters .full { display: none; }
  .meters .short { display: inline; }
  .meters > div { padding: 3px 6px 4px; }
}
@media (max-height: 700px) {
  .jacket { width: 40px; height: 40px; font-size: 20px; }
  .score { font-size: clamp(30px, 10vw, 38px); }
  .btn { min-height: 44px; font-size: 15px; }
  /* 低い画面では、待機中は歌詞の枠を隠し、ロールを低くしてボタンを画面に収める */
  .app:not(.playing) .lyrics { display: none; }
  .stage { flex-basis: 150px; min-height: 150px; }
  .share-hint { margin: 0 0 4px; padding: 4px 32px 4px 10px; }
  .share-hint p { font-size: 12px; line-height: 1.3; }
  .share-hint small { font-size: 10px; }
}

/* ---------- ランキング ---------- */
.rank-switch { grid-column: 1 / -1; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 14px; font-weight: 900; cursor: pointer; }
.rank-switch input { width: 20px; height: 20px; accent-color: var(--accent); }
.panel .rank-switch { margin-top: 8px; }
.rank-status { grid-column: 1 / -1; margin: 0; text-align: center; font-size: 12px; font-weight: 700; color: var(--muted); white-space: pre-line; }
.rank-status:empty { display: none; }
.rank-retry { grid-column: 1 / -1; justify-self: center; display: block; margin: 4px auto 0; padding: 6px 14px; border: 1.5px solid var(--accent); border-radius: 999px; background: var(--card); color: var(--ink); font-size: 13px; font-weight: 900; cursor: pointer; }
.rank-retry[hidden] { display: none; }
.rank-gate { position: fixed; left: 50%; bottom: max(64px, calc(env(safe-area-inset-bottom) + 48px)); z-index: 30; transform: translateX(-50%); }
/* 確認の画面が要るとき以外は見せず、ボタンに重ねない。display:none だと確認が動かないことがあるので、見えなくするだけにする */
.rank-gate:not(.active), .rank-gate.done { pointer-events: none; }
.rank-gate:not(.active) { visibility: hidden; }
.btn-board { min-height: 44px; font-size: 14px; }
.panel-actions .btn-wide { grid-column: 1 / -1; }
.rank-result { margin: 0 0 8px; padding: 8px 10px; border: 1px solid var(--frame); border-radius: 10px; background: var(--card); }
.rank-result-text { margin: 0; font-size: 12.5px; font-weight: 700; white-space: pre-line; }
.rank-publish { display: grid; grid-template-columns: 1fr auto; gap: 6px 8px; align-items: end; margin-top: 6px; }
.rank-publish[hidden] { display: none; }
.rank-publish label, .board-name label { display: grid; gap: 2px; font-size: 11px; font-weight: 700; color: var(--muted); }
.rank-publish input, .board-name input { min-width: 0; padding: 8px 10px; border: 1.5px solid var(--frame); border-radius: 8px; background: #fff; color: var(--ink); font: inherit; font-size: 16px; }
.rank-publish .btn { min-height: 40px; font-size: 15px; }
.rank-publish small { grid-column: 1 / -1; font-size: 10.5px; color: var(--muted); }
.board-title { margin: 0 0 4px; font-size: 18px; }
.board-lead { margin: 0 0 8px; font-size: 11.5px; color: var(--muted); }
.board-feedback { margin: 0 0 6px; font-size: 12px; font-weight: 700; }
.board-feedback:empty { display: none; }
.board-mine { margin-bottom: 8px; padding: 8px 10px; border-radius: 10px; background: rgba(255, 138, 31, .1); }
.board-mine p { margin: 0; font-size: 14px; font-weight: 900; }
.board-mine small { font-size: 11.5px; color: var(--muted); }
.board-pending { margin: 0 0 8px; padding: 0; list-style: none; display: grid; gap: 6px; }
.board-pending li { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; }
.board-pending .btn { min-height: 34px; padding: 4px 14px; font-size: 13px; }
.board-name { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; margin-bottom: 10px; }
.board-name .btn { min-height: 40px; font-size: 13px; }
.board-name .btn[hidden] { display: none; }
.board-list { margin: 0 0 8px; padding: 0; list-style: none; display: grid; gap: 4px; }
.board-list li { display: grid; grid-template-columns: 2.4em 1fr auto; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; background: var(--card); font-size: 14px; }
.board-list li.mine { background: rgba(255, 138, 31, .18); }
.board-rank { text-align: right; font-weight: 900; font-variant-numeric: tabular-nums; }
.board-entry { display: grid; font-weight: 700; overflow-wrap: anywhere; }
.board-entry small { font-size: 10.5px; color: var(--muted); font-weight: 700; }
.board-score { font-weight: 900; font-variant-numeric: tabular-nums; }
.board-empty { margin: 8px 0; text-align: center; font-size: 13px; color: var(--muted); }
.board-refresh { width: 100%; margin-bottom: 8px; }
.board-manage { font-size: 12px; color: var(--muted); }
.board-manage summary { cursor: pointer; font-weight: 700; }
.board-manage p { margin: 6px 0; }
.board-manage .menu-reset { margin: 4px 0; }
.game-language { display: flex; align-items: center; justify-content: flex-end; gap: 7px; font: 700 12px/1.4 system-ui, sans-serif; color: var(--muted); }
.game-language a { color: var(--muted); text-decoration: none; padding: 8px 2px; }
.game-language a[aria-current] { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }
.head .game-language { flex: none; }
@media (max-width: 380px) {
  .head { gap: 6px; }
  .game-language { gap: 4px; font-size: 11px; }
  .meters dt { font-size: 9.5px; }
}

/* ---------- 裏モード（本当のカラオケモード） ---------- */
.mode-badge { grid-column: 1 / -1; justify-self: start; padding: 1px 8px; border-radius: 999px; background: var(--accent-grad); color: #fff; font-size: 11px; font-weight: 900; }
.mode-badge[hidden] { display: none; }
/* マイクで歌うので、スライダーは今の歌声の高さを示すだけ */
.app.mic-mode .slider, .app.mic-mode.playing .roll { cursor: default; }
.app.mic-mode .slider-step { visibility: hidden; }
.app.mic-mode .slider-thumb[data-silent="true"] { opacity: .25; }
.mic-panel { width: min(100%, 400px); }
.mic-panel .panel-actions { grid-template-columns: 1fr; }
.mic-notes { display: grid; gap: 6px; margin: 0; padding-left: 1.2em; font-size: 12px; font-weight: 700; line-height: 1.6; color: var(--muted); }
.mic-notes b { color: var(--ink); }
.mic-error { margin: 0; font-size: 12px; font-weight: 700; color: #c0392b; }
.mic-error:empty { display: none; }
