@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
    --bg-0: #09090b;
    --bg-1: #0f0f13;
    --bg-2: #16161d;
    --bg-3: #1c1c27;
    --bg-card: #13131a;
    --bg-card-hover: #1a1a24;
    --bg-elevated: #1e1e2a;
    --border: #27273a;
    --border-hover: #3a3a55;
    --border-focus: #6366f1;
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --accent-muted: rgba(99, 102, 241, 0.12);
    --accent-glow: rgba(99, 102, 241, 0.25);
    --cyan: #22d3ee;
    --cyan-muted: rgba(34, 211, 238, 0.12);
    --green: #34d399;
    --green-muted: rgba(52, 211, 153, 0.1);
    --red: #f43f5e;
    --red-muted: rgba(244, 63, 94, 0.1);
    --amber: #fbbf24;
    --amber-muted: rgba(251, 191, 36, 0.1);
    --orange: #fb923c;
    --text-0: #fafafa;
    --text-1: #e4e4e7;
    --text-2: #a1a1aa;
    --text-3: #71717a;
    --text-4: #52525b;
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow: 0 4px 12px rgba(0,0,0,0.25);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.35);
    --transition: all 0.2s ease;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-display: 'Space Grotesk', 'Inter', sans-serif;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow-x: hidden; }

body {
    font-family: var(--font);
    background: var(--bg-0);
    color: var(--text-1);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===================== NAVBAR ===================== */
.navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 60px;
    background: rgba(9, 9, 11, 0.85);
    backdrop-filter: blur(16px) saturate(1.6);
    -webkit-backdrop-filter: blur(16px) saturate(1.6);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 1000;
}

.navbar-brand {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-0);
    letter-spacing: -0.3px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
}

.navbar-brand .mic-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--accent);
    border-radius: 8px;
    font-size: 1rem;
}

.navbar-nav {
    display: flex;
    gap: 4px;
    align-items: center;
}

.nav-link {
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-2);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    background: none;
    white-space: nowrap;
    font-family: var(--font);
}

.nav-link:hover { color: var(--text-0); background: var(--bg-3); }
.nav-link.active { color: var(--text-0); background: var(--accent-muted); }

.nav-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 12px 5px 14px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 28px;
    margin-left: 4px;
}

.nav-user .username {
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--text-0);
}

.nav-user .points-badge {
    background: var(--amber-muted);
    color: var(--amber);
    padding: 3px 10px;
    border-radius: 14px;
    font-size: 0.7rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* ===================== LAYOUT ===================== */
.main-container {
    padding-top: 76px;
    padding-bottom: 40px;
    min-height: 100vh;
}

.page-section {
    display: none;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
    animation: fadeIn 0.35s ease;
}

.page-section.active { display: block; }

/* ===================== AUTH ===================== */
.auth-container {
    max-width: 420px;
    margin: 48px auto;
    padding: 0 20px;
}

.auth-card {
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 40px 36px;
}

.auth-card h2 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 4px;
    color: var(--text-0);
}

.auth-card .subtitle {
    text-align: center;
    color: var(--text-3);
    margin-bottom: 28px;
    font-size: 0.88rem;
}

.form-group { margin-bottom: 16px; }

.form-group label {
    display: block;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-2);
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 11px 14px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-0);
    font-size: 0.9rem;
    font-family: var(--font);
    transition: var(--transition);
    outline: none;
}

.form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-input::placeholder { color: var(--text-4); }

/* ===================== BUTTONS ===================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    outline: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}
.btn-primary:hover {
    background: var(--accent-hover);
    box-shadow: 0 4px 20px var(--accent-glow);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-3);
    border: 1px solid var(--border);
    color: var(--text-1);
}
.btn-secondary:hover {
    background: var(--bg-elevated);
    border-color: var(--border-hover);
}

.btn-danger {
    background: var(--red-muted);
    color: var(--red);
}
.btn-danger:hover { background: rgba(244, 63, 94, 0.18); }

.btn-gold {
    background: linear-gradient(135deg, var(--amber), var(--orange));
    color: #000;
    font-weight: 700;
}
.btn-gold:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(251, 191, 36, 0.3);
}

.btn-block { width: 100%; }
.btn-sm { padding: 7px 14px; font-size: 0.78rem; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; }

.auth-switch {
    text-align: center;
    margin-top: 20px;
    color: var(--text-3);
    font-size: 0.85rem;
}
.auth-switch a {
    color: var(--accent-hover);
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
}
.auth-switch a:hover { text-decoration: underline; }

/* ===================== LOBBY ===================== */
.lobby-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 14px;
}

.lobby-header h1 {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-0);
}

.lobby-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.join-form { display: flex; gap: 6px; align-items: center; }
.join-form .form-input { width: 160px; padding: 10px 14px; }

.battles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}

.battle-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: var(--transition);
    cursor: pointer;
}

.battle-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.battle-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.battle-card .room-code {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--cyan);
}

.status-badge {
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-waiting { background: var(--amber-muted); color: var(--amber); }
.status-active { background: var(--green-muted); color: var(--green); }
.status-finished { background: rgba(113, 113, 122, 0.15); color: var(--text-3); }

.battle-card .player-name { color: var(--text-0); font-weight: 600; font-size: 0.9rem; }
.battle-card .waiting-text { color: var(--text-4); font-style: italic; font-size: 0.8rem; margin-top: 4px; }

.empty-state { text-align: center; padding: 64px 20px; color: var(--text-4); }
.empty-state .icon { font-size: 3rem; margin-bottom: 12px; opacity: 0.4; }
.empty-state h3 { color: var(--text-3); margin-bottom: 6px; font-size: 1rem; }
.empty-state p { font-size: 0.85rem; }

/* ===================== BATTLE ROOM ===================== */
.battle-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 14px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.battle-room-code {
    font-family: var(--font-display);
    color: var(--cyan);
    font-size: 0.95rem;
    font-weight: 600;
}

.battle-beat-info {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--amber);
    font-size: 0.85rem;
    font-weight: 500;
}

.battle-arena {
    display: grid;
    grid-template-columns: 1fr 160px 1fr;
    gap: 16px;
    align-items: start;
    margin-bottom: 24px;
}

.player-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.player-panel.active-turn {
    border-color: var(--accent);
    box-shadow: 0 0 24px var(--accent-glow);
}

.player-panel.active-turn::before {
    content: '🎤 AL MIC';
    position: absolute;
    top: 0; left: 0; right: 0;
    padding: 5px;
    background: var(--accent);
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #fff;
}

.player-panel .player-label {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 12px;
    margin-top: 6px;
    color: var(--text-0);
}

.video-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    background: var(--bg-0);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 8px;
    border: 1px solid var(--border);
}

.video-wrapper video { width: 100%; height: 100%; object-fit: cover; }

.video-wrapper .no-video {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-4);
    font-size: 2.5rem;
}
.video-wrapper .no-video span { font-size: 0.75rem; margin-top: 6px; }

/* Battle center */
.battle-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding-top: 48px;
}

.vs-text {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
}

.timer-ring { position: relative; width: 110px; height: 110px; }
.timer-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.timer-ring .ring-bg { fill: none; stroke: var(--bg-3); stroke-width: 5; }
.timer-ring .ring-progress {
    fill: none;
    stroke: url(#timerGradient);
    stroke-width: 5;
    stroke-linecap: round;
    stroke-dasharray: 314;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 0.3s linear;
}

.timer-display {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-0);
    font-variant-numeric: tabular-nums;
}
.timer-display.warning { color: var(--red); animation: pulse-opacity 0.6s infinite; }

.round-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

/* Intermission */
.intermission-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(9, 9, 11, 0.92);
    backdrop-filter: blur(12px);
    z-index: 2000;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.intermission-overlay.active { display: flex; }

.intermission-overlay .count {
    font-family: var(--font-display);
    font-size: 7rem;
    font-weight: 700;
    color: var(--accent);
    animation: scaleIn 0.4s ease;
    font-variant-numeric: tabular-nums;
}

.intermission-overlay .label {
    font-size: 1rem;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 3px;
    margin-top: 12px;
    font-weight: 500;
}

/* Beat visualizer */
.beat-visualizer {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 36px;
    justify-content: center;
    margin: 8px 0;
}
.beat-visualizer .bar {
    width: 3px;
    background: var(--accent);
    border-radius: 2px;
    animation: beat-bar 0.8s ease-in-out infinite;
}
.beat-visualizer .bar:nth-child(1) { height: 20%; animation-delay: 0s; }
.beat-visualizer .bar:nth-child(2) { height: 60%; animation-delay: 0.1s; }
.beat-visualizer .bar:nth-child(3) { height: 40%; animation-delay: 0.2s; }
.beat-visualizer .bar:nth-child(4) { height: 80%; animation-delay: 0.3s; }
.beat-visualizer .bar:nth-child(5) { height: 30%; animation-delay: 0.4s; }
.beat-visualizer .bar:nth-child(6) { height: 70%; animation-delay: 0.5s; }
.beat-visualizer .bar:nth-child(7) { height: 50%; animation-delay: 0.6s; }
.beat-visualizer .bar:nth-child(8) { height: 90%; animation-delay: 0.15s; }
.beat-visualizer .bar:nth-child(9) { height: 35%; animation-delay: 0.35s; }
.beat-visualizer .bar:nth-child(10) { height: 65%; animation-delay: 0.55s; }

/* ===================== VOTING ===================== */
.voting-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 36px;
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

.voting-panel h2 {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text-0);
}

.voting-options { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }

.vote-card {
    background: var(--bg-2);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px 44px;
    cursor: pointer;
    transition: var(--transition);
}
.vote-card:hover { border-color: var(--border-hover); transform: translateY(-3px); box-shadow: var(--shadow); }
.vote-card.selected { border-color: var(--amber); background: var(--amber-muted); }
.vote-card .vote-icon { font-size: 2.5rem; margin-bottom: 10px; }
.vote-card .vote-name { font-family: var(--font-display); font-size: 1.1rem; font-weight: 600; color: var(--text-0); }

/* ===================== PROFILE ===================== */
.profile-header {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 36px;
    text-align: center;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}
.profile-header::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 80px;
    background: linear-gradient(135deg, var(--accent), rgba(34, 211, 238, 0.7));
    opacity: 0.12;
}

.profile-avatar {
    width: 80px; height: 80px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin: 0 auto 12px;
    position: relative;
    z-index: 1;
    border: 3px solid var(--bg-card);
}

.profile-header h2 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 4px;
    position: relative;
    z-index: 1;
    color: var(--text-0);
}

.profile-stats {
    display: flex;
    gap: 28px;
    justify-content: center;
    margin-top: 20px;
    position: relative;
    z-index: 1;
}

.stat-item { text-align: center; }
.stat-value {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.stat-value.gold { color: var(--amber); }
.stat-value.green { color: var(--green); }
.stat-value.red { color: var(--red); }
.stat-label {
    font-size: 0.68rem;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 2px;
    font-weight: 500;
}

/* ===================== LEADERBOARD ===================== */
.leaderboard-section { margin-top: 24px; }
.leaderboard-section h3 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 16px;
}

.leaderboard-table {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.lb-row {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}
.lb-row:last-child { border-bottom: none; }
.lb-row:hover { background: var(--bg-2); }
.lb-row.top-1 { background: rgba(251, 191, 36, 0.04); }
.lb-row.top-2 { background: rgba(192, 192, 192, 0.02); }
.lb-row.top-3 { background: rgba(205, 127, 50, 0.02); }

.lb-rank {
    width: 36px;
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-4);
}
.lb-rank.gold { color: var(--amber); }
.lb-rank.silver { color: #c0c0c0; }
.lb-rank.bronze { color: #cd7f32; }

.lb-name { flex: 1; font-weight: 600; font-size: 0.88rem; }
.lb-points {
    font-family: var(--font-display);
    color: var(--amber);
    font-size: 0.88rem;
    font-weight: 600;
}
.lb-wins { width: 70px; text-align: center; color: var(--green); font-weight: 600; font-size: 0.8rem; }

/* ===================== ADMIN ===================== */
.admin-section { max-width: 700px; margin: 0 auto; }
.admin-section h2 {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text-0);
}

.upload-zone {
    background: var(--bg-card);
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 40px;
    text-align: center;
    margin-bottom: 20px;
    transition: var(--transition);
    cursor: pointer;
}
.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--accent);
    background: var(--accent-muted);
}
.upload-zone .upload-icon { font-size: 2.5rem; margin-bottom: 10px; opacity: 0.4; }
.upload-zone p { color: var(--text-3); margin-bottom: 4px; font-size: 0.88rem; }
.upload-zone .formats { font-size: 0.75rem; color: var(--text-4); }

.beats-list { display: flex; flex-direction: column; gap: 8px; }

.beat-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: var(--transition);
}
.beat-item:hover { border-color: var(--border-hover); }
.beat-item .beat-icon { font-size: 1.3rem; }
.beat-item .beat-name { flex: 1; font-weight: 600; font-size: 0.88rem; }
.beat-item .beat-date { color: var(--text-4); font-size: 0.75rem; }

/* ===================== RESULTS ===================== */
.results-screen {
    text-align: center;
    padding: 36px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    max-width: 550px;
    margin: 0 auto;
}
.results-screen h2 {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-0);
}
.results-screen .winner-name {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    color: var(--amber);
    margin: 14px 0;
}
.results-scores { display: flex; justify-content: center; gap: 40px; margin: 20px 0; }
.results-scores .score-col { text-align: center; }
.results-scores .score-val {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent);
}
.results-scores .score-name { font-size: 0.85rem; color: var(--text-3); margin-top: 4px; }

/* ===================== WAITING ===================== */
.waiting-room { text-align: center; padding: 50px 20px; }
.waiting-room h2 { font-family: var(--font-display); margin-bottom: 10px; font-weight: 700; color: var(--text-0); }
.waiting-room .room-code-display {
    font-family: var(--font-display);
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--accent);
    margin: 20px 0;
    letter-spacing: 3px;
}
.waiting-room .copy-btn {
    cursor: pointer;
    background: none;
    border: none;
    color: var(--accent);
    font-size: 1.1rem;
    margin-left: 6px;
    vertical-align: middle;
}

.waiting-dots { display: flex; justify-content: center; gap: 8px; margin: 20px 0; }
.waiting-dots .dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--accent);
    animation: bounce 1.4s ease-in-out infinite;
}
.waiting-dots .dot:nth-child(2) { animation-delay: 0.2s; }
.waiting-dots .dot:nth-child(3) { animation-delay: 0.4s; }

/* ===================== TOAST ===================== */
.toast-container {
    position: fixed;
    top: 72px; right: 20px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.toast {
    padding: 12px 18px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-1);
    font-size: 0.85rem;
    animation: slideIn 0.25s ease;
    max-width: 340px;
    box-shadow: var(--shadow-lg);
}
.toast.success { border-left: 3px solid var(--green); }
.toast.error { border-left: 3px solid var(--red); }
.toast.info { border-left: 3px solid var(--accent); }

/* ===================== MISC ===================== */
.spinner {
    width: 28px; height: 28px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin: 28px auto;
}
.loading-text { text-align: center; color: var(--text-3); margin-top: 8px; font-size: 0.85rem; }

.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 0.85rem; }
.alert-error { background: var(--red-muted); border: 1px solid rgba(244, 63, 94, 0.25); color: var(--red); }
.alert-success { background: var(--green-muted); border: 1px solid rgba(52, 211, 153, 0.25); color: var(--green); }

/* ===================== ANIMATIONS ===================== */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: translateX(0); } }
@keyframes scaleIn { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes pulse-opacity { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes bounce { 0%, 80%, 100% { transform: scale(0); } 40% { transform: scale(1); } }
@keyframes beat-bar { 0%, 100% { transform: scaleY(0.3); } 50% { transform: scaleY(1); } }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 900px) {
    .battle-arena { grid-template-columns: 1fr; gap: 12px; }
    .battle-center { flex-direction: row; padding-top: 0; order: -1; }
    .timer-ring { width: 72px; height: 72px; }
    .timer-display { font-size: 1.2rem; }
    .vs-text { font-size: 1.5rem; }
}

@media (max-width: 600px) {
    .navbar { padding: 0 12px; }
    .navbar-brand { font-size: 1rem; }
    .nav-link { padding: 6px 8px; font-size: 0.75rem; }
    .lobby-header { flex-direction: column; align-items: flex-start; }
    .auth-card { padding: 28px 20px; }
    .profile-stats { gap: 14px; flex-wrap: wrap; }
    .voting-options { flex-direction: column; }
    .results-scores { gap: 20px; }
    .studio-controls { flex-wrap: wrap; }
    .effects-row { flex-direction: column; }
    .fx-btn { width: 100%; }
}

/* ===================== STUDIO ===================== */
.studio-container {
    max-width: 800px;
    margin: 0 auto;
}

.studio-title {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-0);
    margin-bottom: 4px;
}

.studio-subtitle {
    color: var(--text-3);
    font-size: 0.9rem;
    margin-bottom: 28px;
}

.studio-section {
    margin-bottom: 20px;
}

.studio-upload {
    background: var(--bg-card);
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}
.studio-upload:hover {
    border-color: var(--accent);
    background: var(--accent-muted);
}
.studio-upload .upload-icon {
    font-size: 2.5rem;
    margin-bottom: 8px;
    opacity: 0.5;
}
.studio-upload p {
    color: var(--text-2);
    font-size: 0.9rem;
}
.studio-upload .formats {
    color: var(--text-4);
    font-size: 0.75rem;
    margin-top: 4px;
}

/* Waveforms */
.waveform-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 10px;
}
.waveform-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}
.waveform-container canvas {
    width: 100%;
    height: 80px;
    border-radius: var(--radius-sm);
    display: block;
}

/* Transport Controls */
.studio-controls {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.studio-btn {
    padding: 10px 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    background: var(--bg-card);
    color: var(--text-1);
}
.studio-btn:hover:not(:disabled) {
    background: var(--bg-elevated);
    border-color: var(--border-hover);
    transform: translateY(-1px);
}
.studio-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.studio-btn.play {
    background: var(--green-muted);
    border-color: rgba(52, 211, 153, 0.3);
    color: var(--green);
}
.studio-btn.play:hover:not(:disabled) {
    background: rgba(52, 211, 153, 0.18);
    box-shadow: 0 0 16px rgba(52, 211, 153, 0.15);
}

.studio-btn.record {
    background: var(--red-muted);
    border-color: rgba(244, 63, 94, 0.3);
    color: var(--red);
}
.studio-btn.record:hover:not(:disabled) {
    background: rgba(244, 63, 94, 0.18);
}
.studio-btn.record.recording {
    background: var(--red);
    color: #fff;
    animation: pulse-opacity 1s infinite;
    box-shadow: 0 0 20px rgba(244, 63, 94, 0.35);
}

.studio-btn.stop {
    background: var(--amber-muted);
    border-color: rgba(251, 191, 36, 0.3);
    color: var(--amber);
}

.studio-btn.export {
    background: var(--accent-muted);
    border-color: rgba(99, 102, 241, 0.3);
    color: var(--accent-hover);
}
.studio-btn.export:hover:not(:disabled) {
    background: rgba(99, 102, 241, 0.18);
    box-shadow: 0 0 16px var(--accent-glow);
}

/* Volumes */
.studio-volumes {
    display: flex;
    gap: 20px;
    margin-bottom: 24px;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.volume-control {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}
.volume-control label {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-2);
    white-space: nowrap;
    min-width: 55px;
}
.volume-control input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: var(--bg-3);
    border-radius: 4px;
    outline: none;
}
.volume-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: 2px solid var(--bg-card);
    box-shadow: 0 0 6px var(--accent-glow);
}
.volume-control span {
    font-size: 0.75rem;
    color: var(--text-3);
    min-width: 35px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Effects */
.effects-title {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-0);
    margin-bottom: 14px;
}

.effects-row {
    display: flex;
    gap: 12px;
}

.fx-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 18px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font);
}
.fx-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

.fx-btn.active {
    background: var(--accent-muted);
    border-color: var(--accent);
    box-shadow: 0 0 20px var(--accent-glow);
}
.fx-btn.active .fx-status {
    color: var(--green);
}

.fx-icon { font-size: 1.8rem; }
.fx-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-0);
}
.fx-status {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-4);
}
