/* ソロギターの道 ─ 見た目
   色：明るい＝スプルースの表板、暗い＝エボニーの指板。差し色＝フォスファーブロンズの弦。TABの帯はどちらでも指板の色
   字：見出し＝Zen丸ゴシック（10/21 作者「やわらかめに」）、本文＝Zen角ゴシック、数字とTAB＝IBM Plex Mono */
:root {
  --bg: #f3ebde; --bg-2: #ebdfcc; --surface: #fffaf2; --surface-2: #f6eee1; --line: #e2d4be; --line-2: #ccb99c;
  --ink: #241a13; --ink-2: #57463a; --sub: #86715e;
  --bronze: #a95f22; --bronze-2: #cf8a45; --bronze-soft: #f3dcc0; --on-bronze: #fffaf2;
  --pearl: #237f78; --pearl-soft: #d5ece7;
  --ok: #3d8456; --warn: #b9821a; --bad: #bd4f38;
  --board: #1d1611; --board-2: #261d16; --board-line: #3d3128; --board-ink: #efe4d2; --board-sub: #9d8b77; --nickel: #c9c0b4;
  --chip: #f6eddd; --chip-ink: #1d1611; --board-edge: transparent;
  --shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 8px 24px -14px rgba(60,35,15,.35);
  --display: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Kosugi Maru", "Zen Kaku Gothic New", sans-serif;
  --body: "Zen Kaku Gothic New", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --dock-h: 128px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #14100d; --bg-2: #1a1410; --surface: #201914; --surface-2: #29201a; --line: #372b22; --line-2: #4a3b2f;
  --ink: #f1e7d6; --ink-2: #cdbca6; --sub: #9a8774;
  --bronze: #dba05e; --bronze-2: #f1bf80; --bronze-soft: #3a2a1b; --on-bronze: #1b130d;
  --pearl: #7fcfc4; --pearl-soft: #1d3330;
  --ok: #7cc08e; --warn: #e2b553; --bad: #e57c62;
  --board: #0f0c0a; --board-2: #17120e; --board-line: #2f261f; --board-ink: #efe4d2; --board-sub: #8d7c6a; --nickel: #b8afa3;
  --chip: #efe4d2; --chip-ink: #15100c; --board-edge: #2e251e;
  --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 10px 30px -16px rgba(0,0,0,.8);
  color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #14100d; --bg-2: #1a1410; --surface: #201914; --surface-2: #29201a; --line: #372b22; --line-2: #4a3b2f;
  --ink: #f1e7d6; --ink-2: #cdbca6; --sub: #9a8774;
  --bronze: #dba05e; --bronze-2: #f1bf80; --bronze-soft: #3a2a1b; --on-bronze: #1b130d;
  --pearl: #7fcfc4; --pearl-soft: #1d3330;
  --ok: #7cc08e; --warn: #e2b553; --bad: #e57c62;
  --board: #0f0c0a; --board-2: #17120e; --board-line: #2f261f; --board-ink: #efe4d2; --board-sub: #8d7c6a; --nickel: #b8afa3;
  --chip: #efe4d2; --chip-ink: #15100c; --board-edge: #2e251e;
  --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 10px 30px -16px rgba(0,0,0,.8);
  color-scheme: dark; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 15px; line-height: 1.65;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; touch-action: manipulation; }
button:focus-visible, [tabindex]:focus-visible, input:focus-visible { outline: 2px solid var(--bronze); outline-offset: 2px; border-radius: 10px; }
svg { width: 22px; height: 22px; flex: none; }
[hidden] { display: none !important; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ───── 画面の わく ───── */
#app { min-height: 100%; }
#views { max-width: 720px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 8px) 16px calc(var(--dock-h) + env(safe-area-inset-bottom) + 24px); }
.view { display: flex; flex-direction: column; gap: 22px; }
.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding-top: 14px; }
.top h1 { font-family: var(--display); font-weight: 700; font-size: 30px; line-height: 1.15; margin: 0; letter-spacing: .02em; text-wrap: balance; }
.top .date { font-size: 13px; color: var(--sub); }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .14em; color: var(--sub); }
h2.sec { font-family: var(--display); font-weight: 700; font-size: 19px; margin: 0; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
h2.sec small { font-family: var(--body); font-weight: 500; font-size: 12.5px; color: var(--sub); }

/* 弦の しるし（6本、細い→太い） */
.gauge { display: grid; gap: 3px; width: 100%; }
.gauge i { display: block; background: var(--line-2); border-radius: 2px; }
.gauge i:nth-child(1) { height: 1px; } .gauge i:nth-child(2) { height: 1.3px; } .gauge i:nth-child(3) { height: 1.7px; }
.gauge i:nth-child(4) { height: 2.2px; } .gauge i:nth-child(5) { height: 2.7px; } .gauge i:nth-child(6) { height: 3.3px; }

/* ───── ボタン ───── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px; border-radius: 999px;
  font-weight: 700; font-size: 15px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); }
.btn.primary { background: var(--bronze); border-color: var(--bronze); color: var(--on-bronze); }
.btn.primary:active { filter: brightness(.95); }
.btn.ghost { background: none; border-color: transparent; color: var(--ink-2); }
.btn.small { min-height: 36px; padding: 0 14px; font-size: 13.5px; }
.btn svg { width: 18px; height: 18px; }
.iconbtn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; color: var(--ink-2); }
.iconbtn:active { background: var(--surface-2); }

/* ───── きょう ───── */
.session { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); overflow: hidden; }
.session-head { padding: 18px 18px 14px; display: flex; flex-direction: column; gap: 10px; }
.session-clock { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.session-clock .now { font-weight: 700; font-size: 16px; min-width: 0; }
.session-clock .t { font-family: var(--mono); font-size: 34px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.progress { height: 6px; border-radius: 3px; background: var(--bg-2); overflow: hidden; }
.progress b { display: block; height: 100%; width: 0; background: var(--bronze); border-radius: 3px; transition: width .4s linear; }
.menu { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.menu li { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 12px; padding: 13px 18px; border-bottom: 1px solid var(--line); cursor: pointer; }
.menu li:last-child { border-bottom: 0; }
.menu li:active { background: var(--surface-2); }
.menu .no { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-family: var(--mono); font-weight: 600; font-size: 13px;
  border: 1.5px solid var(--line-2); color: var(--sub); }
.menu li.on .no { border-color: var(--bronze); color: var(--bronze); background: var(--bronze-soft); }
.menu li.done .no { border-color: var(--ok); background: var(--ok); color: var(--surface); }
.menu .name { font-weight: 700; line-height: 1.35; }
.menu .why { font-size: 12.5px; color: var(--sub); line-height: 1.4; margin-top: 2px; }
.menu .meta { font-family: var(--mono); font-size: 12.5px; color: var(--ink-2); text-align: right; line-height: 1.35; white-space: nowrap; }
.menu .meta small { display: block; color: var(--sub); }
.session-foot { padding: 14px 18px 18px; display: flex; gap: 10px; }
.session-foot .btn.primary { flex: 1; }

.challenge { display: grid; grid-template-columns: 1fr auto; gap: 4px 14px; align-items: center; padding: 16px 18px; border-radius: 18px;
  background: linear-gradient(180deg, var(--board-2), var(--board)); color: var(--board-ink); cursor: pointer; position: relative; overflow: hidden; }
.challenge::after { content: ""; position: absolute; inset: auto 0 0 0; height: 46%; pointer-events: none;
  background: repeating-linear-gradient(180deg, transparent 0 7px, rgba(201,192,180,.16) 7px 8px); mask: linear-gradient(90deg, transparent, #000 30%, #000 70%, transparent); }
.challenge .eyebrow { color: var(--board-sub); }
.challenge h3 { margin: 0; font-family: var(--display); font-weight: 700; font-size: 24px; line-height: 1.2; }
.challenge .goal { font-family: var(--mono); font-size: 13px; color: var(--board-sub); }
.challenge .goal b { color: var(--bronze-2); font-size: 16px; }
.challenge .go { grid-row: 1 / 4; grid-column: 2; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--bronze); color: var(--on-bronze); position: relative; z-index: 1; }
.challenge .bpmbar { grid-column: 1; height: 4px; background: rgba(255,255,255,.1); border-radius: 2px; margin-top: 8px; position: relative; z-index: 1; }
.challenge .bpmbar b { display: block; height: 100%; border-radius: 2px; background: var(--bronze-2); }

.days { display: grid; grid-template-columns: repeat(14, 1fr); gap: 5px; }
.days i { aspect-ratio: 1; border-radius: 6px; background: var(--bg-2); border: 1px solid var(--line); display: block; }
.days i.l1 { background: color-mix(in srgb, var(--bronze) 35%, var(--bg-2)); border-color: transparent; }
.days i.l2 { background: color-mix(in srgb, var(--bronze) 65%, var(--bg-2)); border-color: transparent; }
.days i.l3 { background: var(--bronze); border-color: transparent; }
.days i.today { outline: 2px solid var(--ink-2); outline-offset: 1px; }
.dayslab { display: flex; justify-content: space-between; font-size: 12px; color: var(--sub); margin-top: 6px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; }
.stat b { display: block; font-family: var(--mono); font-size: 24px; font-weight: 600; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--sub); }

/* ───── 曲 ───── */
.list { display: flex; flex-direction: column; gap: 10px; }
.song { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; padding: 15px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; cursor: pointer; text-align: left; width: 100%; }
.song:active { background: var(--surface-2); }
.song .t { font-family: var(--display); font-weight: 700; font-size: 20px; line-height: 1.25; }
.song .k { font-size: 12.5px; color: var(--sub); }
.song .tags { grid-column: 1 / 3; display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 11.5px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: var(--bg-2); color: var(--ink-2); }
.song .right { grid-row: 1 / 3; grid-column: 2; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.song .best { font-family: var(--mono); font-size: 13px; color: var(--ink-2); }
.song .best b { font-size: 18px; color: var(--ink); }
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.pill svg { width: 13px; height: 13px; }
.pill.clear { background: var(--ok); color: var(--surface); }
.pill.now { background: var(--bronze-soft); color: var(--bronze); }
.pill.lock { background: var(--bg-2); color: var(--sub); }
.song.locked { cursor: default; background: var(--bg); border-style: dashed; }
.song.locked .t { color: var(--sub); }
.song .bar { grid-column: 1 / 3; height: 3px; background: var(--bg-2); border-radius: 2px; overflow: hidden; }
.song .bar b { display: block; height: 100%; background: var(--bronze); }
.stage { font-family: var(--mono); font-size: 11px; color: var(--sub); letter-spacing: .08em; }

/* ───── 録音 ───── */
.take { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.take .pb { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--bronze-soft); color: var(--bronze); }
.take .pb svg { width: 18px; height: 18px; }
.take .title { font-weight: 700; line-height: 1.3; }
.take .sub { font-family: var(--mono); font-size: 12px; color: var(--sub); }
.take canvas { width: 100%; height: 28px; display: block; margin-top: 4px; }
.take .acts { display: flex; gap: 2px; }
.empty { text-align: center; color: var(--sub); padding: 40px 20px; border: 1px dashed var(--line-2); border-radius: 18px; line-height: 1.8; }
.empty b { color: var(--ink); font-family: var(--display); font-size: 18px; display: block; margin-bottom: 4px; }
.daygroup { font-size: 12.5px; font-weight: 700; color: var(--sub); margin: 6px 4px -2px; }

/* ───── 記録 ───── */
.heat { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, auto); grid-template-columns: repeat(var(--weeks, 18), 1fr); gap: 3px; }
.heat i { aspect-ratio: 1; border-radius: 3px; background: var(--bg-2); display: block; }
.heat i.l1 { background: color-mix(in srgb, var(--bronze) 30%, var(--bg-2)); }
.heat i.l2 { background: color-mix(in srgb, var(--bronze) 60%, var(--bg-2)); }
.heat i.l3 { background: var(--bronze); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.bests { display: flex; flex-direction: column; gap: 12px; }
.brow { display: grid; grid-template-columns: 1fr 120px 64px; align-items: center; gap: 10px; }
.brow .n { font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 4px; min-width: 0; }
.brow .n svg { width: 15px; height: 15px; color: var(--ok); }
.brow svg { width: 120px; height: 28px; }
.brow .v { font-family: var(--mono); text-align: right; font-size: 13px; color: var(--ink-2); }
.brow .v b { color: var(--ink); font-size: 16px; }

/* ───── 道具（チューナー） ───── */
.tuner { background: linear-gradient(180deg, var(--board-2), var(--board)); color: var(--board-ink); border-radius: 22px; padding: 18px 16px 16px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.tuner canvas { width: 100%; height: 150px; display: block; }
.tu-note { display: flex; align-items: baseline; gap: 4px; line-height: 1; margin-top: -14px; }
.tu-note b { font-family: var(--display); font-size: 64px; font-weight: 700; }
.tu-note small { font-family: var(--mono); font-size: 18px; color: var(--board-sub); }
.tu-read { font-family: var(--mono); font-size: 13px; color: var(--board-sub); min-height: 20px; text-align: center; }
.tu-read b { color: var(--board-ink); }
.tu-read .in { color: var(--ok); font-weight: 600; }
.tu-strings { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; width: 100%; }
.tu-strings button { height: 54px; border-radius: 12px; border: 1px solid var(--board-line); color: var(--board-ink); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; }
.tu-strings button b { font-family: var(--display); font-size: 19px; font-weight: 700; }
.tu-strings button small { font-family: var(--mono); font-size: 10px; color: var(--board-sub); }
.tu-strings button.near { border-color: var(--bronze-2); background: rgba(241,191,128,.1); }
.tu-strings button.ok { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 18%, transparent); }
.tool-row { display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.tool-row .ic { width: 44px; height: 44px; border-radius: 12px; background: var(--bg-2); display: grid; place-items: center; color: var(--ink-2); }
.tool-row b { display: block; font-weight: 700; }
.tool-row span { font-size: 12.5px; color: var(--sub); }

/* ───── 下の ドック（メトロノーム＋タブ） ───── */
#dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; padding: 0 12px calc(env(safe-area-inset-bottom) + 6px);
  background: linear-gradient(180deg, transparent, var(--bg) 26%); pointer-events: none; }
#dock > * { pointer-events: auto; }
.mini { display: flex; align-items: center; gap: 12px; max-width: 520px; margin: 0 auto 8px; width: 100%; height: 52px; padding: 0 6px 0 16px; border-radius: 999px;
  background: var(--board); color: var(--board-ink); box-shadow: 0 10px 30px -12px rgba(20,10,5,.6); }
.mini-beats { display: flex; gap: 6px; flex: 1; }
.mini-beats i { width: 9px; height: 9px; border-radius: 50%; background: var(--board-line); transition: background .06s, transform .06s; }
.mini-beats i.hit { background: var(--board-ink); transform: scale(1.25); }
.mini-beats i.hit.acc { background: var(--bronze-2); }
.mini-bpm { font-family: var(--mono); display: flex; align-items: baseline; gap: 4px; }
.mini-bpm small { color: var(--board-sub); font-size: 13px; }
.mini-bpm b { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; min-width: 3ch; text-align: right; }
.mini-go { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--bronze); color: var(--on-bronze); }
.mini-go svg { width: 18px; height: 18px; }
#tabs { max-width: 520px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 4px; box-shadow: var(--shadow); }
#tabs button { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 0 5px; border-radius: 16px; color: var(--sub); font-size: 11px; font-weight: 700; }
#tabs button svg { width: 22px; height: 22px; }
#tabs button[aria-current="page"] { color: var(--ink); background: var(--bg-2); }
body.in-player #dock { display: none; }

/* ───── メトロノームの シート ───── */
.sheet { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet-back { position: absolute; inset: 0; background: rgba(10,6,3,.45); backdrop-filter: blur(2px); animation: fade .2s ease-out; }
.sheet-card { position: relative; width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; background: var(--surface); border-radius: 26px 26px 0 0;
  padding: 10px 18px calc(env(safe-area-inset-bottom) + 18px); display: flex; flex-direction: column; gap: 16px; animation: rise .26s cubic-bezier(.2,.8,.2,1); }
.grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line-2); margin: 0 auto 2px; }
@keyframes rise { from { transform: translateY(40px); opacity: .4; } }
@keyframes fade { from { opacity: 0; } }
.metro-face { background: linear-gradient(180deg, var(--board-2), var(--board)); color: var(--board-ink); border-radius: 20px; padding: 14px 14px 16px; display: flex; flex-direction: column; align-items: center; gap: 4px; position: relative; overflow: hidden; }
.metro-face canvas { width: 100%; height: 150px; display: block; }
.metro-bpm { display: flex; align-items: center; justify-content: center; gap: 14px; width: 100%; }
.metro-bpm .val { font-family: var(--mono); font-weight: 600; font-size: 64px; line-height: 1; font-variant-numeric: tabular-nums; min-width: 3.2ch; text-align: center; letter-spacing: -.02em; }
.metro-bpm .step { width: 52px; height: 52px; border-radius: 50%; border: 1px solid var(--board-line); color: var(--board-ink); font-family: var(--mono); font-size: 15px; font-weight: 600; }
.metro-bpm .step:active { background: var(--board-line); }
.metro-name { font-size: 12.5px; color: var(--board-sub); letter-spacing: .1em; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 32px; background: none; }
input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: var(--line-2); }
input[type=range]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--line-2); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 24px; height: 24px; border-radius: 50%; background: var(--bronze); margin-top: -10px; border: 3px solid var(--surface); box-shadow: 0 1px 4px rgba(0,0,0,.3); }
input[type=range]::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: var(--bronze); border: 3px solid var(--surface); }
.metro-face input[type=range]::-webkit-slider-runnable-track { background: var(--board-line); }
.metro-face input[type=range]::-webkit-slider-thumb { border-color: var(--board); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--bg-2); border-radius: 14px; padding: 3px; gap: 2px; }
.seg button { min-height: 38px; border-radius: 11px; font-weight: 700; font-size: 14px; color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .field > .lab { font-size: 12.5px; font-weight: 700; color: var(--sub); letter-spacing: .06em; }
.row { display: flex; gap: 10px; align-items: center; }
.row > .grow { flex: 1; }
.accents { display: flex; gap: 8px; }
.accents button { flex: 1; height: 40px; border-radius: 10px; background: var(--bg-2); display: grid; place-items: center; }
.accents button i { width: 12px; height: 12px; border-radius: 50%; background: var(--line-2); display: block; }
.accents button[data-a="2"] i { background: var(--bronze); width: 16px; height: 16px; }
.accents button[data-a="1"] i { background: var(--ink-2); }
.accents button[data-a="0"] i { background: transparent; border: 1.5px dashed var(--line-2); }

/* ───── 練習の 画面 ───── */
#player { position: fixed; inset: 0; z-index: 40; background: var(--bg); display: flex; flex-direction: column; overflow: hidden; }
.p-top { display: flex; align-items: center; gap: 6px; padding: calc(env(safe-area-inset-top) + 6px) 8px 4px; }
.p-title { flex: 1; min-width: 0; }
.p-title b { font-family: var(--display); font-weight: 700; font-size: 19px; display: block; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-title span { font-size: 12px; color: var(--sub); }
.p-fixed { flex: none; display: flex; flex-direction: column; gap: 8px; padding: 4px 12px 6px; }
.p-fixed > * { flex-shrink: 0; }
.p-body { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding: 6px 12px 12px; border-top: 1px solid var(--line); }
.p-body > * { flex-shrink: 0; }
.board { position: relative; background: var(--board); border-radius: 18px; overflow: hidden; touch-action: pan-y; flex: none;
  box-shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 16px 34px -20px rgba(0,0,0,.7); }
.board canvas { display: block; width: 100%; }
.board .count { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--mono); font-size: 84px; font-weight: 600; color: var(--bronze-2); pointer-events: none; text-shadow: 0 4px 30px rgba(0,0,0,.6); }
.page { background: var(--board); border-radius: 18px; padding: 10px 6px; display: flex; flex-direction: column; gap: 2px; }
.page canvas { display: block; width: 100%; }
.bars { display: flex; gap: 4px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: none; }
.bars::-webkit-scrollbar { display: none; }
.bars button { flex: none; min-width: 54px; height: 58px; padding: 0 4px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; line-height: 1.1; }
.mini-tab { width: 44px; height: 16px; display: block; color: var(--ink-2); }
.mini-tab line { stroke: currentColor; stroke-width: .6; opacity: .28; }
.mini-tab circle { fill: currentColor; }
.bars button.cur .mini-tab, .bars button.play .mini-tab { color: var(--bronze); }
.bars button.play { background: var(--pearl-soft); }
.bars button b { font-size: 13px; font-weight: 700; }
.bars button small { font-family: var(--mono); font-size: 10px; color: var(--sub); }
.bars button.cur { border-color: var(--bronze); box-shadow: 0 0 0 1px var(--bronze) inset; }
.bars button.inloop { background: var(--pearl-soft); border-color: transparent; }
.bars button.inloop small { color: var(--pearl); }
.loopnote { font-size: 12.5px; color: var(--pearl); font-weight: 700; display: flex; align-items: center; gap: 6px; }
.loopnote svg { width: 16px; height: 16px; }
.p-info { display: flex; flex-direction: column; gap: 8px; }
.p-info p { margin: 0; font-size: 14px; color: var(--ink-2); }
.p-info ul { margin: 0; padding-left: 1.1em; font-size: 14px; display: flex; flex-direction: column; gap: 4px; }
.p-info details summary { cursor: pointer; font-weight: 700; font-size: 14px; list-style: none; display: flex; align-items: center; gap: 6px; }
.p-info details summary::before { content: "＋"; font-family: var(--mono); color: var(--bronze); }
.p-info details[open] summary::before { content: "－"; }
.timerbar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 14px; background: var(--bronze-soft); color: var(--bronze); font-weight: 700; font-size: 13.5px; }
.timerbar .t { font-family: var(--mono); margin-left: auto; font-size: 16px; }
.p-dock { border-top: 1px solid var(--line); background: var(--surface); padding: 10px 14px calc(env(safe-area-inset-bottom) + 10px); display: flex; flex-direction: column; gap: 10px; }
.tempo { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; }
.tempo .step { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); font-family: var(--mono); font-weight: 600; font-size: 13px; }
.tempo .mid { display: flex; flex-direction: column; gap: 0; }
.tempo .read { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.tempo .read b { font-family: var(--mono); font-size: 26px; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tempo .read span { font-size: 12px; color: var(--sub); }
.tempo .read span em { font-style: normal; font-family: var(--mono); color: var(--ink-2); }
.tempo .read .goalhit { color: var(--ok); font-weight: 700; }
.transport { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.transport .side { display: flex; gap: 2px; min-width: 0; }
.transport .side.r { justify-content: flex-end; }
.tbtn { flex: 1 1 0; min-width: 0; height: 50px; padding: 0 2px; border-radius: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; color: var(--sub); font-size: 10px; font-weight: 700; white-space: nowrap; letter-spacing: -.02em; }
.tbtn svg { width: 20px; height: 20px; }
.tbtn[aria-pressed="true"] { color: var(--ink); background: var(--bg-2); }
.tbtn.loop[aria-pressed="true"] { color: var(--pearl); background: var(--pearl-soft); }
.tbtn.rec { color: var(--bad); }
.tbtn.rec[aria-pressed="true"] { background: var(--bad); color: var(--surface); }
.play { width: 66px; height: 66px; border-radius: 50%; background: var(--bronze); color: var(--on-bronze); display: grid; place-items: center; box-shadow: 0 8px 20px -8px color-mix(in srgb, var(--bronze) 70%, transparent); }
.play svg { width: 28px; height: 28px; }
.clearask { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; background: var(--pearl-soft); color: var(--ink); font-size: 14px; }
.clearask b { color: var(--pearl); }
.clearask .btn { margin-left: auto; flex: none; }

#toast { position: fixed; left: 50%; bottom: calc(var(--dock-h) + env(safe-area-inset-bottom) + 16px); transform: translate(-50%, 20px); opacity: 0; z-index: 60; pointer-events: none;
  background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 22px; font-size: 14px; font-weight: 700; transition: opacity .2s, transform .2s; width: max-content; max-width: calc(100vw - 32px); text-align: center; line-height: 1.5; }
#toast.on { opacity: 1; transform: translate(-50%, 0); }
body.in-player #toast { bottom: 190px; }

@media (min-width: 760px) {
  .top h1 { font-size: 36px; }
  .p-body, .p-fixed { max-width: 980px; width: 100%; margin: 0 auto; }
  .p-dock > * { max-width: 760px; width: 100%; margin: 0 auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* 指板の 色の かたまりは、暗い テーマで 背景に とけないよう ふちを つける */
.board, .challenge, .metro-face, .tuner, .page, .mini { border: 1px solid var(--board-edge); }
.tu-read small { display: block; font-size: 11.5px; }
.rh-load { padding: 40px 0; text-align: center; color: var(--sub); }
.rh-chart { border-radius: 16px; overflow: hidden; border: 1px solid var(--board-edge); }
.rh-chart canvas { display: block; width: 100%; height: 170px; }
.rh-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--sub); margin-top: -6px; }
.rh-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: 0; }
.rh-legend i.g { background: var(--ok); } .rh-legend i.b { background: var(--bronze-2); } .rh-legend i.r { background: var(--bad); }
.rh-legend i.x { background: var(--sub); border-radius: 1px; height: 3px; vertical-align: 3px; }
.rh-note { font-size: 12.5px; color: var(--sub); margin: -4px 0 0; }

/* ───── TAB を 書く ───── */
#editor { position: fixed; inset: 0; z-index: 40; background: var(--bg); display: flex; flex-direction: column; overflow: hidden; }
.ed-title { font-family: var(--display); font-weight: 700; font-size: 18px; border: 0; background: none; color: var(--ink); padding: 0; width: 100%; outline: none; border-bottom: 1px dashed transparent; }
.ed-title:focus { border-bottom-color: var(--line-2); }
.ed-body { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 4px 12px 10px; }
.ed-tools { display: flex; align-items: center; gap: 6px; }
.ed-chord { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 0 12px; height: 36px; }
.ed-chord span { font-size: 12px; font-weight: 700; color: var(--sub); white-space: nowrap; }
.ed-chord input { border: 0; background: none; font-family: var(--display); font-weight: 700; font-size: 16px; color: var(--ink); width: 100%; min-width: 0; outline: none; }
.ed-grid-wrap { overflow-x: auto; border-radius: 18px; background: var(--board); border: 1px solid var(--board-edge); padding: 8px 6px 10px; }
.ed-grid { display: flex; flex-direction: column; gap: 0; min-width: max-content; }
.ed-row { display: grid; grid-template-columns: 22px repeat(var(--cols), var(--cw, 36px)); align-items: center; }
.ed-row > span { position: sticky; left: 0; z-index: 3; background: var(--board); align-self: stretch; display: grid; place-items: center; }
.ed-grid { position: relative; }
.ed-head i { font-style: normal; height: 18px; position: relative; }
.ed-head i.bl { overflow: visible; white-space: nowrap; font-family: var(--mono); font-size: 10.5px; font-weight: 600; color: var(--board-sub); padding-left: 3px; }
.ed-head i.bl em { font-style: normal; font-family: var(--display); font-weight: 700; font-size: 12.5px; color: var(--board-ink); margin-left: 5px; }
.ed-head i.bl.cur { color: var(--bronze-2); }
.ed-beats i.b0, .ed-row button.b0 { box-shadow: inset 2px 0 0 rgba(201,192,180,.45); }
.ed-arcs { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; z-index: 2; }
.ed-arcs .arc { fill: none; stroke: var(--bronze-2); stroke-width: 1.6; }
.ed-arcs .sl { stroke: var(--bronze-2); stroke-width: 1.8; stroke-linecap: round; }
.ed-arcs text { fill: var(--bronze-2); font: 700 10px "IBM Plex Mono", monospace; text-anchor: middle; }
.ed-zoom { display: flex; align-items: center; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; height: 36px; padding: 0 4px; flex: none; }
.ed-zoom button { width: 30px; height: 30px; border-radius: 50%; font-weight: 700; font-size: 16px; }
.ed-zoom span { font-size: 11.5px; font-weight: 700; color: var(--sub); }
.ed-ops { display: grid; grid-template-columns: 1fr 1fr 1fr 1.15fr 1.15fr 44px; gap: 5px; }
.ed-ops button { height: 34px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-size: 12.5px; font-weight: 700; white-space: nowrap; display: grid; place-items: center; }
.ed-ops button svg { width: 17px; height: 17px; }
.ed-row .sn { font-family: var(--mono); font-size: 11px; color: var(--board-sub); text-align: center; }
.ed-chord span { min-width: 3.6em; }
.ed-beats i { font-style: normal; font-family: var(--mono); font-size: 10.5px; color: var(--board-sub); text-align: center; height: 18px; }
.ed-beats i.on { color: var(--board-ink); font-weight: 600; }
.ed-row button { height: 38px; position: relative; display: grid; place-items: center; }
.ed-row button::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: var(--sw, 1.5px); transform: translateY(-50%); background: var(--sc, #cfc8bd); opacity: .7; }
.ed-row.s1 { --sw: 1px; } .ed-row.s2 { --sw: 1.3px; } .ed-row.s3 { --sw: 1.7px; --sc: #c6a47c; } .ed-row.s4 { --sw: 2.1px; --sc: #c29d72; } .ed-row.s5 { --sw: 2.5px; --sc: #bd966a; } .ed-row.s6 { --sw: 3px; --sc: #b78f62; }
.ed-row button.beat { box-shadow: inset 1px 0 0 var(--board-line); }
.ed-row button.col { background: rgba(241,191,128,.07); }
.ed-row button.now { background: rgba(127,207,196,.16); }
.ed-row button.sel::after { content: ""; position: absolute; inset: 3px 2px; border-radius: 8px; border: 2px solid var(--bronze-2); box-shadow: 0 0 12px rgba(241,191,128,.35); }
.ed-row button b { position: relative; z-index: 1; min-width: 22px; height: 22px; padding: 0 4px; border-radius: 6px; background: var(--chip); color: var(--chip-ink); font-family: "Barlow Semi Condensed", "Arial Narrow", sans-serif; font-weight: 700; font-size: 16px; line-height: 22px; text-align: center; }
.ed-row button.sel b { background: var(--bronze-2); }
.ed-hint { font-size: 12.5px; color: var(--sub); display: flex; flex-wrap: wrap; gap: 2px 10px; }
.ed-hint b { color: var(--ink); }
.ed-hint span { color: var(--sub); opacity: .8; }
.ed-pad { border-top: 1px solid var(--line); background: var(--surface); padding: 8px 10px calc(env(safe-area-inset-bottom) + 8px); display: flex; flex-direction: column; gap: 6px; }
.ed-keys { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.ed-keys button { height: 42px; border-radius: 11px; background: var(--bg-2); font-family: "Barlow Semi Condensed", "Arial Narrow", sans-serif; font-weight: 700; font-size: 19px; color: var(--ink); }
.ed-keys button:active { background: var(--bronze-soft); }
.ed-acts { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1.4fr; gap: 5px; }
.ed-acts button { height: 44px; border-radius: 11px; border: 1px solid var(--line); font-weight: 700; font-size: 14px; display: grid; place-items: center; }
.ed-acts .ed-play { background: var(--bronze); color: var(--on-bronze); border-color: var(--bronze); }
.ed-acts .ed-play svg { width: 18px; height: 18px; }
.ed-acts .ed-go { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.ed-text { width: 100%; min-height: 160px; font-family: var(--mono); font-size: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); padding: 10px; white-space: pre; overflow-x: auto; }
.song.mine { cursor: default; }
.mine-acts { flex-direction: row !important; align-items: center !important; gap: 6px !important; grid-row: 1 / 2 !important; }
@media (min-width: 760px) { .ed-body, .ed-pad > * { max-width: 860px; width: 100%; margin-left: auto; margin-right: auto; } }
body.in-editor #toast { bottom: auto; top: calc(env(safe-area-inset-top) + 64px); }
.ed-acts [data-emv] { font-size: 19px; }
.ed-acts [data-eundo] { font-size: 13px; }

/* 日本語の 折り返し：Chrome は 文節で、ほかは かたまり（.nb）で */
body { word-break: auto-phrase; }
p, li, .clearask span, .why, .empty { text-wrap: pretty; }
.nb { display: inline-block; }
.clearask > span { flex: 1; min-width: 0; line-height: 1.55; }

/* 書く：技の ボタン・数字キー 2段・持って 動かす */
.ed-marks { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.ed-marks button { height: 34px; border-radius: 10px; border: 1px solid var(--line); font-size: 11.5px; font-weight: 700; color: var(--ink-2); display: flex; align-items: center; justify-content: center; gap: 3px; white-space: nowrap; letter-spacing: -.02em; }
.ed-marks button i { font-style: normal; font-family: var(--mono); font-weight: 600; color: var(--bronze); }
.ed-marks button[aria-pressed="true"] { background: var(--bronze); border-color: var(--bronze); color: var(--on-bronze); }
.ed-marks button[aria-pressed="true"] i { color: var(--on-bronze); }
.ed-marks button:disabled { opacity: .4; }
.ed-keys-wrap { position: relative; }
.ed-keys { max-height: calc(42px * 2 + 5px + 16px); overflow-y: auto; scroll-snap-type: y proximity; overscroll-behavior: contain; scrollbar-width: none;
  -webkit-mask-image: linear-gradient(180deg, #000 calc(100% - 22px), rgba(0,0,0,.35)); mask-image: linear-gradient(180deg, #000 calc(100% - 22px), rgba(0,0,0,.35)); }
.ed-keys::-webkit-scrollbar { display: none; }
.ed-keys button { scroll-snap-align: start; }
.ed-more { display: none; position: absolute; right: 4px; bottom: -2px; font-size: 10.5px; font-weight: 700; color: var(--sub); background: var(--surface); padding: 0 6px; border-radius: 6px; pointer-events: none; transition: opacity .2s; }
.ed-row button.has { touch-action: none; cursor: grab; }
.ed-row button.lift b { opacity: .3; }
.ed-row button.drop::after { content: ""; position: absolute; inset: 3px 2px; border-radius: 8px; border: 2px dashed var(--pearl); }
.ed-row button .mk { position: absolute; z-index: 2; left: 1px; top: 2px; font-style: normal; font-family: var(--mono); font-size: 10px; font-weight: 600; color: var(--bronze-2); }
.ed-row button .dot { position: absolute; z-index: 2; bottom: 4px; left: 50%; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--chip); }
.ed-ghost { position: fixed; z-index: 80; transform: translate(-50%, -120%); pointer-events: none; min-width: 30px; height: 30px; padding: 0 6px; border-radius: 8px; background: var(--bronze-2); color: var(--chip-ink);
  font-family: "Barlow Semi Condensed", "Arial Narrow", sans-serif; font-weight: 700; font-size: 20px; line-height: 30px; text-align: center; box-shadow: 0 8px 20px rgba(0,0,0,.4); }

.btn { white-space: nowrap; }
