:root {
    --bg: #08131b;
    --bg-soft: #102332;
    --card: rgba(12, 29, 42, 0.88);
    --card-strong: rgba(10, 24, 35, 0.94);
    --line: rgba(149, 207, 255, 0.14);
    --text: #ecf7ff;
    --muted: #97b5c6;
    --accent: #ff8b42;
    --accent-soft: rgba(255, 139, 66, 0.16);
    --highlight: #67d8ff;
    --highlight-soft: rgba(103, 216, 255, 0.14);
    --shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
    --wash: rgba(8, 19, 27, 0.95);
}

body[data-theme="light"] {
    --bg: #f5efe4;
    --bg-soft: #e3ecec;
    --card: rgba(255, 255, 255, 0.9);
    --card-strong: rgba(255, 251, 245, 0.96);
    --line: rgba(26, 56, 65, 0.12);
    --text: #1d2b30;
    --muted: #5f7078;
    --accent: #cd612f;
    --accent-soft: rgba(205, 97, 47, 0.14);
    --highlight: #2f8ea1;
    --highlight-soft: rgba(47, 142, 161, 0.14);
    --shadow: 0 24px 60px rgba(22, 43, 48, 0.16);
    --wash: rgba(245, 239, 228, 0.95);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Trebuchet MS", "Verdana", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 16% 18%, rgba(255, 139, 66, 0.18), transparent 24%),
        radial-gradient(circle at 84% 12%, rgba(103, 216, 255, 0.16), transparent 26%),
        linear-gradient(180deg, var(--bg) 0%, var(--bg-soft) 100%);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
    background-size: 32px 32px;
    pointer-events: none;
}

.wash {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at var(--wash-x, 88%) var(--wash-y, 14%), var(--wash) 0, transparent 0);
    opacity: 0;
    pointer-events: none;
    z-index: 20;
}

body.theme-shift .wash {
    animation: wash 0.7s ease forwards;
}

.shell {
    width: min(1180px, calc(100% - 30px));
    margin: 0 auto;
    padding: 24px 0 40px;
}

.hero,
.panel,
.program-card {
    border: 1px solid var(--line);
    background: var(--card);
    box-shadow: var(--shadow);
}

.hero {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 18px;
    padding: 28px;
    border-radius: 28px;
}

.eyebrow {
    margin: 0 0 10px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    font-size: 0.75rem;
    color: var(--accent);
}

h1,
h2,
h3,
.panel-title,
.program-title {
    margin: 0;
    font-family: "Palatino Linotype", Georgia, serif;
}

h1 {
    font-size: clamp(2.4rem, 4vw, 4.2rem);
    line-height: 0.94;
    max-width: 8ch;
}

.hero-text,
.panel-note {
    color: var(--muted);
    line-height: 1.68;
}

.hero-actions,
.chaos-actions,
.filter-list,
.tag-list,
.badge-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.hero-actions {
    margin-top: 20px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 18px;
    border-radius: 14px;
    border: 1px solid transparent;
    text-decoration: none;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.24s ease, background 0.24s ease, border-color 0.24s ease;
}

.button:hover {
    transform: translateY(-2px);
}

.button.solid {
    color: #fff;
    background: linear-gradient(135deg, var(--accent), #bb4a1d);
}

.button.ghost {
    color: var(--text);
    border-color: var(--line);
    background: rgba(255, 255, 255, 0.04);
}

.button.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.hero-stats {
    display: grid;
    gap: 12px;
}

.stat-card,
.meter {
    padding: 18px;
    border-radius: 22px;
    background: var(--card-strong);
}

.stat-card span,
.meter span,
.search-box span,
.filter-label,
.meta-item span {
    display: block;
    color: var(--muted);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.stat-card strong,
.meter strong {
    display: block;
    margin-top: 8px;
    font-size: 2.1rem;
}

.layout {
    display: grid;
    grid-template-columns: 290px 1fr;
    gap: 18px;
    margin-top: 20px;
}

.sidebar {
    display: grid;
    gap: 16px;
    align-content: start;
}

.panel {
    padding: 18px;
    border-radius: 24px;
}

.panel.accent {
    background:
        linear-gradient(135deg, rgba(255, 139, 66, 0.1), rgba(103, 216, 255, 0.06)),
        var(--card);
}

.panel-title {
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.steps {
    margin: 0;
    padding-left: 18px;
    color: var(--muted);
    line-height: 1.7;
}

.catalog {
    display: grid;
    gap: 18px;
}

.toolbar {
    display: grid;
    gap: 16px;
}

.search-box {
    display: grid;
    gap: 8px;
}

.search-box input {
    min-height: 50px;
    width: 100%;
    padding: 0 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    font: inherit;
    color: var(--text);
    background: rgba(255, 255, 255, 0.04);
}

.filter-chip,
.pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    font: inherit;
}

.filter-chip {
    cursor: pointer;
}

.filter-chip.active,
.filter-chip:hover {
    color: #07131b;
    background: linear-gradient(135deg, var(--highlight), #9bffe5);
    border-color: transparent;
}

.program-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.program-card {
    display: grid;
    gap: 14px;
    padding: 20px;
    border-radius: 24px;
    animation: rise 0.5s ease both;
}

.card-head,
.card-actions {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
}

.category-badge {
    color: var(--accent);
    background: var(--accent-soft);
}

.status-badge {
    color: var(--highlight);
    background: var(--highlight-soft);
}

.program-title {
    font-size: 1.65rem;
}

.program-summary {
    margin: 0;
    color: var(--muted);
    line-height: 1.65;
}

.meta-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.meta-item {
    padding: 12px 14px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.04);
}

.meta-item strong {
    display: block;
    margin-top: 6px;
    overflow-wrap: anywhere;
}

.empty {
    text-align: center;
}

.hidden {
    display: none;
}

.chaos-panel {
    background:
        linear-gradient(135deg, rgba(255, 139, 66, 0.08), rgba(103, 216, 255, 0.06)),
        var(--card);
}

.chaos-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.chaos-screen {
    margin-top: 16px;
    padding: 18px;
    border-radius: 22px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.03);
}

.chaos-screen h3 {
    font-size: 1.35rem;
    line-height: 1.4;
}

.chaos-screen p {
    margin: 12px 0 0;
    color: var(--muted);
    line-height: 1.7;
}

.progress {
    height: 12px;
    margin-top: 16px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.06);
}

.progress span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent), var(--highlight), #8effda);
    transition: width 0.35s ease;
}

.badge-row {
    margin-top: 14px;
}

.comments-lite {
    text-align: center;
}

.micro-link {
    position: fixed;
    right: 16px;
    bottom: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(8, 19, 27, 0.7);
    color: var(--text);
    text-decoration: none;
    z-index: 10;
}

code {
    padding: 0.12rem 0.35rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
}

body[data-chaos="bootloop"] .chaos-panel {
    box-shadow: 0 22px 50px rgba(255, 114, 114, 0.16);
}

body[data-chaos="arsentiy"] .chaos-panel {
    box-shadow: 0 22px 50px rgba(103, 216, 255, 0.18);
}

body[data-chaos="erema"] .chaos-panel {
    box-shadow: 0 22px 50px rgba(255, 214, 122, 0.18);
}

@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes wash {
    0% {
        opacity: 0.95;
        background: radial-gradient(circle at var(--wash-x, 88%) var(--wash-y, 14%), var(--wash) 0, transparent 0);
    }
    100% {
        opacity: 0;
        background: radial-gradient(circle at var(--wash-x, 88%) var(--wash-y, 14%), var(--wash) 140vmax, transparent 141vmax);
    }
}

@media (max-width: 980px) {
    .hero,
    .layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .shell {
        width: min(100% - 18px, 1180px);
        padding-top: 18px;
    }

    .program-grid,
    .meta-grid,
    .chaos-head {
        grid-template-columns: 1fr;
    }

    .hero,
    .panel,
    .program-card {
        padding: 18px;
        border-radius: 20px;
    }

    .hero-actions {
        flex-direction: column;
    }

    .button {
        width: 100%;
    }

    .micro-link {
        right: 12px;
        bottom: 12px;
        width: 34px;
        height: 34px;
    }
}
