:root {
    --writing-bg: #f6f7fb;
    --writing-card: #ffffff;
    --writing-border: #ececf3;
    --writing-border-strong: #dfe3ef;
    --writing-border-soft: #eef1f7;
    --writing-text: #1f2937;
    --writing-muted: #6b7280;
    --writing-soft: #f8f8fd;
    --writing-accent-start: #7c3aed;
    --writing-accent-end: #c026d3;
    --writing-accent-shadow: rgba(131, 56, 236, 0.24);
    --writing-accent-soft: rgba(124, 58, 237, 0.1);
    --writing-success: #16a34a;
    --writing-danger: #dc2626;
    --writing-warning: #f59e0b;
    --writing-shadow: 0 18px 42px rgba(15, 23, 42, 0.06);
    --writing-control-lg: 54px;
    --writing-control-md: 46px;
    --writing-control-sm: 38px;
    --writing-radius-lg: 16px;
    --writing-radius-md: 12px;
    --writing-radius-sm: 10px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body.page-writing {
    margin: 0;
    min-height: 100vh;
    background: var(--writing-bg);
    color: var(--writing-text);
    font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.hidden {
    display: none !important;
}

.page-writing .navbar-home {
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid rgba(223, 227, 239, 0.9);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.04);
    backdrop-filter: blur(12px);
}

.page-writing .navbar-brand h1 {
    color: var(--writing-text);
}

.page-writing .nav-link.active,
.page-writing .navbar-brand .logo {
    color: var(--writing-accent-start);
}

.writer-stage {
    width: min(1540px, calc(100% - 48px));
    margin: 0 auto;
    padding: 26px 0 92px;
}

.page-writing[data-start-mode="outline"] .compose-shell {
    gap: 22px;
}

.entry-switcher {
    padding: 18px 22px;
    border: 1px solid var(--writing-border);
    border-radius: 20px;
    background: var(--writing-card);
    box-shadow: var(--writing-shadow);
}

.entry-switcher-head h2 {
    margin: 0;
    font-size: 22px;
    line-height: 1.2;
    font-weight: 800;
    color: #2b2f3a;
}

.entry-switcher-head p {
    margin: 8px 0 0;
    color: var(--writing-muted);
    font-size: 14px;
    line-height: 1.7;
}

.entry-mode-grid {
    margin-top: 14px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.start-mode-option {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    min-height: 58px;
    min-width: 0;
    flex: 1 1 0;
    padding: 10px 14px;
    border: 1px solid var(--writing-border-strong);
    border-radius: var(--writing-radius-md);
    background: #fff;
    cursor: pointer;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.start-mode-option:hover {
    transform: translateY(-1px);
    border-color: rgba(124, 58, 237, 0.24);
    box-shadow: 0 12px 24px rgba(124, 58, 237, 0.08);
}

.start-mode-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.start-mode-option strong {
    color: var(--writing-text);
    font-size: 14px;
    line-height: 1.3;
    font-weight: 800;
}

.start-mode-option span {
    color: var(--writing-muted);
    font-size: 11px;
    line-height: 1.4;
}

.start-mode-option.active {
    border-color: rgba(124, 58, 237, 0.38);
    background: linear-gradient(180deg, rgba(124, 58, 237, 0.08), rgba(192, 38, 211, 0.06));
    box-shadow: 0 16px 30px rgba(124, 58, 237, 0.12);
}

.start-mode-option.active strong {
    color: #5b21b6;
}

.start-mode-option.active span {
    color: #6d28d9;
}

.compose-shell {
    display: grid;
    grid-template-columns: minmax(360px, 0.62fr) minmax(940px, 1.38fr);
    gap: 18px;
    margin-top: 16px;
    align-items: start;
}

.compose-card,
.aux-card {
    background: var(--writing-card);
    border: 1px solid var(--writing-border);
    border-radius: 20px;
    box-shadow: var(--writing-shadow);
}

.compose-card {
    padding: 28px 28px 26px;
}

.compose-card-outline {
    min-height: 760px;
    display: flex;
    flex-direction: column;
}

.stealth-controls {
    display: none;
}

.step-block + .step-block {
    margin-top: 20px;
}

.step-title,
.outline-title {
    display: block;
    margin: 0 0 10px;
    color: #2b2f3a;
    font-size: 24px;
    line-height: 1.2;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.step-title {
    font-size: 18px;
}

.required-mark {
    color: #ef4444;
}

.step-input,
.step-textarea,
.outline-import-panel textarea,
.section-editor,
.draft-preview,
.editor-field textarea,
.outline-input,
.outline-word-input {
    width: 100%;
    border: 1px solid var(--writing-border-strong);
    border-radius: var(--writing-radius-md);
    background: #fff;
    color: var(--writing-text);
    font-family: inherit;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
    outline: none;
}

.step-input,
.outline-input,
.outline-word-input {
    height: var(--writing-control-lg);
    padding: 0 16px;
    font-size: 15px;
}

.step-input::placeholder,
.step-textarea::placeholder,
.outline-import-panel textarea::placeholder,
.section-editor::placeholder,
.draft-preview::placeholder,
.editor-field textarea::placeholder,
.outline-input::placeholder,
.outline-word-input::placeholder {
    color: #9ca3af;
}

.step-textarea,
.outline-import-panel textarea,
.section-editor,
.draft-preview,
.editor-field textarea {
    padding: 16px 18px;
    resize: vertical;
    font-size: 15px;
    line-height: 1.8;
}

.step-input:focus,
.step-textarea:focus,
.outline-import-panel textarea:focus,
.section-editor:focus,
.draft-preview:focus,
.editor-field textarea:focus,
.outline-input:focus,
.outline-word-input:focus {
    border-color: rgba(124, 58, 237, 0.46);
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.1);
}

.title-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 164px;
    gap: 12px;
    align-items: stretch;
}

.title-row.single-input {
    grid-template-columns: minmax(0, 1fr);
}

.gradient-btn,
.subtle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: var(--writing-radius-md);
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
    text-decoration: none;
}

.gradient-btn:hover,
.subtle-btn:hover {
    transform: translateY(-1px);
}

.gradient-btn {
    min-height: var(--writing-control-md);
    padding: 0 16px;
    color: #fff;
    background: linear-gradient(90deg, var(--writing-accent-start), var(--writing-accent-end));
    box-shadow: 0 10px 22px var(--writing-accent-shadow);
}

.gradient-btn-submit {
    min-width: 320px;
    max-width: 100%;
}

.step-submit {
    margin-top: 24px;
    display: flex;
    justify-content: center;
}

.suggestion-list {
    margin-top: 14px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.suggestion-list.empty {
    display: none;
}

.suggestion-chip {
    display: inline-flex;
    align-items: center;
    border: 1px solid rgba(124, 58, 237, 0.18);
    border-radius: 999px;
    background: rgba(124, 58, 237, 0.08);
    color: #5b21b6;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.outline-topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.outline-title {
    margin: 4px 0 0;
    font-size: 25px;
    white-space: nowrap;
}

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

.outline-actions .gradient-btn {
    min-width: 136px;
}

.outline-import-panel {
    margin-top: 12px;
    padding: 14px;
    border: 1px solid rgba(124, 58, 237, 0.14);
    border-radius: 16px;
    background: rgba(124, 58, 237, 0.04);
}

.outline-import-panel textarea {
    min-height: 180px;
    background: #fff;
}

.outline-import-hint {
    margin: 10px 4px 0;
    color: var(--writing-muted);
    font-size: 13px;
    line-height: 1.6;
}

.task-status {
    margin-top: 14px;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid var(--writing-border);
    background: var(--writing-soft);
}

#taskStatus,
#sectionPromptPanel,
#previewPromptBtn,
#copyPromptBtn {
    display: none !important;
}

.page-writing[data-start-mode="outline"] .task-status,
.page-writing[data-start-mode="outline"] .task-progress,
.page-writing[data-start-mode="outline"] .meta-bar.empty {
    margin-top: 12px;
}

.page-writing[data-start-mode="outline"] .outline-container {
    margin-top: 14px;
}

.task-status-title {
    font-size: 14px;
    font-weight: 700;
}

.task-status p {
    margin: 6px 0 0;
    color: var(--writing-muted);
    font-size: 13px;
    line-height: 1.6;
}

.task-status.processing {
    border-color: rgba(124, 58, 237, 0.22);
    background: rgba(124, 58, 237, 0.06);
}

.task-status.completed {
    border-color: rgba(22, 163, 74, 0.22);
    background: rgba(22, 163, 74, 0.08);
}

.task-status.failed {
    border-color: rgba(220, 38, 38, 0.2);
    background: rgba(220, 38, 38, 0.08);
}

.task-status.queued {
    border-color: rgba(245, 158, 11, 0.24);
    background: rgba(245, 158, 11, 0.1);
}

.task-progress {
    margin-top: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.task-progress-track {
    flex: 1;
    height: 8px;
    border-radius: 999px;
    background: #ececf6;
    overflow: hidden;
}

.task-progress-bar {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--writing-accent-start), var(--writing-accent-end));
}

.task-progress-text {
    min-width: 42px;
    color: var(--writing-muted);
    font-size: 12px;
    font-weight: 700;
    text-align: right;
}

.meta-bar {
    margin-top: 14px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.meta-bar.empty {
    display: none;
}

.meta-chip,
.outline-chip,
.project-tag {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(124, 58, 237, 0.08);
    color: #5b21b6;
    font-size: 12px;
    font-weight: 700;
}

.outline-container {
    margin-top: 14px;
    flex: 1;
    min-height: 520px;
    padding: 16px;
    border: 1px solid var(--writing-border);
    border-radius: 16px;
    background: #fbfbfe;
    overflow: auto;
}

.empty-state {
    min-height: 100%;
    display: grid;
    place-items: center;
    text-align: center;
    color: var(--writing-muted);
}

.empty-state h3 {
    margin: 0;
    color: var(--writing-text);
    font-size: 22px;
}

.empty-state p {
    margin: 10px 0 0;
    font-size: 15px;
}

.outline-node {
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
}

.outline-node + .outline-node {
    margin-top: 12px;
}

.outline-node.depth-2 {
    margin-left: 24px;
}

.outline-node.depth-3 {
    margin-left: 48px;
}

.outline-node.depth-4 {
    margin-left: 72px;
}

.outline-node-head {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr) repeat(4, 30px);
    align-items: center;
    gap: 6px;
    overflow-x: visible;
    overflow-y: visible;
    padding-bottom: 0;
}

.outline-node-identity {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.outline-no {
    min-width: 0;
    height: 52px;
    padding: 0 6px 0 0;
    font-size: 16px;
    font-weight: 400;
    color: #475569;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.outline-field-shell {
    min-width: 0;
    min-height: 52px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 84px;
    align-items: stretch;
    border: 1px solid rgba(203, 213, 225, 0.82);
    border-radius: 16px;
    background: linear-gradient(180deg, #ffffff 0%, #fdfefe 100%);
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.04);
    overflow: hidden;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.outline-node:hover .outline-field-shell {
    border-color: rgba(148, 163, 184, 0.72);
    box-shadow: 0 14px 26px rgba(15, 23, 42, 0.07);
}

.outline-node.selected .outline-field-shell {
    border-color: rgba(37, 99, 235, 0.38);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.08), 0 16px 30px rgba(37, 99, 235, 0.10);
}

.outline-input {
    height: 52px;
    padding: 0 14px;
    font-size: 16px;
    font-weight: 400;
    border: none;
    border-radius: 0;
    background: transparent;
    color: #111827;
}

.outline-input:focus {
    outline: none;
}

.outline-word-box {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 0 10px;
    border-left: 1px solid rgba(226, 232, 240, 0.92);
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}

.outline-word-input {
    width: 42px;
    min-width: 42px;
    border: none;
    background: transparent;
    padding: 0;
    font-size: 13px;
    font-weight: 400;
    color: #334155;
    text-align: right;
}

.outline-word-input:focus {
    outline: none;
}

.outline-word-suffix {
    font-size: 12px;
    font-weight: 400;
    color: #94a3b8;
}

.outline-node-actions {
    display: grid;
    grid-template-columns: repeat(4, 30px);
    gap: 6px;
    align-items: center;
}

.outline-action-btn {
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.58);
    backdrop-filter: blur(8px);
    color: var(--writing-text);
    min-height: 30px;
    min-width: 30px;
    padding: 0;
    font-size: 0;
    font-weight: 400;
    cursor: pointer;
    transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0.78;
}

.outline-action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.08);
    opacity: 1;
}

.outline-action-btn:disabled {
    opacity: 0.28;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.outline-action-symbol {
    font-size: 16px;
    line-height: 1;
    font-weight: 400;
    transform: translateY(-0.5px);
}

.outline-action-add {
    color: #0f172a;
}

.outline-action-primary {
    color: #1d4ed8;
    border-color: rgba(37, 99, 235, 0.20);
    background: rgba(239, 246, 255, 0.95);
}

.outline-action-warm {
    color: #ea580c;
    border-color: rgba(249, 115, 22, 0.20);
    background: rgba(255, 247, 237, 0.92);
}

.outline-action-danger {
    color: #dc2626;
    border-color: rgba(220, 38, 38, 0.16);
    background: rgba(220, 38, 38, 0.04);
}

.outline-tip {
    margin-top: 8px;
    margin-left: 86px;
    padding: 9px 12px;
    color: var(--writing-muted);
    font-size: 12px;
    line-height: 1.6;
    border-radius: 10px;
    background: rgba(248, 250, 252, 0.88);
    border: 1px solid rgba(226, 232, 240, 0.9);
}

.outline-children {
    margin-top: 12px;
}

.outline-bottom-tools {
    margin-top: 14px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.outline-bottom-minor {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.outline-bottom-primary {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}

.outline-bottom-hint {
    margin: 0;
    color: var(--writing-muted);
    font-size: 12px;
    line-height: 1.5;
    text-align: right;
}

.outline-generate-paper-btn {
    width: 124px;
    min-width: 124px;
    padding: 0 12px;
}

.subtle-btn {
    min-height: 40px;
    padding: 0 14px;
    border: 1px solid var(--writing-border-strong);
    background: #fff;
    color: var(--writing-text);
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.04);
}

.subtle-btn-primary {
    border-color: rgba(124, 58, 237, 0.22);
    background: rgba(124, 58, 237, 0.06);
    color: #6d28d9;
}

.aux-intro {
    margin: 10px 0 0;
    color: var(--writing-muted);
    font-size: 13px;
    line-height: 1.7;
}

.aux-kicker {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(124, 58, 237, 0.08);
    color: #6d28d9;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.project-records-drawer {
    margin-top: 16px;
    border: 1px solid rgba(124, 58, 237, 0.18);
    border-radius: 18px;
    background: linear-gradient(180deg, #ffffff 0%, #fcfbff 100%);
    box-shadow: 0 18px 36px rgba(124, 58, 237, 0.08);
    padding: 18px;
}

.project-records-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}

.project-records-head h3 {
    margin: 8px 0 0;
    font-size: 20px;
    line-height: 1.3;
}

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

.project-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.stat-card {
    padding: 14px 12px;
    border: 1px solid var(--writing-border);
    border-radius: 18px;
    background: var(--writing-soft);
}

.stat-label {
    display: block;
    color: var(--writing-muted);
    font-size: 13px;
}

.stat-value {
    display: block;
    margin-top: 8px;
    font-size: 24px;
    line-height: 1;
    font-weight: 800;
    color: #5b21b6;
}

.project-list {
    display: grid;
    gap: 10px;
    max-height: 360px;
    overflow: auto;
    padding-right: 4px;
}

.project-card {
    padding: 16px;
    border: 1px solid var(--writing-border);
    border-radius: 18px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.project-card:hover,
.project-card.active {
    transform: translateY(-1px);
    border-color: rgba(124, 58, 237, 0.28);
    box-shadow: 0 12px 24px rgba(124, 58, 237, 0.08);
}

.project-card h3 {
    margin: 0;
    font-size: 15px;
    line-height: 1.7;
}

.project-meta {
    margin-top: 10px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.project-updated {
    margin-top: 10px;
    color: var(--writing-muted);
    font-size: 12px;
}

.section-info-box {
    padding: 14px 16px;
    border: 1px solid var(--writing-border);
    border-radius: 14px;
    background: var(--writing-soft);
    color: var(--writing-muted);
    font-size: 13px;
    line-height: 1.7;
}

.editor-field {
    display: block;
    margin-top: 16px;
}

.editor-field-brief {
    margin-top: 0;
}

.editor-field span {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 700;
}

.editor-field textarea {
    min-height: 96px;
}

.prompt-panel {
    margin-top: 16px;
    border: 1px solid rgba(124, 58, 237, 0.14);
    border-radius: 14px;
    background: rgba(124, 58, 237, 0.04);
    overflow: hidden;
}

.prompt-panel-header {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(124, 58, 237, 0.12);
    font-size: 14px;
}

.prompt-preview {
    margin: 0;
    padding: 16px;
    color: #4338ca;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    line-height: 1.7;
    white-space: pre-wrap;
}

.editor-studio {
    display: grid;
    gap: 16px;
}

.editor-panels {
    display: grid;
    gap: 14px;
}

.editor-pane {
    display: block;
    margin: 0;
    padding: 16px;
    border: 1px solid rgba(223, 227, 239, 0.96);
    border-radius: 18px;
    background: linear-gradient(180deg, #ffffff 0%, #fcfcff 100%);
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.04);
}

.editor-pane-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.editor-pane-head strong {
    font-size: 15px;
    line-height: 1.3;
}

.editor-pane-head span {
    color: var(--writing-muted);
    font-size: 12px;
    line-height: 1.6;
    text-align: right;
}

.section-editor {
    margin-top: 0;
    min-height: 280px;
}

.draft-preview {
    margin-top: 0;
    min-height: 240px;
    background: #fcfcff;
}

.compose-card-outline[data-view-mode="writing"] #outlineContainer,
.compose-card-outline[data-view-mode="writing"] #outlineMetaBar,
.compose-card-outline[data-view-mode="writing"] .outline-bottom-tools,
.compose-card-outline[data-view-mode="writing"] #existingOutlinePanel {
    display: none;
}

.compose-card-outline[data-view-mode="writing"] .outline-actions {
    display: none;
}

.compose-card-outline[data-view-mode="writing"] #taskStatus {
    margin-bottom: 0;
}

.writing-workspace {
    margin-top: 14px;
    border-top: 1px dashed rgba(148, 163, 184, 0.4);
    padding-top: 14px;
    display: grid;
    gap: 14px;
}

.workspace-topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.workspace-topbar h3 {
    margin: 8px 0 0;
    font-size: 22px;
    line-height: 1.3;
}

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

.workspace-progress-card {
    border: 1px solid rgba(124, 58, 237, 0.2);
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(124, 58, 237, 0.05), rgba(124, 58, 237, 0.02));
    padding: 14px;
}

.workspace-progress-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.workspace-progress-head strong {
    font-size: 14px;
}

.workspace-progress-head span {
    color: #6d28d9;
    font-size: 13px;
    font-weight: 700;
}

.workspace-progress-track {
    margin: 0;
}

.workspace-progress-note {
    margin: 10px 0 0;
    color: var(--writing-muted);
    font-size: 13px;
    line-height: 1.6;
}

.workspace-actions-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
}

.literature-panel {
    display: grid;
    gap: 16px;
    padding: 18px;
    border: 1px solid rgba(59, 130, 246, 0.1);
    border-radius: 22px;
    background:
        linear-gradient(180deg, rgba(248, 250, 252, 0.98), rgba(255, 255, 255, 0.98)),
        radial-gradient(circle at top right, rgba(59, 130, 246, 0.08), transparent 34%),
        radial-gradient(circle at bottom left, rgba(124, 58, 237, 0.05), transparent 28%);
    box-shadow: 0 18px 34px rgba(15, 23, 42, 0.05);
}

.literature-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.literature-panel-head h4 {
    margin: 6px 0 0;
    font-size: 19px;
    line-height: 1.35;
}

.literature-panel-head p {
    margin: 6px 0 0;
    font-size: 13px;
    line-height: 1.7;
    color: var(--writing-muted);
}

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

.literature-config-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.literature-count-field input,
.literature-keyword-field input {
    height: 44px;
}

.literature-panel-meta {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.literature-status-cluster {
    display: grid;
    gap: 8px;
    min-width: min(100%, 620px);
}

.literature-search-status {
    font-size: 13px;
    line-height: 1.7;
    color: var(--writing-muted);
}

.literature-search-status.is-loading {
    color: #2563eb;
}

.literature-search-status.is-error {
    color: #dc2626;
}

.literature-search-facts {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.literature-fact-chip {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 12px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
    color: #475569;
    font-size: 12px;
    font-weight: 600;
}

.literature-selected-summary {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    max-width: 100%;
    padding: 0 14px;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.12), rgba(59, 130, 246, 0.08));
    color: #5b21b6;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.5;
}

.literature-query-plan {
    display: grid;
    gap: 10px;
    padding: 14px;
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    background: rgba(248, 250, 252, 0.94);
    color: #475569;
}

.literature-plan-group {
    display: grid;
    gap: 8px;
}

.literature-plan-label {
    font-size: 12px;
    font-weight: 700;
    color: #0f172a;
}

.literature-plan-copy {
    font-size: 13px;
    line-height: 1.7;
    color: #334155;
}

.literature-plan-chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.literature-plan-chip {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 12px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.08);
    color: #1d4ed8;
    font-size: 12px;
    font-weight: 600;
}

.literature-plan-chip.is-foreign {
    background: rgba(245, 158, 11, 0.12);
    color: #b45309;
}

.literature-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.literature-column {
    display: grid;
    gap: 12px;
    align-content: start;
    min-height: 0;
    padding: 14px;
    border: 1px solid rgba(223, 227, 239, 0.92);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.literature-column-manual {
    grid-column: 1 / -1;
    background: linear-gradient(180deg, rgba(255, 250, 245, 0.95), rgba(255, 255, 255, 0.96));
}

.literature-column-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.literature-column-head-copy {
    display: grid;
    gap: 4px;
}

.literature-column-kicker {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #64748b;
}

.literature-column-head strong {
    font-size: 14px;
}

.literature-column-head span {
    font-size: 12px;
    color: var(--writing-muted);
}

.literature-result-list {
    display: grid;
    gap: 12px;
    max-height: 520px;
    overflow-y: auto;
    padding-right: 4px;
}

.literature-column-manual .literature-result-list {
    max-height: 300px;
}

.literature-result-list::-webkit-scrollbar {
    width: 6px;
}

.literature-result-list::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.38);
}

.literature-entry {
    display: grid;
    gap: 12px;
    padding: 14px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.04);
}

.literature-entry.is-selected {
    border-color: rgba(124, 58, 237, 0.22);
    box-shadow: 0 14px 28px rgba(99, 102, 241, 0.12);
}

.literature-entry-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.literature-entry-heading {
    display: grid;
    gap: 8px;
    min-width: 0;
    flex: 1 1 auto;
}

.literature-entry-title-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
}

.literature-entry-title {
    margin: 0;
    font-size: 15px;
    line-height: 1.65;
    font-weight: 700;
    color: #111827;
}

.literature-entry-subtitle {
    font-size: 12px;
    line-height: 1.7;
    color: #64748b;
}

.literature-entry-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.08);
    color: #1d4ed8;
    font-size: 11px;
    font-weight: 700;
}

.literature-entry-badge.is-foreign {
    background: rgba(245, 158, 11, 0.12);
    color: #b45309;
}

.literature-entry-badge.is-manual {
    background: rgba(16, 185, 129, 0.12);
    color: #047857;
}

.literature-entry-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 999px;
    background: rgba(248, 250, 252, 0.96);
    cursor: pointer;
}

.literature-entry-toggle input {
    margin: 0;
    accent-color: #7c3aed;
}

.literature-entry-toggle span {
    font-size: 12px;
    font-weight: 700;
    color: #334155;
}

.literature-entry-toggle.is-selected {
    border-color: rgba(124, 58, 237, 0.18);
    background: rgba(124, 58, 237, 0.08);
}

.literature-entry-toggle.is-selected span {
    color: #6d28d9;
}

.literature-entry-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.literature-entry-tag {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(241, 245, 249, 0.9);
    color: #475569;
    font-size: 11px;
    font-weight: 600;
}

.literature-entry-citation-wrap {
    display: grid;
    gap: 8px;
}

.literature-entry-citation-label {
    font-size: 12px;
    font-weight: 700;
    color: #475569;
}

.literature-citation-editor {
    width: 100%;
    min-height: 112px;
    padding: 12px;
    border: 1px solid var(--writing-border);
    border-radius: 12px;
    resize: vertical;
    background: rgba(248, 250, 252, 0.9);
    color: var(--writing-text);
    font-size: 12px;
    line-height: 1.7;
}

.literature-citation-editor:focus {
    outline: 0;
    border-color: rgba(59, 130, 246, 0.36);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.08);
}

.literature-entry-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: flex-end;
}

.literature-entry-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.literature-entry-footnote {
    font-size: 12px;
    line-height: 1.6;
    color: #64748b;
}

.literature-detail-link {
    color: #2563eb;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
}

.literature-detail-link:hover {
    text-decoration: underline;
}

.literature-delete-btn {
    border: 0;
    background: transparent;
    color: #dc2626;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.literature-delete-btn:hover {
    text-decoration: underline;
}

.literature-empty {
    padding: 18px 14px;
    border: 1px dashed rgba(148, 163, 184, 0.24);
    border-radius: 14px;
    background: rgba(248, 250, 252, 0.86);
    font-size: 12px;
    line-height: 1.8;
    color: var(--writing-muted);
}

.literature-manual-field textarea {
    min-height: 108px;
}

.literature-manual-actions {
    display: flex;
    justify-content: flex-end;
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    transform: translateX(-50%);
    padding: 12px 18px;
    border-radius: 999px;
    background: rgba(17, 24, 39, 0.92);
    color: #fff;
    font-size: 14px;
    z-index: 2000;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.18);
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 2200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(8, 15, 31, 0.54);
    backdrop-filter: blur(12px);
}

.payment-modal-content {
    width: min(500px, 100%);
    max-height: min(calc(100vh - 28px), 720px);
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(124, 58, 237, 0.12);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 26px 60px rgba(15, 23, 42, 0.22);
    overflow: hidden;
}

.modal-header,
.modal-body {
    padding: 18px 20px;
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable;
}

.modal-body::-webkit-scrollbar {
    width: 6px;
}

.modal-body::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.42);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--writing-border);
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--writing-text);
}

.modal-close {
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.06);
    color: var(--writing-text);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.modal-close:hover {
    background: rgba(15, 23, 42, 0.1);
}

.payment-card-header {
    margin-bottom: 6px;
}

.payment-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.payment-icon-wrapper {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.14), rgba(192, 38, 211, 0.12));
    color: #6d28d9;
}

.payment-title {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
}

.payment-subtitle {
    margin: 2px 0 0;
    color: var(--writing-muted);
    font-size: 12px;
}

.qr-code-display-area {
    min-height: 286px;
    padding: 10px 10px 8px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    border: 1px dashed rgba(124, 58, 237, 0.18);
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(248, 248, 253, 0.9), rgba(255, 255, 255, 0.96));
    overflow: hidden;
}

.qr-code-container {
    width: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2px 6px 0;
    box-sizing: border-box;
}

.qr-code-container img,
.qr-code-container canvas {
    display: block;
    width: min(220px, 100%);
    max-width: 220px;
    height: auto;
    margin: 0 auto;
}

.qr-code-logo-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.96);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
}

.qr-code-info {
    margin-top: 12px;
    text-align: center;
}

.qr-code-title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #1f2937;
}

.countdown-timer {
    margin-top: 10px;
    font-size: 12px;
    color: var(--writing-muted);
    text-align: center;
}

.countdown-timer span {
    font-weight: 600;
    color: #9f1239;
}

.qr-code-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    max-width: 280px;
    margin: auto;
    padding: 0 8px;
    color: var(--writing-muted);
    text-align: center;
}

.qr-code-placeholder p {
    margin: 0;
    font-size: 14px;
    text-align: center;
}

.final-price-display {
    display: none;
}

.final-price-display p {
    display: none;
}

.payment-price-note {
    display: none;
}

.agreement-section {
    margin-top: 2px;
}

.payment-agreement {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 12px;
    color: var(--writing-muted);
    cursor: pointer;
}

.payment-methods {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: -6px 0 8px;
}

.payment-method-btn {
    height: 44px;
    border: 1px solid var(--writing-border-strong);
    border-radius: 12px;
    background: #fff;
    color: var(--writing-text);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.payment-method-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 26px rgba(15, 23, 42, 0.08);
}

.payment-method-btn.active {
    border-color: rgba(124, 58, 237, 0.36);
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.1), rgba(192, 38, 211, 0.08));
    color: #5b21b6;
}

.payment-method-btn.wechat.active {
    border-color: rgba(34, 197, 94, 0.28);
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.12), rgba(74, 222, 128, 0.08));
    color: #15803d;
}

.balance-pay-panel {
    margin-top: 0;
    padding: 12px;
    border: 1px solid rgba(249, 115, 22, 0.16);
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(255, 247, 237, 0.96), rgba(255, 255, 255, 0.98));
}

.balance-pay-btn {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    border: 0;
    border-radius: 14px;
    padding: 7px 14px;
    background: linear-gradient(135deg, #ea580c, #c2410c);
    color: #fff;
    box-shadow: 0 12px 24px rgba(194, 65, 12, 0.24);
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.balance-pay-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 28px rgba(194, 65, 12, 0.3);
}

.balance-pay-btn:disabled,
.balance-pay-btn.disabled {
    opacity: 0.56;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.balance-pay-main {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.25;
}

.balance-pay-meta {
    font-size: 11px;
    line-height: 1.35;
    opacity: 0.94;
}

.balance-pay-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 8px;
    font-size: 12px;
}

.balance-pay-hint {
    color: #9a3412;
}

.balance-recharge-link {
    color: #ea580c;
    font-weight: 600;
    text-decoration: none;
}

.balance-recharge-link:hover {
    text-decoration: underline;
}

.balance-pay-error {
    margin-top: 8px;
    padding: 8px 10px;
    border: 1px solid rgba(245, 158, 11, 0.28);
    border-radius: 12px;
    background: rgba(255, 251, 235, 0.96);
    color: #b45309;
    font-size: 12px;
    line-height: 1.6;
}

.overflow-confirm-content {
    width: min(560px, 100%);
    border-radius: 28px;
    background:
        radial-gradient(circle at top left, rgba(59, 130, 246, 0.14), transparent 32%),
        radial-gradient(circle at top right, rgba(249, 115, 22, 0.12), transparent 26%),
        rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(148, 163, 184, 0.18);
    box-shadow: 0 30px 70px rgba(15, 23, 42, 0.24);
    overflow: hidden;
}

.overflow-confirm-shell {
    padding: 28px;
}

.overflow-confirm-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 30px;
    padding: 0 12px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.08);
    color: #1d4ed8;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.overflow-confirm-title {
    margin: 16px 0 8px;
    font-size: 28px;
    line-height: 1.2;
    font-weight: 800;
    color: #0f172a;
}

.overflow-confirm-copy {
    margin: 0;
    font-size: 15px;
    line-height: 1.9;
    color: #475569;
}

.overflow-confirm-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 22px;
}

.overflow-metric-card {
    padding: 16px 14px;
    border-radius: 18px;
    background: rgba(248, 250, 252, 0.94);
    border: 1px solid rgba(148, 163, 184, 0.16);
}

.overflow-metric-card-accent {
    background: linear-gradient(180deg, rgba(255, 247, 237, 0.98), rgba(255, 255, 255, 0.98));
    border-color: rgba(249, 115, 22, 0.18);
}

.overflow-metric-label {
    display: block;
    font-size: 12px;
    color: #64748b;
    letter-spacing: 0.04em;
}

.overflow-metric-value {
    display: block;
    margin-top: 10px;
    font-size: 30px;
    line-height: 1;
    font-weight: 800;
    color: #0f172a;
}

.overflow-metric-card-accent .overflow-metric-value {
    color: #ea580c;
}

.overflow-confirm-note {
    margin-top: 18px;
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(15, 23, 42, 0.04);
    color: #334155;
    font-size: 14px;
    line-height: 1.8;
}

.overflow-confirm-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 22px;
}

.overflow-confirm-btn {
    height: 52px;
    border-radius: 16px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.overflow-confirm-btn:hover {
    transform: translateY(-1px);
}

.overflow-confirm-btn-secondary {
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: #fff;
    color: #334155;
}

.overflow-confirm-btn-secondary:hover {
    box-shadow: 0 14px 28px rgba(148, 163, 184, 0.18);
}

.overflow-confirm-btn-primary {
    border: 0;
    background: linear-gradient(135deg, #2563eb, #f97316);
    color: #fff;
    box-shadow: 0 18px 36px rgba(37, 99, 235, 0.28);
}

.overflow-confirm-btn-primary:hover {
    box-shadow: 0 22px 42px rgba(37, 99, 235, 0.32);
}

.security-assurance {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.04);
    color: var(--writing-muted);
    font-size: 12px;
    line-height: 1.55;
}

@media (min-width: 1360px) {
    .writer-stage {
        width: min(1600px, calc(100% - 40px));
    }

    .entry-switcher {
        margin: 0 0 14px;
    }

    .compose-shell {
        margin-top: 0;
    }

    .project-records-drawer::-webkit-scrollbar,
    .project-list::-webkit-scrollbar {
        width: 8px;
    }

    .project-records-drawer::-webkit-scrollbar-thumb,
    .project-list::-webkit-scrollbar-thumb {
        border-radius: 999px;
        background: rgba(148, 163, 184, 0.28);
    }

    .project-records-drawer {
        padding: 20px;
        border-radius: 20px;
    }

    .project-stats {
        gap: 8px;
        margin-bottom: 14px;
    }

    .stat-card {
        border-radius: 16px;
        padding: 12px;
    }

    .stat-value {
        font-size: 22px;
    }

    .project-list {
        max-height: 300px;
    }

    .project-card {
        border-radius: 16px;
        padding: 14px;
    }

    .editor-pane {
        padding: 14px;
        border-radius: 20px;
    }

    .editor-pane-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .editor-pane-head span {
        text-align: left;
    }

    .section-editor {
        min-height: 300px;
    }

    .draft-preview {
        min-height: 260px;
    }

    .workspace-actions-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

@media (max-width: 1280px) {
    .entry-mode-grid {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
    }

    .compose-shell {
        grid-template-columns: minmax(0, 1fr);
    }

    .compose-card-outline {
        min-height: 680px;
    }

    .workspace-actions-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .literature-columns {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 960px) {
    .writer-stage {
        width: min(100%, calc(100% - 24px));
        padding: 18px 0 92px;
    }

    .entry-switcher {
        padding: 20px;
        border-radius: 22px;
    }

    .compose-card {
        padding: 22px;
        border-radius: 22px;
    }

    .step-title,
    .outline-title {
        font-size: 20px;
    }

    .title-row {
        grid-template-columns: minmax(0, 1fr);
    }

    .title-row .gradient-btn,
    .outline-actions .gradient-btn,
    .gradient-btn-submit {
        width: 100%;
        min-width: 0;
    }

    .outline-topbar,
    .workspace-topbar,
    .project-records-head {
        flex-direction: column;
    }

    .outline-actions,
    .project-records-actions,
    .workspace-topbar-actions,
    .outline-bottom-tools {
        width: 100%;
    }

    .outline-bottom-minor,
    .outline-bottom-primary {
        width: 100%;
    }

    .outline-bottom-primary {
        align-items: stretch;
    }

    .outline-generate-paper-btn {
        width: 100%;
        min-width: 0;
    }

    .outline-bottom-hint {
        text-align: left;
    }

    .payment-modal-content {
        max-height: calc(100vh - 18px);
        border-radius: 20px;
    }

    .overflow-confirm-shell {
        padding: 22px;
    }

    .overflow-confirm-title {
        font-size: 24px;
    }

    .modal-header,
    .modal-body {
        padding: 16px;
    }

    .payment-methods {
        grid-template-columns: minmax(0, 1fr);
    }

    .qr-code-display-area {
        min-height: 264px;
        padding: 9px 8px 8px;
    }

    .balance-pay-panel {
        margin-top: 8px;
        padding: 10px;
    }

    .overflow-confirm-metrics,
    .overflow-confirm-actions {
        grid-template-columns: minmax(0, 1fr);
    }

    .balance-pay-foot {
        flex-direction: column;
        align-items: flex-start;
    }

    .outline-actions .gradient-btn,
    .subtle-btn {
        flex: 1 1 0;
    }

    .workspace-actions-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .literature-panel-head,
    .literature-panel-meta {
        flex-direction: column;
        align-items: stretch;
    }

    .literature-status-cluster {
        min-width: 0;
    }

    .literature-panel-actions {
        justify-content: flex-start;
    }

    .literature-config-grid,
    .literature-columns {
        grid-template-columns: 1fr;
    }

    .literature-column-manual {
        grid-column: auto;
    }

    .outline-node.depth-2 {
        margin-left: 16px;
    }

    .outline-node.depth-3 {
        margin-left: 32px;
    }

    .outline-node.depth-4 {
        margin-left: 48px;
    }

    .outline-node-head {
        grid-template-columns: 56px minmax(0, 1fr) repeat(4, 28px);
        gap: 6px;
    }

    .outline-field-shell {
        min-height: 48px;
        grid-template-columns: minmax(0, 1fr) 72px;
        border-radius: 14px;
    }

    .outline-input {
        height: 48px;
        padding: 0 14px;
        font-size: 15px;
    }

    .outline-no {
        height: 48px;
        font-size: 15px;
    }

    .outline-node-actions {
        grid-template-columns: repeat(4, 28px);
    }

    .outline-action-btn {
        min-height: 28px;
        min-width: 28px;
        border-radius: 9px;
    }

    .outline-action-symbol {
        font-size: 15px;
    }

    .outline-tip {
        margin-left: 68px;
    }

    .project-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .entry-switcher-head h2 {
        font-size: 22px;
    }

    .start-mode-option {
        min-height: 0;
        padding: 14px;
    }

    .step-input,
    .step-textarea,
    .gradient-btn,
    .outline-import-panel textarea {
        font-size: 16px;
    }

    .step-input,
    .gradient-btn {
        min-height: 52px;
        height: 52px;
    }

    .step-textarea {
        min-height: 156px;
    }

    .outline-title {
        white-space: normal;
    }

    .project-stats {
        grid-template-columns: 1fr;
    }

    .workspace-actions-grid {
        grid-template-columns: 1fr;
    }

    .literature-panel {
        padding: 14px;
    }

    .literature-result-list {
        max-height: none;
    }

    .literature-entry-head,
    .literature-entry-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .literature-entry-toggle {
        align-self: flex-start;
    }

    .outline-container {
        min-height: 420px;
        padding: 16px;
    }

    .outline-node.depth-2 {
        margin-left: 10px;
    }

    .outline-node.depth-3 {
        margin-left: 20px;
    }

    .outline-node.depth-4 {
        margin-left: 30px;
    }

    .outline-node-head {
        grid-template-columns: 46px minmax(0, 1fr) repeat(4, 26px);
        gap: 6px;
        overflow-x: auto;
        padding-bottom: 2px;
    }

    .outline-field-shell {
        min-height: 44px;
        grid-template-columns: minmax(0, 1fr) 58px;
        border-radius: 12px;
    }

    .outline-input {
        height: 44px;
        padding: 0 12px;
        font-size: 15px;
    }

    .outline-no {
        height: 44px;
        font-size: 14px;
    }

    .outline-word-box {
        padding: 0 8px;
    }

    .outline-word-input {
        width: 30px;
        min-width: 30px;
        font-size: 12px;
    }

    .outline-node-actions {
        grid-template-columns: repeat(4, 26px);
    }

    .outline-action-btn {
        min-height: 26px;
        min-width: 26px;
        border-radius: 8px;
    }

    .outline-action-symbol {
        font-size: 14px;
    }

    .outline-tip {
        margin-left: 0;
    }

    .modal {
        padding: 12px;
    }

    .modal-header,
    .modal-body {
        padding: 15px;
    }

    .payment-methods {
        grid-template-columns: 1fr;
    }

    .payment-modal-content {
        max-height: calc(100vh - 12px);
    }

    .payment-title-group {
        gap: 10px;
    }

    .payment-icon-wrapper {
        width: 38px;
        height: 38px;
        border-radius: 12px;
    }

    .qr-code-display-area {
        min-height: 244px;
        padding: 8px 8px 6px;
    }

    .qr-code-container img,
    .qr-code-container canvas {
        width: min(196px, 100%);
        max-width: 196px;
    }

    .balance-pay-panel {
        margin-top: 8px;
        padding: 10px;
    }

    .overflow-confirm-shell {
        padding: 18px;
    }

    .overflow-confirm-title {
        font-size: 21px;
    }

    .overflow-confirm-copy {
        font-size: 14px;
        line-height: 1.8;
    }

    .overflow-metric-value {
        font-size: 26px;
    }
}
