:root {
    --bg: #06101f;
    --bg-soft: #0c1630;
    --card: rgba(14, 24, 48, 0.86);
    --card-strong: #121f3c;
    --line: rgba(134, 168, 255, 0.18);
    --text: #f7fbff;
    --muted: #99a8c6;
    --primary: #0067ff;
    --secondary: #56b1e8;
    --accent: #36d1ff;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
    --radius: 24px;
    --font-display: "Trebuchet MS", "Gill Sans", sans-serif;
    --font-body: "Segoe UI", "Tahoma", sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    line-height: 1.6;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

button,
input,
select,
textarea {
    font: inherit;
}

.site-bg {
    position: fixed;
    inset: 0;
    z-index: -2;
    background:
        radial-gradient(circle at top left, rgba(0, 103, 255, 0.22), transparent 34%),
        radial-gradient(circle at bottom right, rgba(54, 209, 255, 0.18), transparent 28%),
        linear-gradient(180deg, #07111f 0%, #081325 35%, #05101d 100%);
}

.site-bg::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 72px 72px;
    opacity: 0.22;
}

.container {
    width: min(1180px, calc(100% - clamp(1.25rem, 3vw, 3rem)));
    margin: 0 auto;
}

.section {
    padding: clamp(2rem, 4vw, 3rem) 0 clamp(3rem, 5vw, 4.5rem);
}

.alt-section {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent);
}

.narrow-section .container,
.auth-wrap {
    width: min(1080px, calc(100% - clamp(1.25rem, 3vw, 3rem)));
}

.site-main {
    overflow-x: clip;
}

.section > .container + .container {
    margin-top: 1.35rem;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(18px);
    background: rgba(6, 16, 31, 0.72);
    border-bottom: 1px solid rgba(122, 157, 240, 0.12);
}

.header-inner,
.header-actions,
.site-nav,
.hero-actions,
.hero-metrics,
.feature-top,
.category-actions,
.progress-meta,
.quiz-header,
.quiz-progress-meta,
.quiz-actions,
.quiz-action-right,
.lesson-actions,
.leader-row,
.leader-meta,
.leader-score,
.result-score-grid,
.result-badge,
.table-actions,
.admin-topbar,
.inline-form,
.tabs {
    display: flex;
    align-items: center;
}

.header-inner {
    justify-content: space-between;
    gap: 1rem;
    min-height: 84px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.85rem;
    min-width: 0;
}

.brand-logo {
    width: auto;
    height: 40px;
    max-width: 170px;
    object-fit: contain;
    flex-shrink: 0;
}

.brand-copy {
    display: grid;
    gap: 0.05rem;
    min-width: 0;
}

.footer-brand,
.admin-brand {
    margin-bottom: 0.75rem;
}

.footer-brand {
    align-items: center;
}

.admin-brand {
    align-items: flex-start;
}

.admin-brand-logo {
    height: 34px;
    max-width: 138px;
    margin-top: 0.1rem;
}

.brand-copy strong,
h1,
h2,
h3 {
    font-family: var(--font-display);
    letter-spacing: 0.01em;
}

.brand-copy small,
.eyebrow,
.chip,
.quiz-question-meta,
.result-badge,
.user-pill small,
.metric-card span {
    color: var(--muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-size: 0.74rem;
}

.site-nav {
    gap: 1.2rem;
}

.site-nav a,
.admin-nav a,
.tab {
    color: var(--muted);
    transition: color 0.2s ease, transform 0.2s ease;
}

.site-nav a:hover,
.site-nav a.active,
.admin-nav a:hover,
.admin-nav a.active,
.tab.active,
.tab:hover {
    color: var(--text);
}

.header-actions {
    gap: 0.75rem;
}

.user-pill {
    display: grid;
    gap: 0.1rem;
    padding: 0.65rem 1rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--line);
}

.button,
button.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: 0;
    border-radius: 999px;
    padding: 0.88rem 1.3rem;
    cursor: pointer;
    font-weight: 700;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.button:hover,
button.button:hover {
    transform: translateY(-1px);
}

.button.primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 16px 34px rgba(0, 103, 255, 0.28);
}

.button.secondary {
    background: rgba(86, 177, 232, 0.12);
    color: white;
    border: 1px solid rgba(86, 177, 232, 0.28);
}

.button.ghost {
    background: rgba(255, 255, 255, 0.04);
    color: white;
    border: 1px solid var(--line);
}

.button.muted {
    background: rgba(255, 255, 255, 0.04);
    color: var(--muted);
    border: 1px solid var(--line);
    cursor: default;
}

.button.danger {
    background: rgba(239, 68, 68, 0.12);
    color: #ffd8d8;
    border: 1px solid rgba(239, 68, 68, 0.24);
}

.button.small {
    padding: 0.55rem 0.9rem;
    font-size: 0.85rem;
}

.button.large {
    padding: 1rem 1.5rem;
}

.glass-panel,
.feature-card,
.mini-card,
.metric-card,
.quiz-card,
.review-card,
.level-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.hero {
    padding: 3.4rem 0 4rem;
}

.hero-grid,
.dual-grid,
.auth-wrap,
.lesson-shell,
.dashboard-grid,
.result-shell {
    display: grid;
    gap: 1.4rem;
}

.hero-grid {
    grid-template-columns: minmax(0, 1.2fr) minmax(320px, 420px);
    align-items: stretch;
}

.hero-copy {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    padding: clamp(1.2rem, 2.4vw, 1.9rem);
    border-radius: 30px;
    border: 1px solid rgba(86, 177, 232, 0.16);
    background:
        linear-gradient(180deg, rgba(12, 22, 48, 0.88), rgba(8, 19, 37, 0.92)),
        radial-gradient(circle at top left, rgba(0, 103, 255, 0.18), transparent 35%);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.24);
}

.hero-copy > * {
    position: relative;
    z-index: 1;
}

.hero-copy::before,
.hero-copy::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.hero-copy::before {
    inset: -12% auto auto -8%;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    background:
        radial-gradient(circle, rgba(54, 209, 255, 0.26) 0%, rgba(0, 103, 255, 0.12) 42%, transparent 70%);
    filter: blur(10px);
    animation: hero-orb-float 14s ease-in-out infinite;
}

.hero-copy::after {
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        radial-gradient(circle at 78% 18%, rgba(54, 209, 255, 0.18), transparent 14%),
        radial-gradient(circle at 82% 72%, rgba(0, 103, 255, 0.16), transparent 18%);
    background-size: 42px 42px, 42px 42px, auto, auto;
    background-position: 0 0, 0 0, 0 0, 0 0;
    opacity: 0.65;
    animation: hero-grid-pan 16s linear infinite;
}

.hero-copy .eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    width: fit-content;
    padding: 0.45rem 0.75rem;
    border-radius: 999px;
    border: 1px solid rgba(86, 177, 232, 0.18);
    background: rgba(255, 255, 255, 0.04);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.hero-copy h1,
.section-head h1,
.section-head h2 {
    margin: 0.3rem 0 0.8rem;
    font-size: clamp(2.2rem, 5vw, 4rem);
    line-height: 1.04;
}

.section-head h2 {
    font-size: clamp(1.8rem, 3vw, 2.7rem);
}

.section-head {
    display: grid;
    gap: 0.55rem;
    max-width: 760px;
    margin-bottom: 0;
}

.lead,
.hero-copy p,
.section-head p,
.feature-card p,
.mini-card p,
.glass-panel p {
    color: var(--muted);
}

.hero-actions,
.hero-metrics,
.category-actions,
.lesson-actions,
.tabs {
    gap: 0.9rem;
    flex-wrap: wrap;
}

.hero-metrics {
    margin-top: 1.5rem;
}

.metric-card {
    padding: 1rem 1.1rem;
    min-width: 140px;
}

.metric-card strong {
    display: block;
    font-size: 1.9rem;
    margin-bottom: 0.25rem;
}

.metric-card.large {
    padding: 1.3rem;
}

.hero-panel {
    padding: 1.25rem;
}

.hero-stack,
.review-stack,
.badge-grid {
    display: grid;
    gap: 1rem;
}

.panel-badge,
.chip,
.result-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    width: fit-content;
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.04);
}

.chip.subtle {
    background: transparent;
}

.hero-level-card,
.step-item,
.leader-row,
.progress-block,
.badge-card {
    padding: 1rem 1.1rem;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.hero-level-card,
.leader-row,
.step-item,
.badge-card,
.progress-meta,
.level-card-top,
.review-top {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.hero-level-card.alt {
    border-color: rgba(54, 209, 255, 0.18);
}

.hero-board h4,
.mini-card h3,
.feature-card h3,
.level-card h2,
.glass-panel h2,
.review-card h2 {
    margin: 0 0 0.4rem;
}

.mini-rank {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 0.8rem;
    padding: 0.8rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.card-grid {
    display: grid;
    gap: 1.2rem;
}

.card-grid,
.level-grid,
.dashboard-grid,
.hero-stack,
.review-stack,
.badge-grid {
    align-items: start;
}

.two-up {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.four-up {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.feature-card,
.mini-card,
.glass-panel {
    padding: clamp(1.1rem, 2vw, 1.5rem);
}

.icon-badge {
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--card-accent, var(--primary)), rgba(255, 255, 255, 0.18));
    font-size: 1.5rem;
}

.section-head.compact {
    margin-bottom: 1rem;
    max-width: none;
}

.dual-grid,
.auth-wrap {
    grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.9fr);
}

.auth-panel {
    padding: 1.8rem;
}

.auth-side {
    display: grid;
    gap: 1rem;
}

.form-grid,
.admin-form {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid label,
.admin-form label {
    display: grid;
    gap: 0.45rem;
}

.form-grid .full-span,
.admin-form .full-span,
.full-span {
    grid-column: 1 / -1;
}

input,
select,
textarea {
    width: 100%;
    padding: 0.95rem 1rem;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

textarea {
    resize: vertical;
}

.auth-links {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
    color: var(--muted);
}

.auth-links.stacked {
    flex-direction: column;
}

.flash-stack {
    margin-top: 1rem;
}

.flash {
    padding: 0.95rem 1rem;
    border-radius: 18px;
    margin-bottom: 0.8rem;
}

.flash-error {
    background: rgba(239, 68, 68, 0.14);
    border: 1px solid rgba(239, 68, 68, 0.24);
}

.flash-success {
    background: rgba(34, 197, 94, 0.14);
    border: 1px solid rgba(34, 197, 94, 0.24);
}

.level-grid,
.badge-grid {
    display: grid;
    gap: 1.1rem;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.level-card {
    padding: 1.25rem;
}

.level-card.locked {
    opacity: 0.68;
}

.level-meta,
.quiz-progress-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    color: var(--muted);
    font-size: 0.92rem;
}

.progress-bar {
    width: 100%;
    height: 10px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.06);
}

.progress-bar span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--primary), var(--accent));
}

.lesson-shell {
    grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.8fr);
}

.lesson-copy {
    display: grid;
    gap: 0.8rem;
}

.lesson-list {
    margin: 0;
    padding-left: 1.2rem;
    color: var(--muted);
}

.quiz-shell {
    padding: 1.6rem;
}

.quiz-header {
    justify-content: space-between;
    margin-bottom: 1rem;
}

.quiz-timer {
    display: grid;
    gap: 0.2rem;
    text-align: right;
}

.quiz-timer strong {
    font-size: 2rem;
}

.quiz-panels {
    position: relative;
    min-height: 360px;
    margin: 1.4rem 0;
}

.quiz-card {
    display: none;
    padding: 1.4rem;
}

.quiz-card.active {
    display: block;
}

.option-grid {
    display: grid;
    gap: 0.9rem;
    margin-top: 1.2rem;
}

.option-card {
    display: grid;
    grid-template-columns: auto auto 1fr;
    align-items: center;
    gap: 0.9rem;
    padding: 1rem;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.03);
    cursor: pointer;
}

.option-card:has(input:checked) {
    border-color: rgba(54, 209, 255, 0.6);
    background: rgba(0, 103, 255, 0.12);
}

.option-card input {
    width: 18px;
    height: 18px;
    margin: 0;
}

.option-label {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    font-weight: 700;
}

.quiz-actions {
    justify-content: space-between;
}

.result-shell {
    grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
}

.result-summary,
.review-card {
    padding: 1.4rem;
}

.review-card.correct {
    border-color: rgba(34, 197, 94, 0.24);
}

.review-card.incorrect {
    border-color: rgba(245, 158, 11, 0.22);
}

.review-options {
    display: grid;
    gap: 0.65rem;
    margin: 1rem 0;
}

.review-option {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.8rem;
    padding: 0.8rem 0.9rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.03);
}

.review-option.is-correct {
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.22);
}

.review-option.is-selected {
    border: 1px solid rgba(245, 158, 11, 0.22);
}

.dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 1.4rem;
}

.full-span {
    grid-column: 1 / -1;
}

.table-shell {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 0.95rem 0.85rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.table-actions {
    gap: 0.55rem;
    flex-wrap: wrap;
}

.tabs {
    gap: 0.7rem;
    margin-bottom: 1.2rem;
}

.tab {
    padding: 0.8rem 1rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--line);
}

.tab.active {
    background: rgba(0, 103, 255, 0.16);
    border-color: rgba(54, 209, 255, 0.34);
}

.site-footer {
    padding: 1rem 0 2.5rem;
}

.footer-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 1.3rem;
    border-radius: 24px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.03);
}

.footer-grid > div {
    display: grid;
    align-content: start;
    gap: 0.65rem;
}

.footer-grid h4,
.footer-grid p {
    margin: 0;
}

.footer-grid a {
    width: fit-content;
}

.footer-grid a,
.footer-bar,
.empty-state {
    color: var(--muted);
}

.footer-bar {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 0 0;
}

.admin-shell {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    min-height: 100vh;
    gap: 1rem;
    padding: 1rem;
}

.admin-sidebar {
    padding: 1.2rem;
    position: sticky;
    top: 1rem;
    align-self: start;
}

.admin-nav {
    display: grid;
    gap: 0.6rem;
    margin-top: 1.2rem;
}

.admin-nav a {
    padding: 0.9rem 1rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.03);
}

.admin-main {
    display: grid;
    align-content: start;
    gap: 1rem;
}

.admin-topbar {
    justify-content: space-between;
    padding: 1.2rem 1.4rem;
}

.admin-link-card {
    display: block;
}

.admin-auth-body .auth-wrap {
    min-height: calc(100vh - 8rem);
    align-items: center;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 0.25rem;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.04);
}

.nav-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    margin: 0 auto;
    background: white;
}

@keyframes hero-orb-float {
    0%,
    100% {
        transform: translate3d(0, 0, 0) scale(1);
    }
    50% {
        transform: translate3d(28px, 26px, 0) scale(1.08);
    }
}

@keyframes hero-grid-pan {
    0% {
        background-position: 0 0, 0 0, 0 0, 0 0;
    }
    100% {
        background-position: 42px 42px, -42px 42px, 0 0, 0 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hero-copy::before,
    .hero-copy::after {
        animation: none;
    }
}

@media (max-width: 1080px) {
    .hero-grid,
    .dual-grid,
    .lesson-shell,
    .result-shell,
    .auth-wrap,
    .dashboard-grid,
    .admin-shell {
        grid-template-columns: 1fr;
    }

    .four-up {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .admin-sidebar {
        position: static;
    }
}

@media (max-width: 820px) {
    .container,
    .narrow-section .container,
    .auth-wrap {
        width: min(100%, calc(100% - 1.35rem));
    }

    .site-nav {
        position: absolute;
        top: calc(100% - 0.35rem);
        left: 1rem;
        right: 1rem;
        display: none;
        flex-direction: column;
        align-items: stretch;
        padding: 1rem;
        border-radius: 20px;
        background: rgba(7, 17, 32, 0.96);
        border: 1px solid var(--line);
        box-shadow: 0 18px 40px rgba(0, 0, 0, 0.32);
    }

    .site-nav.open {
        display: flex;
    }

    .nav-toggle {
        display: flex;
    }

    .header-actions {
        display: flex;
    }

    .header-actions .user-pill {
        display: none;
    }

    .header-actions .button {
        padding: 0.75rem 1rem;
    }

    .two-up,
    .four-up,
    .form-grid,
    .admin-form,
    .footer-grid {
        grid-template-columns: 1fr;
    }

    .header-inner {
        min-height: auto;
        padding: 0.85rem 0;
        flex-wrap: wrap;
        row-gap: 0.85rem;
    }

    .brand {
        gap: 0.7rem;
        flex: 1 1 calc(100% - 56px);
    }

    .brand-logo {
        height: 32px;
        max-width: 132px;
    }

    .brand-copy strong {
        font-size: 1rem;
    }

    .brand-copy small {
        font-size: 0.62rem;
    }

    .nav-toggle {
        margin-left: auto;
    }

    .header-actions {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .header-actions .button {
        flex: 1 1 148px;
        min-width: 0;
    }

    .quiz-actions,
    .quiz-action-right,
    .footer-bar,
    .hero-metrics,
    .result-score-grid {
        flex-direction: column;
        align-items: stretch;
    }

    .quiz-action-right,
    .category-actions,
    .lesson-actions {
        width: 100%;
    }

    .quiz-action-right .button,
    .category-actions .button,
    .lesson-actions .button {
        width: 100%;
    }
}

@media (max-width: 560px) {
    .container,
    .narrow-section .container,
    .auth-wrap {
        width: min(100%, calc(100% - 1rem));
    }

    .section {
        padding: 1.7rem 0 2.7rem;
    }

    .hero {
        padding: 2rem 0 2.6rem;
    }

    .site-header .brand {
        gap: 0.6rem;
        align-items: center;
    }

    .site-header .brand-copy {
        display: grid;
        gap: 0.1rem;
        min-width: 0;
    }

    .site-header .brand-logo {
        height: 28px;
        max-width: 112px;
    }

    .site-header .brand-copy strong {
        font-size: 0.9rem;
        line-height: 1.05;
        white-space: normal;
    }

    .site-header .brand-copy small {
        display: block;
        font-size: 0.55rem;
        letter-spacing: 0.1em;
    }

    .site-bg::after {
        background-size: 56px 56px;
    }

    .hero-copy h1,
    .section-head h1,
    .section-head h2 {
        font-size: clamp(1.9rem, 10vw, 2.7rem);
        line-height: 1.08;
    }

    .feature-card,
    .mini-card,
    .glass-panel,
    .metric-card,
    .quiz-card,
    .review-card,
    .level-card,
    .quiz-shell,
    .result-summary,
    .auth-panel {
        padding: 1rem;
        border-radius: 20px;
    }

    .card-grid,
    .level-grid,
    .badge-grid,
    .hero-stack,
    .review-stack,
    .dashboard-grid {
        gap: 0.9rem;
    }

    .metric-card {
        min-width: 0;
    }

    .metric-card strong {
        font-size: 1.6rem;
    }

    .hero-copy {
        border-radius: 24px;
        padding: 1rem;
    }

    .quiz-shell {
        padding: 1rem;
    }

    .quiz-panels {
        min-height: 0;
        margin: 1rem 0;
    }

    .quiz-card {
        padding: 1rem;
    }

    .option-card {
        grid-template-columns: auto auto minmax(0, 1fr);
        gap: 0.7rem;
        padding: 0.85rem;
    }

    .leader-row,
    .step-item,
    .badge-card,
    .progress-meta,
    .level-card-top,
    .review-top {
        flex-direction: column;
        align-items: flex-start;
    }

    .quiz-timer strong {
        font-size: 1.6rem;
    }

    .footer-grid {
        padding: 1rem;
        gap: 1.15rem;
    }

    .footer-bar {
        padding-top: 0.85rem;
    }
}

@media (max-width: 480px) {
    .header-inner {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        grid-template-areas:
            "brand brand"
            "toggle actions";
        align-items: start;
        column-gap: 0.65rem;
        row-gap: 0.65rem;
    }

    .brand {
        grid-area: brand;
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        align-items: center;
        gap: 0.6rem;
        min-width: 0;
    }

    .brand-logo {
        height: 27px;
        max-width: 104px;
    }

    .brand-copy strong {
        font-size: 0.88rem;
        line-height: 1.06;
        white-space: normal;
    }

    .brand-copy small {
        display: block;
        font-size: 0.52rem;
    }

    .nav-toggle {
        grid-area: toggle;
        justify-self: start;
        width: 40px;
        height: 40px;
        margin: 0;
    }

    .header-actions {
        grid-area: actions;
        width: auto;
        justify-content: flex-end;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .header-actions .user-pill {
        display: none !important;
    }

    .header-actions .button {
        width: auto;
        flex: 0 0 auto;
        padding: 0.72rem 0.95rem;
        white-space: nowrap;
    }

    .site-nav {
        top: calc(100% + 0.25rem);
    }
}

@media (max-width: 420px) {
    .site-nav {
        left: 0.5rem;
        right: 0.5rem;
    }

    .brand-logo {
        height: 25px;
        max-width: 96px;
    }

    .brand-copy strong {
        font-size: 0.8rem;
        line-height: 1.04;
    }

    .brand-copy small {
        display: block;
        font-size: 0.48rem;
        letter-spacing: 0.09em;
    }

    .hero-actions .button,
    .quiz-actions > .button,
    .quiz-action-right .button {
        width: 100%;
    }

    .header-actions .button {
        width: auto;
    }

    .form-grid,
    .admin-form {
        grid-template-columns: 1fr;
    }

    .auth-links {
        flex-direction: column;
        gap: 0.45rem;
    }

    .quiz-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.85rem;
    }

    .quiz-timer {
        text-align: left;
    }
}
