:root {
    --bg: #f7f2ff;
    --surface: #ffffff;
    --surface-soft: #fcfbff;
    --ink: #2a1f3d;
    --muted: #6f6385;
    --accent: #5f3f86;
    --accent-dark: #4b2f6e;
    --accent-soft: #7f5ba4;
    --gold: #c9a23a;
    --gold-dark: #8e6d1f;
    --border: #e3d6f2;
    --shadow: 0 12px 30px rgba(58, 34, 95, 0.12);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Plus Jakarta Sans", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background:
        radial-gradient(circle at 5% 5%, #f1e7fc 0%, transparent 38%),
        radial-gradient(circle at 95% 0%, #f7f0dd 0%, transparent 33%),
        var(--bg);
    color: var(--ink);
    line-height: 1.65;
}

.container {
    width: min(1080px, 92vw);
    margin: 0 auto;
}

.site-header,
.site-footer {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(5px);
    border-bottom: 1px solid var(--border);
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
}

.site-footer {
    margin-top: 42px;
    padding: 18px 0;
    border-top: 1px solid var(--border);
    border-bottom: 0;
    color: var(--muted);
}

.nav-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    gap: 12px;
}

.brand {
    font-weight: 800;
    font-size: 1.18rem;
    letter-spacing: 0.1px;
    color: var(--accent-dark);
}

nav {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.top-nav {
    gap: 6px;
}

.nav-link {
    padding: 8px 10px;
    border-radius: 8px;
    color: var(--ink);
}

.nav-link:hover {
    background: #f5f1fb;
    color: var(--accent-dark);
}

.nav-link-with-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.nav-badge {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--gold);
    color: #fff;
    font-size: 0.74rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

a:hover {
    color: var(--accent-dark);
}

main {
    padding: 28px 0;
}

.hero {
    padding: 26px;
    background: linear-gradient(135deg, #f5f1fb, #ffffff 50%, #fffdfa);
    border: 1px solid var(--border);
    border-radius: 16px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

.hero-pro {
    display: grid;
    grid-template-columns: 1.2fr minmax(260px, 360px);
    gap: 18px;
    align-items: start;
}

.eyebrow {
    display: inline-block;
    margin: 0 0 8px;
    padding: 4px 10px;
    border-radius: 999px;
    background: #efe8fa;
    color: var(--accent-dark);
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.hero-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.hero-panel {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
    background: #fff;
}

.hero-panel ul {
    margin: 8px 0 0;
    padding-left: 18px;
}

.hero-panel li {
    margin-bottom: 8px;
}

.page-head {
    margin-bottom: 18px;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.stat-card {
    text-align: center;
    background: linear-gradient(160deg, #ffffff, #f5f1fb);
}

.stat-number {
    font-size: 1.45rem;
    font-weight: 800;
    margin: 2px 0 0;
}

.course-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}

.course-card {
    overflow: hidden;
}

.course-cover {
    width: 100%;
    height: 160px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid var(--border);
    margin-bottom: 10px;
    background: #f5f1fb;
}

.course-cover-fallback {
    width: 100%;
    height: 160px;
    border-radius: 10px;
    border: 1px solid var(--border);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--accent);
    background: linear-gradient(135deg, #efe8fa, #f7f0dd);
}

.course-cover-detail {
    width: 100%;
    max-height: 340px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid var(--border);
    margin-bottom: 12px;
    background: #f5f1fb;
}

.card,
.course-detail,
.auth-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
    box-shadow: var(--shadow);
}

.muted {
    color: var(--muted);
}

.status {
    color: #0e7490;
    font-weight: 700;
}

button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 10px;
    background: linear-gradient(180deg, var(--accent-soft), var(--accent));
    color: #fff;
    padding: 10px 14px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
}

.secondary-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #f8fbff;
    color: var(--ink);
    padding: 6px 10px;
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 600;
}

.secondary-btn:hover {
    background: #f5f1fb;
}

button:hover,
.button:hover {
    background: linear-gradient(180deg, var(--accent), var(--accent-dark));
    color: #fff;
}

.inline-form {
    display: inline;
}

.inline-form button {
    padding: 8px 10px;
}

.stack-form p {
    margin: 0 0 12px;
}

.stack-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.stack-form input,
.stack-form textarea,
.stack-form select {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px;
    font: inherit;
    color: var(--ink);
    background: #fff;
}

.stack-form .helptext {
    color: var(--muted);
    font-size: 0.86rem;
}

.stack-form .errorlist {
    list-style: none;
    margin: 6px 0 0;
    padding: 0;
    color: #b42318;
    font-size: 0.9rem;
    font-weight: 600;
}

.stack-form .errorlist li {
    margin: 0;
}

.stack-form input:invalid,
.stack-form textarea:invalid,
.stack-form select:invalid {
    border-color: #d92d20;
}

.stack-form input[aria-invalid="true"],
.stack-form textarea[aria-invalid="true"],
.stack-form select[aria-invalid="true"] {
    border-color: #d92d20;
    background: #fff5f5;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    border-bottom: 1px solid var(--border);
    padding: 10px;
    text-align: left;
}

th {
    color: var(--muted);
    font-weight: 700;
}

.actions-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.lesson-item {
    margin-bottom: 14px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-soft);
}

.block-list-public {
    list-style-position: inside;
    padding-left: 0;
}

.block-head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
}

.type-chip {
    display: inline-block;
    background: #efe8fa;
    border: 1px solid #d9caec;
    color: var(--accent-dark);
    border-radius: 999px;
    padding: 2px 10px;
    font-size: 0.78rem;
    font-weight: 700;
}

.lesson-video {
    width: min(760px, 100%);
    border-radius: 10px;
    border: 1px solid var(--border);
    margin-top: 8px;
}

.lesson-block-list {
    margin: 10px 0 0;
    padding-left: 18px;
}

.lesson-block-item {
    margin-bottom: 10px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
}

.lesson-accordion-list {
    display: grid;
    gap: 10px;
}

.lesson-accordion {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    padding: 8px 10px;
}

.lesson-accordion-summary {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    list-style: none;
}

.lesson-accordion-summary::-webkit-details-marker {
    display: none;
}

.compact-block-list {
    margin-top: 10px;
}

.compact-block-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
}

.rich-editor-wrap {
    margin-bottom: 12px;
}

.rt-toolbar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.rich-editor {
    min-height: 160px;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px;
    background: #fff;
}

.rich-editor img,
.rich-content img {
    width: 280px;
    max-width: 100%;
    height: auto;
    display: block;
    margin: 10px 0;
    border-radius: 8px;
}

.rich-editor img.rt-selected-image {
    outline: 2px solid var(--accent);
}

.quiz-matrix-wrap {
    margin-bottom: 12px;
}

.quiz-matrix {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}

.quiz-matrix th,
.quiz-matrix td {
    border-bottom: 1px solid var(--border);
    padding: 8px;
}

.quiz-correct-cell {
    width: 80px;
    text-align: center;
}

.matrix-actions {
    margin-top: 8px;
}

.hidden-field {
    display: none;
}

.quiz-box {
    background: #f4f8ff;
    border: 1px solid #d4e2f6;
    border-radius: 10px;
    padding: 10px;
}

.puzzle-list {
    list-style: none;
    margin: 12px 0;
    padding: 0;
    display: grid;
    gap: 10px;
}

.puzzle-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-soft);
    cursor: move;
}

.puzzle-main {
    display: flex;
    align-items: center;
    gap: 10px;
}

.drag-handle {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 8px;
    border: 1px dashed #d9caec;
    color: var(--accent);
    font-weight: 700;
}

.puzzle-item.dragging {
    opacity: 0.55;
    transform: scale(0.99);
}

.messages {
    list-style: none;
    padding: 0;
}

.message {
    padding: 10px 12px;
    border-radius: 10px;
    margin-bottom: 10px;
    border: 1px solid transparent;
}

.message.success {
    background: #fffdfa;
    border-color: #e7dcb5;
}

.message.info {
    background: #f5f1fb;
    border-color: #ddd2ef;
}

.message.error {
    background: #fdf2f8;
    border-color: #e7c8d7;
}

.learn-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.learn-layout {
    display: grid;
    grid-template-columns: minmax(260px, 320px) 1fr;
    gap: 12px;
}

.learn-sidebar {
    align-self: start;
    position: sticky;
    top: 88px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.learn-lesson-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 10px;
}

.learn-lesson-title {
    font-weight: 700;
    margin: 0 0 6px;
}

.learn-block-list {
    margin: 0;
    padding-left: 18px;
}

.learn-block-list a {
    color: var(--ink);
    font-weight: 600;
}

.learn-block-list a.active-link {
    color: #fff;
    background: var(--accent);
    border-radius: 8px;
    padding: 2px 8px;
}

.learn-content {
    min-height: 380px;
}

.lesson-pdf-frame {
    width: 100%;
    min-height: 540px;
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-top: 10px;
    background: #fff;
}

.learn-nav {
    margin-top: 18px;
    display: flex;
    gap: 8px;
}

.learn-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
    padding: 22px;
}

.learn-topbar h1 {
    margin: 0 0 4px;
    font-size: clamp(1.5rem, 2.5vw, 2rem);
}

.learn-top-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.progress-banner {
    margin-bottom: 12px;
    padding: 14px 18px;
    background: linear-gradient(135deg, #ffffff 0%, #f5f1fb 100%);
}

.progress-banner-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.progress-meter {
    height: 10px;
    border-radius: 999px;
    background: #e8e0f2;
    overflow: hidden;
}

.progress-meter span {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--accent) 0%, var(--accent-soft) 70%, var(--gold) 100%);
}

.lesson-group {
    padding: 10px;
    border: 1px solid #ddd2ef;
    border-radius: 10px;
    background: #fff;
}

.lesson-group-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
}

.small-text {
    font-size: 0.82rem;
}

.curriculum-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    border-radius: 8px;
}

.curriculum-link:hover {
    background: #edf7fc;
}

.curriculum-status {
    width: 18px;
    height: 18px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f5f1fb;
    color: var(--accent);
    font-size: 0.72rem;
    font-weight: 700;
}

.curriculum-status.done {
    background: var(--gold);
    color: #fff;
}

.learn-content {
    padding: 20px;
}

.learn-content-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
    margin-bottom: 12px;
}

.learn-content-body {
    min-height: 240px;
}

.learn-content-body p {
    font-size: 1.02rem;
}

.lesson-media-frame {
    width: 100%;
    min-height: 500px;
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-top: 10px;
    background: #fff;
}

.complete-chip {
    display: inline-block;
    background: #fffdfa;
    color: var(--gold-dark);
    border: 1px solid #e7dcb5;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.8rem;
    font-weight: 700;
}

.student-quiz-form {
    display: grid;
    gap: 10px;
}

.quiz-question-card {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px;
    background: #fff;
}

.quiz-builder-list {
    display: grid;
    gap: 10px;
}

.quiz-question-builder {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px;
    background: #fff;
}

.quiz-question-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.quiz-options-list {
    display: grid;
    gap: 8px;
    margin: 8px 0;
}

.quiz-option-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 8px;
    align-items: center;
}

.quiz-option-line {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px;
}

.course-progress-mini {
    margin: 10px 0 14px;
}

.chat-thread {
    display: grid;
    gap: 10px;
    margin-bottom: 12px;
}

.chat-message {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px;
    background: #fff;
}

.chat-message.mine {
    background: #f5f1fb;
    border-color: #d9caec;
}

.chat-meta {
    margin: 0 0 6px;
    color: var(--muted);
    font-size: 0.84rem;
}

.inbox-list {
    display: grid;
    gap: 10px;
}

.inbox-item {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.inbox-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

@media (max-width: 760px) {
    .nav-wrap {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .footer-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 18px;
    text-align: center;
}

    .puzzle-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .learn-layout {
        grid-template-columns: 1fr;
    }

    .learn-sidebar {
        position: static;
        max-height: none;
    }

    .learn-content-head,
    .learn-topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .lesson-media-frame {
        min-height: 360px;
    }

    .hero-pro {
        grid-template-columns: 1fr;
    }
}


.profile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
}


.footer-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 18px;
    text-align: center;
}
