:root {
    --bg-primary: #0a0c10;
    --bg-secondary: #11141d;
    --bg-card: rgba(17, 20, 29, 0.75);
    --bg-card-hover: rgba(23, 27, 39, 0.85);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-highlight: rgba(0, 240, 255, 0.35);
    
    --accent-cyan: #00f0ff;
    --accent-blue: #0070f3;
    --accent-purple: #7928ca;
    --accent-green: #00df8f;
    --accent-red: #ff0055;
    
    --text-primary: #f0f3f8;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    
    --shadow-glow: 0 0 35px rgba(0, 240, 255, 0.18);
}

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

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-main);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    -webkit-font-smoothing: antialiased;
}

/* Background Animated Lights */
.bg-glow {
    position: fixed;
    width: 650px;
    height: 650px;
    border-radius: 50%;
    filter: blur(140px);
    pointer-events: none;
    z-index: 0;
    opacity: 0.15;
}

.glow-1 {
    top: -150px;
    left: -150px;
    background: radial-gradient(circle, var(--accent-cyan), transparent 70%);
}

.glow-2 {
    bottom: -150px;
    right: -150px;
    background: radial-gradient(circle, var(--accent-purple), transparent 70%);
}

.bg-grid {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
    z-index: 0;
}

/* Screens */
.view-screen {
    display: none;
    position: relative;
    z-index: 1;
}

.view-screen.active {
    display: block;
}

/* Glassmorphism Panel */
.glass-panel {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: all 0.25s ease;
}

.glass-card:hover {
    border-color: rgba(255, 255, 255, 0.14);
}

/* Gradient Text */
.gradient-text {
    background: linear-gradient(135deg, var(--accent-cyan) 0%, #38bdf8 50%, var(--accent-purple) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ==========================================================================
   LOGIN SCREEN
   ========================================================================== */
#loginScreen {
    min-height: 100vh;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

#loginScreen.active {
    display: flex;
}

.login-card {
    width: 100%;
    max-width: 440px;
    border-radius: var(--radius-xl);
    padding: 40px 32px;
    text-align: center;
    border: 1px solid rgba(0, 240, 255, 0.15);
    box-shadow: var(--shadow-glow);
    animation: fadeInScale 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.brand-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 240, 255, 0.08);
    border: 1px solid rgba(0, 240, 255, 0.25);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: var(--accent-cyan);
    margin-bottom: 20px;
}

.brand-title {
    font-size: 1.85rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 8px;
}

.brand-subtitle {
    color: var(--text-secondary);
    font-size: 0.88rem;
    margin-bottom: 32px;
}

.auth-form {
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 14px;
    width: 18px;
    height: 18px;
    color: var(--text-muted);
}

.input-wrapper input {
    width: 100%;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: var(--font-main);
    padding: 13px 14px 13px 44px;
    border-radius: var(--radius-md);
    outline: none;
    transition: all 0.2s ease;
}

.input-wrapper input:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.2);
    background: rgba(0, 0, 0, 0.5);
}

.alert-box {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
}

.alert-box.error {
    background: rgba(255, 0, 85, 0.12);
    border: 1px solid rgba(255, 0, 85, 0.3);
    color: #ff6b8b;
}

.alert-box svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.login-footer {
    margin-top: 28px;
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

/* ==========================================================================
   STUDIO MAIN SCREEN
   ========================================================================== */
.studio-header {
    height: 70px;
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo-group {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.2), rgba(121, 40, 202, 0.2));
    border: 1px solid var(--border-highlight);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-cyan);
}

.logo-icon svg {
    width: 22px;
    height: 22px;
}

.studio-brand {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.studio-brand span {
    color: var(--accent-cyan);
}

.studio-tag {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: var(--text-muted);
}

.status-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(0, 223, 143, 0.1);
    border: 1px solid rgba(0, 223, 143, 0.25);
    color: var(--accent-green);
}

.user-pill {
    font-size: 0.82rem;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
}

.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--accent-cyan);
    box-shadow: 0 0 10px var(--accent-cyan);
    animation: pulse 2s infinite;
}

.pulse-dot.green {
    background-color: var(--accent-green);
    box-shadow: 0 0 10px var(--accent-green);
}

/* Studio Layout Container */
.studio-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 32px;
}

.studio-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px;
    align-items: start;
}

@media (max-width: 1080px) {
    .studio-layout {
        grid-template-columns: 1fr;
    }
}

.control-column, .output-column {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Card Headers */
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.card-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-title svg {
    width: 20px;
    height: 20px;
    color: var(--accent-cyan);
}

.card-title h2 {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

/* Preset Dropdown & Selects */
.select-preset, .select-voice {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 0.85rem;
    padding: 8px 14px;
    border-radius: var(--radius-md);
    outline: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.select-preset:focus, .select-voice:focus {
    border-color: var(--accent-cyan);
}

.select-voice {
    width: 100%;
    padding: 12px 14px;
    font-size: 0.95rem;
    font-weight: 500;
}

.voice-picker-grid {
    margin-bottom: 24px;
}

.param-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Textarea styling */
.textarea-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.textarea-wrapper textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 1.05rem;
    line-height: 1.6;
    outline: none;
    resize: vertical;
    min-height: 130px;
    transition: border-color 0.2s ease;
}

.textarea-wrapper textarea:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.12);
}

.textarea-footer {
    display: flex;
    justify-content: space-between;
    font-size: 0.78rem;
    color: var(--text-muted);
    padding: 0 4px;
}

kbd {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-secondary);
}

/* Sliders Grid */
.sliders-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

@media (max-width: 640px) {
    .sliders-grid {
        grid-template-columns: 1fr;
    }
}

.slider-control {
    background: rgba(0, 0, 0, 0.25);
    padding: 14px 16px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.slider-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.slider-value {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--accent-cyan);
    font-weight: 700;
}

input[type="range"] {
    width: 100%;
    -webkit-appearance: none;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.12);
    outline: none;
    margin: 8px 0;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-cyan);
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.6);
    transition: transform 0.1s;
}

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

.slider-hints {
    display: flex;
    justify-content: space-between;
    font-size: 0.68rem;
    color: var(--text-muted);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font-main);
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-cyan) 0%, #0099ff 100%);
    color: #050505;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 240, 255, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 12px 20px;
    font-size: 0.9rem;
}

.btn-secondary:hover:not(.disabled) {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.25);
}

.btn-secondary.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-outline:hover {
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 8px;
}

.btn-ghost:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
}

.btn-icon {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: 8px;
    border-radius: var(--radius-sm);
}

.btn-icon:hover {
    color: var(--text-primary);
    border-color: var(--accent-cyan);
}

.btn-block {
    width: 100%;
    padding: 14px;
    font-size: 1rem;
}

.btn-xl {
    width: 100%;
    padding: 16px 24px;
    font-size: 1.05rem;
    font-weight: 700;
    border-radius: var(--radius-lg);
}

.btn-xs {
    padding: 4px 10px;
    font-size: 0.72rem;
}

.btn-play-icon {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Player Display */
.player-display {
    display: flex;
    flex-direction: column;
    gap: 18px;
    align-items: center;
}

.visualizer-bars {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    height: 50px;
    width: 100%;
    padding: 8px 0;
}

.visualizer-bars .bar {
    width: 5px;
    height: 8px;
    background: linear-gradient(to top, var(--accent-cyan), var(--accent-purple));
    border-radius: 4px;
    transition: height 0.15s ease;
}

.visualizer-bars.playing .bar {
    animation: soundWave 0.8s ease-in-out infinite alternate;
}

.visualizer-bars.playing .bar:nth-child(2) { animation-delay: 0.1s; }
.visualizer-bars.playing .bar:nth-child(3) { animation-delay: 0.2s; }
.visualizer-bars.playing .bar:nth-child(4) { animation-delay: 0.3s; }
.visualizer-bars.playing .bar:nth-child(5) { animation-delay: 0.4s; }
.visualizer-bars.playing .bar:nth-child(6) { animation-delay: 0.5s; }
.visualizer-bars.playing .bar:nth-child(7) { animation-delay: 0.2s; }
.visualizer-bars.playing .bar:nth-child(8) { animation-delay: 0.4s; }
.visualizer-bars.playing .bar:nth-child(9) { animation-delay: 0.1s; }
.visualizer-bars.playing .bar:nth-child(10) { animation-delay: 0.3s; }
.visualizer-bars.playing .bar:nth-child(11) { animation-delay: 0.5s; }
.visualizer-bars.playing .bar:nth-child(12) { animation-delay: 0.2s; }
.visualizer-bars.playing .bar:nth-child(13) { animation-delay: 0.4s; }
.visualizer-bars.playing .bar:nth-child(14) { animation-delay: 0.1s; }
.visualizer-bars.playing .bar:nth-child(15) { animation-delay: 0.3s; }

.native-audio {
    width: 100%;
    border-radius: var(--radius-md);
    outline: none;
}

.time-badge {
    background: rgba(0, 240, 255, 0.12);
    border: 1px solid rgba(0, 240, 255, 0.3);
    color: var(--accent-cyan);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    padding: 4px 8px;
    border-radius: 6px;
    font-weight: 700;
}

/* Code Snippet Card */
.code-tabs {
    display: flex;
    gap: 6px;
}

.tab-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
}

.tab-btn.active {
    background: var(--accent-cyan);
    color: #000;
    border-color: var(--accent-cyan);
}

.code-box-wrapper {
    position: relative;
    background: rgba(0, 0, 0, 0.55);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    padding: 16px;
    overflow-x: auto;
}

.code-content {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: #cbd5e1;
    white-space: pre-wrap;
    word-break: break-all;
}

.copy-btn {
    position: absolute;
    top: 10px;
    right: 10px;
}

.copy-btn svg {
    width: 16px;
    height: 16px;
}

/* History Card */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 240px;
    overflow-y: auto;
}

.empty-history {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
    padding: 24px 0;
}

.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    gap: 12px;
    animation: slideIn 0.2s ease;
}

.history-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
}

.history-text {
    font-size: 0.85rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 320px;
}

.history-meta {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.history-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

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

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-top-color: #000;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--bg-card);
    border: 1px solid var(--accent-cyan);
    color: var(--text-primary);
    padding: 12px 20px;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
    font-size: 0.9rem;
    z-index: 100;
    animation: slideUp 0.3s ease;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.85); }
}

@keyframes fadeInScale {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes soundWave {
    from { height: 6px; }
    to { height: 42px; }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

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