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

:root {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-tertiary: #0f3460;
    --text-primary: #e8e8e8;
    --text-secondary: #a0a0a0;
    --accent: #e94560;
    --accent-hover: #ff6b6b;
    --highlight: #ffd93d;
    --border: #2a2a4e;
    --shadow: rgba(0, 0, 0, 0.3);
}

html, body {
    height: 100%;
    font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "WenQuanYi Micro Hei", sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.container {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.panel {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.hidden {
    display: none !important;
}

/* Header */
.header {
    background: var(--bg-secondary);
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 1rem;
}

.header h1 {
    font-size: 1.5rem;
    color: var(--highlight);
}

.header-buttons {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: #1a4a7a;
}

.btn-control {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 0.8rem 1rem;
    min-width: 80px;
}

.btn-control:hover {
    background: var(--bg-tertiary);
}

.btn-control .icon {
    font-size: 1.2rem;
}

.btn-toggle {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    padding: 0.6rem 1rem;
}

.btn-toggle.active {
    background: var(--accent);
    color: white;
}

/* Edit Area */
.edit-area {
    flex: 1;
    padding: 1rem;
    display: flex;
}

#textInput {
    width: 100%;
    height: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    color: var(--text-primary);
    font-size: 1.1rem;
    line-height: 1.8;
    resize: none;
    transition: border-color 0.2s;
}

#textInput:focus {
    outline: none;
    border-color: var(--accent);
}

#textInput::placeholder {
    color: var(--text-secondary);
}

/* Quick Settings */
.quick-settings {
    background: var(--bg-secondary);
    padding: 1rem 1.5rem;
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    border-top: 1px solid var(--border);
}

.setting-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.setting-item label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Play Mode */
.prompter-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: var(--bg-primary);
}

.prompter-text {
    position: absolute;
    width: 100%;
    padding: 2rem;
    font-size: 48px;
    line-height: 1.8;
    text-align: center;
    transition: transform 0.05s linear;
    will-change: transform;
}

.prompter-text.mirror-h {
    transform: scaleX(-1);
}

.prompter-text.mirror-v {
    transform: scaleY(-1);
}

.prompter-text.mirror-h.mirror-v {
    transform: scale(-1, -1);
}

.prompter-text .line {
    padding: 0.5rem 0;
    transition: color 0.3s, text-shadow 0.3s;
}

.prompter-text .line.current {
    color: var(--highlight);
    text-shadow: 0 0 20px var(--highlight);
}

.center-line {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent);
    opacity: 0.5;
    pointer-events: none;
}

/* Control Panel */
.control-panel {
    background: var(--bg-secondary);
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
}

.progress-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.progress-slider {
    flex: 1;
    height: 8px;
    -webkit-appearance: none;
    background: var(--bg-tertiary);
    border-radius: 4px;
    cursor: pointer;
}

.progress-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: var(--accent);
    border-radius: 50%;
    cursor: grab;
}

.progress-slider::-webkit-slider-thumb:active {
    cursor: grabbing;
    transform: scale(1.1);
}

.progress-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--accent);
    border-radius: 50%;
    border: none;
    cursor: grab;
}

#progressValue {
    min-width: 50px;
    text-align: right;
    color: var(--text-secondary);
}

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: center;
    justify-content: space-between;
}

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

.setting-inline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-tertiary);
    padding: 0.5rem 1rem;
    border-radius: 8px;
}

.setting-inline label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.setting-inline input[type="range"] {
    width: 80px;
    height: 4px;
    -webkit-appearance: none;
    background: var(--bg-secondary);
    border-radius: 2px;
}

.setting-inline input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: var(--highlight);
    border-radius: 50%;
}

.setting-inline span {
    min-width: 45px;
    text-align: right;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.mirror-controls {
    gap: 0.5rem;
}

.shortcuts-hint {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-align: center;
}

/* Sliders in edit mode */
input[type="range"] {
    height: 6px;
    -webkit-appearance: none;
    background: var(--bg-tertiary);
    border-radius: 3px;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--accent);
    border-radius: 50%;
    transition: transform 0.1s;
}

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

input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--accent);
    border-radius: 50%;
    border: none;
}

/* General range inputs */
input[type="range"] {
    min-width: 100px;
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        text-align: center;
    }
    
    .header-buttons {
        width: 100%;
        justify-content: center;
    }
    
    .controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .control-group {
        justify-content: center;
    }
    
    .shortcuts-hint {
        display: none;
    }
    
    .quick-settings {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .setting-item {
        width: 100%;
        justify-content: space-between;
    }
    
    .setting-item input[type="range"] {
        flex: 1;
    }
}

@media (max-width: 480px) {
    .btn {
        padding: 0.5rem 0.8rem;
        font-size: 0.85rem;
    }
    
    .setting-inline {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .mirror-controls .btn {
        font-size: 0.75rem;
        padding: 0.4rem 0.6rem;
    }
}

/* Fullscreen styles */
:fullscreen .prompter-container,
:-webkit-full-screen .prompter-container {
    height: calc(100vh - 160px);
}

:fullscreen .control-panel,
:-webkit-full-screen .control-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

/* Animations */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.playing .prompter-text .line.current {
    animation: pulse 2s ease-in-out infinite;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}
