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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* Auth Pages */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
}

.auth-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 2.5rem;
    border-radius: 20px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-icon {
    text-align: center;
    margin-bottom: 1rem;
}

.auth-subtitle {
    text-align: center;
    color: #888;
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    margin-top: -1rem;
}

.auth-container h1 {
    text-align: center;
    margin-bottom: 0.5rem;
    color: #667eea;
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.form-group {
    margin-bottom: 1.2rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: #555;
}

.form-group input {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    background: #f8f9fa;
    color: #333;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group small {
    color: #888;
    font-size: 0.75rem;
    margin-top: 0.3rem;
    display: block;
}

.btn {
    display: inline-block;
    padding: 0.7rem 1.5rem;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    width: 100%;
    padding: 0.9rem;
    font-size: 1.05rem;
    margin-top: 0.5rem;
}

.btn-primary:hover {
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.auth-link {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.95rem;
    color: #666;
}

.auth-link a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s;
}

.auth-link a:hover {
    color: #764ba2;
}

.message {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.9rem;
    min-height: 1.2em;
    padding: 0.5rem;
    border-radius: 8px;
}

.message.error {
    color: #e74c3c;
    background: rgba(231, 76, 60, 0.1);
}

.message.success {
    color: #27ae60;
    background: rgba(39, 174, 96, 0.1);
}

/* Teleprompter Page */
.teleprompter-page {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: #f5f7fa;
}

/* Top Bar */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1.5rem;
    background: #fff;
    border-bottom: 1px solid #e1e5e9;
    flex-shrink: 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.top-bar h1 {
    font-size: 1.2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.top-bar .btn {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    background: #f0f2f5;
    color: #555;
    border-radius: 8px;
}

.top-bar .btn:hover {
    background: #e8eaed;
}

/* Main Content */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Editor Panel */
.editor-panel {
    width: 40%;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #e1e5e9;
    background: #fff;
}

.editor-header {
    display: flex;
    gap: 0.8rem;
    padding: 0.8rem;
    background: #f8f9fa;
    border-bottom: 1px solid #e1e5e9;
}

.editor-header input {
    flex: 1;
    padding: 0.6rem 1rem;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    background: #fff;
    color: #333;
    font-size: 0.95rem;
    transition: all 0.3s;
}

.editor-header input:focus {
    outline: none;
    border-color: #667eea;
}

.editor-header .btn {
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
}

.btn-save {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: #fff;
}

.btn-save:hover {
    box-shadow: 0 5px 15px rgba(17, 153, 142, 0.4);
}

#scriptContent {
    flex: 1;
    width: 100%;
    padding: 1.2rem;
    border: none;
    background: #fff;
    color: #333;
    font-size: 1rem;
    line-height: 1.8;
    resize: none;
    outline: none;
}

#scriptContent::placeholder {
    color: #aaa;
}

/* Preview Panel */
.preview-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    background: #1a1a2e;
}

.preview-display {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
}

#previewText {
    padding: 3rem;
    line-height: 2;
    transition: font-size 0.2s;
    min-height: 100%;
}

/* Control Bar */
.control-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem 1.5rem;
    background: #fff;
    border-top: 1px solid #e1e5e9;
    flex-shrink: 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.control-group {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.control-group label {
    font-size: 0.85rem;
    color: #666;
    font-weight: 600;
    white-space: nowrap;
}

.control-group input[type="range"] {
    width: 100px;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: #e1e5e9;
    border-radius: 3px;
    outline: none;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s;
}

.control-group input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.control-group .value-display {
    font-size: 0.85rem;
    color: #667eea;
    font-weight: 600;
    min-width: 3em;
    text-align: center;
    background: #f0f2f5;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
}

.btn-control {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    background: #f0f2f5;
    color: #555;
    border-radius: 8px;
    font-weight: 600;
}

.btn-control:hover {
    background: #e8eaed;
}

.btn-play {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.btn-play:hover {
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-stop {
    background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
    color: #fff;
}

.btn-stop:hover {
    box-shadow: 0 5px 15px rgba(235, 51, 73, 0.4);
}

/* Theme buttons */
.theme-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 3px solid #fff;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.3s;
}

.theme-btn:hover {
    transform: scale(1.15);
}

.theme-btn.active {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

.theme-dark {
    background: #1a1a2e;
}

.theme-light {
    background: #fff;
}

.theme-blue {
    background: #0d47a1;
}

/* Scripts Sidebar */
.scripts-sidebar {
    position: fixed;
    top: 0;
    right: -350px;
    width: 350px;
    height: 100%;
    background: #fff;
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.15);
    transition: right 0.3s ease;
    z-index: 100;
    display: flex;
    flex-direction: column;
}

.scripts-sidebar.open {
    right: 0;
}

.scripts-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem;
    border-bottom: 1px solid #e1e5e9;
    background: #f8f9fa;
}

.scripts-sidebar-header h3 {
    color: #667eea;
    font-size: 1.1rem;
    font-weight: 700;
}

.close-sidebar {
    background: none;
    border: none;
    color: #666;
    font-size: 1.8rem;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s;
}

.close-sidebar:hover {
    background: #f0f2f5;
    color: #333;
}

.scripts-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.script-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #f0f2f5;
    cursor: pointer;
    transition: all 0.3s;
    border-radius: 8px;
    margin: 0.3rem 0;
}

.script-item:hover {
    background: #f8f9fa;
    transform: translateX(-5px);
}

.script-item-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.3rem;
}

.script-item-date {
    font-size: 0.75rem;
    color: #999;
}

.script-item-delete {
    background: none;
    border: none;
    color: #e74c3c;
    cursor: pointer;
    font-size: 1.3rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s;
}

.script-item-delete:hover {
    background: rgba(231, 76, 60, 0.1);
}

/* Fullscreen mode */
.fullscreen .top-bar,
.fullscreen .editor-panel,
.fullscreen .control-bar {
    display: none;
}

.fullscreen .main-content {
    display: block;
}

.fullscreen .preview-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999;
}

.fullscreen .preview-display {
    height: 100%;
}

/* Theme: Dark (default) */
.theme-dark-bg {
    background: #1a1a2e;
    color: #fff;
}

/* Theme: Light */
.theme-light-bg {
    background: #fff;
    color: #333;
}

/* Theme: Blue */
.theme-blue-bg {
    background: #0d47a1;
    color: #ffeb3b;
}

/* Mirror mode */
.mirror-x {
    transform: scaleX(-1);
}

.mirror-y {
    transform: scaleY(-1);
}

.mirror-xy {
    transform: scale(-1, -1);
}

/* Responsive */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }
    
    .editor-panel {
        width: 100%;
        height: 40%;
        border-right: none;
        border-bottom: 1px solid #e1e5e9;
    }
    
    .control-bar {
        gap: 0.8rem;
        padding: 0.8rem;
    }
    
    .control-group input[type="range"] {
        width: 80px;
    }
    
    .scripts-sidebar {
        width: 100%;
        right: -100%;
    }
    
    .auth-container {
        padding: 2rem;
    }
}

@media (max-width: 480px) {
    .top-bar {
        padding: 0.6rem 1rem;
    }
    
    .top-bar h1 {
        font-size: 1rem;
    }
    
    .control-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.6rem;
    }
    
    .control-group {
        justify-content: space-between;
    }
    
    .control-group input[type="range"] {
        flex: 1;
    }
    
    .auth-container {
        padding: 1.5rem;
    }
    
    .auth-container h1 {
        font-size: 1.5rem;
    }
}
