
/* General Settings */
:root {
    --page-bg: #f7f2e8;
    --surface: #fffdf8;
    --text: #292722;
    --muted: #6f6b63;
    --heading: #24231f;
    --nav-bg: #24231f;
    --nav-text: #fffaf1;
    --border: #d9d0c3;
    --soft-border: #e9e1d5;
    --shadow: 0 14px 36px rgba(56, 42, 25, 0.075);
    --accent: #e45d42;
    --accent-hover: #c94830;
    --accent-wash: #fff0e8;
    --amber: #f0b744;
    --content-width: 1150px;
    --card-padding: 25px;
    --notice-bg: #fff3d4;
    --notice-text: #684715;
    --notice-border: #f4d893;
}

body[data-theme="dark"] {
    --page-bg: #1f201f;
    --surface: #292a28;
    --text: #f0ede5;
    --muted: #c2bdb2;
    --heading: #fffaf1;
    --nav-bg: #171817;
    --nav-text: #fffaf1;
    --border: #4a4944;
    --soft-border: #3d3d39;
    --shadow: 0 14px 36px rgba(0, 0, 0, 0.22);
    --accent-wash: #492c25;
    --notice-bg: #3d3423;
    --notice-text: #ffe5ad;
    --notice-border: #66552f;
}

body[data-accent="coral"] {
    --accent: #e45d42;
    --accent-hover: #c94830;
}

body[data-accent="amber"] {
    --accent: #a85e00;
    --accent-hover: #854900;
}

body[data-accent="blue"] {
    --accent: #2867a7;
    --accent-hover: #1d4f84;
}

body[data-accent="violet"] {
    --accent: #7654c8;
    --accent-hover: #5b3fa5;
}

body[data-accent="green"] {
    --accent: #28735a;
    --accent-hover: #1d5945;
}

body[data-accent="rose"] {
    --accent: #c94b68;
    --accent-hover: #a93853;
}

body[data-layout="compact"] {
    --content-width: 980px;
    --card-padding: 18px;
}

body[data-layout="wide"] {
    --content-width: 1440px;
    --card-padding: 30px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

body {
    font-family: Arial, sans-serif;
    background-color: var(--page-bg);
    color: var(--text);
    line-height: 1.6;
    transition: background-color 180ms ease, color 180ms ease;
}

/* Navigation */
.navbar {
    background-color: var(--nav-bg);
    color: var(--nav-text);
    padding: 20px 6%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.navbar h2 {
    font-size: 24px;
}

.navbar ul {
    display: flex;
    list-style: none;
    gap: 25px;
}

.navbar a {
    color: var(--nav-text);
    text-decoration: none;
}

.navbar a:hover {
    color: #8fc4ff;
}

/* Main Layout */
main {
    max-width: var(--content-width);
    margin: 40px auto;
    padding: 0 25px;
    transition: max-width 180ms ease;
}

/* Welcome Page */
.welcome-screen {
    position: relative;
    isolation: isolate;
    display: flex;
    width: 100%;
    max-width: none;
    min-height: 100vh;
    flex-direction: column;
    margin: 0;
    padding: 0 clamp(20px, 5.2vw, 78px);
    overflow: hidden;
    font-family: Inter, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    color: #152b4c;
    background:
        radial-gradient(ellipse at 79% 31%, rgba(201, 225, 255, 0.58), transparent 31%),
        radial-gradient(ellipse at 8% 93%, rgba(219, 237, 255, 0.76), transparent 34%),
        linear-gradient(135deg, #f8fbff 0%, #eff6ff 49%, #ffffff 100%);
    animation: welcome-page-enter 620ms ease-out both;
}

.welcome-atmosphere {
    position: absolute;
    z-index: -1;
    inset: 0;
    pointer-events: none;
    background-image:
        radial-gradient(circle, rgba(47, 105, 179, 0.12) 1px, transparent 1.2px),
        radial-gradient(circle at 73% 52%, rgba(255, 255, 255, 0.88), transparent 25%);
    background-position: 0 0, center;
    background-size: 28px 28px, auto;
    mask-image: linear-gradient(90deg, transparent, #000 45%, #000 100%);
    opacity: 0.43;
}

.welcome-header {
    z-index: 1;
    display: flex;
    width: min(100%, 1280px);
    min-height: 82px;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin: 0 auto;
    border-bottom: 1px solid rgba(32, 71, 122, 0.09);
}

.welcome-brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    color: #102b52;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.04em;
    text-decoration: none;
}

.welcome-brand-icon {
    display: block;
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    border-radius: 12px;
    object-fit: cover;
}

.welcome-brand-light {
    color: #3982dc;
}

.welcome-header-note {
    display: flex;
    align-items: center;
    gap: 9px;
    color: #60738e;
    font-size: 13px;
    font-weight: 600;
}

.welcome-header-note span,
.welcome-eyebrow span {
    display: inline-block;
    width: 7px;
    height: 7px;
    flex: 0 0 auto;
    background: #438ce8;
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(67, 140, 232, 0.12);
}

.welcome-hero {
    display: grid;
    width: min(100%, 1280px);
    min-height: 490px;
    grid-template-columns: minmax(0, 1fr) minmax(390px, 0.94fr);
    align-items: center;
    gap: clamp(28px, 5vw, 74px);
    margin: 0 auto;
    padding: 38px 0 42px;
}

.welcome-copy {
    position: relative;
    z-index: 2;
    max-width: 620px;
}

.welcome-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 24px;
    padding: 9px 13px;
    color: #275b9c;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(66, 126, 194, 0.16);
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.14em;
}

.welcome-eyebrow span {
    width: 6px;
    height: 6px;
}

.welcome-copy h1 {
    max-width: 680px;
    margin-bottom: 21px;
    color: #10284d;
    font-size: clamp(42px, 5.2vw, 70px);
    font-weight: 800;
    letter-spacing: -0.062em;
    line-height: 1.04;
}

.welcome-copy h1 span {
    display: block;
    color: #3478d3;
    background: linear-gradient(95deg, #286cc7 0%, #4c9cf2 73%, #67b4f4 100%);
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.welcome-description {
    max-width: 540px;
    color: #5d708a;
    font-size: clamp(16px, 1.55vw, 18px);
    line-height: 1.75;
}

.welcome-cta {
    display: inline-flex;
    min-height: 58px;
    align-items: center;
    justify-content: center;
    gap: 24px;
    margin-top: 29px;
    padding: 0 24px 0 29px;
    color: #ffffff;
    background: linear-gradient(110deg, #2675d8 0%, #328be8 54%, #4aa5f1 100%);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 14px;
    box-shadow: 0 13px 25px rgba(38, 117, 216, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.24);
    cursor: pointer;
    font-size: 15px;
    font-weight: 700;
    transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}

.welcome-cta:hover {
    transform: translateY(-3px);
    filter: saturate(1.08);
    box-shadow: 0 17px 30px rgba(38, 117, 216, 0.31), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.welcome-cta:active {
    transform: translateY(0) scale(0.98);
}

.welcome-cta svg {
    width: 20px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
    transition: transform 180ms ease;
}

.welcome-cta:hover svg {
    transform: translateX(3px);
}

.welcome-assurance {
    display: flex;
    max-width: 420px;
    align-items: center;
    gap: 10px;
    margin-top: 22px;
    color: #7788a0;
    font-size: 12px;
}

.assurance-check {
    display: grid;
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
    place-items: center;
    color: #2874c9;
    background: #e4f1ff;
    border-radius: 50%;
}

.assurance-check svg {
    width: 13px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.welcome-art {
    position: relative;
    width: 100%;
    max-width: 570px;
    justify-self: end;
    aspect-ratio: 1.2;
}

.welcome-art-halo {
    position: absolute;
    inset: 8% 6%;
    background: radial-gradient(ellipse, rgba(131, 185, 248, 0.24), rgba(207, 230, 255, 0.1) 48%, transparent 72%);
    border-radius: 50%;
    filter: blur(7px);
}

.welcome-artwork {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    overflow: visible;
    animation: welcome-art-drift 7s ease-in-out infinite;
}

.welcome-float-card {
    position: absolute;
    z-index: 2;
    display: flex;
    min-width: 166px;
    align-items: center;
    gap: 11px;
    padding: 11px 14px;
    background: rgba(255, 255, 255, 0.79);
    border: 1px solid rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    box-shadow: 0 15px 34px rgba(34, 73, 124, 0.13);
    backdrop-filter: blur(14px);
    animation: welcome-card-drift 5.5s ease-in-out infinite;
}

.welcome-float-card strong,
.welcome-float-card small {
    display: block;
    white-space: nowrap;
}

.welcome-float-card strong {
    color: #18365f;
    font-size: 12px;
    line-height: 1.4;
}

.welcome-float-card small {
    margin-top: 2px;
    color: #71839b;
    font-size: 10px;
}

.float-icon,
.feature-icon {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    color: #2f78d1;
    background: #eaf3ff;
    border-radius: 11px;
}

.float-icon {
    width: 35px;
    height: 35px;
}

.float-icon svg {
    width: 20px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.55;
}

.float-icon-mint,
.feature-icon-mint {
    color: #28856c;
    background: #e9f7f2;
}

.float-icon-lilac,
.feature-icon-lilac {
    color: #6b66c8;
    background: #f0efff;
}

.float-quizzes {
    top: 16%;
    left: -3%;
}

.float-tasks {
    right: -3%;
    bottom: 23%;
    animation-delay: -1.5s;
}

.float-resources {
    bottom: 5%;
    left: 7%;
    animation-delay: -3s;
}

.welcome-features {
    width: min(100%, 1280px);
    margin: 0 auto;
    padding: 16px 0 26px;
}

.welcome-feature-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 19px;
}

.feature-eyebrow {
    margin-bottom: 5px;
    color: #3979bb;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.14em;
}

.welcome-feature-heading h2 {
    color: #17345c;
    font-size: clamp(21px, 2.4vw, 28px);
    letter-spacing: -0.035em;
    line-height: 1.25;
}

.welcome-feature-heading > p {
    max-width: 360px;
    color: #71839b;
    font-size: 13px;
    line-height: 1.65;
}

.welcome-feature-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.welcome-feature-card {
    min-height: 162px;
    padding: 19px 20px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(71, 121, 177, 0.12);
    border-radius: 17px;
    box-shadow: 0 8px 22px rgba(26, 59, 101, 0.055);
    backdrop-filter: blur(12px);
    transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
}

.welcome-feature-card:hover {
    transform: translateY(-4px);
    border-color: rgba(62, 126, 199, 0.26);
    box-shadow: 0 15px 28px rgba(26, 59, 101, 0.1);
}

.feature-icon {
    width: 39px;
    height: 39px;
    margin-bottom: 12px;
    border-radius: 12px;
}

.feature-icon svg {
    width: 22px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.6;
}

.feature-icon-blue {
    color: #2874c9;
    background: #eaf3ff;
}

.welcome-feature-card h3 {
    margin-bottom: 4px;
    color: #18365f;
    font-size: 15px;
}

.welcome-feature-card p {
    max-width: 350px;
    color: #71839b;
    font-size: 12px;
    line-height: 1.6;
}

.welcome-footer {
    display: flex;
    width: min(100%, 1280px);
    justify-content: space-between;
    gap: 16px;
    margin: auto auto 0;
    padding: 23px 0 20px;
    color: #8392a7;
    font-size: 10px;
}

.welcome-footer span:last-child {
    font-weight: 700;
    letter-spacing: 0.12em;
}

@keyframes welcome-page-enter {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes welcome-art-drift {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes welcome-card-drift {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

@media (max-width: 920px) {
    .welcome-hero {
        min-height: auto;
        grid-template-columns: minmax(0, 1fr);
        gap: 12px;
        padding: 52px 0 36px;
    }

    .welcome-copy {
        max-width: 720px;
    }

    .welcome-art {
        width: min(100%, 550px);
        justify-self: center;
    }
}

@media (max-width: 700px) {
    .welcome-screen {
        padding-right: 22px;
        padding-left: 22px;
    }

    .welcome-header {
        min-height: 72px;
    }

    .welcome-header-note {
        font-size: 11px;
    }

    .welcome-hero {
        padding-top: 39px;
    }

    .welcome-copy h1 {
        font-size: clamp(39px, 10vw, 58px);
    }

    .welcome-art {
        width: calc(100% - 24px);
        margin-top: 5px;
    }

    .float-quizzes {
        left: -5%;
    }

    .float-tasks {
        right: -5%;
    }

    .welcome-feature-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 6px;
    }

    .welcome-feature-heading > p {
        max-width: 520px;
    }

    .welcome-feature-grid {
        grid-template-columns: 1fr;
    }

    .welcome-feature-card {
        min-height: 0;
    }
}

@media (max-width: 480px) {
    .welcome-header-note {
        max-width: 105px;
        text-align: right;
        line-height: 1.35;
    }

    .welcome-brand {
        gap: 8px;
        font-size: 16px;
    }

    .welcome-brand-icon {
        width: 34px;
        height: 34px;
    }

    .welcome-hero {
        padding-top: 32px;
    }

    .welcome-eyebrow {
        gap: 8px;
        padding: 8px 10px;
        font-size: 9px;
        letter-spacing: 0.1em;
    }

    .welcome-copy h1 {
        font-size: clamp(36px, 11vw, 48px);
    }

    .welcome-description {
        font-size: 15px;
    }

    .welcome-cta {
        width: 100%;
        justify-content: space-between;
    }

    .welcome-art {
        width: calc(100% - 14px);
        margin: 6px 0 12px;
    }

    .welcome-float-card {
        min-width: 142px;
        gap: 8px;
        padding: 8px 9px;
        border-radius: 12px;
    }

    .welcome-float-card strong {
        font-size: 11px;
    }

    .welcome-float-card small {
        font-size: 9px;
    }

    .float-icon {
        width: 30px;
        height: 30px;
    }

    .float-quizzes {
        top: 11%;
    }

    .float-tasks {
        right: -8%;
        bottom: 23%;
    }

    .float-resources {
        left: -4%;
        bottom: 3%;
    }

    .welcome-feature-heading h2 {
        font-size: 23px;
    }

    .welcome-footer {
        font-size: 9px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .welcome-screen,
    .welcome-artwork,
    .welcome-float-card {
        animation: none;
    }

    #dashboard.dashboard-enter {
        animation: none;
    }

    .welcome-cta,
    .welcome-cta svg,
    .welcome-feature-card {
        transition: none;
    }
}

#dashboard.dashboard-enter {
    animation: dashboard-enter 260ms ease-out both;
}

@keyframes dashboard-enter {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Statistics Cards */
.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background-color: var(--surface);
    padding: 25px;
    border-radius: 12px;
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-card h3 {
    color: var(--accent);
    font-size: 32px;
}

/* Quiz Library */
#quizzes h2,
.resources h2 {
    color: var(--heading);
    margin-bottom: 20px;
}

.quizzes {
    padding: var(--card-padding);
    background-color: var(--surface);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.quiz-section-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 24px;
    margin-bottom: 24px;
}

.quiz-section-heading h2 {
    margin-bottom: 0 !important;
}

.quiz-section-heading > p,
.quiz-muted {
    color: var(--muted);
}

.quiz-eyebrow {
    color: var(--accent);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.quiz-library-layout {
    display: grid;
    grid-template-columns: minmax(190px, 0.28fr) minmax(0, 1fr);
    gap: 20px;
}

.quiz-sidebar,
.quiz-workspace {
    min-width: 0;
    padding: 20px;
    background-color: var(--page-bg);
    border: 1px solid var(--soft-border);
    border-radius: 12px;
}

.quiz-sidebar h3,
.quiz-workspace h3,
.quiz-chapter-layout h4 {
    color: var(--heading);
    margin-bottom: 12px;
}

.quiz-subject-list,
.quiz-chapter-list {
    display: grid;
    gap: 8px;
}

.quiz-subject-button,
.chapter-button {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    color: var(--text);
    text-align: left;
    background: var(--surface);
    border: 1px solid var(--soft-border);
}

.quiz-subject-button.is-selected,
.chapter-button.is-selected {
    color: var(--accent);
    border-color: var(--accent);
}

.subject-chapter-count {
    flex-shrink: 0;
    color: var(--muted);
    font-size: 12px;
}

.quiz-workspace-heading {
    margin-bottom: 20px;
}

.quiz-workspace-heading h3 {
    margin-bottom: 2px;
    font-size: 23px;
}

.chapter-form {
    margin-bottom: 22px;
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--soft-border);
    border-radius: 10px;
}

.chapter-form > label {
    display: block;
    margin-bottom: 8px;
    color: var(--heading);
    font-weight: 700;
}

.chapter-input-row {
    display: flex;
    gap: 10px;
}

.chapter-input-row input {
    flex: 1;
    min-width: 0;
    padding: 11px 12px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 7px;
    font: inherit;
}

.quiz-chapter-layout {
    display: grid;
    grid-template-columns: minmax(150px, 0.34fr) minmax(0, 1fr);
    gap: 18px;
}

.chapter-navigation,
.quiz-list-panel {
    min-width: 0;
}

.chapter-button {
    justify-content: flex-start;
}

.chapter-empty {
    font-size: 13px;
}

.quiz-list-panel > h4 {
    color: var(--heading);
    font-size: 19px;
}

.quiz-slot-list {
    display: grid;
    gap: 8px;
    margin-top: 14px;
}

.quiz-slot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 12px 14px;
    background: var(--surface);
    border: 1px solid var(--soft-border);
    border-radius: 9px;
}

.quiz-slot h5 {
    color: var(--heading);
    font-size: 14px;
}

.quiz-slot p {
    font-size: 12px;
}

.quiz-slot button {
    flex-shrink: 0;
}

.quiz-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    margin-top: 16px;
    color: var(--muted);
    font-size: 13px;
}

.quiz-pagination-buttons {
    display: flex;
    gap: 8px;
}

.quiz-pagination-buttons button {
    padding: 8px 12px;
}

.quiz-empty-state {
    padding: 24px;
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: 10px;
}

.quiz-empty-state h4 {
    color: var(--heading);
    margin-bottom: 4px;
}

.quiz-empty-state p {
    color: var(--muted);
}

.quiz-dialog {
    width: min(680px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    margin: auto;
    padding: 26px;
    overflow-y: auto;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--soft-border);
    border-radius: 16px;
    box-shadow: 0 24px 80px rgba(15, 23, 42, 0.3);
}

.quiz-dialog::backdrop {
    background: rgba(15, 23, 42, 0.58);
    backdrop-filter: blur(3px);
}

.quiz-dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 18px;
}

.quiz-dialog-header h2 {
    color: var(--heading);
    margin-bottom: 0;
}

.quiz-question-list {
    display: grid;
    gap: 16px;
}

.quiz-question {
    padding: 14px;
    border: 1px solid var(--soft-border);
    border-radius: 9px;
}

.quiz-question legend {
    padding: 0 5px;
    color: var(--heading);
    font-weight: 700;
}

.quiz-answer {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin-top: 9px;
    padding: 9px;
    background: var(--page-bg);
    border-radius: 6px;
    cursor: pointer;
}

.quiz-answer input {
    margin-top: 5px;
    accent-color: var(--accent);
}

.quiz-result {
    margin: 14px 0;
    color: var(--accent);
    font-weight: 700;
}

.quiz-result:empty {
    display: none;
}

/* Buttons */
button {
    background-color: var(--accent);
    color: white;
    border: none;
    padding: 11px 20px;
    border-radius: 7px;
    cursor: pointer;
    font-size: 14px;
}

button:hover {
    background-color: var(--accent-hover);
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.72;
}

:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 3px;
}

/* Resources */
.resources {
    background-color: var(--surface);
    padding: var(--card-padding);
    border-radius: 12px;
    margin-top: 40px;
    box-shadow: var(--shadow);
}

.resource-list {
    display: grid;
    gap: 16px;
    margin-top: 20px;
}

.resource-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 20px;
    background-color: var(--page-bg);
    border: 1px solid var(--soft-border);
    border-radius: 10px;
}

.resource-details h3 {
    margin: 4px 0;
    color: var(--heading);
}

.resource-details p {
    color: var(--muted);
}

.resource-details .resource-category {
    color: var(--accent);
    font-size: 13px;
    font-weight: 700;
}

.resource-actions {
    display: flex;
    flex-shrink: 0;
    gap: 10px;
}

.resource-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 9px 16px;
    color: #ffffff;
    background-color: var(--accent);
    border-radius: 7px;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
}

.resource-link:hover {
    background-color: var(--accent-hover);
}

.resource-link-secondary {
    color: var(--accent);
    background-color: transparent;
    border: 1px solid var(--accent);
}

.resource-link-secondary:hover {
    color: #ffffff;
}

/* Footer */
footer {
    text-align: center;
    padding: 25px;
    color: var(--muted);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.storage-status:not([hidden]) {
    max-width: 1100px;
    margin: 0 auto 20px;
    padding: 12px 16px;
    color: var(--notice-text);
    background: var(--notice-bg);
    border: 1px solid var(--notice-border);
    border-radius: 8px;
}

/* Responsive Design */
@media (max-width: 700px) {
    .navbar {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 15px;
    }

    .navbar ul {
        flex-wrap: wrap;
        justify-content: center;
        gap: 15px;
        order: 3;
        width: 100%;
    }

    .stats,
    .quiz-library-layout,
    .quiz-chapter-layout {
        grid-template-columns: 1fr;
    }

    .quiz-section-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 6px;
    }

    .quiz-subject-list {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }

    .quiz-chapter-list {
        display: flex;
        overflow-x: auto;
        padding: 2px 2px 8px;
    }

    .chapter-button {
        width: auto;
        flex: 0 0 auto;
    }

    .resource-card {
        align-items: stretch;
        flex-direction: column;
        gap: 16px;
    }

    .resource-actions {
        flex-wrap: wrap;
    }
}

/* Study Task Manager */
.tasks {
    background-color: var(--surface);
    padding: var(--card-padding);
    border-radius: 12px;
    margin-top: 40px;
    box-shadow: var(--shadow);
}

.tasks h2 {
    color: var(--heading);
    margin-bottom: 10px;
}

.tasks p {
    color: var(--muted);
    margin-bottom: 20px;
}

.task-input {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.task-input input {
    flex: 1;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 7px;
    font-size: 15px;
    min-width: 0;
    background-color: var(--surface);
    color: var(--text);
}

#taskList {
    list-style: none;
}

#taskList li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-bottom: 1px solid var(--soft-border);
}

#taskList li span {
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
}

#taskList li.is-complete span {
    color: var(--muted);
    text-decoration: line-through;
}

#taskList li .remove-button {
    background-color: #dc5454;
}

#taskList li .remove-button:hover {
    background-color: #b83232;
}

@media (max-width: 500px) {
    .task-input {
        flex-direction: column;
    }
}

body[data-layout="compact"] .stats,
body[data-layout="compact"] .quiz-slot-list {
    gap: 14px;
}

.design-settings-trigger {
    flex-shrink: 0;
    background-color: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.35);
}

.design-settings-trigger:hover {
    background-color: rgba(255, 255, 255, 0.24);
}

.design-dialog {
    width: min(560px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    margin: auto;
    padding: 28px;
    overflow-y: auto;
    color: var(--text);
    background-color: var(--surface);
    border: 1px solid var(--soft-border);
    border-radius: 20px;
    box-shadow: 0 24px 80px rgba(15, 23, 42, 0.3);
}

.design-dialog::backdrop {
    background: rgba(15, 23, 42, 0.58);
    backdrop-filter: blur(3px);
}

.design-dialog-header,
.design-dialog-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.design-dialog-header h2 {
    color: var(--heading);
    font-size: 24px;
}

.design-eyebrow {
    color: var(--accent);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.design-description {
    margin: 8px 0 20px;
    color: var(--muted);
    font-size: 14px;
}

.dialog-close {
    width: 40px;
    height: 40px;
    padding: 0;
    color: var(--muted);
    background: transparent;
    font-size: 26px;
}

.dialog-close:hover {
    color: var(--text);
    background: var(--page-bg);
}

.design-options {
    margin: 0;
    padding: 16px 0 18px;
    border: 0;
    border-top: 1px solid var(--soft-border);
}

.design-options legend {
    padding: 14px 0 10px;
    color: var(--heading);
    font-size: 15px;
    font-weight: 700;
}

.design-choice-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.design-choice,
.accent-choice {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: var(--text);
    background: var(--page-bg);
    border: 1px solid var(--soft-border);
    border-radius: 11px;
    cursor: pointer;
    font-size: 14px;
}

.design-choice.is-selected,
.accent-choice.is-selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(40, 120, 208, 0.14);
}

body[data-accent="violet"] .design-choice.is-selected,
body[data-accent="violet"] .accent-choice.is-selected {
    box-shadow: 0 0 0 2px rgba(118, 84, 214, 0.16);
}

body[data-accent="green"] .design-choice.is-selected,
body[data-accent="green"] .accent-choice.is-selected {
    box-shadow: 0 0 0 2px rgba(25, 135, 84, 0.16);
}

body[data-accent="rose"] .design-choice.is-selected,
body[data-accent="rose"] .accent-choice.is-selected {
    box-shadow: 0 0 0 2px rgba(214, 79, 120, 0.16);
}

.design-choice:focus-within,
.accent-choice:focus-within {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.design-choice input,
.accent-choice input {
    accent-color: var(--accent);
}

.choice-preview {
    display: block;
    width: 48px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: 7px;
}

.light-preview {
    background: linear-gradient(90deg, #f1f5f9 35%, #ffffff 35%);
}

.dark-preview {
    background: linear-gradient(90deg, #111827 35%, #374151 35%);
}

.accent-choices {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.accent-choice {
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    padding: 10px 4px;
    font-size: 12px;
}

.accent-swatch {
    width: 26px;
    height: 26px;
    border-radius: 50%;
}

.accent-blue {
    background: #2878d0;
}

.accent-violet {
    background: #7654d6;
}

.accent-green {
    background: #198754;
}

.accent-rose {
    background: #d64f78;
}

.layout-choice {
    flex-direction: column;
    justify-content: center;
    padding: 12px 6px;
    font-size: 12px;
}

.layout-preview {
    display: flex;
    width: 58px;
    height: 34px;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 5px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
}

.layout-preview i {
    display: block;
    height: 19px;
    flex: 1;
    background: var(--accent);
    opacity: 0.3;
    border-radius: 2px;
}

.compact-preview {
    gap: 1px;
    padding: 7px 3px;
}

.wide-preview {
    width: 68px;
}

.design-dialog-footer {
    padding-top: 18px;
    border-top: 1px solid var(--soft-border);
}

.reset-design-button {
    padding-left: 0;
    color: var(--accent);
    background: transparent;
}

.reset-design-button:hover {
    color: var(--accent-hover);
    background: transparent;
    text-decoration: underline;
}

@media (max-width: 420px) {
    .design-dialog {
        padding: 20px;
    }

    .design-choice-row {
        gap: 7px;
    }

    .design-choice {
        gap: 6px;
        padding: 9px 7px;
        font-size: 12px;
    }
}

/* Study task heading and Stars Leaderboard */
.task-section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.task-section-heading h2 {
    margin-bottom: 10px;
}

.leaderboard {
    margin-top: 40px;
    padding: var(--card-padding);
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--soft-border);
    border-radius: 14px;
    box-shadow: var(--shadow);
    scroll-margin-top: 24px;
}

.leaderboard-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
}

.leaderboard-eyebrow {
    margin-bottom: 5px;
    color: var(--accent);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
}

.leaderboard-heading h2 {
    color: var(--heading);
    font-size: 26px;
}

.leaderboard-heading > p,
.leaderboard-player-form > p {
    color: var(--muted);
    font-size: 13px;
}

.leaderboard-player-form {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    padding: 14px;
    background: var(--page-bg);
    border: 1px solid var(--soft-border);
    border-radius: 10px;
}

.leaderboard-player-form label {
    color: var(--heading);
    font-size: 13px;
    font-weight: 700;
}

.leaderboard-player-form input {
    min-width: 0;
    min-height: 42px;
    padding: 9px 11px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 7px;
    font: inherit;
}

.leaderboard-player-form > p {
    grid-column: 1 / -1;
    margin: 0;
    font-size: 11px;
}

.leaderboard-table-wrap {
    overflow-x: auto;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.leaderboard-table th,
.leaderboard-table td {
    padding: 13px 15px;
    border-bottom: 1px solid var(--soft-border);
}

.leaderboard-table th {
    color: var(--muted);
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.leaderboard-table tbody tr.is-current-player {
    background: var(--page-bg);
}

.leaderboard-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
}

.leaderboard-avatar {
    display: inline-grid;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    place-items: center;
    color: #ffffff;
    background: var(--accent);
    border-radius: 50%;
    font-size: 12px;
}

.leaderboard-stars {
    color: var(--accent);
    font-weight: 700;
    white-space: nowrap;
}

.leaderboard-empty {
    padding: 16px;
    color: var(--muted);
    text-align: center;
}

@media (max-width: 760px) {
    .leaderboard-heading {
        flex-direction: column;
        gap: 6px;
    }
}

@media (max-width: 500px) {
    .task-section-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .leaderboard-player-form {
        grid-template-columns: minmax(0, 1fr);
    }

    .leaderboard-player-form > p {
        grid-column: 1;
    }
}

/* Warm, lively learning hub refresh */
body {
    font-family: Inter, "Aptos", "Segoe UI", system-ui, sans-serif;
    background-color: var(--page-bg);
    color: var(--text);
}

h1,
h2,
.welcome-brand,
.dashboard-brand,
.footer-brand {
    font-family: Georgia, "Times New Roman", serif;
}

button,
input {
    font: inherit;
}

button {
    border-radius: 12px;
    font-weight: 700;
    transition: transform 180ms ease, background-color 180ms ease, box-shadow 180ms ease;
}

button:hover {
    transform: translateY(-2px);
}

button:active {
    transform: translateY(0) scale(0.98);
}

:focus-visible {
    outline-color: #ad4b31;
}

.welcome-screen {
    min-height: 100vh;
    padding: 0 clamp(20px, 5vw, 76px);
    color: var(--text);
    background:
        radial-gradient(ellipse at 84% 17%, rgba(240, 183, 68, 0.22), transparent 27%),
        radial-gradient(ellipse at 2% 54%, rgba(228, 93, 66, 0.1), transparent 32%),
        var(--page-bg);
}

body[data-theme="dark"] .welcome-screen {
    background:
        radial-gradient(ellipse at 84% 17%, rgba(240, 183, 68, 0.11), transparent 27%),
        radial-gradient(ellipse at 2% 54%, rgba(228, 93, 66, 0.09), transparent 32%),
        var(--page-bg);
}

.welcome-atmosphere {
    opacity: 0.32;
    background-image:
        radial-gradient(circle, rgba(91, 69, 43, 0.13) 1px, transparent 1.2px),
        radial-gradient(circle at 73% 52%, rgba(255, 255, 255, 0.86), transparent 25%);
    mask-image: linear-gradient(90deg, transparent, #000 45%, #000 100%);
}

.welcome-header {
    position: relative;
    width: min(100%, 1280px);
    min-height: 86px;
    border-bottom-color: color-mix(in srgb, var(--text) 10%, transparent);
}

.welcome-brand {
    gap: 12px;
    color: var(--heading);
    font-size: 21px;
}

.welcome-brand-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
}

.welcome-brand-light,
.footer-brand > span > span {
    color: var(--accent);
}

.welcome-nav {
    display: flex;
    align-items: center;
    gap: clamp(18px, 2.8vw, 36px);
    margin-left: auto;
    margin-right: 20px;
}

.welcome-nav a,
.welcome-footer nav a,
.dashboard-footer a {
    position: relative;
    color: var(--muted);
    font-size: 13px;
    font-weight: 650;
    text-decoration: none;
    transition: color 160ms ease;
}

.welcome-nav a::after {
    position: absolute;
    right: 0;
    bottom: -7px;
    left: 0;
    height: 2px;
    content: "";
    background: var(--accent);
    border-radius: 2px;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 180ms ease;
}

.welcome-nav a:hover,
.welcome-footer nav a:hover,
.dashboard-footer a:hover {
    color: var(--accent);
}

.welcome-nav a:hover::after {
    transform: scaleX(1);
}

.welcome-nav-cta,
.navbar-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 42px;
    padding: 0 16px;
    color: #fffaf1;
    background: var(--accent);
    border-radius: 999px;
    font-size: 13px;
    text-decoration: none;
}

.welcome-nav-cta:hover,
.navbar-cta:hover {
    color: #fffaf1;
    background: var(--accent-hover);
    box-shadow: 0 8px 20px rgba(201, 72, 48, 0.2);
}

.welcome-hero {
    width: min(100%, 1280px);
    min-height: 520px;
    grid-template-columns: minmax(0, 1.02fr) minmax(360px, 0.98fr);
    gap: clamp(26px, 5vw, 74px);
    padding: 48px 0 50px;
}

.welcome-copy {
    max-width: 650px;
}

.welcome-eyebrow {
    margin-bottom: 22px;
    padding: 9px 14px;
    color: #9b452e;
    background: rgba(255, 253, 248, 0.75);
    border-color: rgba(228, 93, 66, 0.2);
}

.welcome-eyebrow span,
.welcome-header-note span {
    background: var(--accent);
    box-shadow: 0 0 0 4px rgba(228, 93, 66, 0.13);
}

.welcome-copy h1 {
    max-width: 650px;
    margin-bottom: 20px;
    color: var(--heading);
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(52px, 6.1vw, 82px);
    font-weight: 700;
    letter-spacing: -0.065em;
    line-height: 0.99;
}

.welcome-copy h1 span {
    margin-top: 8px;
    color: var(--accent);
    background: none;
    font-style: italic;
    font-weight: 500;
    letter-spacing: -0.07em;
    -webkit-text-fill-color: currentColor;
}

.welcome-description {
    max-width: 510px;
    color: var(--muted);
    font-size: 17px;
    line-height: 1.75;
}

.welcome-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 20px;
    margin-top: 27px;
}

.welcome-cta {
    min-height: 56px;
    gap: 20px;
    margin-top: 0;
    padding: 0 22px 0 25px;
    color: #fffaf1;
    background: linear-gradient(112deg, var(--accent), #ed7651);
    border: 0;
    border-radius: 14px;
    box-shadow: 0 12px 25px rgba(201, 72, 48, 0.2);
}

.welcome-cta:hover {
    transform: translateY(-3px);
    box-shadow: 0 17px 30px rgba(201, 72, 48, 0.27);
}

.welcome-secondary-cta {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--heading);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
}

.welcome-secondary-cta span {
    color: var(--accent);
    transition: transform 180ms ease;
}

.welcome-secondary-cta:hover span {
    transform: translateY(3px);
}

.welcome-assurance {
    max-width: none;
    color: var(--muted);
    font-size: 12px;
}

.assurance-check {
    color: #fffaf1;
    background: #34785d;
}

.welcome-art {
    max-width: 600px;
    filter: drop-shadow(0 20px 24px rgba(67, 55, 37, 0.06));
}

.welcome-art-halo {
    background: radial-gradient(ellipse, rgba(240, 183, 68, 0.28), rgba(228, 93, 66, 0.07) 52%, transparent 74%);
}

.welcome-float-card {
    background: rgba(255, 253, 248, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.95);
    box-shadow: 0 15px 34px rgba(56, 42, 25, 0.12);
}

.float-icon-blue,
.feature-icon-blue {
    color: #a64b34;
    background: #ffede2;
}

.float-icon-mint,
.feature-icon-mint {
    color: #34785d;
    background: #e7f2e9;
}

.float-icon-lilac,
.feature-icon-lilac {
    color: #9b650d;
    background: #fff1cf;
}

.welcome-showcase,
.welcome-features,
.welcome-metrics,
.welcome-closing {
    width: min(100%, 1280px);
    margin-right: auto;
    margin-left: auto;
}

.welcome-showcase {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(360px, 1fr);
    align-items: center;
    gap: clamp(32px, 7vw, 100px);
    padding: 76px 0 84px;
    border-top: 1px solid color-mix(in srgb, var(--text) 10%, transparent);
}

.showcase-intro h2,
.metrics-copy h2,
.welcome-closing h2 {
    max-width: 510px;
    margin: 8px 0 14px;
    color: var(--heading);
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(34px, 4vw, 50px);
    letter-spacing: -0.055em;
    line-height: 1.08;
}

.showcase-intro h2 em,
.metrics-copy h2 em,
.welcome-closing h2 em {
    color: var(--accent);
    font-weight: 500;
}

.showcase-intro > p:last-of-type {
    max-width: 430px;
    color: var(--muted);
    line-height: 1.75;
}

.showcase-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 26px;
}

.showcase-tab {
    padding: 9px 14px;
    color: var(--muted);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 13px;
}

.showcase-tab:hover {
    color: var(--accent);
    background: var(--accent-wash);
}

.showcase-tab[aria-selected="true"] {
    color: #fffaf1;
    background: var(--heading);
}

.showcase-panel {
    position: relative;
    min-height: 330px;
    padding: clamp(24px, 4vw, 38px);
    overflow: hidden;
    color: #2a2824;
    background:
        radial-gradient(circle at 93% 8%, rgba(240, 183, 68, 0.27), transparent 26%),
        var(--surface);
    border: 1px solid var(--soft-border);
    border-radius: 28px;
    box-shadow: 0 22px 55px rgba(56, 42, 25, 0.1);
    transition: transform 200ms ease, box-shadow 200ms ease;
}

.showcase-panel:hover {
    transform: translateY(-4px);
    box-shadow: 0 28px 65px rgba(56, 42, 25, 0.14);
}

.showcase-panel-top,
.showcase-demo-row,
.showcase-panel-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.showcase-panel-top {
    color: #837b70;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.13em;
}

.showcase-panel-top > span:first-child {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.showcase-panel-top i {
    width: 7px;
    height: 7px;
    background: #34785d;
    border-radius: 50%;
}

.showcase-sparkle {
    color: var(--accent);
    font-size: 25px;
}

.showcase-kicker {
    margin-top: 31px;
    color: #a64b34;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.12em;
}

.showcase-panel h3 {
    max-width: 390px;
    margin: 7px 0 9px;
    color: #282620;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(25px, 3vw, 34px);
    letter-spacing: -0.045em;
    line-height: 1.15;
}

.showcase-description {
    max-width: 430px;
    color: #6f6b63;
    font-size: 14px;
    line-height: 1.65;
}

.showcase-demo-row {
    justify-content: flex-start;
    gap: 13px;
    margin-top: 22px;
    padding: 12px 14px;
    background: #f7f2e8;
    border: 1px solid #eee5d8;
    border-radius: 15px;
}

.showcase-number {
    display: grid;
    width: 37px;
    height: 37px;
    flex: 0 0 37px;
    place-items: center;
    color: #fffaf1;
    background: var(--accent);
    border-radius: 12px;
    font-size: 12px;
    font-weight: 800;
}

.showcase-demo-row strong,
.showcase-demo-row small {
    display: block;
}

.showcase-demo-row strong {
    color: #37332d;
    font-size: 12px;
}

.showcase-demo-row small {
    margin-top: 2px;
    color: #7d756b;
    font-size: 11px;
}

.showcase-arrow {
    margin-left: auto;
    color: var(--accent);
    font-size: 18px;
}

.showcase-panel-footer {
    margin-top: 19px;
    color: #8a8379;
    font-size: 11px;
}

.showcase-dots {
    display: flex;
    gap: 4px;
}

.showcase-dots i {
    width: 5px;
    height: 5px;
    background: #d7cfc2;
    border-radius: 50%;
}

.showcase-dots i:first-child {
    width: 16px;
    background: var(--accent);
    border-radius: 5px;
}

.welcome-features {
    padding: 40px 0 88px;
}

.welcome-feature-heading {
    align-items: flex-end;
    margin-bottom: 24px;
}

.feature-eyebrow {
    color: #a64b34;
}

.welcome-feature-heading h2 {
    max-width: 650px;
    color: var(--heading);
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(28px, 3.5vw, 42px);
    letter-spacing: -0.05em;
}

.welcome-feature-heading > p,
.welcome-feature-card p {
    color: var(--muted);
}

.welcome-feature-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 13px;
}

.welcome-feature-card {
    min-height: 215px;
    padding: 22px;
    background: var(--surface);
    border: 1px solid var(--soft-border);
    border-radius: 20px;
    box-shadow: 0 10px 24px rgba(56, 42, 25, 0.045);
}

.welcome-feature-card:hover {
    border-color: rgba(228, 93, 66, 0.32);
    box-shadow: 0 16px 30px rgba(56, 42, 25, 0.09);
}

.feature-icon {
    width: 42px;
    height: 42px;
    margin-bottom: 15px;
    border-radius: 14px;
}

.feature-icon-amber {
    color: #98600c;
    background: #fff0c8;
}

.feature-card-number {
    margin-bottom: 4px;
    color: #9a8170 !important;
    font-size: 9px !important;
    font-weight: 800;
    letter-spacing: 0.12em;
}

.welcome-feature-card h3 {
    margin-bottom: 6px;
    color: var(--heading);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 18px;
    letter-spacing: -0.02em;
}

.welcome-feature-card p:last-child {
    font-size: 12px;
    line-height: 1.65;
}

.welcome-metrics {
    display: grid;
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
    align-items: center;
    gap: 45px;
    margin-bottom: 82px;
    padding: clamp(28px, 5vw, 54px);
    color: #fffaf1;
    background: #292a27;
    border-radius: 28px;
}

.welcome-metrics .feature-eyebrow {
    color: #f4bd63;
}

.metrics-copy h2 {
    margin-bottom: 0;
    color: #fffaf1;
    font-size: clamp(30px, 3.8vw, 44px);
}

.metrics-copy h2 em {
    color: #f4bd63;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.metric-card {
    min-height: 118px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    padding: 16px;
    background: rgba(255, 250, 241, 0.07);
    border: 1px solid rgba(255, 250, 241, 0.13);
    border-radius: 17px;
}

.metric-card strong {
    color: #f4bd63;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(23px, 2.7vw, 34px);
    letter-spacing: -0.05em;
}

.metric-card span {
    color: #e2d9c9;
    font-size: 11px;
    line-height: 1.45;
}

.welcome-closing {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
    margin-bottom: 68px;
    padding: clamp(25px, 4vw, 44px);
    background: #f1e4d1;
    border: 1px solid #e8d8c1;
    border-radius: 25px;
}

body[data-theme="dark"] .welcome-closing {
    background: #302d29;
    border-color: var(--border);
}

.welcome-closing h2 {
    margin: 6px 0 8px;
    font-size: clamp(29px, 3.5vw, 41px);
}

.welcome-closing > div > p:last-child {
    color: var(--muted);
    font-size: 14px;
}

.welcome-closing .welcome-cta {
    flex: 0 0 auto;
}

.welcome-footer {
    width: min(100%, 1280px);
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 10px 30px;
    margin: auto auto 0;
    padding: 25px 0 24px;
    color: var(--muted);
    border-top: 1px solid color-mix(in srgb, var(--text) 10%, transparent);
    font-size: 12px;
}

.footer-brand {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: var(--heading);
    font-size: 18px;
    font-weight: 700;
    text-decoration: none;
}

.footer-brand-icon {
    display: block;
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
    border-radius: 10px;
}

.welcome-footer > p {
    color: var(--muted);
}

.welcome-footer nav {
    display: flex;
    gap: 17px;
}

.welcome-footer nav a {
    font-size: 11px;
}

.footer-copyright {
    grid-column: 1 / -1;
    color: #8b857b;
    font-size: 10px;
}

.reveal-on-scroll {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 380ms ease, transform 380ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.reveal-on-scroll.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Dashboard navigation and surfaces */
.navbar {
    position: sticky;
    z-index: 20;
    top: 0;
    min-height: 76px;
    padding: 12px max(24px, calc((100vw - 1260px) / 2));
    background: rgba(36, 35, 31, 0.96);
    box-shadow: 0 8px 24px rgba(36, 35, 31, 0.12);
    backdrop-filter: blur(14px);
}

.dashboard-brand {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    flex: 0 0 auto;
    color: var(--nav-text);
    font-size: 19px;
    font-weight: 700;
    text-decoration: none;
}

.dashboard-brand > span:last-child > span {
    color: #f3b95d;
}

.dashboard-brand-mark {
    display: block;
    width: 37px;
    height: 37px;
    flex: 0 0 auto;
    border-radius: 12px;
    object-fit: cover;
}

.navbar ul {
    align-items: center;
    gap: clamp(13px, 2vw, 27px);
}

.navbar a:not(.dashboard-brand, .navbar-cta) {
    position: relative;
    padding: 8px 0;
    color: #eee8dd;
    font-size: 12px;
    font-weight: 650;
}

.navbar a:not(.dashboard-brand, .navbar-cta)::after {
    position: absolute;
    right: 0;
    bottom: 1px;
    left: 0;
    height: 2px;
    content: "";
    background: #f3b95d;
    border-radius: 2px;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 160ms ease;
}

.navbar a:not(.dashboard-brand, .navbar-cta):hover {
    color: #fffaf1;
}

.navbar a:not(.dashboard-brand, .navbar-cta):hover::after {
    transform: scaleX(1);
}

.navbar-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 10px;
}

.navbar-cta {
    min-height: 38px;
    padding: 0 14px;
    color: #24231f;
    background: #f3bd61;
    font-size: 11px;
}

.navbar-cta:hover {
    color: #24231f;
    background: #ffd17b;
    box-shadow: 0 8px 18px rgba(240, 183, 68, 0.18);
}

.design-settings-trigger {
    min-height: 38px;
    padding: 8px 12px;
    color: #fffaf1;
    background: rgba(255, 250, 241, 0.09);
    border-color: rgba(255, 250, 241, 0.2);
    border-radius: 999px;
    font-size: 11px;
}

.design-settings-trigger:hover {
    background: rgba(255, 250, 241, 0.16);
}

main#dashboard {
    max-width: 1260px;
    margin: 42px auto 68px;
    padding-right: clamp(18px, 3vw, 34px);
    padding-left: clamp(18px, 3vw, 34px);
}

#dashboard > section {
    scroll-margin-top: 96px;
}

.stats {
    gap: 15px;
    margin-bottom: 28px;
}

.stat-card {
    position: relative;
    min-height: 128px;
    padding: 24px 24px 20px 28px;
    overflow: hidden;
    text-align: left;
    background: var(--surface);
    border: 1px solid var(--soft-border);
    border-radius: 20px;
    box-shadow: var(--shadow);
}

.stat-card::after {
    position: absolute;
    top: -25px;
    right: -18px;
    width: 92px;
    height: 92px;
    content: "";
    background: var(--accent-wash);
    border-radius: 50%;
}

.stat-card h3 {
    position: relative;
    z-index: 1;
    color: var(--accent);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 39px;
    line-height: 1.1;
}

.stat-card p {
    position: relative;
    z-index: 1;
    margin-top: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 650;
}

.quizzes,
.leaderboard,
.tasks,
.resources {
    border: 1px solid var(--soft-border);
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.quizzes {
    padding: clamp(20px, 3vw, 34px);
}

.quiz-section-heading h2,
.resources h2,
.tasks h2,
.leaderboard-heading h2 {
    color: var(--heading);
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(27px, 3vw, 35px);
    letter-spacing: -0.045em;
}

.quiz-section-heading > p {
    max-width: 420px;
    color: var(--muted);
    font-size: 14px;
}

.quiz-sidebar,
.quiz-workspace {
    padding: 20px;
    border-color: var(--soft-border);
    border-radius: 18px;
}

.quiz-sidebar,
.quiz-empty-state {
    background: color-mix(in srgb, var(--page-bg) 70%, var(--surface));
}

.quiz-subject-button,
.chapter-button,
.quiz-slot,
.quiz-empty-state,
.chapter-form,
.resource-card,
.leaderboard-player-form {
    border-radius: 13px;
}

.quiz-subject-button,
.chapter-button {
    min-height: 44px;
    border-radius: 11px;
    cursor: pointer;
    transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease;
}

.quiz-subject-button:hover,
.chapter-button:hover {
    transform: translateY(-1px);
    border-color: var(--accent);
}

.quiz-subject-button.is-selected,
.chapter-button.is-selected {
    color: var(--accent);
    background: var(--accent-wash);
    border-color: color-mix(in srgb, var(--accent) 45%, var(--soft-border));
}

.chapter-form,
.leaderboard-player-form {
    border-color: var(--soft-border);
}

.chapter-input-row input,
.task-input input,
.leaderboard-player-form input {
    border-color: var(--border);
    border-radius: 10px;
}

.chapter-input-row input:focus,
.task-input input:focus,
.leaderboard-player-form input:focus {
    border-color: var(--accent);
    outline: 3px solid color-mix(in srgb, var(--accent) 20%, transparent);
    outline-offset: 1px;
}

.quiz-slot {
    border-radius: 13px;
}

.quiz-dialog,
.design-dialog {
    border-radius: 24px;
}

.leaderboard {
    margin-top: 28px;
}

.leaderboard-player-form {
    padding: 17px;
}

.leaderboard-table tbody tr.is-current-player {
    background: var(--accent-wash);
}

.leaderboard-avatar {
    color: #fffaf1;
    background: var(--accent);
}

.tasks,
.resources {
    margin-top: 28px;
}

.tasks {
    padding: clamp(20px, 3vw, 34px);
}

.tasks h2 {
    margin-bottom: 5px;
}

.task-input {
    align-items: stretch;
}

.task-input input {
    min-height: 46px;
}

#taskList li {
    padding: 14px 10px;
    border-color: var(--soft-border);
}

.resources {
    padding: clamp(20px, 3vw, 34px);
}

.resources h2 {
    margin-bottom: 4px;
}

.resources > p {
    color: var(--muted);
}

.resource-card {
    padding: 22px;
    background: color-mix(in srgb, var(--page-bg) 65%, var(--surface));
    border-color: var(--soft-border);
}

.resource-link {
    border-radius: 999px;
}

.dashboard-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 24px clamp(20px, 5vw, 76px);
    color: var(--muted);
    background: var(--surface);
    border-top: 1px solid var(--soft-border);
    font-size: 12px;
}

.dashboard-footer-brand {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    flex: 0 0 auto;
    color: var(--heading);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 17px;
    font-weight: 700;
    text-decoration: none;
}

.dashboard-footer-brand img {
    display: block;
    width: 32px;
    height: 32px;
    flex: 0 0 auto;
    border-radius: 10px;
}

.dashboard-footer-brand > span > span {
    color: var(--accent);
}

.dashboard-footer p {
    margin: 0;
}

.dashboard-footer a {
    color: var(--accent);
}

.accent-choices {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.accent-coral {
    background: #e45d42;
}

.accent-amber {
    background: #a85e00;
}

@media (max-width: 1020px) {
    .welcome-nav {
        gap: 17px;
        margin-right: 10px;
    }

    .navbar {
        flex-wrap: wrap;
        justify-content: space-between;
        gap: 8px 16px;
    }

    .navbar ul {
        order: 3;
        width: 100%;
        justify-content: center;
    }

    .welcome-feature-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .welcome-metrics {
        grid-template-columns: 1fr;
        gap: 25px;
    }
}

@media (max-width: 760px) {
    .welcome-header {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        min-height: 74px;
        gap: 12px;
    }

    .welcome-nav {
        display: flex;
        grid-column: 1 / -1;
        grid-row: 2;
        justify-content: space-between;
        gap: 12px;
        margin: 0 0 11px;
    }

    .welcome-nav a {
        font-size: 11px;
        white-space: nowrap;
    }

    .welcome-hero {
        grid-template-columns: minmax(0, 1fr);
        gap: 12px;
        padding: 42px 0 36px;
    }

    .welcome-copy h1 {
        font-size: clamp(48px, 10vw, 70px);
    }

    .welcome-art {
        width: min(100%, 540px);
        justify-self: center;
    }

    .welcome-showcase {
        grid-template-columns: 1fr;
        gap: 26px;
        padding: 58px 0 66px;
    }

    .welcome-feature-heading {
        align-items: flex-start;
    }

    .welcome-feature-heading > p {
        max-width: 420px;
    }

    .welcome-features {
        padding-bottom: 64px;
    }

    .welcome-metrics {
        margin-bottom: 58px;
        border-radius: 23px;
    }

    .welcome-closing {
        align-items: flex-start;
        flex-direction: column;
        margin-bottom: 45px;
    }

    .welcome-footer {
        grid-template-columns: 1fr auto;
    }

    .welcome-footer > p {
        grid-column: 1 / -1;
        grid-row: 2;
    }

    .welcome-footer nav {
        justify-content: flex-end;
    }

    .footer-copyright {
        grid-row: 3;
    }

    .quiz-section-heading {
        align-items: flex-start;
    }

    .dashboard-footer {
        flex-wrap: wrap;
    }
}

@media (max-width: 540px) {
    .welcome-screen {
        padding-right: 18px;
        padding-left: 18px;
    }

    .welcome-brand {
        font-size: 17px;
    }

    .welcome-brand-icon {
        width: 36px;
        height: 36px;
    }

    .welcome-nav-cta {
        min-height: 38px;
        padding: 0 12px;
        font-size: 11px;
    }

    .welcome-hero {
        padding-top: 35px;
    }

    .welcome-copy h1 {
        font-size: clamp(43px, 12vw, 58px);
    }

    .welcome-description {
        font-size: 15px;
    }

    .welcome-actions {
        align-items: flex-start;
        flex-direction: column;
        gap: 15px;
    }

    .welcome-cta {
        width: 100%;
        justify-content: space-between;
    }

    .welcome-art {
        width: calc(100% - 16px);
    }

    .welcome-feature-heading {
        flex-direction: column;
        gap: 5px;
    }

    .welcome-feature-grid {
        grid-template-columns: 1fr;
    }

    .welcome-feature-card {
        min-height: 0;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .metric-card {
        min-height: 85px;
    }

    .welcome-footer {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .welcome-footer nav {
        justify-content: flex-start;
    }

    .welcome-footer > p,
    .footer-copyright {
        grid-column: 1;
        grid-row: auto;
    }

    .navbar {
        padding: 12px 16px;
    }

    .navbar-actions {
        gap: 6px;
    }

    .navbar-cta {
        min-height: 36px;
        padding: 0 10px;
        font-size: 10px;
    }

    .design-settings-trigger {
        min-height: 36px;
        padding: 7px 10px;
        font-size: 10px;
    }

    .navbar ul {
        gap: 9px 17px;
    }

    .navbar a:not(.dashboard-brand, .navbar-cta) {
        font-size: 11px;
    }

    main#dashboard {
        margin-top: 24px;
    }

    .stats {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .stat-card {
        min-height: 100px;
    }

    .quiz-section-heading {
        flex-direction: column;
    }

    .chapter-input-row {
        flex-direction: column;
    }

    .resource-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .dashboard-footer {
        align-items: flex-start;
        flex-direction: column;
        padding: 22px 18px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .reveal-on-scroll {
        opacity: 1;
        transform: none;
    }
}