:root {
    --bg: #081321;
    --bg-alt: #10243f;
    --card: rgb(247 250 255 / 0.88);
    --card-soft: rgb(226 236 255 / 0.62);
    --text: #f7fbff;
    --muted: #d7e1f2;
    --panel-text: #10233f;
    --panel-muted: #425776;
    --accent: #7dd3fc;
    --accent-soft: rgb(125 211 252 / 0.18);
    --border: rgb(191 219 254 / 0.26);
    --ok: #14532d;
    --ok-bg: #dcfce7;
    --bad: #7f1d1d;
    --bad-bg: #ffe4e6;
    --shadow: 0 18px 48px rgb(4 10 24 / 28%);
    --glow: 0 0 0 1px rgb(125 211 252 / 0.08), 0 0 32px rgb(56 189 248 / 0.12);
    --toolbar-top: 0px;
    --sticky-gap: 6px;
    --toolbar-height: 58px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    color: var(--text);
    line-height: 1.45;
    background:
        linear-gradient(180deg, rgb(8 19 33 / 0.72), rgb(8 19 33 / 0.84)),
        url("../img/devops-bg.svg") center / cover no-repeat fixed,
        linear-gradient(180deg, var(--bg), var(--bg-alt));
    min-height: 100vh;
    position: relative;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    backdrop-filter: blur(12px) saturate(115%);
    -webkit-backdrop-filter: blur(12px) saturate(115%);
    background:
        linear-gradient(180deg, rgb(255 255 255 / 0.1), rgb(255 255 255 / 0.03) 28%, rgb(255 255 255 / 0.09)),
        radial-gradient(circle at 20% 15%, rgb(255 255 255 / 0.14), transparent 26%),
        radial-gradient(circle at 80% 25%, rgb(148 163 184 / 0.08), transparent 22%),
        linear-gradient(135deg, rgb(14 165 233 / 0.08), transparent 35%, rgb(16 185 129 / 0.06) 70%, transparent);
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0.22;
    background-image:
        linear-gradient(rgb(255 255 255 / 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgb(255 255 255 / 0.05) 1px, transparent 1px);
    background-size: 24px 24px;
    mask-image: linear-gradient(180deg, transparent, black 18%, black 82%, transparent);
}

main,
.container {
    position: relative;
    z-index: 1;
}

.container {
    width: min(1080px, 94vw);
    margin: 0 auto;
    padding: 24px 0 28px;
}

.hero {
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 18px;
    margin-bottom: 14px;
    background: linear-gradient(135deg, rgb(255 255 255 / 0.22), rgb(191 219 254 / 0.12));
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
    text-align: center;
}

.hero::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(90deg, transparent, rgb(125 211 252 / 0.14), transparent),
        linear-gradient(180deg, transparent 0%, rgb(255 255 255 / 0.06) 48%, transparent 100%);
    opacity: 0.7;
}

h1 {
    margin: 0 0 8px;
    font-size: 1.9rem;
    letter-spacing: 0.2px;
    text-shadow: 0 0 24px rgb(125 211 252 / 0.18);
}

p.meta {
    margin: 0;
    color: var(--muted);
    font-size: 0.98rem;
    max-width: 760px;
    margin-inline: auto;
}

.hero-author {
    margin: 14px 0 0;
}

.hero-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #e0f2fe;
    font-weight: 700;
    text-decoration: none;
    border-bottom: 1px solid rgb(125 211 252 / 0.45);
    transition: color 0.2s ease, border-color 0.2s ease;
}

.hero-link:hover {
    color: #7dd3fc;
    border-color: rgb(125 211 252 / 0.9);
}

.hero-link-icon {
    width: 18px;
    height: 18px;
    fill: currentColor;
    flex: 0 0 auto;
}

.toolbar {
    position: sticky;
    top: var(--toolbar-top);
    z-index: 10;
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    gap: 10px;
    margin-bottom: 6px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgb(12 22 39 / 0.42);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: 0 12px 30px rgb(5 10 25 / 24%);
    box-shadow: var(--shadow), var(--glow);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 12px;
    position: sticky;
    top: calc(var(--toolbar-top) + var(--toolbar-height) + var(--sticky-gap));
    z-index: 9;
}

.pill {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgb(247 250 255 / 0.5);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-align: center;
    white-space: nowrap;
    box-shadow: 0 8px 18px rgb(5 10 25 / 16%);
    font-size: 0.94rem;
    font-weight: 600;
    box-shadow: 0 8px 18px rgb(5 10 25 / 16%), var(--glow);
}

.pill strong {
    font-size: 1.05rem;
}

.pill.ok {
    color: #14532d;
    background: rgb(187 247 208 / 0.98);
    border-color: rgb(22 163 74 / 0.92);
    box-shadow: 0 8px 18px rgb(5 10 25 / 16%), 0 0 0 2px rgb(34 197 94 / 0.18);
}

.pill.bad {
    color: #7f1d1d;
    background: rgb(254 202 202 / 0.98);
    border-color: rgb(220 38 38 / 0.92);
    box-shadow: 0 8px 18px rgb(5 10 25 / 16%), 0 0 0 2px rgb(239 68 68 / 0.16);
}

.pill.total {
    color: var(--muted);
    background: rgb(226 236 255 / 0.22);
}

.search {
    width: 100%;
    border: 1px solid var(--border);
    background: rgb(226 236 255 / 0.18);
    color: var(--text);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 0.95rem;
    outline: none;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.search::placeholder {
    color: rgb(232 240 255 / 0.62);
}

.search:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgb(125 211 252 / 20%), 0 0 24px rgb(56 189 248 / 0.16);
}

.btn {
    border: 1px solid var(--border);
    background: rgb(226 236 255 / 0.16);
    color: var(--text);
    border-radius: 10px;
    padding: 10px 12px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.1s ease, border-color 0.2s ease, background 0.2s ease;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.btn:hover {
    border-color: var(--accent);
    background: rgb(125 211 252 / 0.18);
    transform: translateY(-1px);
    box-shadow: 0 0 18px rgb(56 189 248 / 0.14);
}

.btn.reset {
    border-color: rgb(252 165 165 / 0.55);
    color: #ffe3e3;
    background: rgb(153 27 27 / 0.18);
}

.error {
    border: 1px solid rgb(248 113 113 / 0.45);
    border-radius: 10px;
    padding: 12px;
    color: #ffe0e0;
    background: rgb(127 29 29 / 0.38);
    margin-bottom: 16px;
    white-space: pre-wrap;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.qa-item {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: linear-gradient(180deg, rgb(255 255 255 / 0.82), rgb(240 246 255 / 0.76));
    margin-bottom: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    position: relative;
}

.qa-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 22px 48px rgb(4 10 24 / 34%), 0 0 24px rgb(125 211 252 / 0.12);
}

.qa-item::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgb(125 211 252 / 0.66), transparent);
    opacity: 0.9;
    pointer-events: none;
}

.qa-item::after {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 0;
    pointer-events: none;
    transition: width 0.2s ease;
}

.qa-item.status-correct {
    border-color: rgb(22 163 74 / 1);
    box-shadow: 0 20px 42px rgb(21 128 61 / 0.3), 0 0 0 3px rgb(34 197 94 / 0.42);
    background: linear-gradient(180deg, rgb(220 252 231 / 1), rgb(187 247 208 / 0.96));
}

.qa-item.status-incorrect {
    border-color: rgb(220 38 38 / 1);
    box-shadow: 0 20px 42px rgb(185 28 28 / 0.3), 0 0 0 3px rgb(248 113 113 / 0.42);
    background: linear-gradient(180deg, rgb(254 226 226 / 1), rgb(254 202 202 / 0.97));
}

.qa-item.status-correct::after {
    width: 10px;
    background: linear-gradient(180deg, #22c55e, #16a34a);
    box-shadow: 2px 0 18px rgb(34 197 94 / 0.3);
}

.qa-item.status-incorrect::after {
    width: 10px;
    background: linear-gradient(180deg, #ef4444, #dc2626);
    box-shadow: 2px 0 18px rgb(239 68 68 / 0.28);
}

.qa-item.status-correct .q-btn:hover {
    background: rgb(134 239 172 / 0.62);
}

.qa-item.status-incorrect .q-btn:hover {
    background: rgb(252 165 165 / 0.64);
}

.q-head {
    display: flex;
    align-items: stretch;
    gap: 8px;
    padding: 8px 8px 0;
}

.q-btn {
    flex: 1 1 auto;
    min-width: 0;
    border: 0;
    background: transparent;
    color: var(--panel-text);
    text-align: left;
    padding: 10px 8px 12px;
    font-size: 1rem;
    cursor: pointer;
    font-weight: 700;
    display: flex;
    align-items: baseline;
    gap: 10px;
    border-radius: 10px;
}

.q-btn:hover {
    background: var(--accent-soft);
}

.q-btn::before {
    content: ">";
    color: var(--accent);
    transition: transform 0.15s ease;
    display: inline-block;
}

.q-btn[aria-expanded="true"]::before {
    transform: rotate(90deg);
}

.q-num {
    color: #2563eb;
    font-weight: 800;
    min-width: 2.8ch;
}

.q-text {
    color: var(--panel-text);
    text-shadow: none;
}

.mark-actions {
    display: inline-flex;
    flex: 0 0 auto;
    gap: 6px;
    padding: 4px;
    border-radius: 10px;
    background: rgb(226 236 255 / 0.18);
    border: 1px solid var(--border);
    height: fit-content;
    margin-top: 6px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.mark-btn {
    width: 34px;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgb(255 255 255 / 0.92);
    cursor: pointer;
    font-weight: 900;
    line-height: 1;
    transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease;
    user-select: none;
}

.mark-btn:hover {
    transform: translateY(-1px);
}

.mark-btn.correct {
    color: #15803d;
}

.mark-btn.incorrect {
    color: #dc2626;
}

.mark-btn.active.correct {
    border-color: #15803d;
    background: #16a34a;
    color: #f0fdf4;
    box-shadow: 0 0 0 3px rgb(34 197 94 / 0.34), 0 10px 24px rgb(21 128 61 / 0.34);
    animation: pop 0.2s ease;
}

.mark-btn.active.incorrect {
    border-color: #b91c1c;
    background: #dc2626;
    color: #fff1f2;
    box-shadow: 0 0 0 3px rgb(248 113 113 / 0.32), 0 10px 24px rgb(185 28 28 / 0.34);
    animation: pop 0.2s ease;
}

@keyframes pop {
    0% {
        transform: scale(0.9);
    }

    70% {
        transform: scale(1.08);
    }

    100% {
        transform: scale(1);
    }
}

.options {
    margin: 0;
    padding: 0 20px 14px 40px;
    color: var(--panel-muted);
    font-weight: 600;
}

.options li {
    margin: 5px 0;
}

.answer-toggle {
    width: calc(100% - 16px);
    margin: 0 8px 8px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgb(226 236 255 / 0.4);
    color: var(--panel-text);
    padding: 11px 14px;
    font-size: 0.95rem;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.answer-toggle:hover {
    background: rgb(125 211 252 / 0.24);
    border-color: rgb(125 211 252 / 0.42);
    transform: translateY(-1px);
}

.answer-toggle::after {
    content: "Показать";
    float: right;
    color: #0369a1;
    font-size: 0.84rem;
    font-weight: 800;
    opacity: 0.9;
}

.answer-toggle[aria-expanded="true"]::after {
    content: "Скрыть";
}

.answer {
    border-top: 1px solid var(--border);
    padding: 12px 16px 16px;
    white-space: pre-wrap;
    color: var(--panel-text);
    background: linear-gradient(180deg, rgb(255 255 255 / 0.88), rgb(236 244 255 / 0.78));
}

.answer,
.options,
.hero,
.toolbar,
.pill,
.qa-item,
.empty {
    position: relative;
}

.answer::after,
.empty::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(180deg, rgb(255 255 255 / 0.05), transparent 26%, transparent 74%, rgb(255 255 255 / 0.04));
}

.answer-label {
    color: #0369a1;
    font-weight: 800;
    margin-bottom: 6px;
    display: block;
}

.empty {
    padding: 20px;
    border: 1px dashed var(--border);
    border-radius: 12px;
    color: var(--muted);
    text-align: center;
    background: rgb(247 250 255 / 0.28);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.scroll-top-btn {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 20;
    width: 48px;
    height: 48px;
    border: 1px solid rgb(191 219 254 / 0.34);
    border-radius: 999px;
    background: rgb(8 19 33 / 0.72);
    color: #f7fbff;
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 14px 28px rgb(4 10 24 / 28%);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease;
}

.scroll-top-btn:active {
    transform: translateY(0);
    background: rgb(8 19 33 / 0.72);
    border-color: rgb(191 219 254 / 0.34);
}

.scroll-top-btn:focus,
.scroll-top-btn:focus-visible {
    outline: none;
}

@media (hover: hover) and (pointer: fine) {
    .scroll-top-btn:hover {
        transform: translateY(-2px);
        background: rgb(14 165 233 / 0.78);
        border-color: rgb(125 211 252 / 0.6);
    }
}

.scroll-top-btn[hidden] {
    display: none;
}

@media (max-width: 920px) {
    .toolbar {
        grid-template-columns: 1fr 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .container {
        width: min(92vw, 1080px);
        padding-top: 16px;
    }

    .hero {
        padding: 16px;
    }

    h1 {
        font-size: 1.6rem;
    }

    .q-head {
        flex-direction: column;
        gap: 4px;
    }

    .mark-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: calc(100% - 16px);
        margin: 0 8px 8px;
        padding: 6px;
    }

    .mark-btn {
        width: 100%;
        height: 40px;
    }

    .q-btn {
        align-items: flex-start;
        padding-bottom: 10px;
    }

    .q-text {
        overflow-wrap: anywhere;
    }

    .toolbar {
        position: static;
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 8px;
    }

    .toolbar > * {
        width: 100%;
    }

    .stats-grid {
        position: sticky;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        top: 10px;
        z-index: 11;
        padding: 6px;
        border: 1px solid rgb(191 219 254 / 0.18);
        border-radius: 14px;
        background: rgb(8 19 33 / 0.34);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        box-shadow: 0 14px 30px rgb(4 10 24 / 20%);
    }

    .pill {
        padding: 8px 10px;
        font-size: 0.88rem;
    }

    .pill strong {
        font-size: 1rem;
    }

    .pill.total {
        display: none;
    }

    .scroll-top-btn {
        right: 14px;
        bottom: 14px;
        width: 44px;
        height: 44px;
    }
}

@media (prefers-reduced-motion: reduce) {

    .btn,
    .mark-btn,
    .qa-item,
    .q-btn::before,
    .answer-toggle,
    .scroll-top-btn {
        transition: none;
    }

    .mark-btn.active.correct,
    .mark-btn.active.incorrect {
        animation: none;
    }
}
