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

body {
    font-family: 'Poppins', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #0a0a1a;
    color: #fff;
    min-height: 100vh;
    overflow: hidden;
    position: relative;
}

/* --- Animated Background --- */
.bg-animation {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 0;
    overflow: hidden;
}

.bg-circle {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.15;
}

.bg-circle-1 {
    width: 50vh; height: 50vh;
    background: #ff6b35;
    top: -10vh; left: -10vw;
    animation: bgFloat1 20s ease-in-out infinite;
}

.bg-circle-2 {
    width: 40vh; height: 40vh;
    background: #6366f1;
    bottom: -10vh; right: -10vw;
    animation: bgFloat2 25s ease-in-out infinite;
}

.bg-circle-3 {
    width: 35vh; height: 35vh;
    background: #ffd700;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    animation: bgFloat3 30s ease-in-out infinite;
}

@keyframes bgFloat1 {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(10vw, 10vh); }
}
@keyframes bgFloat2 {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(-10vw, -10vh); }
}
@keyframes bgFloat3 {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.3); }
}

/* --- Screens --- */
.screen {
    display: none;
    width: 100%;
    height: 100vh;
    position: relative;
    z-index: 1;
}

.screen.active {
    display: flex;
    flex-direction: column;
    animation: screenFadeIn 0.5s ease-out;
}

@keyframes screenFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* --- LOBBY SCREEN --- */
#lobby-screen {
    padding: 3vh 4vw;
}

.screen-header {
    text-align: center;
    margin-bottom: 3vh;
}

.screen-logo-text {
    font-size: clamp(24px, 4vh, 48px);
    font-weight: 900;
    color: #fff;
    text-shadow: 0 4px 20px rgba(255, 165, 0, 0.5);
    margin-bottom: 1vh;
}

.event-title {
    font-size: clamp(18px, 3vh, 36px);
    font-weight: 700;
    color: rgba(255, 255, 255, 0.7);
}

.content {
    flex: 1;
    display: flex;
    gap: 4vw;
    align-items: flex-start;
    justify-content: center;
}

.qr-section {
    flex-shrink: 0;
}

.qr-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 3vh;
    padding: 3vh 3vw;
    text-align: center;
    backdrop-filter: blur(10px);
}

.qr-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1vw;
    margin-bottom: 2vh;
}

.qr-icon { font-size: clamp(20px, 3vh, 36px); }
.qr-header h2 {
    font-size: clamp(14px, 2.5vh, 28px);
    font-weight: 700;
}

.qr-code {
    margin: 2vh 0;
    display: flex;
    justify-content: center;
}

.qr-code img {
    width: clamp(150px, 25vh, 300px);
    height: auto;
    border-radius: 2vh;
    padding: 1vh;
    background: white;
}

.url-display {
    font-size: clamp(10px, 1.5vh, 16px);
    color: rgba(255, 255, 255, 0.5);
    margin-top: 1vh;
    word-break: break-all;
}

.qr-decoration {
    margin-top: 1.5vh;
    display: flex;
    justify-content: center;
    gap: 1vw;
}

.decoration-star {
    font-size: clamp(14px, 2vh, 24px);
    animation: starPulse 2s ease-in-out infinite;
}

.decoration-star:nth-child(2) { animation-delay: 0.3s; }
.decoration-star:nth-child(3) { animation-delay: 0.6s; }

@keyframes starPulse {
    0%, 100% { transform: scale(1); opacity: 0.7; }
    50% { transform: scale(1.3); opacity: 1; }
}

/* --- Players Section --- */
.players-section {
    flex: 1;
    max-height: 80vh;
    overflow-y: auto;
}

.players-header {
    display: flex;
    align-items: center;
    gap: 1vw;
    margin-bottom: 2vh;
}

.players-icon { font-size: clamp(20px, 3vh, 36px); }
.players-header h3 {
    font-size: clamp(14px, 2.5vh, 28px);
    font-weight: 700;
}

.players-count-badge {
    background: linear-gradient(135deg, #ff6b35, #ffa500);
    color: white;
    padding: 0.3vh 1.5vw;
    border-radius: 2vh;
    font-weight: 800;
}

.players-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(clamp(120px, 15vw, 200px), 1fr));
    gap: 1.5vh 1.5vw;
}

.player-card {
    display: flex;
    align-items: center;
    gap: 1vw;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 1.5vh;
    padding: 1.2vh 1.2vw;
    animation: cardSlideIn 0.3s ease-out both;
}

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

.player-card.disconnected { opacity: 0.4; }

.player-name {
    font-size: clamp(11px, 1.8vh, 18px);
    font-weight: 600;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.player-status-dot {
    width: 1vh; height: 1vh;
    border-radius: 50%;
    flex-shrink: 0;
}

.player-status-dot.online { background: #4cd137; box-shadow: 0 0 8px rgba(76, 209, 55, 0.5); }
.player-status-dot.offline { background: #666; }

/* --- Team Avatar --- */
.team-avatar {
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.team-avatar-generic {
    border: 2px solid rgba(255, 255, 255, 0.2);
}

/* --- GAME SCREEN --- */
.game-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5vh 3vw;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    z-index: 10;
}

.game-header-left {
    display: flex;
    align-items: center;
    gap: 1.5vw;
}

.game-logo-text {
    font-size: clamp(20px, 3vh, 36px);
}

.game-header-left h2 {
    font-size: clamp(14px, 2.5vh, 28px);
    font-weight: 700;
}

.game-timer {
    font-size: clamp(14px, 2.5vh, 28px);
    font-weight: 800;
    color: #ffd700;
}

.game-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2vh 3vw;
    overflow: hidden;
    position: relative;
}

/* --- Info / Waiting Views --- */
.view-info {
    text-align: center;
    max-width: 80vw;
}

.view-info .main-title,
.main-title {
    font-size: clamp(24px, 6vh, 72px);
    font-weight: 900;
    margin-bottom: 2vh;
    background: linear-gradient(135deg, #ff6b35, #ffa500, #ffd700);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sub-message {
    font-size: clamp(14px, 3vh, 36px);
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.6;
    font-weight: 500;
}

.result-icon {
    font-size: clamp(40px, 10vh, 120px);
    margin-bottom: 2vh;
}

/* --- Animations --- */
.animate-fade-in {
    animation: fadeInAnim 0.6s ease-out both;
}

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

.animate-pop-in {
    animation: popInAnim 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes popInAnim {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

.animate-slide-up {
    animation: slideUpAnim 0.5s ease-out both;
}

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

/* --- Question View --- */
.view-question {
    width: 100%;
    max-width: 85vw;
    text-align: center;
}

.round-badge {
    display: inline-block;
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    padding: 0.5vh 2vw;
    border-radius: 2vh;
    font-size: clamp(12px, 2vh, 20px);
    font-weight: 700;
    margin-bottom: 2vh;
    border: 1px solid rgba(56, 189, 248, 0.25);
}

.question-text {
    font-size: clamp(18px, 4vh, 48px);
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 3vh;
}

.question-text.text-small { font-size: clamp(14px, 2.5vh, 30px); }
.question-text.text-medium { font-size: clamp(16px, 3vh, 36px); }

.options-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5vh 2vw;
    width: 100%;
    max-width: 70vw;
    margin: 0 auto;
}

.option-item {
    display: flex;
    align-items: center;
    gap: 1.2vw;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1.5vh;
    padding: 2vh 2vw;
    font-size: clamp(13px, 2.2vh, 24px);
    font-weight: 600;
}

.option-letter {
    font-size: clamp(14px, 2.5vh, 28px);
    font-weight: 800;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.15);
    width: 4vh; height: 4vh;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* --- Result View --- */
.view-result {
    text-align: center;
    max-width: 80vw;
}

.correct-answer-box {
    background: rgba(34, 197, 94, 0.1);
    border: 2px solid rgba(34, 197, 94, 0.3);
    border-radius: 2vh;
    padding: 2vh 3vw;
    margin-top: 3vh;
    font-size: clamp(18px, 4vh, 48px);
    font-weight: 700;
    color: #22c55e;
}

/* --- SCORES SCREEN --- */
.scores-screen {
    padding: 3vh 4vw;
}

.scores-title {
    font-size: clamp(22px, 4vh, 48px);
    font-weight: 900;
    text-align: center;
    margin-bottom: 1vh;
}

.scores-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    padding: 2vh 0;
}

.scores-list {
    width: 100%;
    max-width: 80vw;
    display: flex;
    flex-direction: column;
    gap: 1vh;
}

.scores-list.two-columns {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1vh 2vw;
}

.score-item {
    display: flex;
    align-items: center;
    gap: 1.5vw;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 1.5vh;
    padding: 1.5vh 2vw;
    animation: scoreSlideIn 0.4s ease-out both;
}

@keyframes scoreSlideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

.score-item.top-rank {
    background: rgba(255, 215, 0, 0.08);
    border-color: rgba(255, 215, 0, 0.2);
}

.rank {
    font-size: clamp(16px, 3vh, 32px);
    font-weight: 900;
    color: #ffd700;
    min-width: 4vh;
    text-align: center;
}

.team-avatar-wrapper {
    flex-shrink: 0;
}

.team-info {
    flex: 1;
    overflow: hidden;
}

.team-name {
    font-size: clamp(13px, 2.2vh, 24px);
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.points {
    font-size: clamp(16px, 2.8vh, 30px);
    font-weight: 900;
    color: #38bdf8;
    min-width: 6vw;
    text-align: right;
}

/* --- Podium --- */
.podium-container {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 3vw;
    width: 80vw;
    max-width: 900px;
}

.podium-place {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1vh;
    animation: podiumRise 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

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

.podium-avatar { margin-bottom: 0.5vh; }
.podium-name {
    font-size: clamp(14px, 2.5vh, 28px);
    font-weight: 800;
    text-align: center;
    max-width: 20vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.podium-points {
    font-size: clamp(12px, 2vh, 22px);
    font-weight: 700;
    color: #38bdf8;
}

.podium-medal {
    font-size: clamp(24px, 5vh, 56px);
}

.podium-bar {
    width: clamp(80px, 15vw, 180px);
    background: linear-gradient(180deg, rgba(255, 215, 0, 0.3), rgba(255, 165, 0, 0.1));
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 1.5vh 1.5vh 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.podium-rank-number {
    font-size: clamp(20px, 4vh, 48px);
    font-weight: 900;
    color: rgba(255, 255, 255, 0.3);
}

.podium-rank-1 .podium-bar {
    background: linear-gradient(180deg, rgba(255, 215, 0, 0.4), rgba(255, 165, 0, 0.15));
    border-color: rgba(255, 215, 0, 0.5);
}

.scores-footer {
    text-align: center;
    padding: 2vh;
}

.thank-you-message {
    font-size: clamp(14px, 2.5vh, 28px);
    color: rgba(255, 255, 255, 0.5);
    font-weight: 600;
}

/* --- Media container for game views --- */
.media-container {
    margin: 2vh 0;
    text-align: center;
}

.media-container img {
    max-width: 80%;
    max-height: 40vh;
    border-radius: 2vh;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* Style highlight for info views */
.game-content.style-highlight {
    background: radial-gradient(ellipse at center, rgba(56, 189, 248, 0.05) 0%, transparent 70%);
}
