/* ===== Design System ===== */
:root {
    --bg-primary: #06090f;
    --bg-secondary: #080d18;
    --bg-card: #0b1020;
    --bg-card-hover: #111826;
    --border: rgba(180, 150, 100, 0.14);
    --border-accent: rgba(212, 168, 67, 0.42);
    --text-primary: #ede8dc;
    --text-secondary: #9a8e7a;
    --text-muted: #5a5048;
    --accent-1: #d4a843;
    --accent-2: #e8c96e;
    --accent-gradient: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    --success: #5aaa70;
    --warning: #c8894a;
    --error: #b85555;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 24px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 24px rgba(212, 168, 67, 0.12);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font-serif: 'Songti SC', 'STFangsong', 'FangSong', 'SimSun', 'NSimSun', serif;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', 'PingFang SC', sans-serif;
}

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

body {
    font-family: var(--font-sans);
    background-color: #06090f;
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    line-height: 1.6;
}

/* 背景图单独用伪元素，方便加 brightness 滤镜提亮 */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: url('/static/bg-ancient.jpg') center / cover no-repeat fixed;
    filter: brightness(2.2);
    pointer-events: none;
    z-index: -1;
}

button {
    cursor: pointer;
    font-family: inherit;
}

a {
    color: var(--accent-1);
    text-decoration: none;
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(180, 150, 100, 0.2);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(180, 150, 100, 0.38);
}

/* ===== SVG Icon System ===== */
svg.icon {
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}

/* ===== Navigation ===== */
.top-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 24px;
    background: rgba(4, 8, 18, 0.55);
    backdrop-filter: blur(6px);
    border-bottom: 1px solid rgba(212, 168, 67, 0.2);
    /* 底部装饰双线 */
    box-shadow: 0 1px 0 rgba(212, 168, 67, 0.07);
    flex-shrink: 0;
    z-index: 10;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-brand .logo {
    width: 34px;
    height: 34px;
    background: rgba(212, 168, 67, 0.1);
    border: 1px solid rgba(212, 168, 67, 0.45);
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-1);
    /* 外发光 + 内高光 */
    box-shadow: 0 0 12px rgba(212, 168, 67, 0.15), inset 0 1px 0 rgba(212, 168, 67, 0.2);
}

.nav-brand h1 {
    font-size: 20px;
    font-weight: 700;
    font-family: var(--font-serif);
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 2.5px;
}

.brand-en {
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 13px;
    font-weight: 400;
    letter-spacing: 4px;
    margin-left: 8px;
    vertical-align: baseline;
    /* 脱离 h1 的渐变填充，用独立颜色 */
    -webkit-text-fill-color: var(--text-secondary);
    background: none;
}

.brand-sub {
    font-size: 13.5px;
    color: var(--text-secondary);
    font-family: var(--font-serif);
    letter-spacing: 1.5px;
    margin-left: 12px;
    padding-left: 12px;
    border-left: 1px solid rgba(212, 168, 67, 0.3);
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

.nav-controls > label:not(.format-toggle) {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.mode-select {
    background: rgba(28, 26, 22, 0.9);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 7px 14px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: var(--transition);
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239a8e7a' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 32px;
}

.mode-select:hover { border-color: var(--accent-1); }
.mode-select:focus {
    border-color: var(--accent-1);
    box-shadow: 0 0 0 2px rgba(212, 168, 67, 0.15);
}

/* Format Toggle */
.format-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 6px 12px;
    background: rgba(28, 26, 22, 0.9);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: var(--transition);
    user-select: none;
}

.format-toggle:hover {
    border-color: var(--accent-1);
    background: rgba(212, 168, 67, 0.06);
}

.format-toggle input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: var(--accent-1);
    cursor: pointer;
    margin: 0;
}

.format-toggle-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
}

/* ===== Main Content ===== */
.main-content {
    display: grid;
    grid-template-columns: 2fr 3fr;
    gap: 20px;
    flex: 1 1 0;
    padding: 16px 24px;
    min-height: 0;
    overflow: hidden;
    position: relative;
}

/* 书脊装饰线 — 模拟古籍中缝装订线 */
.main-content::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 40%;
    transform: translateY(-50%);
    width: 1px;
    height: 55%;
    background: linear-gradient(to bottom, transparent, rgba(212, 168, 67, 0.2) 20%, rgba(212, 168, 67, 0.3) 50%, rgba(212, 168, 67, 0.2) 80%, transparent);
    pointer-events: none;
}

/* ===== Panel Base ===== */
/* 双线框（版刻感）: 外框(border) + 内框(outline) */
.panel {
    background-color: rgba(5, 10, 22, 0.45);
    border: 1px solid rgba(212, 168, 67, 0.3);
    /* 内框：模拟古籍版刻双线框 */
    outline: 1px solid rgba(212, 168, 67, 0.09);
    outline-offset: -6px;
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    backdrop-filter: blur(3px);
    transition: var(--transition);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(212, 168, 67, 0.06), inset 0 0 40px rgba(212, 168, 67, 0.02);
}

.panel:hover {
    border-color: rgba(212, 168, 67, 0.42);
    outline-color: rgba(212, 168, 67, 0.14);
}

/* 面板头：左侧金色竖条（章节标注感） */
.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px 12px 16px;
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font-serif);
    color: var(--text-secondary);
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(212, 168, 67, 0.12);
    /* 双线分隔效果 */
    box-shadow: 0 1px 0 rgba(212, 168, 67, 0.05);
    flex-shrink: 0;
    border-left: 2px solid rgba(212, 168, 67, 0.65);
    background: rgba(5, 10, 22, 0.25);
}

.panel-header-icon {
    margin-right: 7px;
    color: var(--accent-1);
    opacity: 0.8;
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
}

/* ===== Image Panel ===== */
.image-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    min-height: 0;
    background: rgba(5, 10, 22, 0.15);
}

.image-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    color: var(--text-muted);
}

.image-placeholder .icon {
    opacity: 0.3;
    color: var(--accent-1);
    display: flex;
}

.image-placeholder p { font-size: 13px; }

#previewImage {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 10px;
    border-top: 1px solid rgba(212, 168, 67, 0.1);
    flex-shrink: 0;
}

.pagination button {
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 14px;
    font-size: 13px;
    transition: var(--transition);
}

.pagination button:hover:not(:disabled) {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--accent-1);
}

.pagination button:disabled { opacity: 0.3; cursor: not-allowed; }

.pagination .page-info {
    font-size: 13px;
    color: var(--text-secondary);
    min-width: 60px;
    text-align: center;
}

/* ===== Result Panel ===== */
.result-container {
    flex: 1 1 0;
    overflow-y: auto;
    padding: 20px 20px 20px 22px;
    min-height: 0;
    position: relative;
    /* 结果区半透明 — 让背景星象隐约可见 */
    background: rgba(5, 10, 22, 0.15);
}

#resultText {
    font-family: var(--font-serif);
    font-size: 15px;
    line-height: 1.9;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--text-primary);
    /* 版心左边线 */
    border-left: 1px solid rgba(212, 168, 67, 0.12);
    padding-left: 16px;
}

.result-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    gap: 14px;
}

.result-placeholder .icon {
    opacity: 0.28;
    color: var(--accent-1);
    display: flex;
}

.result-placeholder p { font-size: 13px; }

.panel-actions { display: flex; gap: 8px; }

.btn-icon {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-icon:hover {
    color: var(--accent-1);
    border-color: var(--accent-1);
    background: rgba(212, 168, 67, 0.08);
}

.btn-icon.copied {
    color: var(--success);
    border-color: var(--success);
    background: rgba(90, 170, 112, 0.08);
}

/* ===== Bottom Section ===== */
.bottom-section {
    padding: 12px 24px 16px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Upload Zone — 四角花角装饰 */
.upload-zone {
    border: 1px solid rgba(212, 168, 67, 0.38);
    border-radius: var(--radius-lg);
    padding: 26px 20px;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    background-color: rgba(5, 10, 22, 0.08);
    backdrop-filter: blur(2px);
    /* 四角装饰线（角花效果） */
    background-image:
        linear-gradient(var(--accent-1), var(--accent-1)),
        linear-gradient(var(--accent-1), var(--accent-1)),
        linear-gradient(var(--accent-1), var(--accent-1)),
        linear-gradient(var(--accent-1), var(--accent-1)),
        linear-gradient(var(--accent-1), var(--accent-1)),
        linear-gradient(var(--accent-1), var(--accent-1)),
        linear-gradient(var(--accent-1), var(--accent-1)),
        linear-gradient(var(--accent-1), var(--accent-1));
    background-size:
        18px 1.5px, 1.5px 18px,
        18px 1.5px, 1.5px 18px,
        18px 1.5px, 1.5px 18px,
        18px 1.5px, 1.5px 18px;
    background-position:
        10px 10px, 10px 10px,
        calc(100% - 10px) 10px, calc(100% - 10px) 10px,
        10px calc(100% - 10px), 10px calc(100% - 11px),
        calc(100% - 10px) calc(100% - 10px), calc(100% - 10px) calc(100% - 11px);
    background-repeat: no-repeat;
    background-blend-mode: normal;
    /* 四角线透明度由 opacity 统一控制，独立加在父容器 */
}

/* 利用 opacity 自定义四角线颜色深度 */
.upload-zone::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(212,168,67,0.5), rgba(212,168,67,0.5)),
        linear-gradient(rgba(212,168,67,0.5), rgba(212,168,67,0.5)),
        linear-gradient(rgba(212,168,67,0.5), rgba(212,168,67,0.5)),
        linear-gradient(rgba(212,168,67,0.5), rgba(212,168,67,0.5)),
        linear-gradient(rgba(212,168,67,0.5), rgba(212,168,67,0.5)),
        linear-gradient(rgba(212,168,67,0.5), rgba(212,168,67,0.5)),
        linear-gradient(rgba(212,168,67,0.5), rgba(212,168,67,0.5)),
        linear-gradient(rgba(212,168,67,0.5), rgba(212,168,67,0.5));
    background-size:
        18px 1.5px, 1.5px 18px,
        18px 1.5px, 1.5px 18px,
        18px 1.5px, 1.5px 18px,
        18px 1.5px, 1.5px 18px;
    background-position:
        10px 10px,   10px 10px,
        calc(100% - 28px) 10px,   calc(100% - 11px) 10px,
        10px calc(100% - 11px),   10px calc(100% - 28px),
        calc(100% - 28px) calc(100% - 11px),   calc(100% - 11px) calc(100% - 28px);
    background-repeat: no-repeat;
    transition: opacity 0.3s;
    opacity: 1;
}

.upload-zone::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--accent-gradient);
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 0;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--accent-1);
    background-color: rgba(212, 168, 67, 0.05);
    box-shadow: var(--shadow-glow);
}

.upload-zone:hover::before,
.upload-zone.dragover::before { opacity: 0.025; }

.upload-zone.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    border-color: var(--border);
}

.upload-zone.upload-disabled {
    opacity: 0.45;
    pointer-events: none;
    cursor: not-allowed;
    border-color: var(--border);
    filter: grayscale(0.5);
}

.upload-content {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.upload-content .icon {
    color: var(--accent-1);
    opacity: 0.75;
    display: flex;
}

.upload-content p { font-size: 14px; color: var(--text-secondary); }

.upload-content a {
    color: var(--accent-1);
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 2px;
}

#fileInput {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.upload-zone.disabled #fileInput { pointer-events: none; }

/* Upload Progress */
.upload-progress {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

.upload-progress-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

.upload-progress-icon {
    display: flex;
    align-items: center;
    color: var(--accent-1);
}

.upload-progress-icon svg { animation: iconSpin 1.2s linear infinite; }

@keyframes iconSpin { to { transform: rotate(360deg); } }
@keyframes uploadPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.upload-progress-text { flex: 1; color: var(--accent-1); font-weight: 500; }

.upload-progress-pct {
    font-weight: 600;
    color: var(--text-primary);
    min-width: 40px;
    text-align: right;
}

.upload-zone.uploading {
    border-color: var(--accent-1);
    background-color: rgba(212, 168, 67, 0.04);
    pointer-events: none;
}

/* Progress Bars */
.progress-section { display: flex; flex-direction: column; gap: 8px; }

.progress-bar-track {
    height: 8px;
    background: var(--bg-card);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.progress-bar-fill {
    height: 100%;
    background: var(--accent-gradient);
    background-size: 200% 100%;
    border-radius: 4px;
    width: 0%;
    transition: width 0.4s ease;
    position: relative;
}

.progress-bar-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-info { display: flex; justify-content: space-between; align-items: center; }
.progress-text { font-size: 13px; color: var(--text-secondary); }

.stats-text { font-size: 12px; color: var(--text-muted); display: flex; gap: 16px; }
.stats-text span { white-space: nowrap; }

/* Action Bar */
.action-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.action-warnings {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 4px;
}

.action-warning-item {
    background: rgba(200, 137, 74, 0.08);
    border: 1px solid rgba(200, 137, 74, 0.3);
    border-radius: var(--radius-sm);
    padding: 8px 14px;
    font-size: 13px;
    color: #d4a060;
    line-height: 1.5;
}

.download-group { display: flex; gap: 8px; flex-wrap: wrap; }

.btn {
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
}

.btn-primary {
    background: var(--accent-gradient);
    color: #1a1409;
    font-weight: 600;
}

.btn-primary:hover {
    box-shadow: 0 0 20px rgba(212, 168, 67, 0.32);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-1);
}

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

.btn-accent {
    background: linear-gradient(135deg, #5aaa70, #3d8a52);
    color: #fff;
    font-weight: 600;
    border: none;
}

.btn-accent:hover {
    box-shadow: 0 0 20px rgba(90, 170, 112, 0.3);
    transform: translateY(-1px);
}

/* ===== Modal ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.active { opacity: 1; visibility: visible; }

.modal {
    background: var(--bg-secondary);
    border: 1px solid rgba(212, 168, 67, 0.22);
    outline: 1px solid rgba(212, 168, 67, 0.07);
    outline-offset: -5px;
    border-radius: var(--radius-lg);
    padding: 28px;
    width: 420px;
    max-width: 90vw;
    box-shadow: var(--shadow-md), 0 0 40px rgba(0, 0, 0, 0.5);
    transform: translateY(20px) scale(0.95);
    transition: var(--transition);
}

.modal-overlay.active .modal { transform: translateY(0) scale(1); }

.modal h2 {
    font-size: 18px;
    font-weight: 700;
    font-family: var(--font-serif);
    margin-bottom: 20px;
    color: var(--accent-1);
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(212, 168, 67, 0.15);
}

.modal-field { margin-bottom: 16px; }

.modal-field label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-weight: 500;
}

.modal-field input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: var(--transition);
}

.modal-field input:focus {
    border-color: var(--accent-1);
    box-shadow: 0 0 0 2px rgba(212, 168, 67, 0.15);
}

.modal-field .hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.hint { font-size: 12px; color: var(--text-muted); }

.modal-switch { text-align: center; margin-top: 16px; font-size: 13px; color: var(--text-muted); }
.modal-switch a { color: var(--accent-1); text-decoration: underline; cursor: pointer; }

.modal-info {
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin-bottom: 20px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ===== Toast ===== */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 24px;
    font-size: 14px;
    color: var(--text-primary);
    box-shadow: var(--shadow-md);
    z-index: 200;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--error); }

/* ===== Animations ===== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.animate-in { animation: fadeIn 0.5s ease forwards; }

/* ===== Utilities ===== */
.hidden { display: none !important; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .main-content { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
    .top-nav { padding: 10px 16px; }
    .bottom-section { padding: 8px 16px 12px; }
    .upload-zone { padding: 20px 16px; }
}

/* ===== User Section ===== */
.user-section { margin-left: 8px; }

.btn-user {
    background: rgba(28, 26, 22, 0.9);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    font-size: 13px;
    font-family: inherit;
    transition: var(--transition);
    cursor: pointer;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-user:hover {
    color: var(--accent-1);
    border-color: var(--accent-1);
    background: rgba(212, 168, 67, 0.08);
}

/* ===== Paywall Overlay ===== */
.paywall-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(13, 12, 10, 0.72);
    backdrop-filter: blur(2px);
    z-index: 5;
    gap: 10px;
    pointer-events: none;
}

.paywall-overlay .paywall-lock { color: var(--accent-1); opacity: 0.7; display: flex; }
.paywall-overlay p { font-size: 14px; color: var(--text-secondary); }

#resultText.blurred { -webkit-user-select: none; user-select: none; }

#resultText.processing-lock {
    -webkit-user-select: none;
    user-select: none;
    pointer-events: none;
    filter: blur(4px);
    position: relative;
}

#resultText.blurred::after {
    content: '';
    display: block;
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 80%;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        rgba(13, 12, 10, 0.3) 20%,
        rgba(13, 12, 10, 0.95) 60%,
        var(--bg-primary) 100%
    );
    pointer-events: none;
}

/* ===== Paywall Modal ===== */
.paywall-modal { width: 460px; }

.paywall-info {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.paywall-stat { display: flex; justify-content: space-between; align-items: center; }
.paywall-label { font-size: 14px; color: var(--text-secondary); }
.paywall-value { font-size: 16px; font-weight: 600; color: var(--text-primary); }

.paywall-price-highlight .paywall-value {
    font-size: 22px;
    background: linear-gradient(135deg, #e8c96e, #d4a843);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.paywall-order-id {
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
    color: var(--accent-1) !important;
}

.paywall-qr-section { text-align: center; margin-bottom: 16px; }
.paywall-qr-section p { font-size: 13px; color: var(--text-secondary); margin-bottom: 12px; }

.paywall-qr-placeholder {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 24px;
    border: 1px dashed var(--border-accent);
}

.paywall-waiting {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(212, 168, 67, 0.05);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(212, 168, 67, 0.15);
    margin-bottom: 16px;
}

.paywall-waiting p { font-size: 12px; color: var(--text-secondary); line-height: 1.5; }

.paywall-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--accent-1);
    border-radius: 50%;
    animation: paywallSpin 1s linear infinite;
    flex-shrink: 0;
}

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

/* ===== Active Task Name ===== */
.active-task-name {
    font-size: 12px;
    font-weight: 400;
    font-family: var(--font-sans);
    color: var(--accent-1);
    letter-spacing: 0;
    text-transform: none;
    margin-left: 6px;
    opacity: 0.85;
}

/* ===== Active Progress ===== */
.active-progress {
    padding: 8px 20px 6px;
    border-bottom: 1px solid rgba(212, 168, 67, 0.1);
    flex-shrink: 0;
}

.active-progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

#activeStatsText { color: var(--text-muted); font-size: 11px; }

/* ===== Task List ===== */
.task-list-section { flex-shrink: 0; }

.task-list {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 4px 2px;
    scroll-behavior: smooth;
}

.task-list::-webkit-scrollbar { height: 4px; }
.task-list::-webkit-scrollbar-thumb {
    background: rgba(180, 150, 100, 0.15);
    border-radius: 2px;
}

/* ===== Task Card ===== */
.task-card {
    flex: 0 0 auto;
    width: 210px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
}

.task-card:hover {
    background: var(--bg-card-hover);
    border-color: rgba(180, 150, 100, 0.22);
}

.task-card.active {
    border-color: var(--accent-1);
    box-shadow: 0 0 12px rgba(212, 168, 67, 0.15);
    background: rgba(212, 168, 67, 0.05);
}

.task-card.completed { border-color: rgba(90, 170, 112, 0.3); }
.task-card.completed.active {
    border-color: var(--success);
    box-shadow: 0 0 12px rgba(90, 170, 112, 0.15);
}

.task-card.error { border-color: rgba(184, 85, 85, 0.3); }
.task-card.queued { animation: taskPulse 2s ease-in-out infinite; }

@keyframes taskPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.task-card-header { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.task-card-icon { font-size: 14px; flex-shrink: 0; }

.task-card-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.task-card-close {
    flex-shrink: 0;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 14px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: var(--transition);
    opacity: 0;
    cursor: pointer;
}

.task-card:hover .task-card-close { opacity: 1; }
.task-card-close:hover { background: rgba(184, 85, 85, 0.15); color: var(--error); }

.task-card-progress { margin-bottom: 6px; }

.task-card-bar-track {
    height: 4px;
    background: rgba(180, 150, 100, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.task-card-bar-fill {
    height: 100%;
    background: var(--accent-gradient);
    border-radius: 2px;
    width: 0%;
    transition: width 0.4s ease;
}

.task-card.completed .task-card-bar-fill { background: linear-gradient(135deg, var(--success), #3d8a52); }
.task-card.error .task-card-bar-fill { background: var(--error); }

.task-card-status {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.task-card.completed .task-card-status { color: var(--success); }
.task-card.error .task-card-status { color: var(--error); }

/* ===== User Task History ===== */
.user-task-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    margin-bottom: 10px;
    transition: var(--transition);
}

.user-task-item:hover { border-color: rgba(180, 150, 100, 0.25); }

.user-task-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }

.user-task-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 320px;
}

.user-task-status { font-size: 12px; font-weight: 500; padding: 2px 8px; border-radius: 10px; flex-shrink: 0; }
.user-task-status.paid { background: rgba(90, 170, 112, 0.12); color: var(--success); }
.user-task-status.pending { background: rgba(200, 137, 74, 0.12); color: #d4a060; }
.user-task-status.processing { background: rgba(212, 168, 67, 0.12); color: var(--accent-1); }

.user-task-meta { display: flex; gap: 16px; font-size: 12px; color: var(--text-muted); margin-bottom: 10px; }
.user-task-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.user-task-actions .btn { font-size: 12px; padding: 4px 12px; }

.btn-danger { background: transparent; color: var(--error); border: 1px solid rgba(184, 85, 85, 0.3); }
.btn-danger:hover { background: rgba(184, 85, 85, 0.1); border-color: var(--error); }

/* ===== Notice Banner ===== */
.notice-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 500;
    z-index: 50;
    flex-shrink: 0;
    animation: noticeBannerSlide 0.4s ease-out;
    gap: 12px;
}

.notice-banner.hidden { display: none; }

.notice-banner.notice-info {
    background: linear-gradient(90deg, rgba(212, 168, 67, 0.14), rgba(212, 168, 67, 0.06));
    border-bottom: 1px solid rgba(212, 168, 67, 0.28);
    color: #e8c96e;
}

.notice-banner.notice-warning {
    background: linear-gradient(90deg, rgba(200, 137, 74, 0.15), rgba(200, 137, 74, 0.07));
    border-bottom: 1px solid rgba(200, 137, 74, 0.3);
    color: #d4a060;
}

.notice-banner.notice-urgent {
    background: linear-gradient(90deg, rgba(184, 85, 85, 0.18), rgba(184, 85, 85, 0.08));
    border-bottom: 1px solid rgba(184, 85, 85, 0.35);
    color: #e8a5a5;
}

.notice-banner-content { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.notice-banner-icon { font-size: 16px; flex-shrink: 0; }
.notice-banner-text { line-height: 1.4; }

.notice-banner-close {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: inherit;
    opacity: 0.7;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s;
}

.notice-banner-close:hover { opacity: 1; background: rgba(255, 255, 255, 0.08); }

@keyframes noticeBannerSlide {
    from { transform: translateY(-100%); opacity: 0; }
    to   { transform: translateY(0);     opacity: 1; }
}

/* ===== Urgent Notice Modal ===== */
.urgent-notice-modal {
    width: 440px;
    border-color: rgba(184, 85, 85, 0.4);
    outline-color: rgba(184, 85, 85, 0.12);
}

.urgent-notice-modal h2 {
    color: #e8a5a5;
    border-bottom-color: rgba(184, 85, 85, 0.25);
}

.urgent-notice-body {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-primary);
    padding: 8px 0 20px;
    white-space: pre-wrap;
}

/* ===== Notice Attachment (📎 图标 + 大图 lightbox) ===== */
.notice-attachment {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 12px;
    padding: 2px 10px;
    border-radius: 6px;
    font-size: 1.05em;
    line-height: 1.6;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    transition: background 0.15s, transform 0.1s;
}
.notice-attachment:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: translateY(-1px);
}
.notice-attachment-modal {
    display: inline-block;
    margin: 4px 0 16px;
    padding: 8px 16px;
    font-size: 14px;
    background: rgba(212, 168, 67, 0.14);
    border-color: rgba(212, 168, 67, 0.32);
    color: #e8c96e;
}
.notice-image-viewer {
    max-width: 92vw;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 20px;
    background: var(--bg-secondary, #1a1d22);
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
.notice-image-viewer img {
    max-width: 100%;
    max-height: 78vh;
    border-radius: 10px;
    object-fit: contain;
    background: #000;
}
