/* ==========================================================================
   Live listen — page styles. Tokens and shell live in ../flexaid.css
   ========================================================================== */

.live-hero .hero-content { min-height: clamp(360px, 44vh, 470px); }
.live-hero h1 { font-size: clamp(1.7rem, 4.4vw, 3rem); }
.live-hero .hero-lead { max-width: 52ch; }

.badge-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.silent-note {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-muted);
}

/* ── Signature readout ─────────────────────────────────────────────────── */
.readout { display: flex; align-items: flex-end; gap: clamp(16px, 3vw, 28px); flex-wrap: wrap; }
.readout > div { position: relative; }
.readout > div + div { padding-left: clamp(16px, 3vw, 28px); }
.readout > div + div::before {
  content: "";
  position: absolute;
  left: 0; top: 6px; bottom: 2px;
  width: 1px;
  background: var(--teal-15);
}
.readout .stat-num {
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  line-height: 0.92;
  margin-top: 8px;
  font-variant-numeric: tabular-nums;
}
#hz { font-weight: 500; }
#hz .unit { font-size: 0.42em; color: var(--fg-muted); margin-left: 0.25em; }

/* ── Input meter ───────────────────────────────────────────────────────── */
.meter-bar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 12px 16px;
}
.meter-label { display: flex; align-items: baseline; gap: 9px; }
.gain { font-family: var(--font-mono); font-size: 12px; font-weight: 600; color: var(--teal); }
.meter-track {
  flex: 1; min-width: 180px; height: 8px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.05);
  overflow: hidden;
}
.meter-fill {
  height: 100%; width: 0%;
  border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--teal), var(--gold));
  transition: width 90ms linear;
}
.meter-fill.hot { background: linear-gradient(90deg, var(--gold), #ef4444); }
.meter-hint { font-size: 12px; color: var(--fg-muted); flex: 1 1 220px; }

/* ── 88-key piano keybed ───────────────────────────────────────────────── */
.piano-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--r-md);
}
.piano {
  position: relative;
  height: clamp(180px, 26vw, 340px);
  min-width: max(100%, calc(52 * 26px));
  border-radius: var(--r-md);
  overflow: hidden;
  background: linear-gradient(180deg, #0c111a, #070b12);
  box-shadow: inset 0 2px 0 var(--teal-10);
}
.white-key, .black-key {
  position: absolute;
  transition: background-color 90ms linear, box-shadow 90ms linear;
}
.white-key {
  top: 0; height: 100%;
  border-right: 1px solid rgba(10, 14, 20, 0.5);
  border-radius: 0 0 5px 5px;
  background: linear-gradient(180deg, #eef2f8, #d9e0ea);
  box-shadow: inset 0 -10px 14px rgba(10, 14, 20, 0.14);
}
.black-key {
  top: 0; height: 61%;
  z-index: 2;
  border-radius: 0 0 4px 4px;
  background: linear-gradient(180deg, #1a2130, #080c13);
  box-shadow: inset 0 -7px 9px rgba(0, 0, 0, 0.5), 0 3px 5px rgba(0, 0, 0, 0.5);
}
.white-key .name, .black-key .name {
  position: absolute;
  bottom: 7px; left: 0; right: 0;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  color: #5b6478;
  opacity: 0.7;
  pointer-events: none;
}
.white-key.need, .white-key.hit {
  background: var(--crayon);
  box-shadow: 0 0 20px color-mix(in srgb, var(--crayon) 55%, transparent), inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}
.black-key.need, .black-key.hit {
  background: var(--crayon);
  box-shadow: 0 0 18px color-mix(in srgb, var(--crayon) 60%, transparent), inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}
.white-key.held { box-shadow: inset 0 0 0 2px #10151f; }
.black-key.held { box-shadow: inset 0 0 0 2px #cbd5e1; }
.white-key.hit, .black-key.hit { box-shadow: 0 0 20px color-mix(in srgb, var(--crayon) 55%, transparent), inset 0 0 0 2px var(--hit-ring); }
.white-key.on .name, .black-key.on .name { color: var(--lab); opacity: 1; }

/* ── Typing board ──────────────────────────────────────────────────────── */
.board-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.typing-board {
  position: relative;
  min-width: 680px;
  height: clamp(168px, 18vw, 250px);
}
.cap {
  position: absolute;
  border: 1px solid var(--teal-08);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 5px 6px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(22, 28, 40, 0.92), rgba(10, 14, 20, 0.92));
  transition: background-color 90ms linear, box-shadow 90ms linear;
}
.cap-glyph {
  font-family: var(--font-mono);
  font-size: clamp(9px, 1vw, 12px);
  font-weight: 600;
  color: var(--fg);
  line-height: 1.1;
}
.cap-note {
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 700;
  text-align: right;
  line-height: 1;
}
.cap-mod { background: rgba(255, 255, 255, 0.02); }
.cap-mod .cap-glyph { color: var(--fg-muted); }
.cap-mod .cap-note { color: transparent; }
/* A note key the current octave has pushed off the ends of the 88-key piano.
   It is still a real key, it just has nothing to play from here. */
.cap-inert { opacity: 0.32; }
.cap-inert .cap-note::after { content: "—"; color: var(--fg-muted); }

.kb-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 10px;
}
.kb-oct {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.kb-oct button {
  min-width: 34px;
  min-height: 34px;
  background: transparent;
  border: 0;
  color: var(--fg);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}
.kb-oct button:hover { background: rgba(255, 255, 255, 0.06); }
.kb-oct button[disabled] { opacity: 0.3; cursor: default; }
.kb-oct .kb-oct-now {
  min-width: 88px;
  padding: 0 8px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: var(--teal);
}
.kb-range { color: var(--fg-muted); font-size: 12px; }
.kb-range b { color: var(--fg); font-weight: 600; }
.kb-layout {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  margin-left: auto;
}
.kb-layout button {
  min-height: 34px;
  padding: 0 10px;
  background: transparent;
  border: 0;
  color: var(--fg-muted);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.kb-layout button[aria-pressed="true"] { background: rgba(255, 255, 255, 0.08); color: var(--fg); }

/* ── Stage ─────────────────────────────────────────────────────────────── */
.stage { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(240px, 1fr); gap: 14px; align-items: start; }
.page[data-mid="1"] .stage { grid-template-columns: 1fr; }
#tracks { width: 100%; height: 340px; display: block; border-radius: var(--r-md); background: var(--bg-canvas); }
.silent { margin-top: 10px; font-size: 12.5px; color: var(--fg-muted); }
.side-col { display: flex; flex-direction: column; gap: 12px; }
.side-col .stat-num { font-size: 1.7rem; margin-top: 6px; color: var(--fg); }
.peaks {
  margin: 8px 0 0;
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--fg-muted);
  white-space: pre-wrap;
  max-height: 190px;
  overflow: auto;
}
.terra-callout {
  background: var(--terra-10);
  border: 1px solid var(--terra-25);
  border-radius: var(--r-md);
  padding: 11px 13px;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--fg-muted);
}

/* ── Bootstrap gate ────────────────────────────────────────────────────── */
.bootstrap {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(6, 9, 14, 0.86);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.bootstrap.hidden, .bootstrap[hidden] { display: none; }
.bootstrap-card {
  background: var(--bg-panel);
  border: 1px solid var(--teal-15);
  border-radius: var(--r-lg);
  padding: 22px 24px 24px;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.bootstrap-card h2 { font-size: 1.05rem; font-weight: 600; color: var(--fg); }
.bootstrap-card p { font-size: 13.5px; line-height: 1.6; color: var(--fg-muted); }
.ios-warn {
  border-left: 3px solid var(--gold);
  padding: 2px 0 2px 12px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--fg) !important;
}
.ios-warn[hidden] { display: none; }

/* The tab-audio button only makes sense where getDisplayMedia exists. */
.share-only { display: none; }
body.can-share .share-only { display: inline-block; }

/* ── Narrow ────────────────────────────────────────────────────────────── */
.page[data-narrow="1"] .readout .stat-num { font-size: clamp(2rem, 12vw, 2.6rem); }
.page[data-narrow="1"] .meter-bar { align-items: flex-start; }
