:root {
    --bg-dark: #07070f;
    --card-bg: rgba(255, 255, 255, 0.03);
    --border-soft: rgba(255, 255, 255, 0.08);
    --text-white: #ffffff;
    --text-muted: #94a3b8;
    
    /* Harmonious HSL Tailored Gradients */
    --purple-primary: hsl(265, 89%, 65%);
    --pink-primary: hsl(330, 81%, 60%);
    --neon-green: hsl(142, 76%, 50%);
    --timer-red: hsl(0, 84%, 60%);
    
    --purple-gradient: linear-gradient(135deg, hsl(265, 89%, 65%) 0%, hsl(290, 80%, 55%) 100%);
    --rainbow-gradient: linear-gradient(135deg, #a78bfa 0%, #ec4899 50%, #f43f5e 100%);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-white);
    min-height: 100vh;
    overflow: hidden;
    position: relative;
}

/* Ambient design elements */
.background-overlay {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(15, 10, 30, 0.6) 0%, rgba(5, 5, 10, 0.95) 100%);
    z-index: 1;
}

.glow-sphere {
    position: absolute;
    border-radius: 50%;
    filter: blur(140px);
    z-index: 2;
    opacity: 0.25;
    pointer-events: none;
}

.g1 {
    top: -10%;
    left: -10%;
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, var(--purple-primary) 0%, transparent 70%);
}

.g2 {
    bottom: -10%;
    right: -10%;
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, var(--pink-primary) 0%, transparent 70%);
}

/* HUD Header styling */
.hud-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 30px 50px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-text {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 2px;
    background: linear-gradient(to right, #ffffff, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.pulse-indicator {
    width: 10px;
    height: 10px;
    background-color: var(--neon-green);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--neon-green);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.9); opacity: 0.6; }
    50% { transform: scale(1.2); opacity: 1; box-shadow: 0 0 16px var(--neon-green); }
    100% { transform: scale(0.9); opacity: 0.6; }
}

.lobby-code-badge {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    padding: 8px 18px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    backdrop-filter: blur(10px);
}

.lobby-code-badge .label {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.lobby-code-badge .code {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    color: #ec4899;
}

/* Stage & container system */
.game-stage {
    position: relative;
    z-index: 5;
    height: 100vh;
    padding: 120px 60px 50px 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.phase-container {
    display: none;
    width: 100%;
    max-width: 1200px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.phase-container.active {
    display: flex;
}

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

/* LOBBY PHASE styling */
.lobby-welcome {
    text-align: center;
    margin-bottom: 40px;
}

.lobby-welcome h2 {
    font-size: 3rem;
    font-weight: 900;
    letter-spacing: -0.5px;
    margin-bottom: 10px;
    background: var(--purple-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.lobby-welcome p {
    font-size: 1.2rem;
    color: var(--text-muted);
    font-weight: 300;
}

.lobby-welcome .url {
    color: #ffffff;
    font-weight: 600;
    text-decoration: underline;
    text-decoration-color: var(--pink-primary);
}

.big-room-code {
    font-size: 7rem;
    font-weight: 900;
    letter-spacing: 4px;
    margin-top: 20px;
    background: var(--rainbow-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 10px 25px rgba(236, 72, 153, 0.2));
    animation: heartbeat 2.5s ease-in-out infinite;
}

@keyframes heartbeat {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.players-lobby-box {
    width: 100%;
    max-width: 900px;
    background: var(--card-bg);
    border: 1px solid var(--border-soft);
    backdrop-filter: blur(15px);
    border-radius: 24px;
    padding: 30px;
    box-shadow: 0 10px 50px rgba(0,0,0,0.3);
}

.players-lobby-box h3 {
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--text-muted);
    margin-bottom: 25px;
    text-align: center;
}

.lobby-players-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
    min-height: 120px;
    align-items: center;
}

.lobby-player-bubble {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 15px 10px;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    animation: popBubble 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes popBubble {
    0% { transform: scale(0.6); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.no-players {
    grid-column: 1 / -1;
    text-align: center;
    color: #4b5563;
    font-style: italic;
    font-weight: 300;
}

/* QUESTION PHASE styling */
.question-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

.question-number {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 3px;
    color: var(--text-muted);
}

.question-timer-wrapper {
    position: relative;
    width: 80px;
    height: 80px;
}

.timer-svg {
    width: 80px;
    height: 80px;
    transform: rotate(-90deg);
}

.timer-track {
    fill: none;
    stroke: rgba(255,255,255,0.06);
    stroke-width: 8px;
}

.timer-bar {
    fill: none;
    stroke: var(--purple-primary);
    stroke-width: 8px;
    stroke-dasharray: 283;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear, stroke 0.5s ease;
    stroke-linecap: round;
}

.timer-value {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.6rem;
    font-weight: 800;
}

.question-text {
    font-size: 2.8rem;
    font-weight: 800;
    text-align: center;
    line-height: 1.3;
    margin-bottom: 60px;
    max-width: 1000px;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    width: 100%;
    margin-bottom: 40px;
}

.option-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-soft);
    border-radius: 20px;
    padding: 30px;
    display: flex;
    align-items: center;
    gap: 20px;
    backdrop-filter: blur(10px);
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.option-letter {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.3rem;
    font-weight: 800;
    color: #ffffff;
}

.option-card:nth-child(1) .option-letter { background-color: #ef4444; }
.option-card:nth-child(2) .option-letter { background-color: #3b82f6; }
.option-card:nth-child(3) .option-letter { background-color: #f59e0b; }
.option-card:nth-child(4) .option-letter { background-color: #10b981; }

.option-text {
    font-size: 1.4rem;
    font-weight: 600;
}

.option-card.correct {
    border-color: var(--neon-green);
    background-color: rgba(16, 185, 129, 0.1);
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.15);
    transform: scale(1.03);
}

.option-card.incorrect {
    opacity: 0.35;
}

.active-players-summary {
    font-size: 1.1rem;
    color: var(--text-muted);
    font-weight: 300;
}

/* REVEAL PHASE styling */
.reveal-banner {
    font-size: 4rem;
    font-weight: 900;
    color: var(--timer-red);
    letter-spacing: 2px;
    margin-bottom: 20px;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-8px); }
    40%, 80% { transform: translateX(8px); }
}

.reveal-question {
    font-size: 1.6rem;
    color: var(--text-muted);
    margin-bottom: 40px;
    text-align: center;
}

.reveal-answer-card {
    background: rgba(16, 185, 129, 0.15);
    border: 2px solid var(--neon-green);
    border-radius: 24px;
    padding: 40px 60px;
    display: flex;
    align-items: center;
    gap: 30px;
    box-shadow: 0 0 50px rgba(16, 185, 129, 0.25);
    animation: zoomBounce 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes zoomBounce {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.reveal-answer-card .reveal-letter {
    width: 60px;
    height: 60px;
    background-color: var(--neon-green);
    color: #000000;
    border-radius: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    font-weight: 900;
}

.reveal-answer-card .reveal-text {
    font-size: 2.2rem;
    font-weight: 800;
}

/* SCOREBOARD PHASE styling */
.scoreboard-title {
    font-size: 3rem;
    font-weight: 900;
    letter-spacing: 2px;
    margin-bottom: 40px;
    background: var(--purple-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.scoreboard-list {
    width: 100%;
    max-width: 700px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.score-rank-row {
    background: var(--card-bg);
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    backdrop-filter: blur(10px);
    transition: transform 0.3s ease;
}

.score-rank-row:nth-child(1) {
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,215,0,0.3);
    box-shadow: 0 4px 20px rgba(255,215,0,0.05);
}

.score-rank-row .player-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.score-rank-row .rank {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--text-muted);
    width: 30px;
}

.score-rank-row:nth-child(1) .rank { color: #ffd700; }
.score-rank-row:nth-child(2) .rank { color: #c0c0c0; }
.score-rank-row:nth-child(3) .rank { color: #cd7f32; }

.score-rank-row .name {
    font-size: 1.4rem;
    font-weight: 700;
}

.score-rank-row .score {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--pink-primary);
}

/* GAME OVER PHASE styling */
.crown-icon {
    font-size: 6rem;
    margin-bottom: 10px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
}

.winner-title {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: 4px;
    color: #ffd700;
    margin-bottom: 10px;
}

.winner-name {
    font-size: 5rem;
    font-weight: 900;
    letter-spacing: -1px;
    margin-bottom: 5px;
    background: linear-gradient(135deg, #ffd700 0%, #f39c12 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.winner-score {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 50px;
}

.podium-view {
    display: flex;
    justify-content: center;
    gap: 30px;
    width: 100%;
    max-width: 600px;
}

.podium-runner-up {
    background: var(--card-bg);
    border: 1px solid var(--border-soft);
    border-radius: 20px;
    padding: 25px;
    text-align: center;
    flex: 1;
    backdrop-filter: blur(10px);
}

.podium-runner-up .place {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.podium-runner-up .p-name {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.podium-runner-up .p-score {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--pink-primary);
}
