/* =============================================================================
   変拍子メトロノーム v2 — 全 CSS
   順序: 1 トークン(§6) → 2 ベース → 3 レイアウト(§8) → 4 メイン部品(NowCard / FlowStrip / SectionCard / Dock /
         VolumePop / Toast) → 5 シート基盤 → 6 シート内部品(Chip / MeterBox / HoldStepper / AccentDot / Switch /
         TempoCurveGraph / SliderRow / SectionOps / PresetRow / 共有 / 設定) → 7 レスポンシブ → 8 reduced-motion
   規則: 数値トークンは min-width px 固定 + tabular-nums。色は --sec と 7 派生だけ。点灯は即時、消灯 70ms。
   ============================================================================= */

/* 音符記号(♩ ♪ ♫ ♬ = U+2669〜266C)だけを記号フォントで描く。
   日本語フォント(Yu Gothic UI / Meiryo / Hiragino)の音符は全角幅で、「♩=120」が「♩ =120」に見えて
   仕様 §7.1「= の前後にスペースなし」から外れるため。local() だけなので外部読み込みは発生せず、
   どのフォントも無い端末では unicode-range が無視されて従来どおりのフォールバックになる。 */
@font-face {
  font-family: "NoteSym";
  src: local("Segoe UI Symbol"), local("SegoeUISymbol"), local("Apple Symbols"), local("AppleSymbols"),
       local("Noto Sans Symbols2"), local("NotoSansSymbols2-Regular"), local("Noto Sans Symbols"), local("NotoSansSymbols-Regular");
  unicode-range: U+2669-266C;
}

/* ---------- 1. トークン ---------- */
:root {
  color-scheme: dark;
  --bg: #0f1115; --panel: #181c24; --panel-2: #1f2430; --line: #2a3040;
  --text: #e8ecf4; --text-dim: #8b93a7; --text-far: #b4bccf; --text-faint: #4a5164;
  --on-color: #0f1115; --count-in: #aeb6c8;
  --ink: #e8ecf4; --stop: #ef5350; --danger: #ef5350;
  /* セクション色の正は src/core/constants.js の SECTION_COLORS(app.js が起動時に同じ値を注入する)。ここは初期描画用の同値 */
  --sec-0: #4fc3f7; --sec-1: #ffb74d; --sec-2: #ba68c8; --sec-3: #81c784;
  --sec-4: #f06292; --sec-5: #ffd54f; --sec-6: #64b5f6; --sec-7: #4db6ac;
  --sec: var(--sec-0);
  --line-40: color-mix(in srgb, var(--line) 40%, var(--panel)); /* MiniAccentRow 休 */
  --fs-beat: 96px; --fs-tempo-now: 28px; --fs-tempo-rest: 16px; --fs-timesig-now: 26px; --fs-stepnum: 22px;
  --fs-timesig: 20px; --fs-measure: 20px; --fs-stepval: 19px; --fs-input: 16px; --fs-next: 15px;
  --fs-title: 15px; --fs-body: 14px; --fs-chip: 12px; --fs-sub: 12px; --fs-caption: 11px; --fs-axis: 10px;
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px;
  --r-chip: 8px; --r-ctl: 10px; --r-block: 12px; --r-card: 16px; --r-sheet: 20px; --r-pill: 999px;
  --bw: 1px; --bw-active: 2px; --bar-w: 4px; --frac-w: 1.5px; /* カードの再生中「見た目 2px」は border 1px + box-shadow 1px で描く(#7) */
  --shadow-float: 0 8px 24px rgba(0, 0, 0, .45);
  --t-off: 70ms; --t-pulse: 90ms; --t-chip: 100ms; --t-color: 120ms; --t-move: 160ms; --t-close: 180ms; --t-height: 200ms; --t-open: 240ms;
  /* NowCard の高さ段(§8)。--now-h は中身の行高の合計で、高さそのもの(c01-17 / X09: 306 / ≤699 276 / ≤599 268 = v2 の 284 / 254 / 246 + ラベル行 22)。
     306 = 枠 1×2 + 余白 16×2 + 1 行目 32 + ラベル行 22 + 進行 6+4+8 + 拍 100 + ドット 28 + テンポ 4+36 + テンポバー 4+4 + 次 24。
     ≤699 は拍 76・テンポ 30 で −30、≤599 はドット 24・進行の下 4 で −8。ラベル行(22px・文字 16px)はどの段でも縮めない */
  --now-beat-box: 100px; --now-tempo-row: 36px; --now-dots-row: 28px; --now-progress-mb: 8px;
  --now-label-row: 22px; --fs-now-label: 16px; --now-h: 306px;
  --dock-h: 72px;
  /* 状態行の高さ(c08-01 / X01: タップ域 44、文字の箱 28)。≤699 の段は 40(A30 のタップ下限)。c07-24 の短い画面の値 36 は
     タップ域が 40 を割るので採らず、40 で 360×640 の流れチップ 2 段(64px)までカード 1 枚が完全に見える。3 段(98px)は NowCard 276
     (c01-17 のラベル行 22px)で 4px 足りず、.app が 4px スクロールする(README「縦の予算」) */
  --status-h: 44px;
  --card-h: 96px; /* SectionCard と編集シートの PreviewCard で共用する 1 値(c01-16)。section-list.js の CARD_H も同じ値 */
  --font: "NoteSym", system-ui, -apple-system, "Hiragino Sans", "Yu Gothic UI", Meiryo, sans-serif;
}

/* セクション色の濃淡。--sec を変える要素(:root・NowCard・カード・JS が style で --sec を入れた要素)ごとに計算し直す。
   :root だけで定義すると、子は :root の --sec(A の色)で計算済みの値を受け継ぎ、B のチップや選択中のボタンの地まで A の青になっていた
   (2026-10-16 に見つけて修正)。5% の濃淡はセクション 5(F)の色 --sec-5 と名前がぶつかっていたので --sec-t5 に改名 */
:root, .now-card, .card, [style*="--sec:"] {
  --sec-100: var(--sec);
  --sec-70: color-mix(in srgb, var(--sec) 70%, var(--panel));
  --sec-45: color-mix(in srgb, var(--sec) 45%, var(--line));
  --sec-28: color-mix(in srgb, var(--sec) 28%, var(--panel-2));
  --sec-15: color-mix(in srgb, var(--sec) 15%, var(--panel));
  --sec-t5: color-mix(in srgb, var(--sec) 5%, var(--bg));
  --sec-glow: color-mix(in srgb, var(--sec) 45%, transparent);
  --sec-35: color-mix(in srgb, var(--sec) 35%, var(--panel));   /* MiniAccentRow 弱 */
  --shadow-glow: 0 0 20px var(--sec-glow);
}

/* ---------- 2. ベース ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); }
html { height: 100%; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font); font-size: var(--fs-body); line-height: 1.5;
  overflow: hidden; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  user-select: none; -webkit-user-select: none;
}
input, textarea { user-select: text; -webkit-user-select: text; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.btn.primary:focus-visible { outline-color: var(--text-far); } /* 白い(--ink)ボタンの外に同じ白の枠が並んで埋もれないように */
.sheet-done:focus-visible { outline-offset: -2px; } /* 外側に出すと下辺が本文の sticky 固定部(.edit-fixed)に隠れる(練習設定シートは開くと完了にフォーカス) */
.icon { display: inline-block; vertical-align: -0.15em; flex: none; }
.num, .timesig, .tempo-token, .tok-measures, .tok-duration, .now-counter, .now-beat, .now-tempo,
.stepper-value, .slider-value, .chip, .flow-chip, .tc-lbl, .vol-value, .badge, .next-text, .preset-summary, .preset-meta {
  font-variant-numeric: tabular-nums;
}
[hidden] { display: none !important; }

/* ---------- 3. レイアウト ---------- */
/* 縦の構造(c07-23 主案 A / X09): v2 と同じ grid で height 100dvh。body はスクロールせず(上の overflow:hidden)、
   セクション一覧だけが 1fr の行の中でスクロールする(ドラッグの自動スクロール・追加時の scrollTo も一覧の中で完結)。ドックは最終行。
   行: ヘッダー 48 / ヘッダー直下の行(保存失敗の帯 48、X10。出ていなければ 0)/ 状態行 44(≤699 は 40。c08-01)/ NowCard / 流れチップ /
   一覧 1fr / ドック(72 + safe-area。高さは .dock が持つ)。帯が hidden(display:none)でも後ろの要素が別の行へずれないよう、
   子の行を明示する。375×812 の縦の予算は README「縦の予算」(c07-24)。
   収まらないときの逃げ道: 一覧の行はカード 1 枚分(上余白 8 + 96)より縮めず、その分 .app の中がスクロールし、ドックは画面の下端に
   貼り付く(sticky)。内容が画面に収まる高さでは .app はスクロールせず、ドックも最終行の位置のままなので、見た目は純粋な grid と同じ。
   高さの閾値(max-height の段)で切り替えないのは、帯 48・初回ヒント 20・流れチップ 3 段 +68 の組み合わせで足りなくなる高さが変わるため
   (固定の行だけで決めた 563px 以下の段にすると、帯 + チップ 3 段の約 570px で ▶ が画面の外に出て、8 セクション + ヒントの 360×640 で一覧が 84px になりカード 0 枚)。
   横向きのスマホ(812×375 など)もこの形で ▶ を押せる。横向きの配置そのものは c07-01 */
.app {
  display: grid; grid-template-rows: 48px auto var(--status-h) auto auto minmax(calc(var(--sp-2) + var(--card-h)), 1fr) auto; grid-template-columns: minmax(0, 1fr);
  height: 100dvh; max-width: 600px; margin: 0 auto; padding: 0 var(--sp-4);
  padding-top: env(safe-area-inset-top);
  overflow-y: auto; overscroll-behavior: contain;
  /* .app がスクロールする低い画面で、フォーカスによるスクロール(編集シートを閉じてカードへ戻る c02-23)がカードを貼り付いたドックの裏に止めない。
     値はドックの高さ(.dock の height と同じ式) */
  scroll-padding-bottom: calc(var(--dock-h) + env(safe-area-inset-bottom));
}
.app > .app-header { grid-row: 1; }
.app > .save-band { grid-row: 2; }
.app > .status-line { grid-row: 3; }
.app > .now-card { grid-row: 4; }
.app > .flow-area { grid-row: 5; }
.app > .section-list { grid-row: 6; }
.app > .dock { grid-row: 7; position: sticky; bottom: 0; z-index: 20; }
.app-header { display: flex; align-items: center; justify-content: space-between; height: 48px; }
.app-title { font-size: var(--fs-title); font-weight: 700; margin: 0; letter-spacing: .02em; }
.header-actions { display: flex; gap: var(--sp-1); }
.icon-btn {
  width: 44px; height: 44px; border-radius: var(--r-ctl); display: inline-flex; align-items: center; justify-content: center;
  color: var(--text);
}
.icon-btn:active { background: var(--panel-2); }
/* 端の ‹ › など「今は押せない」アイコンボタン: 消さずに減光して幅と位置を保つ(フォーカスは残す) */
.icon-btn[aria-disabled="true"] { opacity: .35; cursor: default; }
.icon-btn[aria-disabled="true"]:active { background: none; }

/* ---------- 4-1. NowCard(§4.2 / §3.7) ---------- */
/* 高さは段ごとの --now-h で固定する(c01-17。A13・B42。以前の v3.css の min-height:300px は ≤699 / ≤599 の段を打ち消していた H-4、
   c07-24 では下限だった)。中身は固定高の行だけで合計が --now-h と同じなので、停止・カウントイン・再生で高さも行の位置も変わらない */
.now-card {
  position: relative; border: var(--bw) solid var(--line); border-radius: var(--r-sheet); background: var(--panel);
  height: var(--now-h); padding: var(--sp-4); pointer-events: none; display: flex; flex-direction: column;
  transition: border-color var(--t-color), box-shadow var(--t-color);
  --sec: var(--sec-0);
}
.now-card.playing { border: var(--bw-active) solid var(--sec); padding: calc(var(--sp-4) - 1px); }   /* 2 + 15 = 1 + 16: 内容位置・高さ不変 */
.now-card.countin { border: var(--bw-active) solid var(--count-in); padding: calc(var(--sp-4) - 1px); }
/* 小節頭グロー(c07-05): 立ち上がり --t-glow-rise → 減衰 --t-glow-decay。now-card.js が小節頭ごとに拍間隔(倍率後)から
   min(180, 拍間隔 × 0.4) / min(200, 拍間隔 × 0.3) を入れる(拍数に関わらず。合計 ≤ 拍間隔 × 0.7)。拍間隔 < 150ms のセクションでは付けない */
.now-card.downbeat { animation: now-glow var(--t-glow-decay, 200ms) ease-out var(--t-glow-rise, 180ms) 1 both, now-glow-in var(--t-glow-rise, 180ms) ease-out 1; }
@keyframes now-glow-in { from { box-shadow: 0 0 0 var(--sec-glow); } to { box-shadow: var(--shadow-glow); } }
@keyframes now-glow { from { box-shadow: var(--shadow-glow); } to { box-shadow: 0 0 0 transparent; } }
.now-row1 { display: flex; align-items: center; justify-content: space-between; height: 32px; }
.now-id { display: inline-flex; align-items: center; gap: var(--sp-2); }
.now-timesig { font-size: var(--fs-timesig-now); font-weight: 800; min-width: 80px; text-align: right; line-height: 1; color: var(--text); transition: color var(--t-color); }
.now-card.playing .now-timesig { color: var(--sec); }
.now-card.countin .now-timesig { color: var(--count-in); }
.now-counter { font-size: var(--fs-measure); font-weight: 700; min-width: 128px; text-align: right; color: var(--text-far); line-height: 1; }
.now-progress { height: 4px; margin: 6px 0 var(--now-progress-mb); display: flex; gap: 2px; }
.now-progress .seg { flex: 1; position: relative; background: var(--panel-2); border-radius: 1px; overflow: hidden; }
.now-progress .seg b { position: absolute; inset: 0; background: var(--sec-70); transform: scaleX(0); transform-origin: left; }
.now-progress .seg.tc-mark::before { content: ""; position: absolute; left: 0; top: -2px; bottom: -2px; border-left: 1px dashed var(--sec); z-index: 1; }
.now-progress.cont { position: relative; background: var(--panel-2); border-radius: 2px; overflow: hidden; }
.now-progress.cont b { position: absolute; inset: 0; background: var(--sec-70); transform: scaleX(0); transform-origin: left; }
.now-progress.cont .tc-mark-cont { position: absolute; top: -2px; bottom: -2px; border-left: 1px dashed var(--sec); }
.now-card.countin .now-progress b { transform: scaleX(0) !important; }
/* 末尾 4px の次セクション色(c01-10)。now-card.js が区間の最後の小節の .seg(N≤16)か .cont(left を指定)に入れ、--sec を次セクション色にする */
.now-progress .next-tail { position: absolute; top: 0; bottom: 0; right: 0; width: 4px; background: var(--sec); }
.now-progress.cont .next-tail { right: auto; }
/* 繰り返す範囲の外の小節(c01-27): 区切りを .3。連続バー(N>16)は範囲外の左右だけをマスクで .3 にする */
.now-progress .seg.out { opacity: .3; }
.now-progress.cont.range-out {
  -webkit-mask-image: linear-gradient(to right, rgb(0 0 0 / .3) var(--out-a), #000 var(--out-a), #000 var(--out-b), rgb(0 0 0 / .3) var(--out-b));
  mask-image: linear-gradient(to right, rgb(0 0 0 / .3) var(--out-a), #000 var(--out-a), #000 var(--out-b), rgb(0 0 0 / .3) var(--out-b));
}
.now-beat {
  height: var(--now-beat-box); width: 160px; margin: 0 auto; display: flex; align-items: center; justify-content: center;
  font-size: var(--fs-beat); font-weight: 800; line-height: 1; color: var(--text-faint);
}
.now-card.playing .now-beat { color: var(--sec); text-shadow: 0 0 24px var(--sec-glow); }
.now-card.countin .now-beat { color: var(--count-in); text-shadow: none; }
.now-beat.pulse { animation: beat-pulse var(--t-pulse) ease-out 1; } /* 拍間隔 < 150ms のセクションでは now-card.js が付けない(c07-05) */
@keyframes beat-pulse { from { transform: scale(1.06); } to { transform: scale(1); } }
.now-dots { height: var(--now-dots-row); display: flex; align-items: center; justify-content: center; gap: 20px; }
.now-dots .dots-group { display: inline-flex; gap: 8px; }
.now-dots .dot {
  display: block; width: 18px; height: 18px; border-radius: 50%; background: var(--line); border: 2px solid transparent;
  transition: transform var(--t-off), background-color var(--t-off), box-shadow var(--t-off), opacity var(--t-off);
}
.now-dots .dot.lv2 { border-color: var(--sec); background: var(--panel-2); }
.now-dots .dot.lv0 { opacity: .3; }
.now-dots .dot.on { transition: none; background: var(--sec); border-color: var(--sec); transform: scale(1.4); box-shadow: 0 0 12px var(--sec-glow); }
.now-card.countin .now-dots .dot.on { background: var(--count-in); border-color: var(--count-in); box-shadow: none; }
.now-card.countin .now-dots .dot.lv2 { border-color: var(--count-in); }
.now-dots.sz-m { gap: 16px; } .now-dots.sz-m .dots-group { gap: 6px; } .now-dots.sz-m .dot { width: 14px; height: 14px; }
.now-dots.sz-s { gap: 10px; } .now-dots.sz-s .dots-group { gap: 4px; } .now-dots.sz-s .dot { width: 10px; height: 10px; border-width: 1.5px; }
.now-dots.sz-xs { gap: 6px; } .now-dots.sz-xs .dots-group { gap: 2px; } .now-dots.sz-xs .dot { width: 8px; height: 8px; border-width: 1.5px; }
.now-tempo { height: var(--now-tempo-row); margin-top: var(--sp-1); display: grid; grid-template-columns: 1fr 140px 140px 1fr; align-items: baseline; }
/* now は右端(140px 列の右)を固定して 1 行で出す。最長の「≈ ♪.=133」(28px で約 144px)は左の 1fr 側へはみ出させ、右の rest 列には重ねない(c03-02) */
.now-tempo-now { grid-column: 2; justify-self: end; white-space: nowrap; text-align: right; font-size: var(--fs-tempo-now); font-weight: 800; color: var(--sec); line-height: 1; padding-right: 6px; transition: color var(--t-color); }
.now-tempo-rest { grid-column: 3; text-align: left; font-size: var(--fs-tempo-rest); color: var(--text-far); line-height: 1; white-space: nowrap; }
/* 右の欄が無いセクション(4/4 の ♩=120 など)は、今のテンポを 2 列にまたがせてカードの真ん中に置く(now-card.js の .solo) */
.now-tempo.solo .now-tempo-now { grid-column: 2 / 4; justify-self: center; padding-right: 0; }
.now-tempo.solo .now-tempo-rest { display: none; }
.now-card.countin .now-tempo-now { color: var(--count-in); }
.now-tempo-bar { height: 4px; width: 160px; margin: 4px auto 0; border-radius: 2px; background: var(--panel-2); visibility: hidden; overflow: hidden; position: relative; }
.now-tempo-bar.show { visibility: visible; }
.now-tempo-bar i { position: absolute; inset: 0; background: var(--sec); transform: scaleX(0); transform-origin: left; display: block; }
.now-next { height: 24px; margin-top: auto; display: flex; align-items: center; column-gap: var(--sp-1); font-size: var(--fs-next); color: var(--text-dim); border-radius: 8px; padding: 0 var(--sp-2); }
/* 左スロットはインライン文脈(block)にする: 「次: (B) 7/8」の半角スペースが flex で消えず、ellipsis も実際に効く(#6 / #16) */
.next-left { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; line-height: 24px; }
.next-left .badge { vertical-align: middle; margin: 0; }
/* 毎小節「あと N 小節」(c01-10)。「あと 12 小節」(スマホの字形で ≈ 85px)が入る 88px を全状態で固定し、停止中は空のまま幅を保つ。
   min-width:0 で中身に押し広げさせない(数字の幅が広い字形でも左の本文の幅が桁数で揺れない。はみ出す 1〜2px は行の左右余白 8px に入る)。
   本文(省略の … を含む)と「あと」がくっつかないよう、行に 4px の column-gap を置く */
.next-right { flex: 0 0 88px; min-width: 0; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.now-next.lit { color: var(--sec); background: var(--sec-15); }
.now-next.lit .next-prefix, .now-next.lit .next-loop { color: var(--sec); }

/* ---------- 4-2. Badge / トークン(§4.1) ---------- */
.badge {
  display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; flex: none;
  background: var(--sec); color: var(--on-color); font-weight: 800; line-height: 1;
}
.badge-18 { width: 18px; height: 18px; font-size: 10px; }
.badge-26 { width: 26px; height: 26px; font-size: 13px; }
.badge-30 { width: 30px; height: 30px; font-size: 15px; }
/* 2 字の名前(AA〜FF、セクション 27 個目から)。丸の大きさは変えず、字を 8 割に詰める(18px の丸で 8px・30px の丸で 12px) */
.badge.wide { font-size: 0.8em; letter-spacing: -0.04em; }
.badge-18.wide { font-size: 8px; }
.badge-26.wide { font-size: 11px; }
.badge-30.wide { font-size: 12px; }
.now-card .badge { transition: background-color var(--t-color); } /* セクション切替の色遷移 120ms(§5.2)。カード側は対象外 */
.now-card.countin .badge-30 { background: var(--count-in); }
.timesig { min-width: 60px; text-align: right; font-size: var(--fs-timesig); font-weight: 800; line-height: 1; }
.tempo-token { flex: 1 1 auto; min-width: 112px; font-size: var(--fs-body); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1; }
.tempo-dir { font-size: var(--fs-caption); font-weight: 700; color: var(--sec); margin-left: 4px; }
.tok-measures { min-width: 56px; font-size: var(--fs-sub); color: var(--text-dim); white-space: nowrap; }
.tok-duration { min-width: 64px; font-size: var(--fs-sub); color: var(--text-dim); white-space: nowrap; }
.card-row2 .sep { color: var(--text-faint); margin: 0 4px; font-size: var(--fs-sub); }
.mini-accents { height: 8px; display: flex; align-items: center; gap: 10px; }
.mini-group { display: inline-flex; gap: 4px; }
.mini-dot { display: block; width: 8px; height: 8px; border-radius: 50%; background: var(--sec-45); transition: transform var(--t-off), background-color var(--t-off); }
.mini-dot.lv2 { background: var(--sec); }
.mini-dot.lv1 { background: var(--sec-35); }
.mini-dot.lv0 { background: var(--line-40); }
.mini-dot.on { transition: none; background: #fff; transform: scale(1.3); }
.mini-more { font-size: 10px; color: var(--text-dim); line-height: 8px; }
.mini-curve { width: 48px; height: 32px; display: block; overflow: visible; }
.mini-curve .mc-flat { stroke: var(--line); stroke-width: 2; fill: none; }
.mini-curve .mc-line { stroke: var(--sec); stroke-width: 2; fill: none; }
.mini-curve .mc-ph { stroke: #fff; stroke-width: 5; fill: none; }

/* ---------- 4-3. FlowStrip(§4.3) ---------- */
.flow-area { padding: 3px 0; }
.flow-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; min-height: 30px; min-width: 0; }
.flow-chips { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.flow-chip {
  height: 30px; min-width: 72px; padding: 0 10px; border-radius: var(--r-chip); font-size: var(--fs-chip); font-weight: 700; white-space: nowrap; /* 72 = 最長「▶︎ H ×99」≈ 71.2 を含む */
  border: var(--bw) solid var(--sec-45); background: var(--sec-15); color: var(--text); position: relative;
  transition: background-color var(--t-chip), color var(--t-chip), border-color var(--t-chip), opacity var(--t-chip);
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: manipulation;
}
.flow-chip::before { content: ""; position: absolute; left: 0; right: 0; top: -5px; bottom: -5px; } /* タップ領域 40 */
.flow-chip.active, .flow-chip.tapped { background: var(--sec); border-color: var(--sec); color: var(--on-color); }
.flow-chip.countin { background: transparent; border-color: var(--sec); }
.flow-chip.solo { box-shadow: 0 0 0 2px var(--sec); }
.flow-chip.dimmed { opacity: .4; } /* 繰り返す範囲の外(c01-27: ソロにも小節範囲にも同じ。flow-strip.js が practiceMarks で付ける) */
/* 繰り返す範囲が途中から / 途中までのチップ(c01-27): 左 / 右の縁に 3px の --ink 線。枠の上に重ねて描くので幅・文字位置は変わらない */
.flow-chip::after { content: ""; position: absolute; inset: calc(-1 * var(--bw)); border-radius: inherit; border: 0 solid var(--ink); pointer-events: none; }
.flow-chip.cut-start::after { border-left-width: 3px; }
.flow-chip.cut-end::after { border-right-width: 3px; }
.flow-arrow { color: var(--text-dim); font-size: var(--fs-chip); }
/* セクションが 9 個以上(flow-strip.js の .many): チップを 1 段の横スクロールにし、↻ チップはスクロールの外の右端に置く。
   スクロールの箱は上下を切るので、チップの上下 5px のタップ領域が切れないよう上下に 5px 足して同じだけ外へ戻す。
   右に続きがあるあいだ(.more)は右端 24px を薄く消して、横に送れることを示す。スクロールバーは出さない */
.flow-strip.many { flex-wrap: nowrap; }
.flow-strip.many .flow-chips {
  flex: 1 1 auto; min-width: 0; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain;
  padding: 5px 0; margin: -5px 0; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.flow-strip.many .flow-chips::-webkit-scrollbar { display: none; }
.flow-strip.many.more .flow-chips { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent); }
.flow-strip.many .flow-loop-chip { flex: none; }
/* ↻ 繰り返す範囲チップ(c01-03 / X02): 幅 96 固定で「↻ 全体 / ↻ B だけ / ↻ B 2〜C 1」(状態行の範囲スロットと同じ formatLoopRange の短形)。
   状態で幅・高さ・位置が変わらない。通常チップと同じ高さ 30・角丸・枠 1px・12px w700 で塗りなし、文字はどの状態でも --text-dim(仕様どおり)。
   文字域は 96 − 枠 1×2 − 左右 4×2 = 86 で、状態行の範囲スロット(86、styles/v3.css)と同じ幅・同じ字間 −0.03em にそろえた。
   12px w700・字間込みの実測(ヘッドレス Chrome の字形): 「↻ B 2〜C 1」66.0、「↻ B 12〜C 10」82.0、最長の「↻ H 99〜H 99」84.1 まで
   … にならずに入る(通常チップの左右 10px や 6px では最長が切れる)。左寄せにして、どの状態でも「↻」の位置を動かさない。
   溢れの … は字形の広い環境の保険で、内側の .flow-loop-text で切る(ボタンを overflow:hidden にすると .flow-chip::before の
   上下 5px が切れてタップ領域が 30 に縮む)。
   全体以外は範囲の先頭セクション色の枠「見た目 2px」= border 1px + inset 1px(枠を太らせても文字位置を動かさない)。
   inset も枠の色と同じ 100ms で出入りさせる(片方だけ瞬時だと、切り替えの 1 フレームに「色 1px + 灰 1px」の枠が見える) */
.flow-loop-chip {
  width: 96px; min-width: 96px; padding: 0 var(--sp-1); text-align: left; letter-spacing: -0.03em;
  border-color: var(--line); background: transparent; color: var(--text-dim);
  transition: background-color var(--t-chip), color var(--t-chip), border-color var(--t-chip), opacity var(--t-chip), box-shadow var(--t-chip);
}
.flow-loop-text { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flow-loop-chip.on { border-color: var(--sec); box-shadow: inset 0 0 0 1px var(--sec); }
.flow-loop-chip.on:active { background: var(--panel-2); } /* 押せるときだけ押下中の背景(状態行のスロットと同じ --panel-2) */
.flow-loop-chip[aria-disabled="true"] { cursor: default; }
.flow-hint { height: 20px; line-height: 20px; font-size: var(--fs-caption); color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: opacity var(--t-height); }
.flow-hint.gone { opacity: 0; }

/* ---------- 4-4. セクション一覧 / SectionCard(§4.3) ---------- */
.section-list { overflow-y: auto; overscroll-behavior: contain; padding: var(--sp-2) 0 var(--sp-3); -webkit-overflow-scrolling: touch; }
.section-cards { display: flex; flex-direction: column; gap: 8px; }
.card {
  --sec: var(--sec-0);
  position: relative; height: var(--card-h); border-radius: var(--r-card); background: var(--panel); border: var(--bw) solid var(--line);
  display: grid; grid-template-columns: 4px 1fr 44px; overflow: hidden;
  transition: border-color var(--t-color), box-shadow var(--t-color), transform var(--t-move), height var(--t-height), margin var(--t-height), opacity var(--t-height);
}
.card-preview { grid-template-columns: 4px 1fr; }
/* ⋮⋮ で並べ替えたカード(section-list.js の flashCard): 新しい位置で枠を一瞬セクション色に光らせる(動きを減らす設定では色だけ) */
.card.just-moved { animation: card-moved 900ms ease-out; }
@keyframes card-moved { 0%, 40% { border-color: var(--sec); box-shadow: 0 0 0 2px var(--sec), var(--shadow-glow); } 100% { border-color: var(--line); box-shadow: none; } }
@media (prefers-reduced-motion: reduce) { .card.just-moved { animation-duration: 600ms; } }
.card-band { background: var(--sec); }
.card-body:focus-visible { outline-offset: -2px; }
/* 縦の固定配分(c01-16): 枠 1 + 余白 9 + ラベル行 16 + 4 + row1 20 + 6 + row2 16 + 6 + ドット 8 + 余白 9 + 枠 1 = 96(--card-h)。
   上から詰める(flex-start)ので、ラベル行(空でも 16px を保つ固定スロット)の有無で行の位置は変わらない */
.card-body { position: relative; padding: 9px 6px 9px 10px; display: flex; flex-direction: column; justify-content: flex-start; min-width: 0; cursor: pointer; }
.card-body > * { flex: none; }
.card-label { height: 16px; line-height: 16px; margin-bottom: 4px; padding-right: 56px; } /* 右 56 は MiniCurve の場所(row1 / row2 と同じ) */
.card-row1 { height: 20px; display: flex; align-items: center; gap: 8px; padding-right: 56px; min-width: 0; }
.card-row2 { height: 16px; display: flex; align-items: center; padding-right: 56px; margin-top: 6px; }
.card .mini-accents { margin-top: 6px; }
.card .mini-curve { position: absolute; right: 6px; top: 9px; } /* 上端はラベル行の上端にそろえる */
.card.playing { border-color: var(--sec); box-shadow: 0 0 0 1px var(--sec), var(--shadow-glow); } /* 枠幅は 1px のまま。外側 1px を box-shadow で描き中身をずらさない */
.card.lifting { z-index: 2; box-shadow: var(--shadow-float); transition: box-shadow var(--t-color); }
.card.removing { height: 0; margin-top: -8px; opacity: 0; border-width: 0; }
.card.entering { height: 0; margin-top: -8px; opacity: 0; }
.drag-handle { display: flex; align-items: center; justify-content: center; color: var(--text-dim); touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; cursor: grab; }
.drag-handle.grabbing { color: var(--text); cursor: grabbing; }
.add-btn {
  width: 100%; height: 48px; margin-top: 8px; border: var(--bw) dashed var(--line); border-radius: 14px; color: var(--text-dim); font-size: var(--fs-body);
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.add-btn:active { background: var(--panel); }

/* ---------- 4-5. Dock / VolumePop / Toast(§4.4) ---------- */
.dock {
  height: calc(var(--dock-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  margin: 0 calc(-1 * var(--sp-4)); box-shadow: 0 -1px 0 var(--line); background: var(--panel); /* 上線は box-shadow(内容高 72 を保ち PlayButton 72 が整数位置に) */
  display: flex; align-items: center; justify-content: space-evenly;
}
.dock-slot { display: flex; align-items: center; justify-content: center; }
.dock-slot:nth-child(1), .dock-slot:nth-child(3) { width: 96px; }
.dock-slot:nth-child(2) { width: 72px; }
.dock-pill {
  width: 96px; height: 44px; border-radius: var(--r-pill); border: var(--bw) solid var(--line); color: var(--text-dim);
  display: inline-flex; align-items: center; justify-content: center; gap: 4px; font-size: var(--fs-chip); font-weight: 600; white-space: nowrap;
  transition: border-color var(--t-chip), color var(--t-chip);
}
.dock-pill.on, .dock-pill.open { border-color: var(--ink); color: var(--text); }
.dock-ci-icon, .dock-vol-icon, .play-icon { display: inline-flex; align-items: center; }
.play-btn {
  width: 72px; height: 72px; border-radius: 50%; background: var(--ink); color: var(--on-color);
  display: inline-flex; align-items: center; justify-content: center; transition: transform 80ms, background-color var(--t-chip);
}
.play-btn .icon { margin-left: 3px; }
.play-btn.playing { background: var(--stop); color: #fff; }
.play-btn.playing .icon { margin-left: 0; }
.play-btn:active { transform: scale(.96); }
/* ポップオーバー(pop.js。音量ポップと状態行の倍率ポップ(c04-01、styles/v3.css の .rate-pop)の共通部品):
   背景 --panel-2・角丸 12・影・開閉 120ms(opacity と 8px の移動)。位置・寸法・移動の向きは各ポップが持つ */
.pop {
  z-index: 30; border-radius: var(--r-block); background: var(--panel-2); box-shadow: var(--shadow-float);
  opacity: 0; transform: translateY(8px); transition: opacity var(--t-color), transform var(--t-color);
}
.pop.show { opacity: 1; transform: translateY(0); }
.volume-pop {
  position: fixed; width: 240px; height: 48px;
  bottom: calc(var(--dock-h) + env(safe-area-inset-bottom) + 8px); right: max(var(--sp-4), calc((100vw - 600px) / 2 + var(--sp-4)));
  display: flex; align-items: center; gap: 8px; padding: 0 12px;
}
.vol-pop-icon { color: var(--text-dim); }
.vol-range { flex: 1; height: 44px; margin: 0; accent-color: var(--ink); }
.vol-value { width: 40px; text-align: right; font-size: var(--fs-sub); color: var(--text); }
.toast {
  position: fixed; z-index: 40; left: 50%; transform: translate(-50%, 8px); bottom: calc(var(--dock-h) + env(safe-area-inset-bottom) + 12px);
  height: 44px; max-width: 90%; padding: 0 var(--sp-4); border-radius: var(--r-pill); background: var(--panel-2); box-shadow: var(--shadow-float);
  display: flex; align-items: center; gap: 12px; font-size: var(--fs-body); white-space: nowrap; opacity: 0;
  visibility: hidden; pointer-events: none; /* aria-live 領域は常に DOM 上に置く(display:none にしない)。非表示時はクリックを通す */
  transition: opacity var(--t-close), transform var(--t-close), visibility 0s linear var(--t-close);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); visibility: visible; pointer-events: auto; transition-delay: 0s; }
/* 文言の改行(\n)だけを残す(折り返しはしない)。2 行の文言(共有の受信 c05-20)も高さ 44 のまま 18 × 2 = 36px に収める。
   1 行の文言は今までどおり上下中央で、溢れた行は … で切る */
.toast-msg { overflow: hidden; text-overflow: ellipsis; white-space: pre; line-height: 18px; }
.toast-btn { height: 44px; padding: 0 4px; color: var(--ink); font-weight: 700; flex: none; }

/* ---------- 5. シート基盤(§4.5 / §5.3) ---------- */
body.sheet-open { overflow: hidden; }
.sheet-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(5, 7, 10, .4); opacity: 0; transition: opacity var(--t-open); }
.sheet-backdrop.open { opacity: 1; }
.sheet {
  position: fixed; z-index: 60; left: 50%; bottom: 0; width: 100%; max-width: 600px; transform: translate(-50%, 100%);
  background: var(--panel); border-radius: var(--r-sheet) var(--r-sheet) 0 0; box-shadow: var(--shadow-float);
  display: flex; flex-direction: column; max-height: 92dvh; transition: transform var(--t-open) cubic-bezier(.2, .8, .2, 1), height var(--t-move);
  padding-bottom: env(safe-area-inset-bottom);
}
.sheet.open { transform: translate(-50%, 0); }
.sheet:not(.open) { transition-duration: var(--t-close); transition-timing-function: ease-in; }
.sheet.dragging { transition: none; }
.sheet.sizing-tall { height: 78dvh; max-height: 94dvh; }
.sheet.sizing-tall.expanded { height: 94dvh; }
.sheet-handle-zone { height: 28px; display: flex; align-items: center; justify-content: center; touch-action: none; cursor: grab; flex: none; }
.sheet-handle { width: 40px; height: 4px; border-radius: 2px; background: var(--line); display: block; }
.sheet-header { height: 48px; flex: none; display: flex; align-items: center; justify-content: space-between; padding: 0 var(--sp-2) 0 var(--sp-4); }
.sheet-title { display: flex; align-items: center; gap: 8px; font-size: var(--fs-title); font-weight: 700; min-width: 0; }
.sheet-title-inner { display: inline-flex; align-items: center; gap: 8px; }
.sheet-done { height: 44px; padding: 0 12px; color: var(--ink); font-weight: 700; }
.sheet-body { flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; padding: 0 var(--sp-4) var(--sp-6); -webkit-overflow-scrolling: touch; }
.sheet-footnote { color: var(--text-dim); font-size: var(--fs-caption); line-height: 1.7; margin: 12px 0 0; }
.sheet-divider { border: 0; border-top: var(--bw) solid var(--line); margin: 12px 0; }

/* ---------- 6-1. 汎用ボタン / ラベル ---------- */
.btn {
  height: 40px; padding: 0 14px; border-radius: var(--r-ctl); border: var(--bw) solid var(--line); background: var(--panel-2); color: var(--text);
  font-size: var(--fs-body); font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap;
  transition: background-color var(--t-chip), border-color var(--t-chip), color var(--t-chip);
}
.btn:active { background: var(--line); }
.btn.primary { background: var(--ink); color: var(--on-color); border-color: var(--ink); }
.btn.danger { color: var(--danger); }
.btn.sec-on { background: var(--sec-28); border-color: var(--sec); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .35; pointer-events: none; }
.btn.block { width: 100%; }
.link-btn { height: 40px; color: var(--text); font-size: var(--fs-sub); display: inline-flex; align-items: center; gap: 6px; padding: 0 4px; }
.link-btn[disabled] { opacity: .35; }
.preview-actions { display: flex; gap: 8px; margin-top: 8px; }
.preview-actions .btn { flex: 1; }
/* 「↻ ここだけ繰り返す」⇔「↻ ここだけ繰り返し中」で幅が動かないよう、長い方(実測 175.7px)を含む幅に固定する(c08-08)。
   421px 以上では左の ■ スロット 44 + 間 8×2(c02-24)を引いても、隣の「▶ ここから再生」(実測 135.3px)は残り 153px 以上に収まる。
   420px 以下は 7 章の段で 12px に縮める */
.preview-actions .btn.solo-btn { min-width: 176px; }
/* ■ 停止のスロット(c02-24): ボタン行の左端に幅 44px を常設し、再生中(カウントイン中を含む)だけ ■ を入れる。停止中は空のまま幅を
   確保し、▶ / ↻ の位置と幅を状態で動かさない。高さは隣の .btn と同じ 40 で、行(と固定プレビュー部)の高さを変えない。
   ■ は隣と同じ .btn の枠(c07-11 の secondary = .btn + SVG 14)で、記号だけ --stop(ドックの ■ と同じ色) */
.preview-actions .stop-slot { flex: none; width: 44px; height: 40px; }
.preview-actions .btn.stop-btn { width: 100%; padding: 0; color: var(--stop); } /* padding 0 は ≤420px の段の左右 10px より優先 */
.section-label { display: flex; align-items: center; gap: 6px; font-size: var(--fs-caption); color: var(--text-dim); margin: 14px 0 6px; }
.section-label .icon { width: 13px; height: 13px; }
.section-label .tag { color: var(--sec); font-weight: 700; }

/* ---------- 6-2. Chip(§4.5) ---------- */
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  height: 30px; min-width: 48px; padding: 0 10px; border-radius: var(--r-chip); font-size: var(--fs-chip); font-weight: 600; white-space: nowrap; position: relative;
  border: var(--bw) solid var(--line); background: var(--panel-2); color: var(--text);
  transition: background-color var(--t-chip), border-color var(--t-chip);
}
.chip::before { content: ""; position: absolute; left: 0; right: 0; top: -5px; bottom: -5px; }
.chip.selected { background: var(--sec-28); border-color: var(--sec); }
.chip.ink.selected { background: var(--panel-2); border-color: var(--ink); }
.chip-48 { min-width: 48px; } .chip-64 { min-width: 64px; } .chip-76 { min-width: 76px; padding: 0 8px; } .chip-80 { min-width: 80px; } /* chip-76: 5 文字 × 12 + 16 = 76 に収める */
/* chip-104(c02-13 の等式チップ「♩=♩. → ♪=360」): 3 枚 + 間 6×2 = 324 が 360px の内幅 328 に入る固定幅。文言が長くても伸ばさない */
.chip-104 { width: 104px; min-width: 104px; flex: none; padding: 0 3px; }
.chip[disabled] { opacity: .35; }

/* ---------- 6-3. MeterBox ---------- */
.meter-box { border: var(--bw) solid var(--line); border-radius: var(--r-block); padding: 12px; background: var(--panel-2); }
.meter-top { display: flex; align-items: center; gap: 8px; }
.meter-top .stepper { flex: 1; }
.meter-top .stepper-value { font-size: var(--fs-stepnum); font-weight: 800; color: var(--sec); }
.meter-side-label { width: 72px; text-align: right; font-size: var(--fs-axis); color: var(--text-dim); flex: none; }
.meter-frac { border: 0; border-top: var(--frac-w) solid var(--sec-45); margin: 9px 0; }
.meter-bottom { display: flex; align-items: center; gap: 8px; }
/* 1 拍の音符 2 / 4 / 8 / 16 / 32 の 5 つ(32 は 2026-10-16 に追加。360px でも 1 つ 41px 幅) */
.meter-seg { flex: 1; display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; height: 36px; }
.seg-btn { position: relative; border: var(--bw) solid var(--line); border-radius: var(--r-chip); background: var(--panel); font-size: var(--fs-body); font-weight: 700; transition: background-color var(--t-chip), border-color var(--t-chip); }
.seg-btn::before { content: ""; position: absolute; left: 0; right: 0; top: -2px; bottom: -2px; } /* タップ領域 36 → 40 */
.seg-btn.selected { background: var(--sec-28); border-color: var(--sec); }

/* ---------- 6-4. HoldStepper(§4.5 / §5.4) ---------- */
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper-btn {
  width: 44px; height: 44px; flex: none; border-radius: var(--r-ctl); border: var(--bw) solid var(--line); background: var(--panel-2);
  font-size: 18px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.stepper-btn.holding { background: var(--line); }
.stepper-btn.limit { opacity: .35; }
.stepper-value {
  flex: 1 1 auto; min-width: 96px; height: 44px; border-radius: var(--r-ctl); background: var(--bg); border: var(--bw) solid var(--line);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-size: var(--fs-stepval); font-weight: 700; white-space: nowrap; position: relative;
}
.stepper-value.accent { color: var(--sec); }
.stepper-value.unset .stepper-text { color: var(--text-faint); } /* allowUnset の未設定「–」(c07-09) */
.stepper-pencil { color: var(--text-dim); position: absolute; right: 8px; }
.stepper-value.editing { padding: 0; }
.stepper-input { width: 100%; height: 100%; border: 0; background: transparent; color: var(--text); text-align: center; font: inherit; font-size: var(--fs-input); font-weight: 700; padding: 0 8px; }
.stepper-value.shake { animation: shake-x 120ms ease-in-out 1; }
@keyframes shake-x { 0% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } 100% { transform: translateX(0); } }
.stepper-btn .icon { pointer-events: none; }

/* ---------- 6-5. AccentDot ---------- */
.accent-row { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 8px 0; }
.accent-group { display: inline-flex; gap: 8px; }
.accent-dot {
  width: 40px; height: 40px; border-radius: 50%; border: var(--bw) solid var(--sec-45); background: var(--sec-28);
  font-size: 13px; font-weight: 700; color: var(--text); display: inline-flex; align-items: center; justify-content: center;
  transition: transform 50ms, box-shadow var(--t-off), background-color var(--t-chip);
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.accent-dot.lv2 { background: var(--sec); border-color: var(--sec); color: var(--on-color); }
.accent-dot.lv0 { opacity: .38; border-style: dashed; background: transparent; }
.accent-dot.beat-on { transition: none; box-shadow: 0 0 0 3px var(--sec-glow); }
.accent-dot:active { transform: scale(.9); }
.accent-row.small { gap: 8px 12px; } .accent-row.small .accent-group { gap: 6px; } .accent-row.small .accent-dot { width: 32px; height: 32px; font-size: 12px; }

/* ---------- 6-6. Switch ---------- */
.switch-row { display: flex; align-items: center; justify-content: space-between; min-height: 40px; }
.switch { width: 40px; height: 22px; border-radius: 11px; background: var(--line); position: relative; transition: background-color var(--t-chip); flex: none; }
.switch::before { content: ""; position: absolute; left: 0; right: 0; top: -9px; bottom: -9px; } /* タップ領域 22 → 40(::after はノブ) */
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--text); transition: transform var(--t-chip); }
.switch.on { background: var(--sec); }
.switch.on::after { transform: translateX(18px); background: var(--on-color); }
.check-row { display: flex; align-items: center; gap: 8px; min-height: 40px; font-size: var(--fs-sub); }
.check-row input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--sec); margin: 0; }

/* ---------- 6-7. テンポ変化ブロック / TempoCurveGraph / SliderRow ---------- */
/* 出入りする行(テンポ変化ブロック / 単位チップ行 / 主拍の間 c03-01)は同じ grid 0fr→1fr 200ms */
.tc-block, .collapse-block { display: grid; grid-template-rows: 0fr; transition: grid-template-rows var(--t-height); }
.tc-block.open, .collapse-block.open { grid-template-rows: 1fr; }
.tc-block > .tc-inner, .collapse-block > .collapse-inner { overflow: hidden; min-height: 0; }
.tc-panel { border-radius: var(--r-block); background: var(--sec-t5); padding: 12px; margin-top: 8px; }
.tc-graph-wrap { margin: 8px 0; }
.tc-graph-labels { display: grid; grid-template-columns: 1fr 1fr 1fr; font-size: var(--fs-axis); color: var(--text-dim); margin-bottom: 4px; }
.tc-lbl-m { text-align: center; } .tc-lbl-r { text-align: right; }
.tc-graph { height: 92px; border-radius: var(--r-ctl); background: var(--bg); overflow: hidden; }
.tc-svg { width: 100%; height: 100%; display: block; }
.tc-svg .tc-bar { stroke: var(--line); stroke-width: 1; }
.tc-svg .tc-start { stroke: var(--sec-70); stroke-width: 1.5; }
.tc-svg .tc-line { stroke: var(--sec); stroke-width: 2; fill: none; opacity: .9; }
.tc-svg .tc-dot { stroke: var(--sec); stroke-width: 4.5; fill: none; }
.tc-svg .tc-ph { stroke: #fff; stroke-width: 9; fill: none; }
.slider-row { display: flex; align-items: center; gap: 8px; min-height: 40px; }
.slider-row.disabled { opacity: .35; pointer-events: none; }
.slider-label { width: 56px; flex: none; font-size: var(--fs-caption); color: var(--text-dim); }
.slider-row input[type="range"] { flex: 1; height: 44px; margin: 0; accent-color: var(--sec); min-width: 0; }
.slider-value { width: 88px; flex: none; text-align: right; font-size: var(--fs-caption); color: var(--text); white-space: nowrap; }

/* ---------- 6-8. SectionOps ---------- */
.section-ops { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.ops-btn { height: 40px; padding: 0 12px; border-radius: var(--r-ctl); border: var(--bw) solid var(--line); background: var(--panel-2); font-size: var(--fs-sub); font-weight: 600; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.ops-btn.danger { color: var(--danger); margin-left: auto; }
.ops-btn[disabled] { opacity: .35; }

/* ---------- 6-9. プリセットシート ---------- */
.preset-form { display: flex; gap: 8px; margin: 4px 0 12px; }
.preset-form input { flex: 1; min-width: 0; height: 40px; border-radius: var(--r-ctl); border: var(--bw) solid var(--line); background: var(--bg); color: var(--text); padding: 0 12px; font: inherit; font-size: var(--fs-input); }
.preset-list { display: flex; flex-direction: column; gap: 8px; }
.preset-row { border: var(--bw) solid var(--line); border-radius: var(--r-block); background: var(--panel-2); overflow: hidden; transition: height var(--t-height), opacity var(--t-height); }
.preset-row.removing { height: 0 !important; opacity: 0; border-width: 0; }
.preset-head { height: 72px; padding: 10px 12px; display: grid; grid-template-columns: 1fr 44px; align-items: center; }
.preset-main { min-width: 0; align-self: stretch; display: flex; align-items: center; cursor: pointer; } /* role=button。[…] は兄弟(入れ子にしない #30) */
.preset-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.preset-name { font-size: var(--fs-body); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preset-summary, .preset-meta { font-size: var(--fs-caption); color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preset-more { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; color: var(--text-dim); border-radius: var(--r-ctl); font-weight: 700; }
.preset-ops { display: grid; grid-template-rows: 0fr; transition: grid-template-rows var(--t-color); }
.preset-row.expanded .preset-ops { grid-template-rows: 1fr; }
.preset-ops > div { overflow: hidden; min-height: 0; display: flex; gap: 8px; padding: 0 12px; }
.preset-row.expanded .preset-ops > div { padding-bottom: 10px; }
.preset-ops .btn { height: 34px; font-size: var(--fs-chip); padding: 0 8px; position: relative; }
.preset-ops .btn::before { content: ""; position: absolute; left: 0; right: 0; top: -3px; bottom: -3px; } /* タップ領域 34 → 40 */
.preset-ops .btn.overwrite { min-width: 152px; } .preset-ops .btn.share { min-width: 64px; } .preset-ops .btn.delete { min-width: 64px; color: var(--danger); }
.preset-empty { text-align: center; font-size: var(--fs-sub); color: var(--text-dim); padding: 20px 0; }

/* ---------- 6-10. 共有シート ---------- */
.share-note { color: var(--text-dim); font-size: var(--fs-sub); line-height: 1.7; margin: 6px 0 10px; }
.share-subtitle { font-size: var(--fs-body); font-weight: 700; margin: 4px 0; }
.share-warn { border: var(--bw) solid var(--line); border-radius: var(--r-block); padding: 10px 12px; font-size: var(--fs-sub); line-height: 1.7; color: var(--text); display: flex; gap: 8px; margin: 10px 0; }
.share-warn .icon { flex: none; margin-top: 3px; }
.url-row { display: flex; gap: 8px; margin: 8px 0; }
.share-input, .share-textarea { flex: 1; min-width: 0; border-radius: var(--r-ctl); border: var(--bw) solid var(--line); background: var(--bg); color: var(--text); padding: 8px 12px; font: inherit; font-size: var(--fs-input); user-select: text; -webkit-user-select: text; }
.share-input { height: 40px; padding: 0 12px; }
.share-textarea { width: 100%; resize: none; line-height: 1.5; display: block; transition: border-color var(--t-chip); }
.share-textarea.error { border-color: var(--danger); }
.share-heading { font-size: var(--fs-body); font-weight: 700; margin: 8px 0 4px; }

/* ---------- 6-11. 設定シート ---------- */
.setting-desc { font-size: var(--fs-sub); color: var(--text-dim); margin: 6px 0; min-height: 18px; }
.setting-text { font-size: var(--fs-sub); color: var(--text-dim); line-height: 1.7; margin: 4px 0; }
.setting-version { font-size: var(--fs-caption); color: var(--text-dim); margin-top: 12px; } /* --text-faint は装飾専用(コントラスト 2.2:1)*/

/* ---------- 7. レスポンシブ(§8) ---------- */
@media (max-width: 374px) {
  .timesig { min-width: 56px; }
  .tempo-token { font-size: 13px; min-width: 104px; }
}
@media (max-width: 420px) {
  /* 編集シートの [■] [▶ ここから再生] [↻ ここだけ繰り返す] (c02-24): 360px の内幅 328 − ■ 44 − 間 8×2 = 268px に 2 ボタンを入れる。
     14px・左右 14px のままでは 135.3 + 175.7(「繰り返し中」)= 311px で溢れるので、.v3-actions と同じ ≤420px の段で 12px(--fs-chip)・
     左右 10px にする(115.1 + 147.8 = 262.9px。375px の 283px にも入る)。↻ の幅は ON/OFF の長い方に合わせて固定(c08-08) */
  .preview-actions .btn { padding-left: 10px; padding-right: 10px; font-size: var(--fs-chip); }
  .preview-actions .btn.solo-btn { min-width: 148px; }
}
@media (max-width: 389px) {
  /* かかり方チップ 4×76 + 3×6 = 322 は tc-panel 内幅(375: 319 / 360: 304)に入らないので 2×2 に決め打ち(高さ 66) */
  .tc-panel .curve-chips { display: grid; grid-template-columns: repeat(2, 76px); }
}
@media (max-height: 699px) {
  :root { --fs-beat: 72px; --now-beat-box: 76px; --fs-tempo-now: 24px; --fs-tempo-rest: 14px; --now-tempo-row: 30px; --now-h: 276px; --status-h: 40px; }
}
@media (max-height: 599px) {
  :root { --now-dots-row: 24px; --now-progress-mb: 4px; --now-h: 268px; }
}
@media (hover: hover) {
  .icon-btn:hover, .add-btn:hover, .btn:hover, .ops-btn:hover { background: var(--panel-2); }
  .icon-btn[aria-disabled="true"]:hover { background: none; }
  .btn.primary:hover { background: var(--ink); opacity: .92; }
  .flow-chip:hover:not(.active) { border-color: var(--sec); }
  .flow-loop-chip[aria-disabled="true"]:hover { border-color: var(--line); } /* 押せない ↻ 全体は反応させない */
  .card-body:hover { background: var(--panel-2); }
  .stepper-btn:hover { background: var(--line); }
}

/* ---------- 8. reduced-motion(§10.12): 開閉・退避・展開は 0、点灯系はもともと即時 ---------- */
@media (prefers-reduced-motion: reduce) {
  .sheet, .sheet-backdrop, .card, .tc-block, .collapse-block, .preset-ops, .preset-row, .pop, .toast, .flow-hint { transition: none !important; }
  .now-card.downbeat { animation: none; }
  .now-beat.pulse { animation: none; }
}
