:root {
    color-scheme: dark;
    --bg: #020805;
    --bg-accent: rgba(38, 255, 143, 0.12);
    --surface: #07110c;
    --surface-soft: #0b1711;
    --surface-muted: #102019;
    --border: #173126;
    --border-strong: #24b86d;
    --text: #d8ffe8;
    --text-strong: #f2fff8;
    --muted: #7fd7aa;
    --accent: #24b86d;
    --accent-strong: #57f0a4;
    --accent-text: #021007;
    --success-bg: #0f2116;
    --success-border: #2f8d59;
    --success-text: #c6ffe0;
    --error-bg: #211313;
    --error-border: #7d4848;
    --error-text: #ffc6c6;
    --warning-bg: #1b2316;
    --warning-border: #7bb25b;
    --warning-text: #dff7b4;
    --shadow: 0 24px 60px rgba(0, 0, 0, 0.38);
    --control-height: 42px;
    --control-padding-x: 14px;
    --control-font-size: 14px;
    --checkbox-size: 22px;
    --article-head-gap: 20px;
    --article-head-padding-bottom: 20px;
    --article-footer-padding-top: 64px;
}

:root[data-theme="dark"] {
    color-scheme: dark;
}

:root[data-theme="light"] {
    color-scheme: light;
    --bg: #e6f4eb;
    --bg-accent: rgba(36, 184, 109, 0.08);
    --surface: #f8fff9;
    --surface-soft: #edf8f0;
    --surface-muted: #e1f0e6;
    --border: #b8d6c2;
    --border-strong: #31975e;
    --text: #113220;
    --text-strong: #092213;
    --muted: #4d7f62;
    --accent: #2d8a57;
    --accent-strong: #226d44;
    --accent-text: #f7fff9;
    --success-bg: #e6f8eb;
    --success-border: #8bc3a2;
    --success-text: #1f5d36;
    --error-bg: #fbeeee;
    --error-border: #d6b1b1;
    --error-text: #8c3232;
    --warning-bg: #f3f7e8;
    --warning-border: #b0c170;
    --warning-text: #526623;
    --shadow: 0 24px 50px rgba(20, 77, 45, 0.12);
    --control-height: 42px;
    --control-padding-x: 14px;
    --control-font-size: 14px;
    --checkbox-size: 22px;
    --article-head-gap: 20px;
    --article-head-padding-bottom: 20px;
    --article-footer-padding-top: 64px;
}

html.theme-system {
    color-scheme: dark;
}

body.theme-ready {
    background: var(--bg);
    color: var(--text);
}

.theme-select {
    padding: 0 12px;
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--text);
    font-size: var(--control-font-size);
}

.ui-select {
    min-height: var(--control-height);
    padding: 0 var(--control-padding-x);
    box-sizing: border-box;
}

.ui-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--control-height);
    padding: 0 var(--control-padding-x);
    border: 1px solid var(--border-strong);
    background: var(--surface-muted);
    color: var(--text-strong);
    text-decoration: none;
    font-size: var(--control-font-size);
    font-weight: bold;
    box-sizing: border-box;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.ui-button-primary {
    border-color: var(--accent-strong);
    background: var(--accent);
    color: var(--accent-text);
}

.ui-button:hover,
.ui-button:focus-visible,
.ui-select:focus,
.theme-select:focus {
    outline: none;
    border-color: var(--accent-strong);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.ui-button-danger {
    border-color: #8f3d3d;
    background: #6a1f1f;
    color: #fff4ef;
    transition: background 0.18s ease, border-color 0.18s ease;
}

.ui-button-danger:hover {
    background: #7a2626;
    border-color: #a24848;
}

.ui-button-sm {
    min-height: var(--control-height);
    padding: 0 12px;
    font-size: var(--control-font-size);
}

.ui-button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

input[type="checkbox"] {
    width: var(--checkbox-size);
    height: var(--checkbox-size);
    accent-color: var(--accent);
    vertical-align: middle;
}
