@import url("https://fonts.googleapis.com/css2?family=Sora:wght@400;500;600;700;800&family=Noto+Sans+SC:wght@400;500;700;800&display=swap");

:root {
    --bg: #f6f1e8;
    --bg-strong: #efe8db;
    --surface: rgba(255, 252, 247, 0.84);
    --surface-solid: #fffdf9;
    --surface-tint: #f9f3ea;
    --text: #1e2430;
    --muted: #6d7688;
    --muted-soft: #8b93a5;
    --line: rgba(30, 36, 48, 0.1);
    --line-strong: rgba(26, 125, 120, 0.26);
    --blue: #2f5bea;
    --blue-deep: #213c99;
    --teal: #147d74;
    --gold: #c88b28;
    --danger: #d85d57;
    --shadow-sm: 0 20px 44px rgba(31, 40, 58, 0.08);
    --shadow-lg: 0 34px 90px rgba(31, 40, 58, 0.13);
    --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, 0.55);
    --radius-xl: 36px;
    --radius-lg: 26px;
    --radius-md: 20px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    font-family: "Sora", "Noto Sans SC", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 0% 0%, rgba(47, 91, 234, 0.16), transparent 28%),
        radial-gradient(circle at 100% 10%, rgba(20, 125, 116, 0.12), transparent 26%),
        radial-gradient(circle at 50% 100%, rgba(216, 93, 87, 0.1), transparent 34%),
        linear-gradient(180deg, #fffdf9 0%, var(--bg) 52%, #efe6d9 100%);
}

body[data-page="knowledge"] {
    background:
        repeating-linear-gradient(180deg, rgba(47, 91, 234, 0.045) 0 1px, transparent 1px 36px),
        radial-gradient(circle at 0% 0%, rgba(47, 91, 234, 0.14), transparent 26%),
        radial-gradient(circle at 100% 10%, rgba(216, 93, 87, 0.12), transparent 24%),
        linear-gradient(180deg, #fffdf9 0%, #f7f1e5 54%, #ede4d4 100%);
}

a,
button {
    font: inherit;
}

a {
    color: inherit;
}

.container {
    width: min(1600px, calc(100% - 40px));
    margin: 0 auto;
}

.knowledge-hero {
    padding: 24px 0 10px;
}

.knowledge-hero .container {
    display: grid;
    gap: 16px;
    padding: 26px 30px;
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 34px;
    background:
        radial-gradient(circle at top right, rgba(47, 91, 234, 0.1), transparent 30%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(255, 248, 239, 0.78));
    backdrop-filter: blur(18px);
    box-shadow: var(--shadow-sm), var(--shadow-inset);
}

.knowledge-hero h1 {
    font-size: clamp(1.55rem, 2.45vw, 1.9rem);
    font-weight: 800;
    letter-spacing: -0.045em;
    line-height: 1.05;
}

.knowledge-hero .subtitle {
    max-width: 680px;
    color: var(--muted);
    font-size: 1rem;
    line-height: 1.75;
}

main {
    padding: 24px 0 72px;
}

.intro,
.page-header,
.chapter,
.tips {
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    background: var(--surface);
    box-shadow: var(--shadow-sm), var(--shadow-inset);
}

.intro,
.page-header,
.chapter,
.tips {
    padding: 30px 32px;
}

.intro {
    background:
        radial-gradient(circle at top right, rgba(47, 91, 234, 0.1), transparent 30%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(250, 244, 236, 0.9));
}

.intro .module-glyph-large {
    margin-bottom: 14px;
}

.intro,
.tips {
    position: relative;
    overflow: hidden;
}

.intro::before,
.tips::before {
    content: "";
    position: absolute;
    top: 0;
    left: 24px;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, rgba(216, 93, 87, 0.3), rgba(216, 93, 87, 0.08));
}

.intro > *,
.tips > * {
    position: relative;
    z-index: 1;
}

.intro h2,
.subjects h2,
.tips h2,
.page-header h1,
.chapter h2 {
    letter-spacing: -0.03em;
}

.intro h2,
.subjects h2,
.tips h2 {
    font-size: 1.22rem;
    font-weight: 700;
}

.intro p,
.tips li,
.subject-card p,
.page-header p,
.chapter li,
.chapter p,
table td {
    color: var(--muted);
    line-height: 1.75;
}

.intro p,
.page-header p,
.chapter p,
.chapter li,
.tips li {
    max-width: 92ch;
}

.subjects,
.tips {
    margin-top: 24px;
}

.subject-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
    margin-top: 20px;
}

.subject-card {
    display: block;
    padding: 22px 24px;
    border: 1px solid rgba(30, 36, 48, 0.08);
    border-radius: 26px;
    background:
        radial-gradient(circle at top right, rgba(47, 91, 234, 0.1), transparent 34%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(250, 244, 236, 0.95));
    text-decoration: none;
    box-shadow: var(--shadow-sm), var(--shadow-inset);
    transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.subjects .subject-card {
    background:
        repeating-linear-gradient(180deg, rgba(47, 91, 234, 0.035) 0 1px, transparent 1px 30px),
        linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(250, 244, 236, 0.95));
}

.subject-card:hover,
.subject-card:focus-visible {
    border-color: rgba(47, 91, 234, 0.22);
    box-shadow: var(--shadow-lg), var(--shadow-inset);
    transform: translateY(-3px);
}

.subject-card h3 {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.subject-card p {
    margin-top: 10px;
    font-size: 0.92rem;
}

.grade-grid {
    align-items: stretch;
}

.grade-card {
    cursor: default;
}

a.grade-card {
    cursor: pointer;
}

.grade-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(24, 33, 47, 0.06);
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
}

.status-pill-live {
    background: rgba(20, 125, 116, 0.12);
    color: var(--teal);
}

.status-pill-preview {
    background: rgba(47, 91, 234, 0.12);
    color: var(--blue-deep);
}

.active-grade {
    border-color: rgba(47, 91, 234, 0.16);
    background:
        radial-gradient(circle at top right, rgba(242, 125, 95, 0.1), transparent 34%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 238, 227, 0.98));
}

.tips ul {
    list-style: none;
    margin-top: 14px;
}

.tips li {
    position: relative;
    padding: 12px 0 12px 18px;
    border-bottom: 1px solid rgba(24, 33, 47, 0.07);
}

.tips li:last-child {
    border-bottom: none;
}

.tips li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 22px;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--blue), var(--teal));
}

footer {
    padding: 0 0 32px;
}

footer .container {
    padding: 18px 28px;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: rgba(255, 252, 247, 0.72);
    color: var(--muted-soft);
    text-align: center;
    box-shadow: var(--shadow-sm), var(--shadow-inset);
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 18px;
    color: var(--muted);
    font-size: 0.92rem;
}

.breadcrumb a {
    color: var(--blue-deep);
    text-decoration: none;
}

.breadcrumb a:hover,
.breadcrumb a:focus-visible {
    text-decoration: underline;
}

.page-header {
    margin-bottom: 24px;
    background:
        radial-gradient(circle at top right, rgba(20, 125, 116, 0.1), transparent 28%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(250, 244, 236, 0.9));
}

.page-header,
.chapter {
    position: relative;
}

.chapter::after {
    content: "";
    position: absolute;
    top: 18px;
    right: 18px;
    width: 56px;
    height: 56px;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(47, 91, 234, 0.08), rgba(216, 93, 87, 0.08));
    opacity: 0.9;
}

.chapter > * {
    position: relative;
    z-index: 1;
}

.page-header h1 {
    font-size: clamp(1.45rem, 2.2vw, 1.75rem);
    font-weight: 800;
    line-height: 1.12;
}

.page-header p {
    margin-top: 10px;
    font-size: 1rem;
}

.page-header .action-link {
    display: inline-flex;
    align-items: center;
    min-height: 42px;
    margin-top: 18px;
    padding: 10px 16px;
    border-radius: 999px;
    background: linear-gradient(135deg, #172033, #2b3b56);
    color: #ffffff;
    text-decoration: none;
    font-weight: 600;
    box-shadow: 0 16px 28px rgba(18, 25, 38, 0.2);
}

.page-header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 18px;
}

.page-header-actions .action-link {
    margin-top: 0;
}

.chapter {
    margin-bottom: 20px;
}

.chapter h2 {
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(24, 33, 47, 0.08);
    font-size: 1.2rem;
    font-weight: 700;
}

.chapter h3 {
    margin: 22px 0 10px;
    font-size: 1rem;
    font-weight: 700;
}

.chapter h4 {
    margin: 18px 0 8px;
    color: var(--blue-deep);
    font-size: 0.94rem;
    font-weight: 700;
}

.chapter ul,
.chapter ol {
    margin: 0 0 16px 20px;
}

.chapter li {
    margin-bottom: 8px;
    font-size: 0.96rem;
}

.formula,
.important,
.grammar-point,
.example-card,
.concept-grid {
    margin: 16px 0;
    padding: 18px 20px;
    border-radius: 22px;
}

.formula {
    border: 1px solid rgba(47, 91, 234, 0.12);
    background: linear-gradient(180deg, rgba(235, 241, 255, 0.92), rgba(248, 244, 237, 0.96));
    color: var(--blue-deep);
    font-family: "SF Mono", "Roboto Mono", monospace;
    font-size: 0.95rem;
    overflow-x: auto;
}

.important {
    border: 1px solid rgba(245, 182, 63, 0.25);
    background: linear-gradient(180deg, rgba(255, 246, 219, 0.98), rgba(255, 251, 238, 0.98));
}

.important strong {
    color: #9a6500;
}

.grammar-point {
    border: 1px solid rgba(33, 183, 168, 0.16);
    background: linear-gradient(180deg, rgba(235, 251, 248, 0.98), rgba(247, 255, 253, 0.98));
}

.grammar-point strong {
    display: block;
    margin-bottom: 10px;
    color: var(--teal);
}

.concept-grid,
.example-grid,
.case-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin: 18px 0;
}

.concept-grid {
    padding: 0;
    border: none;
    background: transparent;
}

.concept-card,
.example-card,
.case-card {
    min-height: 100%;
    border-radius: 22px;
    box-shadow: var(--shadow-sm), var(--shadow-inset);
}

.concept-card {
    padding: 18px 20px;
    border: 1px solid rgba(47, 91, 234, 0.1);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(246, 242, 234, 0.96));
}

.concept-card h4 {
    margin: 0 0 10px;
    color: var(--blue-deep);
    font-size: 0.95rem;
    font-weight: 700;
}

.concept-card p,
.example-card p,
.example-card li,
.example-card .answer {
    color: var(--muted);
    line-height: 1.72;
}

.concept-card p {
    margin: 0;
    font-size: 0.94rem;
}

.example-lead {
    margin-top: 18px;
    color: var(--blue-deep);
    font-size: 0.94rem;
    font-weight: 700;
}

.example-grid {
    align-items: stretch;
}

.example-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 0;
    border: 1px solid rgba(33, 183, 168, 0.16);
    background:
        radial-gradient(circle at top right, rgba(20, 125, 116, 0.1), transparent 34%),
        linear-gradient(180deg, rgba(235, 251, 248, 0.98), rgba(247, 255, 253, 0.98));
}

.example-card .example-tag {
    display: inline-flex;
    align-self: flex-start;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(20, 125, 116, 0.12);
    color: var(--teal);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.example-card h4 {
    margin: 0;
    color: var(--text);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.45;
}

.example-card p {
    margin: 0;
    font-size: 0.93rem;
}

.example-card .answer {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid rgba(20, 125, 116, 0.12);
    font-size: 0.92rem;
}

.example-card .answer strong {
    display: inline;
    margin-right: 6px;
    color: var(--teal);
}

.case-lead {
    margin-top: 18px;
    color: var(--danger);
    font-size: 0.94rem;
    font-weight: 700;
}

.case-card {
    padding: 18px 20px;
    border: 1px solid rgba(216, 93, 87, 0.14);
    background:
        radial-gradient(circle at top right, rgba(216, 93, 87, 0.08), transparent 34%),
        linear-gradient(180deg, rgba(255, 250, 246, 0.98), rgba(255, 245, 238, 0.98));
}

.case-card h4 {
    margin: 0 0 10px;
    color: var(--danger);
    font-size: 0.96rem;
    font-weight: 700;
}

.case-card p {
    margin: 0;
    color: var(--muted);
    font-size: 0.93rem;
    line-height: 1.72;
}

.vocab-board {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin: 18px 0;
}

.vocab-card {
    padding: 20px;
    border: 1px solid rgba(47, 91, 234, 0.1);
    border-radius: 24px;
    background:
        radial-gradient(circle at top right, rgba(47, 91, 234, 0.08), transparent 34%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(246, 242, 234, 0.97));
    box-shadow: var(--shadow-sm), var(--shadow-inset);
}

.vocab-card h4 {
    margin: 0 0 12px;
    color: var(--blue-deep);
    font-size: 0.98rem;
    font-weight: 700;
}

.vocab-note {
    margin: 0 0 12px;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.68;
}

.vocab-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.vocab-item {
    display: inline-flex;
    flex-direction: column;
    gap: 2px;
    min-width: 108px;
    padding: 10px 12px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(30, 36, 48, 0.08);
}

.vocab-word {
    color: var(--text);
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.3;
}

.vocab-mean {
    color: var(--muted);
    font-size: 0.8rem;
    line-height: 1.35;
}

.lab-board {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    margin: 18px 0;
}

.lab-card {
    padding: 20px;
    border: 1px solid rgba(20, 125, 116, 0.14);
    border-radius: 24px;
    background:
        radial-gradient(circle at top right, rgba(20, 125, 116, 0.08), transparent 34%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(241, 249, 247, 0.97));
    box-shadow: var(--shadow-sm), var(--shadow-inset);
}

.lab-card h4 {
    margin: 0 0 10px;
    color: var(--teal);
    font-size: 0.98rem;
    font-weight: 700;
}

.lab-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.lab-pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(20, 125, 116, 0.1);
    color: var(--teal);
    font-size: 0.78rem;
    font-weight: 700;
}

.lab-card p {
    margin: 0 0 8px;
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.7;
}

.lab-card p:last-child {
    margin-bottom: 0;
}

.answer-toggle {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid rgba(20, 125, 116, 0.12);
}

.answer-toggle summary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    list-style: none;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(20, 125, 116, 0.1);
    color: var(--teal);
    font-size: 0.86rem;
    font-weight: 700;
    user-select: none;
}

.answer-toggle summary::-webkit-details-marker {
    display: none;
}

.answer-toggle summary::after {
    content: "+";
    font-size: 1rem;
    line-height: 1;
}

.answer-toggle[open] summary::after {
    content: "-";
}

.answer-toggle .answer {
    margin-top: 12px;
}

table {
    width: 100%;
    margin: 16px 0;
    border-collapse: collapse;
    overflow: hidden;
    border-radius: 20px;
    background: rgba(255, 252, 247, 0.88);
    box-shadow: inset 0 0 0 1px rgba(30, 36, 48, 0.06), var(--shadow-sm);
}

table th,
table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid rgba(24, 33, 47, 0.07);
}

table th {
    background: rgba(47, 91, 234, 0.08);
    color: var(--text);
    font-weight: 700;
}

table tr:last-child td {
    border-bottom: none;
}

table tr:hover td {
    background: rgba(47, 91, 234, 0.04);
}

a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
}

@media (max-width: 720px) {
    .container {
        width: calc(100% - 20px);
    }

    .knowledge-hero .container,
    .intro,
    .page-header,
    .chapter,
    .tips,
    footer .container {
        padding: 20px;
        border-radius: 24px;
    }

    .subject-grid {
        grid-template-columns: 1fr;
    }

    table th,
    table td {
        padding: 10px 12px;
        font-size: 0.86rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        transition: none !important;
    }
}
