/* Nobre Keys — interface */
:root {
  --bg: #0B0C0E; --bg2: #0E1012; --bar: #101215; --panel: #141619; --panel2: #1B1E22; --deep: #0F1113; --void: #07080A;
  --line: #23262B; --line2: #2A2E34; --line3: #343941;
  --text: #ECEDEE; --soft: #C4C8CE; --muted: #9BA1A9; --dim: #7C838C;
  --accent: #F2A33A; --accent-ink: #111214;
  --pianoA: #F2A33A; --pianoB: #F5C27A; --organ: #B49CFF; --pad: #4FB3D9; --synth: #FF8FB1; --ok: #3DDC84; --danger: #FF9B8A;
  --r-s: 8px; --r-m: 12px; --r-l: 18px;
  --font: 'Space Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --side: 232px; --top: 60px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); -webkit-font-smoothing: antialiased; }
body { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: var(--side) 1fr; grid-template-rows: var(--top) 1fr auto; height: 100vh; height: 100dvh; }
.app.side-collapsed { --side: 72px; }
.topbar { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; padding: 0 16px; border-bottom: 1px solid var(--line); background: var(--bar); min-width: 0; }
.brand { display: flex; align-items: center; gap: 10px; width: calc(var(--side) - 28px); flex: none; min-width: 0; }
.brand b { font-size: 17px; letter-spacing: .01em; white-space: nowrap; }
.app.side-collapsed .brand b { display: none; }
.icon-btn { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line2); background: var(--panel2); display: inline-grid; place-items: center; flex: none; }
.icon-btn:hover { border-color: var(--line3); }
.icon-btn.ghost { background: transparent; border-color: transparent; }
.top-scene { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.top-scene .t { display: flex; flex-direction: column; min-width: 0; }
.top-scene .t small { font-size: 11px; color: var(--muted); }
.top-scene .t strong { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.metro-mini { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 6px 0 12px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); flex: none; }
.metro-mini .dots { display: flex; gap: 4px; }
.metro-mini .dots i { width: 8px; height: 8px; border-radius: 50%; background: #3A3F46; transition: background .05s; }
.metro-mini .dots i.on { background: var(--accent); }
.metro-mini .dots i.on.acc { background: #fff; }
.pill { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 11px; border-radius: 999px; font-size: 12px; font-weight: 500; background: var(--panel2); color: var(--muted); white-space: nowrap; flex: none; }
.pill i { width: 7px; height: 7px; border-radius: 50%; background: #3A3F46; }
.pill.ok { background: #12241A; color: #8BE5B0; } .pill.ok i { background: var(--ok); }
.pill.warn { background: #2A2210; color: #F5C27A; } .pill.warn i { background: #F2A33A; }
.pill.bad { background: #2A1614; color: var(--danger); } .pill.bad i { background: #FF5A45; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line2); background: var(--panel2); font-size: 13px; font-weight: 500; white-space: nowrap; }
.btn:hover { border-color: var(--line3); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 700; }
.btn.danger { background: #2A1614; color: var(--danger); border-color: #5A2A24; font-weight: 600; }
.btn.ghost { background: transparent; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.btn.lg { height: 52px; padding: 0 20px; font-size: 15px; border-radius: 14px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.sidenav { grid-row: 2 / 4; border-right: 1px solid var(--line); background: var(--bg2); overflow-y: auto; padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; }
.sidenav a { display: flex; align-items: center; gap: 12px; height: 42px; padding: 0 12px; border-radius: 10px; color: var(--soft); text-decoration: none; font-size: 14px; white-space: nowrap; }
.sidenav a:hover { background: var(--panel); }
.sidenav a.active { background: var(--text); color: var(--accent-ink); font-weight: 600; }
.sidenav a svg { flex: none; }
.sidenav .sep { height: 1px; background: var(--line); margin: 8px 6px; }
.app.side-collapsed .sidenav a span { display: none; }
.app.side-collapsed .sidenav a { justify-content: center; padding: 0; }
.sidenav .ver { margin-top: auto; padding: 10px 12px; font-size: 11px; color: var(--dim); font-family: var(--mono); }
.app.side-collapsed .sidenav .ver { display: none; }

.main { grid-row: 2; overflow-y: auto; overflow-x: hidden; min-width: 0; }
.view { padding: 20px 24px 28px; display: flex; flex-direction: column; gap: 16px; max-width: 1600px; }
.view-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.view-head h1 { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -.01em; }
.view-head .sub { font-size: 13px; color: var(--muted); }
.view-head .grow { flex: 1; }

.kbdock { grid-column: 2; grid-row: 3; border-top: 1px solid var(--line); background: var(--bar); }
.kbdock.closed .kb-wrap { display: none; }

.bottomnav { display: none; }

/* ---------- cartões ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-l); padding: 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.card.tinted { background: linear-gradient(180deg, #17151D, #121116); border-color: #2B2638; }
.card-h { display: flex; align-items: center; gap: 10px; min-width: 0; }
.card-h .title { font-weight: 700; letter-spacing: .05em; font-size: 14px; text-transform: uppercase; }
.card-h .grow { flex: 1; }
.led { width: 10px; height: 10px; border-radius: 50%; background: #3A3F46; flex: none; }
.led.on { background: var(--c, var(--accent)); box-shadow: 0 0 10px var(--c, var(--accent)); }
.label { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.grid { display: grid; gap: 14px; }
.grid.auto { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid.auto-s { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.row { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-start; }
.row.center { align-items: center; }
.row > .f1 { flex: 1 1 320px; min-width: 0; }
.row > .f2 { flex: 2 1 480px; min-width: 0; }
.row > .f3 { flex: 3 1 600px; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.big-title { font-size: 20px; font-weight: 600; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 5px 9px; border-radius: 7px; background: var(--panel2); color: var(--soft); }
.well { background: var(--deep); border-radius: 14px; padding: 12px; }
.note { font-size: 12px; color: var(--muted); line-height: 1.5; }
.callout { padding: 12px 14px; border-radius: 12px; border: 1px dashed var(--line3); font-size: 13px; color: var(--muted); line-height: 1.5; }
.callout.warn { border-style: solid; border-color: #4A3A1A; background: #1E1A10; color: #F5C27A; }
.callout.bad { border-style: solid; border-color: #5A2A24; background: #2A1614; color: var(--danger); }
.callout.ok { border-style: solid; border-color: #1E4A30; background: #12241A; color: #8BE5B0; }

/* ---------- controles ---------- */
.knob { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 64px; user-select: none; touch-action: none; }
.knob svg { cursor: ns-resize; }
.knob .kl { font-size: 11px; color: var(--muted); text-align: center; line-height: 1.2; }
.knob .kv { font-family: var(--mono); font-size: 11px; }
.knob:focus-visible { outline: none; }
.knob:focus-visible svg { filter: drop-shadow(0 0 4px var(--accent)); }
.knobs { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 10px 6px; justify-items: center; }

.fader { display: flex; align-items: center; gap: 10px; min-width: 0; }
.fader .fl { font-size: 12px; color: var(--muted); width: 60px; flex: none; }
.fader .track { position: relative; flex: 1; min-width: 80px; height: 28px; touch-action: none; cursor: pointer; }
.fader .track::before { content: ''; position: absolute; left: 0; right: 0; top: 11px; height: 6px; border-radius: 3px; background: var(--line); }
.fader .fill { position: absolute; left: 0; top: 11px; height: 6px; border-radius: 3px; background: var(--c, var(--accent)); }
.fader .thumb { position: absolute; top: 4px; width: 20px; height: 20px; margin-left: -10px; border-radius: 50%; background: var(--text); box-shadow: 0 2px 8px rgba(0,0,0,.5); }
.fader .fv { font-family: var(--mono); font-size: 12px; width: 62px; text-align: right; flex: none; }
.vfader { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.vfader .track { position: relative; width: 52px; height: 220px; border-radius: 14px; background: var(--deep); border: 1px solid var(--line); overflow: hidden; touch-action: none; cursor: pointer; }
.vfader .fill { position: absolute; left: 0; right: 0; bottom: 0; }
.vfader .thumb { position: absolute; left: 6px; right: 6px; height: 10px; margin-bottom: -5px; border-radius: 5px; background: var(--text); }

.seg { display: inline-flex; flex-wrap: wrap; gap: 3px; padding: 4px; background: var(--deep); border-radius: 10px; }
.seg button { height: 32px; padding: 0 12px; border-radius: 7px; border: 0; background: transparent; color: var(--muted); font-size: 12px; font-weight: 500; }
.seg button[aria-pressed="true"] { background: var(--line2); color: var(--text); }
.seg.accent button[aria-pressed="true"] { background: var(--c, var(--accent)); color: var(--accent-ink); font-weight: 700; }
.seg.full { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; }
.seg.mono button { font-family: var(--mono); font-weight: 700; }

.switch { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.switch .sw-t { flex: 1; display: flex; flex-direction: column; }
.switch .sw-t small { font-size: 12px; color: var(--muted); }
.switch button { width: 42px; height: 24px; border-radius: 12px; border: 0; background: var(--line2); position: relative; flex: none; transition: background .15s; }
.switch button::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--text); transition: left .15s; }
.switch button[aria-checked="true"] { background: #2E7D4F; }
.switch button[aria-checked="true"]::after { left: 21px; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field label { font-size: 11px; color: var(--muted); }
.input, select.input, textarea.input { height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line2); background: var(--deep); font-size: 14px; min-width: 0; width: 100%; }
textarea.input { height: auto; padding: 10px 12px; line-height: 1.5; resize: vertical; }
.input:focus { border-color: var(--accent); outline: none; }

.tile { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; min-height: 54px; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line2); background: var(--panel2); text-align: left; min-width: 0; }
.tile strong { font-size: 13px; font-weight: 600; }
.tile small { font-size: 11px; color: var(--muted); }
.tile[aria-pressed="true"] { border-color: var(--c, var(--accent)); background: color-mix(in srgb, var(--c, var(--accent)) 14%, var(--panel)); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }

.meter { display: flex; flex-direction: column; gap: 3px; }
.meter .bar { height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; }
.meter .bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #3DDC84 70%, #F2C14E 88%, #FF5A45); background-size: 400px 100%; border-radius: 3px; }

/* drawbars */
.drawbars { display: flex; gap: 10px; align-items: flex-start; }
.drawbar { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 46px; user-select: none; touch-action: none; }
.drawbar .slot { position: relative; width: 42px; height: 262px; border-radius: 9px; background-color: var(--void); background-image: repeating-linear-gradient(180deg, transparent 0 27px, #1A1C20 27px 28px); border: 1px solid #1D2024; overflow: hidden; cursor: ns-resize; }
.drawbar .rod { position: absolute; top: 0; left: 8px; right: 8px; border-radius: 0 0 4px 4px; transition: height .06s; }
.drawbar .cap { position: absolute; bottom: 0; left: -5px; right: -5px; height: 34px; border-radius: 8px; display: grid; place-items: center; font-family: var(--mono); font-weight: 700; font-size: 14px; box-shadow: 0 4px 12px rgba(0,0,0,.55); }
.drawbar .ft { font-family: var(--mono); font-size: 11px; color: var(--soft); }
.drawbar .nm { font-size: 10px; color: var(--muted); }

/* teclado */
.kb-wrap { padding: 10px 16px 14px; display: flex; flex-direction: column; gap: 6px; }
.kb-lanes { display: flex; flex-direction: column; gap: 3px; }
.kb-lanes .lane { height: 6px; position: relative; background: var(--panel); border-radius: 3px; }
.kb-lanes .lane i { position: absolute; top: 0; bottom: 0; border-radius: 3px; }
.keyboard { position: relative; display: flex; height: 96px; touch-action: none; user-select: none; }
.keyboard .w { position: relative; flex: 1; background: #E6E7E9; border-right: 1px solid var(--bg); border-radius: 0 0 5px 5px; }
.keyboard .w.down { background: var(--accent); }
.keyboard .b { position: absolute; top: 0; right: -30%; width: 60%; height: 60%; background: #16181B; border-radius: 0 0 4px 4px; z-index: 2; }
.keyboard .b.down { background: var(--accent); }
.keyboard .w .lbl { position: absolute; bottom: 4px; left: 0; right: 0; text-align: center; font-family: var(--mono); font-size: 9px; color: #5A6068; pointer-events: none; }

/* EQ */
.eq-graph { position: relative; height: 340px; background: var(--bg); border: 1px solid #1D2024; border-radius: 12px; overflow: hidden; touch-action: none; }
.eq-graph canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.eq-node { position: absolute; width: 28px; height: 28px; margin: -14px 0 0 -14px; border-radius: 50%; border: 2px solid var(--bg); display: grid; place-items: center; font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--bg); cursor: grab; touch-action: none; }
.eq-node.off { opacity: .35; }
.band-card { background: var(--panel); border: 1px solid var(--line2); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.band-num { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--bg); flex: none; }

/* modal */
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(4px); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade .15s ease; }
.modal { width: min(560px, 100%); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line2); border-radius: 20px; overflow: hidden; animation: pop .18s ease; }
.modal header { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.modal header h2 { margin: 0; font-size: 17px; flex: 1; }
.modal .body { padding: 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.modal footer { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 18px; border-top: 1px solid var(--line); background: var(--bar); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }

.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 60; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { pointer-events: auto; padding: 12px 16px; border-radius: 12px; background: var(--panel2); border: 1px solid var(--line3); box-shadow: 0 10px 30px rgba(0,0,0,.4); font-size: 13px; max-width: 360px; animation: pop .2s ease; }
.toast.ok { border-color: #1E4A30; } .toast.bad { border-color: #5A2A24; color: var(--danger); }

.splash { position: fixed; inset: 0; z-index: 70; background: radial-gradient(circle at 50% 35%, #1A1810, var(--bg) 60%); display: flex; align-items: center; justify-content: center; padding: 24px; }
.splash .box { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; max-width: 420px; }
.splash h1 { margin: 0; font-size: 28px; }
.splash p { margin: 0; color: var(--muted); line-height: 1.5; }

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; color: var(--muted); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; font-weight: 500; padding: 8px 10px; }
.table td { padding: 10px; border-top: 1px solid #1F2226; vertical-align: middle; }
.table-wrap { overflow-x: auto; }

.list-item { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 12px; border-radius: 12px; border: 1px solid transparent; background: transparent; text-align: left; width: 100%; }
.list-item:hover { background: var(--panel2); }
.list-item[aria-current="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--panel)); }
.list-item .li-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.list-item .li-main strong { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .li-main small { font-size: 12px; color: var(--muted); }

.beats { display: flex; gap: 10px; padding: 14px; background: var(--deep); border-radius: 14px; }
.beats div { flex: 1; height: 60px; border-radius: 12px; background: var(--panel2); border: 1px solid var(--line); display: grid; place-items: center; font-family: var(--mono); font-size: 18px; font-weight: 700; color: var(--soft); transition: background .05s; }
.beats div.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.beats div.on.sec { background: var(--line3); color: var(--text); border-color: var(--line3); }
.bpm-big { font-family: var(--mono); font-size: 76px; font-weight: 700; line-height: 1; letter-spacing: -.03em; }

.progress { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }

.rotary-btn { height: 120px; border-radius: 18px; border: 1px solid #5B4A8F; background: radial-gradient(circle at 50% 30%, #2C2444, #1C1828); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.rotary-btn.slow { border-color: var(--line2); background: var(--panel2); }
.rotary-btn .rs { font-size: 30px; font-weight: 700; }
.rotary-btn small { font-size: 11px; color: var(--muted); }

/* ---------- responsivo ---------- */
@media (max-width: 1100px) {
  .app { --side: 72px; }
  .brand b { display: none; }
  .sidenav a span { display: none; }
  .sidenav a { justify-content: center; padding: 0; }
  .sidenav .ver { display: none; }
  .metro-mini .lbl { display: none; }
}
@media (max-width: 720px) {
  .app { grid-template-columns: 1fr; grid-template-rows: 56px 1fr auto auto; }
  .topbar { padding: 0 10px; gap: 8px; }
  .brand { width: auto; }
  .sidenav { display: none; }
  .kbdock { grid-column: 1; grid-row: 3; }
  .main { grid-row: 2; }
  .bottomnav { display: grid; grid-row: 4; grid-template-columns: repeat(5, 1fr); border-top: 1px solid var(--line); background: var(--bar); padding-bottom: env(safe-area-inset-bottom); }
  .bottomnav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; height: 58px; color: var(--muted); text-decoration: none; font-size: 10px; }
  .bottomnav a.active { color: var(--accent); }
  .view { padding: 14px 14px 24px; }
  .top-scene .t { display: none; }
  .top-scene { flex: 0 0 auto; }
  .hide-phone { display: none !important; }
  .metro-mini .dots { display: none; }
  .drawbar { width: 32px; } .drawbar .slot { width: 30px; height: 200px; } .drawbars { gap: 4px; }
  .bpm-big { font-size: 56px; }
  .eq-graph { height: 240px; }
  .knob { width: 56px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
