:root {
    --bg-paper: #f7f4ea;
    --bg-soft: #fffdf6;
    --panel: rgba(255, 255, 255, 0.96);
    --panel-strong: #ffffff;
    --ink: #18212f;
    --ink-soft: #5f6b80;
    --line-soft: #d9e0ee;
    --line-strong: #1d2433;
    --brand: #2347d1;
    --brand-deep: #172f8f;
    --brand-light: #dce7ff;
    --accent: #ff7a00;
    --accent-soft: #fff0da;
    --success: #2c8b57;
    --success-soft: #e8f7ef;
    --warn: #d97706;
    --warn-soft: #fff3d8;
    --danger: #b9382f;
    --danger-soft: #ffe3df;
    --formula: #6f35d3;
    --formula-soft: #efe6ff;
    --shadow-card: 0 18px 40px rgba(17, 27, 56, 0.12);
    --shadow-paper: 0 20px 50px rgba(35, 71, 209, 0.1);
    --paper-grid:
        linear-gradient(rgba(35, 71, 209, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(35, 71, 209, 0.05) 1px, transparent 1px);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at 10% 10%, rgba(35, 71, 209, 0.18), transparent 26%),
        radial-gradient(circle at 92% 14%, rgba(255, 122, 0, 0.16), transparent 18%),
        linear-gradient(180deg, #fefbf2 0%, #f6f4ec 48%, #eef3ff 100%);
}

body.cyber-nav-mounted {
    background:
        radial-gradient(circle at 10% 10%, rgba(35, 71, 209, 0.16), transparent 26%),
        radial-gradient(circle at 92% 14%, rgba(255, 122, 0, 0.14), transparent 18%),
        linear-gradient(180deg, #fefbf2 0%, #f6f4ec 48%, #eef3ff 100%);
}

.container {
    width: min(980px, calc(100% - 32px));
    margin: 0 auto;
    padding: 34px 0 44px;
}

.header {
    position: relative;
    overflow: hidden;
    margin-bottom: 26px;
    padding: 34px 30px;
    border: 3px solid var(--line-strong);
    border-radius: 28px;
    color: #ffffff;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.12), transparent 32%),
        linear-gradient(135deg, #16308f 0%, #2953e6 56%, #ff7a00 100%);
    box-shadow: var(--shadow-card);
}

.header::before {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--paper-grid);
    background-size: 22px 22px;
    opacity: 0.18;
    pointer-events: none;
}

.header::after {
    content: "";
    position: absolute;
    right: -26px;
    top: -18px;
    width: 170px;
    height: 170px;
    border: 3px solid rgba(255, 255, 255, 0.26);
    border-radius: 28px;
    transform: rotate(18deg);
}

.logo,
.subtitle {
    position: relative;
    z-index: 1;
}

.logo {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    border: 2px solid rgba(255, 255, 255, 0.24);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.14);
    font-size: 30px;
}

.logo h1 {
    margin: 0;
    font-size: clamp(28px, 4vw, 42px);
    font-weight: 800;
    letter-spacing: 0.02em;
}

.subtitle {
    max-width: 620px;
    margin: 14px 0 0;
    font-size: 16px;
    line-height: 1.85;
    color: rgba(255, 255, 255, 0.94);
}

.main-content {
    display: grid;
    gap: 24px;
}

.input-card,
.result-card {
    position: relative;
    overflow: hidden;
    border: 3px solid var(--line-strong);
    border-radius: 26px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(252, 252, 255, 0.96)),
        var(--panel);
    box-shadow: var(--shadow-paper);
}

.input-card {
    padding: 28px;
}

.result-card {
    padding: 28px;
}

.input-card::before,
.result-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: var(--paper-grid);
    background-size: 26px 26px;
    opacity: 0.08;
    pointer-events: none;
}

.input-card > *,
.result-card > * {
    position: relative;
    z-index: 1;
}

.input-card h2,
.result-header h2 {
    margin: 0 0 18px;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: 0.01em;
}

.field-label {
    display: block;
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--brand-deep);
}

.question-input {
    width: 100%;
    min-height: 150px;
    padding: 18px 18px 18px 20px;
    border: 2px solid #cfd8ea;
    border-radius: 18px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(245, 248, 255, 0.95));
    font: inherit;
    font-size: 15px;
    line-height: 1.9;
    color: var(--ink);
    resize: vertical;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.question-input:focus {
    outline: none;
    border-color: rgba(35, 71, 209, 0.86);
    box-shadow: 0 0 0 5px rgba(35, 71, 209, 0.12);
    transform: translateY(-1px);
}

.upload-group {
    margin-top: 18px;
}

.upload-area {
    border: 2px dashed rgba(35, 71, 209, 0.48);
    border-radius: 18px;
    background:
        linear-gradient(135deg, rgba(35, 71, 209, 0.06), rgba(255, 122, 0, 0.04)),
        #fbfcff;
    transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

.upload-area.dragover {
    border-color: var(--brand);
    background:
        linear-gradient(135deg, rgba(35, 71, 209, 0.12), rgba(255, 122, 0, 0.08)),
        #eef4ff;
    transform: translateY(-1px);
}

.upload-trigger {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 154px;
    padding: 22px;
    cursor: pointer;
    text-align: center;
}

.upload-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 16px;
    background: rgba(35, 71, 209, 0.1);
    font-size: 28px;
}

.upload-title {
    font-size: 19px;
    font-weight: 800;
    color: var(--ink);
}

.upload-text {
    color: var(--ink-soft);
    font-size: 14px;
}

.image-preview {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 16px;
    align-items: center;
    margin-top: 14px;
    padding: 16px;
    border: 2px solid #d8e0ef;
    border-radius: 18px;
    background: #fbfcff;
}

.image-preview[hidden] {
    display: none;
}

.image-preview img {
    width: 100%;
    height: 106px;
    object-fit: cover;
    border-radius: 14px;
    border: 2px solid #d8e0ef;
    background: #ffffff;
}

.image-preview-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.image-name {
    margin: 0;
    font-weight: 700;
    word-break: break-all;
}

.remove-btn,
.submit-btn,
.download-btn {
    border: 2px solid transparent;
    border-radius: 14px;
    font: inherit;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease, background-color 0.18s ease;
}

.remove-btn {
    align-self: flex-start;
    padding: 10px 14px;
    border-color: #f0b6af;
    background: rgba(185, 56, 47, 0.08);
    color: var(--danger);
}

.submit-btn {
    width: 100%;
    margin-top: 18px;
    padding: 16px 18px;
    border-color: var(--line-strong);
    background:
        linear-gradient(135deg, #16308f 0%, #2347d1 56%, #ff7a00 100%);
    color: #ffffff;
    font-size: 17px;
    font-weight: 800;
    letter-spacing: 0.04em;
    box-shadow: 0 12px 28px rgba(35, 71, 209, 0.24);
}

.download-btn {
    padding: 10px 14px;
    border-color: #d2d9e6;
    background: #f4f6fb;
    color: var(--ink);
    font-weight: 700;
}

.download-btn.primary {
    border-color: var(--brand);
    background: linear-gradient(135deg, #2347d1, #4168ff);
    color: #ffffff;
}

.submit-btn:hover,
.download-btn:hover,
.remove-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 22px rgba(17, 27, 56, 0.12);
}

.submit-btn:disabled,
.download-btn:disabled,
.remove-btn:disabled {
    opacity: 0.58;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.result-section {
    scroll-margin-top: 96px;
}

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

.header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.loading-indicator {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
    padding: 16px 18px;
    border: 2px solid #d7e1f5;
    border-radius: 16px;
    background:
        linear-gradient(135deg, rgba(35, 71, 209, 0.08), rgba(255, 122, 0, 0.06)),
        #f8fbff;
}

.loading-indicator[hidden] {
    display: none;
}

.spinner {
    width: 30px;
    height: 30px;
    border: 3px solid rgba(35, 71, 209, 0.16);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.result-placeholder {
    position: relative;
    padding: 24px 22px 24px 26px;
    border: 2px dashed #c7d2eb;
    border-radius: 20px;
    color: var(--ink-soft);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 255, 0.98));
    line-height: 1.9;
}

.result-placeholder::before {
    content: "讲义预览";
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    margin-bottom: 12px;
    padding: 4px 10px;
    border: 2px solid var(--brand);
    border-radius: 999px;
    background: var(--brand-light);
    color: var(--brand-deep);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.result-placeholder[hidden] {
    display: none;
}

.result-content {
    display: grid;
    gap: 16px;
    color: var(--ink);
    line-height: 1.92;
}

.result-content[hidden] {
    display: none;
}

.result-content p {
    margin: 0;
    font-size: 15px;
}

.result-content h3,
.result-content h4 {
    margin: 0;
}

.note-section {
    position: relative;
    overflow: hidden;
    padding: 18px 18px 20px;
    border: 2px solid #d8deec;
    border-radius: 24px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(250, 251, 255, 0.98));
    box-shadow: 0 10px 24px rgba(16, 26, 51, 0.08);
}

.note-section::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: var(--paper-grid);
    background-size: 24px 24px;
    opacity: 0.08;
    pointer-events: none;
}

.note-section::after {
    content: "";
    position: absolute;
    right: 16px;
    top: 16px;
    width: 18px;
    height: 18px;
    border-top: 3px solid rgba(35, 71, 209, 0.18);
    border-right: 3px solid rgba(35, 71, 209, 0.18);
}

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

.note-section--summary {
    border-color: rgba(35, 71, 209, 0.28);
    background:
        linear-gradient(135deg, rgba(35, 71, 209, 0.12), rgba(255, 255, 255, 0.98) 58%),
        #ffffff;
}

.note-section--core {
    border-color: rgba(35, 71, 209, 0.3);
    background:
        linear-gradient(135deg, rgba(35, 71, 209, 0.1), rgba(131, 162, 255, 0.08) 56%, rgba(255, 255, 255, 0.98) 100%),
        #ffffff;
}

.note-section--logic {
    border-color: rgba(111, 53, 211, 0.26);
    background:
        linear-gradient(135deg, rgba(111, 53, 211, 0.08), rgba(255, 255, 255, 0.98) 56%),
        #ffffff;
}

.note-section--example {
    border-color: rgba(44, 139, 87, 0.3);
    background:
        linear-gradient(135deg, rgba(44, 139, 87, 0.09), rgba(255, 255, 255, 0.98) 56%),
        #ffffff;
}

.note-section--warning {
    border-color: rgba(217, 119, 6, 0.3);
    background:
        linear-gradient(135deg, rgba(255, 122, 0, 0.09), rgba(255, 255, 255, 0.98) 56%),
        #ffffff;
}

.note-section--compare {
    border-color: rgba(33, 114, 196, 0.28);
    background:
        linear-gradient(135deg, rgba(33, 114, 196, 0.09), rgba(255, 255, 255, 0.98) 56%),
        #ffffff;
}

.note-section--quiz {
    border-color: rgba(12, 146, 110, 0.28);
    background:
        linear-gradient(135deg, rgba(12, 146, 110, 0.1), rgba(255, 255, 255, 0.98) 56%),
        #ffffff;
}

.note-section--extend {
    border-color: rgba(185, 56, 47, 0.24);
    background:
        linear-gradient(135deg, rgba(255, 122, 0, 0.08), rgba(255, 233, 208, 0.18) 48%, rgba(255, 255, 255, 0.98) 100%),
        #ffffff;
}

.note-section--plain {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(252, 252, 255, 0.98));
}

.note-section--minor {
    padding-top: 20px;
}

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

.section-kicker,
.section-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.section-kicker {
    border: 2px solid rgba(35, 71, 209, 0.16);
    background: rgba(35, 71, 209, 0.08);
    color: var(--brand-deep);
}

.section-mark {
    min-width: 54px;
    border: 2px solid rgba(24, 33, 47, 0.16);
    background: rgba(24, 33, 47, 0.04);
    color: var(--ink-soft);
}

.section-heading {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.section-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: 2px solid rgba(35, 71, 209, 0.14);
    border-radius: 14px;
    background: rgba(35, 71, 209, 0.08);
    font-size: 22px;
}

.section-heading h3 {
    font-size: 24px;
    font-weight: 800;
    line-height: 1.3;
    color: var(--ink);
}

.section-heading h3::after {
    content: "";
    display: block;
    width: 72px;
    height: 6px;
    margin-top: 8px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--brand), rgba(255, 122, 0, 0.96));
}

.section-body {
    display: grid;
    gap: 14px;
}

.note-section--minor .section-body {
    gap: 12px;
}

.result-content h4 {
    display: inline-block;
    padding: 0 2px 3px;
    font-size: 18px;
    font-weight: 800;
    color: var(--brand-deep);
    border-bottom: 3px solid rgba(255, 122, 0, 0.42);
}

.result-content strong {
    padding: 0 3px;
    color: var(--brand-deep);
    background:
        linear-gradient(transparent 58%, rgba(255, 224, 165, 0.72) 58%, rgba(255, 224, 165, 0.72) 100%);
}

.result-content em {
    color: #7a3d00;
    font-style: normal;
    font-weight: 700;
}

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

.bullet-list li {
    position: relative;
    padding: 12px 14px 12px 42px;
    border: 1px solid rgba(35, 71, 209, 0.12);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.86);
}

.bullet-list li::before {
    content: "✦";
    position: absolute;
    left: 14px;
    top: 12px;
    color: var(--accent);
    font-size: 16px;
    font-weight: 800;
}

.knowledge-card,
.highlight-box,
.example-box,
.formula-box,
.callout-box {
    position: relative;
    margin: 0;
    padding: 18px 18px 18px 20px;
    border-radius: 18px;
}

.knowledge-card {
    border: 2px solid rgba(35, 71, 209, 0.22);
    background:
        linear-gradient(135deg, rgba(220, 231, 255, 0.8), rgba(255, 255, 255, 0.98) 58%),
        #ffffff;
}

.highlight-box,
.callout-box {
    border: 2px solid rgba(217, 119, 6, 0.24);
    background:
        linear-gradient(135deg, rgba(255, 243, 216, 0.92), rgba(255, 255, 255, 0.98) 62%),
        #ffffff;
}

.example-box {
    border: 2px solid rgba(44, 139, 87, 0.22);
    background:
        linear-gradient(135deg, rgba(232, 247, 239, 0.92), rgba(255, 255, 255, 0.98) 62%),
        #ffffff;
}

.knowledge-card::before,
.highlight-box::before,
.example-box::before,
.callout-box::before {
    content: "";
    position: absolute;
    left: 0;
    top: 16px;
    bottom: 16px;
    width: 6px;
    border-radius: 999px;
}

.knowledge-card::before {
    background: linear-gradient(180deg, var(--brand), #6f35d3);
}

.highlight-box::before,
.callout-box::before {
    background: linear-gradient(180deg, var(--warn), var(--accent));
}

.example-box::before {
    background: linear-gradient(180deg, #2c8b57, #0c926e);
}

.knowledge-card-title,
.highlight-box-title,
.example-box-title,
.callout-title {
    margin: 0 0 10px;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: var(--ink-soft);
}

.formula-box {
    border: 2px dashed rgba(111, 53, 211, 0.5);
    background:
        linear-gradient(135deg, rgba(239, 230, 255, 0.92), rgba(255, 255, 255, 0.98) 62%),
        #ffffff;
    color: var(--formula);
    font-size: 18px;
    font-weight: 800;
    text-align: center;
}

.step-list {
    display: grid;
    gap: 12px;
    margin: 0;
}

.step-card {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
    padding: 16px 18px;
    border: 2px solid rgba(24, 33, 47, 0.1);
    border-radius: 16px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 255, 0.96));
}

.step-card:hover {
    transform: translateX(2px);
}

.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand), #4168ff);
    color: #ffffff;
    font-weight: 800;
    box-shadow: 0 8px 16px rgba(35, 71, 209, 0.2);
}

.result-content pre {
    margin: 0;
    padding: 18px;
    border: 2px solid rgba(17, 27, 56, 0.08);
    border-radius: 18px;
    background: #1b2130;
    color: #f8f8f2;
    overflow-x: auto;
}

.result-content code {
    padding: 2px 7px;
    border-radius: 8px;
    background: rgba(255, 240, 218, 0.9);
    color: #945200;
    font-weight: 700;
}

.footer {
    margin-top: 24px;
    text-align: center;
    color: var(--ink-soft);
    font-size: 14px;
}

.export-sheet {
    padding: 24px;
    background: #ffffff;
    color: var(--ink);
}

.export-sheet .export-header {
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 2px solid #e3e8f4;
}

.export-sheet .export-header h1 {
    margin: 0 0 8px;
    font-size: 26px;
}

.export-sheet .export-meta {
    margin: 0;
    color: var(--ink-soft);
    font-size: 14px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 768px) {
    .container {
        width: min(100%, calc(100% - 20px));
        padding: 22px 0 28px;
    }

    .header,
    .input-card,
    .result-card {
        padding: 20px;
    }

    .logo {
        align-items: flex-start;
    }

    .logo-icon {
        width: 50px;
        height: 50px;
        font-size: 26px;
    }

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

    .header-actions {
        width: 100%;
    }

    .download-btn {
        flex: 1 1 100%;
    }

    .image-preview {
        grid-template-columns: 1fr;
    }

    .section-topline,
    .section-heading {
        align-items: flex-start;
    }

    .section-heading {
        flex-direction: column;
    }

    .section-heading h3 {
        font-size: 22px;
    }

    .step-card {
        grid-template-columns: 1fr;
    }
}
