:root {
    --bg-start: #07111b;
    --bg-mid: #0a1a29;
    --bg-end: #0d2032;
    --panel: rgba(10, 22, 34, 0.82);
    --panel-strong: rgba(14, 31, 47, 0.94);
    --panel-soft: rgba(16, 33, 49, 0.78);
    --panel-lift: rgba(19, 41, 61, 0.92);
    --page-text: #e6f1ff;
    --page-muted: #99aec4;
    --line: rgba(107, 205, 255, 0.18);
    --cyan: #61dafb;
    --cyan-strong: #2fd7ff;
    --amber: #ffb454;
    --rose: #ff7b72;
    --mint: #47d8b5;
    --diagram-ink: #143147;
    --diagram-muted: #577187;
    --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    color: var(--page-text);
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(47, 215, 255, 0.16), transparent 22%),
        radial-gradient(circle at right 12%, rgba(255, 180, 84, 0.14), transparent 18%),
        linear-gradient(180deg, var(--bg-start) 0%, var(--bg-mid) 38%, var(--bg-end) 100%);
    position: relative;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
    background-size: 34px 34px;
    mask-image: radial-gradient(circle at center, black 55%, transparent 100%);
    opacity: 0.55;
}

h1,
h2,
h3,
h4 {
    font-family: Georgia, "Times New Roman", serif;
    line-height: 1.08;
}

p,
li,
a,
text {
    line-height: 1.65;
}

a {
    color: inherit;
    text-decoration: none;
}

.page-shell {
    position: relative;
    z-index: 1;
    padding: 1.5rem 0 4rem;
}

.tech-navbar,
.hero-panel,
.module-map,
.module-card,
.feature-card,
.module-side,
.diagram-modal-content {
    background: var(--panel);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.tech-navbar {
    background: rgba(7, 17, 28, 0.8);
}

.brand-mark {
    width: 2.85rem;
    height: 2.85rem;
    border-radius: 0.95rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--cyan), var(--amber));
    color: #06121c;
    font-size: 1.25rem;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.brand-title {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.14em;
}

.brand-subtitle {
    color: var(--page-muted);
    font-size: 0.78rem;
}

.tech-navbar .nav-link {
    color: var(--page-muted);
    border-radius: 999px;
    padding: 0.55rem 0.9rem;
}

.tech-navbar .nav-link:hover,
.tech-navbar .nav-link.show {
    color: #ffffff;
    background: rgba(97, 218, 251, 0.12);
}

.tech-dropdown {
    background: rgba(10, 22, 34, 0.96);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.tech-dropdown .dropdown-item {
    color: var(--page-text);
}

.tech-dropdown .dropdown-item:hover {
    background: rgba(97, 218, 251, 0.12);
}

.hero-panel {
    overflow: hidden;
    position: relative;
}

.hero-panel::after {
    content: "";
    position: absolute;
    right: -8rem;
    bottom: -8rem;
    width: 24rem;
    height: 24rem;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(47, 215, 255, 0.22), transparent 65%);
}

.hero-panel .card-body {
    position: relative;
    z-index: 1;
}

.hero-badge {
    background: rgba(97, 218, 251, 0.12);
    color: #e5fbff;
    border: 1px solid rgba(97, 218, 251, 0.16);
    padding: 0.55rem 0.85rem;
}

.eyebrow {
    margin: 0;
    color: var(--cyan);
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 0.78rem;
    font-weight: 700;
}

.hero-panel h1 {
    max-width: 11ch;
}

.hero-lead,
.chapter-summary,
.section-copy,
.map-footnote,
.metric-helper,
.example-copy,
.accordion-body,
.discussion-note,
.module-side span {
    color: var(--page-muted);
}

.btn-info {
    --bs-btn-color: #06121c;
    --bs-btn-bg: var(--cyan);
    --bs-btn-border-color: var(--cyan);
    --bs-btn-hover-color: #06121c;
    --bs-btn-hover-bg: #82e4ff;
    --bs-btn-hover-border-color: #82e4ff;
    --bs-btn-active-color: #06121c;
    --bs-btn-active-bg: #4ecff0;
    --bs-btn-active-border-color: #4ecff0;
    font-weight: 600;
}

.btn-outline-light {
    --bs-btn-color: #ebf5ff;
    --bs-btn-border-color: rgba(255, 255, 255, 0.24);
    --bs-btn-hover-bg: rgba(255, 255, 255, 0.1);
    --bs-btn-hover-border-color: rgba(255, 255, 255, 0.3);
}

.metric-card {
    background: var(--panel-soft);
    border: 1px solid var(--line);
    border-radius: 1.15rem;
}

.metric-label {
    display: block;
    color: var(--page-muted);
    font-size: 0.74rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.metric-value {
    display: block;
    margin-top: 0.35rem;
    font-size: 2rem;
    font-weight: 700;
    color: #ffffff;
}

.module-map-shell {
    height: 100%;
}

.module-map .card-header,
.module-map .card-body {
    position: relative;
    z-index: 1;
}

.map-icon {
    width: 3rem;
    height: 3rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 1rem;
    background: rgba(97, 218, 251, 0.12);
    color: var(--cyan);
    font-size: 1.25rem;
}

.topic-map .list-group-item {
    background: transparent;
    color: var(--page-text);
    border: 1px solid var(--line);
    border-radius: 1rem;
    margin-top: 0.85rem;
    padding: 1rem;
    transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.topic-map .list-group-item:first-child {
    margin-top: 0;
}

.topic-map .list-group-item:hover {
    transform: translateY(-2px);
    background: rgba(97, 218, 251, 0.08);
    border-color: rgba(97, 218, 251, 0.25);
}

.topic-badge {
    background: rgba(255, 180, 84, 0.14);
    color: var(--amber);
    border: 1px solid rgba(255, 180, 84, 0.2);
}

.map-title {
    font-weight: 600;
}

.map-link-icon {
    color: var(--cyan);
    font-size: 1.1rem;
}

.section-title {
    font-size: clamp(2rem, 4vw, 3rem);
}

.section-pill {
    background: rgba(255, 255, 255, 0.08);
    color: #d8f6ff;
    border: 1px solid var(--line);
    padding: 0.75rem 1rem;
}

.module-card {
    overflow: hidden;
    margin-top: 1.5rem;
}

.module-header {
    background: linear-gradient(135deg, rgba(15, 34, 52, 0.95), rgba(10, 23, 35, 0.88));
    border-bottom: 1px solid var(--line);
}

.module-card:nth-of-type(4n + 1) .module-header {
    background: linear-gradient(135deg, rgba(16, 39, 61, 0.95), rgba(9, 25, 38, 0.88));
}

.module-card:nth-of-type(4n + 2) .module-header {
    background: linear-gradient(135deg, rgba(13, 46, 50, 0.95), rgba(9, 25, 34, 0.88));
}

.module-card:nth-of-type(4n + 3) .module-header {
    background: linear-gradient(135deg, rgba(31, 39, 69, 0.95), rgba(11, 24, 36, 0.88));
}

.module-card:nth-of-type(4n + 4) .module-header {
    background: linear-gradient(135deg, rgba(48, 34, 54, 0.95), rgba(12, 22, 34, 0.88));
}

.module-header h2 {
    font-size: clamp(2rem, 3.8vw, 3.1rem);
}

.topic-number-badge {
    background: rgba(97, 218, 251, 0.14);
    color: var(--cyan);
    border: 1px solid rgba(97, 218, 251, 0.2);
}

.module-count-badge {
    background: rgba(255, 255, 255, 0.08);
    color: #ebf5ff;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.module-side {
    background: rgba(7, 18, 29, 0.68);
    box-shadow: none;
}

.module-side-label {
    color: var(--page-muted);
    font-size: 0.75rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.module-side-row {
    padding: 0.6rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.module-side-row:first-of-type {
    padding-top: 0.2rem;
    border-top: 0;
}

.module-side strong {
    color: var(--cyan);
}

.feature-card {
    background: rgba(8, 20, 31, 0.78);
}

.feature-card .card-header {
    background: transparent;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 1rem 1.25rem;
    color: #ffffff;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.feature-card .card-header .bi {
    color: var(--cyan);
}

.tech-list .list-group-item,
.tech-numbered-list .list-group-item {
    background: transparent;
    color: var(--page-text);
    border-color: rgba(255, 255, 255, 0.08);
    padding: 1rem 1.25rem;
}

.hero-lead,
.section-copy,
.chapter-summary,
.example-copy {
    max-width: 68ch;
}

.content-kicker {
    color: #d8ecff;
    font-size: 0.95rem;
    letter-spacing: 0.03em;
}

.objective-icon,
.takeaway-icon {
    color: var(--cyan);
}

.discussion-list {
    display: grid;
    gap: 0.9rem;
}

.discussion-item {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.9rem;
    align-items: start;
    padding: 1rem 1.05rem;
    border-radius: 1rem;
    background: rgba(14, 31, 46, 0.74);
    border: 1px solid rgba(97, 218, 251, 0.12);
}

.discussion-step {
    min-width: 2.25rem;
    height: 2.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: rgba(97, 218, 251, 0.14);
    color: var(--cyan);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.discussion-note {
    color: #e8f2ff;
    line-height: 1.72;
}

.tech-accordion .accordion-item {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 1rem;
    overflow: hidden;
    margin-bottom: 0.85rem;
}

.tech-accordion .accordion-item:last-child {
    margin-bottom: 0;
}

.tech-accordion .accordion-button {
    background: rgba(16, 34, 52, 0.9);
    color: #ffffff;
    font-weight: 600;
    box-shadow: none;
}

.tech-accordion .accordion-button:not(.collapsed) {
    background: rgba(24, 50, 74, 0.95);
    color: #ffffff;
}

.tech-accordion .accordion-button::after {
    filter: brightness(0) invert(1);
    opacity: 0.9;
}

.tech-accordion .accordion-body {
    background: rgba(9, 20, 31, 0.72);
}

.feature-card-diagram .card-header {
    align-items: center;
}

.diagram-badge {
    background: rgba(255, 180, 84, 0.14);
    color: var(--amber);
    border: 1px solid rgba(255, 180, 84, 0.18);
}

.diagram-stage {
    min-height: 380px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0.35rem;
    cursor: zoom-in;
}

.diagram-svg {
    width: min(100%, 780px);
    height: auto;
    margin: 0 auto;
    display: block;
    border-radius: 24px;
    overflow: hidden;
    filter: drop-shadow(0 18px 28px rgba(0, 0, 0, 0.18));
}

.diagram-svg text {
    fill: var(--diagram-ink);
    font-size: 20px;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.diagram-svg .diagram-title {
    font-size: 28px;
    font-weight: 700;
}

.diagram-svg .diagram-year,
.diagram-svg .diagram-node-title {
    font-size: 22px;
    font-weight: 700;
}

.diagram-svg .diagram-caption {
    font-size: 17px;
    fill: var(--diagram-muted);
}

.diagram-svg .diagram-node-invert,
.diagram-svg .diagram-small-invert {
    fill: #ffffff;
    font-weight: 700;
}

.diagram-svg .diagram-center {
    font-size: 24px;
    font-weight: 700;
}

.diagram-svg .diagram-small-invert {
    font-size: 16px;
}

.diagram-modal-content {
    background: rgba(8, 18, 28, 0.96);
    border-radius: 1.75rem;
}

.diagram-modal-content .modal-title {
    color: #ffffff;
}

.diagram-modal-hint {
    color: var(--page-muted);
    font-size: 0.92rem;
}

.diagram-modal-content .btn-close {
    filter: invert(1) grayscale(1);
}

.diagram-modal-stage {
    min-height: 78vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    outline: none;
}

.diagram-modal-svg {
    width: min(100%, 1200px);
    max-height: 78vh;
}

.diagram-modal-inline-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 2.75rem;
    height: 2.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    background: rgba(12, 28, 41, 0.84);
    color: #ffffff;
    z-index: 2;
}

.diagram-modal-inline-close:hover {
    background: rgba(19, 42, 61, 0.96);
    border-color: rgba(97, 218, 251, 0.3);
}

.quiz-section {
    scroll-margin-top: 7rem;
}

.quiz-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.quiz-start-panel {
    padding: 1.5rem;
    border-radius: 1.5rem;
    background: rgba(8, 20, 31, 0.56);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.quiz-start-alert {
    padding: 0.95rem 1rem;
    border-radius: 1rem;
    background: rgba(255, 123, 114, 0.14);
    border: 1px solid rgba(255, 123, 114, 0.28);
    color: #ffd8d4;
}

.quiz-timer,
.quiz-scoreboard {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem;
    border-radius: 1.5rem;
    background: linear-gradient(135deg, rgba(18, 42, 60, 0.95), rgba(10, 27, 42, 0.9));
    border: 1px solid rgba(97, 218, 251, 0.18);
}

.quiz-timer {
    min-width: 16rem;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
}

.quiz-timer-label,
.quiz-field-label {
    color: var(--page-muted);
    font-size: 0.75rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.quiz-timer-value {
    color: #ffffff;
    font-size: 2.2rem;
    line-height: 1;
}

.quiz-timer-note,
.quiz-toolbar-copy,
.quiz-field-note,
.quiz-storage-note {
    color: var(--page-muted);
}

.quiz-toolbar-copy {
    flex: 1;
    padding: 1.25rem 1.35rem;
    border-radius: 1.35rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(8, 20, 31, 0.62);
}

.quiz-timer-warning {
    border-color: rgba(255, 180, 84, 0.38);
    box-shadow: 0 0 0 1px rgba(255, 180, 84, 0.14) inset;
}

.quiz-form-meta {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: 1rem;
}

.quiz-field {
    padding: 1.1rem 1.2rem;
    border-radius: 1.25rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(8, 20, 31, 0.62);
}

.quiz-field-muted {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.quiz-input {
    margin: 0.65rem 0 0.55rem;
    background: rgba(12, 28, 41, 0.92);
    border: 1px solid rgba(97, 218, 251, 0.18);
    color: #ffffff;
}

.quiz-input:focus {
    background: rgba(14, 31, 46, 0.96);
    color: #ffffff;
    border-color: rgba(97, 218, 251, 0.42);
    box-shadow: 0 0 0 0.2rem rgba(97, 218, 251, 0.14);
}

.quiz-input::placeholder {
    color: rgba(230, 241, 255, 0.42);
}

.quiz-identity-value {
    display: block;
    margin: 0.45rem 0 0.4rem;
    color: #ffffff;
    font-size: 1.1rem;
    font-weight: 700;
}

.quiz-start-note {
    color: var(--page-muted);
}

.quiz-score-pill {
    flex-shrink: 0;
    min-width: 5.5rem;
    min-height: 5.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--cyan), var(--amber));
    color: #06121c;
    font-size: 1.55rem;
    font-weight: 800;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}

.quiz-result-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.quiz-result-pass {
    background: rgba(71, 216, 181, 0.16);
    color: var(--mint);
}

.quiz-result-fail {
    background: rgba(255, 123, 114, 0.16);
    color: var(--rose);
}

.quiz-result-time {
    background: rgba(255, 180, 84, 0.16);
    color: var(--amber);
}

.quiz-storage-error {
    color: var(--rose);
}

.quiz-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
}

.quiz-card {
    margin: 0;
    padding: 1.5rem;
    border-radius: 1.4rem;
    background: rgba(8, 20, 31, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.quiz-card:hover {
    transform: translateY(-2px);
}

.quiz-card-pending {
    border-color: rgba(255, 255, 255, 0.08);
}

.quiz-card-correct {
    border-color: rgba(71, 216, 181, 0.55);
    box-shadow: 0 0 0 1px rgba(71, 216, 181, 0.12) inset;
}

.quiz-card-incorrect {
    border-color: rgba(255, 123, 114, 0.5);
    box-shadow: 0 0 0 1px rgba(255, 123, 114, 0.12) inset;
}

.quiz-card-unanswered {
    border-color: rgba(255, 180, 84, 0.45);
    box-shadow: 0 0 0 1px rgba(255, 180, 84, 0.12) inset;
}

.quiz-status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.quiz-status-badge.quiz-card-correct {
    background: rgba(71, 216, 181, 0.16);
    color: var(--mint);
}

.quiz-status-badge.quiz-card-incorrect {
    background: rgba(255, 123, 114, 0.16);
    color: var(--rose);
}

.quiz-status-badge.quiz-card-unanswered {
    background: rgba(255, 180, 84, 0.16);
    color: var(--amber);
}

.quiz-statement {
    margin-bottom: 1rem;
    color: #f4f8ff;
    font-size: 1.02rem;
}

.quiz-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
}

.quiz-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.95rem 1rem;
    border-radius: 1rem;
    border: 1px solid rgba(97, 218, 251, 0.14);
    background: rgba(15, 33, 48, 0.72);
    color: var(--page-text);
    cursor: pointer;
}

.quiz-option:hover {
    border-color: rgba(97, 218, 251, 0.28);
    background: rgba(19, 42, 61, 0.84);
}

.quiz-option input {
    accent-color: var(--cyan-strong);
    transform: scale(1.1);
}

.quiz-feedback {
    margin-top: 1rem;
    padding: 1rem 1.1rem;
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: var(--page-muted);
}

@media (min-width: 1200px) {
    .module-map-shell {
        position: sticky;
        top: 6rem;
    }
}

@media (max-width: 991px) {
    .page-shell {
        padding-top: 1rem;
    }

    .hero-panel h1 {
        max-width: none;
    }

    .quiz-grid {
        grid-template-columns: 1fr;
    }

    .quiz-form-meta {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 767px) {
    .brand-subtitle {
        display: none;
    }

    .hero-panel h1,
    .section-title,
    .module-header h2 {
        font-size: 2.25rem;
    }

    .diagram-stage {
        min-height: 280px;
    }

    .diagram-svg text {
        font-size: 18px;
    }

    .quiz-toolbar,
    .quiz-scoreboard {
        flex-direction: column;
        align-items: flex-start;
    }

    .quiz-options {
        grid-template-columns: 1fr;
    }

    .quiz-timer,
    .quiz-toolbar-copy,
    .quiz-field {
        width: 100%;
    }

    .quiz-score-pill {
        min-width: 4.75rem;
        min-height: 4.75rem;
        font-size: 1.35rem;
    }

    .discussion-item {
        grid-template-columns: 1fr;
    }

    .diagram-modal-inline-close {
        top: 0.75rem;
        right: 0.75rem;
    }
}