/* Metronome (/tools/metronome). Builds on proto.css + home.css; theme-aware through the theme colours. */
.metro { max-width: 560px; padding-top: 12px; padding-bottom: calc(32px + env(safe-area-inset-bottom)); }
.crumb { display: block; width: fit-content; margin-bottom: 8px; font-size: 0.85rem; font-weight: 700; color: var(--muted); text-decoration: none; }
.metro h1 { font-size: 1.6rem; }

.metro-face { margin-top: 12px; padding: 18px 16px 16px; text-align: center; border: 1px solid var(--line); transition: box-shadow 0.06s; }
.metro-face.pulse { animation: m-pulse 0.16s ease-out; }
.metro-face.pulse.strong { animation-name: m-pulse-strong; }
@keyframes m-pulse { from { box-shadow: 0 0 0 3px var(--accent-soft); } to { box-shadow: 0 0 0 0 transparent; } }
@keyframes m-pulse-strong { from { box-shadow: 0 0 0 6px var(--accent); } to { box-shadow: 0 0 0 0 transparent; } }
@media (prefers-reduced-motion: reduce) { .metro-face.pulse, .metro-face.pulse.strong { animation: none; } }
.tname { margin: 0; font-size: 0.8rem; font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-ink); }
.bpm-wrap { margin: 2px 0 0; display: flex; align-items: baseline; justify-content: center; gap: 6px; }
.bpm { font-size: clamp(4rem, 22vw, 5.6rem); font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; color: var(--ink); }
.bpm-unit { font-size: 0.85rem; font-weight: 800; color: var(--muted); }
.tempo-row { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.tempo-row input { flex: 1; min-width: 0; }
.metro input[type="range"] { accent-color: var(--accent); height: 28px; }
.round, .sq { display: grid; place-items: center; flex: none; padding: 0; border: 1px solid var(--line); background: var(--card); color: var(--ink); touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; cursor: pointer; }
.round { width: 52px; height: 52px; border-radius: 50%; }
.sq { width: 40px; height: 40px; border-radius: 12px; }
.round:disabled, .sq:disabled { opacity: 0.35; cursor: default; }
.round:active:not(:disabled), .sq:active:not(:disabled) { background: var(--paper-2); }

.dots { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin: 20px 0 0; }
.dot { position: relative; width: 40px; height: 40px; padding: 0; border-radius: 50%; border: 2px solid var(--line); background: var(--card); cursor: pointer; transition: transform 0.06s; }
.dots.many { gap: 7px; }
.dots.many .dot { width: 32px; height: 32px; }
.dot::after { content: ''; position: absolute; inset: 0; margin: auto; border-radius: 50%; background: var(--ink-2); }
.dot.lv-2 { border-color: var(--accent); }
.dot.lv-2::after { width: 55%; height: 55%; background: var(--accent); }
.dot.lv-1::after { width: 28%; height: 28%; }
.dot.lv-0 { border-style: dashed; }
.dot.lv-0::after { display: none; }
.dot.on { transform: scale(1.14); background: var(--accent); border-color: var(--accent); }
.dot.on::after { background: var(--card); }
.dot.lv-0.on { background: var(--paper-2); border-color: var(--line); }
.dots-hint { margin: 8px 0 0; font-size: 0.78rem; color: var(--muted); }
.bar-n { min-height: 1.2em; margin: 4px 0 0; font-size: 0.82rem; font-weight: 800; color: var(--ink-2); }
.metro-actions { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-top: 10px; }
#toggle { min-height: 56px; font-size: 1.15rem; }
#tap { min-height: 56px; padding-left: 18px; padding-right: 18px; }
#tap.hit { animation: m-tap 0.15s ease-out; }
@keyframes m-tap { from { transform: scale(0.95); } to { transform: none; } }
.metro-status { min-height: 1.2em; margin: 8px 0 0; font-size: 0.86rem; font-weight: 700; color: var(--accent-ink); }
.metro-status:empty { display: none; }

.metro-opts { margin-top: 12px; padding: 4px 16px; border: 1px solid var(--line); }
.opt { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; padding: 8px 0; }
.opt + .opt, .trainer-box, .trainer-box .opt { border-top: 1px solid var(--line); }
.opt-col { flex-wrap: wrap; }
.opt-label { font-weight: 800; font-size: 0.95rem; color: var(--ink); }
.opt input[type="range"] { width: min(220px, 55%); }
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper output { min-width: 2.4em; text-align: center; font-weight: 900; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.m-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.m-chip { min-height: 38px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); color: var(--ink-2); font-weight: 800; font-size: 0.86rem; cursor: pointer; }
.m-chip[aria-pressed="true"] { background: var(--ink-bg); border-color: var(--ink-bg); color: #fff; }
.switch { width: 48px; height: 28px; flex: none; accent-color: var(--accent); cursor: pointer; }
.trainer-text { margin: 0; padding: 10px 0; font-size: 0.86rem; color: var(--ink-2); }
.metro-keys, .metro-saved { margin-top: 12px; font-size: 0.8rem; color: var(--muted); }
.metro-saved { margin-top: 4px; }
@media (hover: none) { .metro-keys { display: none; } }
