/* ========== AI 综述生成 · 对齐模板设计语言 ========== */
:root {
    --brand: #2f6bff;
    --brand-dark: #1f56e0;
    --brand-light: #eef4ff;
    --card: #ffffff;
    --text: #1c2433;
    --text-2: #5c6678;
    --text-3: #97a0b3;
    --border: #e6ebf4;
    --shadow-card: 0 8px 30px rgba(31, 66, 138, 0.08);
    --radius: 18px;
}

/* ---------- 顶部横幅 ---------- */
.banner-section {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    padding: 26px 28px;
    text-align: center;
    margin-bottom: 18px;
}
.banner-title {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: .5px;
}
.banner-features {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 12px;
}
.feature-item {
    background: var(--brand-light);
    color: var(--brand);
    font-size: 13px;
    font-weight: 600;
    padding: 5px 14px;
    border-radius: 999px;
}
.feature-divider { color: var(--text-3); }
.banner-stats {
    margin-top: 14px;
    font-size: 15px;
    font-weight: 600;
    color: var(--brand);
}
.banner-stats strong {
    font-size: 24px;
    margin: 0 3px;
    color: var(--brand);
}
.banner-stats a {
    color: var(--brand);
    text-decoration: none;
    border-bottom: 1px dashed rgba(47, 107, 255, .5);
    margin-left: 4px;
}
.banner-stats a:hover {
    color: var(--brand-dark);
    border-bottom-style: solid;
}

/* ---------- 步骤说明 ---------- */
.steps-section { margin-bottom: 18px; }
.steps-container {
    display: flex;
    align-items: stretch;
    gap: 12px;
    counter-reset: step;
}
.step-card {
    flex: 1;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px 16px 16px;
    text-align: center;
    counter-increment: step;
    transition: transform .2s, box-shadow .2s, border-color .2s;
}
.step-card:hover {
    transform: translateY(-3px);
    border-color: rgba(47, 107, 255, .35);
    box-shadow: var(--shadow-card);
}
.step-card::before {
    content: counter(step);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    margin-bottom: 10px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand), var(--brand-dark));
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    box-shadow: 0 4px 10px rgba(47, 107, 255, .3);
}
.step-title {
    font-size: 14.5px;
    font-weight: 700;
    margin-bottom: 6px;
}
.step-desc {
    font-size: 12.5px;
    color: var(--text-2);
    line-height: 1.6;
}
.step-arrow {
    align-self: center;
    color: var(--text-3);
    font-size: 18px;
    flex-shrink: 0;
}

/* ---------- 主工作区 ---------- */
.app-container {
    display: grid;
    grid-template-columns: minmax(340px, 400px) 1fr;
    gap: 18px;
    align-items: stretch;
}
.input-panel,
.result-panel {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}
.result-panel { min-height: 460px; }

.panel-header {
    display: flex;
    align-items: center;
    min-height: 56px;
    padding: 8px 22px;
    box-sizing: border-box;
    background: var(--brand-light);
    border-bottom: 1px solid var(--border);
}
.panel-title {
    font-size: 15.5px;
    font-weight: 700;
    padding-left: 10px;
    border-left: 3px solid var(--brand);
    line-height: 1.3;
}

/* ---------- 表单 ---------- */
.input-content { padding: 22px; }

.form-group { margin-bottom: 18px; }
.form-group:last-of-type { margin-bottom: 0; }
.form-label {
    display: block;
    font-size: 13.5px;
    font-weight: 600;
    margin-bottom: 8px;
}
.required {
    color: #e5484d;
    margin-right: 2px;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    background: #fff;
    padding: 10px 13px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}
.form-input::placeholder,
.form-textarea::placeholder { color: var(--text-3); }
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(47, 107, 255, .1);
}
.form-select:disabled {
    background: #f6f8fc;
    color: var(--text-3);
    cursor: not-allowed;
}
.form-textarea {
    min-height: 150px;
    resize: vertical;
    line-height: 1.65;
}

.subject-selector {
    display: grid;
    gap: 10px;
}

.paper-tip {
    margin-top: 8px;
    font-size: 12.5px;
}
.paper-tip a {
    color: var(--brand);
    text-decoration: none;
}
.paper-tip a:hover { text-decoration: underline; }

/* ---------- 语言 / 模式选择 ---------- */
.language-selector {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.lang-btn,
.mode-btn {
    border: 1.5px solid var(--border);
    background: #fff;
    color: var(--text-2);
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: all .15s;
}
.lang-btn {
    padding: 7px 18px;
    border-radius: 999px;
}
.mode-btn {
    padding: 9px 12px;
    border-radius: 10px;
}
.lang-btn:hover,
.mode-btn:hover {
    border-color: var(--brand);
    color: var(--brand);
}
.lang-btn.active,
.mode-btn.active {
    background: linear-gradient(135deg, var(--brand), var(--brand-dark));
    border-color: transparent;
    color: #fff;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(47, 107, 255, .3);
}
.mode-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* ---------- 温馨提示 ---------- */
.tips-box {
    background: var(--brand-light);
    border: 1px solid rgba(47, 107, 255, .18);
    border-radius: 12px;
    padding: 14px 16px;
    margin-top: 18px;
}
.tips-title {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--brand);
    margin-bottom: 8px;
}
.tips-list {
    padding-left: 18px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 12.5px;
    color: var(--text-2);
    line-height: 1.6;
}
.tips-list a {
    color: var(--brand);
    text-decoration: none;
}
.tips-list a:hover { text-decoration: underline; }

/* ---------- 提交按钮 ---------- */
.btn-submit {
    width: 100%;
    margin-top: 18px;
    border: none;
    border-radius: 12px;
    padding: 13px;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    color: #fff;
    background: linear-gradient(135deg, var(--brand), var(--brand-dark));
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(47, 107, 255, .3);
    transition: filter .2s, transform .15s, box-shadow .2s;
}
.btn-submit:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
}
.btn-submit.disabled {
    opacity: .6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    filter: none;
}

/* ---------- 兑换码弹窗 ---------- */
.code-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    padding: 8vh 16px 40px;
    overflow-y: auto;
}
.code-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(23, 32, 55, .55);
    backdrop-filter: blur(2px);
}
.code-modal-content {
    position: relative;
    max-width: 400px;
    margin: 0 auto;
    background: var(--card);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(23, 32, 55, .3);
    overflow: hidden;
    animation: modalIn .25s ease;
}
@keyframes modalIn {
    from { opacity: 0; transform: translateY(14px); }
}
.code-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--brand-light);
    border-bottom: 1px solid var(--border);
}
.code-modal-header h3 {
    font-size: 15.5px;
    font-weight: 700;
    padding-left: 10px;
    border-left: 3px solid var(--brand);
    line-height: 1.3;
}
.code-modal-close {
    border: none;
    background: none;
    font-size: 22px;
    line-height: 1;
    color: var(--text-3);
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 8px;
    transition: color .15s, background .15s;
}
.code-modal-close:hover {
    color: var(--text);
    background: rgba(47, 107, 255, .08);
}
.code-modal-body { padding: 18px 20px; }
.code-modal-desc {
    font-size: 13px;
    color: var(--text-2);
    margin-bottom: 14px;
}
.code-form-group input {
    width: 100%;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    padding: 11px 13px;
    font-size: 15px;
    letter-spacing: 2px;
    font-family: inherit;
    color: var(--text);
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}
.code-form-group input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(47, 107, 255, .1);
}
.code-error {
    min-height: 18px;
    margin-top: 8px;
    font-size: 12.5px;
    color: #e5484d;
}
.code-modal-body > a {
    display: inline-block;
    font-size: 12.5px;
    color: var(--brand);
    text-decoration: none;
}
.code-modal-body > a:hover { text-decoration: underline; }
.code-wechat {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px dashed var(--border);
    text-align: center;
}
.code-wechat-qrcode img {
    width: 130px;
    height: 130px;
    border-radius: 10px;
    border: 1px solid var(--border);
}
.code-wechat-text {
    margin-top: 10px;
    font-size: 13px;
    color: var(--text-2);
    line-height: 1.7;
}
.code-wechat-price {
    font-weight: 700;
    color: var(--brand);
}
.code-modal-footer {
    display: flex;
    gap: 10px;
    padding: 14px 20px 18px;
}
.code-btn {
    flex: 1;
    border: none;
    border-radius: 10px;
    padding: 11px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: filter .15s, background .15s;
}
.code-btn-primary {
    background: linear-gradient(135deg, var(--brand), var(--brand-dark));
    color: #fff;
    box-shadow: 0 4px 12px rgba(47, 107, 255, .3);
}
.code-btn-secondary {
    background: #f1f4fb;
    color: var(--text-2);
}
.code-btn:hover { filter: brightness(1.05); }
.code-btn-secondary:hover {
    background: #e7ecf7;
    filter: none;
}

/* ---------- 结果面板 ---------- */
.result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: nowrap;
    min-height: 56px;
    padding: 8px 22px;
    box-sizing: border-box;
    background: var(--brand-light);
    border-bottom: 1px solid var(--border);
}
.result-title-section {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex: 1;
    min-width: 0;
}
.result-label {
    font-size: 15.5px;
    font-weight: 700;
    padding-left: 10px;
    border-left: 3px solid var(--brand);
    line-height: 1.3;
    white-space: nowrap;
}
.result-time {
    font-size: 12px;
    color: var(--text-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.result-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}
.btn-action {
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 9px;
    padding: 7px 14px;
    font-size: 12.5px;
    font-family: inherit;
    color: var(--text-2);
    cursor: pointer;
    transition: all .15s;
}
.btn-action:hover {
    border-color: var(--brand);
    color: var(--brand);
    background: var(--brand-light);
}

/* ---------- 加载状态（display:flex 由 script.js 内联设置） ---------- */
.loading-container {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 30px;
    text-align: center;
}
.loading-spinner {
    width: 44px;
    height: 44px;
    border: 3.5px solid var(--brand-light);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text {
    margin-top: 18px;
    font-size: 15px;
    font-weight: 700;
}
.loading-subtext {
    margin-top: 8px;
    font-size: 12.5px;
    color: var(--text-2);
}
.loading-steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px 10px;
    max-width: 430px;
    margin: 26px auto 0;
}
.step-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    font-size: 12.5px;
    color: var(--text-3);
    transition: color .2s;
}
.step-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border);
    flex-shrink: 0;
    transition: background .2s, box-shadow .2s;
}
.step-item.active {
    color: var(--brand);
    font-weight: 600;
}
.step-item.active .step-dot {
    background: var(--brand);
    box-shadow: 0 0 0 4px rgba(47, 107, 255, .15);
}

/* ---------- 生成结果 ---------- */
.result-content { padding: 22px; }
.result-section-content { margin-bottom: 26px; }
.result-section-content:last-child { margin-bottom: 0; }
.result-section-content > h2 {
    font-size: 16.5px;
    font-weight: 700;
    padding-left: 10px;
    border-left: 3px solid var(--brand);
    margin-bottom: 14px;
}
.content-text {
    font-size: 14px;
    line-height: 1.9;
    color: var(--text-2);
    word-break: break-word;
}
.content-text h2 {
    font-size: 16.5px;
    color: var(--text);
    margin: 20px 0 10px;
    padding-left: 10px;
    border-left: 3px solid var(--brand);
}
.content-text h3 {
    font-size: 15px;
    color: var(--text);
    margin: 16px 0 8px;
}
.content-text h4 {
    font-size: 14px;
    color: var(--text);
    margin: 14px 0 6px;
}
.content-text p { margin-bottom: 10px; }

.reference-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.reference-item {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 13px 16px;
    transition: border-color .2s, box-shadow .2s;
}
.reference-item:hover {
    border-color: rgba(47, 107, 255, .3);
    box-shadow: var(--shadow-card);
}
.reference-title {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.5;
    margin-bottom: 6px;
}
.reference-citation {
    font-size: 12.5px;
    color: var(--text-2);
    line-height: 1.6;
}

/* ---------- 错误提示 ---------- */
.error-container { padding: 22px; }
.error-card {
    display: flex;
    gap: 14px;
    background: #fff5f5;
    border: 1px solid #ffdfdf;
    border-radius: 14px;
    padding: 18px 20px;
}
.error-icon {
    font-size: 22px;
    line-height: 1.4;
}
.error-content h3 {
    font-size: 15px;
    color: #d64545;
    margin-bottom: 6px;
}
.error-content p {
    font-size: 13px;
    color: var(--text-2);
    line-height: 1.7;
}
.error-details {
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-3);
    word-break: break-all;
}

/* ---------- 底部说明卡片 ---------- */
.bottom-cards-section { margin-top: 18px; }
.cards-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}
.card-item {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    padding: 20px 18px;
    text-align: center;
    transition: transform .2s, border-color .2s;
}
.card-item:hover {
    transform: translateY(-3px);
    border-color: rgba(47, 107, 255, .35);
}
.card-title {
    font-size: 14.5px;
    font-weight: 700;
    margin-bottom: 8px;
}
.card-desc {
    font-size: 12.5px;
    color: var(--text-2);
    line-height: 1.7;
}

/* ---------- Toast（script.js 动态创建，内联样式为主） ---------- */
@keyframes slideIn {
    from { opacity: 0; transform: translateX(24px); }
}
@keyframes slideOut {
    to { opacity: 0; transform: translateX(24px); }
}

/* ---------- 响应式 ---------- */
@media (max-width: 1250px) {
    .result-time { display: none; }
}
@media (max-width: 1100px) {
    .btn-action { padding: 6px 10px; font-size: 12px; }
}
@media (max-width: 900px) {
    .app-container { grid-template-columns: 1fr; }
    .result-panel { min-height: 380px; }
    .cards-container { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
    .banner-section { padding: 22px 16px; }
    .banner-title { font-size: 19px; }
    .steps-container {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }
    .step-arrow { display: none; }
    .input-content { padding: 18px 16px; }
    .panel-header { padding: 8px 16px; }
    .result-header { padding: 8px 16px; }
    .result-content { padding: 16px; }
    .loading-steps { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 420px) {
    .mode-selector { grid-template-columns: 1fr; }
    .cards-container { grid-template-columns: 1fr; }
    .loading-steps { grid-template-columns: 1fr; }
    .result-actions { width: 100%; }
    .btn-action { flex: 1; }
}
