:root {
    --bg-color: #090B10;
    --panel-bg: rgba(20, 24, 32, 0.7);
    --panel-border: rgba(255, 255, 255, 0.08);
    --primary-glow: rgba(0, 240, 255, 0.6);
    --primary-color: #00f0ff;
    --text-primary: #ffffff;
    --text-secondary: #8c92a4;
    --accent-gold: #ffd700;
    --overview-bg: rgba(0, 190, 255, 0.08); /* 浅蓝色全息感底色 */
    --overview-border: rgba(0, 190, 255, 0.3);
    
    --l1-bg: rgba(30, 35, 45, 0.8);
    --l2-bg: rgba(40, 45, 55, 0.6);
    --pill-bg: #2a2d36;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: 'Inter', 'Noto Sans SC', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    /* 微妙的镭射和霓虹背景渐变 */
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(0, 240, 255, 0.03), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(255, 215, 0, 0.03), transparent 25%);
}

/* Scrollbar Hide for horizontal rows */
.horizontal-scroll {
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    gap: 12px;
    padding-bottom: 4px;
    scrollbar-width: none; /* Firefox */
}
.horizontal-scroll::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

/* Layout */
.app-container {
    display: flex;
    width: 100%;
    height: 100vh;
}

.main-workspace {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 30px 40px;
    overflow-y: auto;
}

.api-sidebar {
    width: 320px;
    background: var(--panel-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-left: 1px solid var(--panel-border);
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    box-shadow: -10px 0 30px rgba(0,0,0,0.5);
    z-index: 10;
}

/* Header & Title */
.app-header {
    text-align: center;
    margin-bottom: 40px;
}

.main-title {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: 2px;
    background: linear-gradient(90deg, #fff, var(--primary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 24px;
    text-shadow: 0 0 20px rgba(0, 240, 255, 0.2);
}

.mode-switcher {
    display: inline-flex;
    background: rgba(0,0,0,0.5);
    border-radius: 30px;
    padding: 4px; 
    border: 1px solid var(--panel-border);
}

.mode-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 10px 24px;
    border-radius: 26px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.mode-btn.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    box-shadow: inset 0 0 10px rgba(255,255,255,0.05);
}

/* Module Cards */
.module-card {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    transition: border-color 0.3s ease;
}

.module-card:hover { border-color: rgba(255, 255, 255, 0.15); }

.module-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.step-num {
    background: var(--primary-color);
    color: #000;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 1px;
}

.custom-prompt-input {
    width: 100%;
    min-height: 80px;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    color: var(--text-primary);
    padding: 12px 16px;
    font-family: monospace;
    font-size: 0.95rem;
    resize: vertical;
    margin-bottom: 0;
    margin-top: 16px;
    outline: none;
    transition: all 0.3s ease;
}

.custom-prompt-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.1);
}

.giant-input {
    min-height: 250px;
    font-size: 1.1rem;
    line-height: 1.6;
    flex: 1;
}

/* L1, L2, L3 Layers */
.dynamic-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 48px; /* 避免塌陷 */
    margin-bottom: 16px;
}

/* 横向排布类 - 支持自动换行 */
.l-row {
    display: flex;
    flex-wrap: wrap; /* 允许自动换行以展示海量词库 */
    gap: 10px;
    padding-bottom: 4px;
}

.l1-tab {
    background: var(--l1-bg);
    border: 1px solid var(--panel-border);
    padding: 12px 24px;
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
    flex-shrink: 0;
}
.l1-tab:hover {
    background: rgba(40, 45, 55, 0.9);
}
.l1-tab.active {
    background: rgba(0, 240, 255, 0.1);
    border-color: var(--primary-color);
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.2);
}

.l2-tab {
    background: var(--l2-bg);
    border: 1px solid transparent;
    padding: 8px 20px;
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    flex-shrink: 0;
}
.l2-tab:hover { color: #fff; }
.l2-tab.active {
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    background: rgba(255,255,255,0.05);
}

.l3-pill {
    background: var(--pill-bg);
    border: 1px solid rgba(255,255,255,0.05);
    padding: 6px 16px;
    border-radius: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    flex-shrink: 0;
}
.l3-pill:hover { background: rgba(255,255,255,0.1); color: #fff; }
.l3-pill.active {
    background: var(--primary-color);
    color: #000;
    font-weight: 600;
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.4);
}

/* M3 Specific Track */
.timeline-track {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    background: rgba(0,0,0,0.2);
    padding: 10px;
    border-radius: 12px;
    overflow-x: auto;
}
.timeline-track::-webkit-scrollbar { display: none; }

.shot-tab {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--panel-border);
    padding: 10px 20px;
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 600;
    flex-shrink: 0;
    transition: all 0.2s ease;
}
.shot-tab:hover { background: rgba(255, 255, 255, 0.1); }
.shot-tab.active {
    background: rgba(255, 215, 0, 0.1);
    border-color: var(--accent-gold);
    color: var(--accent-gold);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.15);
}

.delete-shot-icon {
    display: none;
    position: absolute;
    top: -8px;
    right: -8px;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(255, 0, 0, 0.6);
    color: #fff;
    font-size: 16px;
    font-weight: bold;
    line-height: 1;
    transition: all 0.2s;
    z-index: 10;
}
.shot-tab:hover .delete-shot-icon {
    display: flex;
}
.delete-shot-icon:hover {
    background: rgba(255, 0, 0, 0.8);
    color: #fff;
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.4);
}

.add-shot-btn {
    background: transparent;
    border: 1px dashed var(--text-secondary);
    padding: 10px 20px;
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: bold;
    transition: all 0.2s ease;
    flex-shrink: 0;
}
.add-shot-btn:hover { border-color: #fff; color: #fff; background: rgba(255,255,255,0.05); }

/* Overview & Action */
.overview-section { margin-top: 20px; }
.overview-box {
    background: var(--overview-bg);
    border: 1px solid var(--overview-border);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: inset 0 0 20px rgba(0, 190, 255, 0.05), 0 0 15px rgba(0, 190, 255, 0.1);
    backdrop-filter: blur(5px);
}
.overview-title {
    color: var(--primary-color);
    font-size: 1.1rem;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
}
.overview-title span { font-size: 0.8rem; opacity: 0.6; color: rgba(255,255,255,0.7); font-weight: 400; }
.overview-content {
    font-family: monospace;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #e0e6ed;
    white-space: pre-wrap;
    min-height: 100px;
}
.placeholder-text { color: rgba(255,255,255,0.3); font-style: italic; }

.action-bar {
    display: flex;
    justify-content: flex-end;
    gap: 16px;
    padding-bottom: 40px;
}
.btn-cancel {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.2);
    color: var(--text-secondary);
    padding: 16px 32px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.3s ease;
}
.btn-cancel:hover { background: rgba(255,255,255,0.05); color: #fff; }
.btn-generate {
    background: linear-gradient(135deg, var(--primary-color), #0099ff);
    border: none;
    color: #000;
    padding: 16px 48px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 1px;
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.4);
    transition: all 0.3s ease;
}
.btn-generate:hover { transform: translateY(-2px); box-shadow: 0 0 30px rgba(0, 240, 255, 0.6); }

/* Sidebar Inputs */
.sidebar-title { font-size: 1.1rem; color: #fff; margin-bottom: 10px; border-bottom: 1px solid var(--panel-border); padding-bottom: 15px; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 8px; }
.cyber-input, .cyber-select {
    width: 100%;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1);
    color: #fff;
    padding: 10px 12px;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.3s ease;
}
.cyber-input:focus, .cyber-select:focus { border-color: var(--primary-color); }
.param-slider { display: flex; align-items: center; gap: 10px; font-size: 0.85rem; }
.param-slider input[type="range"] { flex: 1; accent-color: var(--primary-color); }
.system-status { margin-top: auto; font-size: 0.85rem; color: #4ade80; display: flex; align-items: center; gap: 8px; }
.status-dot { width: 8px; height: 8px; background: #4ade80; border-radius: 50%; box-shadow: 0 0 8px #4ade80; animation: pulse 2s infinite; }
@keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.4; } 100% { opacity: 1; } }

/* Utility & Animations */
.hidden { display: none !important; }

.fade-in {
    animation: fadeIn 0.3s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Result Modal */
#result-modal {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    z-index: 1000;
    display: flex; align-items: center; justify-content: center;
}
.result-modal-backdrop {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(10px);
}
.result-modal-content {
    position: relative;
    background: var(--panel-bg);
    border: 1px solid var(--primary-color);
    box-shadow: 0 0 40px rgba(0, 240, 255, 0.2);
    border-radius: 16px;
    width: 80%; max-width: 900px;
    height: 80vh; max-height: 800px;
    display: flex; flex-direction: column;
    padding: 30px;
    z-index: 1001;
}
.result-modal-title {
    font-size: 1.4rem; color: #fff; margin-bottom: 20px;
    display: flex; align-items: center; gap: 12px;
}
.result-text-area {
    flex: 1;
    background: rgba(0,0,0,0.4);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    padding: 20px;
    color: #e0e6ed;
    font-family: monospace; font-size: 1.05rem; line-height: 1.6;
    overflow-y: auto; white-space: pre-wrap;
    margin-bottom: 24px;
}
.result-modal-actions {
    display: flex; gap: 16px; align-items: center;
}
.fade-in-up { animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.status-pulse { width: 10px; height: 10px; background: #f39c12; border-radius: 50%; box-shadow: 0 0 10px #f39c12; animation: pulse 1s infinite; display: none; }
.status-pulse.active { display: block; }
