.menu-board,
.player-panel,
.jukebox {
    position: absolute;
    border: 6px solid #000;
    box-shadow: var(--pixel-shadow);
    z-index: 4;
    transition: transform 0.25s ease, box-shadow 0.25s ease, background-color 0.25s ease, opacity 0.25s ease, filter 0.25s ease;
}

.menu-board,
.player-panel {
    background:
        linear-gradient(180deg, rgba(30, 35, 24, 0.995), rgba(18, 22, 14, 0.995)),
        repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.02) 0 2px, transparent 2px 10px);
    background-repeat: no-repeat;
    background-size: 100% 100%;
}

.menu-board {
    top: 110px;
    right: 8%;
    width: min(38vw, 460px);
    min-height: 330px;
    max-height: min(68vh, 620px);
    padding: 28px 24px 20px 30px;
    transform: translateY(0);
    background-image: url("../assets/images/ui/menu_board_base.png");
    opacity: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.menu-board > * {
    position: relative;
    z-index: 1;
}

.menu-board::before,
.player-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.menu-board::before {
    background: url("../assets/images/ui/menu_board_frame.png") center / 100% 100% no-repeat;
    opacity: 0.95;
}

.menu-title,
.player-label,
.section-chip {
    font-family: "Press Start 2P", cursive;
    color: var(--accent-soft);
    text-transform: uppercase;
}

.menu-title,
.player-label {
    font-size: 0.7rem;
    margin: 0 0 16px;
}

.menu-title,
.menu-copy,
.section-chip {
    padding-left: 2px;
}

.menu-copy {
    margin: 0 0 16px;
    color: #d8e4c4;
    line-height: 1.5;
    font-size: 0.95rem;
    opacity: 0.98;
}

.menu-copy-intro {
    padding-left: 10px;
    padding-right: 10px;
}

.menu-list,
.stream-list {
    display: grid;
    gap: 10px;
}

.menu-scroller {
    min-height: 0;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
}

.menu-scroller::-webkit-scrollbar {
    width: 10px;
}

.menu-scroller::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid #120b08;
}

.menu-scroller::-webkit-scrollbar-thumb {
    background: #7f5b39;
    border: 2px solid #120b08;
}

.board-button,
.player-button,
.volume-row input[type="range"] {
    appearance: none;
}

.board-button,
.player-button,
.tiny-button {
    width: 100%;
    border: 4px solid #000;
    background: rgba(78, 58, 39, 0.97);
    color: #fff8e1;
    padding: 12px 14px;
    text-align: left;
    cursor: pointer;
    transition: transform var(--ui-transition), background-color var(--ui-transition), color var(--ui-transition), box-shadow var(--ui-transition);
    position: relative;
    padding-left: 44px;
}

.board-button:hover,
.player-button:hover,
.tiny-button:hover,
.board-button:focus-visible,
.player-button:focus-visible,
.tiny-button:focus-visible {
    background: #6c5034;
    transform: translate(-1px, -1px) rotate(-0.2deg);
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.05);
}

.board-button.active {
    background: #8b5930;
    color: #fff0c6;
}

.board-button small {
    display: block;
    margin-top: 6px;
    color: #f0dfbc;
}

.board-button:nth-child(odd):hover {
    transform: translate(-1px, -1px) rotate(-0.25deg);
}

.board-button:nth-child(even):hover {
    transform: translate(-1px, -1px) rotate(0.25deg);
}

.section-chip {
    display: inline-block;
    margin-bottom: 12px;
    font-size: 0.55rem;
}

.empty-state {
    border: 4px dashed #59462d;
    color: #d7c7a0;
    padding: 16px;
    line-height: 1.5;
    background: rgba(0, 0, 0, 0.12);
}

.player-panel {
    left: 10%;
    bottom: 56px;
    width: min(34vw, 410px);
    padding: 18px;
    background-image: url("../assets/images/ui/player_panel.png");
    opacity: 1;
    transform: translateY(0);
}

.player-panel::before {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 24%),
        repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.02) 0 1px, transparent 1px 14px);
    opacity: 0.28;
}

.player-meta {
    display: grid;
    gap: 8px;
    margin-bottom: 14px;
    animation: textFade 0.3s steps(4, end);
}

.player-title-wrap {
    overflow: hidden;
    max-width: 100%;
}

.player-title-track {
    min-width: 0;
}

.player-title-wrap.is-marquee {
    mask-image: linear-gradient(to right, transparent 0, black 6%, black 94%, transparent 100%);
    -webkit-mask-image: linear-gradient(to right, transparent 0, black 6%, black 94%, transparent 100%);
}

.marquee-track {
    display: inline-flex;
    align-items: center;
    gap: 32px;
    white-space: nowrap;
    animation: playerMarquee 12s linear infinite;
}

.menu-board.is-transitioning {
    opacity: 0.72;
    transform: translateY(2px);
}

.menu-board.is-dimmed {
    opacity: 1;
    filter: none;
}

.player-panel.is-emphasis {
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.35), 0 0 0 2px rgba(255, 197, 111, 0.1);
}

.player-panel.is-playing {
    transform: translateY(-2px);
}

.player-title {
    font-size: 1.15rem;
    font-weight: 700;
}

.player-subtitle,
.player-hint,
.player-album {
    color: #ccb990;
}

.player-album {
    font-size: 0.92rem;
    opacity: 0.95;
}

.player-controls,
.player-nav {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 12px;
}

.player-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.equalizer {
    display: inline-grid;
    grid-auto-flow: column;
    align-items: end;
    gap: 3px;
    height: 14px;
    padding-left: 16px;
}

.equalizer span {
    width: 4px;
    height: 4px;
    background: var(--accent-soft);
    animation: eq 1.4s steps(3, end) infinite;
    mask: url("../assets/images/ui/eq_bar.png") center / contain no-repeat;
    -webkit-mask: url("../assets/images/ui/eq_bar.png") center / contain no-repeat;
}

.equalizer span:nth-child(2) {
    animation-delay: 0.2s;
}

.equalizer span:nth-child(3) {
    animation-delay: 0.4s;
}

.equalizer span:nth-child(4) {
    animation-delay: 0.1s;
}

.player-panel:not(.is-playing) .equalizer span {
    animation-play-state: paused;
    height: 4px;
}

.volume-row {
    margin-top: 14px;
    display: grid;
    gap: 8px;
}

.volume-row label {
    color: #d9c59b;
    font-size: 0.9rem;
}

.volume-row input[type="range"] {
    width: 100%;
    height: 16px;
    background: #1a130e;
    border: 3px solid #000;
    outline: none;
}

.volume-row input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 14px;
    height: 24px;
    background: var(--accent);
    border: 3px solid #000;
}

.volume-row input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 24px;
    background: var(--accent);
    border: 3px solid #000;
    border-radius: 0;
}

.tiny-button {
    width: auto;
    padding: 8px 10px;
    padding-left: 40px;
    display: inline-block;
}

.jukebox {
    right: 11%;
    bottom: 62px;
    width: 220px;
    height: 300px;
    display: grid;
    align-content: end;
    justify-items: center;
    gap: 8px;
    padding: 22px 16px 18px;
    background: transparent url("../assets/images/ui/jukebox_idle.png") center bottom / contain no-repeat;
    color: #ffe7b7;
    cursor: pointer;
    animation: jukeboxPulse 5s steps(4, end) infinite;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.35), 0 0 0 3px rgba(255, 178, 103, 0.08);
    isolation: isolate;
}

.jukebox::before,
.jukebox::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.jukebox::before {
    z-index: 0;
    opacity: 0.38;
    background:
        radial-gradient(circle at 50% 28%, rgba(255, 214, 132, 0.22) 0 12%, transparent 13%),
        radial-gradient(circle at 50% 72%, rgba(255, 190, 98, 0.16) 0 9%, transparent 10%);
    filter: blur(12px);
    transition: opacity 0.25s ease, transform 0.25s ease, filter 0.25s ease;
}

.jukebox::after {
    z-index: 1;
    opacity: 0;
    background:
        radial-gradient(circle at 50% 25%, rgba(255, 241, 174, 0.48) 0 10%, transparent 11%),
        radial-gradient(circle at 50% 27%, rgba(255, 193, 94, 0.3) 0 16%, transparent 17%),
        radial-gradient(circle at 50% 66%, rgba(255, 165, 79, 0.22) 0 9%, transparent 10%);
    filter: blur(7px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.jukebox-title {
    font-family: "Press Start 2P", cursive;
    font-size: 0.72rem;
    text-align: center;
    line-height: 1.6;
    position: relative;
    margin-top: auto;
    text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.4);
    z-index: 2;
}

.jukebox-subtitle {
    font-size: 0.88rem;
    color: #ffc56f;
    z-index: 2;
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.35);
}

.jukebox.is-active {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 0 0 4px #000, 0 0 22px rgba(255, 188, 97, 0.45);
    background-image: url("../assets/images/ui/jukebox_active.png");
    background-position: center bottom;
}

.jukebox:hover,
.jukebox:focus-visible {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.35), 0 0 0 3px rgba(255, 178, 103, 0.14), 0 0 18px rgba(255, 188, 97, 0.18);
    background-image: url("../assets/images/ui/jukebox_hover.png");
    background-position: center bottom;
}

.jukebox:hover::before,
.jukebox:focus-visible::before {
    opacity: 0.56;
    transform: scale(1.02);
    filter: blur(14px);
}

.jukebox.is-active::before {
    opacity: 0.7;
    transform: scale(0.98);
}

.jukebox.is-active::after {
    opacity: 0.5;
}

.scene.is-playing .jukebox {
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.35), 0 0 0 3px rgba(255, 178, 103, 0.2), 0 0 22px rgba(255, 188, 97, 0.2);
    background-image: url("../assets/images/ui/jukebox_playing.png");
    background-position: center bottom;
    animation: jukeboxPulse 4.5s steps(4, end) infinite, jukeboxPlayingGlow 2.6s ease-in-out infinite;
}

.scene.is-playing .menu-board,
.scene.is-playing .player-panel {
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.35), 0 0 0 2px rgba(255, 197, 111, 0.08);
}

.scene.is-playing .jukebox::before {
    opacity: 0.78;
    animation: jukeboxHalo 2s ease-in-out infinite;
}

.scene.is-playing .jukebox::after {
    opacity: 0.95;
    animation: jukeboxLampPulse 1.3s steps(2, end) infinite, jukeboxRecordPulse 2.2s ease-in-out infinite;
}

.scene.player-focus .player-panel {
    opacity: 1;
}

.scene.menu-focus .menu-board {
    opacity: 1;
}

.icon-back::before,
.icon-next::before,
.icon-play::before,
.icon-stop::before,
.icon-random::before {
    content: "";
    position: absolute;
    left: 10px;
    top: 50%;
    width: 24px;
    height: 24px;
    transform: translateY(-50%);
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
    image-rendering: pixelated;
}

.icon-back::before {
    background-image: url("../assets/images/ui/btn_back.png");
}

.icon-next::before {
    background-image: url("../assets/images/ui/btn_next.png");
}

.icon-play::before {
    background-image: url("../assets/images/ui/btn_play.png");
}

.icon-stop::before {
    background-image: url("../assets/images/ui/btn_stop.png");
}

.icon-random::before {
    background-image: url("../assets/images/ui/btn_random.png");
}

@keyframes eq {
    0% {
        height: 4px;
    }

    50% {
        height: 11px;
    }

    100% {
        height: 4px;
    }
}

@keyframes textFade {
    0% {
        opacity: 0.82;
    }

    100% {
        opacity: 1;
    }
}

@keyframes playerMarquee {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(calc(-50% - 16px));
    }
}

@keyframes jukeboxPulse {
    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.02);
    }
}

@keyframes jukeboxLamp {
    0%,
    100% {
        filter: brightness(1);
    }

    50% {
        filter: brightness(1.12);
    }
}

@keyframes jukeboxHalo {
    0%,
    100% {
        opacity: 0.72;
        transform: scale(1);
    }

    50% {
        opacity: 0.9;
        transform: scale(1.03);
    }
}

@keyframes jukeboxLampPulse {
    0%,
    100% {
        opacity: 0.9;
    }

    50% {
        opacity: 1;
    }
}

@keyframes jukeboxRecordPulse {
    0%,
    100% {
        transform: scale(1);
        filter: blur(7px);
    }

    50% {
        transform: scale(1.04);
        filter: blur(9px);
    }
}

@keyframes jukeboxPlayingGlow {
    0%,
    100% {
        box-shadow: 0 4px 0 rgba(0, 0, 0, 0.35), 0 0 0 3px rgba(255, 178, 103, 0.2), 0 0 22px rgba(255, 188, 97, 0.2);
    }

    50% {
        box-shadow: 0 4px 0 rgba(0, 0, 0, 0.35), 0 0 0 3px rgba(255, 199, 126, 0.28), 0 0 30px rgba(255, 198, 110, 0.34);
    }
}

@media (max-width: 1280px) {
    .menu-board {
        right: 4%;
        width: min(42vw, 420px);
        top: 104px;
    }

    .player-panel {
        left: 5%;
        bottom: 40px;
        width: min(38vw, 380px);
    }

    .jukebox {
        right: 4%;
        bottom: 40px;
        width: 200px;
        height: 278px;
        padding: 20px 14px 16px;
    }
}

@media (max-width: 1100px) {
    .menu-board {
        width: min(44vw, 390px);
        max-height: min(64vh, 560px);
    }

    .player-panel {
        width: min(40vw, 360px);
    }

    .jukebox {
        width: 184px;
        height: 254px;
    }
}

@media (max-width: 960px) {
    .menu-board,
    .player-panel,
    .jukebox {
        position: relative;
        inset: auto;
        width: 100%;
    }

    .menu-board,
    .player-panel {
        min-height: auto;
        max-height: none;
        padding: 16px;
    }

    .menu-board {
        order: 1;
        padding: 22px 18px 16px 22px;
        max-height: min(52svh, 520px);
    }

    .player-panel {
        order: 2;
    }

    .jukebox {
        order: 3;
        max-width: 240px;
        width: min(52vw, 240px);
        height: 292px;
        margin: 4px auto 0;
    }
}

@media (max-width: 640px) {
    .menu-board,
    .player-panel,
    .jukebox {
        border-width: 4px;
    }

    .menu-board,
    .player-panel {
        padding: 14px;
    }

    .menu-board {
        padding: 20px 16px 14px 18px;
        max-height: min(48svh, 460px);
    }

    .menu-title,
    .player-label {
        font-size: 0.62rem;
        margin-bottom: 12px;
    }

    .menu-copy,
    .board-button,
    .player-button,
    .tiny-button,
    .player-hint,
    .player-subtitle,
    .player-album,
    .volume-row label {
        font-size: 0.88rem;
    }

    .menu-copy-intro {
        padding-left: 8px;
        padding-right: 8px;
    }

    .board-button,
    .player-button,
    .tiny-button {
        padding: 10px 12px;
        padding-left: 40px;
        border-width: 3px;
    }

    .icon-back::before,
    .icon-next::before,
    .icon-play::before,
    .icon-stop::before,
    .icon-random::before {
        left: 9px;
        width: 22px;
        height: 22px;
    }

    .player-title {
        font-size: 1rem;
    }

    .player-controls,
    .player-nav {
        gap: 8px;
        margin-top: 10px;
    }

    .volume-row input[type="range"] {
        height: 14px;
    }

    .volume-row input[type="range"]::-webkit-slider-thumb {
        width: 12px;
        height: 20px;
    }

    .volume-row input[type="range"]::-moz-range-thumb {
        width: 12px;
        height: 20px;
    }

    .jukebox {
        width: min(56vw, 208px);
        height: 250px;
        padding: 18px 12px 14px;
    }

    .jukebox-title {
        font-size: 0.62rem;
    }

    .jukebox-subtitle {
        font-size: 0.78rem;
    }
}

@media (max-width: 420px) {
    .menu-board,
    .player-panel {
        padding: 12px;
    }

    .menu-board {
        padding: 18px 14px 12px 16px;
        max-height: min(46svh, 400px);
    }

    .menu-copy,
    .board-button,
    .player-button,
    .tiny-button,
    .player-hint,
    .player-subtitle,
    .player-album,
    .volume-row label {
        font-size: 0.82rem;
    }

    .menu-copy-intro {
        padding-left: 6px;
        padding-right: 6px;
    }

    .player-head {
        gap: 8px;
    }

    .equalizer {
        padding-left: 10px;
        gap: 2px;
    }

    .player-controls,
    .player-nav {
        grid-template-columns: 1fr;
    }

    .board-button,
    .player-button,
    .tiny-button {
        padding-left: 38px;
    }

    .jukebox {
        width: min(60vw, 184px);
        height: 220px;
        padding: 16px 10px 12px;
    }

    .jukebox-title {
        font-size: 0.56rem;
    }

    .jukebox-subtitle {
        font-size: 0.72rem;
    }
}
