* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: system-ui, "Microsoft YaHei", "思源黑体", sans-serif;
}

:root {
    --brand-red: #c0392b;
    --brand-orange: #e67e22;
    --brand-deep: #8b3c2a;
    --brand-soft: #fff5f0;
    --brand-panel: #fffaf7;
    --brand-border: #ffd9ca;
    --brand-muted: #b85c3a;
    --ink: #2f2f2f;
    --muted: #6f6f6f;
    --success: #1f8a5b;
    --danger: #c7362b;
    --white: #ffffff;
    --shadow: 0 16px 36px -28px rgba(160, 64, 40, 0.65);
}

body {
    min-height: 100vh;
    color: var(--ink);
    background:
        radial-gradient(circle at 8% 12%, rgba(230, 126, 34, 0.12), transparent 30%),
        linear-gradient(135deg, #fff6f1 0%, #fffaf7 46%, #fff0e9 100%);
}

button,
input,
textarea,
select {
    font: inherit;
}

button {
    border: none;
}

.page-shell {
    max-width: 1380px;
    margin: 0 auto;
    padding: 22px;
}

.auth-container {
    max-width: 520px;
    margin: 10vh auto;
    padding: 34px 30px;
    text-align: center;
    background: linear-gradient(#fff, #fff) padding-box,
        linear-gradient(135deg, var(--brand-red), var(--brand-orange)) border-box;
    border: 2px solid transparent;
    border-radius: 30px;
    box-shadow: 0 28px 50px -34px rgba(139, 60, 42, 0.9);
}

.auth-container h2 {
    margin-bottom: 18px;
    color: var(--brand-deep);
    font-size: 1.55rem;
}

.auth-note,
.stem-note,
.small-note {
    color: var(--brand-muted);
    font-size: 0.9rem;
    line-height: 1.7;
}

.auth-input,
.form-input,
.form-select,
.blank-input,
.textarea-input {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid #efcabb;
    border-radius: 18px;
    color: var(--brand-deep);
    background: #fff;
    outline: none;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.auth-input {
    margin: 9px 0;
    border-radius: 24px;
}

.auth-input:focus,
.form-input:focus,
.form-select:focus,
.blank-input:focus,
.textarea-input:focus {
    border-color: var(--brand-orange);
    background: #fffdfb;
    box-shadow: 0 0 0 3px rgba(230, 126, 34, 0.16);
}

.primary-btn,
.submit-btn,
.app-topbar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 22px;
    color: #fff;
    font-weight: 800;
    cursor: pointer;
    border-radius: 24px;
    background: linear-gradient(135deg, var(--brand-red), var(--brand-orange));
    box-shadow: 0 10px 18px -16px rgba(139, 60, 42, 0.9);
    transition: transform 0.15s ease, filter 0.15s ease;
}

.primary-btn {
    width: 100%;
    margin-top: 14px;
    padding: 12px 24px;
}

.primary-btn:hover,
.submit-btn:hover,
.app-topbar-btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.04);
}

.plain-btn {
    padding: 8px 16px;
    border: 1px solid var(--brand-border);
    border-radius: 20px;
    color: var(--brand-deep);
    background: #fff7f2;
    cursor: pointer;
    font-weight: 700;
}

.danger-btn {
    background: linear-gradient(135deg, #b72c24, #d65b3d);
}

.app-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 20px;
    padding: 12px 20px;
    border: 1px solid var(--brand-border);
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: var(--shadow);
}

.app-topbar-title {
    color: var(--brand-deep);
    font-size: 1.1rem;
    font-weight: 900;
}

.topbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.hero-card,
.module-card,
.question-card,
.panel-card {
    border: 1px solid var(--brand-border);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: var(--shadow);
}

.hero-card {
    margin-bottom: 20px;
    padding: 26px 28px;
    border-radius: 30px;
    color: #fff;
    background: linear-gradient(120deg, #963221, #c94a1d);
}

.hero-card h1 {
    font-size: 1.95rem;
}

.hero-card p {
    margin-top: 8px;
    opacity: 0.92;
    line-height: 1.8;
}

.info-bar,
.stats-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.info-chip,
.stat-card {
    border: 1px solid var(--brand-border);
    border-radius: 22px;
    background: #fffaf7;
    color: var(--brand-deep);
}

.info-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-weight: 700;
}

.info-chip span {
    color: var(--brand-muted);
}

.module-card {
    margin-bottom: 24px;
    padding: 22px;
    border-radius: 28px;
}

.module-title {
    margin-bottom: 16px;
    padding-left: 14px;
    border-left: 7px solid var(--brand-orange);
    color: var(--brand-deep);
    font-size: 1.35rem;
}

.question-card {
    margin: 16px 0;
    padding: 18px;
    border-radius: 24px;
    background: linear-gradient(180deg, #fff 0%, #fffaf7 100%);
}

.question-stem {
    margin-bottom: 12px;
    color: #b6492a;
    font-size: 1.05rem;
    font-weight: 900;
    line-height: 1.7;
}

.fill-sheet {
    display: grid;
    gap: 12px;
}

.fill-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 15px 17px;
    border: 1px solid var(--brand-border);
    border-radius: 22px;
    background: linear-gradient(180deg, #fffaf7 0%, #fff4ee 100%);
}

.fill-index {
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 900;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-orange), #d35400);
}

.fill-content {
    flex: 1;
    color: var(--brand-deep);
    line-height: 2.35;
    font-weight: 750;
}

input.inline-blank {
    display: inline-block;
    width: 150px;
    max-width: 100%;
    margin: 0 6px;
    padding: 8px 14px;
    border: 1.5px solid #efcabb;
    border-radius: 18px;
    color: var(--brand-deep);
    background: #fff;
    font-weight: 800;
    text-align: center;
    vertical-align: middle;
}

input.inline-blank.xs { width: 100px; }
input.inline-blank.sm { width: 130px; }
input.inline-blank.md { width: 180px; }
input.inline-blank.lg { width: 240px; }
input.inline-blank.xl { width: 320px; }

input.inline-blank::placeholder,
.textarea-input::placeholder {
    color: #777;
    opacity: 1;
    font-weight: 650;
}

.textarea-input {
    display: block;
    min-height: 86px;
    line-height: 1.7;
    resize: vertical;
}

.answer-textarea {
    margin-top: 10px;
}

.fill-action {
    display: flex;
    justify-content: flex-end;
    margin-top: 12px;
}

.ai-feedback {
    display: none;
    margin-top: 14px;
    padding: 12px 16px;
    border-left: 4px solid var(--brand-orange);
    border-radius: 18px;
    color: var(--brand-deep);
    background: #fff5ee;
    line-height: 1.75;
}

.upload-box {
    margin-top: 10px;
    padding: 12px;
    border: 1px dashed #e0a985;
    border-radius: 18px;
    background: #fffaf5;
}

.upload-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.photo-preview-grid,
.answer-photos {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.photo-preview-thumb,
.answer-photo {
    width: 90px;
    height: 90px;
    object-fit: cover;
    border: 2px solid #fff;
    border-radius: 16px;
    box-shadow: 0 6px 16px -12px rgba(0, 0, 0, 0.7);
}

.toast {
    position: fixed;
    top: 18px;
    left: 50%;
    z-index: 2000;
    padding: 11px 18px;
    color: #fff;
    font-weight: 800;
    border-radius: 999px;
    background: linear-gradient(135deg, #1f8a5b, #2ab27b);
    box-shadow: 0 16px 28px -20px rgba(0, 0, 0, 0.65);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -12px);
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

.error-msg {
    min-height: 22px;
    margin-top: 8px;
    color: var(--danger);
    font-size: 0.9rem;
}

.stat-card {
    flex: 1 1 180px;
    padding: 16px;
}

.stat-value {
    color: var(--brand-red);
    font-size: 1.85rem;
    font-weight: 900;
}

.stat-label {
    color: var(--brand-muted);
    font-weight: 700;
}

.empty-state {
    padding: 32px;
    text-align: center;
    color: var(--muted);
    border: 1px dashed var(--brand-border);
    border-radius: 22px;
    background: #fffaf7;
}

@media (max-width: 760px) {
    .page-shell {
        padding: 12px;
    }

    .app-topbar {
        align-items: flex-start;
        flex-direction: column;
        border-radius: 22px;
    }

    .hero-card,
    .module-card,
    .question-card {
        border-radius: 22px;
        padding: 16px;
    }

    .fill-item {
        gap: 10px;
        padding: 12px;
    }

    .fill-content {
        line-height: 2.5;
    }

    input.inline-blank,
    input.inline-blank.xs,
    input.inline-blank.sm,
    input.inline-blank.md,
    input.inline-blank.lg,
    input.inline-blank.xl {
        width: min(100%, 220px);
    }

    .fill-action {
        justify-content: flex-start;
    }
}
