@import url('https://fonts.googleapis.com/css2?family=VT323&family=Space+Mono:ital,wght@0,400;0,700;1,400&display=swap');

:root {
  --bg:         #0a0a0f;
  --surface:    #12121a;
  --surface2:   #1a1a26;
  --border:     #2a2a3d;
  --accent:     #d4402a;
  --accent2:    #f0622a;
  --green:      #2aab6e;
  --yellow:     #e8c84a;
  --text:       #c8c8d8;
  --text-dim:   #5a5a7a;
  --text-bright:#eaeaf8;
  --scan:       rgba(255,255,255,0.02);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Space Mono', monospace;
  font-size: 13px;
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center;
  padding: 40px 20px;
  background-image: repeating-linear-gradient(
    0deg, var(--scan) 0px, var(--scan) 1px, transparent 1px, transparent 4px
  );
  background-size: 100% 4px;
}

/* ── Noise overlay ───────────────────────────────────────────────────────────── */
.noise {
  position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 200px 200px;
}

/* ── Layout ──────────────────────────────────────────────────────────────────── */
.container {
  position: relative; z-index: 1;
  width: 100%; max-width: 700px;
  display: flex; flex-direction: column; gap: 20px;
}

/* ── Header ──────────────────────────────────────────────────────────────────── */
.header {
  border: 1px solid var(--border); background: var(--surface);
  padding: 24px 28px; position: relative; overflow: hidden;
}
.header::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent2), var(--accent));
}
.logo-eyebrow {
  font-family: 'VT323', monospace; font-size: 13px; color: var(--accent);
  letter-spacing: 0.2em; text-transform: uppercase; margin-bottom: 4px;
}
h1 {
  font-family: 'VT323', monospace; font-size: 42px;
  color: var(--text-bright); line-height: 1; letter-spacing: 0.03em;
}
h1 span { color: var(--accent); }
.header-desc { margin-top: 10px; color: var(--text-dim); font-size: 11px; line-height: 1.6; }

/* ── Auth panel ──────────────────────────────────────────────────────────────── */
.auth-panel {
  border: 1px solid var(--border); background: var(--surface);
  padding: 20px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.auth-status     { display: flex; align-items: center; gap: 10px; }
.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-dim); flex-shrink: 0;
  box-shadow: 0 0 0 2px var(--surface);
}
.status-dot.online {
  background: var(--green);
  box-shadow: 0 0 8px var(--green), 0 0 0 2px var(--surface);
}
.auth-label { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.1em; }
.auth-user  { color: var(--text-bright); font-size: 13px; }

/* ── Buttons ─────────────────────────────────────────────────────────────────── */
.btn {
  font-family: 'Space Mono', monospace; font-size: 11px;
  letter-spacing: 0.08em; text-transform: uppercase;
  border: 1px solid var(--border); background: var(--surface2); color: var(--text);
  padding: 9px 18px; cursor: pointer; transition: all 0.15s;
  text-decoration: none; display: inline-block;
}
.btn:hover    { border-color: var(--accent); color: var(--accent); background: rgba(212,64,42,0.08); }
.btn:active   { transform: translateY(1px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }

.btn-primary       { border-color: var(--accent); color: var(--accent2); background: rgba(212,64,42,0.12); }
.btn-primary:hover { background: rgba(212,64,42,0.22); color: var(--text-bright); }
.btn-danger        { border-color: #3d1a18; color: #a04040; }
.btn-danger:hover  { border-color: var(--accent); color: var(--accent); }
.btn-sm { padding: 6px 12px; font-size: 10px; }

/* ── Generic sections ────────────────────────────────────────────────────────── */
.section { border: 1px solid var(--border); background: var(--surface); }
.section-header {
  padding: 14px 24px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px; background: var(--surface2);
}
.section-num   { font-family: 'VT323', monospace; font-size: 18px; color: var(--accent); min-width: 22px; }
.section-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.15em; color: var(--text-dim); }
.section-aux   { margin-left: auto; font-size: 10px; color: var(--text-dim); }
.section-body  { padding: 24px; }

/* ── Drop zone ───────────────────────────────────────────────────────────────── */
.drop-zone {
  border: 1px dashed var(--border); padding: 36px 24px;
  text-align: center; cursor: pointer; transition: all 0.2s; position: relative;
}
.drop-zone:hover,
.drop-zone.drag-over { border-color: var(--accent); background: rgba(212,64,42,0.05); }
.drop-zone input[type=file] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%;
}
.drop-icon { font-family: 'VT323', monospace; font-size: 48px; color: var(--text-dim); line-height: 1; margin-bottom: 12px; display: block; }
.drop-text { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.1em; }
.drop-hint { font-size: 10px; color: var(--text-dim); margin-top: 6px; opacity: 0.6; }

/* ── Selected file bar ───────────────────────────────────────────────────────── */
.file-bar {
  padding: 10px 14px; background: var(--surface2); border: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.file-icon { color: var(--accent); font-family: 'VT323', monospace; font-size: 18px; }
.file-name { color: var(--text-bright); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta { font-size: 10px; color: var(--text-dim); margin-top: 2px; }

.submit-area { margin-top: 20px; display: flex; align-items: center; gap: 14px; }
.submit-note { font-size: 10px; color: var(--text-dim); flex: 1; line-height: 1.5; }

/* ── Track list section ──────────────────────────────────────────────────────── */
.tracklist-section { border: 1px solid var(--border); background: var(--surface); display: none; }
.tracklist-section.visible { display: block; animation: fadeSlide 0.2s ease; }

@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

.tl-summary {
  padding: 11px 24px; border-bottom: 1px solid var(--border); background: var(--surface2);
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
}
.chip {
  font-size: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.1em;
  display: flex; align-items: baseline; gap: 5px;
}
.chip strong      { font-family: 'VT323', monospace; font-size: 22px; line-height: 1; color: var(--text-bright); }
.chip.muted strong { color: var(--text-dim); }
.chip-sep         { width: 1px; height: 14px; background: var(--border); }

.tl-filter {
  padding: 8px 24px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}
.tl-filter-icon { font-size: 13px; color: var(--text-dim); flex-shrink: 0; }
.tl-filter input {
  flex: 1; background: none; border: none; outline: none;
  font-family: 'Space Mono', monospace; font-size: 11px; color: var(--text-bright);
}
.tl-filter input::placeholder { color: var(--text-dim); }

.tl-scroll {
  max-height: 400px; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.tl-scroll::-webkit-scrollbar       { width: 4px; }
.tl-scroll::-webkit-scrollbar-thumb { background: var(--border); }

table.tl { width: 100%; border-collapse: collapse; }
table.tl thead { position: sticky; top: 0; z-index: 2; background: var(--surface2); }
table.tl th {
  padding: 7px 12px; font-size: 9px; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--text-dim); font-weight: 700; text-align: left;
  border-bottom: 1px solid var(--border); white-space: nowrap;
  cursor: pointer; user-select: none;
}
table.tl th:hover  { color: var(--text); }
table.tl th.sorted { color: var(--accent); }
table.tl th .sa    { margin-left: 3px; font-size: 8px; }
table.tl th.c-n    { width: 38px; text-align: right; }
table.tl th.c-d    { width: 52px;  text-align: right; }
table.tl th.c-t    { width: 130px; }

table.tl tbody tr           { border-bottom: 1px solid rgba(42,42,61,0.5); transition: background 0.1s; }
table.tl tbody tr:hover     { background: var(--surface2); }
table.tl tbody tr.skip      { opacity: 0.3; }

table.tl td          { padding: 7px 12px; font-size: 11px; max-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td.c-n               { color: var(--text-dim);    text-align: right; font-size: 10px; }
td.c-track           { color: var(--text-bright); }
td.c-artist          { color: var(--text); }
td.c-album           { color: var(--text-dim); }
td.c-d               { color: var(--text-dim);    text-align: right; font-size: 10px; }
td.c-t               { color: var(--text-dim);    font-size: 10px; }

.skip-tag {
  display: inline-block; font-size: 8px; padding: 1px 4px; margin-left: 5px;
  border: 1px solid var(--border); color: var(--text-dim);
  letter-spacing: 0.08em; text-transform: uppercase; vertical-align: middle;
}

.tl-empty         { padding: 28px; text-align: center; font-size: 11px; color: var(--text-dim); display: none; }
.tl-empty.visible { display: block; }

/* ── Progress ────────────────────────────────────────────────────────────────── */
.prog         { border: 1px solid var(--border); background: var(--surface); padding: 20px 24px; display: none; }
.prog.visible { display: block; }
.prog-label   { font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-dim); margin-bottom: 10px; display: flex; justify-content: space-between; }
.prog-track   { height: 3px; background: var(--surface2); overflow: hidden; }
.prog-fill    { height: 100%; width: 40%; background: linear-gradient(90deg, var(--accent), var(--accent2)); animation: ind 1.2s linear infinite; }

@keyframes ind {
  0%   { transform: translateX(-200%); }
  100% { transform: translateX(350%); }
}

/* ── Results ─────────────────────────────────────────────────────────────────── */
.results         { border: 1px solid var(--border); background: var(--surface); display: none; }
.results.visible { display: block; }
.results-hd      { padding: 14px 24px; border-bottom: 1px solid var(--border); background: var(--surface2); font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-dim); }
.results-bd      { padding: 20px 24px; }

.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.stat-box  { background: var(--surface2); border: 1px solid var(--border); padding: 14px 16px; }
.stat-v    { font-family: 'VT323', monospace; font-size: 32px; color: var(--text-bright); line-height: 1; }
.stat-v.g  { color: var(--green); }
.stat-v.y  { color: var(--yellow); }
.stat-k    { font-size: 9px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-dim); margin-top: 4px; }

.err-item { padding: 8px 12px; background: rgba(212,64,42,0.08); border-left: 2px solid var(--accent); font-size: 11px; color: var(--accent); margin-bottom: 6px; }
.ok-msg   { padding: 10px 14px; background: rgba(42,171,110,0.1); border: 1px solid rgba(42,171,110,0.3); color: var(--green); font-size: 11px; margin-bottom: 12px; }

/* ── Toast ───────────────────────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(80px);
  background: var(--surface2); border: 1px solid var(--border);
  padding: 12px 20px; font-size: 11px; transition: transform 0.25s; z-index: 100; white-space: nowrap;
}
.toast.show    { transform: translateX(-50%) translateY(0); }
.toast.error   { border-color: var(--accent); color: var(--accent); }
.toast.success { border-color: var(--green);  color: var(--green); }

/* ── Footer ──────────────────────────────────────────────────────────────────── */
.footer { text-align: center; font-size: 10px; color: var(--text-dim); opacity: 0.5; margin-top: 8px; }
