@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Space+Mono:wght@400;700&display=swap');

:root {
    color-scheme: light;
    --page: #f3f5f1;
    --surface: #ffffff;
    --surface-2: #e8ece7;
    --surface-3: #d8dfd8;
    --ink: #15201d;
    --muted: #64736d;
    --quiet: #89958f;
    --line: #ccd5ce;
    --line-strong: #9eaca3;
    --inverse: #15201d;
    --success: #138a62;
    --warning: #b56b13;
    --danger: #bd3d3d;
    --accent: #242424;
    --font: 'DM Sans', sans-serif;
    --mono: 'Space Mono', monospace;
    --radius: 7px;
    --radius-sm: 4px;
    --shadow: 4px 4px 0 #c6d0c8;
    --bg: var(--page);
    --bg-pane: var(--surface);
    --panel-bg: var(--surface);
    --bg-alt: var(--surface-2);
    --console-bg: #17231f;
    --text: var(--ink);
    --text-muted: var(--muted);
    --text-far: var(--quiet);
    --border: var(--line);
    --border-strong: var(--line-strong);
    --warn: var(--warning);
    --error: var(--danger);
    --font-sans: var(--font);
    --font-display: var(--font);
    --font-mono: var(--mono);
}

body.dark-mode {
    color-scheme: dark;
    --page: #050505;
    --surface: #0b0b0b;
    --surface-2: #121212;
    --surface-3: #1c1c1c;
    --ink: #f2f2f2;
    --muted: #a0a0a0;
    --quiet: #686868;
    --line: #262626;
    --line-strong: #3a3a3a;
    --inverse: #050505;
    --accent: #f2f2f2;
    --shadow: 4px 4px 0 #000000;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--page); }
body { min-height: 100vh; color: var(--ink); background: var(--page); font: 13px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
svg { display: block; }
.hidden, [hidden] { display: none !important; }
.text-muted { color: var(--muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: var(--page); }
::-webkit-scrollbar-thumb { background: var(--surface-3); border: 2px solid var(--page); }

@keyframes enter { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
@keyframes appear { from { opacity: 0; } to { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 34px; padding: 0 13px; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); cursor: pointer; font-size: 12px; font-weight: 700; transition: transform .12s, background .12s, border-color .12s; }
.btn:hover { background: var(--surface-2); border-color: var(--accent); transform: translate(-1px, -1px); }
.btn-sm { min-height: 30px; padding: 0 10px; font-size: 11px; }
.btn-xs { min-height: 24px; padding: 0 8px; font-size: 10px; }
.btn-alt { background: var(--surface-2); }
.btn-danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn-danger:hover { background: #f9e5e2; }
.btn-primary { min-height: 36px; padding: 0 17px; color: #ffffff; background: #242424; border: 1px solid #242424; border-radius: var(--radius-sm); cursor: pointer; font-size: 12px; font-weight: 700; box-shadow: 3px 3px 0 var(--line-strong); }
.btn-primary:hover { color: #ffffff; background: #000000; border-color: #000000; }
body.dark-mode .btn-primary { color: #050505; background: #f2f2f2; border-color: #f2f2f2; box-shadow: 3px 3px 0 #4a4a4a; }
body.dark-mode .btn-primary:hover { color: #050505; background: #ffffff; border-color: #ffffff; }
.btn:disabled, .btn-primary:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.theme-toggle, .btn-icon { display: inline-grid; place-items: center; width: 32px; height: 32px; color: var(--muted); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); cursor: pointer; }
.theme-toggle:hover, .btn-icon:hover { color: var(--accent); border-color: var(--accent); }
.theme-toggle svg, .btn-icon svg { width: 14px; height: 14px; }
.sun-icon, .audio-off-icon { display: none; }
body.dark-mode .moon-icon, body.acoustic-muted .audio-on-icon { display: none; }
body.dark-mode .sun-icon, body.acoustic-muted .audio-off-icon { display: block; }

.toast-container { position: fixed; right: 18px; bottom: 18px; z-index: 3000; display: flex; flex-direction: column; gap: 8px; }
.toast { display: flex; align-items: center; gap: 9px; max-width: 340px; padding: 11px 13px; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-left: 4px solid var(--success); border-radius: var(--radius-sm); box-shadow: var(--shadow); animation: enter .18s ease both; font-size: 12px; font-weight: 600; }
.toast.error { border-left-color: var(--danger); }

.modal-overlay { position: fixed; inset: 0; z-index: 2500; display: none; align-items: center; justify-content: center; padding: 16px; background: rgba(0, 0, 0, .82); }
.modal-overlay.active { display: flex; animation: appear .15s ease both; }
.modal { display: flex; flex-direction: column; width: min(100%, 680px); max-height: 90vh; overflow: hidden; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: var(--shadow); }
.modal-header, .modal-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 17px; border-color: var(--line); }
.modal-header { border-bottom: 1px solid var(--line); }
.modal-footer { justify-content: flex-end; border-top: 1px solid var(--line); }
.modal-title { color: var(--ink); font-size: 15px; font-weight: 700; }
.modal-close { display: grid; place-items: center; width: 28px; height: 28px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; font-size: 16px; }
.modal-body { padding: 17px; overflow: auto; }
.verification-modal { max-width: 420px; }
.verification-modal-body { padding: 32px 24px; text-align: center; }
.verification-modal-copy { margin-bottom: 24px; color: var(--quiet); font-size: 12px; }
.turnstile-modal-container { display: flex; min-height: 65px; align-items: center; justify-content: center; }
.error-box { padding: 9px 11px; color: var(--danger); background: #f9e5e2; border: 1px solid #dfaaa2; border-radius: var(--radius-sm); font-size: 12px; }
body.dark-mode .error-box { background: #351f1d; border-color: #70403a; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}