* {
    box-sizing: border-box;
}

:root {
    --bg1: #050505;
    --bg2: #111111;
    --bg3: #1a1a1a;
    --panel: rgba(28, 28, 28, 0.78);
    --panel-soft: rgba(40, 40, 40, 0.68);
    --glass-border: rgba(255, 255, 255, 0.08);

    --orange: #ff9f43;
    --orange-strong: #ff7a00;
    --orange-soft: #ffbe7a;
    --gold: #ffd27a;

    --green: #7df0b8;
    --blue: #8bc4ff;
    --white: #ffffff;
    --text-soft: rgba(255, 255, 255, 0.72);
    --text-dim: rgba(255, 255, 255, 0.50);
    --shadow: rgba(0, 0, 0, 0.38);
}

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    font-family: Arial, sans-serif;
    color: var(--white);
}

body.fantasy-bg {
    background:
        radial-gradient(circle at top left, rgba(255, 122, 0, 0.16), transparent 24%),
        radial-gradient(circle at top right, rgba(255, 190, 122, 0.08), transparent 26%),
        radial-gradient(circle at bottom right, rgba(255, 122, 0, 0.10), transparent 24%),
        linear-gradient(135deg, var(--bg1), var(--bg2), var(--bg3));
    background-attachment: fixed;
}

.stars {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        radial-gradient(2px 2px at 25px 35px, rgba(255,255,255,.65), transparent),
        radial-gradient(1.5px 1.5px at 145px 95px, rgba(255,190,122,.45), transparent),
        radial-gradient(2px 2px at 315px 175px, rgba(255,255,255,.55), transparent),
        radial-gradient(1.5px 1.5px at 470px 55px, rgba(255,159,67,.35), transparent),
        radial-gradient(2px 2px at 630px 240px, rgba(255,255,255,.45), transparent),
        radial-gradient(1.5px 1.5px at 810px 135px, rgba(255,190,122,.40), transparent),
        radial-gradient(2px 2px at 1030px 280px, rgba(255,255,255,.35), transparent);
    background-repeat: repeat;
    opacity: 0.70;
}

.page-center {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.glass-card,
.glass-panel {
    background: linear-gradient(
        180deg,
        rgba(38, 38, 38, 0.80),
        rgba(20, 20, 20, 0.82)
    );
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow:
        0 12px 34px var(--shadow),
        inset 0 1px 0 rgba(255,255,255,0.04),
        inset 0 0 0 1px rgba(255,159,67,0.03);
    border-radius: 24px;
}

.glass-card {
    padding: 26px;
}

.narrow {
    width: 100%;
    max-width: 680px;
}

.glow-title {
    text-align: center;
    font-size: 38px;
    margin: 0 0 14px;
    color: #fff5ea;
    text-shadow:
        0 0 8px rgba(255, 159, 67, 0.28),
        0 0 18px rgba(255, 122, 0, 0.18);
}

.intro-text {
    text-align: center;
    line-height: 1.6;
    margin-bottom: 18px;
}

.info-box,
.terms-box {
    background: linear-gradient(
        180deg,
        rgba(255,255,255,0.04),
        rgba(255,255,255,0.02)
    );
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    padding: 14px 16px;
    margin: 16px 0 18px;
}

.terms-title {
    font-size: 22px;
    font-weight: bold;
    color: var(--gold);
    margin-bottom: 12px;
}

.terms-content p {
    margin: 0 0 12px;
    line-height: 1.6;
    color: var(--text-soft);
    font-size: 15px;
}

.terms-check {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-top: 14px;
    color: var(--white);
    font-size: 15px;
}

.terms-check input {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    flex-shrink: 0;
}

.small {
    font-size: 13px;
}

.muted {
    color: var(--text-soft);
    word-break: break-word;
}

.top-gap {
    margin-top: 12px;
}

input,
select {
    width: 100%;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.08);
    outline: none;
    background: rgba(255,255,255,0.05);
    color: var(--white);
    font-size: 16px;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

input::placeholder {
    color: rgba(255,255,255,0.42);
}

input:focus,
select:focus {
    border-color: rgba(255,159,67,0.50);
    box-shadow: 0 0 0 3px rgba(255,122,0,0.10);
    background: rgba(255,255,255,0.07);
}

.magic-btn {
    border: none;
    border-radius: 16px;
    padding: 14px 20px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease, filter .15s ease;
    box-shadow: 0 10px 22px rgba(0,0,0,0.22);
}

.magic-btn:hover {
    transform: translateY(-1px) scale(1.01);
    filter: brightness(1.03);
}

.magic-btn:active {
    transform: translateY(1px) scale(0.99);
}

.magic-btn:disabled {
    cursor: not-allowed;
    opacity: 0.42;
    transform: none;
    box-shadow: none;
    filter: grayscale(25%);
}

.magic-btn.pink {
    color: #1a1208;
    background: linear-gradient(135deg, #ffbe7a, #ff7a00);
}

.magic-btn.blue {
    color: #151515;
    background: linear-gradient(135deg, #cfcfcf, #8f8f8f);
}

.magic-btn.green {
    color: #161616;
    background: linear-gradient(135deg, #ffd08e, #ff9f43);
}

.magic-btn.orange {
    color: #1a1208;
    background: linear-gradient(135deg, #ffc988, #ff7a00);
}

hr {
    border: none;
    border-top: 1px solid rgba(255,255,255,0.08);
    margin: 18px 0;
}

.page-topbar {
    max-width: 1500px;
    margin: 0 auto 18px;
    padding: 20px 20px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.topbar-title {
    font-size: 34px;
    font-weight: bold;
    color: #fff6ec;
    text-shadow:
        0 0 10px rgba(255,159,67,.18),
        0 0 24px rgba(255,122,0,.08);
}

.room-badge {
    padding: 10px 16px;
    border-radius: 999px;
    background: linear-gradient(
        135deg,
        rgba(255,159,67,0.14),
        rgba(255,122,0,0.10)
    );
    border: 1px solid rgba(255,159,67,0.18);
    color: #ffe7cf;
    font-weight: bold;
}

.computer-page {
    width: 100%;
    min-height: 100vh;
    padding: 0 24px 24px;
}

.computer-layout {
    max-width: 1500px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 22px;
    align-items: start;
}

.main-area {
    padding: 18px;
}

.sticky-panel {
    position: sticky;
    top: 18px;
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sidebar-scroll {
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    padding-right: 6px;
}

.sidebar-scroll::-webkit-scrollbar {
    width: 10px;
}

.sidebar-scroll::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.05);
    border-radius: 999px;
}

.sidebar-scroll::-webkit-scrollbar-thumb {
    background: rgba(255,159,67,0.45);
    border-radius: 999px;
}

.queue-panel {
    padding: 16px;
}

.player-panel {
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 22px;
    background: #000;
    position: relative;
    box-shadow:
        inset 0 0 0 1px rgba(255,255,255,0.05),
        0 16px 36px rgba(0,0,0,0.34);
}

.player-panel:fullscreen {
    width: 100vw;
    height: 100vh;
    aspect-ratio: auto;
    border-radius: 0;
    background: #000;
}

.player-panel:fullscreen #player {
    width: 100%;
    height: 100%;
}

.player-panel:fullscreen .video-qr-overlay {
    top: 18px;
    right: 18px;
    z-index: 9999;
}

.player-panel:fullscreen .fullscreen-fab {
    z-index: 9999;
}

#player {
    width: 100%;
    height: 100%;
}

.overlay-message {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    text-align: center;
    background: rgba(0, 0, 0, 0.45);
    color: white;
    font-size: 22px;
    line-height: 1.45;
    z-index: 3;
}

.hidden {
    display: none;
}

.video-qr-overlay {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 4;
    background: linear-gradient(
        180deg,
        rgba(42,42,42,0.80),
        rgba(20,20,20,0.82)
    );
    border: 1px solid rgba(255,255,255,0.10);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 18px;
    padding: 10px 10px 8px;
    box-shadow: 0 10px 22px rgba(0,0,0,0.28);
    text-align: center;
}

.video-qr-title {
    font-size: 12px;
    font-weight: bold;
    color: #fff4e7;
    margin-bottom: 8px;
    text-shadow: 0 0 8px rgba(0,0,0,0.35);
}

.video-qr-box {
    background: white;
    padding: 6px;
    border-radius: 12px;
    display: inline-block;
}

.fullscreen-fab {
    position: absolute;
    bottom: 14px;
    right: 14px;
    z-index: 5;
    border: none;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 22px;
    font-weight: bold;
    color: #fff;
    background: rgba(20,20,20,0.58);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 8px 18px rgba(0,0,0,0.30);
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 16px;
}

.left-buttons .magic-btn {
    min-width: 160px;
}

.mobile-link-panel {
    padding: 16px;
}

.queue-stack,
.mobile-queue {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.song-card {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 14px;
    align-items: center;
    padding: 12px;
    border-radius: 20px;
    overflow: hidden;
}

.sparkle-card {
    background:
        linear-gradient(135deg, rgba(255,255,255,0.06), rgba(255,255,255,0.03));
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 10px 24px rgba(0,0,0,0.22);
}

.song-card img {
    width: 110px;
    height: 82px;
    object-fit: cover;
    border-radius: 14px;
    box-shadow: 0 8px 18px rgba(0,0,0,.25);
    display: block;
}

.song-text {
    min-width: 0;
}

.song-title {
    font-size: 18px;
    line-height: 1.35;
    font-weight: bold;
    color: #fff6ea;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.song-sub {
    margin-top: 8px;
    font-size: 14px;
    color: var(--text-soft);
}

.song-pill {
    display: inline-block;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 0.06em;
    padding: 6px 10px;
    border-radius: 999px;
    margin-bottom: 8px;
}

.now-pill {
    color: #1a1208;
    background: linear-gradient(135deg, #ffd08e, #ff7a00);
}

.result-pill {
    color: #181818;
    background: linear-gradient(135deg, #d8d8d8, #9f9f9f);
}

.current-song {
    outline: 2px solid rgba(255, 159, 67, 0.24);
}

.song-action-row {
    margin-top: 10px;
}

.small-action-btn {
    padding: 10px 14px;
    font-size: 14px;
}

.empty-box {
    padding: 18px;
    text-align: center;
    border-radius: 18px;
    color: var(--text-soft);
}

.draggable-song {
    cursor: pointer;
    transition:
        transform 0.16s ease,
        box-shadow 0.16s ease,
        outline-color 0.16s ease,
        background 0.16s ease,
        border-color 0.16s ease;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    touch-action: manipulation;
}

.draggable-song:active {
    cursor: grabbing;
}

.queue-item-selected {
    outline: 2px solid rgba(255, 159, 67, 0.34);
    box-shadow:
        0 0 0 1px rgba(255,159,67,0.18),
        0 0 18px rgba(255,159,67,0.10),
        0 12px 28px rgba(0,0,0,0.28);
}

.drag-hold-ready {
    outline: 2px solid rgba(255, 159, 67, 0.65);
    box-shadow:
        0 0 0 2px rgba(255,159,67,0.38),
        0 0 24px rgba(255,159,67,0.40),
        0 0 50px rgba(255,122,0,0.30),
        0 18px 38px rgba(0,0,0,0.36);
    transform: scale(1.01);
}

.drag-hint {
    margin-bottom: 8px;
}

.drag-ghost {
    opacity: 0.38;
}

.drag-chosen {
    outline: 2px solid rgba(255, 159, 67, 0.75);
    box-shadow:
        0 0 0 2px rgba(255,159,67,0.42),
        0 0 26px rgba(255,159,67,0.45),
        0 0 56px rgba(255,122,0,0.32),
        0 18px 40px rgba(0,0,0,0.38);
    transform: scale(1.02);
}

.drag-dragging {
    opacity: 0.96;
    outline: 2px solid rgba(255, 159, 67, 0.82);
    box-shadow:
        0 0 0 2px rgba(255,159,67,0.50),
        0 0 30px rgba(255,159,67,0.55),
        0 0 64px rgba(255,122,0,0.36),
        0 22px 46px rgba(0,0,0,0.42);
    transform: scale(1.025);
}

.quick-actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    align-items: center;
}

.quick-action-btn {
    border: none;
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    color: #1a1208;
    background: linear-gradient(135deg, #ffd08e, #ff9f43);
    box-shadow: 0 8px 18px rgba(0,0,0,0.20);
}

.quick-action-btn.secondary {
    color: #181818;
    background: linear-gradient(135deg, #d8d8d8, #a8a8a8);
}

.quick-action-select-wrap {
    min-width: 120px;
    flex: 1 1 120px;
}

.quick-action-select {
    width: 100%;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.10);
    outline: none;
    background: rgba(255,255,255,0.08);
    color: var(--white);
    font-size: 13px;
    font-weight: bold;
}

.quick-action-select option {
    color: #111;
}

.drag-handle {
    align-self: stretch;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    min-width: 18px;
    font-size: 16px;
    font-weight: bold;
    color: rgba(255,255,255,0.72);
    cursor: grab;
    user-select: none;
    touch-action: none;
    opacity: 0.9;
    transition: transform 0.15s ease, opacity 0.15s ease, color 0.15s ease;
}

.drag-handle:hover {
    color: #ffd27a;
    opacity: 1;
}

.drag-handle:active {
    cursor: grabbing;
    transform: scale(1.06);
}

.queue-item-card {
    grid-template-columns: 18px 92px 1fr;
    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease,
        opacity 0.15s ease;
}

.blue-background-class {
    opacity: 0.45;
    background:
        linear-gradient(135deg, rgba(139,196,255,0.22), rgba(255,255,255,0.06));
}

.sortable-chosen-card {
    transform: scale(1.015);
    box-shadow:
        0 0 0 1px rgba(255,159,67,0.18),
        0 0 18px rgba(255,159,67,0.12),
        0 12px 28px rgba(0,0,0,0.30);
}

.sortable-drag-card {
    opacity: 0.96;
    transform: scale(1.02);
    box-shadow:
        0 0 0 2px rgba(255,159,67,0.30),
        0 0 22px rgba(255,159,67,0.16),
        0 18px 36px rgba(0,0,0,0.38);
}

/* Computer tuning */
@media (min-width: 721px) {
    .queue-item-card {
        grid-template-columns: 16px 84px 1fr;
    }

    .queue-item-card img {
        width: 84px;
        height: 64px;
    }

    .queue-item-card .song-title {
        font-size: 16px;
        line-height: 1.25;
    }

    .queue-item-card .song-sub {
        margin-top: 6px;
        font-size: 13px;
    }

    .queue-item-card .drag-handle {
        width: 16px;
        min-width: 16px;
        font-size: 16px;
    }

    .queue-item-card .quick-actions-row {
        gap: 6px;
        margin-top: 10px;
    }

    .queue-item-card .quick-action-btn {
        padding: 7px 10px;
        font-size: 12px;
    }
}

.mobile-page {
    min-height: 100vh;
    padding: 0 12px 24px;
}

.mobile-topbar {
    padding-left: 4px;
    padding-right: 4px;
}

.mobile-content {
    max-width: 460px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.mobile-controls {
    padding: 18px;
}

.button-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@media (max-width: 1100px) {
    .computer-layout {
        grid-template-columns: 1fr;
    }

    .sticky-panel {
        position: static;
    }

    .sidebar-scroll {
        max-height: none;
        overflow: visible;
        padding-right: 0;
    }
}

/* Mobile tuning */
@media (max-width: 720px) {
    .page-topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .button-grid {
        grid-template-columns: 1fr;
    }

    .topbar-title {
        font-size: 28px;
    }

    .song-card {
        grid-template-columns: 96px 1fr;
    }

    .queue-item-card {
        grid-template-columns: 20px 88px 1fr;
    }

    .song-card img {
        width: 88px;
        height: 66px;
    }

    .queue-item-card .song-title {
        font-size: 14px;
        line-height: 1.28;
    }

    .queue-item-card .song-sub {
        margin-top: 6px;
        font-size: 12px;
    }

    .queue-item-card .quick-actions-row {
        gap: 6px;
        margin-top: 10px;
    }

    .queue-item-card .quick-action-btn {
        padding: 7px 10px;
        font-size: 12px;
    }

    .drag-handle {
        width: 20px;
        min-width: 20px;
        font-size: 18px;
    }

    .video-qr-overlay {
        top: 10px;
        right: 10px;
        padding: 8px 8px 6px;
    }

    .video-qr-title {
        font-size: 11px;
    }

    .fullscreen-fab {
        width: 46px;
        height: 46px;
        font-size: 20px;
    }

    .terms-content p {
        font-size: 14px;
    }
}
