:root {
    --bg: #09090b; --fg: #fafafa; --muted: #27272a; --muted-fg: #a1a1aa;
    --border: #27272a; --card: #0c0c0f; --primary: #fafafa; --primary-fg: #18181b;
    --emerald: #10b981; --warn: #eab308; --red: #ef4444;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; border: 0 solid var(--border); }
body {
    background: var(--bg); color: var(--fg);
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px; line-height: 1.5; min-height: 100vh; padding-bottom: 110px;
}
.container { max-width: 1060px; margin: 0 auto; padding: 0 16px; }
.flex { display: flex; } .flex-col { flex-direction: column; } .items-center { align-items: center; }
.justify-between { justify-content: space-between; } .justify-end { justify-content: flex-end; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; }
.text-sm { font-size: 14px; } .text-xs { font-size: 12px; } .text-muted { color: var(--muted-fg); }
.font-medium { font-weight: 500; } .font-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.danger-text { color: var(--red); }

input, select, button, textarea { font-family: inherit; font-size: inherit; color: inherit; background: transparent; outline: none; }
svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; fill: none; flex-shrink: 0; }

.input-base { height: 36px; border: 1px solid var(--border); border-radius: 6px; padding: 4px 12px; background: var(--bg); }
.input-sm { height: 32px; font-size: 13px; padding: 2px 10px; }
select.input-base {
    appearance: none; padding-right: 28px; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 8px center;
}
select.input-base option { background: var(--bg); color: var(--fg); }

.btn { display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; font-weight: 500; height: 36px; padding: 0 14px; cursor: pointer; transition: 0.15s; white-space: nowrap; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-xs { height: 28px; padding: 0 10px; font-size: 12px; }
.btn-primary { background: var(--primary); color: var(--primary-fg); }
.btn-primary:hover:not(:disabled) { background: #e4e4e7; }
.btn-outline { border: 1px solid var(--border); }
.btn-outline:hover:not(:disabled) { background: var(--muted); }
.btn-icon { width: 32px; height: 32px; padding: 0; color: var(--muted-fg); }
.btn-icon:hover:not(:disabled) { background: var(--muted); color: var(--fg); }
.btn-help {
    width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--border); background: rgba(9,9,11,0.8);
    color: var(--muted-fg); font-size: 12px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.btn-help:hover { color: var(--fg); border-color: var(--muted-fg); }

.header { position: sticky; top: 0; z-index: 40; border-bottom: 1px solid var(--border); background: rgba(9,9,11,0.92); backdrop-filter: blur(8px); }
.header-inner { height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: baseline; gap: 8px; }
.brand-title { font-size: 16px; font-weight: 700; letter-spacing: -0.02em; }
.brand-title span { color: var(--emerald); }
.brand-sep, .brand-sub { font-size: 13px; color: var(--muted-fg); }
.header-actions { display: flex; align-items: center; gap: 10px; }

.switch-label { display: flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; }
.switch-track { width: 34px; height: 18px; background: var(--muted); border-radius: 9px; position: relative; transition: 0.2s; }
.switch-thumb { width: 14px; height: 14px; background: #fff; border-radius: 50%; position: absolute; top: 2px; left: 2px; transition: transform 0.2s; }
input.sr-only { display: none; }
input.sr-only:checked + .switch-track { background: var(--primary); }
input.sr-only:checked + .switch-track .switch-thumb { transform: translateX(16px); background: var(--primary-fg); }
.lock-dot { font-size: 11px; opacity: 0.8; }

.shadcn-checkbox { width: 16px; height: 16px; appearance: none; border: 1px solid var(--muted-fg); border-radius: 4px; cursor: pointer; flex-shrink: 0; }
.shadcn-checkbox:checked {
    background: var(--primary); border-color: var(--primary);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2309090b' stroke-width='3'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
    background-size: 80%; background-position: center; background-repeat: no-repeat;
}

.drop-overlay { position: fixed; inset: 0; z-index: 100; background: rgba(9,9,11,0.92); backdrop-filter: blur(6px); display: none; align-items: center; justify-content: center; padding: 24px; }
.drop-overlay.active { display: flex; }
.drop-overlay-box { width: 100%; height: 100%; border: 2px dashed var(--emerald); border-radius: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; pointer-events: none; }
.icon-lg { width: 48px; height: 48px; color: var(--emerald); }
.drop-overlay-title { font-size: 20px; font-weight: 600; }

.main-content { padding-top: 20px; }
.dropzone { border: 1px dashed var(--border); border-radius: 10px; padding: 28px 16px; text-align: center; cursor: pointer; transition: 0.2s; background: rgba(39,39,42,0.12); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.dropzone:hover { border-color: var(--muted-fg); background: rgba(39,39,42,0.25); }
.dropzone-icon { width: 32px; height: 32px; color: var(--muted-fg); }
.dropzone.compact { flex-direction: row; justify-content: center; padding: 12px 16px; }
.dropzone.compact .dropzone-icon { width: 18px; height: 18px; }

.onboarding { margin-top: 16px; display: flex; flex-direction: column; gap: 12px; }
.steps-row { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; color: var(--muted-fg); font-size: 13px; }
.step-item span { display: inline-flex; width: 20px; height: 20px; border-radius: 50%; background: var(--muted); color: var(--fg); align-items: center; justify-content: center; font-size: 11px; font-weight: 600; margin-right: 4px; }
.legend-details { border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; background: rgba(39,39,42,0.15); }
.legend-summary { cursor: pointer; font-size: 13px; font-weight: 500; color: var(--muted-fg); }
.legend-body { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.legend-row { display: flex; align-items: center; gap: 8px; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.dot-good { background: var(--emerald); } .dot-warn { background: var(--warn); } .dot-bad { background: var(--red); }

.summary-bar { margin-top: 16px; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.filter-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { height: 28px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--border); font-size: 12px; cursor: pointer; color: var(--muted-fg); }
.pill.active { background: var(--muted); color: var(--fg); border-color: var(--muted-fg); }
.summary-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.disclaimer { margin-top: 10px; font-size: 12px; color: var(--muted-fg); opacity: 0.85; }
.track-list { margin-top: 14px; display: flex; flex-direction: column; gap: 12px; }

.card { border: 1px solid var(--border); border-radius: 8px; background: var(--card); overflow: hidden; }
.card.status-good { border-top: 3px solid var(--emerald); }
.card.status-warning { border-top: 3px solid var(--warn); }
.card.status-bad { border-top: 3px solid var(--red); border-color: rgba(239,68,68,0.35); }
.card-header { padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-left { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.card-title-wrap { min-width: 0; flex: 1; }
.card-title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 3px; font-size: 12px; color: var(--muted-fg); }
.card-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }

.badge { display: inline-flex; align-items: center; padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 600; border: 1px solid transparent; }
.badge.emerald { color: var(--emerald); background: rgba(16,185,129,0.1); border-color: rgba(16,185,129,0.25); }
.badge.warning { color: var(--warn); background: rgba(234,179,8,0.1); border-color: rgba(234,179,8,0.25); }
.badge.destructive { color: var(--red); background: rgba(239,68,68,0.1); border-color: rgba(239,68,68,0.25); }
.badge.neutral { color: var(--muted-fg); background: var(--muted); }

.wf-row { padding: 0 14px 12px; display: flex; align-items: center; gap: 10px; }
.play-btn { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--border); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; }
.play-btn:hover { background: var(--muted); }
.wf-canvas-wrap { position: relative; flex: 1; height: 44px; background: #050507; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; cursor: pointer; }
.wf-canvas { width: 100%; height: 100%; display: block; }
.wf-time { font-size: 11px; font-family: monospace; color: var(--muted-fg); min-width: 72px; text-align: right; }

.suggest-bar { margin: 0 14px 12px; padding: 8px 10px; border-radius: 6px; background: rgba(16,185,129,0.08); border: 1px solid rgba(16,185,129,0.25); display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; }

.spoiler { border-top: 1px solid var(--border); display: none; padding: 14px; background: rgba(39,39,42,0.14); }
.spoiler.active { display: block; }
.spectrogram-wrapper { height: 140px; width: 100%; border-radius: 6px; margin-bottom: 10px; position: relative; border: 1px solid var(--border); background: #050507; overflow: hidden; cursor: crosshair; }
.spectrogram-canvas, .spectrogram-canvas-large { width: 100%; height: 100%; display: block; }
.spec-label { position: absolute; font-family: monospace; font-size: 10px; color: rgba(255,255,255,0.85); background: rgba(9,9,11,0.78); padding: 2px 6px; border-radius: 4px; pointer-events: none; }
.freq-scale { position: absolute; right: 6px; top: 0; bottom: 0; display: flex; flex-direction: column; justify-content: space-between; padding: 4px 0; font-size: 10px; font-family: monospace; color: rgba(255,255,255,0.75); pointer-events: none; text-align: right; text-shadow: 0 1px 2px #000; }
.db-legend { position: absolute; left: 10px; top: 30px; bottom: 30px; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 9px; font-family: monospace; color: rgba(255,255,255,0.7); pointer-events: none; }
.db-bar { width: 6px; flex: 1; border-radius: 3px; background: linear-gradient(to bottom, #ffffff, #ffdd22, #f03020, #a500b4, #14006e, #050507); }

.progress-bar-wrap { height: 3px; width: 100%; background: var(--muted); display: none; }
.progress-bar-wrap.active { display: block; }
.progress-bar-fill { height: 100%; width: 0%; background: var(--emerald); transition: width 0.2s; }

.action-bar-wrap { position: fixed; bottom: 0; left: 0; right: 0; z-index: 45; transform: translateY(110%); transition: transform 0.2s ease; }
.action-bar-wrap.visible { transform: translateY(0); }
.expert-panel { border-top: 1px solid var(--border); background: rgba(18,18,22,0.96); backdrop-filter: blur(8px); display: none; }
.expert-panel.active { display: block; }
.expert-content { padding: 10px 16px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.expert-divider { width: 1px; height: 16px; background: var(--border); }
.action-bar { border-top: 1px solid var(--border); background: rgba(9,9,11,0.96); backdrop-filter: blur(10px); }
.action-bar-inner { padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.action-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.lufs-wrap { display: flex; align-items: center; gap: 6px; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(9,9,11,0.82); backdrop-filter: blur(4px); display: none; align-items: center; justify-content: center; z-index: 60; padding: 16px; }
.modal-backdrop.active { display: flex; }
.modal-dialog { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 22px; width: 100%; max-width: 460px; position: relative; max-height: 90vh; overflow-y: auto; }
.spec-modal-dialog { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 20px; width: 100%; max-width: 920px; position: relative; max-height: 92vh; overflow-y: auto; }
.modal-title { font-size: 17px; font-weight: 600; }
.modal-x { position: absolute; top: 14px; right: 14px; }
.modal-grid { display: grid; grid-template-columns: 100px 1fr; gap: 10px; align-items: center; margin-bottom: 12px; }
.spectrogram-modal-canvas-wrap { height: 280px; width: 100%; border-radius: 6px; margin: 12px 0; position: relative; border: 1px solid var(--border); background: #050507; overflow: hidden; cursor: crosshair; }

.cover-upload-row { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.cover-preview { width: 56px; height: 56px; border-radius: 6px; border: 1px solid var(--border); background: var(--muted); display: flex; align-items: center; justify-content: center; overflow: hidden; font-size: 22px; flex-shrink: 0; }
.cover-preview img { width: 100%; height: 100%; object-fit: cover; }

.help-text { margin-top: 12px; font-size: 13px; color: var(--muted-fg); display: flex; flex-direction: column; gap: 8px; }
.help-text strong { color: var(--fg); }
.help-text ul { padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }

.settings-section { margin-top: 16px; }
.radio-group { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.radio-card { border: 1px solid var(--border); border-radius: 6px; padding: 8px; text-align: center; cursor: pointer; font-size: 13px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.radio-card:has(input:checked) { border-color: var(--fg); background: var(--muted); }

.admin-list { display: flex; flex-direction: column; gap: 8px; max-height: 60vh; overflow-y: auto; }
.admin-row { border: 1px solid var(--border); border-radius: 6px; padding: 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

@media (max-width: 720px) {
    .brand-sep, .brand-sub { display: none; }
    .card-header { flex-direction: column; align-items: flex-start; }
    .card-actions { width: 100%; justify-content: flex-end; border-top: 1px solid var(--border); padding-top: 8px; }
    .action-bar-inner { flex-direction: column; align-items: stretch; }
    .action-controls { justify-content: space-between; }
    .modal-grid { grid-template-columns: 1fr; gap: 4px; }
}
