/* ==================== 2026 丙午马年 · 奢华暗金主题 ==================== */
:root {
    --card-bg-top: rgba(55, 55, 65, 0.7);
    --card-bg-bottom: rgba(40, 40, 48, 0.85);
    --input-bg: rgba(35, 35, 42, 0.65);
    --bg-color: #1E1E26;
    --panel-bg: #2A2A32;
    --text-main: #EAEAEF;
    --text-muted: #A0A0A8;
    --gold-light: #E8CC98;
    --gold-main: #D4AA70;
    --gold-dark: #A87D45;
    --accent-color: #D4AA70;
    --accent-hover: #E0BC88;
    --border-bronze: rgba(180, 150, 100, 0.25);
    --border-color: rgba(180, 150, 100, 0.2);
    --divider-color: rgba(255, 255, 255, 0.06);
    --green: #34C759;
    --red: #FF3B30;
    --amber: #FF9500;
    --radius: 14px;
    --radius-sm: 8px;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* ==================== 浅色模式变量覆盖（柔和灰） ==================== */
body.light-mode {
    --card-bg-top: rgba(240, 240, 242, 0.88);
    --card-bg-bottom: rgba(235, 235, 238, 0.92);
    --input-bg: rgba(0, 0, 0, 0.03);
    --bg-color: #E9E9ED;
    --panel-bg: #F0F0F3;
    --text-main: #2C2C2E;
    --text-muted: #7C7C80;
    --gold-light: #B8860B;
    --gold-main: #996515;
    --gold-dark: #7A5210;
    --accent-color: #996515;
    --accent-hover: #B8860B;
    --border-bronze: rgba(0, 0, 0, 0.08);
    --border-color: rgba(0, 0, 0, 0.07);
    --divider-color: rgba(0, 0, 0, 0.05);
    --green: #28A745;
    --red: #DC3545;
    --amber: #E67E00;
}

body.light-mode {
    background-image: url('../icons/bg-horse.webp'), url('../icons/bg-horse.png'), url('../icons/bg-horse.jpg');
    background-blend-mode: overlay;
    background-color: rgba(233, 233, 237, 0.85);
}

body.light-mode .panel-section {
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

body.light-mode .panel-section::before,
body.light-mode .panel-section::after {
    border-color: rgba(0,0,0,0.06);
}

body.light-mode .textarea-wrapper {
    border: 2px solid rgba(0,0,0,0.12);
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.06);
    background-color: #FFFFFF;
}

body.light-mode .textarea-wrapper textarea,
body.light-mode textarea#quickInputText {
    color: #2C2C2E;
}

body.light-mode textarea::placeholder {
    color: #B0B0B5;
}

body.light-mode .btn-ghost {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0,0,0,0.07);
    box-shadow: none;
    color: var(--text-main);
}

body.light-mode .btn-primary {
    background: linear-gradient(90deg, #B8860B, #996515);
    color: #fff;
    box-shadow: 0 2px 6px rgba(153,101,21,0.2);
}

body.light-mode .btn-outline {
    background: rgba(240,240,243,0.9);
    border: 1px solid rgba(0,0,0,0.08);
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

body.light-mode .output-box {
    background: #FFFFFF;
    border: 2px solid rgba(0,0,0,0.08);
    color: #2C2C2E;
}

body.light-mode .recognition-tag {
    background: #FFFFFF;
    border: 2px solid rgba(0,0,0,0.1);
    color: #2C2C2E;
}

body.light-mode .recognition-total {
    background: var(--accent-color);
    color: #fff;
}

body.light-mode .history-item-content {
    background: var(--panel-bg);
}

body.light-mode .history-item-count {
    background: rgba(153,101,21,0.08);
    border: 1px solid rgba(153,101,21,0.15);
}

body.light-mode .app-header {
    border-bottom: 1px solid rgba(0,0,0,0.06);
}

body.light-mode .modal-content {
    background: #F0F0F3;
    border-top: 1px solid rgba(0,0,0,0.05);
}

body.light-mode .settings-section {
    background: rgba(0,0,0,0.03);
    border: 1px solid rgba(0,0,0,0.05);
}

body.light-mode .form-input {
    background: #E9E9ED;
    border: 1px solid rgba(0,0,0,0.1);
    color: var(--text-main);
}

body.light-mode .toast {
    background: rgba(240,240,243,0.95);
    color: #2C2C2E;
    border: 1px solid rgba(0,0,0,0.06);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

body.light-mode .fab-service {
    background: linear-gradient(135deg, rgba(96,165,250,0.15), rgba(139,92,246,0.15));
    border: 1px solid rgba(96,165,250,0.2);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

body.light-mode .format-help-floating {
    background: rgba(240,240,243,0.97);
    border: 1px solid rgba(0,0,0,0.08);
}

body.light-mode .format-help-grid b { color: #2C2C2E; }
body.light-mode .fmt { color: #8E8E93; }

body.light-mode .ocr-loading-overlay {
    background: rgba(233,233,237,0.94);
}

body.light-mode .drop-zone {
    border: 1px dashed rgba(0,0,0,0.15);
    background: rgba(0,0,0,0.02);
}

body.light-mode .seg-item span {
    color: #6C6C70;
}

body.light-mode .seg-item input:checked + span {
    background: var(--accent-color);
    color: #fff;
}

body.light-mode .ios-switch .slider {
    background: rgba(0,0,0,0.12);
}

body.light-mode .textarea-wrapper:focus-within {
    border-color: var(--accent-color);
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.06), 0 0 12px rgba(153,101,21,0.15);
    background-color: rgba(255,255,255,0.9);
}

body.light-mode .panel-section:focus-within,
body.light-mode .panel-section.glow-active {
    border-color: rgba(153,101,21,0.4);
    box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 0 16px rgba(153,101,21,0.12);
}

body.light-mode .form-input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(153,101,21,0.1), 0 0 8px rgba(153,101,21,0.08);
}

body.light-mode .modal-handle {
    background: rgba(0,0,0,0.12);
}

body.light-mode .modal-title {
    color: #2C2C2E;
    border-bottom: 1px solid rgba(0,0,0,0.06);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }

body {
    background-color: var(--bg-color);
    background-image: url('../icons/bg-horse.webp'), url('../icons/bg-horse.png'), url('../icons/bg-horse.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
    color: var(--text-main);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    min-height: 100vh;
    font-size: 15px;
    line-height: 1.6;
    -webkit-overflow-scrolling: touch;
    -webkit-tap-highlight-color: transparent;
    padding: 0;
    overflow-x: hidden;
}

.hidden { display: none !important; }

/* ==================== App Container ==================== */
.app-container {
    max-width: 480px;
    margin: 0 auto;
    padding-bottom: var(--safe-bottom);
}

/* ==================== Header ==================== */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    padding-top: calc(14px + var(--safe-top));
    color: var(--accent-color);
    font-size: 13px;
    letter-spacing: 4px;
    opacity: 0.9;
    border-bottom: 1px solid var(--border-color);
}

.btn-header-action {
    background: transparent;
    border: none;
    color: var(--text-muted);
    width: 36px; height: 36px;
    border-radius: var(--radius-sm);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-appearance: none;
    transition: var(--transition);
}

.btn-header-action:active { color: var(--accent-color); background: rgba(255,255,255,0.05); }

.header-actions { display: flex; gap: 6px; align-items: center; }
.header-help-wrap { position: relative; }

.header-help-wrap .format-help-floating {
    top: 42px;
    right: 0;
}

/* ==================== Tool Panel ==================== */
.tool-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px 16px 8px;
}

/* ==================== Panel Section (Card) ==================== */
.panel-section {
    background: linear-gradient(180deg, var(--card-bg-top) 0%, var(--card-bg-bottom) 100%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 2px solid var(--border-bronze);
    border-radius: var(--radius);
    padding: 16px;
    position: relative;
    transition: border-color 0.3s, box-shadow 0.3s, background 0.3s;
    box-shadow: inset 0 1px 1px rgba(255,255,255,0.08), 0 4px 16px rgba(0,0,0,0.3), 0 0 1px rgba(212,170,112,0.15);
    display: flex;
    flex-direction: column;
}

.panel-section:focus-within,
.panel-section.glow-active {
    border-color: rgba(212,170,112,0.5);
    box-shadow: inset 0 1px 1px rgba(255,255,255,0.1), 0 4px 16px rgba(0,0,0,0.3), 0 0 16px rgba(212,170,112,0.15);
}

/* 卡片角落金色装饰 */
.panel-section::before,
.panel-section::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-color: rgba(212,170,112,0.3);
    border-style: solid;
    pointer-events: none;
}

.panel-section::before {
    top: -1px; left: -1px;
    border-width: 1px 0 0 1px;
    border-radius: var(--radius) 0 0 0;
}

.panel-section::after {
    bottom: -1px; right: -1px;
    border-width: 0 1px 1px 0;
    border-radius: 0 0 var(--radius) 0;
}

/* ==================== Textarea ==================== */
.textarea-wrapper {
    position: relative;
    border-radius: var(--radius-sm);
    background-color: var(--input-bg);
    overflow: hidden;
    border: 2px solid rgba(255,255,255,0.15);
    box-shadow: inset 0 1px 4px rgba(0,0,0,0.2);
    transition: border-color 0.3s, box-shadow 0.3s;
}

.textarea-wrapper:focus-within {
    border-color: var(--accent-color);
    box-shadow: inset 0 1px 4px rgba(0,0,0,0.2), 0 0 12px rgba(212,170,112,0.2);
    background-color: rgba(40, 40, 48, 0.8);
}

.textarea-wrapper textarea,
textarea#quickInputText {
    width: 100%;
    min-height: 120px;
    max-height: 280px;
    background: transparent;
    border: none;
    color: var(--text-main);
    padding: 12px;
    font-size: 16px;
    line-height: 1.5;
    resize: none;
    outline: none;
    font-family: inherit;
    -webkit-appearance: none;
}

textarea::placeholder { color: #55555A; }

.input-focus-line {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0%;
    height: 2px;
    background-color: var(--accent-color);
    transition: width 0.4s ease;
}

textarea:focus + .input-focus-line { width: 100%; }

/* ==================== Action Bar ==================== */
.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
}

.hint-text {
    font-size: 12px;
    color: var(--text-muted);
}

/* ==================== Buttons ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    outline: none;
    min-height: 44px;
    transition: var(--transition);
    -webkit-appearance: none;
}

.btn-group { display: flex; gap: 8px; }

.btn-ghost {
    background: rgba(53, 53, 58, 0.8);
    color: var(--text-main);
    backdrop-filter: blur(4px);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.05);
}

.btn-primary {
    background: linear-gradient(90deg, var(--gold-light), var(--gold-dark));
    color: #1A1105;
    font-weight: bold;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 1px 1px rgba(255,255,255,0.6), 0 4px 15px rgba(200, 160, 107, 0.3);
}

.btn-primary::after {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 60%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    50% { left: 150%; }
    100% { left: 150%; }
}

.btn-primary.loading::after { display: none; }
.btn-primary.loading { opacity: 0.7; pointer-events: none; }

.btn-primary .btn-loading-spinner {
    display: none;
    width: 16px; height: 16px;
    border: 2px solid rgba(0,0,0,0.2);
    border-top-color: #000;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.btn-primary.loading .btn-loading-spinner { display: inline-block; }
.btn-primary.loading .btn-icon { display: none; }

@keyframes spin { to { transform: rotate(360deg); } }

.btn-outline {
    width: 100%;
    padding: 12px;
    background: linear-gradient(180deg, rgba(58, 58, 64, 0.8) 0%, rgba(32, 32, 36, 0.8) 100%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border-bronze);
    color: var(--text-main);
    border-radius: var(--radius);
    font-size: 15px;
    box-shadow: inset 0 1px 1px rgba(255,255,255,0.1), 0 4px 10px rgba(0,0,0,0.3);
}

.btn-outline .icon { width: 16px; height: 16px; }

.btn-text {
    background: transparent;
    color: var(--gold-main);
    padding: 4px 8px;
    font-size: 13px;
    min-height: auto;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    -webkit-appearance: none;
    transition: color 0.15s;
    opacity: 0.8;
}

.btn-text:active { opacity: 0.6; }
.btn-text.copied { color: var(--green); }

/* 移动端按压反馈 */
.btn-primary:active { filter: brightness(0.9); transform: translateY(1px); transition: transform 0.1s; }
.btn-ghost:active { background: rgba(42, 42, 46, 0.9); transform: scale(0.98); }
.btn-outline:active { background: linear-gradient(180deg, rgba(42, 42, 48, 0.9) 0%, rgba(21, 21, 24, 0.9) 100%); }

/* ==================== Section Header ==================== */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.section-header .title {
    font-size: 15px;
    font-weight: 500;
    color: var(--gold-main);
}

.section-actions { display: flex; gap: 12px; align-items: center; }

/* ==================== Output Box ==================== */
.output-box {
    min-height: 48px;
    padding: 12px;
    border-radius: var(--radius-sm);
    background-color: var(--input-bg);
    border: 2px solid rgba(255,255,255,0.1);
    font-size: 13px;
    line-height: 1.7;
    color: var(--text-main);
    white-space: pre-wrap;
    word-break: break-all;
    font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
}

/* ==================== Drop Zone ==================== */
.drop-zone {
    display: none;
    margin-top: 12px;
    border: 2px dashed rgba(255,255,255,0.2);
    border-radius: var(--radius-sm);
    padding: 16px;
    text-align: center;
    background: var(--input-bg);
    transition: var(--transition);
}

.drop-zone.dragover { border-color: var(--accent-color); background: rgba(184,151,104,0.05); }

#quickInputPanel.expanded .drop-zone { display: block; }
#quickInputPanel.expanded .btn-outline { border-color: var(--accent-color); color: var(--text-main); }

.drop-zone-inner { display: flex; align-items: center; justify-content: center; gap: 8px; }
.drop-zone-icon { font-size: 18px; color: var(--text-muted); }
.drop-zone-text { color: var(--text-muted); font-size: 14px; }
.upload-link { color: var(--accent-color); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

.drop-zone-preview { display: none; text-align: center; }
.drop-zone-preview img { max-width: 100%; max-height: 150px; border-radius: var(--radius-sm); margin-bottom: 8px; }

/* ==================== Tags ==================== */
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }

.recognition-tag {
    display: inline-flex;
    background: rgba(255,255,255,0.05);
    border: 2px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-main);
    font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
}

.recognition-total {
    display: inline-flex;
    background: var(--accent-color);
    color: #000;
    border-radius: 6px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 700;
    font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
}

/* ==================== History ==================== */
.history-list { display: flex; flex-direction: column; }

.history-item {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
    cursor: pointer;
    min-height: 48px;
    position: relative;
    overflow: hidden;
    touch-action: pan-y;
    transition: opacity 0.15s;
}

.history-item:last-child { border-bottom: none; }
.history-item:active { opacity: 0.6; }

.history-item-content {
    display: flex;
    align-items: center;
    width: 100%;
    transition: transform 0.25s ease;
    position: relative;
    z-index: 1;
    background: var(--panel-bg);
}

.history-item-input {
    flex: 1;
    color: var(--text-main);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 10px;
    font-size: 14px;
}

.history-item-count {
    color: var(--accent-color);
    font-weight: 600;
    font-size: 12px;
    background: rgba(184,151,104,0.12);
    border: 1px solid rgba(184,151,104,0.2);
    padding: 2px 8px;
    border-radius: 6px;
}

.history-item-time { color: var(--text-muted); margin-left: 10px; font-size: 12px; }

.history-item-delete {
    background: none; border: none; color: var(--text-muted);
    font-size: 16px; cursor: pointer; padding: 4px; margin-left: 6px;
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 6px;
    transition: var(--transition);
}

.history-item-delete:active { color: var(--red); background: rgba(255,59,48,0.1); }
.history-empty { text-align: center; color: var(--text-muted); padding: 24px; font-size: 14px; }
.history-checkbox { margin-right: 12px; width: 18px; height: 18px; accent-color: var(--accent-color); }

.history-merge-panel { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border-color); }
.merge-total {
    font-size: 12px; font-weight: 700;
    color: #000; background: var(--accent-color);
    border-radius: 6px; padding: 3px 10px;
    font-family: 'SF Mono', 'Menlo', monospace;
}

/* ==================== History Swipe ==================== */
.history-item-swipe-bg {
    position: absolute; top: 0; right: 0; bottom: 0;
    width: 80px; background: var(--red);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 13px; font-weight: 600;
    opacity: 0; transition: opacity 0.2s;
}

.history-item.swiping .history-item-swipe-bg,
.history-item.swiped .history-item-swipe-bg { opacity: 1; }
.history-item.swiped .history-item-content { transform: translateX(-80px); }

@media (hover: none) and (pointer: coarse) {
    .history-item-delete { display: none !important; }
}

/* ==================== Format Help ==================== */
.format-help-icon-btn {
    position: absolute;
    top: 8px; right: 8px;
    width: 28px; height: 28px;
    border-radius: 50%;
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 13px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
    -webkit-appearance: none;
    z-index: 2;
}

.format-help-icon-btn:active { background: rgba(255,255,255,0.1); color: var(--text-main); }

/* ==================== Format Help Overlay ==================== */
.format-help-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
}

.format-help-overlay.active { display: flex; }

.format-help-floating {
    position: relative;
    background: rgba(21,21,23,0.97);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-bronze);
    border-radius: var(--radius);
    padding: 20px;
    width: 340px;
    max-width: calc(100vw - 32px);
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 16px 48px rgba(0,0,0,0.7);
    animation: fadeSlideDown 0.25s ease;
}

.format-help-close {
    position: absolute;
    top: 10px; right: 14px;
    font-size: 22px;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
}

.format-help-close:active { color: var(--text-main); }

@keyframes fadeSlideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.format-help-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3px 16px;
    font-size: 12px;
    line-height: 1.8;
    color: var(--text-muted);
}

.format-help-grid b { color: var(--text-main); font-weight: 600; }
.fmt { color: #55555A; font-size: 11px; }

/* ==================== OCR Loading ==================== */
.ocr-loading-overlay {
    display: none;
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(11,11,13,0.92);
    z-index: 10;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    border-radius: var(--radius);
    backdrop-filter: blur(4px);
}

.ocr-loading-overlay.active { display: flex; }

.ocr-spinner {
    width: 32px; height: 32px;
    border: 2px solid rgba(255,255,255,0.1);
    border-top: 2px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.ocr-loading-text { margin-top: 10px; font-size: 14px; color: var(--text-main); font-weight: 500; }
.ocr-progress-bar { width: 160px; height: 2px; background: rgba(255,255,255,0.1); border-radius: 1px; margin-top: 10px; overflow: hidden; }
.ocr-progress-fill { height: 100%; width: 0; background: var(--accent-color); transition: width 0.2s; }
.ocr-progress-text { margin-top: 4px; font-size: 12px; color: var(--text-muted); }

/* ==================== Modal ==================== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 10000;
    justify-content: center;
    align-items: flex-end;
    backdrop-filter: blur(4px);
}

.modal-overlay.active { display: flex; }

.modal-content {
    background: var(--panel-bg);
    border-radius: 16px 16px 0 0;
    padding: 12px 0 0;
    padding-bottom: var(--safe-bottom);
    width: 100%;
    max-width: 480px;
    max-height: 85vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    animation: slideUp 0.25s cubic-bezier(0.32,0.72,0,1);
    border-top: 1px solid rgba(255,255,255,0.08);
}

@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.modal-handle { width: 36px; height: 4px; background: rgba(255,255,255,0.15); border-radius: 2px; margin: 0 auto 12px; }

.modal-title {
    margin: 0;
    padding: 0 24px 14px;
    font-size: 16px;
    font-weight: 500;
    color: var(--text-main);
    border-bottom: 1px solid var(--border-color);
}

/* ==================== Settings ==================== */
.settings-section {
    margin: 16px 20px 0;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
    color: var(--text-main);
}

.settings-row:last-child { border-bottom: none; }

.ios-switch { position: relative; display: inline-block; width: 48px; height: 28px; }
.ios-switch input { opacity: 0; width: 0; height: 0; }
.ios-switch .slider {
    position: absolute; cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,0.15);
    border-radius: 28px;
    transition: 0.25s;
}
.ios-switch .slider::before {
    content: '';
    position: absolute;
    height: 22px; width: 22px;
    left: 3px; bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: 0.25s;
}
.ios-switch input:checked + .slider { background: var(--accent-color); }
.ios-switch input:checked + .slider::before { transform: translateX(20px); }

.seg-control {
    display: flex;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 3px;
}

.seg-item { cursor: pointer; display: flex; }
.seg-item input { display: none; }

.seg-item span {
    padding: 5px 14px;
    font-size: 13px;
    border-radius: 6px;
    color: var(--text-muted);
    font-weight: 500;
    transition: var(--transition);
}

.seg-item input:checked + span {
    background: var(--accent-color);
    color: #000;
    font-weight: 600;
}

/* ==================== Modal Form ==================== */
.modal-content .form-group { padding: 0 20px; margin-top: 14px; }
.modal-content .form-hint { padding: 0 20px; }

.form-group { margin-bottom: 10px; }

.form-label {
    font-size: 13px;
    color: var(--text-muted);
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
}

.form-input {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 15px;
    -webkit-appearance: none;
    background: var(--bg-color);
    color: var(--text-main);
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-input:focus { outline: none; border-color: var(--accent-color); box-shadow: 0 0 0 3px rgba(212,170,112,0.15), 0 0 8px rgba(212,170,112,0.1); }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.input-with-toggle { position: relative; display: flex; align-items: center; }
.input-with-toggle .form-input { padding-right: 44px; }

.btn-toggle-password {
    position: absolute; right: 4px;
    background: none; border: none; cursor: pointer;
    font-size: 16px; padding: 8px; opacity: 0.4;
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    transition: opacity 0.15s;
}

.btn-toggle-password:active { opacity: 1; }

/* ==================== Modal Actions ==================== */
.modal-actions {
    display: flex;
    gap: 10px;
    margin: 16px 20px 10px;
}

/* ==================== Toast ==================== */
.toast-container {
    position: fixed;
    top: 0; left: 0; right: 0;
    display: flex;
    justify-content: center;
    z-index: 99999;
    pointer-events: none;
    padding-top: calc(12px + var(--safe-top));
}

.toast {
    background: rgba(28,28,30,0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--text-main);
    padding: 10px 24px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 8px 16px rgba(0,0,0,0.3);
    animation: toastIn 0.3s ease, toastOut 0.3s ease 1.2s forwards;
    pointer-events: auto;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-20px); }
}

/* ==================== Responsive ==================== */
@media screen and (max-width: 480px) {
    .format-help-grid { grid-template-columns: 1fr; }
    .tool-panel { padding: 12px; }
}

@media screen and (min-width: 769px) {
    .app-container {
        margin-top: 30px;
        border: 1px solid var(--border-color);
        border-radius: var(--radius);
        overflow: hidden;
        box-shadow: 0 0 80px rgba(0,0,0,0.5);
    }

    .modal-overlay { align-items: center; }
    .modal-content { border-radius: var(--radius); max-width: 440px; padding-bottom: 0; border: 1px solid rgba(255,255,255,0.08); }
}

/* ==================== Slide In Animation ==================== */
@keyframes slideInUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

.slide-in-up {
    animation: slideInUp 0.35s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}

/* ==================== 右下角客服悬浮按钮（可拖拽） ==================== */
.fab-service {
    position: fixed;
    bottom: calc(24px + var(--safe-bottom));
    right: 20px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(96,165,250,0.25), rgba(139,92,246,0.25));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #60a5fa;
    border: 1px solid rgba(96,165,250,0.3);
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4), 0 0 20px rgba(96,165,250,0.15);
    z-index: 9998;
    transition: box-shadow 0.3s, background 0.3s;
    -webkit-appearance: none;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.fab-service:active {
    cursor: grabbing;
    background: linear-gradient(135deg, rgba(96,165,250,0.4), rgba(139,92,246,0.4));
    box-shadow: 0 4px 20px rgba(0,0,0,0.4), 0 0 24px rgba(96,165,250,0.3);
}

.fab-service svg {
    width: 22px;
    height: 22px;
    pointer-events: none;
}

/* ==================== 客服弹窗 ==================== */
.service-popup-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
}

.service-popup {
    background: #18181b;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    padding: 32px 28px;
    text-align: center;
    width: 300px;
    max-width: calc(100vw - 40px);
    box-shadow: 0 16px 48px rgba(0,0,0,0.7);
    animation: fadeSlideDown 0.25s ease;
    position: relative;
}

.service-popup-close {
    position: absolute;
    top: 12px;
    right: 16px;
    font-size: 22px;
    color: #52525b;
    cursor: pointer;
    line-height: 1;
}

.service-popup-close:active { color: #a1a1aa; }
