@import url('main.css');

/* ===== Background ===== */
.animated-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
    background: radial-gradient(ellipse 80% 60% at 50% -10%, rgba(94, 184, 255, 0.08), transparent 55%);
}
.bg-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.22;
    animation: orbFloat 28s ease-in-out infinite;
}
.bg-orb-1 { width: 420px; height: 420px; background: #1e4a8a; top: -15%; left: -8%; }
.bg-orb-2 { width: 360px; height: 360px; background: #3d2d7a; bottom: -8%; right: -6%; animation-delay: -9s; }
.bg-orb-3 { width: 280px; height: 280px; background: #1a3a6a; top: 45%; left: 55%; animation-delay: -18s; opacity: 0.12; }
@keyframes orbFloat {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(16px, -12px); }
}

/* ===== Layout ===== */
.audience-page { min-height: 100vh; position: relative; }
.audience-container {
    flex-direction: column;
    align-items: stretch;
    max-width: 480px;
    margin: 0 auto;
    padding: 0.5rem 1rem 6.5rem;
    position: relative;
    z-index: 2;
}
.join-page-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    max-width: 100%;
    min-height: 100dvh;
    padding: 1rem 16px 2rem;
    margin: 0 auto;
    box-sizing: border-box;
    position: relative;
    z-index: 2;
    overflow-x: clip;
}
.join-page-container .logo-slot {
    width: 100%;
    max-width: min(100%, 520px);
    margin-inline: auto;
    padding: 0.35rem 0 0.85rem;
    flex-shrink: 0;
}
.join-page-container .join-card {
    width: min(100%, 480px);
    max-width: 520px;
    margin-inline: auto;
    flex-shrink: 0;
}

html[dir="rtl"] .join-page-container,
html[dir="rtl"] .join-page-container .logo-slot,
html[dir="rtl"] .join-page-container .join-card {
    align-items: center;
    margin-inline: auto;
}

/* ===== Treble clef & stage ===== */
.treble-clef-wrap {
    position: fixed;
    z-index: 1;
    pointer-events: none;
    inset-inline-end: -8%;
    top: 50%;
    transform: translateY(-50%);
    width: min(42vw, 200px);
    height: min(55vh, 320px);
    opacity: 0.22;
}
.join-treble-clef, .scene-treble-clef {
    inset-inline-end: auto;
    inset-inline-start: 50%;
    top: 38%;
    transform: translate(-50%, -50%);
    width: min(65vw, 220px);
    height: auto;
    opacity: 0.28;
    z-index: 1;
}
html[dir="rtl"] .join-treble-clef, html[dir="rtl"] .scene-treble-clef { transform: translate(50%, -50%); }
.treble-clef {
    width: 100%;
    height: auto;
    animation: clefFloat 8s ease-in-out infinite;
}
@keyframes clefFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
}
@media (prefers-reduced-motion: reduce) {
    .treble-clef { animation: none; }
}
.sound-wave {
    position: absolute;
    bottom: 10%;
    left: 50%;
    transform: translateX(-50%);
    width: 120%;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(142, 200, 255, 0.35), transparent);
    border-radius: 2px;
    opacity: 0.5;
}
.sound-wave-1 { animation: wavePulse 4s ease-in-out infinite; bottom: 18%; }
.sound-wave-2 { animation: wavePulse 4s ease-in-out infinite 1.5s; bottom: 8%; width: 90%; opacity: 0.35; }
@keyframes wavePulse {
    0%, 100% { transform: translateX(-50%) scaleX(0.85); opacity: 0.3; }
    50% { transform: translateX(-50%) scaleX(1); opacity: 0.6; }
}
.stage-light {
    position: fixed;
    top: -20%;
    left: 50%;
    transform: translateX(-50%);
    width: 140%;
    height: 55%;
    background: radial-gradient(ellipse at center top, rgba(94, 184, 255, 0.14), transparent 65%);
    pointer-events: none;
    z-index: 0;
}
.stage-spot {
    position: fixed;
    width: 45vw;
    height: 45vh;
    border-radius: 50%;
    filter: blur(80px);
    pointer-events: none;
    z-index: 0;
    animation: spotDrift 18s ease-in-out infinite;
}
.stage-spot-left { left: -10%; top: 10%; background: rgba(94, 184, 255, 0.08); }
.stage-spot-right { right: -10%; top: 15%; background: rgba(139, 124, 247, 0.07); animation-delay: -8s; }
@keyframes spotDrift {
    0%, 100% { transform: translate(0, 0); opacity: 0.6; }
    50% { transform: translate(20px, 12px); opacity: 0.9; }
}

/* ===== Audience scene (violin, guitar, floats) ===== */
.audience-scene {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}
.scene-instrument {
    position: absolute;
    pointer-events: none;
    opacity: 0.22;
}
.scene-violin {
    left: -2%;
    bottom: 8%;
    width: min(28vw, 120px);
    animation: instrumentFloat 12s ease-in-out infinite;
}
.scene-guitar {
    right: -3%;
    bottom: 12%;
    width: min(32vw, 140px);
    animation: instrumentFloat 14s ease-in-out infinite reverse;
}
@keyframes instrumentFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}
.guitar-melody-stream {
    position: absolute;
    left: 20%;
    top: 0;
    width: 60%;
    height: 100%;
    overflow: visible;
}
.guitar-melody-note {
    position: absolute;
    left: 50%;
    bottom: 55%;
    width: 10px;
    height: 14px;
    border: 1.5px solid rgba(126, 200, 255, 0.5);
    border-radius: 0 0 6px 6px;
    transform: translateX(-50%);
    animation: melodyRise 8s ease-out forwards;
    opacity: 0;
}
.guitar-melody-note::after {
    content: '';
    position: absolute;
    top: -5px;
    right: -2px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: rgba(212, 175, 106, 0.55);
}
@keyframes melodyRise {
    0% { opacity: 0; transform: translate(-50%, 0) rotate(-8deg); }
    10% { opacity: 0.45; }
    100% { opacity: 0; transform: translate(calc(-50% + var(--mx, 20px)), -140px) rotate(12deg); }
}
.bg-float-layer {
    position: absolute;
    inset: 0;
    overflow: hidden;
}
.bg-float-note, .bg-float-mic {
    position: absolute;
    pointer-events: none;
    color: rgba(126, 200, 255, 0.55);
}
.bg-float-note {
    width: 12px;
    height: 16px;
    border: 1.5px solid currentColor;
    border-radius: 0 0 6px 6px;
}
.bg-float-run {
    animation: bgFloatRun linear forwards;
}
@keyframes bgFloatRun {
    0% { opacity: 0; transform: translate(0, 0) scale(var(--float-scale, 1)) rotate(var(--float-rot, 0deg)); }
    12% { opacity: 1; }
    100% { opacity: 0; transform: translate(var(--float-dx, 0), var(--float-dy, -120px)) scale(var(--float-scale, 1)) rotate(calc(var(--float-rot, 0deg) + 25deg)); }
}

/* ===== Logo slot (see brand.css for shared rules) */
.logo-slot {
    padding: 0.35rem 0 0.65rem;
}

/* ===== Headphones indicator ===== */
.headphones-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin: 0 auto 1rem;
    color: var(--accent);
}
.hp-icon {
    width: 48px;
    height: 40px;
    animation: hpVibrate 2.8s ease-in-out infinite;
}
.hp-wave {
    width: 3px;
    height: 14px;
    border-radius: 2px;
    background: linear-gradient(to top, var(--accent), var(--accent-purple));
    animation: hpWave 1.1s ease-in-out infinite;
}
.hp-wave-left { animation-delay: 0s; }
.hp-wave-right { animation-delay: 0.25s; }
@keyframes hpWave {
    0%, 100% { height: 8px; opacity: 0.4; }
    50% { height: 22px; opacity: 1; }
}
@keyframes hpVibrate {
    0%, 100% { transform: translateY(0); }
    25% { transform: translateY(-1px); }
    75% { transform: translateY(1px); }
}

.wireless-icon {
    display: inline-flex;
    color: var(--accent);
    opacity: 0.85;
}

@media (max-width: 430px) {
    .scene-violin { width: min(36vw, 90px); left: -4%; bottom: 6%; opacity: 0.18; }
    .scene-guitar { width: min(40vw, 100px); right: -6%; opacity: 0.18; }
}

@media (prefers-reduced-motion: reduce) {
    .scene-instrument, .stage-spot, .guitar-melody-note, .bg-float-run, .hp-icon, .hp-wave { animation: none !important; }
}

/* ===== Header ===== */
.audience-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    padding: 0.75rem 0 1rem;
    min-width: 0;
}
.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}
.user-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.9rem;
    background: var(--surface);
    border-radius: 999px;
    border: 1px solid var(--border);
    font-size: 0.8125rem;
    font-weight: 600;
    flex: 1 1 auto;
    min-width: 0;
    max-width: min(100%, 260px);
}
.user-badge .user-avatar {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}
.user-name-text,
#user-name {
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
}
@media (max-width: 480px) {
    .audience-header {
        flex-direction: column;
        align-items: stretch;
    }
    .user-badge {
        max-width: 100%;
        width: 100%;
    }
    .header-actions {
        width: 100%;
        justify-content: space-between;
    }
}
.btn-logout {
    padding: 0.45rem 0.85rem;
    font-size: 0.75rem;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    font-family: inherit;
    transition: color var(--transition), border-color var(--transition);
}
.btn-logout:hover:not(:disabled) { color: var(--text-primary); border-color: var(--border-hover); }

/* ===== Join ===== */
.join-card {
    max-width: 520px;
    width: min(100%, 480px);
    margin-inline: auto;
    text-align: center;
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
    min-width: 0;
    box-shadow: var(--shadow), var(--shadow-glow);
    z-index: 2;
}
.join-page-container .join-card.glass-card,
.join-page .join-card {
    background: rgba(10, 18, 38, 0.70);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    border-color: rgba(120, 160, 220, 0.14);
}
.join-card::before {
    content: '';
    position: absolute;
    top: -40%;
    left: 50%;
    transform: translateX(-50%);
    width: 120%;
    height: 60%;
    background: radial-gradient(ellipse, rgba(94, 184, 255, 0.12), transparent 70%);
    pointer-events: none;
}
.join-hero { margin-bottom: 1.25rem; position: relative; z-index: 1; }
.join-hero h1 {
    font-size: 1.625rem;
    margin: 0.75rem 0 0.4rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}
.join-tagline { color: var(--text-secondary); font-size: 0.9375rem; line-height: 1.55; max-width: 28ch; margin: 0 auto; }
.join-form-wrap { position: relative; z-index: 2; text-align: left; }
.join-eq { margin: 1.25rem auto; }

/* ===== Equalizer ===== */
.equalizer {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 4px;
    height: 44px;
}
.eq-bar {
    display: block;
    width: 3px;
    background: linear-gradient(to top, var(--accent), var(--accent-purple));
    border-radius: 2px;
    animation: eqBounce 1.4s ease-in-out infinite;
    animation-delay: calc(var(--eq-i) * 0.07s);
    height: 18%;
    opacity: 0.65;
}
@keyframes eqBounce {
    0%, 100% { height: 12%; opacity: 0.4; }
    50% { height: 88%; opacity: 1; }
}
.equalizer.eq-paused .eq-bar { animation-play-state: paused; opacity: 0.25; }

/* ===== Screens ===== */
.screen {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity var(--transition-slow), transform var(--transition-slow);
    pointer-events: none;
    height: 0;
    overflow: hidden;
}
.screen.hidden { opacity: 0; pointer-events: none; height: 0; overflow: hidden; margin: 0; padding: 0; }
.screen.screen-active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    height: auto;
    overflow: visible;
}

/* ===== Waiting ===== */
.waiting-card {
    text-align: center;
    padding: 2rem 1.25rem;
    position: relative;
}
.waiting-card h2 { margin-bottom: 0.5rem; font-size: 1.25rem; font-weight: 600; color: var(--text-primary); }
.waiting-card p { color: var(--text-secondary); font-size: 0.9rem; }
.waiting-tip { margin-top: 0.85rem; font-size: 0.8125rem; color: var(--accent); opacity: 0.75; }
.waiting-eq { margin-bottom: 1.25rem; }
.pulse-ring {
    width: 56px; height: 56px;
    margin: 0 auto 1rem;
    border: 1px solid rgba(94, 184, 255, 0.35);
    border-radius: 50%;
    animation: pulseRing 3s ease infinite;
}
@keyframes pulseRing {
    0%, 100% { transform: scale(1); opacity: 0.7; }
    50% { transform: scale(1.06); opacity: 0.35; }
}

/* ===== Countdown ===== */
.voting-header { text-align: center; margin-bottom: 1rem; }
.voting-header h2 { margin-bottom: 0.75rem; font-size: 1.125rem; font-weight: 600; }
.countdown-wrap { position: relative; width: 108px; height: 108px; margin: 0 auto; }
.countdown-ring { position: absolute; inset: 0; transform: rotate(-90deg); }
.countdown-ring-bg { fill: none; stroke: rgba(255,255,255,0.06); stroke-width: 3; }
.countdown-ring-progress {
    fill: none;
    stroke: var(--accent);
    stroke-width: 3;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.85s linear, stroke 0.3s;
}
.countdown-wrap.urgent .countdown-ring-progress { stroke: var(--accent-gold); }
.countdown-wrap.pulse-soft { animation: countdownPulse 1.2s ease infinite; }
@keyframes countdownPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.02); } }
.countdown-timer {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 2.125rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--accent);
    line-height: 1;
}
.countdown-label {
    font-size: 0.625rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-top: 0.15rem;
}
.countdown-wrap.urgent .countdown-timer { color: var(--accent-gold); }

/* ===== Vote cards ===== */
.vote-cards { display: flex; flex-direction: column; gap: 0.875rem; }
.vote-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.125rem 1.125rem 1rem;
    cursor: pointer;
    transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
    position: relative;
}
.vote-card:hover { border-color: var(--border-hover); transform: translateY(-2px); }
.vote-card.selected {
    border-color: rgba(94, 184, 255, 0.55);
    box-shadow: 0 0 24px var(--accent-glow);
    transform: translateY(-3px);
}
.vote-card.vote-flash { animation: voteFlash 0.5s ease; }
@keyframes voteFlash {
    0%, 100% { box-shadow: 0 0 24px var(--accent-glow); }
    50% { box-shadow: 0 0 36px rgba(94, 184, 255, 0.45); }
}
.vote-card.selected::after {
    content: '';
    position: absolute;
    top: 0.75rem;
    inset-inline-end: 0.75rem;
    width: 22px;
    height: 22px;
    background: var(--accent);
    border-radius: 50%;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2 6l3 3 5-5' stroke='%23fff' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    animation: popIn 0.28s cubic-bezier(0.34, 1.4, 0.64, 1);
}
@keyframes popIn { from { transform: scale(0); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.card-title { font-size: 1.0625rem; font-weight: 700; margin-bottom: 0.2rem; padding-inline-end: 2rem; line-height: 1.3; }
.card-artist { color: var(--text-secondary); font-size: 0.875rem; margin-bottom: 0.45rem; }
.card-genre-tag {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    background: rgba(139, 124, 247, 0.15);
    color: #b8adf5;
    border-radius: 999px;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.75rem;
}
.battery-wrap { margin: 0.5rem 0 0.75rem; }
.vote-card .vote-btn {
    margin-top: 0.5rem;
    width: 100%;
    pointer-events: none;
    padding: 0.65rem;
    font-size: 0.875rem;
}

/* ===== Battery indicator ===== */
.battery-indicator {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}
.battery-body {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 3px;
    min-width: 0;
}
.battery-segments {
    flex: 1;
    display: flex;
    gap: 3px;
    padding: 5px 6px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.25);
    min-height: 22px;
}
.battery-segment {
    flex: 1;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.06);
    transition: background var(--transition), opacity var(--transition), transform var(--transition);
    transform: scaleY(0.85);
    opacity: 0.35;
}
.battery-segment.active {
    background: linear-gradient(180deg, var(--accent), #4a7fd4);
    opacity: 1;
    transform: scaleY(1);
    box-shadow: 0 0 6px rgba(94, 184, 255, 0.35);
}
.battery-segment.active.changed {
    animation: segmentFill 0.35s ease forwards;
    animation-delay: calc(var(--seg-i) * 0.04s);
}
.battery-leader .battery-segment.active {
    background: linear-gradient(180deg, var(--accent-gold), #b89450);
    box-shadow: 0 0 8px var(--accent-gold-glow);
}
@keyframes segmentFill {
    from { opacity: 0.3; transform: scaleY(0.6); }
    to { opacity: 1; transform: scaleY(1); }
}
.battery-cap {
    width: 4px;
    height: 10px;
    border-radius: 0 2px 2px 0;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-left: none;
    background: rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
}
html[dir="rtl"] .battery-cap {
    border-radius: 2px 0 0 2px;
    border-left: 1px solid rgba(255, 255, 255, 0.14);
    border-right: none;
}
.battery-percent {
    font-size: 1.375rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--accent);
    min-width: 3.25rem;
    text-align: end;
}
.battery-leader .battery-percent { color: var(--accent-gold); }

/* ===== Results ===== */
.result-card {
    text-align: center;
    padding: 1.75rem 1.25rem 1.5rem;
    position: relative;
    overflow: hidden;
    z-index: 5;
}
.result-spotlight {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 90% 50% at 50% 0%, rgba(94, 184, 255, 0.1), transparent 65%);
    pointer-events: none;
}
.result-win-mode .result-spotlight {
    background: radial-gradient(ellipse 90% 55% at 50% 0%, rgba(212, 175, 106, 0.14), transparent 60%);
}
.result-lose-mode .result-spotlight {
    background: radial-gradient(ellipse 90% 50% at 50% 0%, rgba(139, 124, 247, 0.1), transparent 65%);
}
.result-tie-mode .result-spotlight {
    background: radial-gradient(ellipse 90% 50% at 50% 0%, rgba(139, 124, 247, 0.12), transparent 65%);
}
.result-header { position: relative; z-index: 1; margin-bottom: 1rem; }
.result-badge {
    display: inline-block;
    padding: 0.3rem 0.85rem;
    background: rgba(94, 184, 255, 0.12);
    color: var(--accent);
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.result-winner { margin-bottom: 1rem; position: relative; z-index: 1; animation: resultReveal 0.5s ease forwards; }
@keyframes resultReveal {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.winner-label { font-size: 0.75rem; color: var(--accent-gold); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 0.35rem; }
.winner-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.2rem; line-height: 1.25; }
.winner-artist { font-size: 1rem; color: var(--text-secondary); }
.result-message {
    font-size: 1.0625rem;
    font-weight: 600;
    line-height: 1.5;
    padding: 1rem 1.125rem;
    border-radius: var(--radius);
    position: relative;
    z-index: 6;
    margin-top: 0.5rem;
    animation: resultReveal 0.55s ease 0.15s both;
}
.result-message.win {
    background: rgba(212, 175, 106, 0.12);
    border: 1px solid rgba(212, 175, 106, 0.28);
    color: #f0dfa8;
}
.result-message.lose {
    background: rgba(139, 124, 247, 0.1);
    border: 1px solid rgba(139, 124, 247, 0.22);
    color: var(--text-secondary);
}
.result-message.tie {
    background: rgba(94, 184, 255, 0.1);
    border: 1px solid rgba(94, 184, 255, 0.22);
    color: var(--accent);
}
.result-message.neutral, .result-message.no-votes {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}
.result-tie-list { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1rem; position: relative; z-index: 1; }
.result-tie-item {
    padding: 0.65rem 0.85rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}
.result-next-hint { margin-top: 1rem; font-size: 0.8125rem; color: var(--text-muted); position: relative; z-index: 1; }
.result-battery { margin: 1rem auto 0; max-width: 280px; position: relative; z-index: 6; }

.result-headline {
    font-size: 1.75rem;
    font-weight: 800;
    margin: 0 0 0.75rem;
    letter-spacing: -0.02em;
    position: relative;
    z-index: 6;
    animation: resultReveal 0.55s ease both;
}
.result-win-mode .result-headline { color: #f0dfa8; }
.result-tie-mode .result-headline { color: var(--accent); }

.result-visual {
    position: relative;
    z-index: 4;
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
}
.result-trophy {
    width: 72px;
    height: auto;
    animation: trophySpring 1s cubic-bezier(0.34, 1.56, 0.64, 1) both;
    filter: drop-shadow(0 8px 24px rgba(212, 175, 106, 0.35));
}
.result-clover {
    width: 56px;
    height: auto;
    animation: cloverFloat 4s ease-in-out infinite;
}
.result-tie-symbol { width: 52px; height: auto; opacity: 0.85; }
.result-wave-icon { width: 100px; height: auto; opacity: 0.7; animation: waveDrift 3s ease-in-out infinite; }

@keyframes trophySpring {
    0% { opacity: 0; transform: scale(0.4) translateY(12px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes cloverFloat {
    0%, 100% { transform: translateY(0) rotate(-2deg); }
    50% { transform: translateY(-8px) rotate(2deg); }
}
@keyframes waveDrift {
    0%, 100% { opacity: 0.5; transform: scaleX(0.95); }
    50% { opacity: 0.85; transform: scaleX(1); }
}

.result-light-rings {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}
.light-ring {
    position: absolute;
    border-radius: 50%;
    filter: blur(28px);
    opacity: 0.45;
    animation: ringPulse 3s ease-in-out infinite;
}
.light-ring-gold { width: 140px; height: 140px; background: rgba(212, 175, 106, 0.35); top: 5%; left: 50%; transform: translateX(-50%); }
.light-ring-blue { width: 180px; height: 100px; background: rgba(94, 184, 255, 0.2); top: 0; left: 50%; transform: translateX(-50%); animation-delay: 0.5s; }
.light-ring-purple { width: 160px; height: 120px; background: rgba(139, 124, 247, 0.25); top: 8%; left: 50%; transform: translateX(-50%); }
.light-ring-left { width: 120px; height: 120px; background: rgba(94, 184, 255, 0.22); top: 10%; left: 15%; }
.light-ring-right { width: 120px; height: 120px; background: rgba(139, 124, 247, 0.22); top: 10%; right: 15%; }
@keyframes ringPulse {
    0%, 100% { opacity: 0.35; transform: translateX(-50%) scale(0.95); }
    50% { opacity: 0.55; transform: translateX(-50%) scale(1.05); }
}

.result-submessage {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    position: relative;
    z-index: 6;
    line-height: 1.5;
}

.result-return {
    margin-top: 1.25rem;
    position: relative;
    z-index: 6;
}
.result-return p {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin: 0 0 0.5rem;
}
.result-return-progress {
    height: 3px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    overflow: hidden;
}
#result-return-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), var(--accent-purple));
    border-radius: 2px;
    transition: width 0.25s linear;
}

.result-card.result-entering { animation: resultEnter 0.55s ease both; }
.result-card.result-exiting { animation: resultExit 0.7s ease forwards; }
@keyframes resultEnter {
    from { opacity: 0; transform: scale(0.96) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes resultExit {
    from { opacity: 1; transform: scale(1); }
    to { opacity: 0; transform: scale(0.96) translateY(-8px); }
}

.result-tie-item span { display: block; font-size: 0.8125rem; color: var(--text-muted); margin-top: 0.15rem; }
.result-tie-list.result-tie-multi { flex-direction: row; flex-wrap: wrap; justify-content: center; }
.result-tie-list.result-tie-multi .result-tie-item { flex: 1 1 140px; max-width: 100%; }

.confetti-canvas { position: fixed; inset: 0; pointer-events: none; z-index: 4; }

/* ===== Tip jar premium ===== */
.tip-jar-compact {
    position: relative;
    margin-top: 1.25rem;
    padding: 0.85rem 1rem;
    z-index: 5;
}
.tip-compact-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem;
}
.tip-compact-text { flex: 1 1 140px; min-width: 0; }
.tip-compact-text h4 { font-size: 0.875rem; margin-bottom: 0.15rem; font-weight: 600; }
.tip-compact-text p { font-size: 0.75rem; color: var(--text-muted); margin: 0; }
.tip-soon-badge {
    font-size: 0.6875rem;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    background: rgba(212, 175, 106, 0.15);
    color: var(--accent-gold);
    border: 1px solid rgba(212, 175, 106, 0.25);
    white-space: nowrap;
}
.tip-sheet {
    position: fixed;
    inset: 0;
    z-index: 8000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}
.tip-sheet-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
}
.tip-sheet-panel {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 480px;
    max-height: 85vh;
    overflow-y: auto;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 1.25rem;
    animation: tipSheetUp 0.35s ease;
}
@keyframes tipSheetUp {
    from { transform: translateY(100%); opacity: 0.8; }
    to { transform: translateY(0); opacity: 1; }
}
.tip-sheet-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; }
.tip-sheet-desc { font-size: 0.8125rem; color: var(--text-secondary); margin-bottom: 1rem; }
.tip-amounts { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.tip-amount-btn {
    flex: 1 1 calc(33% - 0.5rem);
    min-width: 80px;
    padding: 0.65rem;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.875rem;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}
.tip-amount-btn.active, .tip-amount-btn:hover { border-color: var(--accent); box-shadow: 0 0 12px var(--accent-glow); }
.tip-custom-wrap { width: 100%; margin-top: 0.35rem; }
.tip-methods-label { font-size: 0.8125rem; color: var(--text-secondary); margin-bottom: 0.5rem; }
.tip-methods { display: flex; flex-direction: column; gap: 0.45rem; margin-bottom: 0.85rem; }
.tip-method-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 0.85rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.8125rem;
    cursor: not-allowed;
    text-align: start;
}
.tip-method-soon { font-size: 0.6875rem; color: var(--text-muted); }
.tip-secure-note { font-size: 0.75rem; color: var(--text-muted); text-align: center; margin-bottom: 0.85rem; }

/* ===== Avatar picker ===== */
.avatar-picker { text-align: center; margin-bottom: 1rem; }
.avatar-preview-wrap { margin-bottom: 0.65rem; }
.avatar-mic-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0 auto 0.65rem;
    border: 0;
    background: transparent;
    cursor: pointer;
    border-radius: 50%;
    transition: transform var(--transition), box-shadow var(--transition);
}
.avatar-mic-trigger:hover { transform: scale(1.04); }
.avatar-mic-trigger:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
}
.avatar-mic-trigger .avatar-preview { margin: 0; }
#username.input-focus-highlight {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(94, 184, 255, 0.22);
    animation: usernameFocusPulse 1.6s ease;
}
@keyframes usernameFocusPulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(94, 184, 255, 0.18); }
    50% { box-shadow: 0 0 0 5px rgba(94, 184, 255, 0.28); }
}
.avatar-preview {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(94, 184, 255, 0.3);
    box-shadow: 0 0 20px rgba(94, 184, 255, 0.15);
    background: rgba(0, 0, 0, 0.3);
}
.avatar-actions { display: flex; gap: 0.5rem; justify-content: center; flex-wrap: wrap; }
.avatar-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.45rem; }

.bg-vinyl {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(142, 200, 255, 0.08);
    pointer-events: none;
    animation: vinylSpin 80s linear infinite;
}
.bg-vinyl-1 { width: 280px; height: 280px; bottom: 8%; left: -5%; opacity: 0.12; }
.bg-vinyl-2 { width: 200px; height: 200px; top: 12%; right: -4%; opacity: 0.08; animation-direction: reverse; }
.bg-equalizer-line {
    position: absolute;
    bottom: 22%;
    left: 10%;
    right: 10%;
    height: 40px;
    background: repeating-linear-gradient(90deg, transparent, transparent 8px, rgba(94, 184, 255, 0.06) 8px, rgba(94, 184, 255, 0.06) 10px);
    mask-image: linear-gradient(90deg, transparent, black 20%, black 80%, transparent);
    opacity: 0.5;
    animation: eqLineShift 12s ease-in-out infinite;
}
@keyframes vinylSpin { to { transform: rotate(360deg); } }
@keyframes eqLineShift {
    0%, 100% { transform: scaleY(0.85); opacity: 0.35; }
    50% { transform: scaleY(1); opacity: 0.55; }
}

/* ===== Hover / touch premium ===== */
.join-card, .glass-card.join-card {
    transition: transform 0.45s ease, box-shadow 0.45s ease, border-color 0.35s ease;
}
@media (hover: hover) {
    .join-card:hover, .btn-primary:hover, .vote-card:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-glow);
    }
    .btn-primary::after, .join-card::before {
        content: '';
        position: absolute;
        inset: 0;
        border-radius: inherit;
        opacity: 0;
        pointer-events: none;
        background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,0.08) 50%, transparent 60%);
        transition: opacity 0.35s;
    }
    .btn-primary { position: relative; overflow: hidden; }
    .btn-primary:hover::after { opacity: 1; animation: shineSweep 0.6s ease; }
}
@keyframes shineSweep {
    from { transform: translateX(-100%); }
    to { transform: translateX(100%); }
}
.btn-primary:active, .vote-card:active, .tip-amount-btn:active {
    transform: scale(0.98);
}
@media (prefers-reduced-motion: reduce) {
    .bg-vinyl, .bg-equalizer-line { animation: none; }
}

.btn-glow { box-shadow: 0 4px 20px var(--accent-glow); }

@media (max-width: 430px) {
    .card-title { font-size: 1rem; }
    .battery-percent { font-size: 1.2rem; min-width: 2.75rem; }
    .countdown-wrap { width: 96px; height: 96px; }
    .countdown-timer { font-size: 1.875rem; }
}

@media (max-width: 320px) {
    .audience-container { padding-inline: 0.75rem; }
    .battery-segments { gap: 2px; padding: 4px; }
}

@media (prefers-reduced-motion: reduce) {
    .bg-orb, .eq-bar, .pulse-ring, .countdown-wrap.pulse-soft { animation: none !important; }
    .vote-card, .screen, .battery-segment { transition: none; }
    .result-message, .result-winner { animation: none; }
}

/* ===== Social links ===== */
.social-links {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    pointer-events: auto;
}
.social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: rgba(12, 16, 28, 0.82);
    backdrop-filter: blur(8px);
    color: var(--text-primary);
    text-decoration: none;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
    flex-shrink: 0;
}
.social-link:hover {
    transform: translateY(-1px);
    border-color: var(--border-hover);
}
.social-link:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.social-link-whatsapp:hover {
    color: #25d366;
    border-color: rgba(37, 211, 102, 0.45);
    box-shadow: 0 4px 16px rgba(37, 211, 102, 0.2);
}
.social-link-instagram:hover {
    color: #e1306c;
    border-color: rgba(225, 48, 108, 0.45);
    box-shadow: 0 4px 16px rgba(225, 48, 108, 0.2);
}
.social-icon {
    display: block;
    width: 22px;
    height: 22px;
}
.social-links-audience {
    justify-content: center;
}
.social-links-join {
    justify-content: center;
    margin-top: 1rem;
    padding-bottom: max(0.75rem, env(safe-area-inset-bottom, 0px));
}
.social-links-float {
    position: fixed;
    z-index: 40;
    bottom: max(1.25rem, env(safe-area-inset-bottom, 0px));
    right: max(1.25rem, env(safe-area-inset-right, 0px));
    padding: 0;
}
@media (min-width: 768px) {
    .social-links-join {
        position: fixed;
        z-index: 40;
        bottom: max(1.25rem, env(safe-area-inset-bottom, 0px));
        right: max(1.25rem, env(safe-area-inset-right, 0px));
        margin-top: 0;
        padding-bottom: 0;
    }
}
@media (prefers-reduced-motion: reduce) {
    .social-link { transition: none; }
    .social-link:hover { transform: none; }
}
