:root {
    --ink: #17233c;
    --text: #4b5870;
    --muted: #718096;
    --page: #f6f8fc;
    --surface: #ffffff;
    --border: #dce3ee;
    --primary: #2f6fed;
    --primary-dark: #2459be;
    --teal: #0f766e;
    --teal-soft: #e7f6f3;
    --violet: #6d3ccb;
    --violet-soft: #f1ecfb;
    --amber: #f6b73c;
    --amber-soft: #fff6db;
    --success: #18794e;
    --danger: #b42318;
    --radius-sm: 0.75rem;
    --radius-md: 1.25rem;
    --radius-lg: 2rem;
    --shadow-sm: 0 10px 28px rgba(23, 35, 60, 0.07);
    --shadow-lg: 0 28px 70px rgba(23, 35, 60, 0.14);
    --font-display: "Segoe UI Variable Display", "Aptos Display", "Segoe UI", sans-serif;
    --font-body: "Segoe UI Variable Text", "Aptos", "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    color: var(--text);
    background: var(--surface);
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.65;
    text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4,
h5,
h6,
.brand-name {
    color: var(--ink);
    font-family: var(--font-display);
    font-weight: 760;
    letter-spacing: -0.035em;
}

a {
    color: var(--primary-dark);
    text-decoration-thickness: 0.08em;
    text-underline-offset: 0.18em;
}

a:hover {
    color: var(--ink);
}

:focus-visible {
    outline: 3px solid var(--amber) !important;
    outline-offset: 3px;
    box-shadow: none !important;
}

.skip-link {
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 2000;
    padding: 0.75rem 1rem;
    color: #fff;
    background: var(--ink);
    border-radius: var(--radius-sm);
    transform: translateY(-160%);
    transition: transform 0.2s ease;
}

.skip-link:focus {
    color: #fff;
    transform: translateY(0);
}

.container-xl {
    --bs-gutter-x: 2.5rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.48rem;
    min-height: 44px;
    padding: 0.65rem 1.1rem;
    border-radius: var(--radius-sm);
    font-weight: 700;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

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

.btn-primary {
    --bs-btn-bg: var(--primary);
    --bs-btn-border-color: var(--primary);
    --bs-btn-hover-bg: var(--primary-dark);
    --bs-btn-hover-border-color: var(--primary-dark);
    --bs-btn-active-bg: var(--primary-dark);
    --bs-btn-active-border-color: var(--primary-dark);
    box-shadow: 0 10px 22px rgba(47, 111, 237, 0.2);
}

.btn-outline-dark {
    --bs-btn-color: var(--ink);
    --bs-btn-border-color: #aeb8c9;
    --bs-btn-hover-bg: var(--ink);
    --bs-btn-hover-border-color: var(--ink);
}

.section-space {
    padding: 7rem 0;
}

.section-space-sm {
    padding: 5rem 0 7rem;
}

.section-kicker {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 1rem;
    color: var(--primary-dark);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.13em;
    line-height: 1.2;
    text-transform: uppercase;
}

.kicker-dot {
    width: 0.55rem;
    height: 0.55rem;
    background: var(--amber);
    border-radius: 50%;
    box-shadow: 0 0 0 5px rgba(246, 183, 60, 0.18);
}

.section-heading {
    max-width: 48rem;
}

.section-heading h2,
.section-intro-row h2 {
    margin: 0;
    font-size: clamp(2rem, 4vw, 3.45rem);
    line-height: 1.08;
}

.section-support {
    max-width: 35rem;
    color: var(--muted);
    font-size: 1.08rem;
}

/* Header */

.site-header {
    z-index: 1030;
    border-bottom: 1px solid rgba(220, 227, 238, 0.88);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(16px);
}

.site-header .navbar {
    min-height: 82px;
    padding: 0.65rem 0;
}

.navbar-brand,
.footer-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    color: var(--ink);
    text-decoration: none;
}

.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 2.65rem;
    height: 2.65rem;
    color: #fff;
    background: var(--ink);
    border-radius: 0.8rem;
    font-family: ui-monospace, "Cascadia Code", monospace;
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.2em;
    box-shadow: inset -9px -9px 18px rgba(47, 111, 237, 0.35);
}

.brand-mark span:first-child {
    color: #78e0d4;
}

.brand-mark span:last-child {
    color: #f8ce72;
}

.brand-name {
    font-size: 1.08rem;
    letter-spacing: -0.025em;
}

.navbar-nav {
    gap: 0.15rem;
}

.navbar-nav .nav-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.42rem;
    padding: 0.75rem 0.85rem !important;
    color: #4b5567;
    font-size: 0.95rem;
    font-weight: 650;
}

.nav-symbol {
    display: inline-grid;
    place-items: center;
    width: 1.35rem;
    min-width: 1.35rem;
    color: var(--primary-dark);
    font-size: 1rem;
    line-height: 1;
}

.navbar-nav .nav-link:not(.dropdown-toggle)::after {
    display: none;
}

.navbar-nav .nav-link.active,
.navbar-nav .nav-link:hover {
    color: var(--ink);
}

.navbar-nav .nav-link.active::before {
    position: absolute;
    right: 0.85rem;
    bottom: 0.35rem;
    left: 0.85rem;
    height: 2px;
    background: var(--primary);
    border-radius: 1rem;
    content: "";
}

.dropdown-menu {
    padding: 0.55rem;
    border: 1px solid var(--border);
    border-radius: 0.9rem;
}

.dropdown-item {
    padding: 0.65rem 0.8rem;
    border-radius: 0.55rem;
    color: var(--text);
    font-weight: 600;
}

.dropdown-item:hover,
.dropdown-item:focus {
    color: var(--ink);
    background: var(--page);
}

.dropdown-item.active {
    color: var(--ink);
    background: var(--amber-soft);
}

.nav-icon-btn,
.language-button {
    color: var(--ink);
    background: var(--page);
    border: 1px solid var(--border);
}

.nav-icon-btn {
    width: 44px;
    padding: 0;
    font-size: 1.15rem;
    line-height: 1;
}

.nav-icon-btn > .bi {
    margin: 0;
}

.language-button {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 0.7rem;
    font-size: 0.82rem;
}

.language-strip {
    align-items: center;
    gap: 0.2rem;
    padding: 0.2rem;
    background: var(--page);
    border: 1px solid var(--border);
    border-radius: 999px;
}

.language-choice {
    position: relative;
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 2px solid transparent;
    border-radius: 50%;
    text-decoration: none;
    transition: border-color 0.18s ease, background-color 0.18s ease, transform 0.18s ease;
}

.language-choice:hover {
    background: #fff;
    border-color: #c9d4e6;
    transform: translateY(-1px);
}

.language-choice[aria-current="page"] {
    background: #fff;
    border-color: var(--amber);
    box-shadow: 0 0 0 2px rgba(246, 183, 60, 0.2);
}

.language-choice-check {
    position: absolute;
    right: -0.08rem;
    bottom: -0.08rem;
    display: grid;
    place-items: center;
    width: 1rem;
    height: 1rem;
    color: #fff;
    background: var(--success);
    border: 2px solid #fff;
    border-radius: 50%;
    font-size: 0.56rem;
    font-weight: 900;
    line-height: 1;
}

.language-flag {
    display: inline-block;
    flex: 0 0 auto;
    width: 1.75rem;
    aspect-ratio: 3 / 2;
    overflow: hidden;
    background-color: #fff;
    border: 1px solid rgba(23, 35, 60, 0.2);
    border-radius: 0.2rem;
    box-shadow: 0 1px 2px rgba(23, 35, 60, 0.12);
}

.flag-fr {
    background: linear-gradient(90deg, #0055a4 0 33.333%, #fff 33.333% 66.666%, #ef4135 66.666%);
}

.flag-es {
    background: linear-gradient(#aa151b 0 25%, #f1bf00 25% 75%, #aa151b 75%);
}

.flag-it {
    background: linear-gradient(90deg, #009246 0 33.333%, #fff 33.333% 66.666%, #ce2b37 66.666%);
}

.flag-en {
    background:
        linear-gradient(33deg, transparent 43%, #fff 43% 47%, #c8102e 47% 53%, #fff 53% 57%, transparent 57%),
        linear-gradient(-33deg, transparent 43%, #fff 43% 47%, #c8102e 47% 53%, #fff 53% 57%, transparent 57%),
        linear-gradient(90deg, transparent 39%, #fff 39% 61%, transparent 61%),
        linear-gradient(transparent 31%, #fff 31% 69%, transparent 69%),
        linear-gradient(90deg, transparent 46%, #c8102e 46% 54%, transparent 54%),
        linear-gradient(transparent 42%, #c8102e 42% 58%, transparent 58%),
        #012169;
}

.language-code {
    display: inline-grid;
    place-items: center;
    min-width: 1.8rem;
    min-height: 1.55rem;
    padding: 0 0.25rem;
    color: var(--ink);
    background: var(--amber-soft);
    border: 1px solid #f1d38b;
    border-radius: 0.4rem;
    font-size: 0.68rem;
    font-weight: 850;
    letter-spacing: 0.05em;
}

.language-menu .dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.mobile-language-link {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
}

.nav-cta {
    align-items: center;
    gap: 0.55rem;
    margin-left: 0.8rem;
}

.navbar-toggler {
    width: 44px;
    height: 44px;
    padding: 0.45rem;
    border-color: var(--border);
    border-radius: var(--radius-sm);
}

/* Hero */

.hero-section {
    position: relative;
    overflow: hidden;
    padding: 6rem 0 0;
    color: #dce6fa;
    background:
        radial-gradient(circle at 13% 20%, rgba(47, 111, 237, 0.28), transparent 30%),
        radial-gradient(circle at 83% 30%, rgba(15, 118, 110, 0.22), transparent 28%),
        var(--ink);
}

.hero-grid {
    position: absolute;
    inset: 0;
    opacity: 0.12;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.16) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.16) 1px, transparent 1px);
    background-size: 54px 54px;
    mask-image: linear-gradient(to bottom, #000 5%, transparent 90%);
}

.hero-copy {
    position: relative;
    z-index: 2;
    padding-bottom: 7rem;
}

.hero-section .section-kicker {
    color: #aebfe0;
}

.hero-section h1 {
    max-width: 12ch;
    margin: 0;
    color: #fff;
    font-size: clamp(3rem, 6.2vw, 5.65rem);
    line-height: 0.97;
    letter-spacing: -0.065em;
}

.hero-section h1 span {
    color: #79dfd4;
}

.hero-intro {
    max-width: 40rem;
    margin: 1.65rem 0 0;
    color: #bdc9de;
    font-size: clamp(1.08rem, 2vw, 1.3rem);
    line-height: 1.65;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
    margin-top: 2rem;
}

.hero-actions .btn {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    min-height: 54px;
    padding-inline: 1.35rem;
}

.hero-actions .btn-light {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.25);
}

.hero-actions .btn-light:hover {
    color: var(--ink);
    background: #fff;
}

.hero-note {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin: 1.3rem 0 0;
    color: #9cabc3;
    font-size: 0.88rem;
    font-weight: 650;
}

.hero-note .bi {
    display: inline-grid;
    place-items: center;
    color: #79dfd4;
    font-size: 1.15rem;
}

.lab-visual {
    position: relative;
    min-height: 490px;
}

.lab-orbit {
    position: absolute;
    top: 50%;
    left: 50%;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.orbit-one {
    width: 430px;
    height: 430px;
}

.orbit-two {
    width: 330px;
    height: 330px;
    border-style: dashed;
}

.quiz-preview-card {
    position: absolute;
    z-index: 3;
    top: 50%;
    left: 50%;
    width: min(390px, 90%);
    padding: 1.45rem;
    color: var(--text);
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.75);
    border-radius: 1.55rem;
    box-shadow: var(--shadow-lg);
    transform: translate(-50%, -50%) rotate(1.5deg);
}

.preview-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 750;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.preview-status {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.preview-status span {
    width: 0.48rem;
    height: 0.48rem;
    background: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(24, 121, 78, 0.12);
}

.preview-progress {
    height: 0.4rem;
    margin: 0.9rem 0 1.3rem;
    overflow: hidden;
    background: #e8edf5;
    border-radius: 2rem;
}

.preview-progress span {
    display: block;
    width: 40%;
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #5b8ef2);
    border-radius: inherit;
}

.preview-question {
    margin-bottom: 1rem;
    color: var(--ink);
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 750;
    line-height: 1.35;
}

.preview-option {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-top: 0.65rem;
    padding: 0.7rem 0.85rem;
    background: #f8f9fc;
    border: 1px solid var(--border);
    border-radius: 0.7rem;
    font-size: 0.9rem;
    font-weight: 650;
}

.preview-option.active {
    color: #0d5c42;
    background: #eaf8f1;
    border-color: #8ed0b5;
}

.preview-option.active .bi {
    color: var(--success);
    font-size: 1rem;
}

.preview-feedback {
    margin-top: 1rem;
    padding: 0.75rem;
    color: #5f4810;
    background: var(--amber-soft);
    border-radius: 0.7rem;
    font-size: 0.82rem;
    font-weight: 650;
}

.floating-symbol,
.visual-chip {
    position: absolute;
    z-index: 4;
    display: grid;
    place-items: center;
    box-shadow: 0 15px 35px rgba(5, 15, 36, 0.25);
}

.floating-symbol {
    width: 4.3rem;
    height: 4.3rem;
    color: var(--ink);
    background: #fff;
    border-radius: 1.25rem;
    font-family: ui-monospace, "Cascadia Code", monospace;
    font-size: 1.4rem;
    font-weight: 850;
}

.symbol-code {
    top: 1.1rem;
    left: 1.3rem;
    color: #0a655e;
    background: #c9f2ed;
    transform: rotate(-8deg);
}

.symbol-pi {
    top: 0.6rem;
    right: 2rem;
    color: #5229a0;
    background: #e4d9fa;
    font-size: 2.2rem;
    transform: rotate(9deg);
}

.symbol-sum {
    right: 0.3rem;
    bottom: 3.4rem;
    color: #6b4b00;
    background: #ffe69d;
    font-size: 2rem;
    transform: rotate(-5deg);
}

.visual-chip {
    grid-template-columns: auto auto;
    gap: 0.25rem;
    padding: 0.7rem 0.9rem;
    color: var(--ink);
    background: #fff;
    border-radius: 0.85rem;
    transform: rotate(-4deg);
}

.visual-chip strong {
    font-size: 1.15rem;
}

.visual-chip span {
    color: var(--muted);
    font-size: 0.72rem;
}

.chip-time {
    bottom: 1.8rem;
    left: 2.4rem;
}

.chip-score {
    top: 7.5rem;
    right: -0.2rem;
    color: var(--success);
    transform: rotate(5deg);
}

.hero-search-wrap {
    position: relative;
    z-index: 5;
    transform: translateY(50%);
}

.hero-search {
    display: flex;
    align-items: center;
    gap: 1rem;
    max-width: 64rem;
    min-height: 92px;
    margin: 0 auto;
    padding: 1rem 1.2rem;
    background: #fff;
    border: 1px solid rgba(220, 227, 238, 0.9);
    border-radius: 1.35rem;
    box-shadow: var(--shadow-lg);
}

.search-symbol {
    display: grid;
    flex: 0 0 3rem;
    place-items: center;
    width: 3rem;
    height: 3rem;
    color: var(--primary);
    background: #edf3ff;
    border-radius: 0.8rem;
    font-size: 1.65rem;
}

.search-field {
    flex: 1 1 auto;
    min-width: 0;
}

.search-field label {
    display: block;
    margin-bottom: 0.05rem;
    color: var(--ink);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.search-field input {
    width: 100%;
    padding: 0;
    color: var(--ink);
    background: transparent;
    border: 0;
    outline: 0;
    font-size: 1.05rem;
}

.search-field input::placeholder {
    color: #8994a7;
}

.search-shortcut {
    padding: 0.25rem 0.45rem;
    color: #6d7788;
    background: #f1f4f8;
    border: 1px solid var(--border);
    border-radius: 0.38rem;
    font-family: ui-monospace, monospace;
    font-size: 0.72rem;
}

/* Homepage quotations */

.quotes-section {
    position: relative;
    overflow: hidden;
    padding: 1.75rem 0 2rem;
    background:
        radial-gradient(circle at 10% 28%, rgba(47, 111, 237, 0.08), transparent 22rem),
        radial-gradient(circle at 92% 72%, rgba(109, 60, 203, 0.08), transparent 20rem),
        var(--page);
    border-bottom: 1px solid var(--border);
}

.quotes-shell {
    padding: clamp(1rem, 2.5vw, 1.5rem);
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(220, 227, 238, 0.95);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.quotes-topbar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem 2rem;
    margin-bottom: 1rem;
}

.quotes-heading {
    min-width: 0;
}

.quotes-title {
    margin: 0;
    color: var(--ink);
    font-family: var(--font-display);
    font-size: clamp(1.35rem, 2.5vw, 2rem);
    font-weight: 760;
    letter-spacing: -0.035em;
    line-height: 1.12;
}

.quotes-actions,
.quotes-autoplay-note,
.quotes-toolbar {
    display: flex;
    align-items: center;
}

.quotes-actions {
    flex: 0 0 auto;
    gap: 1rem;
}

.quotes-autoplay-note {
    gap: 0.4rem;
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 650;
}

.quotes-progress {
    position: relative;
    width: 100%;
    height: 0.4rem;
    margin: -0.15rem 0 0.85rem;
    overflow: hidden;
    background: #dce3ee;
    border-radius: 999px;
}

.quotes-progress-fill {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, var(--primary), var(--violet));
    border-radius: inherit;
    transform: scaleX(1);
    transform-origin: left center;
    will-change: transform;
}

.quotes-progress[data-paused="true"] .quotes-progress-fill {
    opacity: 0.65;
}

.quotes-carousel {
    min-width: 0;
}

.quotes-shell :focus-visible {
    outline-color: #805300 !important;
}

.quotes-carousel .carousel-inner {
    border-radius: var(--radius-md);
}

.quote-card {
    position: relative;
    display: flex;
    min-height: 11.5rem;
    margin: 0;
    padding: clamp(1.15rem, 2.6vw, 1.65rem);
    overflow: hidden;
    flex-direction: column;
    justify-content: space-between;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.quote-card::before {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 0.3rem;
    background: var(--violet);
    content: "";
}

.quote-card::after {
    position: absolute;
    right: 1.5rem;
    bottom: -3.7rem;
    color: rgba(109, 60, 203, 0.055);
    content: "π";
    font-family: Georgia, serif;
    font-size: 10rem;
    font-weight: 700;
    line-height: 1;
    pointer-events: none;
}

.quote-card.quote-code::before {
    background: var(--teal);
}

.quote-card.quote-code::after {
    right: 1rem;
    bottom: -1.7rem;
    color: rgba(15, 118, 110, 0.055);
    content: "{ }";
    font-family: ui-monospace, monospace;
    font-size: 5.5rem;
}

.quote-card-topline,
.quote-card blockquote,
.quote-card figcaption {
    position: relative;
    z-index: 1;
}

.quote-card-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.quote-subject {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-height: 2rem;
    padding: 0.25rem 0.65rem;
    color: #4e278f;
    background: var(--violet-soft);
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.quote-code .quote-subject {
    color: #0b5f59;
    background: var(--teal-soft);
}

.quote-position {
    color: var(--text);
    font-family: ui-monospace, monospace;
    font-size: 0.75rem;
    font-weight: 750;
}

.quote-card blockquote {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    gap: 0.65rem;
    max-width: 68rem;
    margin: 0.85rem 0;
}

.quote-mark {
    color: var(--violet);
    font-family: Georgia, serif;
    font-size: 3.4rem;
    font-weight: 700;
    line-height: 0.8;
}

.quote-code .quote-mark {
    color: var(--teal);
}

.quote-card blockquote p {
    margin: 0;
    color: var(--ink);
    font-family: var(--font-display);
    font-size: clamp(1.1rem, 2vw, 1.55rem);
    font-weight: 690;
    letter-spacing: -0.02em;
    line-height: 1.3;
}

.quote-card figcaption {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.1rem 0.75rem;
    padding-left: 0.85rem;
    border-left: 3px solid var(--violet);
}

.quote-code figcaption {
    border-left-color: var(--teal);
}

.quote-card figcaption strong {
    color: var(--ink);
    font-size: 0.9rem;
}

.quote-card figcaption cite {
    color: var(--text);
    font-size: 0.82rem;
    font-style: normal;
}

.quote-card figcaption a {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: inherit;
}

.quotes-toolbar {
    gap: 0.45rem;
}

.quotes-carousel .quote-control,
.quotes-topbar .quote-control {
    position: static;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 0.5rem;
    gap: 0.4rem;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid #cbd4e1;
    border-radius: var(--radius-sm);
    opacity: 1;
    font-size: 0.84rem;
    font-weight: 750;
    transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.quotes-topbar .quote-toggle {
    width: auto;
    padding-inline: 0.75rem;
}

.quotes-carousel .quote-control:hover,
.quotes-topbar .quote-control:hover {
    color: #fff;
    background: var(--ink);
    border-color: var(--ink);
}

/* Topic rooms */

.rooms-section {
    background: var(--page);
}

.rooms-section-after-hero {
    padding-top: 10rem;
}

.room-card {
    position: relative;
    overflow: hidden;
    padding: clamp(2rem, 5vw, 3.3rem);
    border: 1px solid transparent;
    border-radius: var(--radius-lg);
    transition: transform 0.24s ease, box-shadow 0.24s ease;
}

.room-card::after {
    position: absolute;
    right: -4rem;
    bottom: -5rem;
    width: 15rem;
    height: 15rem;
    border: 2.5rem solid rgba(255, 255, 255, 0.48);
    border-radius: 50%;
    content: "";
}

.room-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-sm);
}

.room-code {
    background: var(--teal-soft);
    border-color: #c7e9e4;
}

.room-math {
    background: var(--violet-soft);
    border-color: #ddd0f5;
}

.room-topline {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.room-number {
    color: rgba(23, 35, 60, 0.55);
    font-family: ui-monospace, monospace;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.12em;
}

.room-icon {
    display: grid;
    place-items: center;
    min-width: 4.1rem;
    height: 4.1rem;
    color: #fff;
    background: var(--teal);
    border-radius: 1.2rem;
    font-size: 1.55rem;
    transform: rotate(4deg);
}

.room-math .room-icon {
    background: var(--violet);
    transform: rotate(-4deg);
}

.room-card h3 {
    position: relative;
    z-index: 2;
    margin: 1.7rem 0 0.65rem;
    font-size: clamp(2.1rem, 4vw, 3.2rem);
}

.room-card > p {
    position: relative;
    z-index: 2;
    max-width: 30rem;
    margin-bottom: 1.4rem;
    color: #435166;
    font-size: 1.08rem;
}

.topic-pills {
    position: relative;
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0 0 2rem;
    padding: 0;
    list-style: none;
}

.topic-pills li {
    padding: 0.38rem 0.65rem;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(23, 35, 60, 0.12);
    border-radius: 2rem;
    font-size: 0.76rem;
    font-weight: 700;
}

.topic-pills a {
    color: inherit;
    text-decoration: none;
}

.topic-pills a:hover {
    color: var(--violet);
    text-decoration: underline;
    text-underline-offset: 0.18em;
}

.room-link {
    position: relative;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    color: var(--teal);
    font-weight: 800;
    text-decoration: none;
}

.room-math .room-link {
    color: var(--violet);
}

.room-link .bi {
    font-size: 1.2rem;
    transition: transform 0.2s ease;
}

.room-link:hover .bi {
    transform: translateX(2px);
}

/* Activities */

.featured-section {
    background: #fff;
}

.activity-card {
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 1.6rem;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.activity-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 18px 42px rgba(23, 35, 60, 0.12);
}

.activity-card-top,
.activity-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.activity-type {
    color: var(--primary-dark);
    font-size: 0.72rem;
    font-weight: 850;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.difficulty {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.52rem;
    border-radius: 1rem;
    font-size: 0.7rem;
    font-weight: 800;
}

.difficulty::before {
    width: 0.42rem;
    height: 0.42rem;
    border-radius: 50%;
    content: "";
}

.difficulty-easy {
    color: #12633e;
    background: #e6f6ed;
}

.difficulty-easy::before {
    background: #1a8c58;
}

.difficulty-medium {
    color: #73500a;
    background: var(--amber-soft);
}

.difficulty-medium::before {
    background: #c58305;
}

.difficulty-advanced {
    color: #8d2d27;
    background: #ffebe9;
}

.difficulty-advanced::before {
    background: #d04a41;
}

.activity-glyph {
    display: grid;
    place-items: center;
    width: 100%;
    height: 9.5rem;
    margin: 1.25rem 0 1.4rem;
    color: #0c6a63;
    background:
        linear-gradient(135deg, rgba(15, 118, 110, 0.12), rgba(47, 111, 237, 0.08)),
        repeating-linear-gradient(90deg, transparent 0 29px, rgba(15, 118, 110, 0.08) 30px),
        repeating-linear-gradient(0deg, transparent 0 29px, rgba(15, 118, 110, 0.08) 30px);
    border-radius: 1rem;
    font-family: ui-monospace, "Cascadia Code", monospace;
    font-size: 2rem;
    font-weight: 850;
}

.activity-game .activity-glyph {
    color: #5a2eac;
    background:
        radial-gradient(circle at 30% 40%, rgba(109, 60, 203, 0.16), transparent 38%),
        var(--violet-soft);
    font-size: 3.2rem;
}

.activity-card h3 {
    margin: 0 0 0.65rem;
    font-size: 1.38rem;
    line-height: 1.24;
}

.activity-card > p {
    flex: 1 1 auto;
    color: var(--muted);
    font-size: 0.94rem;
}

.activity-meta {
    justify-content: flex-start;
    margin-top: 0.35rem;
    color: #687386;
    font-size: 0.78rem;
    font-weight: 650;
}

.activity-meta span,
.article-meta span,
.catalog-item-meta span {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.activity-link,
.article-link {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    align-self: flex-start;
    margin-top: 1.25rem;
    color: var(--ink);
    font-weight: 800;
    text-decoration: none;
}

/* Daily challenge */

.daily-section {
    padding: 1rem 0 2rem;
}

.daily-card {
    position: relative;
    overflow: hidden;
    padding: clamp(2.2rem, 5vw, 4rem);
    color: #d8e2f3;
    background: linear-gradient(120deg, #13213b, #263e6d);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.daily-pattern {
    position: absolute;
    top: 50%;
    right: -3rem;
    width: 44%;
    color: rgba(255, 255, 255, 0.08);
    font-family: ui-monospace, monospace;
    font-size: clamp(3rem, 8vw, 7.5rem);
    font-weight: 900;
    line-height: 0.9;
    letter-spacing: -0.08em;
    transform: translateY(-50%) rotate(-8deg);
}

.daily-kicker {
    margin-bottom: 1rem;
    color: #f8ce72;
    font-size: 0.75rem;
    font-weight: 850;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.daily-kicker span {
    margin: 0 0.4rem;
    color: #8ea0bd;
}

.daily-card h2 {
    max-width: 19ch;
    margin: 0 0 0.75rem;
    color: #fff;
    font-size: clamp(2rem, 4.2vw, 3.4rem);
    line-height: 1.08;
}

.daily-card p:not(.daily-kicker) {
    max-width: 42rem;
    margin: 0;
    color: #bdc9dc;
}

/* Articles */

.articles-section {
    background: var(--page);
}

.article-card {
    position: relative;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: transform 0.22s ease;
}

.article-card:hover {
    transform: translateY(-3px);
}

.article-visual {
    display: grid;
    place-items: center;
    height: 12rem;
    overflow: hidden;
    color: var(--ink);
    font-family: ui-monospace, "Cascadia Code", monospace;
    font-size: clamp(1.7rem, 4vw, 2.7rem);
    font-weight: 850;
}

.article-visual span {
    padding: 0.5rem 0.8rem;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 0.65rem;
    box-shadow: 0 10px 24px rgba(23, 35, 60, 0.12);
    transform: rotate(-2deg);
}

.article-visual img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.visual-1 {
    background: linear-gradient(135deg, #bfece7, #dbeafa);
}

.visual-2 {
    background: linear-gradient(135deg, #eee2ff, #ffe5f4);
}

.visual-3 {
    background: linear-gradient(135deg, #ffebae, #ffefd8);
}

.article-body {
    padding: 1.45rem;
}

.article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem 1rem;
    margin-bottom: 0.8rem;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 700;
}

.article-meta span:first-child {
    color: var(--primary-dark);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.article-card h3 {
    margin-bottom: 0.75rem;
    font-size: 1.32rem;
    line-height: 1.3;
}

.article-card p {
    color: var(--muted);
    font-size: 0.92rem;
}

.trust-section {
    padding: 4rem 0 6.5rem;
    background: var(--page);
}

.trust-grid {
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.trust-item {
    display: flex;
    gap: 1rem;
    padding: 1.75rem;
    border-right: 1px solid var(--border);
}

.trust-item:last-child {
    border-right: 0;
}

.trust-icon {
    display: grid;
    flex: 0 0 2.5rem;
    place-items: center;
    width: 2.5rem;
    height: 2.5rem;
    color: var(--primary-dark);
    background: #edf3ff;
    border-radius: 0.7rem;
    font-family: ui-monospace, monospace;
    font-size: 0.72rem;
    font-weight: 850;
}

.trust-item h2 {
    margin: 0 0 0.25rem;
    font-size: 1.05rem;
}

.trust-item p {
    margin: 0;
    color: var(--muted);
    font-size: 0.84rem;
    line-height: 1.5;
}

/* Catalog pages */

.breadcrumb {
    margin-bottom: 2.3rem;
    font-size: 0.82rem;
}

.breadcrumb a {
    color: inherit;
    text-decoration: none;
}

.catalog-hero,
.detail-hero {
    position: relative;
    overflow: hidden;
    padding: 3.3rem 0 4.8rem;
    background: var(--page);
    border-bottom: 1px solid var(--border);
}

.catalog-hero::after,
.detail-hero::after {
    position: absolute;
    top: -12rem;
    right: -8rem;
    width: 31rem;
    height: 31rem;
    border: 6rem solid rgba(47, 111, 237, 0.055);
    border-radius: 50%;
    content: "";
}

.catalog-games::after {
    border-color: rgba(109, 60, 203, 0.07);
}

.catalog-articles::after {
    border-color: rgba(246, 183, 60, 0.1);
}

.catalog-approximations {
    background: linear-gradient(135deg, #eef9f7 0%, var(--page) 58%, #f3effc 100%);
}

.catalog-approximations::after {
    border-color: rgba(15, 118, 110, 0.1);
}

.catalog-hero .container-xl,
.detail-hero .container-xl {
    position: relative;
    z-index: 2;
}

.catalog-hero h1,
.detail-hero h1 {
    margin: 0;
    font-size: clamp(2.65rem, 6vw, 5rem);
    line-height: 1;
}

.catalog-hero .col-lg-8 > p:last-child,
.detail-lead {
    max-width: 46rem;
    margin: 1.25rem 0 0;
    color: var(--muted);
    font-size: 1.12rem;
}

.catalog-mark {
    display: inline-grid;
    place-items: center;
    min-width: 8rem;
    height: 7rem;
    padding: 0 1rem;
    color: var(--primary-dark);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 1.5rem;
    box-shadow: var(--shadow-sm);
    font-size: 2.25rem;
    transform: rotate(3deg);
}

.catalog-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.approximation-foundations {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 2.4rem;
}

.approximation-foundations > div {
    display: grid;
    gap: 0.4rem;
    min-width: 0;
    padding: 1.05rem 1.15rem;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 1rem;
    box-shadow: var(--shadow-sm);
}

.approximation-foundations code {
    color: var(--teal);
    font-family: ui-monospace, "Cascadia Code", "SFMono-Regular", Consolas, monospace;
    font-size: 1.35rem;
    font-weight: 850;
}

.approximation-foundations span,
.approximation-methods-intro {
    color: #526078;
    font-size: 0.88rem;
    line-height: 1.5;
}

.catalog-section-heading {
    max-width: 44rem;
}

.catalog-section-heading h2 {
    margin-bottom: 0.55rem;
}

.catalog-section-heading > p:last-child {
    margin: 0;
    color: var(--muted);
}

.approximation-application {
    border-color: #bedbd7;
}

.approximation-method-list {
    display: grid;
    gap: 0.35rem;
    margin: 1rem 0 1.35rem;
}

.approximation-method-list > div {
    display: grid;
    grid-template-columns: 3rem 1fr;
    gap: 0.75rem;
    align-items: center;
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--border);
}

.approximation-method-list code {
    color: var(--violet);
    font-size: 1rem;
    font-weight: 850;
}

.approximation-method-list span {
    color: var(--ink);
    font-size: 0.88rem;
    font-weight: 750;
}

.approximation-note {
    align-items: flex-start;
}

.approximation-note strong {
    display: block;
    margin-bottom: 0.2rem;
    color: var(--ink);
}

.approximation-note p {
    margin: 0;
}

.global-search-form {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.75rem;
    max-width: 56rem;
    margin-top: 2.25rem;
    padding: 0.75rem;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 1rem;
    box-shadow: var(--shadow-sm);
}

.global-search-form .form-control {
    border: 0;
}

.search-results-list {
    max-width: 58rem;
}

.filter-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.filter-pills button {
    min-height: 42px;
    padding: 0.5rem 0.85rem;
    color: var(--text);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 2rem;
    font-size: 0.82rem;
    font-weight: 700;
}

.filter-pills button.active,
.filter-pills button:hover {
    color: #fff;
    background: var(--ink);
    border-color: var(--ink);
}

.catalog-list {
    display: grid;
    gap: 1rem;
}

.search-summary {
    display: inline-flex;
    margin: 1.5rem 0 0;
    padding: 0.45rem 0.75rem;
    color: var(--primary-dark);
    background: #edf3ff;
    border-radius: 2rem;
    font-size: 0.8rem;
    font-weight: 750;
}

.catalog-empty {
    padding: 3.5rem 2rem;
    color: var(--muted);
    background: var(--page);
    border: 1px dashed #bdc7d6;
    border-radius: var(--radius-md);
    text-align: center;
}

.catalog-empty span {
    display: block;
    margin-bottom: 0.8rem;
    color: var(--primary-dark);
    font-family: ui-monospace, monospace;
    font-size: 2rem;
    font-weight: 850;
}

.catalog-empty p {
    max-width: 32rem;
    margin: 0 auto;
}

.catalog-item {
    display: grid;
    grid-template-columns: 3.2rem 1fr auto;
    gap: 1.2rem;
    align-items: start;
    padding: 1.45rem;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.catalog-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.catalog-item-index {
    display: grid;
    place-items: center;
    width: 3.2rem;
    height: 3.2rem;
    color: var(--primary-dark);
    background: #edf3ff;
    border-radius: 0.9rem;
    font-family: ui-monospace, monospace;
    font-size: 0.75rem;
    font-weight: 850;
}

.catalog-item-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 0.6rem;
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 700;
}

.catalog-item-cover {
    display: block;
    width: 100%;
    height: clamp(9rem, 22vw, 13rem);
    margin-bottom: 1rem;
    overflow: hidden;
    background: var(--page);
    border-radius: 0.9rem;
}

.catalog-item-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.25s ease;
}

.catalog-item:hover .catalog-item-cover img {
    transform: scale(1.025);
}

.topic-label {
    color: var(--primary-dark);
    font-weight: 850;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.catalog-item h2 {
    margin: 0 0 0.5rem;
    font-size: 1.35rem;
}

.catalog-item h2 a {
    color: var(--ink);
    text-decoration: none;
}

.catalog-item p {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.catalog-item-link {
    display: inline-flex;
    gap: 0.4rem;
    margin-top: 0.9rem;
    font-size: 0.85rem;
    font-weight: 800;
    text-decoration: none;
}

.catalog-item-symbol {
    color: #aab4c4;
    font-size: 1.25rem;
}

.catalog-sidebar,
.detail-aside {
    position: sticky;
    top: 110px;
    padding: 1.6rem;
    background: var(--page);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.catalog-sidebar > h2 {
    margin-bottom: 1rem;
    font-size: 1.15rem;
}

.sidebar-topics {
    display: grid;
    gap: 0.35rem;
}

.sidebar-topics a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 0;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    font-size: 0.88rem;
    font-weight: 700;
    text-decoration: none;
}

.sidebar-topics a:hover {
    color: var(--primary-dark);
}

.sidebar-topics a[aria-current="page"] {
    color: var(--violet);
    font-weight: 850;
}

.sidebar-note {
    display: flex;
    gap: 0.8rem;
    align-items: center;
    margin-top: 1.5rem;
    padding: 1rem;
    color: #315d58;
    background: var(--teal-soft);
    border-radius: 0.85rem;
}

.sidebar-note span {
    font-family: ui-monospace, monospace;
    font-weight: 850;
}

.sidebar-note p {
    margin: 0;
    font-size: 0.76rem;
    font-weight: 650;
    line-height: 1.45;
}

/* Detail and error */

.detail-demo-card {
    padding: clamp(1.5rem, 4vw, 2.7rem);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.detail-demo-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.detail-article-cover {
    margin: 0 0 1.5rem;
    overflow: hidden;
    background: var(--page);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.detail-article-cover img {
    display: block;
    width: 100%;
    max-height: 32rem;
    object-fit: cover;
}

.content-badge {
    padding: 0.32rem 0.58rem;
    color: #73500a;
    background: var(--amber-soft);
    border-radius: 1rem;
    font-size: 0.72rem;
    font-weight: 800;
}

.detail-slug {
    color: var(--muted);
    font-family: ui-monospace, monospace;
    font-size: 0.74rem;
}

.detail-demo-card h2 {
    font-size: clamp(1.8rem, 4vw, 2.7rem);
}

.detail-demo-card > p {
    max-width: 45rem;
    color: var(--muted);
    font-size: 1.02rem;
}

.detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    margin-bottom: 1.5rem;
}

.detail-meta span {
    padding: 0.35rem 0.65rem;
    color: var(--body);
    background: var(--page);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
}

.article-rich-content {
    max-width: 68ch;
    color: var(--body);
    font-size: 1.04rem;
    line-height: 1.75;
}

.article-rich-content > * + * {
    margin-top: 1.1em;
}

.detail-demo-card .article-rich-content h2 {
    margin-top: 2.2em;
    color: var(--ink);
    font-size: clamp(1.45rem, 3vw, 1.9rem);
    line-height: 1.2;
    scroll-margin-top: 7rem;
}

.detail-demo-card .article-rich-content h3 {
    margin-top: 1.8em;
    color: var(--ink);
    font-size: clamp(1.15rem, 2.5vw, 1.35rem);
    scroll-margin-top: 7rem;
}

.article-rich-content nav {
    padding: 1.2rem 1.35rem;
    background: var(--page);
    border: 1px solid var(--border);
    border-left: 5px solid var(--violet);
    border-radius: 0.9rem;
}

.article-rich-content nav ol {
    display: grid;
    gap: 0.35rem;
    margin: 0;
    padding-left: 1.35rem;
}

.article-rich-content nav a {
    color: var(--ink);
    font-weight: 700;
    text-underline-offset: 0.18em;
}

.article-rich-content blockquote {
    margin-left: 0;
    padding: 1rem 1.15rem;
    color: #3e315e;
    background: var(--violet-soft);
    border-left: 5px solid var(--violet);
    border-radius: 0 0.8rem 0.8rem 0;
}

.article-rich-content blockquote > :last-child {
    margin-bottom: 0;
}

.article-rich-content pre {
    padding: 1rem 1.15rem;
    color: var(--ink);
    background: #f7f4ff;
    border: 1px solid #d8ccec;
    border-radius: 0.85rem;
    font-size: 0.96rem;
    line-height: 1.6;
}

.article-rich-content :not(pre) > code {
    padding: 0.12rem 0.35rem;
    color: #52318d;
    background: #f3eefc;
    border-radius: 0.3rem;
}

.article-rich-content table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border: 1px solid var(--border);
}

.article-rich-content :is(th, td) {
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

.article-rich-content th {
    color: var(--ink);
    background: var(--page);
}

.article-rich-content img {
    max-width: 100%;
    height: auto;
}

.article-rich-content pre,
.article-rich-content table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
}

.article-rich-content #problems ~ ol {
    display: grid;
    gap: 1.4rem;
    padding-left: 1.7rem;
}

.article-rich-content #problems ~ ol > li {
    padding: 0.15rem 0 1.4rem 0.4rem;
    border-bottom: 1px solid var(--border);
}

.article-rich-content #problems ~ ol > li::marker {
    color: var(--violet);
    font-weight: 800;
}

.detail-demo-card .article-rich-content #problems ~ ol > li > h3 {
    margin-top: 0;
}

.article-rich-content #problems ~ ol details {
    margin-top: 0.9rem;
    overflow: hidden;
    background: #fbfaff;
    border: 1px solid #d8ccec;
    border-radius: 0.85rem;
}

.article-rich-content #problems ~ ol summary {
    padding: 0.8rem 1rem;
    color: var(--ink);
    background: #f3eefc;
    cursor: pointer;
    font-weight: 750;
}

.article-rich-content #problems ~ ol summary:hover {
    background: #ebe2f7;
}

.article-rich-content #problems ~ ol summary:focus-visible {
    outline: 3px solid #805300;
    outline-offset: -3px;
}

.article-rich-content #problems ~ ol details[open] summary {
    border-bottom: 1px solid #d8ccec;
}

.article-rich-content #problems ~ ol details > :not(summary) {
    margin-right: 1rem;
    margin-left: 1rem;
}

.article-rich-content #problems ~ ol details > summary + * {
    margin-top: 1rem;
}

.article-rich-content #problems ~ ol details h4 {
    margin-top: 1.25rem;
    color: var(--ink);
    font-size: 1.05rem;
}

.article-rich-content #problems ~ ol details > :last-child {
    margin-bottom: 1rem;
}

.demo-question {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--page);
    border-radius: 1.1rem;
}

.demo-progress {
    height: 0.45rem;
    overflow: hidden;
    background: #dfe5ef;
    border-radius: 1rem;
}

.demo-progress span {
    display: block;
    height: 100%;
    background: var(--primary);
}

.demo-question h3 {
    margin: 1rem 0;
    font-size: 1.15rem;
}

.demo-question label {
    display: block;
    margin-top: 0.65rem;
    padding: 0.75rem;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 0.7rem;
    font-weight: 650;
}

.demo-question label.selected {
    background: #eaf8f1;
    border-color: #8ed0b5;
}

.demo-question input {
    width: 1.1rem;
    height: 1.1rem;
    margin-right: 0.5rem;
    accent-color: var(--success);
}

.number-tiles {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
    align-items: center;
    margin-top: 2rem;
}

.number-tiles span {
    display: grid;
    place-items: center;
    width: 4rem;
    height: 4rem;
    color: #fff;
    background: var(--violet);
    border-radius: 0.9rem;
    font-size: 1.5rem;
    font-weight: 850;
}

.number-tiles strong {
    margin-left: 0.5rem;
    color: var(--ink);
    font-size: 1.4rem;
}

.article-skeleton {
    display: grid;
    gap: 0.75rem;
    margin-top: 2rem;
}

.article-skeleton span {
    display: block;
    width: 100%;
    height: 0.8rem;
    background: #e6eaf1;
    border-radius: 1rem;
}

.article-skeleton span:nth-child(2),
.article-skeleton span:nth-child(5) {
    width: 72%;
}

.aside-symbol {
    display: grid;
    place-items: center;
    width: 5rem;
    height: 5rem;
    margin-bottom: 1.2rem;
    color: var(--primary-dark);
    background: #fff;
    border-radius: 1rem;
    box-shadow: var(--shadow-sm);
    font-size: 1.55rem;
}

.detail-aside h2 {
    font-size: 1.4rem;
}

.detail-aside p {
    color: var(--muted);
    font-size: 0.9rem;
}

.error-page {
    display: grid;
    min-height: 70vh;
    place-items: center;
    padding: 6rem 0;
    background: var(--page);
}

.error-card {
    max-width: 38rem;
    padding: 3rem;
}

.error-code {
    color: var(--ink);
    font-family: ui-monospace, monospace;
    font-size: clamp(4rem, 12vw, 8rem);
    font-weight: 900;
    letter-spacing: -0.12em;
    line-height: 1;
}

.error-code span {
    color: var(--violet);
}

.error-card h1 {
    margin-top: 1rem;
    font-size: clamp(2rem, 5vw, 3.4rem);
}

.error-card p {
    margin: 1rem auto 1.6rem;
    color: var(--muted);
    font-size: 1.05rem;
}

/* Footer and modal */

.site-footer {
    color: #aebbd0;
    background: #111b2f;
}

.footer-main {
    padding: 5.5rem 0 4rem;
}

.footer-brand {
    color: #fff;
}

.footer-brand:hover {
    color: #fff;
}

.footer-brand .brand-mark {
    color: var(--ink);
    background: #fff;
    box-shadow: none;
}

.footer-brand .brand-name {
    color: #fff;
}

.footer-tagline {
    max-width: 26rem;
    margin: 1.2rem 0;
}

.footer-formula {
    display: inline-block;
    padding: 0.45rem 0.65rem;
    color: #79dfd4;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.55rem;
    font-family: ui-monospace, monospace;
    font-size: 0.78rem;
}

.footer-heading {
    margin-bottom: 1rem;
    color: #fff;
    font-family: var(--font-body);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.footer-links {
    display: grid;
    gap: 0.55rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.footer-links a,
.footer-links span,
.footer-link-button {
    color: #aebbd0;
    font-size: 0.9rem;
    text-decoration: none;
}

.footer-links a,
.footer-link-button {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.footer-links a:hover,
.footer-link-button:hover {
    color: #fff;
}

.footer-link-button {
    width: fit-content;
    min-height: 44px;
    margin: -0.55rem 0;
    padding: 0;
    text-align: left;
    background: transparent;
    border: 0;
}

.footer-languages {
    grid-template-columns: 1fr;
}

.footer-language-link {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
}

.footer-language-link[aria-current="page"] {
    color: #fff;
    font-weight: 700;
}

.footer-language-link .language-flag {
    width: 1.5rem;
    border-color: rgba(255, 255, 255, 0.35);
}

.footer-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.4rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.76rem;
}

.footer-bottom p {
    margin: 0;
}

.footer-bottom div {
    display: flex;
    gap: 1rem;
}

.footer-bottom a {
    color: inherit;
    text-decoration: none;
}

.search-modal {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}

.search-form {
    display: flex;
    gap: 0.65rem;
}

.form-control {
    border-color: var(--border);
    border-radius: var(--radius-sm);
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(47, 111, 237, 0.15);
}

@media (max-width: 1199.98px) {
    .nav-cta {
        display: none !important;
    }

    .navbar-nav .nav-link {
        padding-inline: 0.65rem !important;
    }
}

@media (max-width: 991.98px) {
    .site-header .navbar {
        min-height: 72px;
    }

    .navbar-collapse {
        max-height: calc(100vh - 85px);
        padding: 1rem 0 1.3rem;
        overflow-y: auto;
    }

    .navbar-nav {
        align-items: stretch !important;
    }

    .navbar-nav .nav-link {
        padding: 0.8rem 0 !important;
        border-bottom: 1px solid var(--border);
    }

    .navbar-nav .nav-link.active::before {
        display: none;
    }

    .dropdown-menu {
        margin: 0.2rem 0 0.6rem;
        border: 0;
        box-shadow: none !important;
    }

    .hero-section {
        padding-top: 4.5rem;
    }

    .hero-copy {
        padding-bottom: 1rem;
    }

    .hero-section h1 {
        max-width: 10ch;
    }

    .lab-visual {
        max-width: 560px;
        min-height: 450px;
        margin: 0 auto 3rem;
    }

    .hero-search-wrap {
        transform: translateY(38%);
    }

    .rooms-section-after-hero {
        padding-top: 8rem;
    }

    .quote-card {
        min-height: 13.5rem;
    }

    .catalog-mark {
        display: none;
    }

    .catalog-sidebar,
    .detail-aside {
        position: static;
    }
}

@media (max-width: 767.98px) {
    .container-xl {
        --bs-gutter-x: 1.5rem;
    }

    .section-space {
        padding: 5rem 0;
    }

    .section-space-sm {
        padding: 3.5rem 0 5rem;
    }

    .hero-section {
        padding-top: 3.6rem;
    }

    .hero-copy {
        padding-bottom: 0;
    }

    .hero-actions {
        display: grid;
    }

    .hero-actions .btn {
        justify-content: center;
        width: 100%;
    }

    .lab-visual {
        min-height: 410px;
    }

    .orbit-one {
        width: 350px;
        height: 350px;
    }

    .orbit-two {
        width: 270px;
        height: 270px;
    }

    .floating-symbol {
        width: 3.4rem;
        height: 3.4rem;
        border-radius: 1rem;
        font-size: 1rem;
    }

    .symbol-code {
        left: 0;
    }

    .symbol-pi {
        right: 0.4rem;
        font-size: 1.8rem;
    }

    .symbol-sum,
    .chip-score {
        display: none;
    }

    .chip-time {
        bottom: 0.5rem;
        left: 0.4rem;
    }

    .hero-search-wrap {
        transform: translateY(30%);
    }

    .hero-search {
        align-items: stretch;
        min-height: unset;
        padding: 0.85rem;
    }

    .search-symbol {
        display: none;
    }

    .search-field label {
        margin-top: 0.15rem;
    }

    .rooms-section-after-hero {
        padding-top: 7rem;
    }

    .quotes-section {
        padding: 1rem 0 1.25rem;
    }

    .quotes-shell {
        padding: 1rem;
        border-radius: var(--radius-md);
    }

    .quotes-topbar {
        align-items: flex-start;
        margin-bottom: 0.8rem;
        flex-wrap: wrap;
    }

    .quotes-actions {
        justify-content: flex-end;
        width: 100%;
    }

    .quote-card {
        min-height: 18rem;
        padding: 1rem;
        border-radius: var(--radius-md);
    }

    .quote-card blockquote p {
        font-size: clamp(1rem, 4.8vw, 1.25rem);
    }

    .quotes-carousel .carousel-inner {
        border-radius: var(--radius-md);
    }

    .daily-card {
        border-radius: var(--radius-md);
    }

    .trust-item {
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

    .trust-item:last-child {
        border-bottom: 0;
    }

    .catalog-hero,
    .detail-hero {
        padding: 2.5rem 0 3.5rem;
    }

    .catalog-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .approximation-foundations {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .catalog-item {
        grid-template-columns: 2.8rem 1fr;
        gap: 0.9rem;
        padding: 1.15rem;
    }

    .catalog-item-index {
        width: 2.8rem;
        height: 2.8rem;
    }

    .catalog-item-symbol {
        display: none;
    }

    .footer-bottom {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 575.98px) {
    .approximation-foundations {
        grid-template-columns: 1fr;
    }

    .quotes-section {
        padding: 0.65rem 0 0.85rem;
    }

    .quotes-shell {
        padding: 0.65rem;
    }

    .quotes-topbar {
        justify-content: flex-end;
        margin-bottom: 0.5rem;
    }

    .quotes-heading {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    .quotes-actions {
        width: auto;
    }

    .quote-card {
        min-height: 14rem;
        padding: 0.75rem;
    }

    .quote-card blockquote {
        gap: 0.4rem;
        margin: 0.5rem 0;
    }

    .quote-card blockquote p {
        font-size: clamp(0.95rem, 4.3vw, 1.05rem);
        line-height: 1.28;
    }
}

@media (max-width: 575.98px) {
    .site-header .brand-name {
        display: none;
    }

    .hero-section h1 {
        font-size: clamp(2.75rem, 15vw, 4.2rem);
    }

    .lab-visual {
        min-height: 380px;
    }

    .quiz-preview-card {
        width: 96%;
        padding: 1.1rem;
    }

    .hero-search {
        display: grid;
        grid-template-columns: 1fr auto;
    }

    .hero-search .btn {
        align-self: stretch;
    }

    .room-card {
        border-radius: var(--radius-md);
    }

    .room-icon {
        min-width: 3.5rem;
        height: 3.5rem;
    }

    .search-form {
        flex-direction: column;
    }

    .global-search-form {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .quotes-progress-fill {
        will-change: auto;
    }

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }

    .quotes-carousel .carousel-item {
        transition: none !important;
    }
}

/* Cookie consent is rendered only when an optional tracking category exists. */
.cookie-banner {
    position: fixed;
    z-index: 1040;
    right: 1rem;
    bottom: 1rem;
    left: 1rem;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1.25rem 2rem;
    width: min(1120px, calc(100% - 2rem));
    margin-inline: auto;
    padding: 1.4rem 1.5rem;
    color: var(--body);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: 0 22px 60px rgba(23, 35, 60, 0.2);
}

.cookie-banner[hidden] {
    display: none;
}

.cookie-banner-copy {
    max-width: 70ch;
}

.cookie-banner h2 {
    margin: 0.2rem 0 0.45rem;
    color: var(--ink);
    font-size: clamp(1.25rem, 2.5vw, 1.65rem);
}

.cookie-banner p {
    margin: 0.3rem 0 0;
}

.cookie-banner-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.65rem;
    font-weight: 750;
}

.cookie-banner-actions {
    display: flex;
    align-content: center;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.65rem;
    max-width: 25rem;
}

.cookie-banner-actions .btn,
.cookie-preferences-actions .btn {
    min-height: 44px;
}

.cookie-choice-button {
    color: #fff;
    background: var(--ink);
    border-color: var(--ink);
}

.cookie-choice-button:hover,
.cookie-choice-button:focus-visible {
    color: #fff;
    background: #243554;
    border-color: #243554;
}

.cookie-banner-close {
    position: absolute;
    top: 0.55rem;
    right: 0.65rem;
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    color: var(--ink);
    background: transparent;
    border: 0;
    border-radius: 50%;
    font-size: 1.65rem;
    line-height: 1;
}

.cookie-banner-close:hover {
    background: var(--page);
}

.cookie-preferences {
    border: 0;
    border-radius: var(--radius-md);
    box-shadow: 0 22px 70px rgba(23, 35, 60, 0.22);
}

.cookie-preferences .modal-header,
.cookie-preferences .modal-footer {
    padding: 1.25rem 1.4rem;
    border-color: var(--border);
}

.cookie-preferences .modal-body {
    padding: 1.4rem;
}

.cookie-category {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 1rem;
    margin-top: 0.85rem;
    padding: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.9rem;
}

.cookie-category h3 {
    margin: 0 0 0.25rem;
    color: var(--ink);
    font-size: 1rem;
}

.cookie-category p,
.cookie-preferences-note {
    margin: 0;
    color: var(--body);
    font-size: 0.92rem;
}

.cookie-category .form-check {
    min-width: 9rem;
}

.cookie-category .form-check-input {
    width: 2.7rem;
    height: 1.45rem;
}

.cookie-category.is-unavailable {
    background: #f2f4f8;
}

.cookie-preferences-note {
    margin-top: 1rem;
}

@media (max-width: 767.98px) {
    .cookie-banner {
        grid-template-columns: 1fr;
        max-height: calc(100vh - 2rem);
        overflow-y: auto;
        padding: 1.2rem;
    }

    .cookie-banner-copy {
        padding-right: 2.2rem;
    }

    .cookie-banner-actions,
    .cookie-preferences-actions {
        align-items: stretch;
        flex-direction: column;
        max-width: none;
    }

    .cookie-banner-actions .btn,
    .cookie-preferences-actions .btn {
        width: 100%;
    }

    .cookie-category {
        grid-template-columns: 1fr;
    }
}

@media print {
    .cookie-banner,
    #cookiePreferences {
        display: none !important;
    }

    .article-rich-content #problems ~ ol details > :not(summary) {
        display: block !important;
    }
}

/* Public quiz player */
.quiz-hero {
    background:
        radial-gradient(circle at 88% 16%, rgba(47, 111, 237, 0.22), transparent 22rem),
        linear-gradient(135deg, #f4f7ff, #eef9f7);
}

.quiz-hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.quiz-hero-meta span {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 44px;
    padding: 0.65rem 0.9rem;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(47, 111, 237, 0.18);
    border-radius: 999px;
    font-weight: 750;
}

.quiz-player,
.quiz-results {
    background: var(--page);
}

.quiz-instructions {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.25rem;
    padding: 1.15rem 1.25rem;
    color: #31405a;
    background: var(--amber-soft);
    border: 1px solid #ead48b;
    border-radius: var(--radius-md);
}

.quiz-instructions > .bi {
    color: #805300;
    font-size: 1.35rem;
}

.quiz-instructions h2 {
    margin: 0 0 0.25rem;
    font-size: 1.05rem;
}

.quiz-instructions p {
    margin: 0;
}

.quiz-form {
    display: grid;
    gap: 1.25rem;
}

.quiz-question-card {
    min-width: 0;
    padding: clamp(1.1rem, 3vw, 1.65rem);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.quiz-question-card legend {
    display: flex;
    align-items: flex-start;
    gap: 0.9rem;
    width: 100%;
    margin: 0 0 0.6rem;
    color: var(--ink);
    font-family: var(--font-display);
    font-size: clamp(1.05rem, 2vw, 1.25rem);
    font-weight: 760;
    letter-spacing: -0.02em;
    line-height: 1.4;
}

.quiz-question-number {
    display: inline-grid;
    flex: 0 0 2.5rem;
    width: 2.5rem;
    height: 2.5rem;
    place-items: center;
    color: #fff;
    background: var(--ink);
    border-radius: 0.75rem;
    font-size: 0.78rem;
    letter-spacing: 0.08em;
}

.quiz-choice-hint {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0 0 1rem 3.4rem;
    color: var(--muted);
    font-size: 0.9rem;
}

.quiz-options {
    display: grid;
    gap: 0.7rem;
}

.quiz-option {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr);
    align-items: center;
    gap: 0.75rem;
    min-height: 52px;
    padding: 0.75rem 0.9rem;
    color: #33415a;
    background: #fbfcff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: border-color 0.18s ease, background-color 0.18s ease, transform 0.18s ease;
}

.quiz-option:hover {
    background: #f2f6ff;
    border-color: #91ace3;
    transform: translateY(-1px);
}

.quiz-option:has(input:checked) {
    color: var(--ink);
    background: #eaf1ff;
    border-color: var(--primary);
    box-shadow: inset 3px 0 0 var(--primary);
}

.quiz-option input {
    width: 1.15rem;
    height: 1.15rem;
    margin: 0;
    accent-color: var(--primary);
}

.quiz-option-marker {
    display: inline-grid;
    width: 1.75rem;
    height: 1.75rem;
    place-items: center;
    color: var(--primary-dark);
    background: #eaf1ff;
    border-radius: 50%;
    font-size: 0.78rem;
    font-weight: 800;
}

.quiz-submit-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    padding: 1.4rem;
    color: #fff;
    background: var(--ink);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}

.quiz-submit-panel h2 {
    margin: 0 0 0.2rem;
    color: #fff;
    font-size: 1.2rem;
}

.quiz-submit-panel p {
    margin: 0;
    color: #dce6fb;
}

.quiz-aside {
    position: sticky;
    top: 6.5rem;
}

.quiz-score-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: clamp(1.4rem, 4vw, 3rem);
    margin-bottom: 3rem;
    padding: clamp(1.25rem, 4vw, 2.5rem);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.quiz-score-card.is-passed {
    border-top: 5px solid var(--success);
}

.quiz-score-card.is-not-passed {
    border-top: 5px solid var(--amber);
}

.quiz-score-ring {
    display: grid;
    width: clamp(9rem, 18vw, 12rem);
    aspect-ratio: 1;
    place-content: center;
    text-align: center;
    background: var(--teal-soft);
    border: 0.75rem solid rgba(15, 118, 110, 0.18);
    border-radius: 50%;
}

.is-not-passed .quiz-score-ring {
    background: var(--amber-soft);
    border-color: rgba(246, 183, 60, 0.26);
}

.quiz-score-ring strong {
    color: var(--ink);
    font-family: var(--font-display);
    font-size: clamp(1.7rem, 5vw, 2.75rem);
    line-height: 1;
}

.quiz-score-ring span {
    margin-top: 0.45rem;
    font-weight: 750;
}

.quiz-score-card .btn {
    margin: 0.35rem 0.35rem 0 0;
}

.quiz-review {
    max-width: 58rem;
    margin-inline: auto;
}

.quiz-review-heading {
    margin-bottom: 1.5rem;
}

.quiz-review-card {
    margin-bottom: 1rem;
    padding: clamp(1.1rem, 3vw, 1.5rem);
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 5px solid var(--danger);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.quiz-review-card.is-correct {
    border-left-color: var(--success);
}

.quiz-review-card header {
    display: flex;
    align-items: flex-start;
    gap: 0.9rem;
}

.quiz-review-card h3 {
    margin: 0;
    font-size: 1.15rem;
    line-height: 1.45;
}

.quiz-review-status {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0.4rem 0 0;
    color: var(--danger);
    font-weight: 750;
}

.is-correct .quiz-review-status {
    color: var(--success);
}

.quiz-unanswered {
    margin: 1rem 0 0;
    padding: 0.6rem 0.75rem;
    color: #694b0c;
    background: var(--amber-soft);
    border-radius: 0.65rem;
}

.quiz-result-options {
    display: grid;
    gap: 0.55rem;
    margin: 1rem 0 0;
    padding: 0;
    list-style: none;
}

.quiz-result-options li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.55rem;
    padding: 0.65rem 0.75rem;
    border: 1px solid transparent;
    border-radius: 0.7rem;
}

.quiz-result-options li.is-correct-answer {
    color: #105c3c;
    background: #e9f7f0;
    border-color: #a8d8c2;
}

.quiz-result-options li.is-selected-answer:not(.is-correct-answer) {
    color: #8a1c14;
    background: #fff0ee;
    border-color: #efb4ae;
}

.quiz-result-options small {
    padding: 0.12rem 0.45rem;
    background: rgba(255, 255, 255, 0.72);
    border-radius: 999px;
    font-weight: 750;
}

.quiz-explanation {
    margin-top: 1rem;
    padding: 0.9rem 1rem;
    background: #f0f4fb;
    border-radius: var(--radius-sm);
}

.quiz-explanation p {
    margin: 0.25rem 0 0;
}

.quiz-error-card {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    max-width: 54rem;
    margin-inline: auto;
    padding: clamp(1.25rem, 4vw, 2rem);
    background: var(--surface);
    border: 1px solid #ead48b;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}

.quiz-error-card > .bi {
    color: #805300;
    font-size: 2rem;
}

.quiz-error-card > div {
    flex: 1 1 22rem;
}

.quiz-error-card h2,
.quiz-error-card p {
    margin: 0;
}

@media (max-width: 767.98px) {
    .quiz-choice-hint {
        margin-left: 0;
    }

    .quiz-submit-panel,
    .quiz-score-card {
        grid-template-columns: 1fr;
    }

    .quiz-submit-panel {
        align-items: stretch;
        flex-direction: column;
    }

    .quiz-submit-panel .btn,
    .quiz-score-card .btn,
    .quiz-error-card .btn {
        width: 100%;
    }

    .quiz-score-ring {
        margin-inline: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .quiz-option {
        transition: none;
    }
}

/* Mathematics laboratory */

.math-lab-hero {
    overflow: hidden;
    background:
        radial-gradient(circle at 92% 12%, rgba(109, 60, 203, 0.18), transparent 28rem),
        linear-gradient(135deg, #f8f6ff 0%, #f4f8ff 58%, #eef9f7 100%);
}

.math-lab-hero::after {
    top: 0;
    right: 0;
    width: 55%;
    height: 100%;
    border: 0;
    border-radius: 0;
    background:
        linear-gradient(rgba(109, 60, 203, 0.07) 1px, transparent 1px),
        linear-gradient(90deg, rgba(109, 60, 203, 0.07) 1px, transparent 1px);
    background-size: 34px 34px;
    mask-image: linear-gradient(90deg, transparent, #000);
}

.math-lab-hero .detail-lead {
    max-width: 42rem;
}

.math-php-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-height: 36px;
    margin-top: 0.75rem;
    padding: 0.35rem 0.75rem;
    color: #4e2a99;
    background: #fff;
    border: 1px solid #cfc1ec;
    border-radius: 999px;
    font-size: 0.86rem;
    font-weight: 800;
    box-shadow: var(--shadow-sm);
}

.math-php-badge .bi {
    font-size: 1.15rem;
}

.math-formula-card {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 15rem;
    padding: 2rem;
    color: #fff;
    background: linear-gradient(145deg, #17233c, #3e2f78 72%, #5c35ab);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: var(--radius-lg);
    box-shadow: 0 28px 60px rgba(47, 36, 89, 0.28);
    isolation: isolate;
}

.math-formula-card::before,
.math-formula-card::after {
    position: absolute;
    z-index: -1;
    content: "";
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 50%;
}

.math-formula-card::before {
    top: 1.2rem;
    right: 1.2rem;
    width: 5rem;
    height: 5rem;
}

.math-formula-card::after {
    bottom: -2rem;
    left: -1.5rem;
    width: 8rem;
    height: 8rem;
}

.math-formula-card math {
    max-width: 100%;
    color: #fff;
    font-size: clamp(1.75rem, 4vw, 2.75rem);
}

.math-formula-card code {
    max-width: 100%;
    padding: 0.45rem 0.8rem;
    overflow-wrap: anywhere;
    color: #dffbf7;
    background: rgba(8, 14, 30, 0.48);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 0.65rem;
    font-size: clamp(0.86rem, 2.2vw, 1rem);
}

.math-lab-section {
    background: var(--page);
}

.math-lab-card {
    height: 100%;
    padding: clamp(1.25rem, 3vw, 2rem);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.math-form-card,
.math-result-card {
    border-top: 4px solid var(--violet);
}

.math-card-heading {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.6rem;
}

.math-card-heading.compact {
    margin-bottom: 1rem;
}

.math-card-heading h2,
.math-card-heading h3 {
    margin: 0;
    font-size: clamp(1.45rem, 3vw, 2rem);
}

.math-card-heading p:not(.section-kicker) {
    max-width: 44rem;
    margin: 0.3rem 0 0;
}

.math-step-number,
.math-section-icon {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    width: 2.8rem;
    height: 2.8rem;
    color: #fff;
    background: var(--violet);
    border-radius: 0.85rem;
    font-size: 0.86rem;
    font-weight: 850;
    box-shadow: 0 8px 18px rgba(109, 60, 203, 0.22);
}

.math-section-icon {
    color: #4e2a99;
    background: var(--violet-soft);
    font-size: 1.25rem;
    box-shadow: none;
}

.math-lab-card .form-label,
.math-fieldset legend {
    color: var(--ink);
    font-weight: 800;
}

.math-fieldset {
    min-width: 0;
    padding: 0;
    border: 0;
}

.math-fieldset legend {
    margin-bottom: 0.55rem;
    font-size: 1rem;
}

.math-lab-card .form-control {
    min-height: 48px;
    color: var(--ink);
    background: #fbfcff;
    border-color: #bac5d6;
    border-radius: 0.7rem;
}

.math-expression-input {
    font-family: ui-monospace, "Cascadia Code", "SFMono-Regular", Consolas, monospace;
    font-size: 1rem;
}

.math-lab-card .form-text {
    color: #59677d;
}

.math-lab-card :is(.form-control, .math-method-option, .btn, summary):focus-visible {
    outline-color: #805300 !important;
}

.math-method-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.math-method-option {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.15rem 0.7rem;
    min-width: 0;
    min-height: 7.2rem;
    padding: 1rem;
    cursor: pointer;
    background: #fbfcff;
    border: 1px solid #c8d1df;
    border-radius: 0.9rem;
    transition: border-color 0.18s ease, background-color 0.18s ease, transform 0.18s ease;
}

.math-method-option:hover {
    border-color: #8b70ca;
    transform: translateY(-1px);
}

.math-method-option.is-selected {
    background: var(--violet-soft);
    border-color: var(--violet);
    box-shadow: inset 0 0 0 1px var(--violet);
}

.math-method-option input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

.math-method-option:has(input:focus-visible) {
    outline: 3px solid #805300;
    outline-offset: 3px;
}

.math-method-option input:focus + .math-method-check {
    outline: 3px solid #805300;
    outline-offset: 3px;
}

.math-method-check {
    display: inline-grid;
    place-items: center;
    grid-row: 1 / span 2;
    width: 1.45rem;
    height: 1.45rem;
    margin-top: 0.05rem;
    color: transparent;
    background: #fff;
    border: 2px solid #9eabc0;
    border-radius: 50%;
}

.math-method-option.is-selected .math-method-check {
    color: #fff;
    background: var(--violet);
    border-color: var(--violet);
}

.math-method-option strong {
    color: var(--ink);
    line-height: 1.3;
}

.math-method-option small {
    color: #56647a;
    line-height: 1.45;
}

.math-form-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.math-error-summary {
    margin-bottom: 1.5rem;
    padding: 1rem 1.1rem;
    color: #792018;
    background: #fff2f0;
    border: 1px solid #e6a69f;
    border-left: 5px solid var(--danger);
    border-radius: 0.8rem;
}

.math-error-summary .bi {
    margin-top: 0.15rem;
    font-size: 1.25rem;
}

.math-error-summary h3 {
    margin: 0;
    font-size: 1.05rem;
}

.math-error-summary p {
    margin: 0.15rem 0 0.35rem;
}

.math-error-summary ul {
    margin: 0;
    padding-left: 1.2rem;
}

.math-error-summary a {
    color: #792018;
    font-weight: 750;
}

.math-result-card {
    position: sticky;
    top: 106px;
}

.math-result-empty {
    display: grid;
    place-items: center;
    min-height: 22rem;
    padding: 2rem;
    text-align: center;
    color: #59677d;
    background: linear-gradient(145deg, #fbfcff, var(--violet-soft));
    border: 1px dashed #b8a4df;
    border-radius: 1rem;
}

.math-result-empty .bi {
    display: grid;
    place-items: center;
    width: 4.6rem;
    height: 4.6rem;
    color: var(--violet);
    background: #fff;
    border-radius: 50%;
    font-size: 2rem;
    box-shadow: var(--shadow-sm);
}

.math-result-empty h3 {
    margin: 1rem 0 0;
    font-size: 1.25rem;
}

.math-result-empty p {
    max-width: 28rem;
    margin: 0.3rem 0 0;
}

.math-result-expression {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 0.25rem 0.65rem;
    margin-bottom: 1.2rem;
    padding: 0.9rem 1rem;
    background: #f7f4ff;
    border: 1px solid #ded4f2;
    border-radius: 0.85rem;
}

.math-result-expression > span {
    grid-row: 1 / span 2;
    color: var(--violet);
    font-family: Georgia, serif;
    font-size: 2rem;
}

.math-result-expression code,
.math-result-expression small {
    min-width: 0;
    overflow-wrap: anywhere;
}

.math-result-expression code {
    color: var(--ink);
}

.math-result-expression small {
    color: #59677d;
}

.math-result-label {
    margin: 0;
    color: #59677d;
    font-size: 0.78rem;
    font-weight: 850;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.math-result-value {
    display: block;
    max-width: 100%;
    margin: 0.2rem 0 1.4rem;
    overflow-wrap: anywhere;
    color: var(--ink);
    font-family: var(--font-display);
    font-size: clamp(2rem, 6vw, 3.7rem);
    font-weight: 800;
    letter-spacing: -0.045em;
    line-height: 1.05;
}

.math-result-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    overflow: hidden;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: 0.85rem;
}

.math-result-metrics > div {
    min-width: 0;
    padding: 0.8rem;
    background: #fff;
}

.math-result-metrics dt {
    color: #59677d;
    font-size: 0.76rem;
    font-weight: 750;
}

.math-result-metrics dd {
    margin: 0.15rem 0 0;
    overflow-wrap: anywhere;
    color: var(--ink);
    font-weight: 800;
}

.math-result-note {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    margin: 1rem 0 0;
    color: #59677d;
    font-size: 0.9rem;
}

.math-result-note .bi {
    margin-top: 0.15rem;
    color: var(--violet);
}

.math-method-guide {
    border-top: 4px solid var(--teal);
}

.math-method-guide > .math-card-heading {
    max-width: 58rem;
}

.math-guide-formula {
    max-width: 100%;
    padding: 0.85rem 1rem;
    overflow-x: auto;
    color: #17233c;
    background: #f7f4ff;
    border: 1px solid #d9cff0;
    border-radius: 0.8rem;
    scrollbar-color: #8b70ca #ece7f8;
    scrollbar-width: thin;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
}

.math-guide-formula:focus-visible {
    outline-color: #805300 !important;
    outline-offset: 3px;
}

.math-guide-formula math {
    display: block;
    width: max-content;
    min-width: 100%;
    margin-inline: auto;
    font-size: clamp(1.05rem, 2.2vw, 1.35rem);
    white-space: nowrap;
}

.math-guide-formula-stacked math + math {
    margin-top: 0.65rem;
    padding-top: 0.65rem;
    border-top: 1px solid #d9cff0;
}

.math-guide-notation {
    margin: 0.25rem 0 1rem;
    background: #f2fbf9;
    border-color: #b9ddd6;
}

.math-guide-pi-note,
.math-guide-caveat,
.math-guide-accuracy {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
}

.math-guide-pi-note {
    margin: 0 0 1.4rem;
    padding: 0.85rem 1rem;
    color: #244f4a;
    background: #edfaf7;
    border-left: 4px solid var(--teal);
    border-radius: 0.7rem;
}

.math-guide-pi-note .bi,
.math-guide-caveat .bi,
.math-guide-accuracy .bi {
    flex: 0 0 auto;
    margin-top: 0.16rem;
}

.math-method-guide-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.math-method-guide-card {
    min-width: 0;
    padding: clamp(1rem, 2.5vw, 1.35rem);
    background: #fbfcff;
    border: 1px solid #cfd7e4;
    border-radius: 0.95rem;
}

.math-method-guide-card h3 {
    margin: 0;
    color: var(--ink);
    font-size: 1.18rem;
}

.math-method-guide-card > p:not(.math-guide-accuracy) {
    margin: 0.4rem 0 0.9rem;
    color: #4f5e73;
}

.math-guide-accuracy {
    margin: 0.85rem 0 0;
    color: #4e2a99;
    font-size: 0.9rem;
    font-weight: 700;
}

.math-guide-history {
    margin-top: 1rem;
    padding: 0.9rem 1rem;
    color: #5d4510;
    background: var(--amber-soft);
    border-left: 4px solid var(--amber);
    border-radius: 0.75rem;
}

.math-guide-history strong {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--ink);
}

.math-guide-history p {
    margin: 0.4rem 0 0;
    font-size: 0.9rem;
}

.math-guide-caveat {
    margin: 1rem 0 0;
    padding: 0.9rem 1rem;
    color: #5d4510;
    background: var(--amber-soft);
    border-radius: 0.75rem;
}

.math-guide-caveat .bi {
    color: #805300;
}

.math-syntax-details {
    border-top: 1px solid var(--border);
}

.math-syntax-details summary {
    min-height: 44px;
    padding: 0.75rem 0;
    cursor: pointer;
    color: var(--ink);
    font-weight: 800;
}

.math-syntax-details ul {
    display: grid;
    gap: 0.4rem;
    padding-left: 1.25rem;
}

.math-syntax-details p {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.8rem;
    color: #5d4510;
    background: var(--amber-soft);
    border-radius: 0.7rem;
}

.math-examples-list {
    display: grid;
    gap: 0.75rem;
}

.math-examples-list article {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem 0;
    border-top: 1px solid var(--border);
}

.math-examples-list h3 {
    margin: 0;
    font-size: 1rem;
}

.math-examples-list p {
    margin: 0.2rem 0 0;
    color: #59677d;
    font-size: 0.88rem;
}

@media (max-width: 991.98px) {
    .math-result-card {
        position: static;
    }

    .math-result-empty {
        min-height: 15rem;
    }
}

@media (max-width: 767.98px) {
    .math-method-guide-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 575.98px) {
    .math-lab-hero .row {
        --bs-gutter-y: 2rem;
    }

    .math-formula-card {
        min-height: 11.5rem;
        padding: 1.25rem;
        border-radius: var(--radius-md);
    }

    .math-method-grid,
    .math-result-metrics {
        grid-template-columns: 1fr;
    }

    .math-method-option {
        min-height: 0;
    }

    .math-guide-formula {
        padding: 0.75rem;
    }

    .math-guide-formula math {
        font-size: 1rem;
    }

    .math-form-actions,
    .math-form-actions .btn {
        width: 100%;
    }

    .math-card-heading {
        gap: 0.75rem;
    }

    .math-examples-list article {
        grid-template-columns: 1fr;
    }

    .math-examples-list .btn {
        width: 100%;
    }
}

@supports not selector(:has(*)) {
    .math-method-option input:focus {
        outline: 3px solid #805300;
        outline-offset: 5px;
    }
}

@media print {
    .math-lab-hero,
    .math-lab-section {
        background: #fff !important;
    }

    .math-form-actions,
    .math-examples-list .btn {
        display: none !important;
    }

    .math-result-card {
        position: static;
    }
}
