:root {
    --vr-wood-deep: #22120b;
    --vr-wood-main: #3d2217;
    --vr-wood-light: #5a3321;
    --vr-gold: #c5a059;
    --vr-gold-bright: #e5c079;
    --vr-amber: #ffaa00;
    --vr-display-bg: #050505;
}

.vmvr-radio-wrapper {
    padding: 30px 10px;
    display: flex;
    justify-content: center;
    width: 100%;
}

/* Chasis Principal - Contenedor Absoluto */
.vmvr-old-radio.premium-tabletop {
    width: 100%;
    max-width: 900px;
    background: var(--vr-wood-main);
    background-image:
        repeating-linear-gradient(90deg, transparent, transparent 40px, rgba(0, 0, 0, 0.1) 40px, rgba(0, 0, 0, 0.1) 80px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.05), transparent 50%, rgba(0, 0, 0, 0.2));
    border-radius: 20px;
    padding: 15px;
    position: relative;
    box-shadow:
        0 40px 80px rgba(0, 0, 0, 0.95),
        inset 0 2px 5px rgba(255, 255, 255, 0.15),
        inset 0 -5px 15px rgba(0, 0, 0, 0.5);
    border: 8px solid var(--vr-wood-deep);
    box-sizing: border-box;
}

/* Wood Grain Overlay */
.vmvr-old-radio.premium-tabletop::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('https://www.transparenttextures.com/patterns/dark-wood.png');
    opacity: 0.3;
    pointer-events: none;
    z-index: 1;
}

/* Wear & Tear */
.vmvr-old-radio.premium-tabletop::after {
    content: "";
    position: absolute;
    top: 5px;
    left: 5px;
    right: 5px;
    bottom: 5px;
    border-radius: 15px;
    box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.6);
    background:
        /* Scratches */
        repeating-linear-gradient(135deg, transparent, transparent 100px, rgba(255, 255, 255, 0.02) 100.5px, transparent 101px),
        repeating-linear-gradient(45deg, transparent, transparent 150px, rgba(255, 255, 255, 0.02) 150.5px, transparent 151px),
        /* Worn corners */
        radial-gradient(circle at 5% 5%, rgba(255, 255, 255, 0.08) 0%, transparent 20%),
        radial-gradient(circle at 95% 5%, rgba(255, 255, 255, 0.08) 0%, transparent 20%),
        radial-gradient(circle at 5% 95%, rgba(255, 255, 255, 0.08) 0%, transparent 20%),
        radial-gradient(circle at 95% 95%, rgba(255, 255, 255, 0.08) 0%, transparent 20%),
        /* Grime */
        linear-gradient(to bottom, rgba(0, 0, 0, 0.4), transparent 10%, transparent 90%, rgba(0, 0, 0, 0.4));
    pointer-events: none;
    z-index: 2;
    filter: contrast(120%) sepia(30%);
}

/* Extra Dust & Grime Layer */
.vmvr-old-radio.premium-tabletop::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 20;
    background:
        radial-gradient(circle at 50% 50%, transparent 60%, rgba(30, 20, 10, 0.4) 100%),
        repeating-radial-gradient(circle at 20% 80%, rgba(255, 255, 255, 0.03) 0, transparent 1px, transparent 3px),
        url('data:image/svg+xml;utf8,%3Csvg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"%3E%3Cfilter id="noiseFilter"%3E%3CfeTurbulence type="fractalNoise" baseFrequency="0.65" numOctaves="3" stitchTiles="stitch"/%3E%3C/filter%3E%3Crect width="100%25" height="100%25" filter="url(%23noiseFilter)" opacity="0.15"/%3E%3C/svg%3E');
    mix-blend-mode: overlay;
    border-radius: 20px;
}


/* Aged Patina on Bezel */
.vmvr-chassis::before {
    content: "";
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border-radius: 14px;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8);
    pointer-events: none;
    z-index: 4;
}

.vmvr-chassis {
    background: linear-gradient(135deg, var(--vr-wood-light), var(--vr-wood-main) 60%);
    border-radius: 12px;
    padding: 12px;
    position: relative;
    box-sizing: border-box;
    z-index: 3;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.vmvr-chassis-bezel {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.vmvr-screw {
    position: absolute;
    width: 8px;
    height: 8px;
    background: radial-gradient(circle at 30% 30%, #888, #222);
    border-radius: 50%;
    box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.vmvr-screw::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 6px;
    height: 1px;
    background: #111;
    transform: translate(-50%, -50%) rotate(45deg);
}

.vmvr-screw.top-left {
    top: 8px;
    left: 8px;
}

.vmvr-screw.top-right {
    top: 8px;
    right: 8px;
}

.vmvr-screw.bottom-left {
    bottom: 8px;
    left: 8px;
}

.vmvr-screw.bottom-right {
    bottom: 8px;
    right: 8px;
}

/* Marco Interior: Estabilizado con GRID */
.vmvr-inner-frame {
    background: #000;
    border-radius: 8px;
    padding: 15px;
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 20px;
    border: 4px solid #1a1a1a;
    box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.9);
    box-sizing: border-box;
    overflow: hidden;
    /* Seguridad extra */
}

/* Panel Izquierdo: Portada */
.vmvr-art-section {
    width: 160px;
}

.vmvr-album-frame {
    width: 160px;
    height: 160px;
    background: #111;
    border: 2px solid #222;
    padding: 4px;
    border-radius: 4px;
    box-sizing: border-box;
}

.vmvr-album-art {
    width: 100%;
    height: 100%;
    background: #020202;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.vmvr-album-art img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.vmvr-art-placeholder i {
    font-size: 40px;
    color: #1a1a1a;
}

/* Panel Derecho: Main Logic */
.vmvr-main-section {
    min-width: 0;
    /* PERMITE QUE LOS HIJOS SE ENCOJAN */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Dial Glass - FIX OVERFLOW */
.vmvr-tuning-scale {
    height: 70px;
    background: radial-gradient(circle at center, #111, #000);
    border: 2px solid #2a2a2a;
    position: relative;
    overflow: hidden;
    /* CRITICAL FIX */
    border-radius: 4px;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 1);
}

/* Glass Dust & Scratches */
.vmvr-tuning-scale::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        radial-gradient(circle at 80% 70%, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    opacity: 0.5;
    pointer-events: none;
    z-index: 5;
}

.vmvr-stations-list {
    display: flex;
    gap: 40px;
    padding: 25px 0;
    transition: transform 0.6s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.vmvr-station {
    color: var(--vr-amber);
    font-family: 'Courier New', monospace;
    font-size: 14px;
    font-weight: bold;
    opacity: 0.2;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.3s;
}

.vmvr-station.active {
    opacity: 1;
    text-shadow: 0 0 10px var(--vr-amber);
    transform: scale(1.05);
}

.vmvr-needle-wrap {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #f00;
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.8), 0 0 20px rgba(255, 0, 0, 0.4);
    z-index: 10;
}

/* Dirty Glass Effect */
.vmvr-tuning-scale::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 10% 10%, rgba(255, 255, 255, 0.05), transparent 30%);
    pointer-events: none;
    z-index: 11;
}

/* Controles */
.vmvr-console-row {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-top: 10px;
}

.vmvr-digital-display {
    flex: 1;
    min-width: 0;
    /* Importante para flex shrink */
    height: 50px;
    background: #020205;
    border: 1px solid #1a1a1a;
    padding: 0 12px;
    display: flex;
    align-items: center;
    border-radius: 3px;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 1);
}

.vmvr-now-playing {
    color: var(--vr-amber);
    font-size: 11px;
    font-family: 'Courier New', monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    /* Evita que el texto rompa el layout */
    text-transform: uppercase;
}

.vmvr-knob-cluster {
    display: flex;
    gap: 15px;
    /* width: 100%; REMOVED to fix desktop */
    justify-content: flex-end;
    /* Default alignment */
}

.vmvr-knob-unit {
    text-align: center;
}

.vmvr-knob-label {
    display: block;
    font-size: 8px;
    color: #444;
    font-weight: bold;
    margin-top: 4px;
}

.vmvr-knob.metal {
    width: 44px;
    height: 44px;
    background: radial-gradient(circle at 35% 35%, #555, #111 80%);
    border-radius: 50%;
    border: 2px solid #000;
    cursor: pointer;
    position: relative;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.7);
}

.vmvr-knob-indicator {
    position: absolute;
    top: 4px;
    left: 50%;
    width: 2px;
    height: 10px;
    background: var(--vr-amber);
    transform: translateX(-50%);
}

.vmvr-push-button {
    width: 50px;
    height: 50px;
    flex-shrink: 0;
    /* Prevent deformation globally */
    border-radius: 50%;
    border: 3px solid #000;
    background: radial-gradient(circle, var(--vr-gold-bright) 0%, var(--vr-gold) 100%);
    cursor: pointer;
    position: relative;
    color: #111;
    font-size: 18px;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.8);
    transition: all 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vmvr-square-button {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 2px solid #1a1a1a;
    background: radial-gradient(circle at 30% 30%, #444, #111);
    cursor: pointer;
    position: relative;
    color: var(--vr-amber);
    font-size: 11px;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.9);
    transition: all 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin-bottom: 8px;
    /* Consistent margin */
}

.vmvr-square-button:hover {
    background: radial-gradient(circle at center, #555, #222);
}

.vmvr-square-button:active {
    transform: translateY(1px);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.vmvr-square-button span {
    line-height: 1;
    text-align: center;
    transform: scale(0.9);
}

.playing .vmvr-push-button {
    background: radial-gradient(circle, #ffcc00 0%, #d4af37 100%);
    box-shadow: 0 0 15px rgba(255, 170, 0, 0.4), inset 0 0 5px white;
}

/* Speaker & Sound Particles */
.vmvr-speaker-area {
    margin-top: 15px;
    height: 60px;
    background: #0a0a0a;
    border-radius: 6px;
    position: relative;
    overflow: hidden;
    border: 2px solid #111;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.9);
}

.vmvr-grill-texture {
    width: 100%;
    height: 100%;
    background-image: radial-gradient(#222 1px, transparent 1px);
    background-size: 4px 4px;
    border-radius: 6px;
    opacity: 0.6;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 10;
}

.vmvr-speaker-visualizer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    height: 100%;
    justify-content: center;
    pointer-events: none;
    z-index: 5;
    background: radial-gradient(circle at center, rgba(255, 170, 0, 0.05), transparent 70%);
}

.playing .vmvr-speaker-visualizer {
    background: radial-gradient(circle at center, rgba(255, 170, 0, 0.15), transparent 70%);
}

.vmvr-speaker-visualizer span {
    width: 8px;
    height: 8px;
    background: var(--vr-amber);
    border-radius: 4px;
    opacity: 0.1;
    transition: all 0.4s;
    box-shadow: 0 0 15px var(--vr-amber), 0 0 30px rgba(255, 170, 0, 0.3);
}

.playing .vmvr-speaker-visualizer span {
    opacity: 0.9;
    animation: speakerPulse 1.2s ease-in-out infinite;
}

/* Give each bar a different animation delay for a dynamic effect */
.playing .vmvr-speaker-visualizer span:nth-child(2n) {
    animation-delay: 0.1s;
    animation-duration: 0.8s;
}

.playing .vmvr-speaker-visualizer span:nth-child(3n) {
    animation-delay: 0.2s;
    animation-duration: 1.1s;
}

.playing .vmvr-speaker-visualizer span:nth-child(4n) {
    animation-delay: 0.3s;
    animation-duration: 0.9s;
}

.playing .vmvr-speaker-visualizer span:nth-child(5n) {
    animation-delay: 0.4s;
    animation-duration: 1.3s;
}

@keyframes speakerPulse {

    0%,
    100% {
        height: 10px;
        opacity: 0.4;
        filter: blur(1px);
    }

    50% {
        height: 35px;
        opacity: 1;
        filter: blur(0px);
    }
}

.vmvr-sound-emitter {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    height: 1px;
    z-index: 500;
    /* Above chassis tools */
}

.vmvr-note {
    position: absolute;
    color: var(--vr-amber);
    font-size: 24px;
    font-weight: bold;
    pointer-events: none;
    animation: floatNote 3s ease-out forwards;
    opacity: 0;
    z-index: 3000;
    text-shadow: 0 0 10px rgba(255, 170, 0, 0.6);
}

@keyframes floatNote {
    0% {
        transform: translate(0, 0) scale(0.5);
        opacity: 0;
    }

    20% {
        opacity: 1;
    }

    80% {
        opacity: 0.8;
    }

    100% {
        transform: translate(calc(var(--rand-x) * 1px), -250px) scale(1.5) rotate(calc(var(--rand-r) * 1deg));
        opacity: 0;
    }
}

/* Responsive */
@media (max-width: 800px) {
    .vmvr-inner-frame {
        grid-template-columns: 1fr;
        height: auto;
    }

    .vmvr-art-section {
        margin: 0 auto;
    }

    .vmvr-old-radio.premium-tabletop {
        height: auto;
    }

    /* Mobile specific adjustments */

    /* Stack Display and Controls vertically */
    .vmvr-console-row {
        flex-direction: column;
        align-items: stretch;
        /* Full width */
        gap: 15px;
    }

    .vmvr-digital-display {
        width: 100%;
        margin-bottom: 5px;
    }

    .vmvr-knob-cluster {
        width: 100%;
        justify-content: space-between;
        /* Fix empty space on mobile */
    }

    /* Make Genres Button Prominent on Mobile - ROUND & LARGE (Already global) */
    .vmvr-square-button {
        /* Styles inherited from global */
        transform: none;
    }

    .vmvr-square-button span {
        transform: scale(1);
    }

    /* Shrink Play Button on Mobile to de-emphasize & FIX deformation */
    .vmvr-push-button {
        width: 45px;
        height: 45px;
        font-size: 14px;
        flex-shrink: 0;
        /* Prevent deformation */
    }

    /* Adjust Labels */
    .vmvr-knob-label {
        font-size: 7px;
    }
}

/* Genres Overlay */
.vmvr-genres-overlay {
    position: absolute;
    top: 5px;
    left: 5px;
    right: 5px;
    bottom: 5px;
    background: rgba(10, 5, 5, 0.98);
    border-radius: 12px;
    z-index: 2000;
    display: none;
    padding: 25px;
    backdrop-filter: blur(10px);
    border: 2px solid var(--vr-wood-deep);
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
    box-sizing: border-box;
}

.vmvr-genres-overlay.active {
    display: flex;
    flex-direction: column;
}

.vmvr-genres-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.vmvr-genres-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #222;
    padding-bottom: 10px;
}

.vmvr-genres-header h3 {
    margin: 0;
    color: var(--vr-gold);
    font-family: 'Courier New', monospace;
    font-size: 18px;
    letter-spacing: 2px;
}

.vmvr-close-genres {
    background: none;
    border: none;
    color: #888;
    font-size: 30px;
    cursor: pointer;
    line-height: 1;
}

.vmvr-close-genres:hover {
    color: #fff;
}

.vmvr-genres-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    overflow-y: auto;
    padding-right: 5px;
}

.vmvr-genres-grid::-webkit-scrollbar {
    width: 6px;
}

.vmvr-genres-grid::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 3px;
}

.vmvr-genre-item {
    background: #111;
    border: 1px solid #222;
    padding: 10px;
    text-align: center;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

.vmvr-genre-item:hover {
    background: #1a1a1a;
    border-color: var(--vr-amber);
    transform: scale(1.02);
}

.vmvr-genre-item .vmvr-genre-name {
    color: #aaa;
    font-size: 12px;
    font-family: 'Courier New', monospace;
    text-transform: uppercase;
}

.vmvr-genre-item:hover .vmvr-genre-name {
    color: var(--vr-amber);
}