:root {
  --bg: #0e1014;
  --panel: #161a21;
  --panel-2: #1c212a;
  --line: #272d38;
  --text: #e9ecf1;
  --muted: #8a93a3;
  --orig: #5b8cff;
  --dub: #2dd4bf;
  --rec: #ef4444;
  --ok: #22c55e;
  --radius: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; letter-spacing: .2px; }
.brand-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--rec); box-shadow: 0 0 12px var(--rec); }

main { max-width: 1100px; margin: 0 auto; padding: 24px; }

/* Upload */
.drop {
  margin: 8vh auto 0; max-width: 620px; text-align: center; cursor: pointer;
  border: 2px dashed var(--line); border-radius: 20px; padding: 56px 24px;
  background: var(--panel); transition: border-color .15s, background .15s;
}
.drop:hover, .drop:focus-visible, .drop.over { border-color: var(--orig); background: var(--panel-2); outline: none; }
.drop-icon { width: 48px; height: 48px; color: var(--orig); }
.drop h1 { font-size: 22px; margin: 12px 0 6px; }
.drop p { margin: 0; color: var(--muted); }

.howto {
  max-width: 620px; margin: 16px auto 0; padding: 14px 16px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  font-size: 13px; color: var(--muted);
}
.howto h2 { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; margin: 0 0 10px; color: var(--muted); }
.howto ol {
  list-style: none; counter-reset: step; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
}
.howto li { counter-increment: step; line-height: 1.4; }
.howto li::before {
  content: counter(step); display: grid; place-items: center; width: 22px; height: 22px; margin-bottom: 6px;
  border-radius: 50%; background: var(--panel-2); border: 1px solid var(--line);
  color: var(--text); font-weight: 700; font-size: 12px;
}
.howto li b { color: var(--text); }
.howto p { margin: 12px 0 0; padding-top: 10px; border-top: 1px solid var(--line); }
.pix {
  max-width: 620px; margin: 12px auto 0; padding: 12px 14px;
  display: flex; gap: 14px; align-items: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  font-size: 13px; color: var(--muted);
}
.pix img { flex: none; width: 96px; height: 96px; border-radius: 8px; background: #fff; padding: 4px; }
.pix-body { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.pix h2 { font-size: 14px; margin: 0; color: var(--text); }
.pix p { margin: 0; }
.pix-key { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 4px; }
.pix-key code {
  font: 13px ui-monospace, Consolas, monospace; color: var(--text); background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px; overflow-wrap: anywhere; user-select: all;
}
.pix-key .small-btn { align-self: center; }

.dot-rec { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--rec); vertical-align: 1px; }

.drop-hint {
  position: fixed; inset: 12px; border: 3px dashed var(--orig); border-radius: 20px;
  background: rgba(14,16,20,.85); display: grid; place-items: center;
  font-size: 22px; font-weight: 600; z-index: 30; pointer-events: none;
}

/* File bar */
.filebar { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; margin-bottom: 16px; }
.file-title { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.file-title strong { font-size: 18px; overflow-wrap: anywhere; }
.label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted);
  border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px;
}

.file-pos {
  font-size: 12px; font-weight: 600; color: var(--bg); background: var(--text);
  border-radius: 6px; padding: 1px 7px; white-space: nowrap;
}

/* Fila */
.queue { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px; }
.queue-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.queue-head h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin: 0; }
.queue-head .small-btn { margin-left: auto; align-self: center; }
.queue-head .small-btn:not(:disabled) { border-color: var(--dub); color: var(--dub); }
.queue-list { list-style: none; margin: 0; padding: 4px 0; max-height: 196px; overflow-y: auto; }
.q-item { display: flex; align-items: center; gap: 10px; padding: 3px 10px 3px 14px; }
.q-item.current { background: var(--panel-2); box-shadow: inset 3px 0 0 var(--orig); }
.q-n { width: 22px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; text-align: right; flex: none; }
.q-name {
  flex: 1; min-width: 0; text-align: left; background: none; border: 0; padding: 5px 0; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px;
}
.q-item.current .q-name { font-weight: 650; }
.q-name:hover:not(:disabled) { text-decoration: underline; }
.q-name:disabled { cursor: not-allowed; }
.q-del {
  flex: none; width: 26px; height: 26px; border-radius: 6px; border: 0; background: none;
  color: var(--muted); cursor: pointer; font-size: 18px; line-height: 1;
}
.q-del:hover:not(:disabled) { color: var(--rec); background: var(--bg); }
.chip { flex: none; font-size: 11px; font-weight: 600; border-radius: 999px; padding: 2px 9px; border: 1px solid var(--line); color: var(--muted); }
.st-rec { color: #eab308; border-color: rgba(234,179,8,.45); }
.st-saved { color: var(--dub); border-color: rgba(45,212,191,.45); }
.st-down { color: var(--ok); border-color: rgba(34,197,94,.45); }
.st-err { color: var(--rec); border-color: rgba(239,68,68,.45); }

/* Tracks */
.tracks { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.track { display: grid; grid-template-columns: 170px 1fr; }
.track + .track { border-top: 1px solid var(--line); }
.track-head { padding: 12px 14px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; justify-content: center; }
.tname { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.swatch.orig { background: var(--orig); }
.swatch.dub { background: var(--dub); }
.track-ctl { display: flex; align-items: center; gap: 8px; }
.track-ctl .vol { flex: 1; min-width: 0; }
.mute {
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel-2); cursor: pointer; display: grid; place-items: center; padding: 0;
}
.mute svg { width: 16px; height: 16px; }
.mute[aria-pressed="true"] { color: var(--rec); border-color: var(--rec); }
.wave { position: relative; height: 110px; cursor: crosshair; touch-action: none; }
.wave canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.wave-empty {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 0 16px;
  color: var(--muted); font-size: 13px; pointer-events: none;
}

/* Transport */
.transport {
  display: flex; align-items: center; flex-wrap: wrap; gap: 12px;
  margin: 16px 0; padding: 14px 16px; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius);
}
.round {
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--panel-2); cursor: pointer; display: grid; place-items: center; padding: 0;
}
.round svg { width: 18px; height: 18px; }
.round.big { width: 54px; height: 54px; background: var(--text); color: var(--bg); border: 0; }
.round.big svg { width: 22px; height: 22px; }
.round:disabled, .rec:disabled { opacity: .35; cursor: not-allowed; }
.i-pause { display: none; }
.playing .i-play { display: none; }
.playing .i-pause { display: block; }

.rec {
  display: inline-flex; align-items: center; gap: 10px; height: 54px; padding: 0 22px;
  border-radius: 27px; border: 2px solid var(--rec); background: transparent;
  font-weight: 650; cursor: pointer; min-width: 132px; justify-content: center;
}
.rec-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--rec); transition: border-radius .15s; }
.rec.active { background: var(--rec); }
.rec.active .rec-dot { background: #fff; border-radius: 3px; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .4; } }

.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track {
  position: relative; width: 34px; height: 20px; border-radius: 10px; flex: none;
  background: var(--panel-2); border: 1px solid var(--line); transition: background .15s, border-color .15s;
}
.switch-track::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--muted); transition: transform .15s, background .15s;
}
.switch input:checked + .switch-track { background: rgba(239,68,68,.25); border-color: var(--rec); }
.switch input:checked + .switch-track::after { transform: translateX(14px); background: var(--rec); }
.switch input:checked ~ span:last-child { color: var(--text); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--orig); outline-offset: 2px; }
.switch input:disabled ~ * { opacity: .5; cursor: not-allowed; }

.time { font-variant-numeric: tabular-nums; font-size: 20px; font-weight: 600; margin-left: 6px; }
.meter { display: flex; align-items: center; gap: 8px; margin-left: auto; min-width: 160px; }
.meter-label { font-size: 11px; color: var(--muted); letter-spacing: .8px; }
.meter-bar { flex: 1; height: 8px; border-radius: 4px; background: var(--panel-2); overflow: hidden; border: 1px solid var(--line); }
#meterFill { height: 100%; width: 0; background: linear-gradient(90deg, var(--ok), #eab308 75%, var(--rec)); transition: width .05s linear; }

/* Panels */
.panels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.panel h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin: 0; }
.panel p { margin: 0; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
select {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; color: var(--text); width: 100%;
}
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; cursor: pointer; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
input[type="range"] { accent-color: var(--dub); width: 100%; }
#shift { accent-color: var(--orig); }
.shift-labels { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.shift-labels b { color: var(--text); font-variant-numeric: tabular-nums; }

.ghost {
  background: transparent; border: 1px solid var(--line); border-radius: 9px;
  padding: 8px 12px; cursor: pointer;
}
.ghost:hover:not(:disabled) { background: var(--panel-2); }
.ghost:disabled { opacity: .4; cursor: not-allowed; }
.ghost.danger:not(:disabled):hover { border-color: var(--rec); color: var(--rec); }
.small-btn { align-self: flex-start; padding: 5px 10px; font-size: 13px; }

.outname {
  font-family: ui-monospace, Consolas, monospace; font-size: 14px; background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; overflow-wrap: anywhere;
}
.export-btns { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.export-btns .ghost { padding: 10px 12px; }
.primary {
  background: var(--dub); color: #062420; border: 0; border-radius: 10px;
  padding: 12px 16px; font-weight: 700; cursor: pointer;
}
.primary:disabled { opacity: .35; cursor: not-allowed; }
.primary:hover:not(:disabled) { filter: brightness(1.08); }

.tips { margin: 18px 0 0; }
kbd {
  font: 12px ui-monospace, Consolas, monospace; border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 5px; padding: 0 5px; background: var(--panel-2); color: var(--text);
}

/* Overlays */
.countdown {
  position: fixed; inset: 0; display: grid; place-items: center; z-index: 40;
  background: rgba(14,16,20,.55); font-size: 160px; font-weight: 800; color: var(--rec);
  pointer-events: none; text-shadow: 0 0 40px rgba(239,68,68,.5);
}
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 16px; max-width: calc(100% - 32px); transition: .2s; z-index: 50; pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { border-color: var(--rec); }
.toast.ok { border-color: var(--ok); }

@media (max-width: 860px) {
  .panels { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  main { padding: 16px; }
  .howto ol { grid-template-columns: 1fr 1fr; }
  .pix img { width: 80px; height: 80px; }
  .queue-head { flex-wrap: wrap; }
  .top { padding: 12px 16px; }
  .track { grid-template-columns: 1fr; }
  .track-head { border-right: 0; border-bottom: 1px solid var(--line); flex-direction: row; align-items: center; justify-content: space-between; padding: 8px 12px; }
  .track-ctl { width: 55%; }
  .wave { height: 90px; }
  .meter { margin-left: 0; width: 100%; }
  .time { font-size: 17px; }
  .countdown { font-size: 110px; }
}
