/* 全局主题变量（浅色模式默认） */
:root {
    --bg: #f5f7fa;
    --text: #2d3748;
    --card-bg: #ffffff;
    --navbar-bg: #ffffff;
    --border-color: #e2e8f0;
    --box-bg: #f7fafc;
    --shadow: 0 4px 20px rgba(0,0,0,0.08);
}

/* 深色模式变量 */
.dark {
    --bg: #121212;
    --text: #e0e0e0;
    --card-bg: #1e1e1e;
    --navbar-bg: #1e1e1e;
    --border-color: #333333;
    --box-bg: #2a2a2a;
    --shadow: 0 4px 20px rgba(0,0,0,0.2);
}

/* 顶部导航栏 */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background: var(--navbar-bg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    z-index: 999;
    box-sizing: border-box;
}
.logo-link {
    display: flex;
    align-items: center;
    height: 100%;
    text-decoration: none;
}
#logo-img {
    height: 40px;
    width: auto;
    object-fit: contain;
    cursor: pointer;
}
.theme-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--box-bg);
    color: var(--text);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s;
    display: grid;
    place-items: center;
}
.theme-btn:hover {
    transform: rotate(30deg);
    background: #3182ce;
    color: #fff;
}

/* 全局样式 */
* {margin: 0;padding: 0;box-sizing: border-box;font-family: "Microsoft YaHei", sans-serif;}
body {
    background: var(--bg);
    color: var(--text);
    padding: 80px 20px 20px;
    max-width: 1200px;
    margin: 0 auto;
    transition: background 0.3s, color 0.3s;
}
.title {text-align: center;color: var(--text);margin: 20px 0;font-size: 28px;}
.container {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 30px;
    box-shadow: var(--shadow);
    transition: background 0.3s;
}
.box {margin-bottom: 25px;}
.box-title {
    font-size: 16px;font-weight: 600;color: var(--text);
    margin-bottom: 10px;padding-left: 8px;border-left: 4px solid #3182ce;
}

/* 提示框 */
.toast {
    position: fixed; top: 80px; left: 50%; transform: translateX(-50%);
    background: #2d3748; color: #fff; padding: 12px 24px;
    border-radius: 6px; font-size: 14px; z-index: 9999;
    opacity: 0; transition: opacity 0.3s; pointer-events: none;
}
.toast.show {opacity: 1;}

/* 渐变编辑器 */
.gradient-editor {
    display: flex;gap: 20px;align-items: flex-start;flex-wrap: wrap;
    background: var(--box-bg);border-radius: 8px;padding: 20px;
    border: 1px solid var(--border-color);transition: background 0.3s;
}
.gradient-preview-bar {width: 100%;height: 30px;background: linear-gradient(to right, #d9afd9, #97d9e1);border-radius: 4px;margin-bottom: 15px;}
.color-wheel {width: 280px;height: 280px;background: linear-gradient(to top,#000,transparent),linear-gradient(to right,#fff,transparent);border-radius: 4px;position: relative;cursor: crosshair;}
.hue-bar {width: 100%;height: 20px;background: linear-gradient(90deg,#ff0000,#ffff00,#00ff00,#00ffff,#0000ff,#ff00ff,#ff0000);border-radius: 4px;margin:15px 0;position: relative;cursor: pointer;}
.color-picker-dot {position: absolute;width:12px;height:12px;border:2px solid #fff;border-radius:50%;transform:translate(-50%,-50%);box-shadow:0 0 0 1px #000;z-index:10;}
.hue-dot {position: absolute;top:50%;width:12px;height:24px;border:1px solid #fff;border-radius:2px;transform:translate(-50%,-50%);box-shadow:0 0 2px rgba(0,0,0,0.5);z-index:10;}
.color-values {flex:1;min-width:200px;}
.color-list {display:flex;flex-direction:column;gap:8px;margin-bottom:15px;}
.color-item {
    display:flex;gap:10px;align-items:center;padding:8px;
    border:1px solid var(--border-color);border-radius:4px;
    background:var(--card-bg);cursor:grab;transition: background 0.3s;
}
.color-item.locked {background:#f0f8fb;opacity:0.8;}
.dark .color-item.locked {background:#2c5282;}
.color-swatch {width:30px;height:30px;border-radius:4px;border:1px solid #ddd;}
.color-input {
    flex:1;padding:8px;border:1px solid var(--border-color);border-radius:4px;
    font-size:14px;outline:none;line-height:1;height:30px;
    background: var(--card-bg);color: var(--text);
}
.color-actions {display:flex;gap:4px;}
.color-btn {width:28px;height:28px;border:none;border-radius:4px;color:#fff;cursor:pointer;display:grid;place-items:center;font-size:12px;}
.btn-lock {background:#9f7aea;}.btn-copy {background:#38b2ac;}.btn-del {background:#e53e3e;}
.gradient-actions {display:flex;gap:8px;flex-wrap:wrap;}
.grad-btn {padding:8px 12px;border:none;border-radius:4px;color:#fff;cursor:pointer;font-size:14px;}
.btn-add {background:#48bb78;}.btn-reset {background:#ed8936;}.btn-random {background:#9f7aea;}.btn-import {background:#38b2ac;}

/* 文本输入 */
#rawText {
    width:100%;min-height:80px;padding:15px;
    border:2px solid var(--border-color);border-radius:8px;
    font-size:24px;line-height:1.6;outline:none;
    background:var(--box-bg);white-space:pre-wrap;color:var(--text);
}
.style-toolbar {display:flex;gap:8px;margin-bottom:10px;flex-wrap:wrap;}
.style-btn {
    width:40px;height:40px;border:1px solid var(--border-color);border-radius:4px;
    background:var(--card-bg);font-size:18px;cursor:pointer;display:grid;place-items:center;
    color: var(--text);transition: all 0.2s;
}
.style-btn.active {background:#3182ce;color:#fff;border-color:#3182ce;}

/* 预览区 */
.preview {
    min-height:80px;padding:20px;border:2px dashed var(--border-color);
    border-radius:8px;display:flex;align-items:center;justify-content:center;
    flex-wrap:wrap;font-size:26px;background:var(--box-bg);transition: background 0.3s;
}
.preview span {cursor:pointer;padding:2px 3px;border-radius:3px;transition:.15s;}
.preview span:hover {background:#bee3f860;}
.preview span.selected {background:#bee3f8;border:1px solid #3182ce;}

/* 代码区 */
.code-area textarea {
    width:100%;height:120px;padding:15px;
    border:1px solid var(--border-color);border-radius:8px;
    font-family:monospace;resize:vertical;outline:none;
    background:var(--card-bg);color:var(--text);
}
.btn-group {display:flex;gap:15px;justify-content:center;margin-top:20px;flex-wrap:wrap;}
.action-btn {padding:12px 28px;border:none;border-radius:6px;color:#fff;cursor:pointer;font-size:15px;}
.btn-mini {padding:10px 20px;font-size:14px;}
.btn-skip {background:#3182ce;}
.btn-full {background:#6c757d;}
.btn-format {background:#28a745;}
.btn-clear {background:#dd6b20;}