:root {
    --bg-dark: #09090b;       /* 极深灰，非纯黑，更有质感 */
    --surface: #18181b;       /* 面板颜色 */
    --surface-hover: #27272a;
    --border: #3f3f46;
    --primary: #3b82f6;       /* 专业蓝 */
    --primary-glow: rgba(59, 130, 246, 0.4);
    --text-main: #f4f4f5;
    --text-muted: #a1a1aa;
    --danger: #ef4444;
    
    --font-sans: 'Inter', sans-serif;
    --radius-md: 8px;
    --radius-full: 999px;
    --dock-bg: rgba(24, 24, 27, 0.85); /* 磨砂底 */
}

/* === Reset & Base === */
* { box-sizing: border-box; margin: 0; padding: 0; outline: none; -webkit-tap-highlight-color: transparent; }
body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-sans);
    height: 100vh;
    overflow: hidden;
}

/* === Utility === */
.hidden { display: none !important; }
button { font-family: inherit; border: none; cursor: pointer; transition: all 0.2s; }
.app-view { display: none; width: 100%; height: 100%; position: absolute; inset: 0; flex-direction: column; }
.app-view.active { display: flex; }

/* === Editor View === */
.top-bar {
    height: 64px;
    padding: 0 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.logo { font-weight: 800; font-size: 1.1rem; letter-spacing: 0.5px; display: flex; align-items: center; gap: 8px; }
.tag { font-size: 0.6rem; background: var(--border); padding: 2px 6px; border-radius: 4px; color: var(--text-muted); }

.toolbar { display: flex; gap: 16px; }
.btn-text { background: transparent; color: var(--text-muted); padding: 8px 12px; font-weight: 500; font-size: 0.9rem;}
.btn-text:hover { color: var(--danger); }

.btn-primary {
    background: var(--text-main);
    color: var(--bg-dark);
    padding: 10px 24px;
    border-radius: var(--radius-full);
    font-weight: 600;
    display: flex; align-items: center; gap: 6px;
    box-shadow: 0 0 15px rgba(255,255,255,0.1);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 20px rgba(255,255,255,0.2); }

.editor-wrapper { flex: 1; padding: 30px; display: flex; justify-content: center; }
.editor-card {
    width: 100%; max-width: 800px; height: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    display: flex; flex-direction: column;
    overflow: hidden;
}
textarea {
    flex: 1; width: 100%; padding: 24px;
    background: transparent; border: none; color: var(--text-main);
    font-size: 1.1rem; line-height: 1.6; resize: none;
}
.editor-footer {
    padding: 12px 24px; background: rgba(0,0,0,0.2);
    display: flex; justify-content: space-between;
    font-size: 0.85rem; color: var(--text-muted);
}

/* === Prompter View === */
#app-prompter { background: #000; } /* 提词时背景纯黑 */

#scroll-track {
    width: 100%; height: 100%;
    overflow: hidden; /* JS 处理滚动 */
    position: relative;
    z-index: 1;
}

.prompter-content {
    /* 核心属性由 JS 动态控制 */
    width: 100%;
    padding-left: 10%; padding-right: 10%; /* 默认边距 */
    color: #fff;
    font-weight: 600;
    text-align: left;
    transform-origin: center center; /* 镜像翻转中心 */
    will-change: transform; /* 性能优化 */
}

/* 视线引导线 */
.eye-line {
    position: absolute;
    top: 35%; /* 默认值 */
    left: 0; right: 0;
    height: 0px;
    z-index: 10;
    display: flex; align-items: center;
    opacity: 0.4;
    pointer-events: none;
    border-top: 1px dashed var(--primary);
}
.marker-left, .marker-right { 
    background: #000; color: var(--primary); font-size: 12px; padding: 0 5px;
}
.line { flex: 1; }

/* === Control Dock === */
.control-dock {
    position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%);
    width: 90%; max-width: 500px;
    background: var(--dock-bg);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px;
    padding: 16px;
    z-index: 100;
    transition: opacity 0.3s ease, transform 0.3s ease;
    display: flex; flex-direction: column; gap: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}
/* 鼠标闲置时隐藏 dock 的类 (JS控制) */
.dock-hidden { opacity: 0; transform: translate(-50%, 20px); pointer-events: none; }

.dock-section { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.dock-btn {
    width: 40px; height: 40px; border-radius: 50%;
    background: rgba(255,255,255,0.05); color: var(--text-main);
    display: flex; align-items: center; justify-content: center; font-size: 1.2rem;
}
.dock-btn:hover { background: rgba(255,255,255,0.1); }
.dock-btn.active-state { background: var(--primary); color: #000; }

.play-fab {
    width: 56px; height: 56px; border-radius: 50%;
    background: var(--text-main); color: #000;
    font-size: 1.5rem; display: flex; align-items: center; justify-content: center;
    box-shadow: 0 0 20px rgba(255,255,255,0.15);
}
.play-fab:hover { transform: scale(1.05); background: #fff; }

.speed-control {
    flex: 1; background: rgba(0,0,0,0.3);
    height: 40px; border-radius: 20px;
    display: flex; align-items: center; padding: 0 16px; gap: 10px;
}
.speed-control .label { font-size: 0.7rem; font-weight: 700; color: var(--text-muted); }
.speed-control .value { font-size: 0.9rem; font-weight: 600; min-width: 24px; text-align: right; }

/* Custom Range Input */
input[type=range] { -webkit-appearance: none; background: transparent; width: 100%; height: 20px; }
input[type=range]::-webkit-slider-runnable-track {
    width: 100%; height: 4px; background: rgba(255,255,255,0.2); border-radius: 2px;
}
input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none; height: 16px; width: 16px; border-radius: 50%;
    background: #fff; margin-top: -6px; box-shadow: 0 2px 6px rgba(0,0,0,0.5); cursor: grab;
}

/* Settings Grid */
.settings-panel { 
    flex-direction: column; align-items: stretch; gap: 16px; 
    border-top: 1px solid rgba(255,255,255,0.1); padding-top: 16px;
    animation: slideDown 0.3s ease;
}
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

.setting-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.setting-item { display: flex; flex-direction: column; gap: 8px; }
.setting-item label { font-size: 0.8rem; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }

.setting-toggles { display: flex; gap: 8px; flex-wrap: wrap; }
.toggle-chip {
    padding: 6px 12px; background: rgba(255,255,255,0.05); border-radius: 6px;
    font-size: 0.8rem; color: var(--text-muted); display: flex; align-items: center; gap: 6px;
    border: 1px solid transparent;
}
.toggle-chip.active { background: rgba(59, 130, 246, 0.15); color: var(--primary); border-color: var(--primary); }

/* Countdown */
#countdown-layer {
    position: fixed; inset: 0; background: rgba(0,0,0,0.8); z-index: 200;
    display: flex; align-items: center; justify-content: center;
}
.count-num { font-size: 15rem; font-weight: 800; color: #fff; animation: pulse 1s infinite; }
@keyframes pulse { 0% { opacity: 0.5; transform: scale(0.8); } 100% { opacity: 1; transform: scale(1.2); } }