/* ─── shared styles for singer-dot class ──────── */
.singer-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ─── Host Screen — Container & Toolbar ─────────────────────── */
.karaoke-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: #0f0f0f;
    color: #fff;
    font-family: system-ui, sans-serif;
    overflow: hidden;
    /*
     * TV safe zone.
     * 5vw ≈ 96px horizontal at 1920px (action-safe boundary).
     * 5vh ≈ 54px vertical   at 1080px (action-safe boundary).
     * clamp keeps it sane on smaller monitors / windows.
     */
    padding: clamp(12px, 5vh, 54px) clamp(12px, 5vw, 96px);
    box-sizing: border-box;
}

.karaoke-toolbar {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .35rem .5rem; /* was .45rem 1rem — container handles the horizontal safe zone */
    background: #1a1a1a;
    border-bottom: .5px solid rgba(255, 255, 255, .08);
    border-radius: 6px; /* softens the floating look now it's inset */
    flex-shrink: 0;
    flex-wrap: wrap;
    margin-bottom: .35rem;
}

.toolbar-group {
    display: flex;
    gap: .25rem;
}

.toolbar-group--right {
    margin-left: auto;
}

.toolbar-btn {
    background: rgba(255, 255, 255, .06);
    border: .5px solid rgba(255, 255, 255, .12);
    color: rgba(255, 255, 255, .8);
    border-radius: 6px;
    padding: .3rem .75rem; /* was .35rem .85rem */
    font-size: .78rem; /* was .82rem */
    cursor: pointer;
    transition: background .12s;
    white-space: nowrap;
}

    .toolbar-btn:hover:not(:disabled) {
        background: rgba(255, 255, 255, .1);
    }

    .toolbar-btn.active {
        background: rgba(255, 255, 255, .16);
        color: #fff;
        border-color: rgba(255, 255, 255, .2);
    }

    .toolbar-btn:disabled {
        opacity: .3;
        cursor: not-allowed;
    }

.now-playing-pill {
    flex: 1;
    display: flex;
    align-items: center;
    gap: .5rem;
    background: rgba(255, 255, 255, .05);
    border-radius: 6px;
    padding: .3rem .65rem; /* was .35rem .75rem */
    min-width: 0;
    overflow: hidden;
    margin: 0 .25rem;
}

.now-playing-text {
    font-size: .82rem; /* was .85rem */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: .9;
}

/* ─── Host Screen — Stage ────────────────────────────────────── */
.karaoke-stage {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.player-pane {
    flex: 1;
    position: relative;
    background: #000;
}

#yt-player {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.player-singer-bar {
    position: absolute;
    bottom: 10px;
    left: 10px;
    right: 10px;
    background: rgba(0, 0, 0, .65);
    border-radius: 8px;
    padding: .35rem .65rem; /* was .4rem .75rem */
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .82rem; /* was .9rem */
    pointer-events: none;
}

/* ─── Host Screen — List Pane ────────────────────────────────── */
.mode-fullscreen .list-pane {
    display: none;
}

.mode-songlist .list-pane {
    width: 300px; /* was 340px */
}

.list-pane {
    background: #111;
    border-left: .5px solid rgba(255, 255, 255, .06);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
}

.list-scroll {
    flex: 1;
    overflow-y: auto;
}

.list-row {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .45rem .65rem; /* was .55rem .75rem */
    border-bottom: .5px solid rgba(255, 255, 255, .06);
    font-size: .8rem; /* was .85rem */
    transition: background .1s;
}

.list-row--active {
    background: rgba(127, 119, 221, .1);
}

.list-num {
    width: 18px;
    text-align: center;
    font-size: .72rem;
    opacity: .45;
    flex-shrink: 0;
}

.list-title {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-singer {
    font-size: .75rem;
    opacity: .6;
    white-space: nowrap;
}

.list-playing-badge {
    background: rgba(29, 158, 117, .2);
    color: #1D9E75;
    font-size: .65rem;
    border-radius: 999px;
    padding: .12rem .45rem;
    white-space: nowrap;
}

.list-remove-btn {
    background: none;
    color: rgba(255, 255, 255, .3);
    border: none;
    cursor: pointer;
    font-size: .85rem;
    padding: 0 .2rem;
    flex-shrink: 0;
}

    .list-remove-btn:hover {
        color: #E24B4A;
    }

.rotation-preview {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    padding: .6rem .65rem; /* was .75rem */
    border-top: .5px solid rgba(255, 255, 255, .08);
    flex-shrink: 0;
}

.rotation-chip {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    background: rgba(255, 255, 255, .06);
    border: .5px solid rgba(255, 255, 255, .1);
    border-radius: 999px;
    padding: .18rem .55rem; /* was .2rem .65rem */
    font-size: .72rem; /* was .78rem */
    color: rgba(255, 255, 255, .8);
}

.rotation-count {
    background: rgba(255, 255, 255, .1);
    border-radius: 999px;
    padding: 0 .35rem;
    font-size: .68rem;
    min-width: 1rem;
    text-align: center;
}

/* ─── Now Singing Overlay (host) ─────────────────────────────── */
.nso-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, .88);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity .3s;
}

.nso-backdrop--visible {
    pointer-events: all;
    opacity: 1;
}

.nso-content {
    text-align: center;
    color: #fff;
    padding: 2rem;
}

.nso-label {
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: .15em;
    opacity: .6;
}

.nso-singer {
    font-size: 3.5rem;
    font-weight: 900;
    margin: .4rem 0;
}

.nso-song {
    font-size: 1.3rem;
    opacity: .85;
    margin-bottom: 1.5rem;
    max-width: 500px;
}

.nso-progress-bar-track {
    height: 4px;
    background: rgba(255, 255, 255, .12);
    border-radius: 2px;
    width: 300px;
    max-width: 80vw;
    margin: 0 auto 1rem;
}

.nso-progress-bar {
    height: 100%;
    background: #7F77DD;
    border-radius: 2px;
    animation: nsoProgressShrink linear forwards;
}

@keyframes nsoProgressShrink {
    from {
        width: 100%;
    }

    to {
        width: 0%;
    }
}

.nso-hint {
    font-size: .85rem;
    opacity: .4;
}

/* ─── Singer Room — Your Turn Backdrop ──────────────────────── */
.your-turn-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, .88);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.your-turn-card {
    border: 2px solid;
    border-radius: 16px;
    padding: 2rem 1.5rem;
    text-align: center;
    background: rgba(0, 0, 0, .5);
    max-width: 360px;
    width: 90%;
    animation: cardGlow 1.5s ease-in-out infinite;
}

@keyframes cardGlow {
    0%, 100% {
        box-shadow: 0 0 24px var(--singer-color, #fff);
    }

    50% {
        box-shadow: 0 0 64px var(--singer-color, #fff);
    }
}

.your-turn-icon {
    font-size: 3.5rem;
}

.your-turn-title {
    font-size: 3rem;
    font-weight: 900;
    color: #fff;
    margin: .4rem 0;
}

.your-turn-song {
    font-size: 1.2rem;
    color: rgba(255,255,255,.9);
    margin-bottom: 1.25rem;
}

.your-turn-hint {
    font-size: .9rem;
    color: rgba(255,255,255,.4);
}

/* ─── Singer Room — Header ───────────────────────────────────── */
.singer-loading {
    color: #fff;
    padding: 2rem;
    text-align: center;
    font-family: system-ui, sans-serif;
}

.singer-header {
    background: #111;
    color: #fff;
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .75rem 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    font-family: system-ui, sans-serif;
}

.sr-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    color: #fff;
    flex-shrink: 0;
}

.singer-header-name {
    font-weight: 700;
    flex: 1;
}

.singer-header-room {
    font-size: .75rem;
    opacity: .5;
}

.sr-now-playing-pill {
    border-radius: 999px;
    padding: .25rem .75rem;
    font-size: .75rem;
    border: 1px solid var(--singer-color, #7F77DD);
    color: var(--singer-color, #7F77DD);
    animation: pillBlink 1s ease-in-out infinite;
    white-space: nowrap;
}

@keyframes pillBlink {
    0%, 100% {
        opacity: 1;
    }

    50% {
        opacity: .2;
    }
}

/* ─── Singer Room — Body ─────────────────────────────────────── */
.singer-room {
    max-width: 480px;
    margin: 0 auto;
    padding: 1rem;
    color: #fff;
    font-family: system-ui, sans-serif;
}

.singer-tabs {
    display: flex;
    background: #111;
    border-bottom: .5px solid rgba(255,255,255,.1);
}

.singer-tab {
    flex: 1;
    background: none;
    border: none;
    color: rgba(255,255,255,.5);
    padding: .75rem;
    font-size: .95rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color .15s;
}

.singer-tab--active {
    color: #fff;
    border-bottom-color: #7F77DD;
}

.singer-panel {
    padding: 1rem 0;
}

.singer-search-bar {
    display: flex;
    gap: .5rem;
}

.singer-search-input {
    flex: 1;
    background: #1a1a1a;
    border: .5px solid rgba(255,255,255,.15);
    color: #fff;
    border-radius: 8px;
    padding: .65rem .9rem;
    font-size: 1rem;
}

    .singer-search-input:focus {
        outline: none;
        border-color: #7F77DD;
    }

.singer-search-btn {
    background: #7F77DD;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: .65rem 1.2rem;
    font-size: 1rem;
    cursor: pointer;
    white-space: nowrap;
}

    .singer-search-btn:hover:not(:disabled) {
        background: #9f98e8;
    }

    .singer-search-btn:disabled {
        opacity: .5;
        cursor: not-allowed;
    }

.singer-results {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

/* sr-result replaces singer-video-card */
.sr-result {
    display: flex;
    align-items: center;
    gap: .75rem;
    background: #1a1a1a;
    border-radius: 10px;
    padding: .5rem;
}

.sr-result--queued {
    opacity: .45;
}

.singer-video-thumb {
    width: 80px;
    height: 56px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}

.singer-video-info {
    flex: 1;
    min-width: 0;
}

.singer-video-title {
    color: #fff;
    font-size: .9rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.singer-video-channel {
    color: rgba(255,255,255,.5);
    font-size: .75rem;
    margin-top: .2rem;
}

.singer-in-queue-badge {
    background: rgba(255,255,255,.08);
    color: rgba(255,255,255,.5);
    font-size: .7rem;
    border-radius: 999px;
    padding: .25rem .65rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.singer-add-btn {
    background: #1D9E75;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: .4rem .9rem;
    font-size: .85rem;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}

    .singer-add-btn:hover {
        background: #25c48f;
    }

.singer-error {
    color: #E24B4A;
    font-size: .85rem;
    margin-top: .5rem;
}

/* sr-toast replaces singer-toast */
.sr-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: #1D9E75;
    color: #fff;
    border-radius: 999px;
    padding: .65rem 1.5rem;
    font-size: .95rem;
    font-weight: 600;
    z-index: 9000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, .4);
    white-space: nowrap;
    animation: srToastFadeUp .25s ease forwards;
}

@keyframes srToastFadeUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* ─── Singer Room — My Songs ─────────────────────────────────── */
.my-songs {
    margin-top: 1.5rem;
}

.my-songs-title {
    font-size: 1rem;
    opacity: .6;
    margin-bottom: .75rem;
}

.my-songs-empty {
    opacity: .35;
    font-size: .9rem;
}

.my-song-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .5rem .75rem;
    border-radius: 8px;
    background: #1a1a1a;
    margin-bottom: .4rem;
    border-left: 3px solid transparent;
}

.my-song-item--playing {
    border-left-color: #1D9E75;
}

.my-song-item--completed {
    opacity: .4;
}

.my-song-item--skipped {
    opacity: .3;
}

.my-song-title {
    font-size: .9rem;
    flex: 1;
}

.my-song-status {
    font-size: .75rem;
    opacity: .55;
    text-transform: capitalize;
}

.my-song-item--playing .my-song-status {
    color: #1D9E75;
    opacity: 1;
}

.my-song-remove-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,.3);
    font-size: 1rem;
    cursor: pointer;
    padding: .1rem .3rem;
    line-height: 1;
    flex-shrink: 0;
    transition: color .12s;
}

    .my-song-remove-btn:hover {
        color: #E24B4A;
    }

/* ─── Lobby ──────────────────────────────────────────────────── */
.lobby-container {
    min-height: 100vh;
    background: #0f0f0f;
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 1rem;
    gap: 2rem;
    font-family: system-ui, sans-serif;
}

.lobby-room-code-label {
    font-size: 1rem;
    opacity: .55;
    text-transform: uppercase;
    letter-spacing: .1em;
}

.lobby-room-code {
    font-size: 5rem;
    font-weight: 900;
    letter-spacing: .15em;
}

.lobby-qr-image {
    width: 220px;
    height: 220px;
    border-radius: 12px;
}

.lobby-qr-hint {
    text-align: center;
    opacity: .55;
    margin-top: .5rem;
}

.lobby-qr-url {
    font-family: monospace;
    font-size: .75rem;
    opacity: .35;
    text-align: center;
    word-break: break-all;
}

.lobby-roster {
    width: 100%;
    max-width: 420px;
}

.lobby-roster-title {
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

.lobby-empty {
    opacity: .45;
}

.lobby-singer-row {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .6rem 0;
    border-bottom: .5px solid rgba(255,255,255,.1);
}

.lobby-singer-name {
    flex: 1;
    font-size: 1.1rem;
}

.lobby-kick-btn {
    background: rgba(192, 57, 43, .8);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: .3rem .75rem;
    cursor: pointer;
    font-size: .85rem;
}

    .lobby-kick-btn:hover {
        background: #e74c3c;
    }

.lobby-start-btn {
    background: #7F77DD;
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 1rem 3rem;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
}

    .lobby-start-btn:hover {
        background: #9f98e8;
    }

/* ─── Home Page ──────────────────────────────────────────────── */
.home-container {
    min-height: 100vh;
    background: #0f0f0f;
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2.5rem;
    font-family: system-ui, sans-serif;
    padding: 2rem 1rem;
    box-sizing: border-box;
}

.home-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .75rem;
    text-align: center;
}

.home-logo {
    font-size: 5rem;
    line-height: 1;
}

.home-title {
    font-size: 3rem;
    font-weight: 900;
    margin: 0;
    letter-spacing: -.01em;
}

.home-subtitle {
    font-size: 1.1rem;
    opacity: .5;
    margin: 0;
}

.home-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.home-btn {
    display: inline-block;
    text-decoration: none;
    border: none;
    border-radius: 12px;
    padding: 1rem 2.5rem;
    font-size: 1.15rem;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s;
}

.home-btn--primary {
    background: #7F77DD;
    color: #fff;
}

    .home-btn--primary:hover {
        background: #9f98e8;
    }

/* ─── Host Screen — List Pane QR ────────────────────────────── */
.list-pane-qr {
    position: fixed;
    bottom: clamp(12px, 5vh, 54px);
    right: clamp(12px, 5vw, 96px);
    text-align: center;
    z-index: 10;
}

.list-pane-qr-img {
    width: 120px;
    height: 120px;
    border-radius: 8px;
    display: block;
    margin: 0 auto;
}

.list-pane-qr-hint {
    font-size: .75rem;
    opacity: .5;
    margin: .3rem 0 .1rem;
}

.list-pane-qr-url {
    font-family: monospace;
    font-size: .6rem;
    opacity: .3;
    word-break: break-all;
    margin: 0;
}

/* ─── Join Room ──────────────────────────────────────────────── */
.join-container {
    min-height: 100vh;
    background: #0f0f0f;
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 1rem;
    gap: 1.5rem;
    font-family: system-ui, sans-serif;
    max-width: 480px;
    margin: 0 auto;
    box-sizing: border-box;
}

.join-title {
    font-size: 1.8rem;
    font-weight: 700;
    text-align: center;
    margin: 0;
}

.join-room-code {
    color: #7F77DD;
}

.join-field {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.join-label {
    font-size: .9rem;
    opacity: .65;
}

.join-input {
    background: #1a1a1a;
    border: .5px solid rgba(255,255,255,.2);
    color: #fff;
    border-radius: 8px;
    padding: .85rem 1rem;
    font-size: 1rem;
    width: 100%;
    box-sizing: border-box;
}

    .join-input:focus {
        outline: none;
        border-color: #7F77DD;
    }

.join-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
}

.join-swatch {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform .1s, border-color .1s;
    /* ensure tap target is large enough on mobile */
    -webkit-tap-highlight-color: transparent;
}

    .join-swatch:hover {
        transform: scale(1.1);
    }

.join-swatch--selected {
    border-color: #fff;
    transform: scale(1.15);
    box-shadow: 0 0 0 2px rgba(255,255,255,.35);
}

.join-btn {
    width: 100%;
    background: #7F77DD;
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 1rem;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: .5rem;
}

    .join-btn:hover:not(:disabled) {
        background: #9f98e8;
    }

    .join-btn:disabled {
        opacity: .5;
        cursor: not-allowed;
    }

.join-error {
    color: #E24B4A;
    font-size: .9rem;
    text-align: center;
}

.join-checking {
    opacity: .45;
    font-size: .95rem;
}
