:root {
  --bg: #0f1115; --panel: #171a21; --panel-2: #1f232c; --line: #2a2f3a;
  --text: #e8eaf0; --muted: #8b93a5; --accent: #7c9cff; --ok: #4fd18b; --err: #ff6b6b; --rec: #ff4d6d;
  --radius: 12px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
main { max-width: 1180px; margin: 0 auto; padding: 24px 16px 64px; }
h1 { font-size: 1.6rem; margin: 0 0 6px; } h2 { font-size: 1.2rem; margin: 0 0 12px; }
a { color: var(--accent); }
.muted { color: var(--muted); } .small { font-size: 0.85rem; }
.hidden { display: none !important; }
.ok { color: var(--ok); } .err, .error { color: var(--err); }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 20px; border-bottom: 1px solid var(--line); background: var(--panel); }
.brand { font-weight: 700; color: var(--text); text-decoration: none; letter-spacing: .02em; }
.topbar nav { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.topbar nav a { text-decoration: none; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; margin-bottom: 20px; }

button, .button { font: inherit; color: var(--text); background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 14px; cursor: pointer; text-decoration: none; display: inline-block; }
button:hover:not(:disabled), .button:hover { border-color: var(--accent); }
button:disabled, .button.disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }
.primary { background: var(--accent); border-color: var(--accent); color: #0b0d12; font-weight: 600; }
.ghost { background: transparent; }
.rec { background: var(--rec); border-color: var(--rec); color: #fff; font-weight: 600; }
input[type=text], input[type=password], input:not([type]) { width: 100%; padding: 10px 12px; margin-top: 4px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px; color: var(--text); font: inherit; }
label { display: block; margin-bottom: 14px; }
.file-btn input { display: none; }
.file-btn.big { padding: 14px 22px; font-size: 1.05rem; }

/* auth */
.auth { max-width: 400px; margin: 48px auto; }
.auth form button { width: 100%; padding: 11px; }

/* record */
.record-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap;
  margin-bottom: 18px; }
.record-head p { max-width: 620px; margin: 0; }
.head-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.progress-pill { padding: 7px 12px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); }
.record-layout { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 20px; align-items: start; }
@media (max-width: 900px) { .record-layout { grid-template-columns: 1fr; } }

.note-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; }
.tile { --hue: 220; position: relative; aspect-ratio: 1; padding: 0; border-radius: 10px; overflow: hidden;
  border: 2px solid transparent; background-color: hsl(var(--hue) 35% 22%);
  background-size: cover; background-position: center; transition: transform .08s, box-shadow .08s, border-color .08s; }
.tile-label { position: absolute; left: 0; right: 0; bottom: 0; padding: 2px 4px; font-size: .78rem; font-weight: 600;
  background: linear-gradient(transparent, rgba(0,0,0,.75)); text-align: left; }
.note-grid.small .tile.empty { opacity: .5; background-color: var(--panel-2); }
.note-grid.small .tile.default::after { content: "default"; position: absolute; top: 3px; right: 4px; font-size: .62rem;
  color: var(--muted); }
.note-grid.small .tile.recorded::after { content: "●"; position: absolute; top: 2px; right: 5px; font-size: .7rem; color: var(--ok); }
.tile.selected { border-color: var(--accent); }
.pc0{--hue:0} .pc1{--hue:30} .pc2{--hue:60} .pc3{--hue:90} .pc4{--hue:120} .pc5{--hue:150}
.pc6{--hue:180} .pc7{--hue:210} .pc8{--hue:240} .pc9{--hue:270} .pc10{--hue:300} .pc11{--hue:330}

.panel { position: sticky; top: 16px; }
.panel-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.note-title { text-align: center; }
.big-note { font-size: 2.6rem; font-weight: 700; line-height: 1.1; }
.session-bar { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; padding: 14px 16px; }
.session-bar .dev { display: flex; flex-direction: column; gap: 4px; margin: 0; color: var(--muted); flex: 1 1 200px; min-width: 0; }
.session-bar select { padding: 7px 8px; background: var(--bg); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; font: inherit; width: 100%; }
.big-btn { padding: 10px 18px; font-size: 1rem; }
.stage-top { display: flex; justify-content: space-between; gap: 10px; font-size: .78rem; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.stage-big { font-size: 2.4rem; font-weight: 700; line-height: 1.15; margin: 4px 0 6px; }
.stage-big.good { color: var(--ok); } .stage-big.bad { color: var(--err); } .stage-big.now { color: var(--accent); }
.stage-big.dim { color: var(--muted); }
#stSub { min-height: 1.5em; margin-bottom: 12px; }
.lvl { position: relative; height: 26px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg);
  margin: 10px 0 14px; overflow: hidden; }
.lvl-clip { position: absolute; top: 0; bottom: 0; right: 0; background: rgba(255,107,107,.18); }
.lvl-clip { left: 95%; }
.lvl-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--accent); }
.lvl-peak { position: absolute; top: -2px; bottom: -2px; width: 3px; margin-left: -1px; background: var(--text); left: 0; }
.hold { height: 14px; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; margin: 10px 0; background: var(--bg); }
.hold div { height: 100%; width: 0; background: var(--ok); }
.hold div.guide { background: var(--accent); }
.why { margin: 4px 0 6px; padding-left: 20px; color: var(--text); }
.why li { margin-bottom: 8px; line-height: 1.45; }
.why b { color: var(--err); font-weight: 600; }
.why span { color: var(--muted); }
.advice { min-height: 1.5em; color: var(--err); font-weight: 600; }
.stage-hint { min-height: 1.5em; margin: 6px 0 12px; }
.keys { font-size: .7rem; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; margin-left: 4px; }
.primary .keys { color: #0b0d12; border-color: rgba(0,0,0,.3); }
.vol { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.note-grid.small .tile.skipped { opacity: .45; background-color: var(--panel-2); }
.note-grid.small .tile.skipped::after { content: "skipped"; position: absolute; top: 3px; right: 4px; font-size: .62rem; color: var(--err); }
.note-grid.small .tile.recorded.redo::after { content: "redo"; color: #ffb340; font-size: .62rem; top: 3px; right: 4px; }
.badge.redo { color: #ffb340; border-color: rgba(255,179,64,.45); }
.issues { font-size: .85rem; color: #ffb340; margin: -2px 0 10px; }
.tile.now { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124,156,255,.35); }
.mic-pick { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; color: var(--muted); }
.mic-pick select { flex: 1; min-width: 0; padding: 6px 8px; background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.meter { background: var(--bg); border-radius: 10px; padding: 12px; margin-bottom: 14px; }
.meter-scale { display: flex; justify-content: space-between; font-size: .72rem; color: var(--muted); }
.meter-track { position: relative; height: 26px; margin: 4px 0 8px; border-radius: 6px;
  background: linear-gradient(90deg, #3a1f27, #2a2f3a 40%, #2a2f3a 60%, #3a1f27); }
.meter-zone { position: absolute; left: 35%; width: 30%; top: 0; bottom: 0; background: rgba(79,209,139,.18);
  border-left: 1px solid rgba(79,209,139,.5); border-right: 1px solid rgba(79,209,139,.5); }
.needle { position: absolute; top: -3px; bottom: -3px; width: 4px; margin-left: -2px; left: 50%;
  background: var(--err); border-radius: 2px; transition: left .08s; }
.needle.good { background: var(--ok); } .needle.off { opacity: .15; }
.level { height: 4px; background: var(--panel-2); border-radius: 2px; margin-top: 8px; overflow: hidden; }
.level div { height: 100%; width: 0; background: var(--accent); }
.row, .take, .status-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.rec-progress { height: 4px; background: var(--panel-2); border-radius: 2px; margin-bottom: 14px; overflow: hidden; }
.rec-progress div { height: 100%; width: 0; background: var(--rec); }
.badge { padding: 3px 10px; border-radius: 999px; font-size: .8rem; background: var(--panel-2); border: 1px solid var(--line); }
.badge.recorded, .badge.done { color: var(--ok); border-color: rgba(79,209,139,.4); }
.badge.default { color: var(--accent); }
.badge.failed { color: var(--err); }
#msg { min-height: 1.4em; margin-bottom: 10px; }
.image-row { display: flex; gap: 14px; align-items: center; border-top: 1px solid var(--line); padding-top: 14px; }
.img-preview { width: 84px; height: 84px; flex: none; border-radius: 10px; background: var(--panel-2) center/cover;
  display: grid; place-items: center; font-size: .72rem; color: var(--muted); }
.image-row .file-btn { margin: 6px 6px 0 0; }

/* studio */
.studio form { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; margin-top: 16px; }
.slider input { width: 260px; display: block; }
.modes { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin: 0; max-width: 640px; }
.modes label, .check { margin: 6px 0; }
.check .muted { display: block; margin-left: 24px; max-width: 600px; }
.disabled-row { opacity: .4; pointer-events: none; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; margin: 8px 0 0; font-size: .85rem; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; }
.bar { height: 10px; background: var(--panel-2); border-radius: 5px; overflow: hidden; margin: 18px 0 6px; }
.bar div { height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.jobs { list-style: none; padding: 0; margin: 0; }
.jobs li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.job-name { font-weight: 600; flex: 1 1 200px; }

/* imitations */
.imit-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap;
  margin-bottom: 8px; }
.imit-head p { margin: 0; }
.imit-list { list-style: none; padding: 0; margin: 0; }
.imit { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  padding: 16px 18px; margin-bottom: 12px; }
.imit-main { flex: 1 1 320px; min-width: 0; }
.imit-name { font-weight: 600; font-size: 1.05rem; overflow-wrap: anywhere; margin-bottom: 2px; }
.imit-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.imit-bar { margin: 10px 0 4px; height: 8px; }
.danger { color: var(--err); border-color: rgba(255,107,107,.4); }
.danger:hover:not(:disabled) { border-color: var(--err); background: rgba(255,107,107,.08); }
.studio-link { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.empty-state { text-align: center; padding: 36px 20px; }
.badge.running, .badge.queued { color: var(--accent); }
.back { display: inline-block; margin-bottom: 8px; text-decoration: none; font-size: .9rem; }

/* player */
.player-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; }
.seg button.on { background: var(--accent); color: #0b0d12; font-weight: 600; }
audio { width: 100%; margin: 14px 0 4px; }
.board { margin-top: 14px; gap: 10px; }
.board .tile { --lvl: 0; }
.board .tile { --glow: hsl(var(--hue) 100% 60%); }
.board .tile.on { border-color: var(--glow);
  box-shadow: 0 0 calc(6px + 26px * var(--lvl)) calc(2px * var(--lvl)) color-mix(in srgb, var(--glow) calc(35% + 60% * var(--lvl)), transparent);
  transform: scale(calc(1 + .07 * var(--lvl))); z-index: 1; }
@media (max-width: 600px) { .note-grid { gap: 5px; } .board { gap: 6px; } .tile-label { font-size: .62rem; } }
