/* ==================== 赛博朋克主题变量 ==================== */
:root {
    --bg: #0a0a12;
    --card: rgba(15, 15, 25, 0.95);
    --primary: #00fff9;
    --secondary: #ff00ff;
    --accent: #fffc00;
    --text: #e0e0ff;
    --error: #ff2a6d;
    --success: #05ffa1;
    --border: rgba(0, 255, 249, 0.3);
    --dim: #6a6a8a;
    --neon-shadow: 0 0 20px rgba(0, 255, 249, 0.5), 0 0 40px rgba(0, 255, 249, 0.2);
    --glow-color: rgba(0, 255, 249, 0.4);
}

/* 主题1: Neon Night - 经典霓虹之夜 (青色+品红) */
[data-theme="neon-night"] {
    --bg: #0a0a12;
    --card: rgba(15, 15, 25, 0.95);
    --primary: #00fff9;
    --secondary: #ff00ff;
    --accent: #fffc00;
    --text: #e0e0ff;
    --border: rgba(0, 255, 249, 0.3);
    --neon-shadow: 0 0 20px rgba(0, 255, 249, 0.5), 0 0 40px rgba(0, 255, 249, 0.2);
    --glow-color: rgba(0, 255, 249, 0.4);
}

/* 主题2: Blade Runner 2049 - 银翼杀手 (橙黄+深蓝) */
[data-theme="blade-runner"] {
    --bg: #0d0d1a;
    --card: rgba(20, 18, 30, 0.95);
    --primary: #ff6b00;
    --secondary: #00d4ff;
    --accent: #ffaa00;
    --text: #ffeedd;
    --border: rgba(255, 107, 0, 0.4);
    --neon-shadow: 0 0 20px rgba(255, 107, 0, 0.6), 0 0 60px rgba(255, 107, 0, 0.3);
    --glow-color: rgba(255, 107, 0, 0.5);
}

/* 主题3: Synthwave - 合成波 (紫粉渐变) */
[data-theme="synthwave"] {
    --bg: #1a0a2e;
    --card: rgba(35, 15, 50, 0.95);
    --primary: #ff71ce;
    --secondary: #01cdfe;
    --accent: #ffd700;
    --text: #ffddee;
    --border: rgba(255, 113, 206, 0.4);
    --neon-shadow: 0 0 20px rgba(255, 113, 206, 0.6), 0 0 60px rgba(255, 113, 206, 0.3);
    --glow-color: rgba(255, 113, 206, 0.5);
}

/* 主题4: Matrix - 黑客帝国 (终端绿) */
[data-theme="matrix"] {
    --bg: #000a00;
    --card: rgba(0, 15, 0, 0.95);
    --primary: #00ff41;
    --secondary: #008f11;
    --accent: #00ff41;
    --text: #00ff41;
    --border: rgba(0, 255, 65, 0.3);
    --neon-shadow: 0 0 20px rgba(0, 255, 65, 0.5), 0 0 40px rgba(0, 255, 65, 0.2);
    --glow-color: rgba(0, 255, 65, 0.4);
}

/* 主题5: Tokyo Night - 东京之夜 (深紫+霓虹) */
[data-theme="tokyo-night"] {
    --bg: #0f0f1a;
    --card: rgba(20, 20, 35, 0.95);
    --primary: #7aa2f7;
    --secondary: #bb9af7;
    --accent: #ff9e64;
    --text: #c0caf5;
    --border: rgba(122, 162, 247, 0.3);
    --neon-shadow: 0 0 20px rgba(122, 162, 247, 0.5), 0 0 40px rgba(187, 154, 247, 0.3);
    --glow-color: rgba(122, 162, 247, 0.4);
}

/* 主题6: Outrun - 复古未来 (橙紫粉) */
[data-theme="outrun"] {
    --bg: #0d0221;
    --card: rgba(20, 5, 40, 0.95);
    --primary: #ff00ff;
    --secondary: #00ffff;
    --accent: #ff6600;
    --text: #ffffff;
    --border: rgba(255, 0, 255, 0.4);
    --neon-shadow: 0 0 20px rgba(255, 0, 255, 0.6), 0 0 60px rgba(255, 0, 255, 0.3);
    --glow-color: rgba(255, 0, 255, 0.5);
}

/* 主题7: Cyberpunk Yellow - 赛博警示 (黄黑) */
[data-theme="cyber-yellow"] {
    --bg: #0a0a00;
    --card: rgba(20, 20, 0, 0.95);
    --primary: #fcee0a;
    --secondary: #ff0000;
    --accent: #ffffff;
    --text: #fcee0a;
    --border: rgba(252, 238, 10, 0.4);
    --neon-shadow: 0 0 20px rgba(252, 238, 10, 0.6), 0 0 60px rgba(252, 238, 10, 0.3);
    --glow-color: rgba(252, 238, 10, 0.5);
}

/* 主题8: Vaporwave - 蒸汽波 (粉紫青) */
[data-theme="vaporwave"] {
    --bg: #1a0a2e;
    --card: rgba(40, 20, 60, 0.95);
    --primary: #ff71ce;
    --secondary: #b967ff;
    --accent: #01cdfe;
    --text: #ffbde0;
    --border: rgba(255, 113, 206, 0.4);
    --neon-shadow: 0 0 20px rgba(255, 113, 206, 0.6), 0 0 40px rgba(185, 103, 255, 0.4);
    --glow-color: rgba(255, 113, 206, 0.5);
}

/* 主题9: Midnight City - 午夜城市 (深蓝粉) */
[data-theme="midnight-city"] {
    --bg: #0a0a1a;
    --card: rgba(15, 15, 35, 0.95);
    --primary: #00d4ff;
    --secondary: #ff6ec7;
    --accent: #7b68ee;
    --text: #b8d4e8;
    --border: rgba(0, 212, 255, 0.3);
    --neon-shadow: 0 0 20px rgba(0, 212, 255, 0.5), 0 0 60px rgba(255, 110, 199, 0.3);
    --glow-color: rgba(0, 212, 255, 0.4);
}

/* ==================== 基础样式 ==================== */
* { margin: 0; padding: 0; box-sizing: border-box; outline: none; -webkit-tap-highlight-color: transparent; }

body {
    font-family: "Alibaba PuHuiTi", "Microsoft YaHei", sans-serif;
    background-color: var(--bg);
    color: var(--text);
    height: 100vh; width: 100vw; overflow: hidden;
    background: 
        radial-gradient(ellipse at 50% 0%, rgba(255, 0, 255, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(0, 255, 255, 0.08) 0%, transparent 40%),
        radial-gradient(ellipse at 20% 80%, rgba(255, 107, 0, 0.06) 0%, transparent 40%),
        linear-gradient(rgba(0, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 255, 0.02) 1px, transparent 1px),
        var(--bg);
    background-size: 100% 100%, 100% 100%, 100% 100%, 40px 40px, 40px 40px, 100% 100%;
}

.container {
    width: 520px; height: 600px; min-width: 320px; min-height: 400px;
    background: var(--card); backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
    z-index: 1000; display: flex; flex-direction: column; overflow: hidden;
    touch-action: none;
    resize: none;
}

/* 呼吸灯效果 */
.breathing-glow .container {
    animation: containerGlow 3s infinite ease-in-out;
}

/* 调整大小手柄 */
.resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 22px;
    height: 22px;
    cursor: nwse-resize;
    z-index: 10;
    background: transparent;
}
.resize-handle::before {
    content: "";
    position: absolute;
    bottom: 6px;
    right: 6px;
    width: 10px;
    height: 10px;
    border-right: 2px solid var(--primary);
    border-bottom: 2px solid var(--primary);
    opacity: 0.7;
    filter: drop-shadow(0 0 4px var(--primary));
}
.resize-handle:hover::before {
    opacity: 1;
}

.drag-handle {
    padding: 15px 20px;
    background: linear-gradient(90deg, var(--glow-color), transparent);
    border-bottom: 1px solid var(--border);
    cursor: move;
    display: flex; align-items: center; justify-content: space-between;
    flex-shrink: 0;
}

.drag-handle h1 {
    font-size: 18px;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 4px;
    text-shadow: var(--neon-shadow);
    font-weight: 900;
    pointer-events: none;
}

/* 设置按钮 */
.btn-settings {
    width: 32px; height: 32px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
    margin-left: auto;
    margin-right: 10px;
}
.btn-settings:hover {
    background: var(--primary);
    color: var(--bg);
    box-shadow: 0 0 20px var(--primary);
}

.content-area { padding: 24px; flex: 1; display: flex; flex-direction: column; overflow: hidden; position: relative; }

#welcome-line {
    position: relative;
    font-size: 14px;
    color: var(--secondary);
    margin-bottom: 15px;
    line-height: 1.5;
    padding-left: 20px;
    text-shadow: 0 0 15px var(--secondary);
    min-height: 1.5em;
    flex-shrink: 0;
}
#welcome-line::before {
    content: "";
    position: absolute;
    left: 0;
    top: 3px;
    width: 3px;
    height: 18px;
    background: var(--primary);
    box-shadow: 0 0 15px var(--primary);
    animation: neonBlinking 2s infinite step-end;
}

.editor-wrapper { position: relative; flex: 1; display: flex; flex-direction: column; min-height: 100px; }

textarea {
    width: 100%;
    flex: 1;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid var(--border);
    color: var(--primary);
    padding: 15px;
    font-size: 17px;
    line-height: 1.8;
    resize: none;
    transition: 0.3s;
    background-image: linear-gradient(rgba(0, 0, 0, 0) 50%, rgba(255, 255, 255, 0.02) 50%);
    background-size: 100% 4px;
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.5);
}
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 20px var(--glow-color), inset 0 0 30px rgba(0, 0, 0, 0.5);
}

.btn-attach-hidden {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border);
    color: var(--primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
    z-index: 5;
    opacity: 0.6;
}
.btn-attach-hidden:hover {
    opacity: 1;
    background: var(--primary);
    color: var(--bg);
    box-shadow: 0 0 15px var(--primary);
}

/* 预览区 */
.preview { 
    display: flex; flex-wrap: wrap; gap: 10px; margin: 15px 0; 
    max-height: 120px; overflow-y: auto; flex-shrink: 0;
}
.preview::-webkit-scrollbar { width: 3px; }
.preview::-webkit-scrollbar-thumb { background: var(--primary); box-shadow: 0 0 10px var(--primary); }

.p-item { 
    position: relative;
    width: 60px;
    height: 60px;
    border: 1px solid var(--primary);
    background: rgba(0, 0, 0, 0.5);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 15px var(--glow-color);
}
.p-item img { width: 100%; height: 100%; object-fit: cover; }
.p-ext { font-size: 10px; font-weight: bold; color: var(--primary); }
.p-close {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 18px;
    height: 18px;
    background: var(--error);
    color: #fff;
    text-align: center;
    line-height: 16px;
    cursor: pointer;
    font-size: 12px;
    box-shadow: 0 0 10px var(--error);
}

.btn-send {
    width: 100%;
    height: 50px;
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
    font-weight: bold;
    font-size: 16px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 4px;
    flex-shrink: 0;
    transition: 0.4s;
    position: relative;
    overflow: hidden;
}
.btn-send::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    transition: 0.5s;
}
.btn-send:hover:not(:disabled)::before {
    left: 100%;
}
.btn-send:hover:not(:disabled) {
    background: var(--primary);
    color: var(--bg);
    box-shadow: 0 0 30px var(--primary), 0 0 60px var(--glow-color);
    text-shadow: none;
}
.btn-send:disabled {
    color: var(--dim);
    border-color: var(--dim);
    opacity: 0.5;
}

.status {
    text-align: center;
    margin-top: 15px;
    font-size: 12px;
    min-height: 18px;
    flex-shrink: 0;
}
.status.err {
    color: var(--error);
    text-shadow: 0 0 10px var(--error);
}
.status.ok {
    color: var(--success);
    text-shadow: 0 0 10px var(--success);
}

.footer {
    text-align: center;
    font-size: 10px;
    color: var(--dim);
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    letter-spacing: 2px;
    flex-shrink: 0;
}

/* ==================== 设置面板 ==================== */
.settings-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
}

.settings-overlay.active {
    display: flex;
}

.settings-panel {
    width: 420px;
    max-width: 90vw;
    background: var(--card);
    border: 1px solid var(--border);
    padding: 30px;
    position: relative;
    animation: panelSlideIn 0.3s ease-out;
    box-shadow: 0 0 50px var(--glow-color);
}

@keyframes panelSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

.settings-header h2 {
    font-size: 16px;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 3px;
    text-shadow: var(--neon-shadow);
}

.btn-close-settings {
    width: 28px;
    height: 28px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: 0.3s;
}
.btn-close-settings:hover {
    background: var(--error);
    border-color: var(--error);
    color: #fff;
    box-shadow: 0 0 15px var(--error);
}

.settings-section {
    margin-bottom: 30px;
}

.settings-section h3 {
    font-size: 11px;
    color: var(--dim);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 15px;
}

/* 主题选择器 */
.theme-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.theme-option {
    padding: 15px 10px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border);
    cursor: pointer;
    text-align: center;
    transition: 0.3s;
    font-size: 11px;
    color: var(--text);
    position: relative;
    overflow: hidden;
}
.theme-option::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    opacity: 0;
    transition: 0.3s;
}
.theme-option:hover {
    border-color: var(--primary);
    background: rgba(0, 0, 0, 0.6);
}
.theme-option:hover::before {
    opacity: 1;
}
.theme-option.active {
    border-color: var(--primary);
    box-shadow: 0 0 20px var(--glow-color), inset 0 0 20px rgba(255, 255, 255, 0.05);
}
.theme-option.active::before {
    opacity: 1;
}

.theme-option .color-preview {
    width: 100%;
    height: 3px;
    margin-bottom: 10px;
    border-radius: 2px;
    box-shadow: 0 0 10px currentColor;
}

/* 主题预览色条 */
.theme-option[data-theme="neon-night"] .color-preview { background: linear-gradient(90deg, #00fff9, #ff00ff); }
.theme-option[data-theme="blade-runner"] .color-preview { background: linear-gradient(90deg, #ff6b00, #00d4ff); }
.theme-option[data-theme="synthwave"] .color-preview { background: linear-gradient(90deg, #ff71ce, #01cdfe); }
.theme-option[data-theme="matrix"] .color-preview { background: linear-gradient(90deg, #00ff41, #008f11); }
.theme-option[data-theme="tokyo-night"] .color-preview { background: linear-gradient(90deg, #7aa2f7, #bb9af7); }
.theme-option[data-theme="outrun"] .color-preview { background: linear-gradient(90deg, #ff00ff, #00ffff); }
.theme-option[data-theme="cyber-yellow"] .color-preview { background: linear-gradient(90deg, #fcee0a, #ff0000); }
.theme-option[data-theme="vaporwave"] .color-preview { background: linear-gradient(90deg, #ff71ce, #b967ff, #01cdfe); }
.theme-option[data-theme="midnight-city"] .color-preview { background: linear-gradient(90deg, #00d4ff, #ff6ec7); }

/* 开关样式 */
.switch-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.switch-item:last-child {
    border-bottom: none;
}

.switch-item label {
    font-size: 13px;
    color: var(--text);
}

.switch {
    position: relative;
    width: 48px;
    height: 26px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: 0.3s;
    border-radius: 26px;
    border: 1px solid var(--border);
}

.switch-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 2px;
    bottom: 2px;
    background-color: var(--dim);
    transition: 0.3s;
    border-radius: 50%;
}

.switch input:checked + .switch-slider {
    background-color: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 0 15px var(--primary);
}

.switch input:checked + .switch-slider:before {
    transform: translateX(22px);
    background-color: #fff;
    box-shadow: 0 0 10px #fff;
}

/* ==================== 动画 ==================== */
@keyframes containerGlow { 
    0%, 100% { 
        box-shadow: 0 0 30px var(--glow-color), 0 0 60px rgba(0, 0, 0, 0.5); 
    } 
    50% { 
        box-shadow: 0 0 50px var(--glow-color), 0 0 100px var(--glow-color), 0 0 60px rgba(0, 0, 0, 0.5); 
    } 
}

@keyframes neonBlinking { 
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ==================== 响应式 ==================== */
@media (max-width: 600px) { 
    .container { width: 95vw; height: 85vh; } 
    .resize-handle { display: none; }
    .theme-grid { grid-template-columns: repeat(2, 1fr); }
}
