/* ==========================================================================
   YT-KEYS — "Night Keys"
   A dark instrument: one neutral family of stepped surfaces, one lit
   color (signal lime) that only means "this is sounding" or "this is the
   thing you're acting on". Allo throughout.
   Sections: fonts · tokens · base · controls · gate · topbar · search
             · stage · screen · info · deck · keys · toast · modal
             · voices · responsive
   ========================================================================== */

@font-face {
  font-family: "Allo";
  src: url("fonts/AlloVariable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Allo Friendly";
  src: url("fonts/AlloVariableFriendly.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* --------------------------------------------------------------------------
   Tokens
   -------------------------------------------------------------------------- */
:root {
  color-scheme: dark;

  --bg: #0B0B0D;
  --bg-2: #0F1012;
  --surface: #141518;
  --surface-2: #1B1C20;
  --surface-3: #25262B;
  --surface-4: #2E3036;
  --line: rgba(255, 255, 255, 0.06);
  --line-2: rgba(255, 255, 255, 0.11);

  --ink: #F3F3EF;
  --ink-2: #B9BAC0;
  --ink-3: #85878E;
  --ink-4: #5A5C63;

  /* No hue. The one "lit" color is plain light: white buttons, pale-gray
     keys when sounding. */
  --accent: #F3F3EF;
  --accent-2: #FFFFFF;
  --accent-ink: #0B0B0D;
  --lit: #C9CAC6;
  --lit-top: #DCDDD9;
  --lit-ink: #0B0B0D;
  --lit-edge: #8A8B88;

  --rec: #FF4D4F;
  --rec-ink: #FFFFFF;

  --key: #1E1F23;
  --key-top: #24252A;
  --key-edge: #08080A;

  --font-ui: "Allo Friendly", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-display: "Allo", "Allo Friendly", "Segoe UI", system-ui, sans-serif;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --spring: cubic-bezier(0.34, 1.4, 0.64, 1);

  --gutter: 28px;
  --maxw: 1240px;
  --radius: 18px;
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

[hidden] { display: none !important; }

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 420;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

body.gate-open,
body.modal-open { overflow: hidden; }

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--ink); }

kbd {
  display: inline-block;
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--surface-3);
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.4);
  color: var(--ink-2);
  font: 500 11.5px/1.5 var(--font-ui);
  text-align: center;
}

.ico {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

:focus-visible {
  outline: 2px solid rgba(243, 243, 239, 0.55);
  outline-offset: 2px;
}

/* Ambient: the song's own artwork, blurred far back. Changes per song. */
.ambient {
  position: fixed;
  inset: -10% -10% auto -10%;
  height: 620px;
  z-index: 0;
  background-size: cover;
  background-position: center;
  filter: blur(90px) saturate(1.25);
  opacity: 0.17;
  pointer-events: none;
  transition: background-image 0.6s var(--ease);
  -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 0%, transparent 100%);
}

.topbar, .stage, .footer { position: relative; z-index: 1; }
.topbar { z-index: 20; }

/* --------------------------------------------------------------------------
   Controls
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--ink);
  font-weight: 540;
  font-size: 14px;
  letter-spacing: -0.005em;
  white-space: nowrap;
  text-decoration: none;
  transition: background 0.15s var(--ease), transform 0.12s var(--ease), color 0.15s;
}

.btn:hover { background: var(--surface-3); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: default; }

.btn-primary { background: var(--accent); color: var(--accent-ink); font-weight: 580; }
.btn-primary:hover { background: var(--accent-2); }

.btn-quiet { background: var(--surface-2); color: var(--ink-2); }
.btn-quiet:hover { color: var(--ink); }

.btn-sm { height: 32px; padding: 0 12px; border-radius: 10px; font-size: 13px; }

.btn-xl {
  height: 58px;
  padding: 0 30px;
  border-radius: 18px;
  font-size: 16px;
  font-weight: 580;
  gap: 10px;
}

.btn-xl .ico { width: 20px; height: 20px; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--ink-2);
  transition: background 0.15s var(--ease), color 0.15s;
}

.icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 10px; }
.icon-btn.sm .ico { width: 16px; height: 16px; }

.seg {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border-radius: 12px;
  background: var(--surface-2);
}

.seg button {
  height: 30px;
  min-width: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-3);
  font-weight: 520;
  font-size: 13px;
  font-feature-settings: "tnum" 1;
  transition: background 0.15s var(--ease), color 0.15s;
}

.seg button:hover { color: var(--ink); }
.seg button.is-on { background: var(--surface-4); color: var(--ink); }

/* --------------------------------------------------------------------------
   Landing (the gate). One click here unlocks sound, so it doubles as the
   start screen. First visit scrolls; a shared beat shows only the hero.
   -------------------------------------------------------------------------- */
.gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  overflow-y: auto;
  overscroll-behavior: contain;
  background:
    radial-gradient(1100px 620px at 50% -12%, rgba(255, 255, 255, 0.055), transparent 70%),
    var(--bg);
  transition: opacity 0.4s var(--ease), transform 0.4s var(--ease);
}

.gate.is-out { opacity: 0; transform: scale(1.01); pointer-events: none; }

.landing {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.l-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}

.l-hero {
  max-width: 760px;
  margin: 0 auto;
  padding: clamp(40px, 9vh, 96px) 0 0;
  text-align: center;
}

.l-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 22px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line-2);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 460;
}

.gate-title {
  margin: 0 0 18px;
  font-family: var(--font-display);
  font-variation-settings: "wght" 600, "ROND" 0, "opsz" 72;
  font-weight: 600;
  font-size: clamp(40px, 7vw, 76px);
  line-height: 0.98;
  letter-spacing: -0.045em;
  text-wrap: balance;
}

.gate-sub {
  max-width: 520px;
  margin: 0 auto;
  color: var(--ink-2);
  font-size: clamp(16px, 1.6vw, 18px);
  line-height: 1.55;
  text-wrap: pretty;
}

.l-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-top: 34px;
}

.l-cta-note {
  color: var(--ink-3);
  font-size: 13px;
  letter-spacing: 0.01em;
}

/* Product preview */
.l-demo {
  margin: clamp(48px, 8vh, 80px) auto 0;
  max-width: 880px;
}

.demo-card {
  container-type: inline-size;
  padding: 18px;
  border-radius: 24px;
  background: linear-gradient(180deg, var(--surface-2), var(--surface) 60%);
  box-shadow:
    inset 0 0 0 1px var(--line-2),
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 40px 100px rgba(0, 0, 0, 0.55);
}

.demo-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.demo-thumb {
  width: 56px;
  height: 32px;
  border-radius: 7px;
  object-fit: cover;
  background: var(--surface-3);
  filter: grayscale(0.35);
}

.demo-song { display: flex; flex-direction: column; min-width: 0; text-align: left; }
.demo-song b { font-weight: 560; font-size: 14px; }
.demo-song span { color: var(--ink-3); font-size: 12.5px; }

.demo-rec {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-left: auto;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 540;
  letter-spacing: 0.06em;
}

.demo-rec i { width: 7px; height: 7px; border-radius: 50%; background: var(--rec); animation: blink 1.2s steps(2, start) infinite; }
.demo-rec em { font-style: normal; color: var(--ink-3); letter-spacing: 0; font-feature-settings: "tnum" 1; }

.demo-tl {
  position: relative;
  height: 30px;
  margin-bottom: 16px;
  border-radius: 9px;
  background: var(--surface-3);
  opacity: 0.85;
}

.demo-tl i {
  position: absolute;
  top: 9px;
  bottom: 9px;
  width: 2px;
  margin-left: -1px;
  border-radius: 2px;
  background: var(--ink-4);
  transition: background 0.12s, top 0.12s var(--ease), bottom 0.12s var(--ease);
}

.demo-tl i.is-on { top: 5px; bottom: 5px; background: var(--ink); }

.demo-board {
  --gap: 6px;
  --k: calc((100cqw + var(--gap)) / 10.5 - var(--gap));
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  width: fit-content;
  margin: 0 auto;
}

.demo-row { display: flex; gap: var(--gap); }
.demo-row.r1 { padding-left: calc((var(--k) + var(--gap)) * 0.5); }
.demo-row.r2 { padding-left: calc((var(--k) + var(--gap)) * 0.75); }
.demo-row.r3 { padding-left: calc((var(--k) + var(--gap)) * 1.25); }

.demo-key {
  position: relative;
  width: var(--k);
  height: calc(var(--k) * 0.74);
  border-radius: 9px;
  background: linear-gradient(180deg, var(--key-top), var(--key));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 2px 0 var(--key-edge),
    0 5px 12px rgba(0, 0, 0, 0.35);
  transition: transform 0.08s var(--ease), background 0.1s, box-shadow 0.08s;
}

.demo-key span {
  position: absolute;
  top: 7px;
  left: 9px;
  color: var(--ink-3);
  font-family: var(--font-display);
  font-variation-settings: "wght" 520, "ROND" 0, "opsz" 28;
  font-size: clamp(10px, 1.6cqw, 15px);
  line-height: 1;
}

.demo-key.is-on {
  transform: translateY(2px);
  background: linear-gradient(180deg, var(--lit-top), var(--lit));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 0 0 var(--key-edge), 0 3px 10px rgba(0, 0, 0, 0.35);
}

.demo-key.is-on span { color: var(--lit-ink); }

.demo-cap {
  margin-top: 16px;
  color: var(--ink-4);
  font-size: 13px;
  text-align: center;
}

/* Below the fold */
.l-section {
  padding: clamp(72px, 12vh, 120px) 0 0;
}

.l-h2 {
  margin: 0;
  font-family: var(--font-display);
  font-variation-settings: "wght" 580, "ROND" 0, "opsz" 48;
  font-weight: 580;
  font-size: clamp(28px, 3.6vw, 40px);
  line-height: 1.08;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 32px 0 0;
  padding: 0;
  list-style: none;
}

.steps li {
  padding: 22px 22px 24px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
}

.step-n {
  display: block;
  margin-bottom: 36px;
  color: var(--ink-4);
  font-size: 13px;
  font-weight: 500;
  font-feature-settings: "tnum" 1;
}

.steps h3 {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 560;
  letter-spacing: -0.01em;
}

.steps p {
  margin: 0;
  color: var(--ink-3);
  font-size: 14.5px;
  line-height: 1.5;
}

.l-loop {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: 48px;
}

.loop-copy p {
  max-width: 420px;
  margin: 16px 0 0;
  color: var(--ink-3);
  font-size: 16px;
  line-height: 1.55;
}

.loop-mock {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  padding: 28px;
  border-radius: 24px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
}

.bubble {
  padding: 9px 14px;
  border-radius: 18px 18px 6px 18px;
  background: var(--surface-4);
  font-size: 14.5px;
}

.link-card {
  display: flex;
  flex-direction: column;
  width: min(300px, 100%);
  overflow: hidden;
  border-radius: 18px 18px 6px 18px;
  background: var(--surface-3);
}

.link-card img {
  width: 100%;
  aspect-ratio: 16 / 8;
  object-fit: cover;
  filter: grayscale(0.35) brightness(0.85);
}

.link-meta { display: flex; flex-direction: column; gap: 3px; padding: 12px 14px 14px; }
.link-host { color: var(--ink-3); font-size: 12px; }
.link-meta b { font-weight: 560; font-size: 14.5px; line-height: 1.3; }

.link-play {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 520;
}

.link-play .ico { width: 13px; height: 13px; }

.l-final {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  text-align: center;
}

.l-foot {
  margin-top: clamp(72px, 12vh, 120px);
  padding: 22px 0 32px;
  border-top: 1px solid var(--line);
  color: var(--ink-4);
  font-size: 12.5px;
  text-align: center;
}

/* Shared beat: the hero alone, centred. */
.gate.is-share .landing,
.gate.is-compact .landing {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.gate.is-share .l-nav .js-start,
.gate.is-share .l-demo,
.gate.is-share .l-more,
.gate.is-compact .l-nav .js-start,
.gate.is-compact .l-demo,
.gate.is-compact .l-more { display: none; }

.gate.is-share .l-hero,
.gate.is-compact .l-hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 0 72px;
}

.gate.is-share .gate-title,
.gate.is-compact .gate-title { font-size: clamp(34px, 5.6vw, 60px); }

/* --------------------------------------------------------------------------
   Top bar
   -------------------------------------------------------------------------- */
.topbar {
  display: grid;
  grid-template-columns: 1fr minmax(0, 540px) 1fr;
  align-items: center;
  gap: 20px;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 14px var(--gutter);
}

.wordmark {
  font-family: var(--font-display);
  font-variation-settings: "wght" 640, "ROND" 0, "opsz" 32;
  font-size: 21px;
  letter-spacing: -0.04em;
  color: var(--ink);
  user-select: none;
}

.wordmark span { color: var(--ink-3); }

.topbar-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* --------------------------------------------------------------------------
   Search box
   -------------------------------------------------------------------------- */
.omnibox {
  position: relative;
  display: flex;
  align-items: center;
  height: 44px;
  margin: 0;
  padding: 0 12px;
  gap: 10px;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
  transition: background 0.15s, box-shadow 0.15s;
}

.omnibox:focus-within,
.omnibox.is-open {
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line-2);
}

.omni-ico { color: var(--ink-3); }

.omnibox input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 14.5px;
}

.omnibox input::placeholder { color: var(--ink-3); }

.omni-kbd { opacity: 0; transition: opacity 0.15s; }
.omnibox:focus-within .omni-kbd { opacity: 1; }

.omni-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 40;
  max-height: min(460px, 70vh);
  overflow-y: auto;
  padding: 6px;
  border-radius: 16px;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line-2), 0 24px 60px rgba(0, 0, 0, 0.55);
  animation: drop 0.16s var(--ease);
}

@keyframes drop {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}

.panel-label,
.panel-foot {
  padding: 8px 10px 6px;
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 500;
}

.panel-foot { padding: 8px 10px 6px; border-top: 1px solid var(--line); margin-top: 4px; font-weight: 500; }

.song-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 7px 8px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  text-align: left;
}

.song-row:hover { background: var(--surface-3); }

.song-row img {
  width: 64px;
  height: 36px;
  border-radius: 7px;
  object-fit: cover;
  background: var(--surface-3);
}

.song-meta { display: flex; flex-direction: column; gap: 1px; min-width: 0; }

.song-title,
.song-artist {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.song-title { font-weight: 540; font-size: 14px; }
.song-artist { color: var(--ink-3); font-size: 12.5px; }

.song-now {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-4);
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 540;
}

.panel-note { padding: 14px 14px 12px; }
.panel-note-title { font-weight: 580; font-size: 15px; }
.panel-note p { margin: 4px 0 12px; color: var(--ink-2); font-size: 13.5px; }
.panel-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.panel-empty { padding: 16px 14px; color: var(--ink-2); }

/* --------------------------------------------------------------------------
   Stage layout
   36 keys: video + song info on top, the full keyboard beneath.
   16 keys: video + info on the left, the 4×4 grid on the right.
   -------------------------------------------------------------------------- */
.stage {
  flex: 1;
  display: grid;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 6px var(--gutter) 20px;
  gap: 20px;
}

body[data-layout="36"] .stage {
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas:
    "screen info"
    "deck   deck";
  align-content: start;
}

body[data-layout="16"] .stage {
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "screen deck"
    "info   deck";
  align-content: start;
}

.screen { grid-area: screen; }
.info { grid-area: info; }
.deck { grid-area: deck; min-width: 0; }

/* --------------------------------------------------------------------------
   Screen (the visible YouTube voice)
   -------------------------------------------------------------------------- */
.player-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--radius);
  background: #000;
  box-shadow: 0 0 0 1px var(--line), 0 20px 50px rgba(0, 0, 0, 0.45);
}

body[data-layout="36"] .player-frame {
  height: clamp(200px, calc(100vh - 530px), 320px);
}

body[data-layout="16"] .player-frame { width: 100%; }

.player-frame iframe {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  border: 0;
}

/* --------------------------------------------------------------------------
   Info: title, song timeline, selected key
   -------------------------------------------------------------------------- */
.info {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  padding: 18px 18px 14px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
}

.np { min-width: 0; }

.np-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-family: var(--font-display);
  font-variation-settings: "wght" 580, "ROND" 0, "opsz" 32;
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.np-sub {
  margin-top: 4px;
  min-height: 19px;
  color: var(--ink-3);
  font-size: 13px;
  font-feature-settings: "tnum" 1;
}

body.is-loading .np-sub { color: var(--ink-2); }

/* The key map takes whatever height the card has spare, so the card never
   shows empty bands; taller tracks just make marks easier to grab. */
.timeline {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.tl-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 24px;
  margin-bottom: 6px;
}

.tl-caption {
  color: var(--ink-3);
  font-size: 12.5px;
  font-weight: 460;
}

.tl-reset {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 8px;
  border: 0;
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 520;
}

.tl-reset:hover { background: var(--surface-3); color: var(--ink); }
.tl-reset .ico { width: 13px; height: 13px; }

.tl-track {
  position: relative;
  flex: 1;
  min-height: 60px;
  max-height: 120px;
  border-radius: 11px;
  background: var(--surface-2);
  cursor: pointer;
  touch-action: none;
  user-select: none;
}

.tl-track::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: var(--line-2);
}

.tl-mark {
  position: absolute;
  top: 34%;
  bottom: 22%;
  width: 2px;
  margin-left: -1px;
  border-radius: 2px;
  background: var(--ink-4);
  transition: background 0.1s, top 0.12s var(--ease), bottom 0.12s var(--ease);
}

.tl-mark.is-on { top: 26%; bottom: 14%; background: var(--ink-2); }

/* The selected key: a tall line with its letter tag inside the track. */
.tl-mark.is-selected {
  top: 28px;
  bottom: 8px;
  width: 3px;
  margin-left: -1.5px;
  background: var(--ink);
  z-index: 2;
}

.tl-mark.is-selected::after {
  content: attr(data-key);
  position: absolute;
  bottom: calc(100% + 3px);
  left: 50%;
  transform: translateX(-50%);
  padding: 1px 7px;
  border-radius: 6px;
  background: var(--ink);
  color: var(--bg);
  font: 580 12px/1.5 var(--font-ui);
}

.tl-head {
  position: absolute;
  top: 60%;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 0 0 3px rgba(243, 243, 239, 0.18);
  opacity: 0;
  z-index: 3;
  pointer-events: none;
  transition: opacity 0.12s;
}

.tl-head.is-on { opacity: 1; }

.timeline.is-dragging .tl-track { cursor: grabbing; }

.tl-times {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  color: var(--ink-4);
  font-size: 12px;
  font-feature-settings: "tnum" 1;
}

.editor {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

#resetKey { color: var(--ink); background: var(--surface-3); }

.ed-cap {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: var(--surface-3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 2px 0 var(--key-edge);
  color: var(--ink);
  font-family: var(--font-display);
  font-variation-settings: "wght" 560, "ROND" 0, "opsz" 28;
  font-size: 17px;
}

.ed-text { min-width: 0; }

.ed-time { color: var(--ink-3); font-size: 13px; }
.ed-time b { color: var(--ink); font-weight: 560; font-size: 15px; font-feature-settings: "tnum" 1; }
.ed-help { color: var(--ink-4); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.ed-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

/* --------------------------------------------------------------------------
   Deck: record, options, keys
   -------------------------------------------------------------------------- */
body[data-layout="36"] .deck { container-type: inline-size; }

body[data-layout="16"] .stage { --p: clamp(70px, calc((100vh - 250px) / 4.4), 122px); }
body[data-layout="16"] .deck { width: calc(var(--p) * 4 + 30px); }
body[data-layout="16"] .info { align-self: start; gap: 22px; }
body[data-layout="16"] .opt-label { display: none; }
body[data-layout="16"] .player-frame { width: min(100%, calc((100vh - 400px) * 16 / 9)); margin: 0 auto; }

.deck-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-bottom: 14px;
}

.rec-group,
.deck-opts,
.take {
  display: flex;
  align-items: center;
  gap: 8px;
}

.deck-opts { gap: 10px 14px; flex-wrap: wrap; }
.rec-group { margin-left: auto; gap: 10px; }

.opt { display: flex; align-items: center; gap: 8px; }
.opt-label { color: var(--ink-3); font-size: 12.5px; font-weight: 460; }

.rec-btn { min-width: 112px; font-feature-settings: "tnum" 1; }

.rec-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--rec);
  flex: none;
}

.rec-btn.is-armed .rec-dot { animation: blink 0.9s steps(2, start) infinite; }

.rec-btn.is-rec { background: var(--rec); color: var(--rec-ink); }
.rec-btn.is-rec:hover { background: #F03E41; }
.rec-btn.is-rec .rec-dot { background: #fff; border-radius: 2px; }

@keyframes blink { to { opacity: 0.15; } }

.take-len {
  color: var(--ink-3);
  font-size: 13px;
  font-feature-settings: "tnum" 1;
  padding: 0 0 0 2px;
}

#takePlay.is-playing .take-len { color: inherit; opacity: 0.6; }

#takePlay .ico-stop { display: none; }
#takePlay.is-playing { background: var(--accent); color: var(--accent-ink); }
#takePlay.is-playing .ico-play { display: none; }
#takePlay.is-playing .ico-stop { display: block; }
#takePlay .ico { width: 15px; height: 15px; }

#shuffleBtn.spin .ico { animation: spin 0.5s var(--ease); }
@keyframes spin { from { transform: rotate(-180deg); } to { transform: none; } }

.board-wrap { position: relative; }

/* --------------------------------------------------------------------------
   Keys
   -------------------------------------------------------------------------- */
.board {
  --gap: 8px;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  width: fit-content;
  margin: 0 auto;
  user-select: none;
  -webkit-user-select: none;
}

/* Full keyboard: keys sized from the deck width, rows staggered like a
   real keyboard (0, ½, ¾, 1¼ keys). */
body[data-layout="36"] .board {
  --k: min(112px, calc((100cqw + var(--gap)) / 10.5 - var(--gap)));
  --kh: clamp(50px, calc(var(--k) * 0.78), 84px);
}

.board-row { display: flex; gap: var(--gap); }

body[data-layout="36"] .row-1 { padding-left: calc((var(--k) + var(--gap)) * 0.5); }
body[data-layout="36"] .row-2 { padding-left: calc((var(--k) + var(--gap)) * 0.75); }
body[data-layout="36"] .row-3 { padding-left: calc((var(--k) + var(--gap)) * 1.25); }

body[data-layout="36"] .pad {
  width: var(--k);
  height: var(--kh);
}

/* 16: a square 4×4 grid. */
body[data-layout="16"] .board { --gap: 10px; }

body[data-layout="16"] .pad {
  width: var(--p);
  height: var(--p);
  border-radius: 16px;
}

.pad {
  position: relative;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(180deg, var(--key-top), var(--key));
  color: var(--ink);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 3px 0 var(--key-edge),
    0 7px 16px rgba(0, 0, 0, 0.38);
  touch-action: none;
  transition: transform 0.07s var(--ease), box-shadow 0.07s var(--ease), background 0.09s;
}

.pad:hover { background: linear-gradient(180deg, #2A2B31, #222328); }

.pad-key {
  position: absolute;
  top: 9px;
  left: 11px;
  color: var(--ink-2);
  font-family: var(--font-display);
  font-variation-settings: "wght" 520, "ROND" 0, "opsz" 28;
  font-size: 16px;
  line-height: 1;
  transition: color 0.12s;
}

body[data-layout="16"] .pad-key {
  top: 14px;
  left: 15px;
  font-size: 24px;
}

.pad.is-selected { box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 3px 0 var(--key-edge),
    0 7px 16px rgba(0, 0, 0, 0.38); }
.pad.is-selected .pad-key { color: var(--ink); }

/* Where in the song this key starts. */
.pad-pos {
  position: absolute;
  left: 11px;
  right: 11px;
  bottom: 11px;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.07);
}

body[data-layout="16"] .pad-pos { left: 15px; right: 15px; bottom: 15px; }

.pad-pos i {
  position: absolute;
  top: -1.5px;
  width: 6px;
  height: 6px;
  margin-left: -3px;
  border-radius: 50%;
  background: var(--ink-3);
}

.pad.is-down {
  transform: translateY(2px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 1px 0 var(--key-edge),
    0 3px 8px rgba(0, 0, 0, 0.35);
}

.pad.is-on {
  background: linear-gradient(180deg, var(--lit-top), var(--lit));
  color: var(--lit-ink);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    0 1px 0 var(--lit-edge),
    0 4px 14px rgba(0, 0, 0, 0.4);
}

.pad.is-on:not(.is-down) { transform: translateY(1px); }
.pad.is-on .pad-key { color: var(--lit-ink); }
.pad.is-on .pad-pos { background: rgba(0, 0, 0, 0.12); }
.pad.is-on .pad-pos i { background: var(--lit-ink); }

.hint {
  margin-top: 16px;
  color: var(--ink-3);
  font-size: 13px;
  text-align: center;
  transition: opacity 0.4s var(--ease);
}

.hint.is-done { opacity: 0; }

.focus-shield {
  position: absolute;
  inset: -6px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 0;
  border-radius: 20px;
  background: rgba(11, 11, 13, 0.8);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: var(--ink);
}

.focus-shield[hidden] { display: none; }
.shield-title { font-weight: 580; font-size: 16px; }
.shield-sub { color: var(--ink-3); font-size: 13px; }

/* Recording: a thin red line along the top of the page says "live". */
body.is-recording::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 50;
  background: var(--rec);
}

/* --------------------------------------------------------------------------
   Footer + toast
   -------------------------------------------------------------------------- */
.footer {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 4px var(--gutter) 24px;
  color: var(--ink-4);
  font-size: 12px;
  text-align: center;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 90;
  max-width: min(520px, calc(100vw - 32px));
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--ink);
  color: var(--bg);
  font-weight: 540;
  font-size: 14px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transform: translate(-50%, 8px);
  pointer-events: none;
  transition: opacity 0.2s var(--ease), transform 0.25s var(--spring);
}

.toast.is-shown { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { background: var(--rec); color: var(--rec-ink); }

/* --------------------------------------------------------------------------
   Settings
   -------------------------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.6);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.modal-backdrop[hidden] { display: none; }

.modal {
  width: min(440px, 100%);
  padding: 20px 22px 22px;
  border-radius: 20px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line-2), 0 30px 80px rgba(0, 0, 0, 0.6);
  animation: drop 0.18s var(--ease);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.modal-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-variation-settings: "wght" 580, "ROND" 0, "opsz" 28;
  font-size: 19px;
  letter-spacing: -0.02em;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0 16px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.row-title { display: block; font-weight: 560; font-size: 14.5px; }
.row-sub { display: block; margin: 2px 0 0; color: var(--ink-3); font-size: 13px; }
.row-sub a { color: var(--ink-2); }

.switch {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex: none;
  width: 42px;
  height: 25px;
  margin: 0;
  border-radius: 999px;
  background: var(--surface-4);
  cursor: pointer;
  transition: background 0.15s;
}

.switch::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: var(--ink);
  transition: transform 0.18s var(--spring);
}

.switch:checked { background: var(--ink); }
.switch:checked::before { transform: translateX(17px); background: var(--bg); }

.key-form { padding-top: 4px; }

.key-form input {
  width: 100%;
  height: 42px;
  margin-top: 12px;
  padding: 0 12px;
  border: 0;
  border-radius: 12px;
  background: var(--bg-2);
  box-shadow: inset 0 0 0 1px var(--line-2);
  outline: 0;
}

.key-form input:focus { box-shadow: inset 0 0 0 1px rgba(243, 243, 239, 0.35); }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

/* --------------------------------------------------------------------------
   My beats — a side sheet on desktop, a bottom sheet on phones.
   -------------------------------------------------------------------------- */
.beats-btn { gap: 7px; }

.beats-count {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--surface-4);
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 560;
  line-height: 20px;
  text-align: center;
  font-feature-settings: "tnum" 1;
}

.beats-count[hidden] { display: none; }

.toast.has-action { pointer-events: auto; display: flex; align-items: center; gap: 14px; padding-right: 8px; }

.toast-action {
  height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.08);
  color: inherit;
  font-weight: 580;
  font-size: 13px;
}

.toast-action:hover { background: rgba(0, 0, 0, 0.14); }

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  justify-content: flex-end;
  background: rgba(0, 0, 0, 0.5);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  animation: fade 0.18s var(--ease);
}

.sheet-backdrop[hidden] { display: none; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.sheet {
  display: flex;
  flex-direction: column;
  width: min(440px, 100%);
  height: 100%;
  padding: 20px 14px 16px;
  background: var(--surface);
  box-shadow: inset 1px 0 0 var(--line-2), -30px 0 80px rgba(0, 0, 0, 0.5);
  animation: slide-in 0.24s var(--ease);
}

@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }

.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 0 8px 14px;
}

.sheet-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-variation-settings: "wght" 580, "ROND" 0, "opsz" 28;
  font-size: 21px;
  letter-spacing: -0.025em;
}

.sheet-sub { margin: 2px 0 0; color: var(--ink-3); font-size: 13px; }

.beat-list {
  flex: 1;
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.beat-list[hidden] { display: none; }

.beat-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: 14px;
  transition: background 0.12s;
}

.beat-row:hover { background: var(--surface-2); }
.beat-row.is-current { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line-2); }

.beat-thumb {
  position: relative;
  width: 72px;
  height: 44px;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 9px;
  background: var(--surface-3);
}

.beat-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(0.3) brightness(0.75);
  transition: filter 0.15s;
}

.beat-play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
}

.beat-play .ico {
  width: 26px;
  height: 26px;
  padding: 7px;
  border-radius: 50%;
  background: rgba(11, 11, 13, 0.62);
  transition: transform 0.15s var(--ease), background 0.15s;
}

.beat-thumb:hover img { filter: none; }
.beat-thumb:hover .beat-play .ico { transform: scale(1.08); background: var(--accent); color: var(--accent-ink); }

.beat-meta { min-width: 0; }

.beat-name {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-weight: 560;
  font-size: 14.5px;
}

.beat-name-text {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.beat-tag {
  flex: none;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface-4);
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 520;
}

.beat-sub {
  overflow: hidden;
  color: var(--ink-3);
  font-size: 12.5px;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-feature-settings: "tnum" 1;
}

.beat-rename {
  width: 100%;
  height: 30px;
  margin: -3px 0 1px;
  padding: 0 8px;
  border: 0;
  border-radius: 8px;
  outline: 0;
  background: var(--bg-2);
  box-shadow: inset 0 0 0 1px rgba(243, 243, 239, 0.35);
  font-weight: 560;
  font-size: 14px;
}

.beat-acts { display: flex; gap: 2px; opacity: 0.55; transition: opacity 0.12s; }
.beat-row:hover .beat-acts,
.beat-row:focus-within .beat-acts { opacity: 1; }
.beat-acts .icon-btn { background: transparent; }
.beat-acts .icon-btn:hover { background: var(--surface-3); }

.beats-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 28px 40px;
  text-align: center;
}

.beats-empty[hidden] { display: none; }

.empty-keys { display: flex; gap: 6px; margin-bottom: 22px; }

.empty-keys span {
  width: 38px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(180deg, var(--key-top), var(--key));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 2px 0 var(--key-edge);
}

.empty-keys span.on {
  transform: translateY(2px);
  background: linear-gradient(180deg, var(--lit-top), var(--lit));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.beats-empty h3 { margin: 0 0 6px; font-size: 17px; font-weight: 580; }
.beats-empty p { max-width: 280px; margin: 0 0 20px; color: var(--ink-3); font-size: 14px; line-height: 1.5; }
.beats-empty b { color: var(--ink-2); font-weight: 540; }

.sheet-foot {
  margin: 10px 8px 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--ink-4);
  font-size: 12px;
}

@media (hover: none) {
  .beat-acts { opacity: 1; }
}

@media (max-width: 560px) {
  .beats-label { display: none; }
  .beats-btn { padding: 0 11px; }

  .sheet-backdrop { align-items: flex-end; }

  .sheet {
    width: 100%;
    height: auto;
    max-height: 86dvh;
    padding: 10px 8px calc(14px + env(safe-area-inset-bottom));
    border-radius: 22px 22px 0 0;
    box-shadow: inset 0 1px 0 var(--line-2), 0 -30px 80px rgba(0, 0, 0, 0.5);
    animation: slide-up 0.26s var(--ease);
  }

  .sheet::before {
    content: "";
    align-self: center;
    width: 36px;
    height: 4px;
    margin-bottom: 12px;
    border-radius: 2px;
    background: var(--surface-4);
  }

  .beats-empty { padding: 20px 24px 28px; }
  .beat-row { grid-template-columns: 60px minmax(0, 1fr) auto; gap: 10px; padding: 8px 6px; }
  .beat-thumb { width: 60px; height: 38px; }
  .beat-tag { font-size: 10.5px; padding: 1px 6px; }
  .beat-acts .icon-btn.sm { width: 30px; }
}

@keyframes slide-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

/* --------------------------------------------------------------------------
   Accounts — menu, avatar, sign-in dialog. Hidden unless config.js is set.
   -------------------------------------------------------------------------- */
.topbar-actions { position: relative; }

.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-block { width: 100%; }

.l-nav-actions { display: flex; align-items: center; gap: 6px; }
#landingSignIn[hidden] { display: none; }

.avatar {
  display: none;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(180deg, #3A3C42, #2B2D33);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
  color: var(--ink);
  font-family: var(--font-display);
  font-variation-settings: "wght" 580, "ROND" 0, "opsz" 28;
  font-size: 13.5px;
  line-height: 1;
}

#settingsBtn.is-account { background: transparent; }
#settingsBtn.is-account:hover { background: var(--surface-2); }
#settingsBtn.is-account .ico { display: none; }
#settingsBtn.is-account .avatar,
.menu .avatar { display: grid; }
.avatar.lg { width: 38px; height: 38px; font-size: 17px; }

.menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 45;
  width: 248px;
  padding: 6px;
  border-radius: 16px;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line-2), 0 24px 60px rgba(0, 0, 0, 0.55);
  animation: drop 0.16s var(--ease);
}

.menu[hidden], .menu-head[hidden], .menu-item[hidden] { display: none; }

.menu-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 12px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
}

.menu-who { display: flex; flex-direction: column; min-width: 0; }
.menu-who b { font-weight: 580; font-size: 14.5px; }
.menu-who span { overflow: hidden; color: var(--ink-3); font-size: 12.5px; white-space: nowrap; text-overflow: ellipsis; }

.menu-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
}

.menu-item:hover { background: var(--surface-3); color: var(--ink); }
.menu-cta span { color: var(--ink); font-weight: 580; }
.menu-cta small { color: var(--ink-3); font-size: 12.5px; font-weight: 420; }
.menu-cta { margin-bottom: 4px; padding-bottom: 11px; border-radius: 10px 10px 4px 4px; box-shadow: 0 1px 0 var(--line); }

.auth-backdrop { z-index: 130; }

.auth-modal { width: min(400px, 100%); padding: 20px 22px 22px; }
.auth-step[hidden] { display: none; }
#authGoogle[hidden], #authEmailForm[hidden], .or[hidden], .dev-link[hidden] { display: none; }
.dev-link { margin-bottom: 8px; }
.auth-modal .modal-head { margin-bottom: 8px; }

.auth-lede {
  margin: 0 0 20px;
  color: var(--ink-3);
  font-size: 14px;
  line-height: 1.5;
}

.auth-lede b { color: var(--ink); font-weight: 540; word-break: break-all; }

.g-logo { width: 18px; height: 18px; flex: none; padding: 2px; border-radius: 4px; background: #fff; box-sizing: content-box; }

.or {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  color: var(--ink-4);
  font-size: 12.5px;
}

.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line-2); }

.auth-email { display: flex; flex-direction: column; gap: 8px; }

.auth-email input,
.name-field {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  outline: 0;
  background: var(--bg-2);
  box-shadow: inset 0 0 0 1px var(--line-2);
  font-size: 15px;
  transition: box-shadow 0.15s;
}

.auth-email input:focus,
.name-field:focus-within { box-shadow: inset 0 0 0 1px rgba(243, 243, 239, 0.4); }

.auth-fine { margin: 14px 0 0; color: var(--ink-4); font-size: 12.5px; text-align: center; }

.name-field { display: flex; align-items: center; gap: 2px; cursor: text; }
.name-field span { color: var(--ink-3); font-size: 15px; }
.name-field input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; font-size: 15px; }

.name-hint { margin: 8px 2px 16px; color: var(--ink-4); font-size: 12.5px; }
.name-hint.is-error { color: #FF8A8C; }

.link-btn {
  display: block;
  margin: 12px auto 0;
  padding: 4px 6px;
  border: 0;
  background: none;
  color: var(--ink-3);
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.link-btn:hover { color: var(--ink); }

.sheet-foot { display: flex; align-items: center; gap: 12px; }
.sheet-foot span { flex: 1; }
.sheet-foot .btn { flex: none; }
.sheet-foot .btn[hidden] { display: none; }

@media (max-width: 560px) {
  .menu { position: fixed; top: 64px; right: 12px; left: auto; }
}

/* --------------------------------------------------------------------------
   Tooltips — the toast's light pill, small.
   -------------------------------------------------------------------------- */
.tip {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 200;
  width: max-content;
  max-width: 260px;
  padding: 6px 10px;
  border-radius: 9px;
  background: var(--ink);
  color: var(--bg);
  font-size: 12.5px;
  font-weight: 520;
  line-height: 1.35;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  opacity: 0;
  transform: translateY(3px);
  transition: opacity 0.12s var(--ease), transform 0.16s var(--ease);
}

.tip.is-below { transform: translateY(-3px); }
.tip.is-shown { opacity: 1; transform: none; }

/* Top-bar sign-in */
.signin-btn { gap: 9px; padding: 0 14px 0 11px; }
.signin-btn .g-logo { display: none; }
.signin-btn.has-google .g-logo { display: block; }

@media (max-width: 560px) {
  .signin-btn.has-google #topSignInLabel { display: none; }
  .signin-btn.has-google { padding: 0 10px; }
}

/* --------------------------------------------------------------------------
   Hidden voices — off-screen, never display:none (players get throttled).
   -------------------------------------------------------------------------- */
.voice-mount {
  position: fixed;
  left: -9999px;
  top: 0;
  width: 320px;
  height: 180px;
  overflow: hidden;
  pointer-events: none;
}

.voice-mount iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1020px) {
  body[data-layout="16"] .stage {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
    grid-template-areas: "screen" "info" "deck";
  }

  body[data-layout="16"] .stage { --p: clamp(64px, calc((100vw - 2 * var(--gutter) - 30px) / 4), 118px); }
  body[data-layout="16"] .deck { width: auto; }
  body[data-layout="16"] .player-frame { width: 100%; }
}

@media (max-width: 860px) {
  :root { --gutter: 16px; }

  .topbar {
    grid-template-columns: auto 1fr;
    grid-template-areas: "brand actions" "search search";
    gap: 12px;
  }

  .wordmark { grid-area: brand; }
  .topbar-actions { grid-area: actions; }
  .omnibox { grid-area: search; }

  /* Phone: the keys come right after the video; song details below. */
  body[data-layout="36"] .stage,
  body[data-layout="16"] .stage {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
    grid-template-areas: "screen" "deck" "info";
    gap: 16px;
  }

  body[data-layout="36"] .player-frame { height: auto; width: 100%; }

  .opt-label { display: none; }
  .tl-track { min-height: 56px; max-height: 64px; }
  /* Phone: the two pickers share a row; Shuffle and Record share the next. */
  .deck-opts { display: contents; }
  .deck-bar { gap: 10px; }
  .hint { display: none; }
}

@media (max-width: 560px) {
  .ed-help { display: none; }
  .ed-time > span { display: none; }
  .editor { flex-wrap: wrap; row-gap: 10px; }
  .ed-text { flex: 1 0 auto; }
  .ed-actions { margin-left: 0; }
  .ed-actions .btn { padding: 0 10px; }
  .seg button { min-width: 30px; padding: 0 8px; }
  .info { padding: 16px; }
  .np-title { font-size: 19px; }
  body[data-layout="36"] .board { --gap: 5px; }
  body[data-layout="36"] .pad { border-radius: 8px; }
  body[data-layout="36"] .pad-key { top: 6px; left: 7px; font-size: 14px; }
  body[data-layout="36"] .pad-pos { left: 6px; right: 6px; bottom: 7px; }
  .steps { grid-template-columns: minmax(0, 1fr); }
  .step-n { margin-bottom: 18px; }
  .l-loop { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .loop-mock { padding: 20px; }
  .demo-card { padding: 12px; border-radius: 18px; }
  .demo-board { --gap: 4px; }
  .demo-key { border-radius: 6px; }
  .demo-key span { top: 4px; left: 5px; }
  .demo-cap { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

.footer a, .l-foot a { color: var(--ink-3); text-underline-offset: 3px; }
.footer a:hover, .l-foot a:hover { color: var(--ink); }

/* Search box: what Enter will do, shown while typing. */
.hint-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 12px;
  border: 0;
  border-radius: 11px;
  background: var(--surface-3);
  color: var(--ink-2);
  font-size: 14px;
  text-align: left;
}

.hint-row:hover { background: var(--surface-4); color: var(--ink); }
.hint-row .ico { width: 16px; height: 16px; color: var(--ink-3); }
.hint-text { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.hint-text b { color: var(--ink); font-weight: 560; }

/* SoundCloud: its visible player shares the video frame. Only the active
   source's player shows; the other stays loaded but hidden and paused. */
.sc-screen { position: absolute; inset: 0; display: none; background: #000; }
body[data-source="sc"] .sc-screen { display: block; }
body[data-source="sc"] #player0 { visibility: hidden; }

/* Key map header actions (Save keys, Reset all) */
.tl-actions { display: inline-flex; align-items: center; gap: 6px; }
.beat-tag.is-keys { background: transparent; box-shadow: inset 0 0 0 1px var(--line-2); color: var(--ink-3); }

/* Phones: My beats + My keys + Share + Sign in must fit beside the wordmark.
   Share keeps its white button but shows just its icon. */
@media (max-width: 480px) {
  .topbar-actions { gap: 6px; }
  .beats-btn { padding: 0 8px; gap: 5px; }
  .beats-count { min-width: 18px; height: 18px; line-height: 18px; padding: 0 5px; font-size: 11px; }
  #shareBtn { padding: 0 11px; }
  #shareBtn #shareLabel { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .signin-btn { padding: 0 10px; }
}
