/* Song Voter - Elite Dark Aesthetic */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
    /* Monochromatic dark palette */
    --bg-primary: #0a0a0a;
    --bg-secondary: #111111;
    --bg-card: #141414;
    --bg-elevated: #1a1a1a;
    --text-primary: #fafafa;
    --text-secondary: #737373;
    --text-muted: #404040;

    /* Minimal accent - warm amber */
    --accent: #e5e5e5;
    --accent-warm: #d4a574;
    --accent-glow: rgba(212, 165, 116, 0.15);
    --success: #eab308;
    --success-muted: #854d0e;
    --danger: #dc2626;
    --danger-muted: #991b1b;
    --positive: #22c55e;
    --positive-muted: #166534;

    /* Design tokens */
    --border: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.12);
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    --transition: all 0.2s ease;

    /* Typography */
    --font-mono: 'JetBrains Mono', 'SF Mono', 'Monaco', 'Consolas', monospace;

    /* Accent color (can be overridden inline) */
    --accent-color: #ffffff;
}

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

/* Prevent sticky focus on tap for all interactive elements */
button:focus,
a:focus,
input:focus,
select:focus,
textarea:focus {
    outline: none;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

body {
    font-family: var(--font-mono);
    /* Static premium background - animated on desktop only for performance */
    background:
        radial-gradient(ellipse at 15% 75%, rgba(25, 35, 30, 0.35) 0%, transparent 55%),
        radial-gradient(ellipse at 85% 25%, rgba(20, 25, 35, 0.3) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(15, 20, 25, 0.25) 0%, transparent 65%),
        linear-gradient(135deg, #06060a 0%, #0a0a0e 50%, #06060a 100%);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 0.875rem;

    /* Apply accent color from inline style */
    --accent: var(--accent-color, #e5e5e5);
}

/* Desktop-only: Enable background animation on capable devices */
@media (min-width: 769px) and (prefers-reduced-motion: no-preference) {
    body {
        background-size: 200% 200%;
        animation: bgDrift 45s ease-in-out infinite;
        will-change: background-position;
        /* GPU hint for smooth animation */
    }

    /* SVG grain overlay - static layer on top (doesn't animate) */
    body::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        pointer-events: none;
        z-index: 0;
        opacity: 0.03;
        background: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
        background-size: 200px 200px;
    }
}

@keyframes bgDrift {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

/* Animation keyframes kept for UI elements that need them */
@keyframes bgPulse {

    0%,
    100% {
        opacity: 0.25;
    }

    50% {
        opacity: 0.4;
    }
}

/* Loading shimmer animation */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.loading {
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

/* Song card transition */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(-20px);
    }
}

/* Vote success pulse animation */
@keyframes votePulse {
    0% {
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12),
            inset 0 1px 0 rgba(255, 255, 255, 0.03),
            0 0 0 0 rgba(34, 197, 94, 0.4);
    }

    50% {
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12),
            inset 0 1px 0 rgba(255, 255, 255, 0.03),
            0 0 0 15px rgba(34, 197, 94, 0);
    }

    100% {
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12),
            inset 0 1px 0 rgba(255, 255, 255, 0.03),
            0 0 0 0 rgba(34, 197, 94, 0);
    }
}

.card.vote-pulse {
    animation: votePulse 0.6s ease-out;
}

/* Song loading shimmer */
.song-loading {
    position: relative;
    overflow: hidden;
}

.song-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.08),
            transparent);
    animation: shimmerSlide 1.5s infinite;
}

@keyframes shimmerSlide {
    0% {
        left: -100%;
    }

    100% {
        left: 100%;
    }
}

/* Skeleton text placeholder */
.skeleton-text {
    background: linear-gradient(90deg,
            var(--bg-elevated) 0%,
            rgba(255, 255, 255, 0.05) 50%,
            var(--bg-elevated) 100%);
    background-size: 200% 100%;
    animation: skeleton 1.5s ease-in-out infinite;
    border-radius: 4px;
    color: transparent !important;
}

@keyframes skeleton {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.song-name {
    animation: slideIn 0.3s ease-out;
}

.container {
    max-width: 480px;
    margin: 0 auto;
    padding: 48px 24px;
    min-height: 100vh;
}

/* Header */
h1 {
    text-align: center;
    margin-bottom: 40px;
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

/* Cards - Refined Dark Glass */
.card {
    position: relative;
    background: linear-gradient(135deg,
            rgba(14, 14, 18, 0.5) 0%,
            rgba(10, 10, 14, 0.55) 50%,
            rgba(14, 14, 18, 0.5) 100%);
    /* Reduced blur for better performance (12px vs 32px) */
    backdrop-filter: blur(12px) saturate(1.1);
    -webkit-backdrop-filter: blur(12px) saturate(1.1);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 16px;
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.03);
    overflow: hidden;
}

/* Disable blur for reduced motion OR mobile devices (GPU-intensive) */
@media (prefers-reduced-motion: reduce),
(max-width: 768px) {
    .card {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: rgba(14, 14, 18, 0.85);
    }
}


/* Subtle top highlight */
.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 15%;
    right: 15%;
    height: 1px;
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(255, 255, 255, 0.08) 50%,
            transparent 100%);
    pointer-events: none;
}


/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    background: var(--bg-secondary);
    color: var(--text-primary);
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    user-select: none;
}

.btn:hover {
    background: var(--bg-elevated);
    border-color: var(--border-hover);
}

/* Remove sticky hover on touch devices */
@media (hover: none) {
    .btn:hover {
        background: var(--bg-secondary);
        border-color: var(--border);
    }
}

/* Only show focus ring on keyboard navigation, not tap */
.btn:focus {
    outline: none;
}

.btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.btn:active {
    transform: scale(0.95);
}

.btn.primary {
    background: var(--accent);
    color: var(--bg-primary);
    /* Contrast? If accent is dark, this is bad. But typically accent is bright on dark theme. */
    border-color: var(--accent);
}

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

.btn-secondary {
    background: transparent;
    border-color: var(--border);
}

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

.btn-icon {
    width: 48px;
    height: 48px;
    padding: 0;
    font-size: 1.25rem;
    border-radius: 50%;
    line-height: 1;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-success {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

.btn-success:hover {
    background: #16a34a;
    border-color: #16a34a;
}

.btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Form Elements */
select,
input[type="text"],
input[type="number"] {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: var(--font-mono);
    transition: var(--transition);
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

/* Number input - restore spinner and style it */
input[type="number"] {
    -webkit-appearance: textfield;
    -moz-appearance: textfield;
    appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: inner-spin-button;
    opacity: 1;
    height: 28px;
    margin-right: 2px;
    cursor: pointer;
}

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23737373' stroke-width='2'%3E%3Cpolyline points='6,9 12,15 18,9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 44px;
    cursor: pointer;
}

/* Android-specific select fix */
select::-ms-expand {
    display: none;
}

select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 12px;
}

select:focus,
input:focus {
    outline: none;
    border-color: var(--text-secondary);
}

label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Setup Section */
.setup-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Player Section */
.player-section {
    display: none;
}

.player-section.visible {
    display: block;
}

.song-name {
    text-align: center;
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 32px;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

/* Audio Controls */
.audio-controls {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.progress-container {
    width: 100%;
    cursor: pointer;
    position: relative;
    margin-bottom: 12px;
}

.waveform-canvas {
    width: 100%;
    height: 48px;
    display: block;
    border-radius: 4px;
    /* Background removed for sleek look */
}

.time-display {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: var(--text-primary);
    margin-top: 8px;
    font-variant-numeric: tabular-nums;
    font-family: var(--font-mono);
}

.playback-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
}

#playBtn {
    font-size: 1.5rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    margin-top: 0;
}

/* Cast Button */
.cast-btn {
    font-size: 1rem;
    display: none;
    /* Hidden by default, shown when devices available */
}

.cast-btn.connecting {
    animation: pulse 1s ease-in-out infinite;
}

.cast-btn.casting {
    background: var(--success);
    border-color: var(--success);
    color: var(--bg-primary);
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Cast Controls (HEOS + AirPlay) */
.cast-controls {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cast-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.cast-select {
    flex: 1;
    font-size: 0.75rem;
    padding: 8px 10px;
}

.cast-play-btn {
    padding: 8px 14px;
    font-size: 1rem;
}

.cast-play-btn.playing {
    background: var(--success);
    border-color: var(--success);
    color: var(--bg-primary);
}


.volume-control {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.volume-slider {
    width: 64px;
    height: 3px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--text-secondary);
    border-radius: 2px;
    outline: none;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 10px;
    height: 10px;
    background: var(--text-muted);
    /* Volume is usually less important, maybe text-muted or accent? Let's use text-primary or accent. */
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
}

.volume-slider::-moz-range-thumb {
    width: 10px;
    height: 10px;
    background: var(--text-primary);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* Voting Section */
.voting-section {
    margin-top: 4px;
}

.thumbs-container {
    display: flex;
    justify-content: center;
    gap: 48px;
    margin-bottom: 24px;
}

.thumb-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.thumb-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
    font-size: 3rem;
    line-height: 1;
    padding: 8px 16px;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    user-select: none;
}

.thumb-btn:hover {
    color: var(--text-primary);
    transform: scale(1.1);
}

/* Remove sticky hover on touch devices */
@media (hover: none) {
    .thumb-btn:hover:not(.selected) {
        color: var(--text-secondary);
        transform: none;
    }
}

.thumb-btn.up.selected {
    color: var(--positive);
    animation: thumbBounce 0.4s ease;
}

.thumb-btn.down.selected {
    color: var(--danger);
    animation: thumbBounce 0.4s ease;
}

@keyframes thumbBounce {
    0% {
        transform: scale(1);
    }

    30% {
        transform: scale(1.3);
    }

    50% {
        transform: scale(0.9);
    }

    70% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

.thumb-btn:disabled {
    opacity: 0.25;
    cursor: not-allowed;
}

.thumb-btn:disabled:hover {
    transform: none;
}

.thumb-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Rating */
.rating-container {
    margin-bottom: 24px;
}

.rating-display {
    text-align: center;
    margin-bottom: 12px;
}

.rating-value {
    font-size: 2.5rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    /* Default color, will be overridden by JS */
    color: var(--text-primary);
}

.rating-slider {
    width: 100%;
    height: 3px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--text-secondary);
    border-radius: 2px;
    outline: none;
}

.rating-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
}

.rating-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

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

.rating-slider:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.rating-slider:disabled::-webkit-slider-thumb {
    cursor: not-allowed;
}

.rating-slider:disabled::-moz-range-thumb {
    cursor: not-allowed;
}

.rating-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 8px;
    padding: 0 2px;
    font-variant-numeric: tabular-nums;
}

.action-buttons {
    display: flex;
    gap: 12px;
}

.action-buttons .btn {
    flex: 1;
}

/* Feedback Message */
.feedback {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 14px 24px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 100;
    border: 1px solid var(--border);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.feedback.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Navigation */
.nav-footer {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 24px;
}

.nav-link {
    display: inline-block;
    text-align: center;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition);
    padding: 8px;
}

.nav-link:hover {
    color: var(--text-primary);
}

/* Thumb Groups */
.thumb-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.thumb-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Rating Header */
.rating-header {
    text-align: center;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 8px;
}

/* Rank Badges */
.rank-badge {
    display: inline-block;
    margin-right: 8px;
    font-size: 1.1rem;
    vertical-align: middle;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state-title {
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-state-message {
    font-size: 0.9rem;
    max-width: 280px;
    margin: 0 auto;
    line-height: 1.5;
}

/* Error State */
.error-state {
    text-align: center;
    padding: 32px 24px;
    background: rgba(220, 38, 38, 0.1);
    border: 1px solid rgba(220, 38, 38, 0.2);
    border-radius: var(--radius-lg);
    color: #fca5a5;
}

.error-state-icon {
    font-size: 2rem;
    margin-bottom: 12px;
}

.error-state-title {
    font-size: 1rem;
    font-weight: 500;
    color: #fca5a5;
    margin-bottom: 4px;
}

.error-state-message {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Rank badge colors */
.rank-badge.rank-1 {
    color: #ffd700;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
}

.rank-badge.rank-2 {
    color: #c0c0c0;
    text-shadow: 0 0 6px rgba(192, 192, 192, 0.4);
}

.rank-badge.rank-3 {
    color: #cd7f32;
    text-shadow: 0 0 6px rgba(205, 127, 50, 0.4);
}

/* Wide container for results/admin pages */
.container-wide {
    max-width: 900px;
}

/* Agreement score colors */
.agree-high {
    color: #4ade80;
}

.agree-mid {
    color: #fbbf24;
}

.agree-low {
    color: #f87171;
}

/* Controversial indicator - references @keyframes pulse defined above */
.controversial {
    margin-left: 4px;
    color: #f59e0b;
    animation: pulse 2s ease-in-out infinite;
}

/* Results Legend */
.results-legend {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(70px, auto));
    gap: 8px 20px;
    justify-content: center;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
    padding: 10px 16px;
    margin-top: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
}

.results-legend span {
    white-space: nowrap;
}

.legend-sep {
    opacity: 0.3;
    display: none;
    /* Hide separator, using grid layout instead */
}

/* Hide legend on mobile - too cluttered */
@media (max-width: 600px) {
    .results-legend {
        display: none;
    }
}

/* Best version indicator - subtle warm tone */
.best-version {
    color: #e5c07b;
    margin-right: 4px;
}

/* Controversial - no animation for performance */
.controversial {
    animation: none;
}

/* Help Page */
.help-content {
    line-height: 2;
    padding: 8px;
}

.help-content h2 {
    font-size: 1.1rem;
    font-weight: 500;
    margin-top: 32px;
    margin-bottom: 16px;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.help-content h2:first-child {
    margin-top: 0;
}

.help-content p {
    color: var(--text-secondary);
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.help-content ul {
    color: var(--text-secondary);
    padding-left: 0;
    margin-bottom: 20px;
    list-style: none;
}

.help-content li {
    margin-bottom: 12px;
    padding-left: 20px;
    position: relative;
    font-size: 0.9rem;
}

.help-content li::before {
    content: '—';
    position: absolute;
    left: 0;
    color: var(--text-muted);
}

.help-content a {
    color: var(--accent-warm);
    text-decoration: none;
    border-bottom: 1px solid var(--accent-warm);
    transition: var(--transition);
}

.help-content a:hover {
    color: var(--text-primary);
    border-color: var(--text-primary);
}

.help-content strong {
    color: var(--text-primary);
    font-weight: 500;
}

/* Results Page */
.results-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
}

.results-table th,
.results-table td {
    padding: 12px 8px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.results-table th {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    user-select: none;
    transition: var(--transition);
}

.results-table th:hover {
    color: var(--text-secondary);
}

.results-table th.sorted {
    color: var(--text-primary);
}

.results-table th.sorted::after {
    content: ' ↓';
    font-size: 0.6rem;
}

.results-table th.sorted.asc::after {
    content: ' ↑';
}

.results-table tbody tr {
    transition: var(--transition);
}

.results-table tbody tr:hover {
    background: var(--bg-secondary);
}

.results-table td {
    font-size: 0.875rem;
    font-variant-numeric: tabular-nums;
}

.no-votes {
    color: var(--text-muted);
}

/* Loading State */
.loading {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 1.5px solid var(--text-secondary);
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.6s linear infinite;
    margin-left: 8px;
    vertical-align: middle;
}

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

/* Responsive - Compressed for mobile */
@media (max-width: 480px) {
    .container {
        padding: 16px 12px;
    }

    h1 {
        font-size: 1.1rem;
        margin-bottom: 16px;
    }

    .card {
        padding: 16px;
        margin-bottom: 12px;
    }

    .song-name {
        font-size: 1rem;
        margin-bottom: 16px;
    }

    .visualizer {
        height: 60px;
        margin-bottom: 12px;
    }

    .thumb-btn {
        font-size: 2.5rem;
        padding: 6px 12px;
    }

    .thumbs-container {
        gap: 32px;
        margin-bottom: 16px;
    }

    .rating-container {
        margin-bottom: 16px;
    }

    .volume-control {
        display: none;
    }

    .results-table {
        font-size: 0.8rem;
    }

    .results-table th,
    .results-table td {
        padding: 10px 6px;
    }
}

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

::-webkit-scrollbar-track {
    background: transparent;
}

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

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

/* Selection */
::selection {
    background: rgba(255, 255, 255, 0.15);
}

/* Visualizer - extends to card edges */
.visualizer {
    width: calc(100% + 48px);
    margin-left: -24px;
    margin-right: -24px;
    height: 80px;
    margin-bottom: 16px;
    background: transparent;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 360px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    font-weight: 500;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 16px 20px;
}

.cast-option {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 12px;
}

.cast-option:hover {
    background: var(--bg-elevated);
    border-color: var(--border-hover);
}

.cast-icon {
    font-size: 1.25rem;
}

.cast-option-group {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.cast-option-group:last-of-type {
    border-bottom: none;
}

.cast-option-header {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.cast-modal-select,
.cast-modal-input {
    width: 100%;
    margin-bottom: 8px;
    font-size: 0.875rem;
}

.cast-modal-select-small {
    width: auto;
    flex: 1;
    margin-right: 8px;
    font-size: 0.875rem;
    padding: 8px 12px;
}

.cast-option-group .btn {
    width: 100%;
}

.cast-option-group>div:last-child {
    display: flex;
    gap: 8px;
}

.cast-note {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 8px;
}

.btn.playing {
    background: var(--success);
    border-color: var(--success);
    color: var(--bg-primary);
}

/* ============ Admin Panel ============ */

.admin-container {
    max-width: 600px;
}

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

.admin-header h1 {
    margin: 0;
}

.admin-section {
    margin-bottom: 24px;
}

.admin-section h2 {
    font-size: 1rem;
    margin-bottom: 20px;
    color: var(--text-primary);
}

/* Forms */
.admin-form .form-group {
    margin-bottom: 16px;
}

.admin-form label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.admin-form input[type="text"],
.admin-form input[type="password"] {
    width: 100%;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 0.875rem;
}

.alert-error {
    background: var(--danger-muted);
    color: var(--danger);
    border: 1px solid var(--danger);
}

.alert-success {
    background: var(--positive-muted);
    color: var(--positive);
    border: 1px solid var(--positive);
}

/* Settings */
.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.setting-row:last-of-type {
    border-bottom: none;
    margin-bottom: 16px;
}

.setting-info {
    flex: 1;
}

.setting-label {
    display: block;
    font-weight: 500;
    color: var(--text-primary);
}

.setting-desc {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.setting-select,
.setting-input {
    width: 120px;
    font-size: 0.8rem;
    padding: 8px;
}

/* Color Picker */
.color-picker {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 48px;
    height: 32px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    background: transparent;
    padding: 2px;
}

.color-picker::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-picker::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

.color-picker::-moz-color-swatch {
    border: none;
    border-radius: 4px;
}

.color-picker:hover {
    border-color: var(--border-hover);
}

/* Toggle Switch */
.toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-secondary);
    border-radius: 24px;
    transition: var(--transition);
    border: 1px solid var(--border);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background: var(--text-secondary);
    border-radius: 50%;
    transition: var(--transition);
}

.toggle input:checked+.toggle-slider {
    background: var(--positive);
    border-color: var(--positive);
}

.toggle input:checked+.toggle-slider:before {
    transform: translateX(20px);
    background: white;
}

/* Songs List */
.songs-actions {
    margin-bottom: 16px;
}

.songs-list {
    max-height: 300px;
    overflow-y: auto;
}

.song-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.song-item:last-child {
    border-bottom: none;
}

.song-info {
    flex: 1;
    min-width: 0;
}

.song-name {
    display: block;
    font-size: 0.85rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.song-base {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.song-actions {
    display: flex;
    gap: 8px;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    transition: var(--transition);
    text-decoration: none;
}

.btn-icon:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.btn-icon.btn-danger:hover {
    background: var(--danger-muted);
    color: var(--danger);
    border-color: var(--danger);
}

/* Admin Users */
.admins-list {
    margin-bottom: 16px;
}

.admin-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.admin-item:last-child {
    border-bottom: none;
}

.admin-name {
    color: var(--text-primary);
}

.add-admin-form {
    display: flex;
    gap: 8px;
}

.add-admin-form input {
    flex: 1;
    font-size: 0.8rem;
}

/* Results clickable rows */
.results-table .song-link {
    color: var(--text-primary);
    text-decoration: none;
    transition: var(--transition);
}

.results-table .song-link:hover {
    color: var(--accent-warm);
}

/* Play Page */
.play-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: -16px;
    margin-bottom: 24px;
}

/* Upload Area */
.upload-area {
    margin: 16px 0;
    padding: 16px;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    text-align: center;
}

.upload-status {
    margin-top: 12px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Better Admin Forms */
.admin-form input[type="text"],
.admin-form input[type="email"],
.admin-form input[type="password"],
.add-admin-form input,
.add-admin-form select {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: var(--transition);
}

.admin-form input:focus,
.add-admin-form input:focus,
.add-admin-form select:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 3px rgba(138, 180, 248, 0.1);
}

.add-admin-form select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23737373' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
    padding-right: 32px;
    cursor: pointer;
}

/* Site Password - inline layout */
.setting-row .setting-input {
    width: 140px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 12px;
    color: var(--text-primary);
    font-size: 0.8rem;
}

/* Songs list - cleaner */
.songs-list {
    max-height: 400px;
    overflow-y: auto;
    margin-top: 16px;
}

/* Checkbox for bulk delete */
.song-checkbox {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    margin-right: 12px;
    cursor: pointer;
}

/* Better delete button */
.btn-icon.btn-danger {
    background: transparent;
    border-color: transparent;
    color: var(--text-muted);
}

.btn-icon.btn-danger:hover {
    background: var(--danger-muted);
    color: var(--danger);
    border-color: var(--danger);
}

/* Bulk delete bar */
.bulk-delete-bar {
    display: none;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    margin-bottom: 16px;
    justify-content: space-between;
    align-items: center;
}

.bulk-delete-bar.visible {
    display: flex;
}

.bulk-delete-bar span {
    font-size: 0.85rem;
    color: var(--text-secondary);
}