/* ============================================================
   物理模型黑白简笔画生成器 — Style Sheet
   ============================================================ */

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #f2f8f6;
    --surface: #ffffff;
    --border: #d7e7e3;
    --text: #173a36;
    --text-light: #637a76;
    --primary: #087a68;
    --primary-hover: #056353;
    --accent: #159aa6;
    --accent-light: #cceee7;
    --success: #0b927b;
    --radius: 14px;
    --shadow: 0 10px 30px rgba(8, 86, 74, .08);
    --font: 'PingFang SC','Microsoft YaHei','Noto Sans SC',system-ui,-apple-system,sans-serif;
    --font-display: 'Songti SC','STSong','Noto Serif SC',serif;
}

html { font-size: 15px; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* --- Header --- */
header {
    background: linear-gradient(180deg, #fbfaf6 0%, var(--surface) 100%);
    border-bottom: 1px solid var(--border);
    padding: 1.8rem 1rem 1.6rem;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}
header .header-inner { max-width: 1100px; margin: 0 auto; }
header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: .04em;
    color: var(--text);
}
header .icon { font-size: 1.6rem; margin-right: .3rem; }
header .subtitle {
    color: var(--text-light);
    font-size: .93rem;
    margin-top: .3rem;
}

/* --- Main --- */
main {
    flex: 1;
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.5rem 1rem 3rem;
    width: 100%;
}

/* --- Tabs --- */
.tabs {
    display: flex;
    gap: .5rem;
    margin-bottom: 1.5rem;
}
.tab-btn {
    flex: 1;
    padding: .8rem 1.2rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    color: var(--text-light);
    font-family: var(--font);
}
.tab-btn span { margin-right: .4rem; }
.tab-btn:hover { border-color: var(--accent); color: var(--text); }
.tab-btn.active {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

.mode-panel { display: none; }
.mode-panel.active { display: block; }

/* --- Cards --- */
.panel-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.03);
    margin-bottom: 1.2rem;
    overflow: hidden;
    transition: box-shadow .2s;
}
.panel-card:hover {
    box-shadow: 0 2px 6px rgba(0,0,0,0.05), 0 6px 22px rgba(0,0,0,0.05);
}
.panel-row {
    display: flex;
    gap: 1.2rem;
    margin-bottom: 1.2rem;
}
.panel-row .panel-card { margin-bottom: 0; }
.flex-grow { flex: 1; }
.panel-row .panel-card:first-child { width: 280px; flex-shrink: 0; }

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .8rem 1.2rem;
    border-bottom: 1px solid var(--border);
    background: #f4faf8;
}
.card-header h2 { font-size: 1rem; font-weight: 600; }
.card-body { padding: 1.2rem; }

.badge {
    font-size: .75rem;
    padding: .15rem .6rem;
    border-radius: 20px;
    background: var(--accent-light);
    color: var(--text);
    font-weight: 500;
}
.badge-green { background: #d4e8d4; color: #2a5a2a; }

/* --- Text Input --- */
#text-input {
    width: 100%;
    padding: .8rem 1rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: .95rem;
    font-family: var(--font);
    line-height: 1.8;
    resize: vertical;
    transition: border-color .2s;
    background: #f8fcfb;
}
#text-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(21,154,166,.16);
}

.input-actions {
    display: flex;
    gap: .6rem;
    margin-top: .8rem;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .6rem 1.2rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: .9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all .2s;
    font-family: var(--font);
}
.btn span { font-size: 1rem; }
.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:disabled {
    opacity: .5;
    cursor: not-allowed;
}
.btn-secondary {
    background: var(--surface);
    color: var(--text);
}
.btn-secondary:hover { background: #e5f4f0; }
.btn-download {
    background: var(--surface);
    color: var(--text);
    border-color: var(--accent);
    font-size: .82rem;
    padding: .4rem .9rem;
}
.btn-download:hover { background: var(--accent-light); }
.btn-download:disabled {
    opacity: .4;
    cursor: not-allowed;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: .6rem;
}
.ctrl-label {
    font-size: .82rem;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: .3rem;
}
.ctrl-label select {
    padding: .2rem .4rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: var(--font);
    font-size: .82rem;
}

/* --- Scene Tags --- */
.scene-tags {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-bottom: .5rem;
}
.scene-tag {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .3rem .7rem;
    border-radius: 20px;
    background: #dcefeb;
    font-size: .82rem;
    font-weight: 500;
}

/* --- Param Controls --- */
.param-controls { margin-top: .8rem; }
.param-row {
    display: flex;
    align-items: center;
    gap: .6rem;
    margin-bottom: .5rem;
}
.param-row label {
    min-width: 70px;
    font-size: .85rem;
    color: var(--text-light);
}
.param-row input[type="range"] {
    flex: 1;
    max-width: 160px;
    accent-color: var(--primary);
}
.param-row input[type="number"] {
    width: 60px;
    padding: .2rem .3rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: .85rem;
    text-align: center;
    font-family: var(--font);
}
.param-row select {
    padding: .2rem .4rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: var(--font);
    font-size: .85rem;
}
.param-val {
    font-size: .82rem;
    color: var(--text-light);
    min-width: 28px;
}

/* --- Canvas --- */
.canvas-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    background: #fff;
}
.canvas-wrap canvas {
    max-width: 100%;
    height: auto;
    border: 1px solid var(--border);
    border-radius: 4px;
    display: block;
    image-rendering: pixelated;
}
.canvas-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    background: #f4faf8;
    border-radius: 4px;
}
.canvas-placeholder .placeholder-icon {
    font-size: 3rem;
    margin-bottom: .6rem;
    opacity: .5;
}
.canvas-placeholder p {
    text-align: center;
    font-size: .9rem;
    line-height: 1.7;
}

/* --- Generic Placeholder (compose-mode panel) --- */
.placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    color: var(--text-light);
    background: #f4faf8;
    border-radius: 6px;
    border: 1px dashed var(--border);
    text-align: center;
}
.placeholder .placeholder-icon {
    font-size: 3rem;
    margin-bottom: .6rem;
    opacity: .5;
}
.placeholder .placeholder-text {
    font-size: .9rem;
    line-height: 1.7;
    color: var(--text-light);
}

/* --- Compose canvas wrapper --- */
.canvas-wrapper {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: .5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.canvas-wrapper canvas {
    max-width: 100%;
    height: auto;
    display: block;
    image-rendering: pixelated;
}

/* --- Result Tabs --- */
.result-tabs {
    display: flex;
    gap: .3rem;
}
.result-tab {
    padding: .3rem .7rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    font-size: .8rem;
    cursor: pointer;
    transition: all .15s;
    font-family: var(--font);
    color: var(--text-light);
}
.result-tab:hover { border-color: var(--accent); color: var(--text); }
.result-tab.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* --- Prompt Input --- */
#prompt-input {
    width: 100%;
    padding: .6rem .8rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: .85rem;
    font-family: var(--font);
    line-height: 1.7;
    resize: vertical;
    transition: border-color .2s;
    background: #f8fcfb;
}
#prompt-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(21,154,166,.16);
}

/* --- Upload --- */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all .2s;
    position: relative;
}
.upload-area:hover,
.upload-area.dragover {
    border-color: var(--accent);
    background: #fcfaf6;
}
.upload-icon { font-size: 3rem; margin-bottom: .5rem; }
.upload-hint { font-size: .8rem; color: var(--text-light); display: block; margin-top: .2rem; }
.upload-preview {
    max-width: 100%;
    max-height: 300px;
    overflow: hidden;
}
.upload-preview img { max-width: 100%; max-height: 280px; object-fit: contain; }

/* --- Compact upload variant (用于参考文档等次要上传入口) --- */
.upload-area--compact { padding: .6rem .8rem; min-height: 70px; }
.upload-area--compact .upload-icon { font-size: 1.4rem; margin-bottom: .25rem; }
.upload-area--compact p { font-size: .82rem; margin: .15rem 0; }
.upload-area--compact .upload-hint { font-size: .7rem; opacity: .8; margin-top: 0; }
.upload-area--compact .upload-preview { display: flex; align-items: center; }
.upload-area--file {
    border-style: solid;
    border-color: var(--accent);
    background: #fcfaf6;
}

/* --- 参考文档状态文字 --- */
.ref-status {
    font-size: .78rem;
    color: var(--text-light);
    margin-top: .35rem;
    padding-left: .1rem;
    min-height: 1.1em;
}
.ref-status--ok { color: #2a9d6f; }
.ref-status--err { color: #a04040; }

/* --- AI Params Panel (Text Mode AI tab) --- */
.ai-params {
    margin-top: .8rem;
    padding: .8rem 1rem;
    background: #f4faf8;
    border: 1px dashed var(--border);
    border-radius: 6px;
}
.ai-params-title {
    font-size: .85rem;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: .5rem;
}
.ai-params .param-row {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: .4rem;
    flex-wrap: wrap;
}
.ai-params .param-row label {
    min-width: 70px;
    font-size: .82rem;
    color: var(--text-light);
}
.ai-params .param-row input[type="number"] {
    width: 90px;
    padding: .2rem .4rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: .85rem;
    text-align: center;
    font-family: var(--font);
}
.ai-params .param-row input[type="range"] {
    flex: 1;
    min-width: 100px;
    max-width: 200px;
    accent-color: var(--primary);
}
.ai-params .param-row select {
    padding: .25rem .5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: .82rem;
    font-family: var(--font);
    background: #fff;
}
.ai-params .param-hint {
    font-size: .72rem;
    color: var(--text-light);
    margin-left: auto;
}
.ai-params .param-val {
    font-size: .82rem;
    color: var(--text);
    min-width: 28px;
    text-align: right;
}
.btn-mini {
    padding: .15rem .5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--surface);
    font-size: .78rem;
    cursor: pointer;
    color: var(--text-light);
    font-family: var(--font);
    transition: all .15s;
}
.btn-mini:hover {
    background: var(--accent-light);
    color: var(--text);
}

/* --- Compose Original Question Mode --- */
.form-row {
    margin-bottom: .8rem;
}
.form-row label {
    display: block;
    font-size: .85rem;
    font-weight: 500;
    color: var(--text-light);
    margin-bottom: .3rem;
}
.form-row select,
.form-row textarea {
    width: 100%;
    padding: .4rem .5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: .85rem;
    font-family: var(--font);
    background: #fff;
    box-sizing: border-box;
}
.form-row textarea {
    resize: vertical;
    line-height: 1.5;
}
.compose-section {
    margin-bottom: 1rem;
    padding-bottom: .8rem;
    border-bottom: 1px dashed var(--border);
}
.compose-section:last-child {
    border-bottom: none;
}
.compose-label {
    font-size: .9rem;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: .4rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.compose-meta {
    font-size: .72rem;
    color: var(--text-light);
    font-weight: normal;
    background: #e5f4f0;
    padding: .1rem .5rem;
    border-radius: 3px;
}
.compose-question {
    padding: .8rem 1rem;
    background: #f4faf8;
    border-left: 3px solid var(--primary);
    border-radius: 4px;
    font-size: .95rem;
    line-height: 1.8;
    white-space: pre-wrap;
    color: var(--text);
}
.compose-solution {
    padding: .8rem 1rem;
    background: #f4faf8;
    border-left: 3px solid var(--accent);
    border-radius: 4px;
    font-size: .9rem;
    line-height: 1.8;
    white-space: pre-wrap;
    color: var(--text);
    margin-top: .4rem;
}
.compose-answer {
    padding: .6rem 1rem;
    background: #e8f0e8;
    border-left: 3px solid #5a7a5a;
    border-radius: 4px;
    font-size: 1rem;
    line-height: 1.6;
    font-weight: 500;
    color: #2d4a2d;
}
.reason-section {
    margin-bottom: .8rem;
    padding-bottom: .6rem;
    border-bottom: 1px dashed var(--border);
}
.reason-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}
.reason-label {
    font-size: .82rem;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: .25rem;
}
.reason-text {
    font-size: .9rem;
    line-height: 1.7;
    color: var(--text);
    background: #f8fcfb;
    padding: .5rem .7rem;
    border-radius: 4px;
    border-left: 3px solid var(--accent);
}
.reason-answer {
    background: #e8f0e8;
    border-left-color: #5a7a5a;
    font-weight: 500;
}
.reason-visual {
    background: #f5f0e8;
    border-left-color: #159aa6;
    font-style: italic;
}
.reason-chain {
    margin-top: .8rem;
}
.reason-chain summary {
    cursor: pointer;
    font-size: .82rem;
    color: var(--text-light);
    padding: .3rem 0;
    user-select: none;
}
.reason-chain summary:hover {
    color: var(--primary);
}
.reason-chain-pre {
    margin: .3rem 0 0;
    padding: .6rem .8rem;
    background: #f8f8f8;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: .78rem;
    line-height: 1.6;
    color: var(--text-light);
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-wrap;
    font-family: var(--font);
}
.reason-svg-pre {
    margin: .3rem 0 0;
    padding: .6rem .8rem;
    background: #faf8f3;
    border: 1px solid var(--border);
    border-left: 3px solid #159aa6;
    border-radius: 4px;
    font-size: .76rem;
    line-height: 1.5;
    color: #4a3f30;
    max-height: 240px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-all;
    font-family: "SF Mono", "Consolas", "Monaco", monospace;
}
.reason-section .reason-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* --- Param Groups (Image Mode) --- */
.param-group { margin-bottom: .8rem; }
.param-group label {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-size: .88rem;
}
.param-group label span:first-child { min-width: 80px; }
.param-group input[type="range"] {
    flex: 1;
    accent-color: var(--primary);
}
.param-group select {
    padding: .3rem .5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: var(--font);
    font-size: .85rem;
}
.param-group #threshold-val,
.param-group #blur-val {
    min-width: 28px;
    color: var(--text-light);
    font-size: .85rem;
}

/* --- Model Selector (AI Image Generation) --- */
.model-selector {
    display: flex;
    gap: .4rem;
}
.model-option {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .35rem .8rem;
    border: 1px solid var(--border);
    border-radius: 18px;
    font-size: .82rem;
    cursor: pointer;
    transition: all .2s;
    background: var(--surface);
    color: var(--text-light);
    user-select: none;
    font-family: var(--font);
}
.model-option:hover {
    border-color: var(--accent);
    color: var(--text);
}
.model-option.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* --- Generation Mode Selector --- */
.gen-mode-selector {
    display: flex;
    gap: .4rem;
    margin-top: .8rem;
}
.gen-mode-option {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .4rem 1rem;
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: .85rem;
    cursor: pointer;
    transition: all .2s;
    background: var(--surface);
    color: var(--text-light);
    user-select: none;
    font-family: var(--font);
}
.gen-mode-option:hover {
    border-color: var(--accent);
    color: var(--text);
}
.gen-mode-option.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.gen-mode-option .badge {
    font-size: .7rem;
    padding: .05rem .4rem;
}

/* --- Loading Overlay --- */
.loading-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,.92);
    border-radius: 4px;
    z-index: 10;
}
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .8s linear infinite;
    margin-bottom: .8rem;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
.loading-overlay p {
    font-size: .95rem;
    color: var(--text);
    font-weight: 500;
}
.loading-hint {
    font-size: .78rem !important;
    color: var(--text-light) !important;
    font-weight: 400 !important;
    margin-top: .3rem;
}
.loading-dots::after {
    content: '...';
}

/* --- 进度条组件(全局复用) --- */
.gen-progress {
    margin-top: .55rem;
    padding: .55rem .75rem;
    background: #f4faf8;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: .85rem;
    animation: fadeIn .2s ease-out;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-3px); }
    to { opacity: 1; transform: translateY(0); }
}
.gen-progress-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    margin-bottom: .3rem;
}
.gen-progress-stage {
    font-size: .82rem;
    color: var(--text);
    font-weight: 500;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.gen-progress-pct {
    font-size: .78rem;
    color: var(--text-light);
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}
.gen-progress-bar {
    height: 7px;
    background: #dcefeb;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}
.gen-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #5a7a5a, #159aa6);
    border-radius: 4px;
    transition: width .35s ease;
    box-shadow: 0 0 8px rgba(90, 122, 90, .25);
}
.gen-progress--done {
    background: #ecf6ec;
    border-color: #b6d8b6;
}
.gen-progress--done .gen-progress-fill {
    background: linear-gradient(90deg, #5a7a5a, #2a9d6f);
}
.gen-progress--done .gen-progress-stage { color: #2a5a2a; }
.gen-progress--error {
    background: #fbecec;
    border-color: #e8c0c0;
}
.gen-progress--error .gen-progress-fill {
    background: linear-gradient(90deg, #a04040, #c66565);
}
.gen-progress--error .gen-progress-stage { color: #8a2828; }

footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-light);
    font-size: .8rem;
    border-top: 1px solid var(--border);
    background: var(--surface);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .panel-row { flex-direction: column; }
    .panel-row .panel-card:first-child { width: 100%; }
    .tabs { flex-direction: column; }
    header h1 { font-size: 1.4rem; }
    .card-header { flex-wrap: wrap; gap: .5rem; }
    .header-actions { flex-wrap: wrap; }
}

/* --- Compose layout wrapper (Part: UI 大气化 + 纵向堆叠) --- */
.compose-layout {
    display: flex;
    gap: 1.2rem;
    flex-wrap: wrap;
    align-items: flex-start;
}
.compose-form-card {
    flex: 0 0 280px;
    position: sticky;
    top: .8rem;
    max-height: calc(100vh - 1.6rem);
    overflow-y: auto;
}
.compose-form-card .card-body { padding: .9rem 1rem; }
.compose-form-card .form-row { margin-bottom: .65rem; }

/* --- Compose result: 试题 / 配图 / 解析 纵向堆叠 --- */
.compose-result-grid {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    flex: 1;
    min-width: 0;
    max-width: 880px;
}
.compose-result-grid .panel-card { min-width: 0; }
.compose-result-grid .card-header { padding: .85rem 1.2rem; }
.compose-result-grid .card-body { padding: 1.1rem 1.3rem; line-height: 1.85; }
.compose-result-grid .card-body::-webkit-scrollbar { width: 6px; }
.compose-result-grid .card-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.compose-result-grid > .panel-card:nth-child(1) .card-body {  /* 题目 */
    font-size: 1.02rem;
    line-height: 2;
}
.compose-result-grid > .panel-card:nth-child(2) .card-body {  /* 配图 */
    display: flex; justify-content: center;
    background: #f4faf8; padding: 1rem;
}
.compose-result-grid > .panel-card:nth-child(2) .canvas-wrapper {
    width: 100%; max-width: 720px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: .6rem;
}
.compose-result-grid > .panel-card:nth-child(2) .canvas-wrapper canvas {
    width: 100%; height: auto; display: block;
}
.compose-result-grid > .panel-card:nth-child(3) .card-body {  /* 解答 */
    font-size: .98rem;
    line-height: 1.95;
}

@media (max-width: 980px) {
    .compose-form-card { position: static; flex: 1 1 100%; max-height: none; }
    .compose-result-grid { max-width: 100%; }
}

/* --- Compose toolbar (Part C-3) --- */
.compose-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: .5rem;
}

/* --- Proxy 状态横幅(doc2x 启动提示) --- */
.proxy-banner {
    display: flex;
    align-items: flex-start;
    gap: .8rem;
    padding: .8rem 1rem;
    background: #fff8e8;
    border: 1px solid #e8c97a;
    border-left: 4px solid #d4a017;
    border-radius: 6px;
    margin-bottom: 1rem;
    animation: fadeIn .2s ease-out;
}
.proxy-banner--ok {
    background: #ecf6ec;
    border-color: #b6d8b6;
    border-left-color: #2a9d6f;
}
.proxy-banner-icon { font-size: 1.4rem; line-height: 1.5; }
.proxy-banner-body { flex: 1; }
.proxy-banner-title { font-weight: 600; margin-bottom: .3rem; font-size: .95rem; }
.proxy-banner--warn .proxy-banner-title { color: #8a5a00; }
.proxy-banner--ok .proxy-banner-title { color: #2a5a2a; }
.proxy-banner-text { font-size: .85rem; color: var(--text); line-height: 1.6; margin-bottom: .25rem; }
.proxy-banner-cmd {
    margin: .4rem 0;
    padding: .4rem .6rem;
    background: rgba(0,0,0,.06);
    border-radius: 4px;
    font-family: "SF Mono", Consolas, "Liberation Mono", monospace;
    font-size: .9rem;
    display: inline-block;
}
.proxy-banner code {
    background: rgba(0,0,0,.06);
    padding: .05rem .35rem;
    border-radius: 3px;
    font-family: "SF Mono", Consolas, monospace;
    font-size: .85rem;
}

/* --- History drawer (Part C-3) --- */
.history-drawer { position: fixed; inset: 0; z-index: 100; }
.history-backdrop {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.45);
}
.history-panel {
    position: absolute; top: 0; right: 0; bottom: 0;
    width: min(420px, 92vw);
    background: #fff;
    display: flex; flex-direction: column;
    box-shadow: -4px 0 16px rgba(0,0,0,0.18);
    animation: slideInRight .18s ease-out;
}
@keyframes slideInRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}
.history-header {
    display: flex; align-items: center; gap: .5rem;
    padding: 1rem;
    border-bottom: 1px solid #eee;
}
.history-header h2 { flex: 1; margin: 0; font-size: 1.05rem; }
.history-hint {
    padding: .5rem 1rem;
    font-size: .75rem;
    color: var(--text-light);
    margin: 0;
    border-bottom: 1px solid #f3f3f3;
}

.history-list {
    flex: 1; overflow-y: auto;
    padding: .5rem 1rem 1rem;
}
.history-empty {
    padding: 2rem;
    text-align: center;
    color: var(--text-light);
}

.history-item {
    border: 1px solid #ececec; border-radius: 6px;
    margin-bottom: .8rem;
    padding: .7rem .8rem;
    background: #f4faf8;
}
.history-meta {
    display: flex; justify-content: space-between;
    font-size: .72rem;
    color: var(--text-light);
    margin-bottom: .35rem;
}
.history-ttl { color: #b58900; font-weight: 500; }
.history-summary { font-size: .82rem; margin-bottom: .5rem; }
.history-preview summary {
    font-size: .75rem;
    color: var(--text-light);
    cursor: pointer;
    user-select: none;
}
.history-preview pre {
    margin: .35rem 0 0;
    padding: .4rem .55rem;
    background: #fff;
    border-radius: 4px;
    font-size: .78rem;
    line-height: 1.5;
    white-space: pre-wrap;
    border: 1px solid #ececec;
}
.history-actions {
    display: flex; gap: .4rem;
    margin-top: .5rem;
}
.history-actions button {
    font-size: .78rem;
    padding: .3rem .55rem;
}

/* ============================================================
   产品落地页 — 导航栏
   ============================================================ */
.site-nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 200;
    background: rgba(255,255,255,.97);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border-bottom: 1px solid var(--border);
    height: 56px;
}
.nav-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.2rem;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 2rem;
}
.nav-brand {
    display: flex;
    align-items: center;
    gap: .4rem;
    text-decoration: none;
    color: var(--text);
    font-weight: 700;
    font-size: 1.05rem;
    flex-shrink: 0;
}
.nav-brand-icon { font-size: 1.4rem; }
.nav-links {
    display: flex;
    gap: .25rem;
    flex: 1;
}
.nav-link {
    text-decoration: none;
    color: var(--text-light);
    font-size: .88rem;
    padding: .35rem .8rem;
    border-radius: 6px;
    transition: all .15s;
    font-weight: 500;
}
.nav-link:hover { color: var(--text); background: #e5f4f0; }
.nav-link.active { color: var(--text); background: #dcefeb; font-weight: 600; }
.nav-actions {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-shrink: 0;
}
.nav-login-btn {
    padding: .35rem 1rem;
    border: 1px solid var(--primary);
    border-radius: 6px;
    background: var(--primary);
    color: #fff;
    font-size: .82rem;
    cursor: pointer;
    transition: all .15s;
    font-family: var(--font);
    font-weight: 500;
}
.nav-login-btn:hover { background: var(--primary-hover); }
.nav-menu-btn {
    display: none;
    border: none;
    background: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: var(--text);
    padding: .2rem .4rem;
}

/* --- Hero section — 保留原 header + main 内容 --- */
#hero {
    padding-top: 56px;  /* nav 高度补偿 */
    scroll-margin-top: 56px;
}
.hero-header {
    background: linear-gradient(180deg, #fbfaf6 0%, var(--surface) 100%);
    border-bottom: 1px solid var(--border);
    padding: 1.8rem 1rem 1.6rem;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}
.hero-header-inner { max-width: 1100px; margin: 0 auto; }
.hero-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: .04em;
    color: var(--text);
}
.hero-header .icon { font-size: 1.6rem; margin-right: .3rem; }
.hero-header .subtitle {
    color: var(--text-light);
    font-size: .93rem;
    margin-top: .3rem;
}
.hero-main {
    flex: 1;
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.5rem 1rem 3rem;
    width: 100%;
}

/* --- Section shared styles --- */
.section-alt {
    background: #f2f8f6;
    padding: 3.5rem 1rem;
    scroll-margin-top: 56px;
}
.section-light {
    background: #f8fcfb;
    padding: 3.5rem 1rem;
    scroll-margin-top: 56px;
}
.section-inner {
    max-width: 1100px;
    margin: 0 auto;
}
.section-title {
    font-size: 1.6rem;
    font-weight: 700;
    text-align: center;
    color: var(--text);
    margin-bottom: .6rem;
}
.section-desc {
    text-align: center;
    color: var(--text-light);
    font-size: .95rem;
    margin-bottom: 2.5rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* --- Showcases --- */
.showcase-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.2rem;
}
.showcase-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    transition: all .2s;
}
.showcase-card:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,.06);
    transform: translateY(-2px);
}
.showcase-icon {
    font-size: 2rem;
    margin-bottom: .6rem;
}
.showcase-card h3 {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: .4rem;
    color: var(--text);
}
.showcase-card p {
    font-size: .88rem;
    color: var(--text-light);
    line-height: 1.7;
    margin-bottom: .8rem;
}
.showcase-tags {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
}
.showcase-tags span {
    font-size: .75rem;
    padding: .15rem .5rem;
    border-radius: 20px;
    background: #dcefeb;
    color: var(--text);
}

.showcase-cases {
    display: flex;
    flex-direction: column;
    gap: 1.8rem;
}
.showcase-case {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,.035);
}
.showcase-case-header {
    padding: 1.35rem 1.5rem 1.1rem;
    border-bottom: 1px solid var(--border);
}
.showcase-case-kicker {
    display: block;
    color: var(--accent);
    font-size: .76rem;
    font-weight: 700;
    letter-spacing: .08em;
    margin-bottom: .35rem;
}
.showcase-case-header h3 {
    margin: 0 0 .4rem;
    font-size: 1.25rem;
    color: var(--text);
}
.showcase-case-header p {
    margin: 0;
    color: var(--text-light);
    font-size: .88rem;
}
.showcase-case-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(220px, .85fr) minmax(0, 1.25fr);
    gap: 0;
}
.showcase-pane {
    min-width: 0;
    padding: 1.2rem 1.35rem 1.35rem;
}
.showcase-pane + .showcase-pane {
    border-left: 1px solid var(--border);
}
.showcase-pane h4 {
    display: flex;
    align-items: center;
    gap: .4rem;
    margin: 0 0 .8rem;
    padding-bottom: .55rem;
    border-bottom: 2px solid #dcefeb;
    font-size: .98rem;
    color: var(--text);
}
.showcase-text {
    color: var(--text-light);
    font-size: .84rem;
    line-height: 1.8;
}
.showcase-text p { margin: 0 0 .7rem; }
.showcase-text p:last-child { margin-bottom: 0; }
.showcase-text .formula {
    color: var(--text);
    font-family: Georgia, 'Times New Roman', serif;
    white-space: nowrap;
}
.showcase-answer {
    padding: .65rem .75rem;
    border-left: 3px solid var(--accent);
    background: #faf7ef;
    color: var(--text);
}
.showcase-diagram {
    display: flex;
    flex-direction: column;
}
.showcase-diagram img {
    display: block;
    width: 100%;
    max-height: 390px;
    object-fit: contain;
    border: 1px solid #dcefeb;
    border-radius: 6px;
    background: #fff;
}
.showcase-caption {
    display: block;
    margin-top: .55rem;
    color: var(--text-light);
    font-size: .72rem;
    text-align: center;
}
@media (max-width: 900px) {
    .showcase-case-grid { grid-template-columns: 1fr; }
    .showcase-pane + .showcase-pane {
        border-left: 0;
        border-top: 1px solid var(--border);
    }
}

.about-grid {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}
.about-block h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: .6rem;
    color: var(--text);
}
.about-block p {
    font-size: .92rem;
    color: var(--text-light);
    line-height: 1.8;
}
.about-steps {
    margin: 0;
    padding-left: 1.3rem;
    font-size: .9rem;
    color: var(--text-light);
    line-height: 1.9;
}
.about-steps li { margin-bottom: .35rem; }
.about-highlights {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.2rem;
    margin-top: .5rem;
}
.highlight-item {
    display: flex;
    gap: .8rem;
    padding: 1rem;
    background: #f4faf8;
    border: 1px solid var(--border);
    border-radius: 8px;
}
.highlight-num {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--accent);
    line-height: 1.3;
    flex-shrink: 0;
    min-width: 30px;
}
.highlight-item h4 {
    font-size: .92rem;
    font-weight: 600;
    margin-bottom: .2rem;
    color: var(--text);
}
.highlight-item p {
    font-size: .82rem;
    color: var(--text-light);
    line-height: 1.6;
}

/* --- Features --- */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.2rem;
}
.feature-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    transition: all .2s;
    position: relative;
    overflow: hidden;
}
.feature-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--success));
    opacity: 0;
    transition: opacity .2s;
}
.feature-card:hover::before { opacity: 1; }
.feature-card:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,.06);
    transform: translateY(-2px);
}
.feature-card-icon {
    font-size: 1.8rem;
    margin-bottom: .6rem;
}
.feature-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: .4rem;
    color: var(--text);
}
.feature-card p {
    font-size: .85rem;
    color: var(--text-light);
    line-height: 1.75;
}

/* --- QA --- */
.qa-list {
    max-width: 780px;
    margin: 0 auto;
}
.qa-item {
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: .6rem;
    overflow: hidden;
    background: var(--surface);
    transition: box-shadow .2s;
}
.qa-item:hover { box-shadow: 0 1px 6px rgba(0,0,0,.04); }
.qa-question {
    padding: 1rem 1.2rem;
    cursor: pointer;
    font-weight: 600;
    font-size: .92rem;
    color: var(--text);
    list-style: none;
    display: flex;
    align-items: center;
    gap: .5rem;
    user-select: none;
    transition: background .15s;
}
.qa-question::-webkit-details-marker { display: none; }
.qa-question::before {
    content: '▶';
    font-size: .7rem;
    color: var(--accent);
    transition: transform .2s;
    flex-shrink: 0;
}
.qa-item[open] .qa-question::before {
    transform: rotate(90deg);
}
.qa-question:hover { background: #f4faf8; }
.qa-answer {
    padding: 0 1.2rem 1rem;
    font-size: .88rem;
    color: var(--text-light);
    line-height: 1.8;
}

/* --- Testimonials --- */
.testimonial-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.2rem;
}
.testimonial-card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 1.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 2px 12px rgba(0,0,0,.035);
}
.testimonial-quote {
    height: 1.5rem;
    color: var(--accent);
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 2.6rem;
    font-weight: 700;
    line-height: 1;
}
.testimonial-card > p {
    flex: 1;
    margin: .55rem 0 1.2rem;
    color: var(--text-light);
    font-size: .88rem;
    line-height: 1.85;
}
.testimonial-user {
    display: flex;
    flex-direction: column;
    gap: .18rem;
    padding-top: .85rem;
    border-top: 1px solid var(--border);
}
.testimonial-user strong {
    color: var(--text);
    font-size: .9rem;
}
.testimonial-user span {
    color: var(--text-light);
    font-size: .75rem;
}

/* --- Call to Action --- */
.cta-section {
    padding: 3.8rem 1rem;
    background: #283831;
    color: #fff;
    scroll-margin-top: 56px;
}
.cta-inner {
    max-width: 760px;
    margin: 0 auto;
    text-align: center;
}
.cta-kicker {
    display: block;
    margin-bottom: .55rem;
    color: #d8c9a8;
    font-size: .76rem;
    font-weight: 700;
    letter-spacing: .12em;
}
.cta-inner h2 {
    margin: 0;
    font-size: 1.75rem;
    line-height: 1.35;
}
.cta-inner p {
    margin: .8rem auto 1.5rem;
    color: rgba(255,255,255,.76);
    font-size: .93rem;
    line-height: 1.7;
}
.cta-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .7rem;
}
.cta-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 142px;
    padding: .68rem 1.15rem;
    border: 1px solid transparent;
    border-radius: 6px;
    font-size: .88rem;
    font-weight: 600;
    text-decoration: none;
    transition: transform .15s, background .15s, border-color .15s;
}
.cta-button:hover { transform: translateY(-1px); }
.cta-button-primary {
    background: #eee4cf;
    color: #283831;
}
.cta-button-primary:hover { background: #f7f0e1; }
.cta-button-secondary {
    border-color: rgba(255,255,255,.38);
    color: #fff;
    background: transparent;
}
.cta-button-secondary:hover {
    border-color: rgba(255,255,255,.72);
    background: rgba(255,255,255,.07);
}

/* --- Footer --- */
footer {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-light);
    font-size: .8rem;
    border-top: 1px solid var(--border);
    background: var(--surface);
}
.footer-inner {
    max-width: 1100px;
    margin: 0 auto;
}
.footer-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: .4rem;
}
.footer-icon { font-size: 1.2rem; }
.footer-desc {
    font-size: .82rem;
    color: var(--text-light);
    margin-bottom: .8rem;
}
.footer-links {
    display: flex;
    justify-content: center;
    gap: .6rem 1.2rem;
    flex-wrap: wrap;
    margin-bottom: .6rem;
}
.footer-links a {
    color: var(--text-light);
    text-decoration: none;
    font-size: .8rem;
    transition: color .15s;
}
.footer-links a:hover { color: var(--text); }
.footer-legal {
    margin-top: .9rem;
    padding-top: .9rem;
    border-top: 1px solid var(--border);
}
.footer-legal-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .35rem .65rem;
    margin-bottom: .55rem;
    color: var(--text-light);
    font-size: .75rem;
}
.footer-copy {
    margin: 0;
    font-size: .75rem;
    color: var(--text-light);
    opacity: .7;
}

/* hide old header (replaced by new nav + hero-header) */
header:not(.hero-header) { display: none; }

/* --- Responsive for landing sections --- */
@media (max-width: 768px) {
    .site-nav { height: 50px; }
    .nav-inner { padding: 0 .8rem; gap: .5rem; }
    .nav-brand-text { display: none; }
    .nav-links { gap: 0; display: none; }
    .nav-links.open { display: flex; position: absolute; top: 50px; left: 0; right: 0;
        background: rgba(255,255,255,.98); border-bottom: 1px solid var(--border);
        flex-direction: column; padding: .5rem; }
    .nav-link { padding: .5rem .8rem; display: block; }
    .nav-menu-btn { display: inline-flex; }
    .nav-login-btn { font-size: .78rem; padding: .3rem .7rem; }
    #hero { padding-top: 50px; }
    .hero-header { padding: 1.2rem .8rem 1rem; }
    .hero-header h1 { font-size: 1.4rem; }
    .section-alt, .section-light { padding: 2rem .8rem; }
    .section-title { font-size: 1.3rem; }
    .showcase-grid, .feature-grid, .testimonial-grid { grid-template-columns: 1fr; }
    .about-highlights { grid-template-columns: 1fr; }
    .cta-section { padding: 2.8rem .8rem; }
    .cta-inner h2 { font-size: 1.4rem; }
    .cta-actions { flex-direction: column; align-items: stretch; }
    .cta-button { width: 100%; }
    .footer-legal-links { gap: .3rem .5rem; }
    .qa-question { font-size: .88rem; padding: .8rem 1rem; }
    .qa-answer { font-size: .85rem; padding: 0 1rem .8rem; }
}
@media (max-width: 980px) {
    .about-highlights { grid-template-columns: 1fr; }
}

/* --- Showcase LaTeX --- */
.showcase-pane .katex { font-size: 1.04em; }
.showcase-pane .katex-display { margin: .5em 0; overflow-x: auto; }
.showcase-final-answers {
    display: flex;
    flex-direction: column;
    gap: .85rem;
    margin-top: 1.2rem;
}
.final-answer-item {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: .55rem .8rem;
    padding: .9rem 1rem;
    border-left: 3px solid var(--accent);
    border-radius: 3px;
    background: #faf7ef;
    color: var(--text);
}
.final-answer-item > span:first-child { color: var(--accent); font-weight: 700; }
.final-answer-item strong { flex-basis: 100%; font-size: .9rem; }
.final-answer-item .formula { font-size: 1.08rem; }

/* ============================================================
   Brand refresh — physics signal lab
   ============================================================ */
::selection {
    background: var(--accent-light);
    color: var(--text);
}

body {
    background-color: var(--bg);
    color: var(--text);
}

.brand-logo-frame {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    overflow: hidden;
    border: 1px solid rgba(8, 122, 104, .14);
    background: #fff;
    box-shadow: 0 7px 18px rgba(8, 86, 74, .11);
}
.brand-logo-frame img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.brand-logo-nav {
    width: 34px;
    height: 34px;
    border-radius: 10px;
}
.brand-logo-hero {
    width: 104px;
    height: 104px;
    border-radius: 26px;
    box-shadow: 0 16px 36px rgba(8, 86, 74, .16);
}
.brand-logo-footer {
    width: 42px;
    height: 42px;
    border-radius: 12px;
}

.site-nav {
    background: rgba(255, 255, 255, .91);
    border-bottom-color: rgba(8, 122, 104, .12);
    box-shadow: 0 5px 22px rgba(8, 70, 61, .06);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}
.nav-inner { max-width: 1320px; }
.nav-brand {
    gap: .65rem;
    color: var(--primary);
    letter-spacing: .01em;
}
.nav-link { border-radius: 999px; }
.nav-link:hover {
    color: var(--primary);
    background: #ebf7f4;
}
.nav-link.active {
    color: #066454;
    background: var(--accent-light);
}
.nav-login-btn {
    border-radius: 999px;
    box-shadow: 0 5px 14px rgba(8, 122, 104, .18);
}

.hero-header {
    position: relative;
    overflow: hidden;
    padding: 2.35rem 1rem 2.2rem;
    background-color: #f7fbfa;
    background-image:
        linear-gradient(rgba(8, 122, 104, .045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(8, 122, 104, .045) 1px, transparent 1px);
    background-size: 24px 24px;
    border-bottom-color: rgba(8, 122, 104, .14);
    box-shadow: inset 0 -28px 55px rgba(35, 185, 199, .035);
    text-align: left;
}
.hero-header-inner { max-width: 1180px; }
.hero-brand-lockup {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.45rem;
}
.hero-brand-copy { min-width: 0; }
.hero-eyebrow {
    display: block;
    margin-bottom: .25rem;
    color: var(--primary);
    font-size: .76rem;
    font-weight: 700;
    letter-spacing: .12em;
}
.hero-header h1 {
    margin: 0;
    color: var(--text);
    font-family: var(--font-display);
    font-size: clamp(1.85rem, 3vw, 2.45rem);
    font-weight: 700;
    letter-spacing: .035em;
    line-height: 1.25;
}
.hero-header .subtitle {
    max-width: 720px;
    margin-top: .5rem;
    color: var(--text-light);
    font-size: .94rem;
}
.hero-main { padding-top: 1.7rem; }

.tabs {
    gap: .35rem;
    padding: .38rem;
    border: 1px solid rgba(8, 122, 104, .12);
    border-radius: 18px;
    background: rgba(225, 243, 238, .8);
    box-shadow: inset 0 1px 2px rgba(8, 86, 74, .04);
}
.tab-btn {
    border: 0;
    border-radius: 13px;
    background: transparent;
    color: var(--text-light);
}
.tab-btn:hover {
    border-color: transparent;
    background: rgba(255, 255, 255, .72);
    color: var(--primary);
}
.tab-btn.active {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
    box-shadow: 0 7px 18px rgba(8, 122, 104, .22);
}

.panel-card {
    border-color: rgba(8, 122, 104, .14);
    border-radius: 16px;
    box-shadow: var(--shadow);
}
.panel-card:hover {
    box-shadow: 0 14px 34px rgba(8, 86, 74, .11);
}
.card-header {
    border-bottom-color: rgba(8, 122, 104, .12);
    background: linear-gradient(90deg, #f3faf8, #fbfdfd);
}
.card-header h2 { color: var(--text); }
.badge {
    background: var(--accent-light);
    color: #075f55;
}
.badge-green {
    background: #d9f3e8;
    color: #087258;
}

#text-input,
#prompt-input,
.form-row select,
.form-row textarea,
.ctrl-label select,
.ai-params input {
    border-color: var(--border);
    border-radius: 10px;
    background: #fbfefd;
    color: var(--text);
}
#text-input:focus,
#prompt-input:focus,
.form-row select:focus,
.form-row textarea:focus,
.ctrl-label select:focus,
.ai-params input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(21, 154, 166, .16);
}

.btn { border-radius: 9px; }
.btn-primary {
    border-color: var(--primary);
    background: var(--primary);
    box-shadow: 0 6px 16px rgba(8, 122, 104, .17);
}
.btn-primary:hover {
    border-color: var(--primary-hover);
    background: var(--primary-hover);
    transform: translateY(-1px);
}
.btn-secondary:hover { background: #e5f4f0; }
.btn-download { color: var(--primary); }
.btn-download:hover { background: var(--accent-light); }

.gen-mode-option {
    border-radius: 999px;
    background: #fbfefd;
}
.gen-mode-option.active,
.model-option.active {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
    box-shadow: 0 5px 14px rgba(8, 122, 104, .16);
}
.upload-area {
    border-color: #b8d8d1;
    border-radius: 12px;
    background: #fbfefd;
}
.upload-area:hover,
.upload-area.dragover,
.upload-area--file {
    border-color: var(--accent);
    background: #ecf9f6;
}

.section-alt { background: #edf6f3; }
.section-light { background: #f9fcfb; }
.section-title {
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 2.5vw, 2rem);
    letter-spacing: .035em;
}
.section-title::after {
    content: '';
    display: block;
    width: 58px;
    height: 3px;
    margin: .7rem auto 0;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
}
.showcase-case,
.feature-card,
.highlight-item,
.qa-item,
.testimonial-card {
    border-color: rgba(8, 122, 104, .14);
    box-shadow: 0 8px 24px rgba(8, 86, 74, .055);
}
.showcase-case:hover,
.feature-card:hover,
.highlight-item:hover,
.testimonial-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(8, 86, 74, .09);
}
.showcase-case-header,
.showcase-pane + .showcase-pane {
    border-color: var(--border);
}
.feature-card::before { background: var(--accent); }
.showcase-tags span,
.compose-meta { background: var(--accent-light); }
.showcase-answer,
.final-answer-item {
    border-left-color: var(--accent);
    background: #eff9f6;
}
.qa-question:hover { background: #edf8f5; }

.cta-section {
    background-color: #075f55;
    background-image:
        radial-gradient(circle at 18% 20%, rgba(35, 185, 199, .17), transparent 32%),
        radial-gradient(circle at 82% 78%, rgba(255, 255, 255, .07), transparent 34%);
}
.cta-kicker { color: #8ee4e5; }
.cta-button-primary {
    background: #e3f7f3;
    color: #075f55;
}
.cta-button-primary:hover { background: #fff; }

footer { border-top-color: rgba(8, 122, 104, .14); }
.footer-brand {
    gap: .65rem;
    color: var(--primary);
}
.footer-links a:hover { color: var(--primary); }
.footer-legal { border-top-color: rgba(8, 122, 104, .12); }

:where(a, button, input, textarea, select, summary):focus-visible {
    outline: 3px solid rgba(21, 154, 166, .45);
    outline-offset: 3px;
}

@media (max-width: 768px) {
    .brand-logo-nav {
        width: 30px;
        height: 30px;
        border-radius: 9px;
    }
    .hero-header { padding: 1.7rem .8rem 1.55rem; }
    .hero-brand-lockup {
        flex-direction: column;
        gap: .85rem;
        text-align: center;
    }
    .brand-logo-hero {
        width: 76px;
        height: 76px;
        border-radius: 20px;
    }
    .hero-eyebrow { font-size: .68rem; }
    .hero-header .subtitle { font-size: .86rem; }
    .tabs { border-radius: 14px; }
    .tab-btn {
        padding: .68rem .4rem;
        border-radius: 10px;
        font-size: .88rem;
    }
    .tab-btn span {
        display: block;
        margin: 0 0 .15rem;
    }
    .panel-card { border-radius: 13px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
    .panel-card:hover,
    .showcase-case:hover,
    .feature-card:hover,
    .highlight-item:hover,
    .testimonial-card:hover,
    .btn-primary:hover,
    .cta-button:hover {
        transform: none;
    }
}

/* ============================================================
   用户作品画廊 (User Gallery)
   ============================================================ */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-top: 32px;
}
.gallery-loading,
.gallery-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 48px 16px;
    color: var(--text-muted, #6b7280);
    font-size: 15px;
    background: #fff;
    border-radius: 12px;
    border: 1px dashed var(--border, #e5e7eb);
}
.gallery-card {
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, .06);
    border: 1px solid var(--border, #e5e7eb);
    display: flex;
    flex-direction: column;
    transition: transform .2s, box-shadow .2s;
}
.gallery-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
}
.gallery-img-wrap {
    width: 100%;
    background: #f9fafb;
    border-bottom: 1px solid var(--border, #e5e7eb);
    max-height: 320px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.gallery-img-wrap img {
    width: 100%;
    height: auto;
    max-height: 320px;
    object-fit: contain;
    display: block;
}
.gallery-meta {
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.gallery-tags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}
.gallery-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    background: #e3f7f3;
    color: #075f55;
    font-weight: 600;
}
.gallery-tag-mode {
    background: #eef2ff;
    color: #4338ca;
}
.gallery-time {
    color: var(--text-muted, #9ca3af);
    margin-left: auto;
}
.gallery-title {
    margin: 0;
    font-size: 16px;
    color: var(--text, #1f2937);
    line-height: 1.4;
}
.gallery-question {
    font-size: 13px;
    color: var(--text-muted, #6b7280);
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}
.gallery-solution {
    font-size: 13px;
}
.gallery-solution summary {
    cursor: pointer;
    color: #075f55;
    font-weight: 600;
    padding: 4px 0;
}
.gallery-solution div {
    color: var(--text-muted, #4b5563);
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    padding-top: 6px;
}

/* ============================================================
   额度用完充值提示模态框
   ============================================================ */
.quota-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    align-items: center;
    justify-content: center;
}
.quota-modal.show {
    display: flex;
}
.quota-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
}
.quota-modal-card {
    position: relative;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    padding: 32px 28px;
    max-width: 440px;
    width: calc(100% - 32px);
    text-align: center;
    z-index: 1;
}
.quota-modal-card h2 {
    margin: 0 0 12px;
    font-size: 20px;
    color: var(--text);
}
.quota-modal-card > p {
    margin: 0 0 16px;
    font-size: 14px;
    color: var(--text-light);
    line-height: 1.6;
}
.quota-contact {
    background: var(--bg);
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 16px;
    text-align: left;
}
.quota-contact p {
    margin: 4px 0;
    font-size: 13px;
    color: var(--text);
    line-height: 1.7;
}
.quota-contact b {
    color: var(--primary);
}
.quota-qr-wrap {
    margin-bottom: 16px;
}
.quota-qr-wrap img {
    width: 280px;
    height: 280px;
    object-fit: contain;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #fff;
    padding: 8px;
    box-sizing: border-box;
}
.quota-qr-placeholder {
    font-size: 13px;
    color: var(--text-light);
    padding: 40px 0;
}
.quota-user-id {
    background: var(--accent-light);
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 8px;
}
.quota-user-id p {
    margin: 2px 0;
    font-size: 13px;
    color: var(--text);
}
.quota-user-id b {
    color: var(--primary);
    font-size: 15px;
}

/* ============================================================
   使用记录模态框
   ============================================================ */
.usage-modal-card {
    max-width: 440px;
    text-align: left;
}
.usage-modal-card h2 {
    text-align: center;
}
.usage-summary {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}
.usage-stat {
    flex: 1;
    background: var(--bg);
    border-radius: 10px;
    padding: 14px 8px;
    text-align: center;
}
.usage-stat-label {
    display: block;
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 4px;
}
.usage-stat-value {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
}
.usage-list-title {
    font-size: 14px;
    color: var(--text);
    margin: 0 0 10px;
    font-weight: 600;
}
.usage-list {
    max-height: 280px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
}
.usage-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}
.usage-item:last-child { border-bottom: none; }
.usage-item-type {
    color: var(--text);
    font-weight: 500;
}
.usage-item-time {
    color: var(--text-light);
    font-size: 12px;
}
.usage-empty {
    text-align: center;
    color: var(--text-light);
    padding: 30px 0;
    font-size: 14px;
}

/* ============================================================
   导航栏充值按钮 + 充值模态框
   ============================================================ */
.nav-recharge-btn {
    margin-left: 6px;
    padding: 4px 12px;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    background: var(--primary);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: opacity .15s, transform .1s;
}
.nav-recharge-btn:hover { opacity: .88; }
.nav-recharge-btn:active { transform: scale(.96); }

.recharge-modal-card {
    max-width: 400px;
}
.recharge-intro {
    margin-bottom: 14px !important;
}
.recharge-packages {
    display: flex;
    gap: 10px;
    margin-bottom: 18px;
}
.recharge-pkg {
    flex: 1;
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    padding: 12px 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.recharge-pkg-times {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}
.recharge-pkg-price {
    font-size: 17px;
    font-weight: 700;
    color: var(--primary);
}
.recharge-qr-wrap img {
    background: #fff;
}

