:root {
    /* DARK & CINEMATIC — Spotify meets A24.
       Deep black, off-white, single indigo accent. No noisy gradients. */
    --bg-base: #0a0a0a;
    --bg-gradient: radial-gradient(ellipse at top, #121212 0%, #0a0a0a 60%, #050505 100%);

    --card-gradient: rgba(255, 255, 255, 0.03);
    --card-border: rgba(255, 255, 255, 0.07);

    --text-main: #f0f0f0;        /* off-white */
    --text-muted: #888;
    --card-bg: #111111;
    --card-border-solid: #2a2a2a;
    --selected-bg: #1e1e2e;       /* slightly indigo-tinted card surface */

    /* Single accent: electric indigo */
    --accent: #7B61FF;
    --accent-2: #9D85FF;          /* lighter indigo for secondary highlights */
    --accent-soft: rgba(123, 97, 255, 0.12);
    --accent-border: rgba(123, 97, 255, 0.35);

    /* Buttons: subtle indigo gradient with a hint of depth */
    --accent-gradient: linear-gradient(135deg, #7B61FF 0%, #5746EA 100%);
    --accent-gradient-hover: linear-gradient(135deg, #8E78FF 0%, #6A5BF0 100%);

    /* Secondary buttons: muted neutral so they recede */
    --secondary-gradient: rgba(255, 255, 255, 0.06);
    --secondary-gradient-hover: rgba(255, 255, 255, 0.1);

    --danger: #ff5f5f;

    /* A24-style serif used for title-card moments only:
       - daily/multiplayer scenario prompt (the hero text)
       - "The Winner" / "It's a Tie" / "Round Complete" h1
       Everything else stays Inter/system sans for crisp UI legibility. */
    --font-serif: 'Fraunces', 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden; /* prevent orb drifts from causing horizontal scroll */
}

/* --- AMBIENT ORBS — drifting indigo gradients in the background ---
   Three large blurred radial gradients on slow loops. Sit between the
   solid body background and the actual content. Pure mood-setting.
   Disabled for users with `prefers-reduced-motion: reduce`.
*/
.ambient-orbs {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}
.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.22;
    will-change: transform;
}
.orb-1 {
    width: 620px;
    height: 620px;
    top: -180px;
    left: -120px;
    background: radial-gradient(circle, #7B61FF 0%, transparent 65%);
    animation: orbDrift1 38s ease-in-out infinite;
}
.orb-2 {
    width: 540px;
    height: 540px;
    bottom: -160px;
    right: -120px;
    background: radial-gradient(circle, #9D85FF 0%, transparent 65%);
    animation: orbDrift2 44s ease-in-out infinite;
}
.orb-3 {
    width: 420px;
    height: 420px;
    top: 40%;
    left: 50%;
    background: radial-gradient(circle, #5746EA 0%, transparent 70%);
    opacity: 0.16;
    animation: orbDrift3 52s ease-in-out infinite;
}
@keyframes orbDrift1 {
    0%, 100% { transform: translate(0, 0); }
    33%      { transform: translate(120px, 90px); }
    66%      { transform: translate(-60px, 160px); }
}
@keyframes orbDrift2 {
    0%, 100% { transform: translate(0, 0); }
    50%      { transform: translate(-140px, -110px); }
}
@keyframes orbDrift3 {
    0%, 100% { transform: translate(-50%, -50%); }
    25%      { transform: translate(-30%, -40%); }
    50%      { transform: translate(-60%, -70%); }
    75%      { transform: translate(-40%, -55%); }
}

/* --- FILM GRAIN — barely-perceptible animated noise overlay ---
   SVG fractalNoise generated inline as a data-URL background. Sized 110%
   so the subtle translate() in the animation never exposes raw edges.
*/
.film-grain {
    position: fixed;
    top: -5%;
    left: -5%;
    width: 110%;
    height: 110%;
    z-index: 9999;
    pointer-events: none;
    opacity: 0.05;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
    animation: grainShift 0.5s steps(10) infinite;
}
@keyframes grainShift {
    0%, 100% { transform: translate(0, 0); }
    10%      { transform: translate(-2%, -2%); }
    20%      { transform: translate(2%,  0%); }
    30%      { transform: translate(-1%,  2%); }
    40%      { transform: translate(1%, -1%); }
    50%      { transform: translate(-2%,  1%); }
    60%      { transform: translate(2%,  2%); }
    70%      { transform: translate(-1%, -1%); }
    80%      { transform: translate(1%,  1%); }
    90%      { transform: translate(-2%, -2%); }
}

/* Make sure all content sits ABOVE the ambient layers */
header, #app-container, .modal {
    position: relative;
    z-index: 2;
}

/* Hide the global header during full-takeover stages — they own the
   viewport and bring their own meta bar. Header reappears when you leave. */
body:has(#page-discussion.view.active) header,
body:has(#page-gameplay.view.active) header {
    display: none;
}

/* Respect users who don't want ambient motion */
@media (prefers-reduced-motion: reduce) {
    .ambient-orbs .orb,
    .film-grain {
        animation: none;
    }
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 22px 24px;
    background: linear-gradient(180deg, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0) 100%);
    border-bottom: 1px solid #1a1a1a;
}

/* Brand: SVG logo replaces the old text wordmark. h1 acts as the click target. */
.brand {
    display: flex;
    align-items: center;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    line-height: 0; /* prevent stray inline-block spacing under the SVG */
}
.brand-logo {
    height: 30px;
    width: auto;
    display: block;
}
.brand:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
    border-radius: 4px;
}

#app-container {
    flex: 1;
    padding: 32px 20px 40px;
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
}

.view { display: none; }
.view.active {
    display: block !important;
    visibility: visible !important;
    animation: fadeIn 0.4s ease;
}
.hidden { display: none !important; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border-solid);
    padding: 28px;
    border-radius: 16px;
    margin-bottom: 28px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.55);
    transition: transform 0.25s cubic-bezier(.4, 0, .2, 1),
                box-shadow 0.25s cubic-bezier(.4, 0, .2, 1),
                border-color 0.25s ease;
}
/* Subtle lift on hover — only for cards inside #app-container, never on
   the takeover stages (gameplay/discussion/winner) which need to sit still. */
#app-container .card:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.6);
    border-color: rgba(123, 97, 255, 0.18);
}

h2, h3 {
    color: var(--text-main);
    margin-bottom: 6px;
}

/*
   Hero element of the entire app. Reads like a film title, not a hyperlink:
   - Off-white #f0f0f0
   - Editorial serif (Fraunces) — A24-style cinematic title treatment
   - Slightly larger than the old sans version since serifs read smaller
   - Generous line-height for breathability
   - Subtle negative tracking — looks better at large display sizes
*/
.scenario-text {
    font-family: var(--font-serif);
    font-size: clamp(1.6rem, 5vw, 1.85rem);
    font-weight: 700;
    margin: 20px 0 24px;
    line-height: 1.3;
    color: var(--text-main);
    letter-spacing: -0.005em;
    /* Fraunces variable axes — opsz scales optical-size to actual rendered size */
    font-variation-settings: "opsz" 144, "SOFT" 30;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
}

.input-group.checkbox {
    flex-direction: row;
    align-items: center;
    gap: 10px;
}

label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

input[type="text"], input[type="number"], select {
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-main);
    font-size: 1rem;
    width: 100%;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

button {
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    /* Slight overshoot on hover/release for a more tactile, elastic feel */
    transition: transform 0.18s cubic-bezier(.34, 1.56, .64, 1),
                background 0.2s ease,
                box-shadow 0.2s ease,
                color 0.2s ease;
}
button:active {
    transform: scale(0.96);
    transition-duration: 0.1s;
}

.btn-primary {
    background: var(--accent-gradient);
    color: #fff;
    box-shadow: 0 4px 14px rgba(123, 97, 255, 0.25);
}
.btn-primary:hover {
    background: var(--accent-gradient-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 22px rgba(123, 97, 255, 0.35);
}

.btn-secondary {
    background: var(--secondary-gradient);
    color: var(--text-main);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}
.btn-secondary:hover {
    background: var(--secondary-gradient-hover);
    transform: translateY(-1px);
}

.btn-text {
    background: none;
    color: var(--text-muted);
    box-shadow: none;
}
.btn-text:hover { color: var(--accent); }

.btn-icon {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: var(--text-main);
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 1.2rem;
    box-shadow: none;
}
.btn-icon:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--accent);
}

.btn-small {
    padding: 8px 14px;
    font-size: 0.9rem;
}

.btn-select {
    background: var(--accent-gradient);
    color: #fff;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
}
.btn-select:hover { background: var(--accent-gradient-hover); }
.btn-select:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.full-width { width: 100%; }

.room-actions {
    display: flex;
    gap: 12px;
}
.room-actions button { flex: 1; }

/*
   "Play with Friends" section wrapping the create/join buttons.
   The .section-label is meant to read as a small uppercase chapter header —
   muted gray, wide tracking, no decoration.
*/
.play-section {
    margin-top: 36px;
    margin-bottom: 8px;
}
.section-label {
    text-transform: uppercase;
    letter-spacing: 2.5px;
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
    margin: 0 0 14px 4px;
}

/* Compact label/value pill bar at the top of the gameplay screen */
.game-header {
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin-bottom: 22px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid #1a1a1a;
    border-radius: 14px;
}
.game-meta {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    flex: 1;
    min-width: 0;
}
.game-meta-label {
    color: var(--text-muted);
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 1.6px;
    font-weight: 500;
}
.game-meta-value {
    color: var(--text-main);
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: 0.5px;
    font-variant-numeric: tabular-nums;
}
/* Indigo only for the infinity-symbol timer; regular countdowns stay off-white */
.game-meta-value.is-infinity {
    color: var(--accent);
    font-size: 1.3rem;
    line-height: 0.95;
}

/* Subtle uppercase round pill that replaces the in-card "Scenario" h2 */
.round-pill {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    color: var(--text-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 500;
    margin-bottom: 10px;
}

.grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.stat-box {
    background: var(--card-gradient);
    backdrop-filter: blur(8px);
    border: 1px solid var(--card-border);
    padding: 18px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.stat-box span {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 6px;
}

.song-result-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    transition: background 0.2s, border-color 0.2s;
}
/* Only rows explicitly marked as clickable (search results, artist drilldown,
   etc.) get the pointer cursor + indigo hover. Leaderboard rows have a play
   button but the row body isn't a click target — they don't get role="button". */
.song-result-card[role="button"] {
    cursor: pointer;
}
.song-result-card[role="button"]:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(123, 97, 255, 0.25);
}
.song-result-card[role="button"]:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.song-result-card img {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    flex-shrink: 0;
}
.song-result-card .song-info {
    flex: 1;
    min-width: 0;
}
.song-result-card .song-title {
    color: var(--text-main);
    font-size: 0.95rem;
}
.song-result-card .song-artist {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.selected-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    margin-top: 8px;
    background: var(--selected-bg);
    border: 1px solid rgba(123, 97, 255, 0.18);
    border-radius: 12px;
    color: var(--text-main);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}
.selected-card img {
    width: 56px;
    height: 56px;
    border-radius: 10px;
}
.selected-card strong {
    display: block;
    font-size: 1.05rem;
}
.selected-card .muted {
    font-size: 0.85rem;
    opacity: 0.75;
}

.snippet-picker {
    margin-top: 16px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
}

/* --- Snippet length picker (5 / 10 / 15 / 20s buttons under the slider) --- */
.snippet-length-picker {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.snippet-length-label {
    color: var(--text-muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    flex-shrink: 0;
}
.snippet-length-options {
    display: flex;
    gap: 4px;
    flex: 1;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 999px;
    padding: 3px;
}
.snippet-length-options button {
    flex: 1;
    padding: 6px 10px;
    background: transparent;
    border: none;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.18s, color 0.18s;
}
.snippet-length-options button:hover {
    color: var(--text-main);
}
.snippet-length-options button.active {
    background: var(--accent-gradient);
    color: #fff;
    box-shadow: 0 0 12px rgba(123, 97, 255, 0.35);
}
.picker-label {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 10px;
}
.picker-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
}
#snippet-start-label {
    color: var(--accent);
    font-weight: 600;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    box-shadow: 0 0 10px rgba(123, 97, 255, 0.55);
    transition: transform 0.15s ease;
}
input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}
input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: none;
    box-shadow: 0 0 10px rgba(123, 97, 255, 0.55);
}

/*
   NOTE: legacy discussion styles (#discussion-timer, #discussion-up-next,
   .volume-controls, #discussion-phase-label) were replaced by the
   "DISCUSSION STAGE" section above. The selectors are still in the DOM
   but their visual treatment now comes from the cinematic ruleset.
*/

.results-container {
    margin-top: 10px;
}

/* .winner-card was the old card-style wrapper around the results screen.
   Replaced by .winner-stage (transparent, full-width). Both rule blocks
   removed — HTML no longer references .winner-card. */

.avatar {
    font-size: 3rem;
    text-align: center;
    margin: 10px;
}

.profile-header {
    text-align: center;
}

#host-controls {
    margin-top: 20px !important;
    border-top: 1px solid rgba(255, 255, 255, 0.12) !important;
    padding-top: 14px !important;
}
#host-controls p small {
    color: var(--text-muted) !important;
    letter-spacing: 2px;
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: 500;
    display: block;
    margin-bottom: 8px;
}

.muted { color: var(--text-muted); }
.small { font-size: 0.85rem; }

/* --- REQUIREMENT BADGE --- */
.requirement-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 12px 0 18px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 10px;
}
.requirement-icon {
    font-size: 1.1rem;
}
.requirement-text {
    color: var(--accent);
    font-size: 0.92rem;
    font-weight: 500;
}

/* --- LOBBY --- */
.lobby-card {
    padding: 28px 24px;
}
.lobby-code-block {
    text-align: center;
    padding: 8px 0 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 18px;
}
.lobby-code {
    font-size: 3.4rem;
    font-weight: 800;
    letter-spacing: 12px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 8px 0;
}
.lobby-pulse {
    color: var(--accent-2);
    font-size: 0.85rem;
    margin-top: 6px;
    animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}
.lobby-players-block h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}
.lobby-players-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}
.lobby-player {
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    color: var(--text-main);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}
.lobby-player::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 6px rgba(123, 97, 255, 0.5);
    flex-shrink: 0;
    display: inline-block;
}

.pill {
    display: inline-block;
    background: var(--accent-gradient);
    color: #fff;
    padding: 2px 12px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 700;
}

/* --- SETTINGS PAGE (Create Party Room) --- */
.settings-card { padding: 24px 28px; }
.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 16px 0;
    border-bottom: 1px solid #1a1a1a;
    min-height: 64px;
}
.settings-row:last-of-type { border-bottom: none; }

/* Label block on the left — title + subtitle stacked, no icon */
.settings-text {
    flex: 1;
    min-width: 0;
}
.settings-title {
    display: block;
    color: var(--text-main);
    font-size: 0.98rem;
    font-weight: 600;
    letter-spacing: 0.1px;
}
.settings-sub {
    color: var(--text-muted);
    font-size: 0.78rem;
    margin: 3px 0 0;
    line-height: 1.35;
}

/* Control on the right — never shrinks, never wraps */
.settings-input {
    flex-shrink: 0;
    width: auto;
    min-width: 130px;
}

/* Collapsible advanced panel — used for custom scenarios */
.settings-advanced {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #1a1a1a;
}
.settings-advanced > summary {
    cursor: pointer;
    list-style: none;
    padding: 4px 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.settings-advanced > summary::-webkit-details-marker { display: none; }
.settings-advanced > summary::after {
    content: "▸";
    position: absolute;
    right: 0;
    top: 4px;
    color: var(--text-muted);
    transition: transform 0.2s;
}
.settings-advanced { position: relative; }
.settings-advanced[open] > summary::after { transform: rotate(90deg); }
.settings-textarea {
    display: block;
    width: 100%;
    margin-top: 12px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid #2a2a2a;
    border-radius: 10px;
    color: var(--text-main);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 0.92rem;
    line-height: 1.45;
    resize: vertical;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.settings-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.settings-note {
    margin-top: 10px;
    color: var(--text-muted);
    font-size: 0.78rem;
}
.settings-warning {
    margin-top: 8px;
    padding: 8px 12px;
    background: var(--accent-soft);
    border: 1px solid var(--accent-border);
    border-radius: 8px;
    color: var(--accent-2);
    font-size: 0.78rem;
    line-height: 1.4;
}
.settings-number {
    width: 72px;
    min-width: 72px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* Toggle switch */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
    flex-shrink: 0;
}
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.switch-slider {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 999px;
    transition: 0.25s;
    cursor: pointer;
}
.switch-slider::before {
    content: "";
    position: absolute;
    height: 20px;
    width: 20px;
    left: 3px;
    top: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.25s;
}
.switch input:checked + .switch-slider {
    background: var(--accent-gradient);
    border-color: transparent;
}
.switch input:checked + .switch-slider::before {
    transform: translateX(22px);
}

/* --- SPOTIFY SECTION --- */
.spotify-empty {
    text-align: center;
    padding: 8px 0;
}
.spotify-empty h3 {
    margin-bottom: 8px;
}
.spotify-btn {
    /* Indigo per the global "no green/orange" rule, even for Spotify connect */
    margin-top: 14px;
}
.spotify-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}
.spotify-header h3 {
    margin: 0;
}
.spotify-disconnect {
    font-size: 0.85rem;
    padding: 4px 10px;
}
.spotify-section-label {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin: 18px 0 8px;
}
.spotify-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.spotify-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
}
.spotify-row img {
    width: 44px;
    height: 44px;
    border-radius: 6px;
    flex-shrink: 0;
}
.spotify-rank {
    color: var(--accent);
    font-weight: 700;
    min-width: 28px;
    text-align: center;
    font-size: 0.95rem;
}
.spotify-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}
.spotify-meta strong {
    color: var(--text-main);
    font-size: 0.95rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.spotify-sub {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* --- MVP / SCOREBOARD (final round) --- */
.mvp-block {
    text-align: center;
    margin: 24px 0 16px;
    padding: 20px;
    background: var(--card-gradient);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 14px;
}
.mvp-name {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 2rem;
    margin: 6px 0;
}
.mvp-count {
    color: var(--accent);
    font-weight: 600;
}
.scoreboard {
    margin-top: 14px;
    text-align: left;
}
.scoreboard h3 {
    margin-bottom: 8px;
}
.scoreboard-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    margin-bottom: 6px;
}
.scoreboard-rank {
    font-weight: 700;
    color: var(--accent);
    min-width: 30px;
}
.scoreboard-name {
    flex: 1;
    color: var(--text-main);
}
.scoreboard-count {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* --- USERNAME MODAL --- */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.78);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 100;
}
.modal-content {
    width: 100%;
    max-width: 420px;
    margin: 0;
}
.modal-content h2 {
    margin-bottom: 8px;
}

/* --- VOTING STAGE — full-width centered, dramatic --- */
.voting-stage {
    width: 100%;
    max-width: 540px;
    margin: 0 auto;
    padding: 12px 0 24px;
}
.voting-hero {
    text-align: center;
    margin-bottom: 28px;
}
.voting-title {
    font-size: clamp(1.75rem, 5vw, 2.25rem);
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.01em;
    margin: 0;
}
.voting-subtitle {
    margin-top: 8px;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.voting-progress {
    margin: 0 0 24px;
}
.voting-progress-text {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    text-align: center;
    margin-bottom: 8px;
}
.voting-progress-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 2px;
    overflow: hidden;
}
.voting-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.45s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 12px rgba(123, 97, 255, 0.45);
}

.voting-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.voting-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    background: var(--card-bg);
    border: 1px solid var(--card-border-solid);
    border-radius: 14px;
    transition: border-color 0.2s, transform 0.15s;
}
.voting-card:hover {
    border-color: rgba(123, 97, 255, 0.35);
}
.voting-card.voted-for {
    background: var(--selected-bg);
    border-color: rgba(123, 97, 255, 0.45);
    box-shadow: 0 0 18px rgba(123, 97, 255, 0.18);
}
.voting-card-art {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    flex-shrink: 0;
    object-fit: cover;
}
.voting-card-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.voting-card-title {
    color: var(--text-main);
    font-size: 0.98rem;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.voting-card-artist {
    color: var(--text-muted);
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.voting-vote-btn {
    flex-shrink: 0;
    padding: 9px 18px;
    background: var(--accent-gradient);
    color: #fff;
    border: none;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.4px;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.15s;
    box-shadow: 0 0 16px rgba(123, 97, 255, 0.25);
}
.voting-vote-btn:hover { transform: translateY(-1px); }
.voting-vote-btn:disabled {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}
.voting-vote-btn.is-voted:disabled {
    /* my own pick — keep the indigo treatment as the "voted for" indicator */
    background: var(--accent-gradient);
    color: #fff;
    opacity: 0.85;
    box-shadow: 0 0 12px rgba(123, 97, 255, 0.4);
}

.voting-host-controls {
    margin-top: 24px;
    text-align: center;
}
.voting-end-early {
    color: var(--text-muted);
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    padding: 8px 14px;
}
.voting-end-early:hover { color: var(--accent); }
.voting-wait { margin-top: 16px; }


/* --- WINNER STAGE — clean indigo-only treatment --- */
.winner-stage {
    width: 100%;
    max-width: 540px;
    margin: 0 auto;
    padding: 16px 0 32px;
    text-align: center;
}
.winner-eyebrow {
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 3px;
    font-size: 0.7rem;
    font-weight: 500;
    margin: 0 0 12px;
}
.winner-title {
    font-family: var(--font-serif);
    font-size: clamp(2.2rem, 6vw, 2.8rem);
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.02em;
    margin: 0 0 28px;
    line-height: 1.05;
    font-variation-settings: "opsz" 144, "SOFT" 30;
}

.winner-reveal {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
}
.winner-art-wrap {
    position: relative;
    width: clamp(220px, 60vw, 300px);
    height: clamp(220px, 60vw, 300px);
    margin: 0 auto 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.winner-art-glow {
    position: absolute;
    inset: -36px;
    background: radial-gradient(
        circle at center,
        rgba(123, 97, 255, 0.50) 0%,
        rgba(123, 97, 255, 0.18) 38%,
        rgba(123, 97, 255, 0) 70%
    );
    filter: blur(28px);
    border-radius: 50%;
    z-index: 0;
    pointer-events: none;
    animation: glowPulse 4s ease-in-out infinite;
}
.winner-art {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 18px;
    object-fit: cover;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.7),
        0 0 80px rgba(123, 97, 255, 0.20);
    z-index: 1;
}
.winner-song-title {
    font-size: clamp(1.25rem, 4vw, 1.5rem);
    color: var(--text-main);
    margin: 6px 0 0;
    font-weight: 700;
    letter-spacing: -0.01em;
}
.winner-song-artist {
    color: var(--text-muted);
    margin: 4px 0 0;
    font-size: 1rem;
    font-weight: 400;
}
.winner-submitted {
    color: var(--text-muted);
    margin-top: 14px;
    font-size: 0.85rem;
}
.winner-submitted strong {
    color: var(--text-main);
    font-weight: 600;
}
.winner-vote-pill {
    display: inline-block;
    margin-top: 22px;
    padding: 10px 24px;
    background: var(--accent-gradient);
    color: #fff;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.5px;
    box-shadow: 0 0 24px rgba(123, 97, 255, 0.35);
}

/* Tied winners — list layout */
.winner-tie-caption {
    color: var(--text-muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-align: center;
    margin-bottom: 18px;
}
.winner-tie-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-align: left;
}
.winner-tie-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    background: var(--card-bg);
    border: 1px solid var(--card-border-solid);
    border-radius: 14px;
}
.winner-tie-card img {
    width: 64px;
    height: 64px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}
.winner-tie-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.winner-tie-title {
    color: var(--text-main);
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.winner-tie-artist {
    color: var(--text-muted);
    font-size: 0.88rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.winner-tie-player { margin-top: 4px; }

.winner-empty-msg {
    text-align: center;
    margin: 24px auto;
    max-width: 360px;
}



/* --- LOADING ANIMATIONS ---
   Three reusable primitives:
     .skeleton          — gray placeholder block with a shimmer sweep
     .loading-dots      — animated "..." ellipsis for inline text
     .loading-pulse     — gentle opacity breathe for buttons mid-action
*/

/* Skeleton: opaque-ish neutral block with a moving highlight band on top.
   Apply to any element to swap its content for a placeholder. */
.skeleton {
    position: relative;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 6px;
    color: transparent !important;
    user-select: none;
    pointer-events: none;
    isolation: isolate;
}
.skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(123, 97, 255, 0.10) 50%,
        transparent 100%
    );
    animation: shimmer 1.6s linear infinite;
    transform: translateX(-100%);
}
@keyframes shimmer {
    to { transform: translateX(100%); }
}

/* Pre-built skeleton parts for typical layouts (rows, lines, thumbnails) */
.skeleton-line {
    height: 1.1em;
    margin-bottom: 10px;
}
.skeleton-line:last-child { margin-bottom: 0; }
.skeleton-line-sm { height: 0.85em; }
.skeleton-line-lg { height: 1.4em; }
.skeleton-line-w-30 { width: 30%; }
.skeleton-line-w-50 { width: 50%; }
.skeleton-line-w-70 { width: 70%; }
.skeleton-line-w-90 { width: 90%; }

.skeleton-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid #1a1a1a;
    border-radius: 12px;
}
.skeleton-thumb {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    flex-shrink: 0;
}
.skeleton-text-block {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

/* Inline animated ellipsis. Pair with text:
     <span>Loading<span class="loading-dots"></span></span>
*/
.loading-dots::after {
    content: "";
    display: inline-block;
    min-width: 1.2em;
    text-align: left;
    animation: loading-dots-anim 1.4s steps(4, end) infinite;
}
@keyframes loading-dots-anim {
    0%   { content: ""; }
    25%  { content: "."; }
    50%  { content: ".."; }
    75%  { content: "..."; }
    100% { content: ""; }
}

/* Buttons mid-action — soft breathe at half opacity */
.loading-pulse {
    animation: loading-pulse-anim 1.4s ease-in-out infinite;
    pointer-events: none;
    cursor: wait;
}
@keyframes loading-pulse-anim {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.55; }
}

/* --- AVATAR (used in friend rows, chat list, chat header, invite modal) --- */
.row-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
}
.row-avatar-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-2);
    font-weight: 700;
    font-size: 0.95rem;
    background: var(--accent-soft);
    border-color: var(--accent-border);
}
.chat-header .row-avatar {
    width: 32px;
    height: 32px;
}

/* --- REPORT BUG PAGE --- */
.report-title {
    font-family: var(--font-serif);
    font-size: clamp(1.5rem, 4vw, 1.9rem);
    font-weight: 700;
    color: var(--text-main);
    margin: 0 0 6px;
    letter-spacing: -0.01em;
}
#page-report select {
    font-size: 1rem;
}

/* --- PUBLIC PROFILE PAGE (/u/username) --- */
.public-profile-card {
    text-align: center;
    padding: 24px 28px 28px;
    position: relative;
}
.public-profile-back {
    position: absolute;
    top: 14px;
    left: 14px;
    padding: 6px 10px;
    font-size: 0.85rem;
}
.public-profile-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 0 24px;
}
.public-avatar-wrap {
    position: relative;
    width: 96px;
    height: 96px;
    margin-bottom: 8px;
}
.public-avatar-img {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent-border);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4), 0 0 24px rgba(123, 97, 255, 0.18);
}
.public-avatar-fallback {
    width: 96px;
    height: 96px;
    margin: 0;
    font-size: 2.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--accent-soft);
    border: 2px solid var(--accent-border);
    color: var(--accent-2);
    font-weight: 700;
}
.public-username {
    font-size: clamp(1.4rem, 4vw, 1.8rem);
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.01em;
    margin: 4px 0 0;
}
.public-joined {
    margin: 4px 0 0;
}
.public-stats {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 8px 0 22px;
}
.public-stats .stat-box {
    padding: 14px 10px;
}
.public-actions {
    margin: 8px 0 18px;
}
.public-share-hint {
    text-align: center;
    margin-top: 8px;
    word-break: break-all;
}
.public-share-hint span {
    color: var(--accent);
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.78rem;
}
.public-share-hint span:hover { text-decoration: underline; }

@media (max-width: 480px) {
    .public-stats { grid-template-columns: 1fr 1fr; }
    .public-stats .stat-box:first-child { grid-column: span 2; }
}

/* --- TIER 2 SOCIAL: friends, requests, invites --- */
.friends-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
/* Top of the Friends tab — copy-your-link CTA. Indigo border, soft glow,
   one-click invite generation. The most prominent way to add friends. */
.friend-invite-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    margin-bottom: 18px;
    background: var(--accent-soft);
    border: 1px solid var(--accent-border);
    border-radius: 12px;
}
.friend-invite-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.friend-invite-text strong {
    color: var(--text-main);
    font-weight: 600;
    font-size: 0.95rem;
}
.friend-invite-text .muted {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.74rem;
}
.friend-invite-row .btn-small {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* "or search by username" divider */
.friends-or-divider {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 1.6px;
    margin: 4px 0 10px;
    position: relative;
}
.friends-or-divider::before,
.friends-or-divider::after {
    content: "";
    position: absolute;
    top: 50%;
    width: calc(50% - 70px);
    height: 1px;
    background: rgba(255, 255, 255, 0.06);
}
.friends-or-divider::before { left: 0; }
.friends-or-divider::after  { right: 0; }
.friends-or-divider span { padding: 0 10px; }

.friend-search {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}
.friend-search input {
    flex: 1;
}
.friend-search-results {
    margin-bottom: 14px;
}
.friend-search-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    margin-bottom: 4px;
}
.friend-search-row .friend-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.search-hint {
    text-align: center;
    padding: 8px 0;
}
.friends-subhead {
    margin: 14px 0 6px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.78rem;
}
.friend-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    margin-bottom: 6px;
}
.friend-name {
    color: var(--text-main);
    font-weight: 500;
    flex-shrink: 0;
}
.friend-status {
    flex: 1;
    font-size: 0.85rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.friend-status.online { color: var(--accent); }
.friend-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}
.invite-room {
    flex: 1;
    color: var(--accent);
    font-weight: 600;
}
.friend-invite-row {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.25);
}

/* Notification badge on the Profile button */
nav button { position: relative; }
.notif-badge {
    position: absolute;
    top: 2px;
    right: -2px;
    background: var(--danger);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    border-radius: 8px;
    padding: 0 4px;
    text-align: center;
    box-shadow: 0 0 0 2px var(--bg-base);
}

/* --- CHAT (1-on-1 DMs) --- */
.chat-card {
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 70vh;
    min-height: 480px;
}
.chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(0, 0, 0, 0.15);
}
.chat-header .btn-text {
    padding: 4px 8px;
    flex-shrink: 0;
}
.chat-partner-name {
    flex: 1;
    color: var(--text-main);
    font-size: 1.05rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.chat-bubble {
    max-width: 78%;
    padding: 10px 14px;
    border-radius: 16px;
    word-wrap: break-word;
    line-height: 1.35;
    font-size: 0.95rem;
    animation: chatBubbleIn 0.18s ease;
}
.chat-bubble.mine {
    align-self: flex-end;
    background: var(--accent-gradient);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.chat-bubble.theirs {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    border-bottom-left-radius: 4px;
}
@keyframes chatBubbleIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}
.chat-composer {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(0, 0, 0, 0.15);
}
.chat-composer input {
    flex: 1;
    margin: 0;
}
.chat-composer button {
    flex-shrink: 0;
    padding: 12px 18px;
}
.chat-gif-btn {
    flex-shrink: 0;
    padding: 0 12px;
    height: 40px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: var(--text-main);
    font-weight: 700;
    font-size: 0.78rem;
    letter-spacing: 1px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.chat-gif-btn:hover {
    background: rgba(123, 97, 255, 0.18);
    border-color: rgba(123, 97, 255, 0.4);
}
.chat-gif-btn:active { transform: scale(0.96); }

/* --- Chat polish: day separators, time labels, grouped bubbles --- */
.chat-day-sep {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 14px 0 6px;
    position: relative;
}
.chat-day-sep::before,
.chat-day-sep::after {
    content: "";
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
}
.chat-day-sep span {
    padding: 0 12px;
    font-size: 0.72rem;
    color: var(--text-muted);
    letter-spacing: 1px;
    text-transform: uppercase;
    font-weight: 600;
}
.chat-time-label {
    align-self: center;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin: 8px 0 2px;
    letter-spacing: 0.5px;
}
.chat-bubble.grouped {
    margin-top: -2px;
}
.chat-bubble.mine.grouped {
    border-top-right-radius: 6px;
}
.chat-bubble.theirs.grouped {
    border-top-left-radius: 6px;
}
.chat-bubble.emoji-only {
    background: transparent !important;
    border: none !important;
    padding: 2px 6px;
    font-size: 2.4rem;
    line-height: 1.1;
}
.chat-bubble a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.chat-bubble.theirs a {
    color: var(--accent);
}
.chat-bubble.is-gif {
    background: transparent !important;
    border: none !important;
    padding: 0;
    overflow: hidden;
    max-width: 240px;
}
.chat-bubble.is-gif img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.04);
}
.chat-empty {
    text-align: center;
    margin: auto;
}

/* --- GIF picker modal --- */
.gif-picker-content {
    max-width: 520px;
    width: 92vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    padding: 18px;
}
.gif-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.gif-picker-header h2 {
    margin: 0;
    font-size: 1.15rem;
}
.gif-picker-header .btn-text {
    padding: 4px 10px;
    font-size: 1.1rem;
}
#gif-picker-input {
    width: 100%;
    margin: 0 0 12px 0;
}
.gif-picker-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    overflow-y: auto;
    flex: 1;
    padding-right: 4px;
}
.gif-tile {
    padding: 0;
    border: none;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 1 / 1;
    transition: transform 0.12s, box-shadow 0.12s;
}
.gif-tile:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}
.gif-tile img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.gif-picker-footer {
    text-align: center;
    margin: 10px 0 0;
    font-size: 0.7rem;
}
@media (max-width: 480px) {
    .gif-picker-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Conversation list */
.chat-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 12px;
}
.chat-list-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.chat-list-row:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.18);
}
.chat-list-row.has-unread {
    background: rgba(123, 97, 255, 0.12);
    border-color: rgba(123, 97, 255, 0.3);
}
.chat-list-meta {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.chat-list-meta strong {
    color: var(--text-main);
}
.chat-list-preview {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}
.chat-unread-pill {
    background: var(--accent);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
    min-width: 22px;
    height: 22px;
    line-height: 22px;
    border-radius: 11px;
    padding: 0 7px;
    text-align: center;
    flex-shrink: 0;
}

/* Inline unread badge on the friend-row Message button */
.msg-badge {
    background: var(--danger);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    margin-left: 4px;
    vertical-align: middle;
}

/* --- ONBOARDING POPUP (first-visit explainer) --- */
.onboarding-content {
    max-width: 460px;
    width: 92vw;
    padding: 32px 28px 24px;
    text-align: center;
    animation: onboardingIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes onboardingIn {
    from { opacity: 0; transform: scale(0.92) translateY(8px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}
.onboarding-icon {
    font-size: 2.6rem;
    margin-bottom: 8px;
    line-height: 1;
}
.onboarding-title {
    font-family: 'Fraunces', 'Times New Roman', serif;
    font-size: 1.85rem;
    margin: 0 0 4px;
    font-weight: 500;
    font-variation-settings: 'opsz' 144, 'SOFT' 100;
}
.onboarding-tagline {
    color: var(--text-muted);
    font-size: 1rem;
    margin: 0 0 22px;
    font-style: italic;
}
.onboarding-steps {
    list-style: none;
    padding: 0;
    margin: 0 0 22px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    text-align: left;
}
.onboarding-steps li {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}
.onboarding-step-num {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent-gradient);
    color: white;
    font-weight: 700;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(123, 97, 255, 0.35);
}
.onboarding-steps strong {
    display: block;
    color: var(--text-main);
    font-size: 0.98rem;
    margin-bottom: 2px;
}
.onboarding-steps p {
    margin: 0;
    line-height: 1.4;
}
.onboarding-cta {
    font-size: 1rem;
    padding: 14px 18px;
    margin-bottom: 6px;
}
.onboarding-skip {
    display: block;
    width: 100%;
    text-align: center;
    font-size: 0.78rem;
    color: var(--text-muted);
    text-transform: none;
    letter-spacing: 0.3px;
    padding: 8px;
}
.onboarding-skip:hover {
    color: var(--text-main);
}
@media (max-width: 480px) {
    .onboarding-content { padding: 26px 20px 18px; }
    .onboarding-title { font-size: 1.55rem; }
}

/* --- FRIENDS TODAY (social card on home page) --- */
.friends-today-card { /* nothing extra — uses .card base */ }
.friends-today-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 4px;
}
.friends-today-header h2 { margin: 0; }
.friends-today-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 10px;
}
.friend-pick-row {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.friend-pick-row.is-mine {
    border-color: rgba(123, 97, 255, 0.35);
    background: rgba(123, 97, 255, 0.08);
}
.friend-pick-header {
    display: flex;
    align-items: center;
    gap: 10px;
}
.friend-pick-who {
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex: 1;
    min-width: 0;
}
.friend-pick-who strong {
    color: var(--text-main);
    font-size: 0.95rem;
}
.friend-pick-time {
    font-size: 0.78rem;
}
.friend-pick-song {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0, 0, 0, 0.18);
    border-radius: 10px;
    padding: 8px 10px;
}
.friend-pick-song img {
    width: 44px;
    height: 44px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
}
.friend-pick-song > div {
    flex: 1;
    min-width: 0;
}
.friend-pick-song .song-title,
.friend-pick-song .song-artist {
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.friend-pick-play-btn {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-gradient);
    color: white;
    border: none;
    font-size: 0.9rem;
    cursor: pointer;
}
.friend-reactions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.reaction-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s, transform 0.1s;
}
.reaction-btn:hover {
    background: rgba(255, 255, 255, 0.09);
    border-color: rgba(255, 255, 255, 0.2);
}
.reaction-btn:active { transform: scale(0.94); }
.reaction-btn.active {
    background: rgba(123, 97, 255, 0.18);
    border-color: rgba(123, 97, 255, 0.5);
}
.reaction-emoji { font-size: 0.95rem; }
.reaction-count {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 600;
    min-width: 8px;
}
.reaction-btn.active .reaction-count {
    color: var(--text-main);
}

/* --- POLISH PASS: header, mobile, hierarchy --- */
header {
    flex-wrap: wrap;
    gap: 12px;
}
nav {
    display: flex;
    gap: 2px;
    flex-wrap: wrap;
}
nav .btn-text {
    padding: 8px 14px 14px;       /* extra bottom padding so the active dot has room */
    font-size: 0.9rem;
    border-radius: 6px;
    letter-spacing: 0.6px;
    font-weight: 500;
    position: relative;
}
nav .btn-text:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-main);
}
/* Subtle indigo dot under the active page — nothing dramatic */
nav .btn-text.active {
    color: var(--text-main);
}
nav .btn-text.active::after {
    content: "";
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    background: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(123, 97, 255, 0.7);
}
@media (max-width: 480px) {
    .brand-logo { height: 24px; }
    nav .btn-text { padding: 6px 10px 12px; font-size: 0.82rem; }
    .stat-box { padding: 14px; }
    .lobby-code { font-size: 2.6rem; letter-spacing: 8px; }
    .chat-card { height: calc(100vh - 180px); }
}
.card { transition: transform 0.18s ease, box-shadow 0.18s ease; }
button { letter-spacing: 0.2px; }
.btn-text:focus-visible, .btn-primary:focus-visible, .btn-secondary:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* --- DAILY STREAK --- */
.daily-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
}
.daily-card-header h2 {
    margin: 0;
}
/* Stripped of the orange pill — flame stands alone next to clean off-white text. */
.streak-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: none;
    padding: 0;
    font-size: 0.85rem;
    color: var(--text-muted);
    flex-shrink: 0;
}
.streak-badge .streak-flame {
    font-size: 1rem;
    line-height: 1;
}
.streak-badge strong {
    color: var(--text-main);
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* Generic floating toast — used for share confirmations, info messages, etc. */
.app-toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: #1a1a1a;
    border: 1px solid var(--accent-border);
    color: var(--text-main);
    padding: 12px 22px;
    border-radius: 999px;
    font-size: 0.92rem;
    font-weight: 500;
    letter-spacing: 0.3px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.55), 0 0 24px rgba(123, 97, 255, 0.18);
    opacity: 0;
    transition: opacity 0.35s ease, transform 0.35s ease;
    z-index: 200;
    pointer-events: none;
    white-space: nowrap;
}
.app-toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
/* Streak-toast variant — gradient indigo, more celebratory */
.app-toast.streak-toast {
    background: var(--accent-gradient);
    border: none;
    color: #fff;
    font-size: 1.05rem;
    font-weight: 600;
    box-shadow: 0 8px 28px rgba(123, 97, 255, 0.45);
}

/* Share button — secondary action, used on daily card + results screen */
.share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin-top: 14px;
    padding: 12px 20px;
    border-radius: 999px;
    font-size: 0.92rem;
    font-weight: 500;
    letter-spacing: 0.3px;
}
.share-icon {
    font-size: 1rem;
    color: var(--accent);
    line-height: 1;
}

/* --- SEARCH MODE TOGGLE (Track / Artist) --- */
.search-mode-toggle {
    display: flex;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #2a2a2a;
    margin-bottom: 10px;
    background: rgba(255, 255, 255, 0.02);
}
.search-mode-toggle button {
    flex: 1;
    background: transparent;
    border: none;
    padding: 10px 8px;
    font-size: 0.92rem;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 0;
    box-shadow: none;
    font-weight: 600;
    transition: background 0.15s, color 0.15s;
}
.search-mode-toggle button:hover {
    color: var(--text-main);
}
.search-mode-toggle button.active {
    background: var(--accent-gradient);
    color: #fff;
}

/* --- ARTIST RESULT CARDS --- */
.artist-result-card {
    border-color: rgba(255, 255, 255, 0.25);
}
.artist-avatar {
    width: 50px;
    height: 50px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--secondary-gradient);
    border-radius: 8px;
    font-size: 1.6rem;
}
.artist-back-btn {
    margin-bottom: 8px;
    text-align: left;
    display: block;
}
.level-header {
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.78rem;
    color: var(--accent);
}
.album-result-card {
    border-color: rgba(255, 255, 255, 0.18);
}
.album-result-card img {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

/* --- SEARCH ROW (region picker + input) --- */
.search-row {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}
.search-row input[type="text"] {
    flex: 1;
    min-width: 0;
}
.search-region {
    width: auto;
    min-width: 130px;
    flex-shrink: 0;
    padding: 12px 10px;
    background: rgba(20, 15, 35, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 10px;
    color: var(--text-main);
    font-size: 0.95rem;
    cursor: pointer;
}
.search-region:focus {
    outline: none;
    border-color: var(--accent);
}

/* --- SONG RECAP (end-of-game) --- */
.song-recap {
    margin: 18px 0 8px;
}
.recap-round {
    margin: 14px 0 22px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
}
.recap-round-header {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.recap-round-num {
    color: var(--accent);
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-size: 0.85rem;
}
.recap-scenario {
    font-style: italic;
    line-height: 1.35;
}
.recap-song {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    margin: 6px 0;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
}
.recap-song.recap-winner {
    background: var(--selected-bg);
    border-color: rgba(123, 97, 255, 0.45);
    box-shadow: 0 0 16px rgba(123, 97, 255, 0.18);
}
.recap-song img {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    flex-shrink: 0;
}
.recap-meta {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.recap-meta strong {
    color: var(--text-main);
    font-size: 0.95rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.recap-artist, .recap-picker {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.recap-links {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}
.recap-link {
    display: inline-block;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 600;
    text-align: center;
    transition: background 0.15s, border-color 0.15s;
}
.recap-link:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--accent);
}
.recap-apple { color: #e8dfc8; }
.recap-spotify { color: var(--accent); }

.endgame-actions {
    margin-top: 24px;
}

/* --- LOCKIN COUNTER (gameplay) --- */
.lockin-status {
    margin: 18px 0 24px;
    background: transparent;
    border: none;
    padding: 0;
}
.lockin-label {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 8px;
}
.lockin-count {
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    font-size: 0.7rem;
    font-weight: 500;
}
.lockin-mine {
    color: var(--accent);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.3px;
}
.lockin-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 2px;
    overflow: hidden;
}
.lockin-bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.45s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 12px rgba(123, 97, 255, 0.45);
}

/* --- VOTING (progress + voted state) --- */
.vote-status {
    text-align: center;
    margin-bottom: 14px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 10px;
}
.song-result-card.voted-for {
    background: var(--selected-bg);
    border-color: rgba(123, 97, 255, 0.45);
}

/* --- GAMEPLAY STAGE (full-viewport song selection screen) ---
   Same takeover pattern as the discussion stage: when active, escape
   #app-container's max-width and use the entire viewport. Split into a
   slim top bar (room/round/timer + lockin progress) and a two-column
   body — 55% search on the left, 45% sticky preview on the right.
*/
#page-gameplay.view.active {
    position: fixed;
    inset: 0;
    z-index: 40;
    /* Slightly transparent so the ambient orbs still register behind the UI */
    background: rgba(10, 10, 10, 0.92);
    overflow: hidden;
    padding: 0;
    margin: 0;
    display: flex !important;
    flex-direction: column;
}
.gameplay-stage {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    box-sizing: border-box;
    overflow: hidden;
}

/* Top bar — room/round/timer + lockin counter, full width */
.gameplay-top {
    flex-shrink: 0;
    padding: 16px 24px 14px;
    border-bottom: 1px solid #1a1a1a;
    background: rgba(255, 255, 255, 0.01);
}
.gameplay-top .game-header {
    margin-bottom: 12px;
}
.gameplay-top .lockin-status {
    margin: 0;
}

/* Two-column layout */
.gameplay-columns {
    flex: 1;
    display: flex;
    min-height: 0; /* allow children to shrink + scroll */
    overflow: hidden;
}

/* LEFT: scenario + search + scrollable results */
.gameplay-left {
    flex: 0 0 55%;
    border-right: 1px solid #1a1a1a;
    overflow-y: auto;
    padding: 24px 28px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-width: 0;
}
.gameplay-scenario {
    flex-shrink: 0;
}
.gameplay-scenario .scenario-text {
    /* Slightly smaller in the gameplay context so it doesn't dominate the column */
    font-size: clamp(1.1rem, 2.4vw, 1.3rem);
    margin: 8px 0 12px;
}
.gameplay-search-controls {
    flex-shrink: 0;
}
.gameplay-results {
    flex: 1;
    min-height: 0;
    /* Each row is a tight clickable card; let the column scroll independently */
    display: flex;
    flex-direction: column;
    gap: 6px;
}
/* Tighter row treatment than the default .song-result-card */
.gameplay-results .song-result-card {
    padding: 10px 12px;
    margin-bottom: 0;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.gameplay-results .song-result-card:hover {
    background: rgba(123, 97, 255, 0.06);
    border-color: rgba(123, 97, 255, 0.25);
}
.gameplay-results .song-result-card .btn-select {
    /* Make the per-row button smaller and quieter — the row is the click target */
    padding: 6px 12px;
    font-size: 0.78rem;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-main);
    box-shadow: none;
}
.gameplay-results .song-result-card:hover .btn-select {
    background: var(--accent-gradient);
    color: #fff;
}

.gameplay-host-controls {
    flex-shrink: 0;
    padding-top: 6px;
}
.gameplay-locked-msg {
    text-align: center;
    color: var(--text-muted);
    padding: 14px 0;
    font-size: 0.9rem;
}

/* RIGHT: sticky preview panel */
.gameplay-right {
    flex: 0 0 45%;
    padding: 24px 28px;
    display: flex;
    flex-direction: column;
    position: relative;
    min-width: 0;
    overflow: hidden;
}
.gameplay-preview {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}
/* Empty state — soft placeholder when nothing's selected yet */
.preview-empty {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.95rem;
    letter-spacing: 0.3px;
    border: 1px dashed rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    min-height: 280px;
}

/* Selected song detail */
.preview-art-wrap {
    width: clamp(180px, 22vw, 280px);
    height: clamp(180px, 22vw, 280px);
    margin: 12px auto 18px;
    flex-shrink: 0;
    position: relative;
}
.preview-art {
    width: 100%;
    height: 100%;
    border-radius: 14px;
    object-fit: cover;
    box-shadow:
        0 16px 48px rgba(0, 0, 0, 0.6),
        0 0 60px rgba(123, 97, 255, 0.16);
}
.preview-title {
    font-size: clamp(1.2rem, 1.8vw, 1.5rem);
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
    letter-spacing: -0.01em;
    line-height: 1.2;
    max-width: 100%;
    /* Two-line clamp so absurdly long titles don't blow up the panel */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.preview-artist {
    color: var(--text-muted);
    font-size: 1rem;
    margin: 6px 0 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}
.preview-snippet {
    width: 100%;
    max-width: 360px;
    margin: 22px auto 0;
}
.preview-no-audio {
    margin-top: 18px;
    text-align: center;
    max-width: 360px;
}

/* Lock In button — pinned at the bottom of the right panel, full width */
.gameplay-lockin-btn {
    width: 100%;
    margin-top: 16px;
    margin-bottom: 56px;  /* leave space for the volume control in the corner */
    padding: 14px 24px;
    border-radius: 999px;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}
.gameplay-lockin-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
    box-shadow: none;
    transform: none;
}

/* Volume control — bottom-right corner of the right panel */
.gameplay-volume {
    position: absolute;
    bottom: 14px;
    right: 14px;
    z-index: 10;
}

/* Mobile: stack columns vertically, drop the divider, allow full scroll */
@media (max-width: 768px) {
    .gameplay-columns { flex-direction: column; }
    .gameplay-left, .gameplay-right { flex: 1 0 auto; padding: 18px 20px; }
    .gameplay-left { border-right: none; border-bottom: 1px solid #1a1a1a; }
    .gameplay-right { padding-bottom: 80px; } /* room for absolute volume control */
    .preview-art-wrap { width: clamp(160px, 50vw, 220px); height: clamp(160px, 50vw, 220px); }
    .gameplay-lockin-btn { margin-bottom: 16px; }
    .gameplay-volume { bottom: 10px; right: 10px; }
}


/* --- VOLUME CONTROL (shared between discussion + gameplay stages) --- */
.vol-control {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: 160px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 999px;
}
.vol-control .vol-icon {
    font-size: 0.85rem;
    color: var(--text-muted);
    flex-shrink: 0;
    line-height: 1;
}
.vol-control .vol-display {
    font-size: 0.7rem;
    color: var(--text-muted);
    min-width: 30px;
    text-align: right;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}
.vol-control .vol-slider {
    flex: 1;
    width: 100%;
    height: 14px;
    background: transparent;
    margin: 0;
    padding: 0;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}
.vol-control .vol-slider:focus { outline: none; box-shadow: none; }
.vol-control .vol-slider::-webkit-slider-runnable-track {
    height: 3px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 2px;
}
.vol-control .vol-slider::-moz-range-track {
    height: 3px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 2px;
}
.vol-control .vol-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 6px rgba(123, 97, 255, 0.55);
    cursor: pointer;
    margin-top: -4px;
    transition: transform 0.15s ease;
}
.vol-control .vol-slider::-webkit-slider-thumb:hover { transform: scale(1.25); }
.vol-control .vol-slider::-moz-range-thumb {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 6px rgba(123, 97, 255, 0.55);
    cursor: pointer;
    border: none;
}


/* --- DISCUSSION STAGE (full-viewport cinematic playback) ---
   The discussion screen takes over the entire viewport while it's active —
   bypasses #app-container's max-width / padding to feel like a moment.
*/
#page-discussion.view.active {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex !important;
    flex-direction: column;
    /* Mostly opaque so the album-art glow doesn't fight with bg orbs, but
       slightly transparent so a hint of ambient atmosphere bleeds through. */
    background: rgba(10, 10, 10, 0.92);
    overflow: hidden;
    padding: 0;
    margin: 0;
}

.discussion-stage {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100vh;
    height: 100dvh; /* dynamic viewport height for iOS */
    padding: 18px 20px 20px;
    box-sizing: border-box;
    overflow: hidden;       /* hard guarantee — content never spills past the screen */
    justify-content: center;
    position: relative;     /* anchor for the absolutely-positioned volume control */
}

/* --- Splash mode: who's up, no song info revealed yet --- */
.discussion-splash-mode {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    text-align: center;
    animation: splashFadeIn 0.45s ease;
}
.discussion-splash-mode .splash-label {
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 4px;
    font-size: 0.78rem;
    margin-bottom: 4px;
}
.discussion-splash-mode .splash-player {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: clamp(2.5rem, 9vw, 4rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    margin: 0;
    line-height: 1.1;
    animation: splashPulse 1.4s ease-in-out infinite;
}
@keyframes splashFadeIn {
    from { opacity: 0; transform: scale(0.96); }
    to   { opacity: 1; transform: scale(1); }
}
@keyframes splashPulse {
    0%, 100% { opacity: 0.85; }
    50%      { opacity: 1; }
}

/* --- Song mode: the cinematic stage --- */
.discussion-song-mode {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    height: 100%;
    overflow: hidden;
    animation: songFadeIn 0.5s ease;
}
@keyframes songFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.discussion-top {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 0 0 10px;
    flex-shrink: 0;
}
.discussion-count-badge {
    display: inline-block;
    padding: 5px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    color: var(--text-muted);
    font-size: 0.74rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}
/* The scenario the room is responding to — small italic serif caption so
   listeners remember the prompt while a song plays. */
.discussion-scenario-caption {
    font-family: var(--font-serif);
    font-size: clamp(0.92rem, 1.6vw, 1.05rem);
    font-style: italic;
    color: var(--text-muted);
    text-align: center;
    max-width: 88%;
    margin: 0 auto;
    line-height: 1.4;
    letter-spacing: 0.005em;
    opacity: 0.85;
    /* Cap at 2 lines so a long scenario doesn't push the album art down */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.discussion-center {
    flex: 1;
    min-height: 0; /* allow flex shrinking inside the locked-height stage */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    gap: 12px;
    /* Make this the stacking context so children render above the album glow */
    position: relative;
    z-index: 1;
}
/* All children of the center column drop their own margins — gap controls
   spacing uniformly so nothing fights with the column's justify-content. */
.discussion-center > * {
    margin-top: 0;
    margin-bottom: 0;
    position: relative;
    z-index: 2;  /* sit above the radial glow */
}

/* Album art with indigo radial glow behind it. The glow is two stacked
   gradients via a pseudo + box-shadow combo for depth without harshness. */
.discussion-art-wrap {
    position: relative;
    /* Capped at 240px so the timer + button never get pushed off the
       bottom on standard viewport heights (~720-800px). */
    width: clamp(180px, 42vh, 240px);
    height: clamp(180px, 42vh, 240px);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    z-index: 2; /* above the glow which sits at z-index: 0 inside */
}
.discussion-art-glow {
    position: absolute;
    inset: -56px;
    background: radial-gradient(
        circle at center,
        rgba(123, 97, 255, 0.50) 0%,
        rgba(123, 97, 255, 0.18) 38%,
        rgba(123, 97, 255, 0) 70%
    );
    filter: blur(36px);
    border-radius: 50%;
    animation: glowPulse 4s ease-in-out infinite;
    z-index: 0;
    pointer-events: none;
}
.discussion-art {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 18px;
    object-fit: cover;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.7),
        0 0 80px rgba(123, 97, 255, 0.20);
    z-index: 1;
}
@keyframes glowPulse {
    0%, 100% { opacity: 0.65; transform: scale(1); }
    50%      { opacity: 0.95; transform: scale(1.06); }
}

.discussion-title {
    font-size: clamp(1.3rem, 4.2vw, 1.5rem);
    font-weight: 700;
    color: var(--text-main);
    text-align: center;
    letter-spacing: -0.01em;
    line-height: 1.2;
    max-width: 92%;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    /* Slight halo so the title pops against the album glow's faint indigo bleed */
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
}
.discussion-artist-name {
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-muted);
    text-align: center;
    max-width: 92%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.discussion-submitted {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-align: center;
    opacity: 0.75;
    letter-spacing: 0.3px;
}

/* Phase indicator: animated waveform + label */
.discussion-phase-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
    font-size: 0.85rem;
    letter-spacing: 0.6px;
}
.audio-waveform {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    height: 22px;
}
.audio-waveform .bar {
    width: 3px;
    height: 22px;
    background: var(--accent);
    border-radius: 2px;
    transform-origin: center;
    animation: wave-bar 1.1s ease-in-out infinite;
}
.audio-waveform .bar:nth-child(1) { animation-delay: 0s;    }
.audio-waveform .bar:nth-child(2) { animation-delay: 0.18s; }
.audio-waveform .bar:nth-child(3) { animation-delay: 0.36s; }
.audio-waveform .bar:nth-child(4) { animation-delay: 0.54s; }
.audio-waveform.paused .bar {
    animation-play-state: paused;
    transform: scaleY(0.2);
    opacity: 0.3;
}
@keyframes wave-bar {
    0%, 100% { transform: scaleY(0.25); }
    50%      { transform: scaleY(1);    }
}

/* Timer with circular progress ring */
.timer-ring-wrap {
    position: relative;
    width: 80px;
    height: 80px;
    flex-shrink: 0;
}
.timer-ring-svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}
.ring-track {
    fill: none;
    stroke: rgba(255, 255, 255, 0.06);
    stroke-width: 3;
}
.ring-progress {
    fill: none;
    stroke: var(--accent);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-dasharray: 289;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 0.95s linear;
    filter: drop-shadow(0 0 6px rgba(123, 97, 255, 0.55));
}
.ring-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.02em;
}

/* --- Bottom region: up-next pill, CTA, volume --- */
.discussion-bottom {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;  /* center the up-next pill + capped CTA */
    gap: 12px;
    padding-top: 12px;
    /* Add right padding so wide bottom content doesn't sit under the
       absolutely-positioned volume control on small screens */
    padding-right: 8px;
    padding-left: 8px;
    flex-shrink: 0;
}

.discussion-up-next-banner {
    align-self: center;
    display: inline-block;
    padding: 7px 18px;
    background: rgba(123, 97, 255, 0.10);
    border: 1px solid rgba(123, 97, 255, 0.35);
    border-radius: 999px;
    color: var(--accent-2);
    font-size: 0.85rem;
    text-align: center;
    animation: pillGlow 3s ease-in-out infinite;
}
.discussion-up-next-banner strong {
    color: var(--text-main);
    font-weight: 600;
}
.discussion-up-next-banner.last-song {
    background: rgba(123, 97, 255, 0.18);
    border-color: rgba(123, 97, 255, 0.55);
    color: var(--text-main);
    font-weight: 500;
    animation: pillGlowLast 2.6s ease-in-out infinite;
}
@keyframes pillGlow {
    0%, 100% { box-shadow: 0 0 18px rgba(123, 97, 255, 0.18); }
    50%      { box-shadow: 0 0 32px rgba(123, 97, 255, 0.36); }
}
@keyframes pillGlowLast {
    0%, 100% { box-shadow: 0 0 22px rgba(123, 97, 255, 0.30); }
    50%      { box-shadow: 0 0 40px rgba(123, 97, 255, 0.55); }
}

/* CTA — pill-shaped, centred, capped at 320px so it reads as a button, not a banner */
.discussion-controls {
    width: 100%;
    display: flex;
    justify-content: center;
}
.discussion-cta {
    width: 100%;
    max-width: 320px;
    padding: 14px 28px !important;
    border-radius: 999px !important;
    font-size: 0.95rem !important;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Discussion-stage volume — only positioning here. Visuals come from .vol-control. */
.discussion-volume {
    position: absolute;
    bottom: 16px;
    right: 16px;
    z-index: 10;
}

/* Mobile tweaks — keep everything on one screen even on small phones */
@media (max-width: 480px) {
    .discussion-stage { padding: 14px 14px 16px; }
    .discussion-art-wrap { width: clamp(170px, 38vh, 220px); height: clamp(170px, 38vh, 220px); }
    .discussion-title { font-size: 1.2rem; }
    .discussion-artist-name { font-size: 0.9rem; }
    .discussion-submitted { font-size: 0.72rem; }
    .timer-ring-wrap { width: 70px; height: 70px; }
    .ring-text { font-size: 1.15rem; }
    .discussion-cta { padding: 12px 22px !important; font-size: 0.92rem !important; max-width: 280px; }
    .discussion-bottom { gap: 10px; padding-top: 10px; }
    .discussion-up-next-banner { font-size: 0.78rem; padding: 6px 14px; }
    /* Volume slightly smaller + tighter to corner on phones */
    .discussion-volume { width: 140px; bottom: 10px; right: 10px; padding: 5px 10px; }
    .discussion-volume .vol-display { font-size: 0.65rem; min-width: 26px; }
    .discussion-center { gap: 10px; }
}
@media (max-height: 720px) {
    .discussion-art-wrap { width: clamp(170px, 34vh, 220px); height: clamp(170px, 34vh, 220px); }
    .discussion-center { gap: 10px; }
}
@media (max-height: 600px) {
    .discussion-art-wrap { width: clamp(150px, 28vh, 190px); height: clamp(150px, 28vh, 190px); }
    .discussion-title { font-size: 1.1rem; }
    .discussion-submitted { display: none; } /* lowest-priority line — hide on tiny screens */
    .timer-ring-wrap { width: 64px; height: 64px; }
    .ring-text { font-size: 1.05rem; }
}

/* --- PROFILE AVATAR --- */
/* --- PROFILE CARD (revamped) --- */
.profile-card {
    padding: 28px;
}
.profile-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 4px;
    margin-bottom: 24px;
}
.profile-username {
    font-size: clamp(1.5rem, 4vw, 1.9rem);
    font-weight: 700;
    color: var(--text-main);
    margin: 8px 0 0;
    letter-spacing: -0.01em;
}
.profile-joined {
    color: var(--text-muted);
    font-size: 0.82rem;
    margin: 0;
}

/* Section labels — small, uppercase, muted, used to break up profile */
.profile-section-label {
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.8px;
    font-size: 0.7rem;
    font-weight: 500;
    margin-bottom: 10px;
}

/* Bio block — sits between hero and stats */
.profile-bio-block {
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 8px;
    position: relative;
}
.profile-bio-text {
    margin: 0;
    color: var(--text-main);
    font-size: 0.95rem;
    line-height: 1.45;
    white-space: pre-wrap;
    word-wrap: break-word;
    padding-right: 50px; /* space for the Edit button */
}
.profile-bio-text.profile-bio-empty {
    color: var(--text-muted);
    font-style: italic;
}
.profile-bio-edit {
    position: absolute;
    top: 10px;
    right: 12px;
    font-size: 0.78rem;
    padding: 4px 10px;
    color: var(--accent);
}
.profile-bio-edit:hover { color: var(--accent-2); }

/* Recent picks list — own profile only, last few unique tracks */
.profile-recent-picks {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.recent-pick-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
}
.recent-pick-art {
    width: 44px;
    height: 44px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
}
.recent-pick-meta {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.recent-pick-meta strong {
    color: var(--text-main);
    font-size: 0.92rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.recent-pick-meta span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.recent-pick-count {
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

/* Public profile bio — same treatment as own */
.public-bio {
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 14px 16px;
    margin: 0 auto 18px;
    max-width: 90%;
    color: var(--text-main);
    font-size: 0.95rem;
    line-height: 1.45;
    white-space: pre-wrap;
    word-wrap: break-word;
    text-align: left;
}

.profile-avatar-wrapper {
    position: relative;
    display: inline-block;
    margin: 6px auto 4px;
    width: 100px;
    height: 100px;
}
/* Initial-letter fallback when the user hasn't uploaded a photo —
   matches the public-avatar-fallback styling for consistency. */
#profile-avatar-placeholder {
    width: 100px;
    height: 100px;
    margin: 0;
    border-radius: 50%;
    background: var(--accent-soft);
    border: 2px solid var(--accent-border);
    color: var(--accent-2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.4rem;
    font-weight: 700;
}
.avatar-img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent-border);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4), 0 0 24px rgba(123, 97, 255, 0.18);
}
/* Public profile reuses .avatar-img — no need to redefine */
.avatar-upload-label {
    position: absolute;
    bottom: 0;
    right: -4px;
    background: var(--accent-gradient);
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
    transition: transform 0.2s;
    user-select: none;
}
.avatar-upload-label:hover { transform: scale(1.12); }

/* --- LEADERBOARD ROWS --- */
.leaderboard-rank {
    min-width: 36px;
    text-align: center;
    font-weight: 700;
    color: var(--accent);
    font-size: 1rem;
}
.leaderboard-count {
    text-align: right;
    min-width: 70px;
}
.leaderboard-count strong {
    color: var(--text-main);
    font-size: 1.1rem;
    font-weight: 600;
}
