/* styles.css — Karaoke
   デザインの軸: カラオケ画面の「歌詞テロップ」。曲名は縁取り文字で、表示時に一度だけ色がワイプする。
   それ以外は静かに。色は意味（判定）にだけ使う。 */

:root {
  --bg: #f2f0f7;
  --surface: #ffffff;
  --surface-2: #e9e6f2;
  --ink: #1d1840;
  --ink-2: #5a5577;
  --ink-3: #8a86a3;
  --line: #d9d5e6;
  --accent: #d6246e; /* テロップのワイプ色 */
  --accent-ink: #ffffff;
  --telop-fill: #ffffff;
  --telop-edge: #1d1840;

  --ok: #1f7a4d;
  --ok-bg: #dcf1e5;
  --adjust: #8a5300;
  --adjust-bg: #fbe9c8;
  --unknown: #5f5b74;
  --unknown-bg: #e6e3ee;
  --warn: #b3212f;
  --warn-bg: #fbe0e2;
  --check: #5f5200; /* 要確認: 黄系（注意=琥珀とも ⚠=赤とも別） */
  --check-bg: #fff2a3;
  --check-line: #e2bd00;

  --voice: #3b347a;
  --song-orig: #b9b3d8;
  --song: #1aa0c4;
  --over: #e0344a;

  --r-s: 6px;
  --r-m: 12px;
  --r-l: 20px;
  --gutter: 16px;
  --font: -apple-system, BlinkMacSystemFont, 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', 'Noto Sans CJK JP', 'Yu Gothic', sans-serif;
  --font-telop: 'Hiragino Maru Gothic ProN', 'Hiragino Maru Gothic Pro', 'M PLUS Rounded 1c', 'Kosugi Maru', 'Noto Sans CJK JP', var(--font);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14112a;
    --surface: #1f1b3a;
    --surface-2: #2a2549;
    --ink: #f1eefc;
    --ink-2: #b7b1d6;
    --ink-3: #8781aa;
    --line: #36305a;
    --accent: #ff4f93;
    --accent-ink: #1a0c16;
    --telop-fill: #ffffff;
    --telop-edge: #0b0820;

    --ok: #6fdba0;
    --ok-bg: #173a2a;
    --adjust: #f5c46a;
    --adjust-bg: #3d2e10;
    --unknown: #b4afcc;
    --unknown-bg: #2c2848;
    --warn: #ff8a93;
    --warn-bg: #44161d;
    --check: #f6e266;
    --check-bg: #39340f;
    --check-line: #e8cf3a;

    --voice: #8f86f0;
    --song-orig: #4d4675;
    --song: #3fd0f2;
    --over: #ff5468;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; }
.skip:focus { left: 8px; top: calc(8px + var(--safe-top)); z-index: 50; background: var(--surface); padding: 8px 12px; }

.view {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 var(--gutter) calc(48px + var(--safe-bottom));
  outline: none;
}
.loading { padding: 40vh 0 0; text-align: center; color: var(--ink-2); }

/* ---------- 上部バー ---------- */
.appbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  padding-top: var(--safe-top);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-family: var(--font-telop);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.appbar__actions { display: flex; align-items: center; gap: 2px; margin-right: -8px; }
.icon-btn--pick { color: var(--accent); }
.brand__mark {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: conic-gradient(from 200deg, var(--accent) 0 62%, var(--song) 62% 100%);
  box-shadow: inset 0 0 0 5px var(--bg);
  outline: 2px solid var(--ink);
  outline-offset: -2px;
}
.icon-btn, .back, .bar-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  min-width: 44px;
  justify-content: center;
  text-decoration: none;
  color: var(--ink-2);
  border-radius: var(--r-m);
}
.back { margin-left: -10px; padding-right: 8px; font-weight: 600; color: var(--ink); }
.bar-link { padding: 0 4px; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }
button.bar-link { border: 0; background: none; cursor: pointer; font-weight: 600; }

.netstatus {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: calc(6px + var(--safe-top)) var(--gutter) 6px;
  background: var(--adjust-bg);
  color: var(--adjust);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}

/* ---------- 一覧 ---------- */
.list-head {
  position: sticky;
  top: 0;
  z-index: 10;
  margin: 0 calc(-1 * var(--gutter));
  padding: 0 var(--gutter) 10px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-m);
  color: var(--ink-3);
}
.search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  background: transparent;
  font-size: 16px; /* iOS のズーム防止 */
  color: var(--ink);
  outline: none;
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.chips {
  display: flex;
  gap: 6px;
  margin: 10px calc(-1 * var(--gutter)) 0;
  padding: 0 var(--gutter);
  overflow-x: auto;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  position: relative;
}
.chip::after { content: ''; position: absolute; inset: -4px 0; } /* タップ領域を 44px に */
.chip__count { font-size: 12px; font-weight: 500; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.chip[aria-checked='true'] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chip[aria-checked='true'] .chip__count { color: inherit; opacity: 0.7; }
.chip[aria-pressed='true'] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
/* 折り返すチップ群（属性の編集・今日なに歌う？） */
.chips--wrap { flex-wrap: wrap; row-gap: 8px; margin: 0; padding: 0; overflow: visible; }
.chip--removable span { font-size: 16px; line-height: 1; opacity: 0.7; }

.summary {
  display: flex;
  justify-content: space-between;
  margin: 12px 0 4px;
  font-size: 13px;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.summary__mode { color: var(--ink-3); }

.artist-group { margin-top: 18px; }
.artist-group__name {
  margin: 0 0 4px;
  padding-left: 2px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-2);
  letter-spacing: 0.02em;
}
.song-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--surface);
  border-radius: var(--r-m);
  overflow: hidden;
}
.song-list li + li .song-row { border-top: 1px solid var(--line); }
.song-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 8px 12px 8px 14px;
  text-decoration: none;
}
.song-row:active { background: var(--surface-2); }
.song-row__title { font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }

.key-badge {
  display: inline-block;
  min-width: 34px;
  padding: 1px 6px;
  border: 1.5px solid var(--ink-2);
  border-radius: var(--r-s);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.key-badge--orig { border-style: dashed; color: var(--ink-2); }

.verdict {
  display: inline-block;
  min-width: 72px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}
.verdict--ok { background: var(--ok-bg); color: var(--ok); }
.verdict--adjust { background: var(--adjust-bg); color: var(--adjust); }
.verdict--unknown { background: var(--unknown-bg); color: var(--unknown); font-weight: 600; }
.verdict--warn { background: var(--warn-bg); color: var(--warn); }
/* 要確認: 黄色の地に破線の縁（まだ決まっていない） */
.verdict--check { background: var(--check-bg); color: var(--check); outline: 1.5px dashed var(--check-line); outline-offset: -1.5px; }
/* 裏声上限で判定した OK / 要調整の先頭バッジ */
.verdict__ura {
  display: inline-block;
  margin: 0 4px 0 -2px;
  padding: 0 3px;
  border: 1px solid currentColor;
  border-radius: 4px;
  font-size: 10px;
  line-height: 13px;
  vertical-align: 1px;
}

.empty { padding: 48px 8px; text-align: center; color: var(--ink-2); }
.empty .btn-row { justify-content: center; }

/* ---------- 曲ページ: テロップ ---------- */
.song-hero { padding: 8px 0 18px; }
.song-hero__artist { margin: 0 0 2px; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.telop {
  margin: 0;
  font-family: var(--font-telop);
  font-size: clamp(30px, 9vw, 44px);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: 0.01em;
  outline: none;
}
.telop__line {
  position: relative;
  display: inline-block;
  max-width: 100%;
  color: var(--telop-fill);
  /* 縁取り（8方向の影）: カラオケの歌詞テロップの体裁 */
  text-shadow:
    2px 0 0 var(--telop-edge), -2px 0 0 var(--telop-edge), 0 2px 0 var(--telop-edge), 0 -2px 0 var(--telop-edge),
    1.5px 1.5px 0 var(--telop-edge), -1.5px 1.5px 0 var(--telop-edge), 1.5px -1.5px 0 var(--telop-edge), -1.5px -1.5px 0 var(--telop-edge),
    0 4px 0 var(--telop-edge);
  overflow-wrap: anywhere;
}
/* 色ワイプ: 同じ文字をアクセント色で重ね、左から右へ一度だけ現す（画面で唯一の自動モーション） */
.telop__line::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  color: var(--accent);
  text-shadow: none;
  clip-path: inset(-10% 100% -10% 0);
  animation: telop-wipe 1.6s cubic-bezier(0.45, 0, 0.3, 1) 0.25s forwards;
}
@keyframes telop-wipe {
  to { clip-path: inset(-10% 0 -10% 0); }
}
@media (prefers-reduced-motion: reduce) {
  .telop__line::after { animation: none; clip-path: none; }
}

/* ---------- 曲ページ: ステージ（判定・音域バー・キー試算） ---------- */
.stage {
  margin: 0 calc(-1 * var(--gutter));
  padding: 16px var(--gutter) 18px;
  background: var(--surface);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.judge { padding-left: 12px; border-left: 4px solid var(--unknown); }
.judge--ok { border-color: var(--ok); }
.judge--adjust { border-color: var(--adjust); }
.judge--warn { border-color: var(--warn); }
.judge--check { border-color: var(--check-line); }
.judge--check .judge__label span { background: linear-gradient(transparent 58%, var(--check-bg) 58%); color: var(--ink); }
.judge__label { margin: 0; font-size: 22px; font-weight: 800; line-height: 1.35; overflow-wrap: anywhere; }
.judge--ok .judge__label { color: var(--ok); }
.judge--adjust .judge__label { color: var(--adjust); }
.judge--warn .judge__label { color: var(--warn); }
.judge__facts { display: flex; flex-wrap: wrap; gap: 4px 20px; margin: 8px 0 0; }
.judge__facts div { display: flex; flex-direction: column; }
.judge__facts dt { font-size: 12px; color: var(--ink-2); }
.judge__facts dd { margin: 0; font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.judge__warns { margin: 10px 0 0; padding-left: 1.1em; font-size: 14px; color: var(--warn); }
.judge__warns li + li { margin-top: 2px; }
.judge__hint { margin: 8px 0 0; font-size: 14px; color: var(--ink-2); }
.judge__confirm .btn-row { margin: 10px 0 0; }
.judge__confirm .btn { flex: 1 1 240px; }

.stage__bar { margin-top: 14px; }
.rangebar { display: block; width: 100%; height: auto; overflow: visible; font-family: var(--font); }
.rb-grid { stroke: var(--line); stroke-width: 1; }
.rb-guide { stroke: var(--voice); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0.6; }
.rb-label { font-size: 11px; fill: var(--ink-2); }
.rb-label--strong { fill: var(--ink); font-weight: 700; }
.rb-note { font-size: 10px; font-weight: 700; fill: var(--ink-2); font-variant-numeric: tabular-nums; }
.rb-note--over { fill: var(--over); }
.rb-octave { font-size: 9px; fill: var(--ink-3); }
.rb-empty { font-size: 11px; fill: var(--ink-3); }
.rb-voice { fill: var(--voice); }
.rb-voice-falsetto { stroke: var(--voice); stroke-width: 2; stroke-dasharray: 2 3; }
.rb-voice-mark { fill: var(--bg); stroke: var(--voice); stroke-width: 2; }
.rb-song-orig { fill: var(--song-orig); }
.rb-song-orig-mark { fill: var(--song-orig); }
.rb-song { fill: var(--song); }
.rb-song-mark { fill: var(--song); }
.rb-over { fill: var(--over); }
.rb-over-mark { fill: var(--over); }
.rb-song-fals { fill: var(--song); fill-opacity: 0.32; stroke: var(--song); stroke-width: 1; stroke-dasharray: 2 2; }
.rb-guide--fals { stroke-dasharray: 1 3; opacity: 0.9; }
.rb-note--fals { fill: var(--voice); }
.rb-falsetto-link { stroke: var(--ink-3); stroke-width: 1.5; stroke-dasharray: 2 3; }
.rb-key-white { fill: var(--surface-2); }
.rb-key-black { fill: var(--ink-2); opacity: 0.55; }

.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; font-size: 11px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 4px; }
.lg { display: inline-block; width: 14px; height: 8px; border-radius: 2px; }
.lg--voice { background: var(--voice); }
.lg--orig { background: var(--song-orig); }
.lg--cur { background: var(--song); }
.lg--over { background: var(--over); }
.lg--mark { width: 8px; height: 8px; border-radius: 0; background: var(--song); transform: rotate(45deg); }
.lg--fals { background: color-mix(in srgb, var(--song) 32%, transparent); outline: 1px dashed var(--song); outline-offset: -1px; }
.legend__mode { margin: 6px 0 0; font-size: 12px; font-weight: 700; color: var(--voice); }

.sim { margin-top: 16px; }
.stepper {
  display: grid;
  grid-template-columns: 64px 1fr 64px;
  align-items: center;
  height: 64px;
  background: var(--bg);
  border-radius: var(--r-l);
  overflow: hidden;
}
.stepper__btn {
  height: 100%;
  border: 0;
  background: var(--ink);
  color: var(--bg);
  font-size: 28px;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
}
.stepper__btn:active { background: var(--accent); color: var(--accent-ink); }
.stepper__btn:disabled { opacity: 0.35; cursor: default; }
.stepper__value { display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
.stepper__num { font-family: var(--font-telop); font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stepper__cap { font-size: 11px; color: var(--ink-2); }
.sim__saved { margin: 8px 0 0; font-size: 13px; color: var(--ink-2); text-align: center; }
.sim__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.sim__actions .btn { flex: 1 1 140px; }

/* ---------- パネルとフォーム ---------- */
.page-title { margin: 4px 0 8px; font-family: var(--font-telop); font-size: 28px; font-weight: 800; outline: none; }
.panel { padding: 22px 0 6px; border-bottom: 1px solid var(--line); }
.panel:last-child { border-bottom: 0; }
.panel__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.panel__title { margin: 0 0 6px; font-size: 18px; font-weight: 800; }
.panel__head .panel__title { margin: 0; }
.panel__hint { margin: 0 0 12px; font-size: 13px; color: var(--ink-2); }

.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0 12px; }
.field { display: block; margin: 0 0 12px; padding: 0; border: 0; min-width: 0; }
.field__label { display: block; margin-bottom: 4px; padding: 0; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field input, .field select, textarea {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-m);
  background: var(--surface);
  font-size: 16px;
  -webkit-appearance: none;
  appearance: none;
}
.field select {
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-right: 32px;
}
textarea { resize: vertical; line-height: 1.6; margin-bottom: 12px; }
.field input:focus, .field select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: var(--r-m);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
}
.btn:disabled { opacity: 0.45; cursor: default; }
.btn--ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn--small { min-height: 40px; padding: 0 14px; font-size: 14px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; }

.seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.seg__item { position: relative; }
.seg__item input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg__item span {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-m);
  background: var(--surface);
  font-size: 22px;
  font-weight: 700;
}
.seg__item input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.seg__item input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ボタン型のセグメント（高音の歌い方・テンポ・喉の調子） */
.segbar { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.seg-btn {
  min-height: 48px;
  padding: 4px 6px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-m);
  background: var(--surface);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
  cursor: pointer;
  touch-action: manipulation;
}
.seg-btn[aria-checked='true'] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.seg-btn:disabled { opacity: 0.5; cursor: default; }
.field__label small, .pick-q__title small { margin-left: 6px; font-size: 12px; font-weight: 500; color: var(--ink-3); }

.hnm { margin: 18px 0 8px; padding-top: 16px; border-top: 1px dashed var(--line); }
.hnm__title { margin: 0 0 8px; font-size: 15px; font-weight: 800; }
.hnm__notes { margin: 8px 0 0; padding: 0; list-style: none; font-size: 13px; color: var(--ink-2); }
.hnm__notes b { color: var(--ink); }

.hist-form { margin: 14px 0 6px; padding: 14px; background: var(--surface); border-radius: var(--r-m); }
.hist-form .btn { width: 100%; }

.hist-list { list-style: none; margin: 12px 0 0; padding: 0; }
.hist { padding: 12px 0; border-top: 1px solid var(--line); }
.hist:first-child { border-top: 0; }
.hist__head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; }
.hist__date { font-weight: 600; font-variant-numeric: tabular-nums; }
.hist__rec {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin: -10px 0 -10px auto;
  padding: 0 4px;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
}
.hist__memo { margin: 6px 0 0; white-space: pre-wrap; color: var(--ink-2); font-size: 15px; }

/* ---------- 録音の添付と再生（v0.3） ---------- */
/* 添付ボタン: ファイル入力をラベルで包む。破線の枠＝「ここに入れる」 */
.rec-pick {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 8px 14px;
  border: 1.5px dashed color-mix(in srgb, var(--accent) 55%, var(--line));
  border-radius: var(--r-m);
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
  cursor: pointer;
}
.rec-pick:active { background: color-mix(in srgb, var(--accent) 14%, var(--surface)); }
.rec-pick:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }
.rec-pick__input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.rec-pick__icon { display: inline-flex; color: var(--accent); }
.rec-pick__text { display: flex; flex-direction: column; line-height: 1.3; }
.rec-pick__text b { font-weight: 800; color: var(--ink); }
.rec-pick__text small { font-size: 12px; color: var(--ink-3); }

.rec-file {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 4px 4px 4px 12px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-m);
  background: var(--bg);
}
.rec-file__icon { display: inline-flex; color: var(--accent); }
.rec-file__name { min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-file__size { font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rec-file__x {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: var(--r-s);
  background: none;
  font-size: 22px;
  line-height: 1;
  color: var(--ink-2);
  cursor: pointer;
}
.rec-file__x:disabled { opacity: 0.35; cursor: default; }

/* 進捗: テロップの色ワイプと同じく、左からアクセント色で埋まる */
.rec-progress { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.rec-progress__track { flex: 1; height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.rec-progress__fill {
  display: block;
  height: 100%;
  background: var(--accent);
  transform-origin: left center;
  transition: transform 0.15s linear;
}
.rec-progress__pct { min-width: 3.2em; font-family: var(--font-telop); font-size: 18px; font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; color: var(--accent); }
@media (prefers-reduced-motion: reduce) {
  .rec-progress__fill { transition: none; }
}
.rec-status { margin: 6px 0 0; font-size: 13px; }
.rec-status--done { color: var(--ok); font-weight: 600; }
.rec-note { margin: 0 0 12px; font-size: 13px; color: var(--ink-3); }
.hist-form input[name='recordingUrl']:disabled { background: var(--bg); border-style: dashed; color: var(--ink-3); }
.rec-howto { margin: 10px 0 0; font-size: 12px; color: var(--ink-3); text-align: center; }

.hist__audio { margin-top: 8px; }
.hist__audio audio { display: block; width: 100%; height: 40px; border-radius: 999px; }
.hist__audio-foot { display: flex; justify-content: flex-end; gap: 4px; margin-top: 2px; }
.hist__audio-err { margin: 4px 0 0; font-size: 13px; color: var(--warn); }
/* 小さな文字ボタン（録音を削除。2段階で確認） */
.text-btn {
  min-height: 36px;
  padding: 0 6px;
  border: 0;
  background: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-3);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
span.text-btn { display: inline-flex; align-items: center; text-decoration: none; }
.text-btn.is-armed { color: var(--warn); font-weight: 800; }
.text-btn:disabled { opacity: 0.45; cursor: default; }

/* ---------- 履歴の編集・削除（v0.4） ---------- */
/* 行の「評価・日付・キー」がそのまま編集ボタン。右端の小さな「編集」で押せることを示す */
.hist__tap {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 44px;
  margin: -7px -8px;
  padding: 7px 8px;
  border: 0;
  border-radius: var(--r-s);
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.hist__tap:active { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.hist__tap:focus-visible { outline: 3px solid var(--accent); outline-offset: 0; }
@media (hover: hover) {
  .hist__tap:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); }
}
.hist__edit { display: inline-flex; align-items: center; gap: 3px; margin-left: auto; font-size: 12px; font-weight: 600; color: var(--ink-3); }
.hist__tap + .hist__rec { margin-left: 8px; }

/* 未保存の編集があるときに別の行をタップ → その行が確認に変わる */
.hist__switch {
  flex: 1 1 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 2px 8px;
  min-height: 44px;
  padding: 2px 4px 2px 12px;
  border-radius: var(--r-s);
  background: var(--warn-bg);
}
.hist__switch-msg { font-size: 13px; font-weight: 700; color: var(--warn); }
.hist__switch-btns { display: flex; gap: 2px; }

.hist--editing { padding: 8px 0; }
.hist-form--edit { margin: 0; box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 40%, var(--line)); }
.hist-form__title { display: flex; align-items: center; gap: 6px; margin: 0 0 10px; font-size: 13px; font-weight: 800; color: var(--accent); }
.hist-form__actions { display: grid; grid-template-columns: 1fr 1.6fr; gap: 8px; margin-top: 4px; }
.hist-form__danger { display: flex; justify-content: center; gap: 4px; margin-top: 6px; }
.hist-form__danger .text-btn { min-height: 44px; }

/* 編集フォームの「今の録音」: 差し替え前に聴いて確かめられる */
.rec-current { margin: 0 0 8px; padding: 8px 10px 2px; border-radius: var(--r-m); background: var(--bg); }
.rec-current__label { display: block; margin-bottom: 4px; font-size: 12px; font-weight: 600; color: var(--ink-3); }
.rec-current audio { display: block; width: 100%; height: 40px; border-radius: 999px; }
.rec-current__foot { display: flex; justify-content: flex-end; }
.rec-current__note { margin: 4px 0 6px; font-size: 13px; color: var(--ink-2); }
.rec-current--removed { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 8px; padding: 4px 4px 4px 12px; border: 1.5px dashed var(--line); background: transparent; }
.rec-current--removed .rec-current__note { margin: 0; color: var(--warn); font-weight: 600; }
.field .rec-note { margin: 0; }

.panel__hint--lead { margin-bottom: 4px; color: var(--ink); font-weight: 600; }
.rating {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-weight: 800;
}
.rating--great { background: var(--ok-bg); color: var(--ok); }
.rating--good { background: color-mix(in srgb, var(--song) 18%, var(--surface)); color: var(--ink); }
.rating--fair { background: var(--adjust-bg); color: var(--adjust); }
.rating--poor { background: var(--warn-bg); color: var(--warn); }
.rating--none { background: var(--unknown-bg); color: var(--unknown); }

.muted { color: var(--ink-2); font-size: 14px; }
.error-text { color: var(--warn); font-size: 14px; }
.ok-text { color: var(--ok); font-size: 14px; font-weight: 600; }

.estimate { margin: 4px 0 12px; padding: 14px; background: var(--surface); border-radius: var(--r-m); font-size: 14px; }
.estimate p { margin: 0 0 8px; }
.estimate__list, .info-list { margin: 0 0 12px; }
.estimate__list div, .info-list div { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.estimate__list dt, .info-list dt { color: var(--ink-2); }
.estimate__list dd, .info-list dd { margin: 0; font-weight: 600; text-align: right; }
.estimate__list small { margin-left: 8px; color: var(--ink-3); font-weight: 400; }

/* ---------- トースト ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + var(--safe-bottom));
  z-index: 40;
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  border-radius: var(--r-m);
  background: var(--ink);
  color: var(--bg);
  font-size: 15px;
  font-weight: 600;
  transform: translate(-50%, 16px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.toast--error { background: var(--warn); color: #fff; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) {
  .toast { transition: none; }
}

/* ---------- 今日なに歌う？ #/pick ---------- */
.telop--page { font-size: clamp(28px, 8.4vw, 40px); }
.pick-hero { padding-bottom: 10px; }
.pick-q { margin-top: 18px; }
.pick-q__title { display: block; margin: 0 0 8px; font-size: 15px; font-weight: 800; }
.pick-q .field { margin-bottom: 8px; }
.pick-years { margin: 8px 0 0; font-size: 13px; color: var(--ink-2); }
.pick-years b { color: var(--ink); font-variant-numeric: tabular-nums; }

.pick-more { margin-top: 22px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.pick-more > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  font-size: 16px;
  font-weight: 800;
  list-style: none;
  cursor: pointer;
}
.pick-more > summary::-webkit-details-marker { display: none; }
.pick-more > summary::after {
  content: '';
  width: 8px;
  height: 8px;
  margin: -4px 4px 0 auto;
  border-right: 2px solid var(--ink-2);
  border-bottom: 2px solid var(--ink-2);
  transform: rotate(45deg);
}
.pick-more[open] > summary::after { margin-top: 4px; transform: rotate(-135deg); }
.pick-more__count { font-size: 12px; font-weight: 700; color: var(--accent); }
.pick-more__body { padding-bottom: 14px; }
.pick-more__body .pick-q:first-child { margin-top: 2px; }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; margin-top: 12px; font-weight: 700; cursor: pointer; }
.switch input {
  flex: none;
  position: relative;
  width: 50px;
  height: 30px;
  margin: 0;
  border-radius: 999px;
  background: var(--line);
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  transition: background 0.15s;
}
.switch input::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgb(0 0 0 / 25%);
  transition: transform 0.15s;
}
.switch input:checked { background: var(--ink); }
.switch input:checked::before { transform: translateX(20px); }
@media (prefers-reduced-motion: reduce) {
  .switch input, .switch input::before { transition: none; }
}

.pick-results { padding-top: 22px; }
.pick-results .panel__title { margin: 0; }
.pick-results .summary { margin-top: 4px; }
.pick-list { margin-top: 8px; }
.song-row--pick { row-gap: 6px; padding-top: 10px; padding-bottom: 10px; }
.song-row__main { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.song-row__artist { display: block; font-size: 12px; font-weight: 500; color: var(--ink-2); }
.pick-rank { flex: none; min-width: 1.4em; font-family: var(--font-telop); font-size: 15px; font-weight: 800; color: var(--ink-3); text-align: right; font-variant-numeric: tabular-nums; }
.reasons { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px; padding-left: calc(1.4em + 10px); }
.reason { padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); font-size: 12px; font-weight: 600; }
.pick-empty p { margin: 0 0 8px; }
.pick-empty .btn { margin-top: 8px; }

/* ---------- 索引バー（一覧の右端） ---------- */
#index-bar { position: fixed; right: 0; top: 0; bottom: 0; z-index: 12; display: flex; align-items: center; pointer-events: none; }
#index-bar[hidden] { display: none; }
.index-bar {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 4px 6px 10px;            /* 左に余白を取って指が当てやすく */
  padding-right: max(4px, env(safe-area-inset-right, 0px));
  max-height: calc(100vh - 220px);      /* 上部のヘッダ・下部の余白を避ける */
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  border-radius: 12px 0 0 12px;
  transition: background 0.15s;
}
.index-bar.is-active { background: color-mix(in srgb, var(--surface-2) 85%, transparent); }
.index-bar__key {
  font-size: 10px;
  line-height: 1;
  font-weight: 700;
  color: var(--accent);
  padding: 1.5px 2px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}
.index-bar__key.is-empty { color: var(--ink-3); opacity: 0.45; font-weight: 500; }
@media (max-height: 700px) { .index-bar__key { font-size: 9px; padding: 1px 2px; } }
.index-bubble {
  position: fixed;
  right: 44px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 13;
  min-width: 64px;
  padding: 14px 0;
  text-align: center;
  font-size: 32px;
  font-weight: 800;
  color: var(--accent-ink);
  background: var(--accent);
  border-radius: 16px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  pointer-events: none;
}
.index-bubble[hidden] { display: none; }
/* 右端の索引と曲行の判定チップが重ならないように */
#results { padding-right: 18px; }
