:root {
  --red: #D01D1D; --red2: #ff4d4d; --bg: #0e0e11; --panel: #16161b; --panel2: #1d1d24; --line: #2a2a33;
  --ink: #f2f1ee; --mute: #9a99a3; --dim: #5d5c66; --ok: #6fd38a; --warn: #ffb84d;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 15px; }
a { color: inherit; }
button, select, input { font: inherit; color: inherit; }
button { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; cursor: pointer; }
button:hover { border-color: #4a4a56; }
button.primary { background: var(--red); border-color: var(--red); color: #fff; }
button.primary:hover { background: #e02828; }
button.ghost { background: transparent; }
button.on { background: var(--red); border-color: var(--red); color: #fff; }
button:disabled { opacity: .4; cursor: default; }
select, input[type=text] { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }
.hidden { display: none !important; }
.grow { flex: 1; }
.muted { color: var(--mute); }
.small { font-size: 13px; }

/* nav */
nav { display: flex; align-items: center; gap: 4px; padding: 10px 18px; border-bottom: 1px solid var(--line); background: #111115; position: sticky; top: 0; z-index: 20; }
nav a { text-decoration: none; padding: 6px 12px; border-radius: 8px; color: var(--mute); }
nav a.active, nav a:hover { color: var(--ink); background: var(--panel2); }
nav .brand { color: var(--ink); font-weight: 800; font-size: 18px; margin-right: 10px; background: none !important; }
.logo { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--red); color: #fff; margin-right: 6px; }
.lan { font-size: 12px; color: var(--mute); }
.lan b { color: var(--ink); font-weight: 600; }
body.stage-mode nav { display: none; }

main { padding: 20px; max-width: 1500px; margin: 0 auto; }
h1 { font-size: 26px; margin: 0; }
h2 { font-size: 18px; margin: 0 0 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }

/* library */
.lib { display: grid; grid-template-columns: 1fr 340px; gap: 18px; }
@media (max-width: 980px) { .lib { grid-template-columns: 1fr; } }
.drop { border: 2px dashed #3a3a46; border-radius: 14px; padding: 26px; text-align: center; margin-bottom: 18px; transition: .15s; }
.drop.over { border-color: var(--red2); background: #2a1416; }
.drop .big { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.songs { display: flex; flex-direction: column; gap: 8px; }
.song { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 12px 14px; border-radius: 12px; background: var(--panel2); border: 1px solid var(--line); }
.song .t { font-weight: 700; }
.song .sub { color: var(--mute); font-size: 13px; margin-top: 2px; }
.song .acts { display: flex; gap: 6px; align-items: center; }
.bar { height: 6px; border-radius: 3px; background: #2b2b34; overflow: hidden; margin-top: 8px; }
.bar > i { display: block; height: 100%; background: var(--red2); transition: width .5s; }
.pl-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; cursor: pointer; }
.pl-item.sel, .pl-item:hover { background: var(--panel2); }
.pl-songs { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.pl-song { display: flex; gap: 6px; align-items: center; padding: 6px 8px; background: var(--panel2); border-radius: 8px; font-size: 14px; }
.pl-song span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-song button { padding: 2px 8px; }

/* jam view */
.jam-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; background: var(--panel2); border: 1px solid var(--line); cursor: pointer; font-size: 14px; }
.badge b { color: var(--red2); }
.tabs { display: flex; gap: 4px; }
.transport { display: flex; align-items: center; gap: 14px; }
.play { width: 54px; height: 54px; border-radius: 50%; background: var(--red); border: 0; color: #fff; display: grid; place-items: center; flex: none; }
.play svg { width: 22px; height: 22px; }
.time { font-variant-numeric: tabular-nums; color: var(--mute); min-width: 92px; }
.timeline { position: relative; height: 44px; flex: 1; background: #121217; border-radius: 10px; overflow: hidden; cursor: pointer; border: 1px solid var(--line); }
.timeline .blk { position: absolute; top: 6px; bottom: 6px; border-radius: 5px; font-size: 11px; font-weight: 800; color: #111; padding: 0 4px; overflow: hidden; white-space: nowrap; display: flex; align-items: center; opacity: .55; }
.timeline .blk.cur { opacity: 1; }
.timeline .blk.edited { outline: 2px solid #fff; outline-offset: -2px; }
.timeline .ph { position: absolute; top: 0; bottom: 0; width: 2px; background: #fff; pointer-events: none; }

.mixer { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.ch { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; display: flex; align-items: center; gap: 8px; }
.ch .nm { font-weight: 700; font-size: 13px; min-width: 52px; }
.ch input[type=range] { width: 90px; accent-color: var(--red2); }
.ch button { padding: 2px 8px; font-size: 12px; font-weight: 800; }
.ch button.m.on { background: #555; border-color: #777; }
.ch button.s.on { background: var(--warn); border-color: var(--warn); color: #111; }
.ch.silent .nm { color: var(--dim); }
.loading { color: var(--mute); font-size: 13px; }

.jam-main { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 18px; margin-top: 16px; }
@media (max-width: 1100px) { .jam-main { grid-template-columns: 1fr; } }

/* smooth lyrics */
.lyrics { position: relative; height: 62vh; overflow: hidden; border-radius: 14px; background: var(--panel); border: 1px solid var(--line);
  mask-image: linear-gradient(transparent 0, #000 14%, #000 80%, transparent 100%); -webkit-mask-image: linear-gradient(transparent 0, #000 14%, #000 80%, transparent 100%); }
.lyrics .inner { position: absolute; left: 0; right: 0; top: 0; padding: 0 28px; will-change: transform; }
.lline { padding: 10px 0; opacity: .38; transition: opacity .8s ease; display: flex; flex-wrap: wrap; align-items: flex-end; }
.lline.cur { opacity: 1; }
.lline.near { opacity: .62; }
.lw { display: inline-flex; flex-direction: column; margin-right: .32em; cursor: pointer; }
.lw .c { min-height: 1.3em; font-weight: 800; font-size: .82em; color: var(--red2); white-space: pre; transition: color .4s; }
.lw .c.carry { opacity: .5; }
.lw .t { font-size: 1.35em; white-space: pre; }
.lw.low .t { color: var(--mute); font-style: italic; }
.lsec { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.lsec .lbl { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--mute); margin-right: 6px; }
.lsec .cc { font-weight: 800; color: var(--red2); border: 1px solid var(--line); padding: 2px 10px; border-radius: 7px; font-size: 1.1em; }
.lyrics.big .inner { font-size: 1.6em; }

/* chord panel */
.instr-toggle { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.nowpanel { display: flex; flex-direction: column; gap: 14px; }
.instr-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.instr-card .hd { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.instr-card .hd .nm { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--mute); }
.nn-row { display: grid; grid-template-columns: 1.25fr 1fr; gap: 12px; align-items: end; }
.cslot { text-align: center; }
.cslot .cname { font-size: 26px; font-weight: 900; color: var(--red2); line-height: 1.1; }
.cslot.next .cname { font-size: 18px; color: var(--mute); }
.cslot.next .cbox { opacity: .6; }
.cslot .lab { font-size: 11px; color: var(--mute); text-transform: uppercase; letter-spacing: .1em; }
.cycler { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 2px; font-size: 12px; color: var(--mute); }
.cycler button { padding: 1px 9px; }
.saved { color: var(--ok); }

/* svg */
.cbox { width: 100%; max-width: 170px; display: block; margin: 0 auto; }
.bassbox { max-width: 230px; }
.cbox .fl { stroke: #555560; stroke-width: 1.4; }
.cbox .sl, .fboard .sl { stroke: #8d8c96; stroke-width: 1.6; }
.cbox .nut { fill: #d9d8d3; }
.cbox .nutv, .fboard .nutv { stroke: #d9d8d3; stroke-width: 5; }
.cbox .bf, .fboard .bf { fill: #8d8c96; font-size: 12px; }
.cbox .xo { fill: #8d8c96; font-size: 15px; }
.cbox .open { fill: none; stroke: #d9d8d3; stroke-width: 1.8; }
.cbox .dot { fill: #e9e8e4; }
.cbox .dot.root { fill: var(--red2); }
.cbox .dot.tone { fill: #cfcfd6; }
.cbox .dot.main { stroke: #fff; stroke-width: 2; }
.cbox .fn { fill: #111; font-size: 11.5px; font-weight: 800; }
.cbox .nn { fill: var(--ink); font-size: 12px; font-weight: 700; }
.cbox .sn, .fboard .sn { fill: #77767f; font-size: 11px; }

/* scales */
.scales { margin-top: 18px; }
.scales .ctl { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.fboard { width: 100%; display: block; }
.fboard .fl { stroke: #44444e; stroke-width: 1.4; }
.fboard .mk { fill: #2c2c35; }
.fboard .sd.sc { fill: #3d3d48; }
.fboard .sd.ct { fill: #e9e8e4; }
.fboard .sd.root { fill: var(--red2); }
.fboard .sdt { fill: #fff; font-size: 10.5px; font-weight: 700; pointer-events: none; }
.fboard .sd.ct + .sdt { fill: #111; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--mute); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }

/* setup chords */
.setup-row { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 12px; }
.setup-row .top { display: flex; align-items: baseline; gap: 12px; margin-bottom: 8px; }
.setup-row .top .cn { font-size: 24px; font-weight: 900; color: var(--red2); }
.shape-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x proximity; }
.shape-strip::-webkit-scrollbar { height: 8px; } .shape-strip::-webkit-scrollbar-thumb { background: #33333d; border-radius: 4px; }
.shape { flex: none; width: 112px; padding: 6px 4px 4px; border-radius: 10px; border: 2px solid transparent; background: var(--panel2); cursor: pointer; scroll-snap-align: start; text-align: center; }
.shape.bass { width: 170px; }
.shape:hover { border-color: #4a4a56; }
.shape.sel { border-color: var(--red2); background: #2a1517; }
.shape .tag { font-size: 11px; color: var(--mute); }
.strip-label { font-size: 12px; color: var(--mute); text-transform: uppercase; letter-spacing: .1em; margin: 6px 0 4px; }

/* popover */
.pop { position: fixed; z-index: 50; background: #1b1b22; border: 1px solid #3a3a46; border-radius: 12px; padding: 14px; box-shadow: 0 20px 60px #000a; min-width: 260px; }
.pop .row { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: #26262e; border: 1px solid #3a3a46; padding: 10px 16px; border-radius: 10px; z-index: 60; }

/* stage */
.stage { position: fixed; inset: 0; display: grid; grid-template-rows: auto 1fr auto; background: #0a0a0c; }
.stage-top { display: flex; align-items: center; gap: 30px; padding: 22px 40px 10px; }
.stage-top .now { font-size: 92px; font-weight: 900; color: var(--red2); line-height: 1; min-width: 220px; }
.stage-top .nxt { font-size: 34px; color: var(--mute); }
.stage-top .nxt b { color: var(--ink); }
.stage-top .ttl { font-size: 18px; color: var(--mute); }
.stage-body { display: grid; grid-template-columns: 1fr auto; gap: 24px; padding: 0 40px 30px; min-height: 0; }
.stage .lyrics { height: 100%; background: transparent; border: 0; }
.stage .lyrics .inner { font-size: 2.1em; padding: 0 10px; }
.stage-body { min-height: 0; }
.stage .diag { width: 440px; display: flex; flex-direction: column; gap: 10px; min-height: 0; max-height: 100%; }
.stage .diag .instr-card { flex: 1 1 0; min-height: 0; padding: 6px 12px; background: #121216; display: flex; flex-direction: column; max-height: 420px; }
.stage .diag .instr-card .hd { margin-bottom: 0; }
.stage .diag .nn-row { flex: 1; min-height: 0; align-items: stretch; }
.stage .diag .cslot { display: flex; flex-direction: column; min-height: 0; }
.stage .diag .cslot .cbox { flex: 1 1 0; min-height: 0; width: 100%; height: 100%; max-width: 100%; }
.stage .diag .cslot .cname { font-size: 22px; }
.stage .diag .cslot.next .cname { font-size: 16px; }
.stage .diag .saved { font-size: 12px; }
.stage-bar { display: flex; align-items: center; gap: 12px; padding: 12px 40px 18px; background: linear-gradient(transparent, #000c 40%); transition: opacity .6s; }
.stage-bar.sleep { opacity: 0; }
.stage-bar.sleep:hover { opacity: 1; }
.stage-bar .play { width: 50px; height: 50px; }
.sseek { flex: 1; height: 10px; border-radius: 5px; background: #2a2a33; cursor: pointer; overflow: hidden; }
.sseek i { display: block; height: 100%; width: 0; background: var(--red2); }
.stage-bar select { max-width: 320px; }
.stage-ctl { position: fixed; right: 16px; top: 14px; display: flex; gap: 6px; opacity: .35; transition: opacity .3s; z-index: 5; }
.stage-ctl:hover { opacity: 1; }
.wait { display: grid; place-items: center; height: 100%; color: var(--mute); font-size: 22px; text-align: center; }

/* finder */
.finder .notes, .finder .quals { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.finder .notes button { min-width: 48px; font-weight: 800; }
.finder .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 16px; }
.finder .cell { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 8px; text-align: center; }
.finder .cell .tag { font-size: 12px; color: var(--mute); }
.finder .big { font-size: 44px; font-weight: 900; color: var(--red2); }
@media (max-width: 600px) { main { padding: 12px; } nav { overflow-x: auto; } .lan { display: none; } }

/* stage on a narrow screen (phone, tablet in portrait): shapes go under the lyrics */
@media (max-width: 900px) {
  .stage-top { padding: 60px 16px 6px; gap: 16px; }
  .stage-top .now { font-size: 56px; min-width: 0; }
  .stage-top .nxt { font-size: 22px; }
  .stage-top .ttl { display: none; }
  .stage-body { grid-template-columns: 1fr; grid-template-rows: 1fr auto; padding: 0 12px 8px; gap: 8px; }
  .stage .lyrics .inner { font-size: 1.3em; }
  .stage .diag { width: 100%; flex-direction: row; height: 210px; overflow-x: auto; }
  .stage .diag .instr-card { flex: 1 0 200px; max-height: none; }
  .stage-bar { padding: 8px 12px 12px; gap: 8px; flex-wrap: wrap; }
  .stage-bar select { max-width: 100%; flex: 1 1 100%; order: 5; }
  .stage-ctl { left: 8px; right: 8px; flex-wrap: wrap; justify-content: flex-end; opacity: .6; }
  .stage-ctl button { padding: 4px 8px; font-size: 13px; }
}
