/* FOLLOW ME — stage-dark. Midnight navy, gold, electric-blue glow. Built to read from 2 m away. */
:root {
  --bg: #060A18;
  --bg2: #0B1228;
  --panel: #101937;
  --panel2: #16214A;
  --line: #22305E;
  --text: #EEF2FF;
  --muted: #8C98BF;
  --gold: #F2B632;
  --gold2: #FFD66B;
  --blue: #2F7BFF;
  --glow: #4DA3FF;
  --red: #FF3B3B;
  --green: #22C55E;
  --purple: #9B5CFF;
  --display: "Avenir Next Condensed", "AvenirNextCondensed-Heavy", "Roboto Condensed", "Arial Narrow", "Helvetica Neue", system-ui, sans-serif;
  --ui: -apple-system, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --r: 14px;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--ui); overscroll-behavior: none; }
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
input, select { -webkit-user-select: text; user-select: text; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; touch-action: manipulation; }
.hidden { display: none !important; }

.screen { display: none; position: fixed; inset: 0; }
body[data-screen="home"] #home, body[data-screen="md"] #md, body[data-screen="band"] #band, body[data-screen="keymap"] #keymap { display: flex; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: var(--r);
  font-family: var(--display); font-weight: 800; letter-spacing: .06em; font-size: 18px; transition: transform .06s, filter .12s, box-shadow .12s; }
.btn:active { transform: scale(.97); }
.btn.xl { min-height: 64px; font-size: 24px; width: 100%; }
.btn.sm { min-height: 40px; font-size: 15px; }
.btn.gold { background: linear-gradient(180deg, var(--gold2), var(--gold)); color: #1A1204; box-shadow: 0 6px 24px -8px rgba(242,182,50,.7), inset 0 1px 0 rgba(255,255,255,.5); }
.btn.blue { background: rgba(47,123,255,.12); color: #CFE2FF; border: 1.5px solid var(--blue); box-shadow: 0 0 22px -6px var(--glow), inset 0 0 16px -8px var(--glow); }
.btn.ghost { color: var(--muted); border: 1px solid var(--line); }
.icon-btn { width: 44px; height: 44px; border-radius: 12px; font-size: 22px; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.icon-btn:active { background: var(--panel2); }

/* ---------- home ---------- */
#home { align-items: center; justify-content: center; overflow-y: auto;
  background: radial-gradient(1100px 600px at 50% -10%, rgba(47,123,255,.22), transparent 60%), radial-gradient(700px 500px at 50% 120%, rgba(242,182,50,.12), transparent 60%), var(--bg); }
.home-wrap { width: min(440px, 100% - 32px); padding: calc(24px + var(--safe-t)) 0 calc(24px + var(--safe-b)); display: flex; flex-direction: column; gap: 22px; margin: auto; }
.brand { text-align: center; }
.app-icon { width: 96px; height: 96px; border-radius: 22px; box-shadow: 0 10px 40px -10px rgba(242,182,50,.55), 0 0 0 1px rgba(242,182,50,.25); margin-bottom: 10px; }
.mark { display: inline-flex; gap: 6px; align-items: flex-end; height: 46px; margin-bottom: 6px; }
.mark span { width: 10px; border-radius: 3px; background: var(--gold); box-shadow: 0 0 14px rgba(242,182,50,.6); animation: mark 1.2s ease-in-out infinite; }
.mark span:nth-child(1) { height: 60%; animation-delay: 0s; } .mark span:nth-child(2) { height: 100%; animation-delay: .15s; }
.mark span:nth-child(3) { height: 75%; animation-delay: .3s; } .mark span:nth-child(4) { height: 45%; animation-delay: .45s; background: var(--glow); box-shadow: 0 0 14px var(--glow); }
@keyframes mark { 50% { transform: scaleY(.55); } }
.wordmark { font-family: var(--display); font-weight: 900; font-size: clamp(40px, 12.5vw, 84px); letter-spacing: .05em; white-space: nowrap; margin: 0; line-height: .95;
  background: linear-gradient(180deg, #FFF3C9 0%, var(--gold) 55%, #B9831A 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 24px rgba(242,182,50,.35)); }
.tag { color: var(--muted); margin: 8px 0 0; font-size: 15px; }
.home-card { background: linear-gradient(180deg, var(--panel), var(--bg2)); border: 1px solid var(--line); border-radius: 22px; padding: 20px; display: flex; flex-direction: column; gap: 14px;
  box-shadow: 0 20px 60px -30px rgba(0,0,0,.8), inset 0 1px 0 rgba(255,255,255,.04); }
.field { display: flex; flex-direction: column; gap: 8px; }
.field > span, .set-group h4 { font-family: var(--display); font-weight: 800; letter-spacing: .14em; font-size: 13px; color: var(--muted); margin: 0; }
.field input, .text, .select { background: var(--bg); border: 1.5px solid var(--line); border-radius: 12px; color: var(--text); font-size: 18px; padding: 12px 14px; width: 100%; outline: none; }
.field input:focus, .text:focus { border-color: var(--glow); box-shadow: 0 0 0 3px rgba(77,163,255,.2); }
.code-input { font-family: var(--display); font-weight: 900; font-size: 40px !important; letter-spacing: .4em; text-align: center; text-transform: uppercase; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 9px 12px; border-radius: 999px; border: 1.5px solid var(--line); font-family: var(--display); font-weight: 800; font-size: 14px; letter-spacing: .06em; color: var(--muted); }
.chip.on { border-color: var(--gold); color: var(--gold); background: rgba(242,182,50,.1); }
.home-foot { display: flex; gap: 10px; justify-content: center; }
.err { color: #FF8A8A; text-align: center; min-height: 1.2em; margin: 0; font-weight: 600; }
.hint { color: var(--muted); font-size: 13px; margin: 0; line-height: 1.4; }
.server-note { color: var(--muted); font-size: 12px; text-align: center; margin: 0; opacity: .8; }

/* ---------- md ---------- */
#md { flex-direction: column; background: var(--bg); }
.l-top { display: flex; align-items: center; gap: 10px; padding: calc(8px + var(--safe-t)) 12px 8px; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--bg2), var(--bg)); flex-wrap: wrap; }
.code-chip { font-family: var(--display); font-weight: 900; font-size: 22px; letter-spacing: .18em; color: var(--gold); border: 1.5px solid rgba(242,182,50,.5); border-radius: 10px; padding: 6px 10px; }
.code-chip.small { font-size: 14px; padding: 3px 7px; }
.tempo { display: flex; align-items: center; gap: 4px; }
.bpm { display: flex; flex-direction: column; align-items: center; line-height: 1; min-width: 64px; }
.bpm b { font-family: var(--display); font-weight: 900; font-size: 30px; }
.bpm small { font-size: 10px; letter-spacing: .2em; color: var(--muted); }
.btn.tap { min-height: 42px; padding: 0 14px; background: var(--panel2); border: 1px solid var(--line); }
.btn.tap.hit { background: var(--glow); color: #03122E; }
#meter { background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 10px; height: 42px; padding: 0 8px; font-weight: 700; }
.beats { display: flex; gap: 6px; align-items: center; }
.beats i { width: 14px; height: 14px; border-radius: 50%; background: var(--panel2); border: 1px solid var(--line); transition: background .05s; }
.beats i.on { background: var(--glow); box-shadow: 0 0 12px var(--glow); border-color: var(--glow); }
.beats i.on.one { background: var(--gold); box-shadow: 0 0 14px var(--gold); border-color: var(--gold); }
.beats.small i { width: 10px; height: 10px; }
.btn.count { min-height: 42px; padding: 0 12px; font-size: 15px; background: rgba(242,182,50,.1); color: var(--gold); border: 1px solid rgba(242,182,50,.45); }
.band-btn { margin-left: auto; font-family: var(--display); font-weight: 800; letter-spacing: .08em; padding: 8px 12px; border-radius: 10px; background: var(--panel2); border: 1px solid var(--line); }
.band-btn span { color: var(--glow); }

.l-body { flex: 1; display: flex; min-height: 0; }
.pad { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 10px 12px 18px; display: flex; flex-direction: column; gap: 14px; -webkit-overflow-scrolling: touch; }
.row h3 { font-family: var(--display); font-weight: 800; letter-spacing: .16em; font-size: 12px; color: var(--muted); margin: 0 0 7px; display: flex; gap: 8px; align-items: baseline; }
.row h3 em { font-style: normal; color: var(--gold); letter-spacing: .1em; }
.row.locked .grid { opacity: .35; }
.row.locked h3::after { content: "🔒 BAND PLAN"; color: var(--gold); font-size: 11px; margin-left: auto; }
.grid { display: grid; gap: 7px; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
.grid.who { grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); }
.grid.degrees { grid-template-columns: repeat(7, 1fr); }
.grid.mods { grid-template-columns: repeat(9, 1fr); margin-top: 7px; }
.grid.keys { grid-template-columns: repeat(6, 1fr); margin-top: 7px; }
.grid.keymove { grid-template-columns: repeat(4, 1fr); }
.p { min-height: 52px; border-radius: 12px; background: linear-gradient(180deg, var(--panel2), var(--panel)); border: 1px solid var(--line); font-family: var(--display); font-weight: 800;
  font-size: 15px; letter-spacing: .02em; padding: 6px 4px; line-height: 1.05; text-transform: uppercase; box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
  overflow-wrap: anywhere; min-width: 0; }
.p:active { transform: scale(.96); }
.p.long { font-size: 12.5px; letter-spacing: 0; }
.p.mod { text-transform: none; }
.p.lower { text-transform: none; font-size: 20px; font-style: italic; font-family: Georgia, "Times New Roman", serif; }
.p.sec { border-color: rgba(47,123,255,.45); }
.p.sec.on { background: var(--blue); color: #fff; box-shadow: 0 0 20px -2px var(--glow); }
.p.deg { font-size: 26px; border-color: rgba(242,182,50,.35); }
.p.mod { font-size: 17px; border-color: rgba(242,182,50,.25); }
.p.chord.on, .p.deg.on { background: var(--gold); color: #1A1204; }
.p.cmd.on { background: #fff; color: #0A1024; }
.p.stopish { border-color: rgba(255,59,59,.5); }
.p.stopish.on { background: var(--red); color: #fff; }
.p.dyn { border-color: rgba(34,197,94,.4); }
.p.dyn.on { background: var(--green); color: #031A0B; }
.p.tmp.on { background: #fff; color: #0A1024; }
.p.key { border-color: rgba(155,92,255,.45); }
.p.key.on { background: var(--purple); color: #fff; box-shadow: 0 0 18px -4px var(--purple); }
.p.who { min-height: 42px; font-size: 13px; }
.p.who.on { background: rgba(77,163,255,.18); border-color: var(--glow); color: #CFE2FF; }

.band-list { width: 300px; border-left: 1px solid var(--line); background: var(--bg2); padding: 10px 12px; overflow-y: auto; }
.bl-head { display: flex; align-items: center; justify-content: space-between; }
.bl-head h3 { font-family: var(--display); letter-spacing: .16em; font-size: 14px; margin: 0; color: var(--muted); }
#bl-items { list-style: none; margin: 8px 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
#bl-items li { display: grid; grid-template-columns: 10px 1fr auto; gap: 10px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
#bl-items li b { font-family: var(--display); letter-spacing: .06em; }
#bl-items li small { color: var(--muted); display: block; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
#bl-items li code { font-size: 12px; color: var(--muted); text-align: right; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: #555; }
.dot.ok { background: var(--green); box-shadow: 0 0 8px var(--green); }
.dot.warn { background: var(--gold); }
.dot.off { background: var(--red); }

.l-dock { border-top: 1px solid var(--line); background: linear-gradient(0deg, #04071200, var(--bg2)); padding: 10px 12px calc(10px + var(--safe-b)); display: flex; flex-direction: column; gap: 8px;
  box-shadow: 0 -20px 40px -20px rgba(0,0,0,.8); }
.armed { display: flex; align-items: center; gap: 8px; border-radius: 14px; padding: 8px 8px 8px 14px; background: var(--panel); border: 1.5px dashed var(--line); min-height: 62px; }
.armed.ready { border-style: solid; border-color: var(--k, var(--gold)); box-shadow: 0 0 24px -10px var(--k, var(--gold)); }
.armed-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.armed-text small { font-size: 10px; letter-spacing: .2em; color: var(--muted); font-weight: 700; }
.armed-text b { font-family: var(--display); font-weight: 900; font-size: 26px; letter-spacing: .03em; color: var(--k, var(--text)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.armed-text span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.when { display: flex; gap: 8px; }
.seg { display: flex; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 3px; flex: 1; }
.seg.small { flex: none; }
.seg.wide { flex-wrap: wrap; }
.seg button { flex: 1; min-height: 38px; border-radius: 9px; font-family: var(--display); font-weight: 800; font-size: 14px; letter-spacing: .04em; color: var(--muted); padding: 0 5px; white-space: nowrap; }
.seg button.on { background: var(--panel2); color: var(--text); box-shadow: inset 0 0 0 1px var(--glow), 0 0 14px -6px var(--glow); }
.fire-row { display: grid; grid-template-columns: 1fr 1fr 2fr; gap: 8px; }
.btn.stop, .btn.hold { min-height: 68px; font-size: 24px; background: linear-gradient(180deg, #FF5252, #C61A1A); color: #fff; box-shadow: 0 8px 26px -10px rgba(255,59,59,.9), inset 0 1px 0 rgba(255,255,255,.35); }
.btn.hold { background: linear-gradient(180deg, #D92C2C, #8E1111); }
.btn.fire { min-height: 68px; font-size: 30px; letter-spacing: .14em; background: linear-gradient(180deg, var(--gold2), var(--gold)); color: #1A1204; box-shadow: 0 10px 34px -10px rgba(242,182,50,.9), inset 0 1px 0 rgba(255,255,255,.55); }
.btn.fire:disabled { filter: grayscale(.8) brightness(.55); }
.fired { font-size: 13px; color: var(--muted); min-height: 1.2em; text-align: center; font-variant-numeric: tabular-nums; }
.fired b { color: var(--text); }

/* iPad / landscape: everything on one screen, band list docked */
@media (min-width: 900px) {
  .pad { display: grid; grid-template-columns: 1fr 1fr; align-content: start; column-gap: 18px; }
  .row[data-row="who"], .row[data-row="command"] { grid-column: 1 / -1; }
  .band-list { display: block; }
  .band-list.hidden { display: block !important; }
  #bl-close { display: none; }
  .l-dock { display: grid; grid-template-columns: 1.1fr 1.2fr 1.2fr; align-items: center; column-gap: 12px; }
  .l-dock .fired { grid-column: 1 / -1; }
  .p { min-height: 58px; font-size: 17px; }
}
@media (max-width: 899px) {
  .band-list:not(.hidden) { position: fixed; right: 0; top: 0; bottom: 0; z-index: 30; width: min(340px, 90vw); box-shadow: -20px 0 60px rgba(0,0,0,.6); padding-top: calc(10px + var(--safe-t)); }
}
@media (max-width: 520px) {
  .l-top { gap: 6px; }
  .l-top .beats { order: 10; width: 100%; justify-content: center; }
  .code-chip { font-size: 18px; }
  .bpm b { font-size: 24px; } .bpm { min-width: 48px; }
  .btn.count { font-size: 13px; padding: 0 8px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
  .grid.mods { grid-template-columns: repeat(5, 1fr); }
  .p { font-size: 13.5px; }
  .grid.who { grid-auto-flow: column; grid-template-columns: none; grid-auto-columns: 84px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
  .grid.who::-webkit-scrollbar { display: none; }
  .grid.keys { grid-template-columns: repeat(4, 1fr); }
  .grid.keymove { grid-template-columns: repeat(2, 1fr); }
  .p.deg { font-size: 22px; min-height: 50px; }
}

/* ---------- band ---------- */
#band { background: #000; }
.stage { position: absolute; inset: 0; display: flex; flex-direction: column; --k: #0B1228; background: radial-gradient(120% 90% at 50% 40%, color-mix(in srgb, var(--k) 100%, #fff 0%), color-mix(in srgb, var(--k) 70%, #000)); transition: background .15s; color: #fff; }
.stage.idle { --k: #0B1228; }
.stage.light { color: #0A1024; }
.b-top { display: flex; align-items: center; gap: 10px; padding: calc(8px + var(--safe-t)) 12px 8px; background: rgba(0,0,0,.28); }
.b-part { font-family: var(--display); font-weight: 800; letter-spacing: .12em; font-size: 14px; }
.b-bpm { font-family: var(--display); font-weight: 800; font-size: 15px; margin-left: auto; opacity: .85; white-space: nowrap; }
.b-bpm::after { content: " BPM"; font-size: 10px; letter-spacing: .15em; opacity: .7; }
.sync-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--red); }
.sync-dot.ok { background: var(--green); box-shadow: 0 0 8px var(--green); }
.sync-dot.warn { background: var(--gold); }
.stage .icon-btn { color: inherit; opacity: .8; }
.cue { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 0 4vw; gap: 1.2vh; }
.cue-who { font-family: var(--display); font-weight: 800; letter-spacing: .14em; font-size: clamp(22px, 6vw, 56px); opacity: .9; min-height: 1em; }
.cue-who.me { background: #fff; color: #000; padding: 0 .4em; border-radius: 8px; opacity: 1; }
.cue-label { font-family: var(--display); font-weight: 900; line-height: .9; letter-spacing: .01em; font-size: clamp(64px, 24vw, 260px); word-break: break-word; text-transform: uppercase; }
.cue-label.lower { text-transform: none; font-family: Georgia, "Times New Roman", serif; font-style: italic; }
.cue-label.long { font-size: clamp(48px, 15vw, 190px); }
.cue-label.xlong { font-size: clamp(40px, 11vw, 150px); }
.cue-sub { font-family: var(--display); font-weight: 800; letter-spacing: .12em; font-size: clamp(18px, 5vw, 44px); opacity: .85; min-height: 1em; }
.cue-count { font-family: var(--display); font-weight: 900; font-size: clamp(40px, 14vw, 140px); line-height: 1; min-height: 1em; font-variant-numeric: tabular-nums; }
.b-now { padding: 10px 14px calc(12px + var(--safe-b)); text-align: center; font-family: var(--display); font-weight: 800; letter-spacing: .14em; font-size: clamp(16px, 4.5vw, 28px); background: rgba(0,0,0,.28); min-height: 1.5em; }
.stage.hit { animation: hit .5s ease-out; }
@keyframes hit { 0% { filter: brightness(2.2) saturate(.3); } 100% { filter: none; } }
.stage.pre .cue-label { animation: breathe calc(var(--beat, 600ms)) ease-in-out infinite; }
@keyframes breathe { 0% { transform: scale(1.04); } 60% { transform: scale(1); } }
.stage.stopped .cue-label { animation: none; }
.arm-overlay { position: absolute; inset: 0; background: rgba(6,10,24,.94); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 24px; text-align: center; z-index: 5; }
.arm-overlay .btn { max-width: 380px; }
.arm-overlay p { color: var(--muted); margin: 0; line-height: 1.5; }

/* ---------- sheets ---------- */
.sheet-back { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 40; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.sheet { position: fixed; z-index: 41; left: 50%; bottom: 0; transform: translateX(-50%); width: min(560px, 100%); max-height: 92vh; display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--panel), var(--bg2)); border: 1px solid var(--line); border-bottom: 0; border-radius: 22px 22px 0 0; box-shadow: 0 -30px 80px rgba(0,0,0,.7); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 4px 20px; }
.sheet-head h2 { font-family: var(--display); letter-spacing: .16em; font-size: 18px; margin: 0; color: var(--gold); }
.sheet-body { overflow-y: auto; padding: 6px 20px calc(24px + var(--safe-b)); display: flex; flex-direction: column; gap: 18px; }
.sheet-body.center { align-items: center; text-align: center; }
.set-group { display: flex; flex-direction: column; gap: 10px; }
.set-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 14px; color: var(--muted); }
.slider { display: grid; grid-template-columns: 90px 1fr; align-items: center; gap: 10px; font-size: 14px; }
.slider b { color: var(--gold); font-weight: 700; display: block; font-size: 12px; }
input[type=range] { width: 100%; accent-color: var(--gold); }
.toggle { display: flex; gap: 10px; align-items: center; font-size: 15px; }
.toggle input { width: 22px; height: 22px; accent-color: var(--gold); flex: none; }
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.filters label { display: flex; gap: 8px; align-items: center; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px; font-size: 14px; }
.filters input { accent-color: var(--gold); width: 18px; height: 18px; }
.filters i { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.plan-line { margin: 0; font-size: 15px; }
.plan-line b { color: var(--gold); }
body[data-role="band"] .md-only, body[data-role="md"] .band-only, body:not([data-role]) .band-only { display: none; }
.leave { margin-top: 6px; }
.qr-code { font-family: var(--display); font-weight: 900; font-size: 64px; letter-spacing: .25em; color: var(--gold); line-height: 1; margin-left: .25em; }
#qr-img { border-radius: 16px; background: #F5E6B8; padding: 8px; width: min(260px, 70vw); height: auto; aspect-ratio: 1; }
.join-url { font-family: ui-monospace, Menlo, monospace; font-size: 14px; color: #CFE2FF; margin: 0; word-break: break-all; -webkit-user-select: text; user-select: text; }
.pw-lead { font-family: var(--display); font-size: 26px; font-weight: 900; margin: 0; }
.pw-feats { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; color: #D5DCF5; }
.pw-feats b { color: var(--gold); }
.pw-plans { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.plan-card { border-radius: 16px; border: 1.5px solid var(--line); background: var(--bg); padding: 14px 10px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.plan-card:first-child { border-color: var(--gold); box-shadow: 0 0 30px -12px var(--gold); }
.plan-card small { font-size: 11px; letter-spacing: .16em; color: var(--gold); font-weight: 700; }
.plan-card b { font-family: var(--display); font-size: 40px; font-weight: 900; }
.plan-card span { color: var(--muted); font-size: 13px; }
.plan-card em { font-style: normal; font-size: 12px; color: #CFE2FF; margin-top: 4px; }
.pw-free, .pw-note { color: var(--muted); font-size: 13px; margin: 0; text-align: center; }
.pw-note { color: var(--gold); }
.pw-tester { display: flex; gap: 8px; justify-content: center; }
.pw-tester.hidden { display: none; }
.pw-tester input { flex: 1; max-width: 200px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line, #2a3a6a); background: rgba(255,255,255,.06); color: inherit; font: inherit; text-transform: uppercase; letter-spacing: .1em; }

.toast { position: fixed; left: 50%; top: calc(14px + var(--safe-t)); transform: translate(-50%, calc(-100% - 60px - var(--safe-t))); visibility: hidden; background: var(--panel2); border: 1px solid var(--line); padding: 10px 16px;
  border-radius: 12px; z-index: 60; font-weight: 600; transition: transform .25s; max-width: 90vw; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.toast.show { transform: translate(-50%, 0); visibility: visible; }
.shake { animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.name-field { padding: 0 4px; }

/* ---------- modes ---------- */
body:not([data-mode="sync"]) .sync-only { display: none !important; }
.mode-badge { display: flex; flex-direction: column; line-height: 1.05; padding: 4px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); min-width: 120px; }
.mode-badge b { font-family: var(--display); font-weight: 900; letter-spacing: .1em; font-size: 15px; color: var(--muted); }
.mode-badge span { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
body[data-mode="sync"] .mode-badge { border-color: var(--glow); box-shadow: 0 0 18px -6px var(--glow); }
body[data-mode="sync"] .mode-badge b { color: #CFE2FF; }
.mode-badge.playing b::before { content: "● "; color: var(--green); }
.sync-box { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.barbeat { font-family: var(--display); font-weight: 900; font-size: 22px; font-variant-numeric: tabular-nums; min-width: 64px; color: var(--gold); }
.midi-chip { display: inline-flex; align-items: center; gap: 6px; font-family: var(--display); font-weight: 800; letter-spacing: .08em; font-size: 13px; padding: 8px 10px; border-radius: 10px; background: var(--panel2); border: 1px solid var(--line); color: var(--muted); }
.led { width: 9px; height: 9px; border-radius: 50%; background: #3A4468; display: inline-block; flex: none; }
.led.on { background: var(--green); box-shadow: 0 0 8px var(--green); }
.led.hit { background: var(--gold); box-shadow: 0 0 10px var(--gold); }
.led.warn { background: var(--gold); }
.btn.keymap-btn { min-height: 38px; padding: 0 12px; font-size: 14px; background: rgba(77,163,255,.1); border: 1px solid rgba(77,163,255,.45); color: #CFE2FF; }
.b-mode { font-family: var(--display); font-weight: 800; letter-spacing: .1em; font-size: 12px; opacity: .75; }
.btn.xs { min-height: 34px; font-size: 13px; padding: 0 10px; border-radius: 10px; }
.select.slim, .text.slim { padding: 6px 8px; font-size: 14px; border-radius: 9px; width: auto; }
.mini { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.mini input[type=checkbox] { accent-color: var(--gold); width: 16px; height: 16px; }

/* ---------- key map ---------- */
#keymap { flex-direction: column; background: var(--bg); }
.k-top { display: flex; align-items: center; gap: 10px; padding: calc(8px + var(--safe-t)) 12px 6px; border-bottom: 1px solid var(--line); flex-wrap: wrap; background: var(--bg2); }
.k-top h2 { font-family: var(--display); letter-spacing: .16em; font-size: 18px; margin: 0; color: var(--gold); }
.k-top .icon-btn { font-size: 32px; }
.k-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.k-status { display: flex; align-items: center; gap: 14px; padding: 8px 12px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.midi-status { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; }
.readout { margin-left: auto; font-family: ui-monospace, Menlo, monospace; font-size: 13px; color: #CFE2FF; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 5px 9px; }
.k-view { display: flex; align-items: center; gap: 8px; padding: 8px 12px; }
.oct { font-family: var(--display); font-weight: 900; font-size: 18px; min-width: 70px; text-align: center; }
.learn-banner { margin-left: auto; font-family: var(--display); font-weight: 800; letter-spacing: .06em; color: #1A1204; background: var(--gold); border-radius: 8px; padding: 6px 10px; display: none; }
.learn-banner.on { display: block; animation: breathe 1s ease-in-out infinite; }
.k-stage { padding: 0 12px; }
.keyboard { position: relative; height: 210px; overflow-x: auto; overflow-y: hidden; border-radius: 12px; background: #02040C; border: 1px solid var(--line); scrollbar-width: thin; touch-action: pan-x; }
.keyboard .kb { position: relative; height: 100%; }
.pk { position: absolute; top: 0; border-radius: 0 0 8px 8px; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; text-align: center; padding: 4px 2px 6px; overflow: hidden; }
.pk.white { width: 60px; height: 100%; background: linear-gradient(180deg, #E9EDF7, #C9D0E2); color: #0A1024; border: 1px solid #0A1024; z-index: 1; }
.pk.black { width: 40px; height: 60%; background: linear-gradient(180deg, #1B2340, #0A0F22); color: #EEF2FF; z-index: 2; border: 1px solid #000; box-shadow: 0 4px 10px rgba(0,0,0,.6); }
.pk .lab { font-family: var(--display); font-weight: 800; font-size: 11px; line-height: 1.05; letter-spacing: .02em; word-break: break-word; width: 100%; border-radius: 5px; padding: 3px 2px; margin-bottom: 4px; }
.pk .nn { font-size: 10px; opacity: .65; font-family: ui-monospace, Menlo, monospace; }
.pk.mapped .lab { background: var(--kc); color: var(--kt, #fff); box-shadow: 0 0 10px -2px var(--kc); }
.pk.sel { outline: 3px solid var(--glow); outline-offset: -3px; }
.pk.hit, .pad.hit { filter: brightness(1.5); box-shadow: inset 0 0 0 3px var(--gold), 0 0 22px var(--gold); }
.pk.drop, .pad.drop { outline: 3px dashed var(--gold); outline-offset: -3px; }
.pk.pv, .pad.pv { outline: 3px dashed var(--glow); outline-offset: -3px; }
.pk.pv .lab::after, .pad.pv .plab::after { content: " ←"; }
.pads { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; max-width: 560px; margin: 0 auto; }
.pad { aspect-ratio: 1.35; border-radius: 12px; background: linear-gradient(180deg, var(--panel2), var(--panel)); border: 1.5px solid var(--line); display: flex; flex-direction: column; justify-content: space-between; padding: 7px; }
.pad.mapped { border-color: var(--kc); box-shadow: inset 0 0 0 1px var(--kc), 0 0 16px -8px var(--kc); }
.pad .plab { font-family: var(--display); font-weight: 900; font-size: 15px; line-height: 1.05; color: var(--kc, var(--muted)); word-break: break-word; }
.pad .nn { font-size: 10px; color: var(--muted); font-family: ui-monospace, Menlo, monospace; }
.pad.sel { outline: 3px solid var(--glow); }
.k-inspect { margin: 8px 12px 0; padding: 8px 12px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); font-size: 14px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; min-height: 46px; }
.k-inspect b { font-family: var(--display); letter-spacing: .04em; }
.k-inspect .sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.k-bottom { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 8px 12px calc(8px + var(--safe-b)); gap: 8px; }
.k-panel { flex: 1; min-height: 0; overflow-y: auto; }
.lib-cats { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.lib-cats button { font-family: var(--display); font-weight: 800; font-size: 12px; letter-spacing: .06em; padding: 6px 10px; border-radius: 999px; border: 1.5px solid var(--line); color: var(--muted); }
.lib-cats button.on { color: var(--text); border-color: var(--c, var(--glow)); box-shadow: inset 0 0 0 1px var(--c, var(--glow)); }
.lib-items { display: flex; flex-wrap: wrap; gap: 6px; }
.wchip { font-family: var(--display); font-weight: 800; font-size: 13px; letter-spacing: .03em; padding: 8px 10px; border-radius: 9px; background: var(--panel2); border: 1.5px solid var(--c, var(--line)); color: var(--text); touch-action: none; cursor: grab; }
.wchip.sel { background: var(--c); color: #0A1024; }
.wchip.cue { border-style: dashed; }
.drag-ghost { position: fixed; z-index: 90; pointer-events: none; transform: translate(-50%, -120%); font-family: var(--display); font-weight: 900; padding: 8px 12px; border-radius: 10px; background: var(--c, var(--gold)); color: #0A1024; box-shadow: 0 10px 30px rgba(0,0,0,.6); }
.trash { position: fixed; left: 50%; bottom: calc(16px + var(--safe-b)); transform: translateX(-50%); z-index: 80; background: rgba(255,59,59,.15); border: 2px dashed var(--red); color: #FFB3B3; font-family: var(--display); font-weight: 900; letter-spacing: .12em; padding: 14px 22px; border-radius: 14px; display: none; }
body.dragging-key .trash { display: block; }
.trash.drop { background: var(--red); color: #fff; }
.batch-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; }
.batch-list label { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border-radius: 10px; background: var(--panel); border: 1.5px solid var(--line); font-size: 13px; }
.batch-list label b { font-family: var(--display); letter-spacing: .04em; display: block; font-size: 14px; }
.batch-list label small { color: var(--muted); }
.batch-list label i { width: 10px; height: 10px; border-radius: 3px; flex: none; margin-top: 4px; }
.batch-list input { accent-color: var(--gold); margin-top: 2px; }
.batch-opts, .batch-save { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
@media (max-width: 520px) {
  .keyboard { height: 180px; }
  .k-actions { margin-left: 0; }
  .readout { margin-left: 0; }
}
.pk .lab.long { font-size: 9px; letter-spacing: 0; }

/* FOLLOW ME: room servers found on this Wi-Fi (iOS app), subscription terms under the plans */
.found { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.found .btn.on { border-color: var(--gold); color: var(--gold); }
.pw-legal { color: var(--muted); font-size: 11.5px; line-height: 1.45; margin: 4px 0 0; text-align: center; }
.pw-legal a { color: var(--muted); text-decoration: underline; }

/* Voice dropdowns (Settings): navy field, gold chevron and gold focus ring, big finger target */
.field-label { display: block; font-size: 13px; color: var(--muted); margin: 2px 0 6px; }
.select-wrap { position: relative; }
.select-wrap::after { content: ""; position: absolute; right: 16px; top: 50%; width: 9px; height: 9px; margin-top: -7px; border-right: 2.5px solid var(--gold); border-bottom: 2.5px solid var(--gold); transform: rotate(45deg); pointer-events: none; }
.select.voice-select { -webkit-appearance: none; appearance: none; min-height: 50px; padding-right: 40px; background: linear-gradient(180deg, var(--panel2), var(--panel)); border-color: var(--line); font-weight: 600; font-size: 16px; color: var(--text); text-overflow: ellipsis; }
.select.voice-select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(242, 182, 50, .22); }
.select.voice-select optgroup { color: var(--gold); background: var(--bg2); font-style: normal; }
.select.voice-select option { color: var(--text); background: var(--bg2); }
#set-fill-line { margin-top: 12px; }

/* Voice & words list + trim editor (LYNGO-style: waveform, draggable START/END, SPEED) */
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row > .btn { flex: 1; padding: 0 10px; white-space: nowrap; }
.bpm-in { width: 88px !important; text-align: center; font-size: 18px !important; }
#lock-manual { justify-content: flex-start; }
.word-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.word-list button { min-height: 48px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); color: var(--text); font-weight: 600; font-size: 15px; text-align: left; padding: 8px 12px; display: flex; align-items: center; gap: 8px; }
.word-list button i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.word-list button.edited { border-color: var(--gold); }
.word-list button.edited::after { content: "✂"; margin-left: auto; color: var(--gold); font-size: 13px; }
.word-list h5 { grid-column: 1 / -1; margin: 8px 0 0; font-family: var(--display); letter-spacing: .14em; font-size: 12px; color: var(--muted); }
#sheet-trim .sheet-head h2 { flex: 1; text-align: center; }
.trim-wave { position: relative; height: 170px; border-radius: 14px; background: var(--bg); border: 1px solid var(--line); overflow: hidden; touch-action: none; }
.trim-wave canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.trim-shade { position: absolute; top: 0; bottom: 0; background: rgba(6, 10, 24, .72); pointer-events: none; }
.trim-shade.l { left: 0; } .trim-shade.r { right: 0; }
.trim-handle { position: absolute; top: 0; bottom: 0; width: 48px; margin-left: -24px; touch-action: none; cursor: ew-resize; display: flex; justify-content: center; }
.trim-handle i { width: 3px; height: 100%; background: var(--gold); box-shadow: 0 0 10px var(--gold); }
.trim-handle span { position: absolute; top: 6px; left: 50%; transform: translateX(-2px); background: var(--gold); color: #1a1200; font: 800 11px/1 var(--display); letter-spacing: .08em; padding: 5px 7px; border-radius: 7px; white-space: nowrap; }
.trim-handle.end span { top: auto; bottom: 6px; transform: translateX(calc(-100% + 2px)); }
.trim-handle.drag i { background: var(--gold2); }
.trim-play { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--glow); box-shadow: 0 0 8px var(--glow); pointer-events: none; display: none; }
.trim-times { display: flex; flex-wrap: wrap; row-gap: 8px; justify-content: space-between; font: 600 13px/1 var(--ui); color: var(--muted); margin-top: -8px; }
.trim-times span:nth-child(2) { color: var(--gold); order: 3; flex-basis: 100%; text-align: center; font-size: 15px; }
.trim-words { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; width: 100%; }
.trim-words .btn { min-height: 40px; }
.resume-banner { position: fixed; z-index: 90; left: 50%; top: calc(var(--safe-t) + 10px); transform: translateX(-50%); min-height: 52px; padding: 0 22px; border-radius: 26px; background: var(--gold); color: #1a1200; font: 800 17px/1 var(--display); letter-spacing: .04em; box-shadow: 0 8px 30px rgba(0,0,0,.5); white-space: nowrap; }

/* Key map on a phone: the whole screen scrolls so WORD LIBRARY / LOAD BATCH always have room,
   and the octave bar + keyboard stay pinned at the top so words can still be dragged onto keys. */
#keymap { overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
#keymap .k-view { position: sticky; top: 0; z-index: 5; background: var(--bg); }
#keymap .k-stage { position: sticky; top: 52px; z-index: 4; background: var(--bg); padding-bottom: 6px; }
#keymap .k-bottom { flex: 1 0 auto; min-height: 62vh; }
#keymap .k-panel { flex: 1 0 auto; min-height: 0; max-height: none; overflow: visible; padding-bottom: 24px; }
#keymap .batch-opts { position: sticky; bottom: 0; background: var(--bg); padding: 8px 0 calc(8px + var(--safe-b)); z-index: 3; }
.batch-list label .bwords { display: block; margin-top: 4px; font-size: 11.5px; line-height: 1.35; color: var(--text); opacity: .78; }
#km-bnote { color: var(--gold); font-size: 13px; }
