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

body {
    font-family: 'Poppins', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1f3a 0%, #2d3561 50%, #1a1f3a 100%);
    background-attachment: fixed;
    color: #333;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image:
        radial-gradient(circle at 20% 50%, rgba(255, 165, 0, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(255, 215, 0, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(255, 140, 0, 0.08) 0%, transparent 50%);
    animation: particleFloat 20s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes particleFloat {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-20px) scale(1.05); }
}

.screen {
    display: none;
    width: 100%;
    min-height: 100vh;
    padding: 20px;
    position: relative;
    z-index: 1;
}

.screen.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: top;
    animation: fadeIn 0.5s ease-in-out;
}

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

.logo-container {
    text-align: center;
    margin-bottom: 30px;
    animation: logoEntrance 1s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes logoEntrance {
    0% { transform: scale(0) rotate(-180deg); opacity: 0; }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.logo-text {
    font-size: 2.5em;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 4px 20px rgba(255, 165, 0, 0.5);
    animation: logoPulse 3s ease-in-out infinite;
}

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

.logo-container-small {
    text-align: center;
    margin-bottom: 20px;
}

.logo-text-small {
    font-size: 1.8em;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 2px 10px rgba(255, 165, 0, 0.4);
}

.logo-text-tiny {
    font-size: 1.5em;
}

.container {
    width: 100%;
    max-width: 500px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.9) 100%);
    backdrop-filter: blur(20px);
    padding: 40px 30px;
    border-radius: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.container::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 215, 0, 0.1), transparent);
    animation: shimmer 3s infinite;
    pointer-events: none;
}

@keyframes shimmer {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

.welcome-title {
    font-size: 2.2em;
    font-weight: 900;
    background: linear-gradient(135deg, #ff6b35 0%, #ffa500 50%, #ffd700 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    animation: titleSlideIn 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes titleSlideIn {
    from { transform: translateY(-30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.subtitle {
    color: #555;
    font-size: 1em;
    margin-bottom: 30px;
    font-weight: 500;
    animation: fadeInUp 1s ease-out 0.2s both;
}

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

.game-content {
    width: 100%;
    max-width: 600px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.9) 100%);
    backdrop-filter: blur(20px);
    padding: 30px;
    border-radius: 25px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.game-header-player {
    width: 100%;
    max-width: 600px;
    display: flex;
    align-items: center;
    gap: 15px;
    background: linear-gradient(135deg, rgba(255, 165, 0, 0.2) 0%, rgba(255, 215, 0, 0.2) 100%);
    backdrop-filter: blur(10px);
    padding: 15px 20px;
    border-radius: 20px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.game-info { flex: 1; text-align: left; }
.game-info h2 { font-size: 1.4em; font-weight: 800; color: #1a1f3a; margin: 0; }
#team-display { font-size: 0.9em; color: #AAA; margin-top: 5px; font-weight: 600; }

.view-waiting { text-align: center; }
.view-waiting h3 {
    font-size: 1.8em;
    background: linear-gradient(135deg, #ff6b35, #ffa500);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 15px;
    font-weight: 800;
}
.view-waiting p { color: #666; font-size: 1.2em; font-weight: 500; }

.spinner {
    width: 50px; height: 50px; margin: 20px auto;
    border: 5px solid rgba(255, 165, 0, 0.2);
    border-top: 5px solid #ffa500;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.view-info { text-align: center; width: 100%; }
.view-info h3 { font-size: 2.2em; margin-bottom: 15px; color: #1a1f3a; font-weight: 800; }
.view-info p { font-size: 1.4em; color: #555; font-weight: 600; }

.view-question { width: 100%; display: flex; flex-direction: column; align-items: center; }
.question-text { font-size: 1.3em; font-weight: 700; margin-bottom: 25px; text-align: center; color: #1a1f3a; line-height: 1.4; }

.game-input {
    width: 100%; padding: 18px; font-size: 1.2em;
    border: 3px solid rgba(255, 165, 0, 0.3);
    border-radius: 15px; margin-bottom: 10px; text-align: center;
    font-family: 'Poppins', sans-serif; font-weight: 600;
    background: rgba(255, 255, 255, 0.9);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.game-input:focus {
    outline: none; border-color: #ffa500;
    box-shadow: 0 0 0 4px rgba(255, 165, 0, 0.2);
    transform: scale(1.02);
}

.input-field {
    width: 100%; padding: 12px; font-size: 1.1em;
    border: 3px solid rgba(255, 165, 0, 0.3);
    border-radius: 15px; text-align: center;
    font-family: 'Poppins', sans-serif; font-weight: 600;
    background: rgba(255, 255, 255, 0.9);
}
.input-field:focus {
    outline: none; border-color: #ffa500;
    box-shadow: 0 0 0 4px rgba(255, 165, 0, 0.2);
}

.view-feedback { text-align: center; }
.view-feedback h3 { font-size: 2em; margin-bottom: 10px; font-weight: 900; }
.view-feedback p { font-size: 1.5em; font-weight: 600; }

.btn {
    border: none; font-weight: 800; cursor: pointer;
    font-family: 'Poppins', sans-serif;
    position: relative; overflow: hidden;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-primary {
    background: linear-gradient(135deg, #ff6b35 0%, #ffa500 50%, #ffd700 100%);
    color: white; padding: 18px 30px; border-radius: 50px; font-size: 1.3em;
    box-shadow: 0 10px 30px rgba(255, 165, 0, 0.4);
    display: flex; align-items: center; justify-content: center; gap: 10px;
}

.btn-primary:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 15px 40px rgba(255, 165, 0, 0.6);
}
.btn-primary:active { transform: translateY(-1px) scale(1.02); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-text { position: relative; z-index: 1; }
.btn-icon { font-size: 1.2em; position: relative; z-index: 1; }
.full-width { width: 100%; }

.error-message {
    color: #dc3545; display: none; margin-top: 15px;
    font-weight: 600; background: rgba(220, 53, 69, 0.1);
    padding: 10px; border-radius: 10px; border: 2px solid rgba(220, 53, 69, 0.3);
}
.error-message.active { display: block; animation: errorShake 0.5s; }
@keyframes errorShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.lobby-container { animation: slideInUp 0.6s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes slideInUp {
    from { transform: translateY(50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.welcome-badge {
    background: linear-gradient(135deg, rgba(255, 165, 0, 0.15) 0%, rgba(255, 215, 0, 0.15) 100%);
    padding: 20px; border-radius: 20px; margin-bottom: 25px;
    border: 2px solid rgba(255, 165, 0, 0.3);
}

.wave-emoji { font-size: 3em; display: block; margin-bottom: 10px; animation: wave 1.5s infinite; }
@keyframes wave {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(20deg); }
    75% { transform: rotate(-20deg); }
}

.welcome-badge h2 { font-size: 1.6em; color: #1a1f3a; font-weight: 800; }
.highlight-name {
    background: linear-gradient(135deg, #ff6b35, #ffa500);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 900;
}

.status-card {
    background: rgba(255, 255, 255, 0.5);
    padding: 25px; border-radius: 20px; margin-bottom: 20px;
    border: 2px dashed rgba(255, 165, 0, 0.4);
}

.status-icon { font-size: 3em; margin-bottom: 15px; animation: rotate 2s linear infinite; }
@keyframes rotate { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.status-text { font-size: 1.2em; color: #555; font-weight: 600; margin-bottom: 15px; }
.info-text { color: #666; font-size: 1.1em; font-weight: 600; }

.end-container { animation: zoomIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes zoomIn {
    from { transform: scale(0.5); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.end-icon { font-size: 5em; margin-bottom: 20px; animation: endIconSpin 1s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes endIconSpin {
    0% { transform: rotate(-360deg) scale(0); }
    100% { transform: rotate(0deg) scale(1); }
}

.end-title {
    font-size: 2.5em; font-weight: 900;
    background: linear-gradient(135deg, #ff6b35, #ffa500, #ffd700);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 20px;
}

.final-score-text {
    font-size: 1.4em; color: #555; font-weight: 700;
    margin-bottom: 30px; padding: 15px;
    background: rgba(255, 215, 0, 0.1); border-radius: 15px;
    border: 2px solid rgba(255, 215, 0, 0.3);
}

.input-locked {
    background-color: rgba(233, 236, 239, 0.8);
    color: #6c757d; cursor: not-allowed; border-color: #ccc;
}

.reset-link {
    display: none; margin-top: 20px; color: #ffa500;
    text-decoration: none; font-size: 0.95em; cursor: pointer;
    font-weight: 600; transition: all 0.3s;
    padding: 8px 15px; border-radius: 20px; border: 2px solid transparent;
}
.reset-link:hover {
    color: #ff8c00; border-color: rgba(255, 165, 0, 0.3);
    background: rgba(255, 165, 0, 0.1);
}
.reset-link.active { display: inline-block; }

/* Leaderboard view */
.view-leaderboard {
    animation: fadeIn 0.5s ease-out;
}
.leaderboard-list {
    display: flex; flex-direction: column; gap: 8px;
}
.lb-row {
    display: flex; align-items: center; gap: 10px;
    background: rgba(255,255,255,0.6); border-radius: 12px;
    padding: 12px 14px; opacity: 0; transform: translateY(12px);
    animation: lbSlideIn 0.4s ease-out forwards;
    border: 1px solid rgba(0,0,0,0.06);
}
.lb-row-top {
    background: linear-gradient(135deg, rgba(255,215,0,0.15), rgba(255,165,0,0.1));
    border-color: rgba(255,165,0,0.25);
}
.lb-row-me {
    background: linear-gradient(135deg, rgba(79,172,254,0.18), rgba(0,242,254,0.1));
    border-color: rgba(79,172,254,0.35);
    box-shadow: 0 0 10px rgba(79,172,254,0.15);
}
.lb-pos { font-size: 1.4em; min-width: 32px; text-align: center; flex-shrink: 0; }
.lb-name { flex: 1; font-weight: 700; font-size: 1.05em; color: #1a1f3a; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-pts { font-weight: 800; font-size: 1.05em; color: #ff6b35; white-space: nowrap; }
@keyframes lbSlideIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 480px) {
    .logo-text { font-size: 2em; }
    .welcome-title { font-size: 1.8em; }
    .subtitle { font-size: 0.9em; }
    .container { padding: 30px 20px; }
    .btn-primary { font-size: 1.1em; padding: 15px 25px; }
}
