/* Online Bansuri Flute (newellabs.com/play/flute). Self-contained; system fonts only. */
:root {
  color-scheme: light dark;
  --bg: #f4efe4; --well: #ebe4d4; --card: #fffdf7; --card-2: #f8f2e6;
  --ink: #1b2130; --ink-2: #3a4254; --muted: #586070; --faint: #a39d92; --done: #646b78;
  --line: #e0d6c3; --line-strong: #cbbda3;
  --accent: #0b6b6f; --accent-ink: #ffffff; --accent-soft: rgba(11, 107, 111, .12);
  --hl: #e3a33b; --hl-ink: #241805; --glow: rgba(231, 163, 59, .7);
  --focus: #2459d6; --rec: #c2362b; --rec-on: #c2362b;
  --bam-1: #f6e2b0; --bam-2: #e3bf76; --bam-3: #c69a4f; --bam-4: #9d7132; --node: rgba(110, 72, 20, .35);
  --thread: #8c1d24; --thread-2: #2a1a12;
  --hole: #2a1806; --hole-rim: rgba(255, 240, 210, .55);
  --finger: #0b6b6f; --finger-rim: #7fd1cc;
  --key-top: #fffdf7; --key-strong: #f6efe0; --key-bk: #2f3542; --key-bk-ink: #f2efe8;
  --veil: rgba(244, 239, 228, .55);
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans Devanagari", "Kohinoor Devanagari", sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11161b; --well: #19212a; --card: #1b232c; --card-2: #212a34;
    --ink: #ece7de; --ink-2: #d0cac0; --muted: #a2a9b4; --faint: #5d6470; --done: #8a919c;
    --line: #2a3340; --line-strong: #3b4554;
    --accent: #5fcfc6; --accent-ink: #062224; --accent-soft: rgba(95, 207, 198, .14);
    --hl: #e8ad4a; --hl-ink: #241805; --glow: rgba(240, 180, 80, .55);
    --focus: #93b4ff; --rec: #ee5b4d; --rec-on: #c0392f;
    --bam-1: #d9bd84; --bam-2: #b89350; --bam-3: #8f6b31; --bam-4: #644819; --node: rgba(30, 18, 4, .45);
    --thread: #b3343c; --thread-2: #120c08;
    --hole: #120a03; --hole-rim: rgba(255, 230, 190, .3);
    --finger: #5fcfc6; --finger-rim: #c9fffa;
    --key-top: #232c36; --key-strong: #29323d; --key-bk: #0d1116; --key-bk-ink: #e6e2da;
    --veil: rgba(17, 22, 27, .55);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.6 var(--sans); overflow-x: hidden; }
a { color: inherit; text-decoration-color: var(--hl); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
a:hover { color: var(--accent); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
button { font: inherit; color: inherit; touch-action: manipulation; }
kbd { font: 500 .82em/1 var(--mono); display: inline-block; min-width: 1.6em; padding: .22em .38em; text-align: center; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px; background: var(--card); color: var(--ink); }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }
[hidden] { display: none !important; }
.fine-only { display: none; }
.vh { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: -9999px; top: 8px; z-index: 50; background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: 10px; }
.skip:focus { left: 16px; }

/* Header, hero, footer */
.top { border-bottom: 1px solid var(--line); }
.top-in { min-height: 54px; display: flex; align-items: center; }
.brand { display: inline-flex; align-items: center; gap: 9px; min-height: 44px; text-decoration: none; font-weight: 650; font-size: 15px; padding: 8px 0; }
.brand svg { width: 22px; height: 22px; color: var(--accent); }
.brand-sub { color: var(--muted); font-weight: 500; margin-left: 2px; }
.brand-sub::before { content: "/"; margin-right: 6px; color: var(--faint); }
.hero { padding-top: 18px; padding-bottom: 2px; }
h1 { font: 700 clamp(1.9rem, 7vw, 3rem)/1.05 var(--serif); letter-spacing: -.01em; margin: 0 0 8px; }
.lede { margin: 0; color: var(--ink-2); max-width: 640px; font-size: 1rem; line-height: 1.5; }
/* Phones (under 600 px wide) leave the intro sentence out, so the whole instrument is on the first screen from 360 x 640
   up. By WIDTH only: a phone's visible height changes when its toolbar slides away (664 -> 745 px), and a height rule
   brought the sentence back in mid-visit and moved the flute 78 px under the fingers (README, "Live audit, round 2"). */
@media (max-width: 599px) { .hero .lede { display: none; } .hero { padding-top: 8px; } }
.foot { border-top: 1px solid var(--line); margin-top: 56px; padding: 22px 0 32px; color: var(--muted); font-size: .9rem; }
.foot p { margin: 0; }
.foot-in { display: flex; flex-wrap: wrap; justify-content: space-between; column-gap: 20px; }
.foot a { color: var(--muted); display: inline-block; padding: 12px 0; }

/* Controls */
.stage { padding-top: 16px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 0 0 12px; }
.controls { display: flex; flex-wrap: wrap; gap: 8px; }
.seg { display: inline-flex; align-items: center; background: var(--well); border: 1px solid var(--line); border-radius: 13px; padding: 3px; }
.seg-cap, .songs-cap { font: 650 11px/1 var(--sans); letter-spacing: .09em; text-transform: uppercase; color: var(--muted); padding: 0 6px; white-space: nowrap; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.seg label { min-height: 44px; min-width: 44px; padding: 0 8px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; font-weight: 600; font-size: 14px; color: var(--ink-2); cursor: pointer; white-space: nowrap; touch-action: manipulation; transition: background-color .15s, color .15s; }
.seg input:checked + label { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .12), 0 0 0 1px var(--line); }
.seg input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 1px; }
.songs { display: flex; align-items: center; gap: 8px; flex: 1 1 260px; min-width: 0; max-width: 420px; }
.songs-cap { flex: none; padding-left: 0; cursor: pointer; }
@media (max-width: 599px) { .songs-cap { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } .songs { flex-basis: 100%; max-width: none; } }
.pick { position: relative; flex: 1 1 auto; min-width: 0; display: flex; }
.pick::after { content: ""; position: absolute; right: 16px; top: 50%; width: 7px; height: 7px; margin-top: -6px; border: solid var(--ink-2); border-width: 0 2px 2px 0; transform: rotate(45deg); pointer-events: none; }
.pick select { -webkit-appearance: none; appearance: none; width: 100%; min-width: 0; min-height: 44px; padding: 0 40px 0 16px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--card); color: var(--ink); font: 500 15px/1.2 var(--sans); cursor: pointer; text-overflow: ellipsis; }
.pick select:hover { border-color: var(--hl); }
.pick select.has-song { border-color: var(--hl); box-shadow: inset 0 0 0 1px var(--hl); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 15px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--card); font-size: 15px; font-weight: 600; cursor: pointer; transition: border-color .15s, background-color .15s, color .15s; -webkit-tap-highlight-color: transparent; }
.btn:hover { border-color: var(--ink-2); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .45; cursor: default; transform: none; border-color: var(--line-strong); }
.btn svg { width: 18px; height: 18px; fill: currentColor; flex: none; }
.btn-sm { min-height: 44px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn-sm svg { width: 16px; height: 16px; }
.btn-icon { padding: 0; width: 44px; }
.link-btn { background: none; border: 0; padding: 4px 2px; min-height: 44px; min-width: 44px; color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--hl); text-underline-offset: 3px; cursor: pointer; font-size: inherit; }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--rec); flex: none; transition: border-radius .15s; }
.btn-rec[aria-pressed="true"] { background: var(--rec-on); border-color: var(--rec-on); color: #fff; }
.btn-rec[aria-pressed="true"] .rec-dot { background: #fff; border-radius: 2px; animation: blink 1.2s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .35; } }
.btn .i-stop { display: none; }
.btn.is-playing .i-stop { display: block; }
.btn.is-playing .i-play { display: none; }
#play.attention:not([disabled]) { border-color: var(--hl); box-shadow: 0 0 0 3px var(--glow); }
.mic-state { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 2px 7px; border-radius: 999px; background: var(--well); color: var(--muted); }
.btn-mic[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.btn-mic[aria-pressed="true"] .mic-state { background: var(--accent); color: var(--accent-ink); }
.btn-mic svg rect { fill: currentColor; }

/* Play-along panel */
.along { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 10px 12px 8px; margin: 0 0 12px; }
.along-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; }
.along-title { margin: 0; font-size: 15px; line-height: 1.3; }
/* The panel sits above the flute, so it must not change height while a song is played: the flute and the keys would
   move under the fingers. Two things used to do that: "9 of 16" growing to "10 of 16" (the title wrapped, or the
   buttons dropped a row), and the hint giving way to the shorter "Well played!" line. Each now shares its box with an
   unseen twin (.along-room) holding the longest text it will show, so the box keeps one size all song long. */
.along-count { display: inline-grid; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; margin-left: 4px; white-space: nowrap; }
.along-count > *, .along-hint > * { grid-area: 1 / 1; }
.along-room { visibility: hidden; }
.along-actions { display: flex; gap: 6px; }
.strip { position: relative; display: flex; gap: 3px; overflow-x: auto; padding: 8px 2px 6px; scrollbar-width: none; -webkit-mask-image: linear-gradient(90deg, transparent, #000 18px, #000 calc(100% - 18px), transparent); mask-image: linear-gradient(90deg, transparent, #000 18px, #000 calc(100% - 18px), transparent); }
.strip::-webkit-scrollbar { display: none; }
.strip::before, .strip::after { content: ""; flex: none; width: 40%; }
.tok { flex: none; min-width: 30px; padding: 3px 5px 4px; display: inline-flex; flex-direction: column; align-items: center; border-radius: 8px; font-weight: 650; font-size: 16px; line-height: 1.05; color: var(--ink-2); transition: background-color .12s, color .12s; }
.tok.bar-end { margin-right: 10px; }
.tok.done { color: var(--done); font-weight: 500; }
.tok.cur { background: var(--hl); color: var(--hl-ink); }
.along-hint { display: grid; margin: 2px 0 2px; font-size: 13px; color: var(--muted); }

/* Note names: komal underlined, tivra with a stroke above, octave dots above or below */
.nm { position: relative; display: inline-block; padding: 4px 0; line-height: 1; white-space: nowrap; }
.nm.k > .t { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.nm.tv > .t::before { content: ""; position: absolute; left: 50%; top: -.06em; width: 2px; height: .24em; margin-left: -1px; border-radius: 1px; background: currentColor; }
.nm.lo::after, .nm.hi::after { content: ""; position: absolute; left: 50%; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: currentColor; }
.nm.lo::after { bottom: -4px; }
.nm.hi::after { top: -4px; }
.nm.hi.tv::after { margin-left: 4px; top: -6px; }
.nm sub { font-size: .62em; font-weight: 600; vertical-align: baseline; position: relative; top: .12em; margin-left: .5px; }
.nm .t { position: relative; }

/* The instrument */
.instrument { position: relative; border-radius: 22px; background: var(--card); border: 1px solid var(--line); padding: 10px 10px 12px; box-shadow: 0 18px 40px -26px rgba(60, 40, 10, .45); outline: none; }
.inst-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 6px; }
.inst-head .seg label { min-width: 0; padding: 0 11px; }
/* The note line keeps one height whatever it says. It used to grow to two or three lines for komal and tivra notes on
   an upright phone, which pushed the keys down under the finger holding one (live audit, 2026-10-05). The details sit
   beside the name on at most two lines; a third line (odd fingerings in Holes mode on a narrow phone) ends in "…". */
.readout { display: flex; flex-wrap: nowrap; align-items: center; column-gap: 10px; height: 40px; padding: 0 4px 2px; }
.play-area { position: relative; }
.ro-name { flex: none; font: 700 28px/1.1 var(--serif); min-width: 2.2em; }
.ro-name .nm { padding: 4px 0; }
.ro-detail { flex: 1 1 0; min-width: 0; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; color: var(--muted); font-size: 13px; line-height: 1.3; font-variant-numeric: tabular-nums; }
.instrument.sounding .ro-name { color: var(--accent); }

.flute { position: relative; height: 92px; margin: 0 -4px; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.tube {
  position: absolute; left: 0; right: 0; top: 50%; height: 34px; margin-top: -17px; border-radius: 17px 12px 12px 17px;
  background:
    linear-gradient(90deg, transparent 0 41%, var(--node) 41% 41.6%, transparent 41.6% 79%, var(--node) 79% 79.6%, transparent 79.6%),
    linear-gradient(180deg, var(--bam-1) 0%, var(--bam-2) 30%, var(--bam-3) 72%, var(--bam-4) 100%);
  box-shadow: inset 0 -3px 5px rgba(80, 50, 10, .25), inset 0 2px 1px rgba(255, 255, 255, .35), 0 6px 12px -6px rgba(60, 40, 10, .55);
}
.bind { position: absolute; top: -1px; bottom: -1px; border-radius: 2px; background: repeating-linear-gradient(90deg, var(--thread) 0 3px, var(--thread-2) 3px 4px); box-shadow: inset 0 2px 1px rgba(255, 255, 255, .2), inset 0 -2px 2px rgba(0, 0, 0, .3); }
.bind-a { left: 1.6%; width: 2.6%; }
.bind-b { left: 14.2%; width: 1.8%; }
.bind-c { right: 1%; width: 2.6%; border-radius: 2px 10px 10px 2px; }
.mouth { position: absolute; left: 8%; top: 50%; width: 18px; height: 13px; margin: -6.5px 0 0 -9px; border-radius: 50%; background: radial-gradient(ellipse at 50% 40%, #000 0 45%, var(--hole) 70%); box-shadow: 0 1px 0 var(--hole-rim); }
.air { position: absolute; left: 8%; top: -14px; width: 28px; height: 22px; margin-left: -14px; opacity: 0; pointer-events: none;
  background: radial-gradient(closest-side, var(--accent-soft), transparent), repeating-linear-gradient(100deg, transparent 0 5px, var(--accent) 5px 6.5px, transparent 6.5px 10px);
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 40%, transparent); mask-image: linear-gradient(180deg, transparent, #000 40%, transparent); }
.instrument.sounding .air { opacity: .55; animation: air 0.9s linear infinite; }
@keyframes air { from { transform: translateY(-3px); } to { transform: translateY(4px); } }

.holes { position: absolute; inset: 0; }
.hole { position: absolute; top: 0; bottom: 0; width: 12.5%; margin: 0 0 0 -6.25%; padding: 0; border: 0; background: none; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: none; }
.hole::before { content: ""; position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%; background: radial-gradient(circle at 50% 42%, #000 0 40%, var(--hole) 72%); box-shadow: 0 1px 0 var(--hole-rim), inset 0 2px 3px rgba(0, 0, 0, .6); }
/* finger pad: --cov 0..1 sets how much of the hole it covers, from the top */
.hole .pad { position: absolute; left: 50%; top: 50%; width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 50%; pointer-events: none; opacity: 0;
  background: linear-gradient(180deg, var(--finger) calc(var(--cov, 0) * 100%), transparent calc(var(--cov, 0) * 100%)); box-shadow: 0 0 0 2px var(--finger-rim); transition: opacity .06s; }
.hole.cov .pad { opacity: .95; }
.hole .ghost { position: absolute; left: 50%; top: 50%; width: 36px; height: 36px; margin: -18px 0 0 -18px; border-radius: 50%; border: 2.5px dashed var(--hl); opacity: 0; pointer-events: none; }
.hole.want .ghost { opacity: 1; }
.hole.want-half .ghost { opacity: 1; border-style: dotted; }
.hole .hn { position: absolute; left: 0; right: 0; bottom: 2px; text-align: center; font: 600 11px/1 var(--mono); color: var(--muted); pointer-events: none; }
.hole .hk { position: absolute; left: 0; right: 0; top: 2px; text-align: center; font: 600 10px/1 var(--mono); color: var(--faint); pointer-events: none; display: none; }
.hole:focus-visible { outline: none; }
.hole:focus-visible::before { box-shadow: 0 0 0 3px var(--focus); }
.mode-notes .hole { cursor: default; }

/* Keys: two rows, bottom = gentle breath, top = strong breath */
.keys { display: flex; flex-direction: column-reverse; gap: 8px; margin-top: 6px; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.row { position: relative; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; height: 90px; }
.key, .bk { margin: 0; padding: 0; border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: none; }
.key { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding-bottom: 4px; border-radius: 6px 6px 12px 12px; background: var(--key-top); border: 1px solid var(--line-strong); border-bottom-width: 3px; color: var(--ink); transition: background-color .08s, transform .08s; }
.row.strong .key { background: var(--key-strong); }
/* names sit low and tight so the komal/tivra keys (up to 44 % of the row) never cover them or their octave dots */
.key .p { font-size: 17px; font-weight: 700; line-height: 1.1; }
.key .s { font-size: 11px; font-weight: 600; line-height: 1.1; color: var(--muted); margin-top: 5px; }
.key .nm { padding: 2px 0; } /* octave dots 2 px nearer the name */
.key .kc, .bk .kc { position: absolute; left: 4px; top: 4px; font: 600 10px/1 var(--mono); color: var(--faint); display: none; }
.bk { --bw: min(11%, 56px); position: absolute; top: 0; z-index: 2; width: var(--bw); height: 44%; margin-left: calc(var(--bw) / -2); border-radius: 4px 4px 8px 8px; background: var(--key-bk); color: var(--key-bk-ink); display: flex; align-items: flex-end; justify-content: center; padding-bottom: 4px; box-shadow: 0 3px 0 rgba(0, 0, 0, .25); font-size: 11px; font-weight: 700; }
.bk .kc { color: rgba(255, 255, 255, .45); left: 3px; top: 3px; }
.bk.edge { margin-left: calc(var(--bw) * -1); border-radius: 4px 6px 8px 8px; }
.key.on, .bk.on, .row.strong .key.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); transform: translateY(1px); }
.key.on .s { color: var(--accent-ink); opacity: .85; }
.key.next, .bk.next { box-shadow: 0 0 0 3px var(--hl), 0 0 16px 4px var(--glow); }
.key.next { border-color: var(--hl); }
.key.next .p { color: inherit; }
.key:focus-visible, .bk:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; z-index: 3; }
.keys-cap { margin: 6px 2px 0; font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; }

/* Holes mode: blow buttons */
.blowpad { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 8px; }
.blow { flex: 1 1 140px; min-height: 64px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; border-radius: 16px; border: 1px solid var(--line-strong); border-bottom-width: 3px; background: var(--key-top); font-size: 16px; font-weight: 700; cursor: pointer; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
.blow-hard { background: var(--key-strong); }
.blow.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.blow-ic { width: 22px; height: 14px; background: repeating-linear-gradient(180deg, currentColor 0 2px, transparent 2px 5px); -webkit-mask-image: linear-gradient(90deg, #000, transparent); mask-image: linear-gradient(90deg, #000, transparent); }
.keep { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: 14px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.keep input { width: 20px; height: 20px; accent-color: var(--accent); }

/* Tap-to-start veil */
.start { position: absolute; inset: -2px; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 10px; border: 0; margin: 0; padding: 34px 16px 16px; border-radius: 16px; background: var(--veil); -webkit-backdrop-filter: blur(1.5px); backdrop-filter: blur(1.5px); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.start-pill { display: inline-flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 24px; border-radius: 999px; background: var(--ink); color: var(--bg); font-size: 17px; font-weight: 650; box-shadow: 0 10px 24px -10px rgba(0, 0, 0, .5); transition: transform .15s; }
.start-pill svg { width: 22px; height: 22px; fill: currentColor; }
.start:hover .start-pill { transform: scale(1.03); }
.start-sub { font-size: 13px; font-weight: 500; color: var(--ink); background: var(--card); padding: 4px 10px; border-radius: 999px; text-align: center; }
.start:focus-visible { outline-offset: -3px; }

.turn-hint { display: none; align-items: center; gap: 8px; margin: 10px 0 0; font-size: 13px; color: var(--muted); }
.turn-hint svg { width: 20px; height: 20px; flex: none; color: var(--accent); }
@media (pointer: coarse) and (orientation: portrait) and (max-width: 559px) { .mode-holes .turn-hint { display: flex; } }

/* Recorder and microphone */
.deck { margin-top: 14px; }
.deck-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.meter { position: relative; height: 10px; margin: 10px 0 0; border-radius: 5px; background: var(--well); border: 1px solid var(--line); overflow: hidden; max-width: 420px; }
.meter-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--accent); transition: width .06s linear; }
.meter-on, .meter-hard { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--ink-2); left: 0; }
.meter-hard { background: var(--rec); }
.mic-note { margin: 8px 0 0; font-size: 13px; color: var(--muted); max-width: 640px; }
.status { margin: 6px 0 0; color: var(--muted); font-size: 14px; line-height: 1.45; min-height: 2.9em; }
#status { font-variant-numeric: tabular-nums; }
.keyhint { margin: 4px 0 0; color: var(--muted); font-size: 13px; max-width: 760px; }

/* Help text */
.prose { margin-top: 40px; }
.prose > * { max-width: 700px; }
.prose h2 { font: 700 1.5rem/1.2 var(--serif); margin: 36px 0 12px; }
.prose h3 { font-size: 1.02rem; margin: 22px 0 4px; line-height: 1.35; }
.prose p { margin: 0 0 10px; color: var(--ink-2); }
.prose ul { padding-left: 1.2em; margin: 0; color: var(--ink-2); }
.prose li { margin: 0 0 10px; }
.prose li::marker { color: var(--hl); }
.prose strong { color: var(--ink); }
.table-wrap { overflow-x: auto; margin: 4px 0 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
.chart { border-collapse: collapse; width: 100%; font-size: 15px; }
.chart th, .chart td { text-align: left; padding: 7px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.chart thead th { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.chart tbody tr:last-child th, .chart tbody tr:last-child td { border-bottom: 0; }
.chart tbody th { font-weight: 650; }
.chart tr.sa th, .chart tr.sa td { background: var(--accent-soft); }
.fc { display: inline-flex; gap: 4px; vertical-align: middle; }
.fc .fh:nth-child(4) { margin-left: 5px; }
.fh { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--ink-2); vertical-align: middle; }
.fh.c { background: var(--ink-2); }
.fh.h { background: linear-gradient(180deg, var(--ink-2) 50%, transparent 50%); }
.chart-key { white-space: nowrap; margin-right: 10px; font-size: 14px; }
.chart-key .fh { margin-right: 3px; }
@media (max-width: 419px) { .chart th, .chart td { padding: 7px 8px; font-size: 14px; } .fc { gap: 3px; } .fh { width: 12px; height: 12px; } .fc .fh:nth-child(4) { margin-left: 4px; } }

/* Toast */
/* Messages show at the top of the screen. Starting, or picking a song, scrolls the flute so its keys end at the bottom
   edge, which is where a bottom message used to sit: right over the names of the bottom row of keys. */
.toast { position: fixed; left: 50%; top: max(12px, env(safe-area-inset-top)); z-index: 40; width: max-content; max-width: calc(100vw - 32px); transform: translate(-50%, -12px); opacity: 0; pointer-events: none; background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 12px; font-size: 14px; font-weight: 500; box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .45); transition: opacity .2s, transform .2s; }
/* A message never takes taps: on a short phone it lies over the keys, and for 3.6 s the keys under it were dead (live
   audit, 2026-10-05). Only the "Copy this link" fallback, which holds a text field, can be touched. */
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.show.copy { pointer-events: auto; }
.toast input { display: block; width: min(560px, calc(100vw - 64px)); margin-top: 8px; padding: 8px; border-radius: 8px; border: 0; font: 13px var(--mono); color: var(--ink); background: var(--card); }

/* Wider screens */
@media (min-width: 600px) {
  .wrap { padding-left: 24px; padding-right: 24px; }
  .hero { padding-top: 30px; }
  .stage { padding-top: 22px; }
  .instrument { padding: 14px 18px 16px; }
  .flute { height: 108px; margin: 0; }
  .tube { height: 40px; margin-top: -20px; border-radius: 20px 14px 14px 20px; }
  .hole::before { width: 26px; height: 26px; margin: -13px 0 0 -13px; }
  .hole .pad { width: 34px; height: 34px; margin: -17px 0 0 -17px; }
  .hole .ghost { width: 42px; height: 42px; margin: -21px 0 0 -21px; }
  .row { height: 96px; gap: 6px; }
  .key .p { font-size: 20px; }
  .key .s { font-size: 12px; }
  .bk { font-size: 12px; height: 42%; }
  .readout { height: 42px; }
  .ro-name { font-size: 32px; }
  .seg label { min-width: 44px; padding: 0 10px; }
}
/* 320 px phones: slightly smaller details, so all 24 notes still fit on two lines */
@media (max-width: 343px) { .readout { column-gap: 6px; } .ro-name { min-width: 2em; } .ro-detail { font-size: 12px; } }
@media (hover: hover) and (pointer: fine) {
  .fine-only { display: revert; }
  .key .kc, .bk .kc, .mode-holes .hole .hk { display: block; }
}
@media (orientation: landscape) and (max-height: 500px) {
  .top-in { min-height: 40px; }
  .brand { padding: 4px 0; }
  .hero { padding-top: 6px; padding-bottom: 0; }
  h1 { font-size: 1.5rem; margin: 0; }
  .lede { display: none; }
  .stage { padding-top: 8px; }
  .toolbar { margin-bottom: 8px; }
  .row { height: 66px; }
  .bk { --bw: min(11%, 46px); height: 38%; padding-bottom: 2px; font-size: 11px; }
  .key { padding-bottom: 2px; }
  .key .p { font-size: 16px; }
  .key .s { font-size: 10px; margin-top: 4px; }
  .flute { height: 84px; }
  .readout { height: 32px; }
  .ro-name { font-size: 22px; }
  .ro-detail { line-height: 1.2; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
  .instrument.sounding .air { animation: none; }
  .btn-rec[aria-pressed="true"] .rec-dot { animation: none; }
}

/* More toys (links to the other Newel Labs toys) */
.more-toys { margin-top: 48px; }
.more-toys h2 { font: 700 1.4rem/1.2 var(--serif); margin: 0 0 12px; }
.more-toys ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.more-toys a { display: grid; grid-template-columns: 112px minmax(0, 1fr); align-items: center; column-gap: 14px; min-height: 44px; padding: 10px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); color: var(--ink); text-decoration: none; }
.more-toys a:hover { border-color: var(--hl); color: var(--ink); }
.more-toys img { grid-row: 1 / 3; display: block; width: 112px; height: 63px; border-radius: 10px; object-fit: cover; background: var(--well); }
.more-toys b { align-self: end; font-weight: 700; }
.more-toys span { align-self: start; font-size: 0.88rem; line-height: 1.35; color: var(--muted); }
.more-toys + .foot { margin-top: 40px; }
