/* 中性極簡：黑白灰為主，唯一的訊號色是綠（只表示「達成」和「準了」）。
   不用卡片陰影，用細線和留白分區；每個畫面只有一個大數字。 */

@font-face {
  font-family: "Instrument Sans";
  src: url("fonts/instrument-sans.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light;
  --bg: #f6f6f4;
  --surface: #ffffff;
  --surface-2: #ececea;
  --line: #e3e3df;
  --text: #1c1d20;
  --text-2: #4a4c52;
  --muted: #7d8086;
  --accent: #1c1d20;          /* 主要動作＝墨色 */
  --accent-ink: #ffffff;
  --accent-soft: rgba(28, 29, 32, 0.07);
  --ok: #1e9a68;
  --ok-soft: #e2f3eb;
  --warn: #b7791f;
  --danger: #c0392b;
  --wave: #c4c5c8;
  --wave-sel: #1c1d20;
  --radius: 12px;
  --col: 760px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #1a1b1e; --surface: #222327; --surface-2: #2c2d32; --line: #34363b;
    --text: #ececea; --text-2: #c3c4c7; --muted: #8e9096;
    --accent: #ececea; --accent-ink: #1a1b1e; --accent-soft: rgba(236, 236, 234, 0.08);
    --ok: #3fbd88; --ok-soft: #1d3a2f; --warn: #d69e2e; --danger: #e5786d;
    --wave: #4a4c52; --wave-sel: #ececea;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1a1b1e; --surface: #222327; --surface-2: #2c2d32; --line: #34363b;
  --text: #ececea; --text-2: #c3c4c7; --muted: #8e9096;
  --accent: #ececea; --accent-ink: #1a1b1e; --accent-soft: rgba(236, 236, 234, 0.08);
  --ok: #3fbd88; --ok-soft: #1d3a2f; --warn: #d69e2e; --danger: #e5786d;
  --wave: #4a4c52; --wave-sel: #ececea;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 "Instrument Sans", system-ui, -apple-system, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  /* 頁尾永遠貼在最下面：內容少的時候也不會浮在畫面中間 */
  display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh;
}
.num, output, input[type=number] { font-variant-numeric: tabular-nums; }
main { flex: 1 0 auto; width: 100%; max-width: var(--col); margin: 0 auto; padding: 8px 20px 32px; }
h1 { font-size: 17px; margin: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
h2 { font-size: 13px; margin: 28px 0 6px; color: var(--muted); font-weight: 500; }
[hidden] { display: none !important; }
a { color: var(--text); }

/* ---------- 頂端列與分頁 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 8px; min-height: 58px;
  /* 大螢幕上按鈕跟內容欄對齊，不要跑到螢幕最左最右 */
  padding: 10px max(20px, calc((100% - var(--col)) / 2 + 20px)); padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--bg);
}
.topbar .spacer { flex: 1; }
.logo-mark { width: 24px; height: 24px; flex: none; color: var(--text); }
.logo-mark circle { fill: var(--ok); }
.back:not([hidden]) + .logo-mark { display: none; }

/* ---------- 首頁 hero（還沒有曲子時） ---------- */
.hero { padding: 18px 0 22px; }
.hero-line { margin: 0; font-size: clamp(21px, 5.4vw, 28px); line-height: 1.35; font-weight: 600; letter-spacing: -0.01em; max-width: 24em; text-wrap: pretty; word-break: auto-phrase; }
.hero-line .phrase { display: inline-block; }
:lang(ko) .hero-line { word-break: keep-all; }
.hero .ladder { display: block; width: 100%; height: auto; margin-top: 18px; color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }
.hero .ladder-wide { display: none; }
@media (min-width: 600px) {
  .hero .ladder-narrow { display: none; }
  .hero .ladder-wide { display: block; }
}
.awake { font-size: 12px; color: var(--text-2); background: var(--accent-soft); padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.back { width: 44px; height: 44px; margin-left: -12px; font-size: 28px; line-height: 1; padding: 0 0 3px; background: none; border: 0; border-radius: 50%; color: var(--text); flex: none; }
/* 頂端右邊的小圖示鈕：語言、深淺色。44px 是手指點得準的最小尺寸 */
.icon-btn { width: 44px; height: 44px; padding: 0; border-radius: 50%; flex: none; }
.lang-btn { position: relative; display: inline-grid; place-items: center; cursor: pointer; border: 1px solid var(--line); }
.lang-btn .lang-code { font-size: 14px; font-weight: 600; letter-spacing: .02em; color: var(--text); }
/* 原生選單疊在代碼上、透明：點下去就打開系統的語言清單，鍵盤也能操作 */
.lang-btn select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; min-height: 0; }
.lang-btn:focus-within { outline: 2px solid var(--text); outline-offset: 2px; }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  display: grid; grid-template-columns: repeat(3, 1fr);
  padding: 6px max(8px, calc((100% - var(--col)) / 2)) calc(10px + env(safe-area-inset-bottom));
  background: var(--bg); border-top: 1px solid var(--line);
}
.tabs button { border: 0; background: none; color: var(--muted); font-size: 12px; display: grid; justify-items: center; gap: 2px; padding: 6px 0; border-radius: 10px; }
.tabs svg { width: 22px; height: 22px; }
.tabs [aria-current="page"] { color: var(--text); font-weight: 600; }
body.has-tabs { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
/* 大螢幕：分頁改成內容欄最上方的分段按鈕，不放在螢幕最下緣 */
@media (min-width: 900px) {
  .tabs { position: static; display: flex; gap: 4px; width: 100%; max-width: var(--col); margin: 0 auto; padding: 0 20px 6px; border: 0; background: none; }
  .tabs button { grid-auto-flow: column; gap: 6px; align-items: center; font-size: 14px; padding: 7px 14px; }
  .tabs svg { width: 18px; height: 18px; }
  .tabs [aria-current="page"] { background: var(--surface-2); }
  body.has-tabs { padding-bottom: 0; }
}

/* ---------- 基本元件 ---------- */
.card { background: none; border: 0; padding: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; justify-content: center; }
.msg { min-height: 1.2em; margin: 8px 0; color: var(--text-2); font-size: 14px; }
.msg.error { color: var(--danger); }

button, .button {
  font: inherit; cursor: pointer; border-radius: var(--radius); padding: 10px 14px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  touch-action: manipulation;
}
button:disabled { opacity: .35; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
button.ghost, .button.ghost { background: transparent; }
button.danger, .danger { color: var(--danger); }
button.small { padding: 6px 12px; font-size: 14px; }
button.big { padding: 15px 18px; font-size: 16px; width: 100%; }
/* 用滑鼠時給回饋；手機沒有 hover，不加，避免點完留著灰底 */
@media (hover: hover) {
  button:not(:disabled):hover, .button:hover { background: var(--surface-2); }
  button.primary:not(:disabled):hover { background: var(--accent); filter: brightness(1.25); }
  .tabs button:hover { color: var(--text); background: none; }
  .seg button:not([aria-pressed="true"]):hover { background: none; color: var(--text); }
  .list li:not(.empty):hover { background: var(--accent-soft); }
  .lang-btn:hover { background: var(--surface-2); }
  .beat.now:hover { background: var(--text); }
  button.link:hover { background: none; text-decoration-thickness: 2px; }
}
/* 危險動作推到最右邊，跟一般按鈕拉開距離，不會順手按到 */
.push-end { margin-left: auto; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
kbd { font: 11px/1 "Instrument Sans", system-ui, sans-serif; color: var(--muted); margin-left: 4px; }
@media (hover: none) { kbd { display: none; } }
button.round { width: 44px; height: 44px; border-radius: 50%; padding: 0; font-size: 20px; flex: none; }

.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0; }
@media (max-width: 340px) { .grid2 { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; }
.field label { font-size: 13px; color: var(--muted); }
input[type=number], input[type=text], input[type=url], select {
  font: inherit; padding: 9px 10px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); min-width: 0; width: 100%;
}
input[type=range] { width: 100%; min-width: 120px; accent-color: var(--text); margin: 0; height: 32px; cursor: pointer; }
.nudge { display: flex; gap: 6px; align-items: center; }
.nudge input { text-align: center; }
details > summary { cursor: pointer; }

/* 一列一列的設定（像系統設定） */
.setrow { display: flex; align-items: center; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.setrows > .setrow:first-child { border-top: 1px solid var(--line); }
.setrow .k { flex: 1; min-width: 7em; }
.setrow .k small { display: block; color: var(--muted); font-size: 12.5px; }
.setrow select { width: auto; min-width: 7em; }
.setrow input[type=range] { flex: 0 1 60%; }
/* 開關：整列都可以點，不用瞄準小小的勾選框 */
.switch-row { cursor: pointer; min-height: 52px; }
.switch { -webkit-appearance: none; appearance: none; flex: none; position: relative; width: 46px; height: 28px; margin: 0; border-radius: 999px; background: var(--line); cursor: pointer; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .15s; }
.switch:checked { background: var(--text); }
.switch:checked::after { transform: translateX(18px); }
.setrow .round { width: 40px; height: 40px; }
.tr-actions { display: flex; gap: 14px; margin-top: 2px; }
button.link { border: 0; background: none; padding: 2px 0; font-size: 13.5px; color: var(--text); text-decoration: underline; text-underline-offset: 3px; border-radius: 4px; }
.setrow output { min-width: 2.2em; text-align: center; font-size: 19px; font-weight: 600; }

/* ---------- 曲庫 ---------- */
.dropzone {
  display: flex; flex-direction: column; gap: 4px; align-items: center; text-align: center;
  padding: 18px 16px; border: 1px dashed var(--muted); border-radius: var(--radius);
  cursor: pointer; color: var(--muted); font-size: 13.5px;
}
.dropzone strong { color: var(--text); font-size: 16px; font-weight: 600; }
.dropzone.over { border-color: var(--text); background: var(--accent-soft); }

.streak { display: flex; align-items: center; gap: 12px; padding: 6px 0 4px; }
.streak b { font-size: 34px; line-height: 1; font-weight: 600; font-variant-numeric: tabular-nums; }
.streak .dots { display: flex; gap: 7px; margin-left: auto; }
.streak .dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--line); display: block; }
.streak .dots i.on { background: var(--text); }
.streak .dots i.today { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px var(--text); }

.list { list-style: none; margin: 8px 0; padding: 0; border-top: 1px solid var(--line); }
.list li { border-bottom: 1px solid var(--line); padding: 13px 2px; display: flex; gap: 12px; align-items: center; cursor: pointer; }
.list li .grow { flex: 1; min-width: 0; }
.list li .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list li .meta { font-size: 13px; color: var(--muted); }
.list li .badge { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.list.compact li { padding: 9px 2px; cursor: default; font-size: 14px; }
.mini { width: 40px; height: 40px; flex: none; transform: rotate(-90deg); }
.mini circle { fill: none; stroke-width: 3.5; }
.mini .bg { stroke: var(--line); }
.mini .fg { stroke: var(--text); stroke-linecap: round; }
.mini .fg.ok { stroke: var(--ok); }
.backup { margin-top: 28px; color: var(--text-2); font-size: 14px; }
.backup > summary { padding: 10px 0; }
.list li.empty { cursor: default; }
/* ---------- 頁尾（每個主畫面共用） ---------- */
.site-foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 20px;
  width: calc(100% - 40px); max-width: calc(var(--col) - 40px); margin: 0 auto; padding: 14px 0 18px;
  border-top: 1px solid var(--line); font-size: 13px; color: var(--muted);
}
.site-foot .foot-links { display: flex; flex-wrap: wrap; gap: 0 20px; }
.site-foot a { color: var(--text-2); text-underline-offset: 3px; display: inline-block; padding: 4px 0; }
.site-foot .copy { margin: 0; }
@media (hover: hover) { .site-foot a:hover { color: var(--text); } }

/* 日文、韓文用各自的字形，避免漢字和諺文顯示成中文字形 */
:lang(ja) body, body:lang(ja) { font-family: "Instrument Sans", system-ui, -apple-system, "Hiragino Sans", "Yu Gothic UI", "Meiryo", "Noto Sans JP", sans-serif; }
:lang(ko) body, body:lang(ko) { font-family: "Instrument Sans", system-ui, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif; }

/* ---------- 段落編輯 ---------- */
.wave-wrap { position: relative; margin: 8px 0; }
.preview-row { margin-bottom: 4px; }
#preview-rate { display: block; margin-bottom: 8px; }
canvas { display: block; width: 100%; border-radius: 10px; background: var(--surface-2); touch-action: none; cursor: crosshair; }

/* ---------- 練習設定 ---------- */
.suggest {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin: 10px 0;
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; font-size: 14px;
}
.hero-range { display: flex; align-items: baseline; justify-content: center; gap: 6px; margin: 14px 0 0; }
.hero-range input {
  width: 2.6em; border: 0; background: none; padding: 0; text-align: center;
  font: 600 52px/1 "Instrument Sans", system-ui, sans-serif; letter-spacing: -.02em; color: var(--text);
  -moz-appearance: textfield; appearance: textfield;
}
.hero-range input::-webkit-inner-spin-button, .hero-range input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.hero-range input:focus-visible { outline: 0; box-shadow: 0 2px 0 var(--text); }
.hero-range span { font-size: 18px; color: var(--muted); }
.dual { position: relative; height: 44px; margin: 4px 2px 0; }
.dual .track, .dual .fillr { position: absolute; top: 20px; height: 4px; border-radius: 2px; }
.dual .track { left: 0; right: 0; background: var(--line); }
.dual .fillr { background: var(--text); }
.dual .orig { position: absolute; top: 12px; width: 1px; height: 20px; background: var(--muted); }
.dual input { position: absolute; inset: 0; width: 100%; margin: 0; background: none; pointer-events: none; -webkit-appearance: none; appearance: none; min-width: 0; }
.dual input::-webkit-slider-runnable-track { background: none; }
.dual input::-webkit-slider-thumb { -webkit-appearance: none; pointer-events: auto; width: 26px; height: 26px; border-radius: 50%; background: var(--surface); border: 2px solid var(--text); cursor: grab; }
.dual input::-moz-range-thumb { pointer-events: auto; width: 22px; height: 22px; border-radius: 50%; background: var(--surface); border: 2px solid var(--text); cursor: grab; }
.dual input::-moz-range-track { background: none; }
.scale { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--surface-2); border-radius: 10px; padding: 3px; margin-top: 16px; }
.seg button { border: 0; background: none; border-radius: 8px; padding: 8px 4px; font-size: 14px; color: var(--text-2); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, .14); }
.preset-note { font-size: 13.5px; color: var(--text-2); margin: 10px 0 14px; min-height: 2.6em; }
.adv { border-bottom: 1px solid var(--line); }
.adv > summary { padding: 12px 0; list-style: none; display: flex; justify-content: space-between; }
.adv > summary::after { content: "›"; color: var(--muted); transition: transform .15s; }
.adv[open] > summary::after { transform: rotate(90deg); }
.adv > summary::-webkit-details-marker { display: none; }
.adv .grid2 { margin-top: 0; }

/* ---------- 圖表 ---------- */
.chart { width: 100%; height: auto; display: block; margin: 12px 0 4px; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .series { fill: none; stroke: var(--text); stroke-width: 2; stroke-linejoin: round; }
.chart .dot { fill: var(--text); stroke: var(--bg); stroke-width: 2; }
.chart .dot-bad { fill: var(--bg); stroke: var(--muted); stroke-width: 2; }
.chart .cur-band { fill: var(--accent-soft); }
.chart .cur-dot { fill: var(--text); stroke: var(--bg); stroke-width: 2; }
.chart .hitbox { fill: transparent; }
.chart .hit:hover .hitbox { fill: var(--accent-soft); }
.chart .pb-line { stroke: var(--ok); stroke-width: 1; stroke-dasharray: 4 4; }
.chart .pb-label { fill: var(--ok); font-size: 12px; font-weight: 600; }

/* ---------- 分段圓環（練習中、結算共用） ---------- */
.ring { position: relative; width: min(72vw, 270px); aspect-ratio: 1; margin: 4px auto 0; }
.ring svg { width: 100%; height: 100%; display: block; }
.ring .s { fill: none; stroke: var(--line); stroke-width: 7; stroke-linecap: round; transition: stroke .25s; }
.ring .s.done { stroke: var(--text); }
.ring .s.now { stroke: var(--text); animation: breathe 1.1s ease-in-out infinite; }
.ring .s.ok { stroke: var(--ok); }
@keyframes breathe { 0%, 100% { opacity: .25; } 50% { opacity: .8; } }
.ring .c { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }

/* ---------- 練習中 ---------- */
.practice { text-align: center; }
.rate-big { font-size: clamp(60px, 19vw, 78px); font-weight: 600; line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.rate-big small { font-size: .36em; margin-left: 2px; color: var(--text-2); font-weight: 500; }
.ring .sub { font-size: 13px; color: var(--muted); margin-top: 6px; font-variant-numeric: tabular-nums; }
.progress { height: 3px; background: var(--line); border-radius: 2px; overflow: hidden; margin: 16px 2px 6px; }
.progress > div { height: 100%; width: 0; background: var(--text); }
.progress.gap > div { background: var(--muted); }
.pr-meta { display: flex; justify-content: space-between; gap: 16px; color: var(--muted); font-size: 13px; margin: 0 2px; font-variant-numeric: tabular-nums; }
.keyrow { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 14px 0 2px; font-size: 14px; color: var(--text-2); }
.keyrow output { min-width: 2em; font-size: 17px; font-weight: 600; color: var(--text); }
.pr-buttons { display: grid; grid-template-columns: 1fr 1.3fr 1fr; gap: 10px; margin: 14px 0 6px; }
.pr-buttons button { flex-direction: column; gap: 4px; padding: 12px 4px; font-size: 14px; }
.pr-buttons svg { width: 22px; height: 22px; }
.pr-hint { margin-top: 10px; }
/* 平板橫放、電腦：左邊大速度，右邊控制鈕 */
@media (min-width: 760px) and (orientation: landscape), (min-width: 1000px) {
  .practice:not([hidden]) { display: grid; grid-template-columns: 1.1fr 1fr; column-gap: 36px; align-items: center; align-content: center; text-align: left; min-height: calc(100vh - 120px); }
  .practice .ring { grid-row: 1 / span 7; width: min(42vw, 380px); }
  .practice .rate-big { font-size: 104px; }
  .practice .keyrow { justify-content: flex-start; }
  .practice .pr-buttons { grid-template-columns: 1fr 1fr; }
  .practice .pr-buttons #btn-pause { grid-column: 1 / -1; order: -1; flex-direction: row; padding: 16px; }
}

/* ---------- 結算 ---------- */
.sum-hero { text-align: center; margin-bottom: 8px; }
.sum-hero .ring { width: min(52vw, 190px); }
.pb-label { font-size: 13px; color: var(--muted); margin-top: 10px; }
.pb-big { position: relative; display: inline-block; font-size: 64px; font-weight: 600; line-height: 1.05; letter-spacing: -.02em; padding-bottom: 6px; font-variant-numeric: tabular-nums; }
.pb-big .u { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--ok); transform: scaleX(0); transform-origin: left; border-radius: 2px; }
.pb-big.mark .u { transition: transform .5s cubic-bezier(.3, .7, .2, 1); transform: scaleX(1); }
.delta { display: inline-block; margin-top: 8px; font-size: 13.5px; font-weight: 600; color: var(--ok); background: var(--ok-soft); padding: 3px 10px; border-radius: 999px; opacity: 0; transition: opacity .3s; }
.delta.show { opacity: 1; }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); margin: 16px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: center; }
.facts div { padding: 10px 0; }
.facts div + div { border-left: 1px solid var(--line); }
.facts b { display: block; font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.facts span { font-size: 12px; color: var(--muted); }

.yt-frame { position: relative; aspect-ratio: 16 / 9; margin: 8px 0 12px; border-radius: 10px; overflow: hidden; background: #000; }
.yt-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ---------- 節拍器 ---------- */
.metro { display: flex; flex-direction: column; gap: 14px; }
.pulse {
  width: min(56vw, 220px); aspect-ratio: 1; margin: 4px auto 0; border-radius: 50%;
  display: grid; place-items: center; background: none; border: 2px solid var(--line);
  font-size: clamp(56px, 18vw, 88px); font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text-2);
}
.pulse.l2 { border-color: var(--text); }
.beats { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.beat {
  width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid var(--line); background: var(--surface);
  color: var(--text-2); font: 600 15px/1 "Instrument Sans", system-ui, sans-serif; padding: 0; cursor: pointer;
}
.beat.l2 { border-color: var(--text); border-width: 3px; color: var(--text); }
.beat.l1 { border-color: var(--text-2); }
.beat.l-1 { border-style: dashed; color: var(--muted); opacity: .55; }
.beat.now { background: var(--text); color: var(--bg); opacity: 1; }
.bpm-row { display: flex; align-items: center; justify-content: center; gap: 8px; }
.bpm-big { display: flex; flex-direction: column; align-items: center; min-width: 110px; }
.bpm-big output { font-size: 52px; font-weight: 600; line-height: 1; }
.bpm-big span { font-size: 12px; color: var(--muted); }
body.flash { animation: flash .18s ease-out; }
@keyframes flash { from { background: var(--text); } to { background: var(--bg); } }

/* ---------- 調音器 ---------- */
.tuner { display: grid; gap: 14px; }
.t-display { text-align: center; padding: 14px 0 0; }
.t-notewrap { font-size: 104px; font-weight: 600; line-height: 1; }
.t-notewrap sub { font-size: 28px; font-weight: 500; color: var(--muted); vertical-align: baseline; margin-left: 2px; }
.t-meter { max-width: 440px; margin: 20px auto 4px; }
.t-dial { position: relative; height: 76px; }
.t-ticks { position: absolute; inset: 0; display: flex; justify-content: space-between; align-items: flex-end; }
.t-ticks i { width: 1px; height: 14px; background: var(--line); }
.t-ticks i.big { height: 26px; background: var(--muted); }
.t-zero { position: absolute; left: 50%; bottom: 0; width: 2px; height: 44px; margin-left: -1px; background: var(--text-2); }
.t-needle { position: absolute; bottom: 0; width: 3px; height: 68px; margin-left: -1.5px; border-radius: 2px; background: var(--muted); left: calc(50% + var(--c, 0) * 50%); transition: left .08s linear, background .15s; }
.heard .t-needle { background: var(--text); }
.t-scale { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 4px; }
.intune .t-needle { background: var(--ok); }
.intune .t-notewrap, .intune .t-cents { color: var(--ok); }
.t-cents { font-size: 17px; font-weight: 600; min-height: 1.5em; margin-top: 8px; }
.t-strings { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; }
.t-strings .string { min-width: 46px; padding: 7px 4px; text-align: center; border: 1px solid var(--line); border-radius: 10px; font-weight: 600; font-size: 14px; color: var(--text-2); }
.t-strings .string.on { border-color: var(--text); color: var(--text); }
.intune .t-strings .string.on { border-color: var(--ok); color: var(--ok); }

/* ---------- 手指操作（手機、平板）：點擊範圍至少 44px，相鄰的鈕拉開 ---------- */
@media (pointer: coarse) {
  button, .button { min-height: 44px; }
  button.small { padding: 10px 14px; }
  input[type=number], input[type=text], input[type=url], select { min-height: 46px; }
  input[type=range] { height: 44px; }
  .row { gap: 10px; }
  .nudge button { width: 44px; padding: 0; flex: none; }
  .seg button { padding: 12px 4px; }
  .setrow .round { width: 44px; height: 44px; }
  button.link { min-height: 44px; min-width: 44px; padding: 0 2px; justify-content: flex-start; }
  .tr-actions { gap: 22px; margin-top: -6px; margin-bottom: -10px; }
  .dual { height: 48px; }
  .dual .track, .dual .fillr { top: 22px; }
  .dual .orig { top: 14px; }
  .dual input::-webkit-slider-thumb { width: 32px; height: 32px; }
  .dual input::-moz-range-thumb { width: 28px; height: 28px; }
  .beats { gap: 12px; }
  .bpm-row { gap: 10px; }
  .site-foot a { padding: 12px 0; }
  .backup > summary { padding: 12px 0; }
  .site-foot .foot-links { gap: 0 24px; }
}

@media (prefers-reduced-motion: reduce) {
  body.flash { animation: none; }
  .ring .s.now { animation: none; opacity: .6; }
  .t-needle, .ring .s { transition: none; }
}

/* 隱私權政策、服務條款 */
body.policy main { max-width: 680px; padding-top: 20px; padding-bottom: 48px; }
.policy .site-foot { max-width: 640px; }
.policy-lang { justify-content: flex-end; gap: 8px; }
.policy-lang label { color: var(--muted); font-size: 13px; }
.policy article { line-height: 1.7; }
.policy article h1 { font-size: 24px; white-space: normal; margin: 20px 0 4px; }
.policy article h2 { font-size: 16px; color: var(--text); font-weight: 600; margin: 28px 0 6px; }
.policy article p, .policy article li { color: var(--text-2); }
.policy article ul { padding-left: 1.2em; }
.policy-back { font-size: 14px; color: var(--muted); text-decoration: none; }
.policy .todo { background: var(--warn); color: #fff; padding: 0 4px; border-radius: 4px; }
