@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800&display=swap');

:root {
    --bg-color: #020617;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent: #38bdf8;
    --accent-hover: #0ea5e9;
    --success: #22c55e;
    --danger: #ef4444;
    --font-family: 'Outfit', sans-serif;
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

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

body {
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(at 0% 0%, rgba(56, 189, 248, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(129, 140, 248, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(56, 189, 248, 0.1) 0px, transparent 50%),
        radial-gradient(at 0% 100%, rgba(129, 140, 248, 0.1) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: var(--font-family);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3%3Ffilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    opacity: 0.03;
    pointer-events: none;
    z-index: -1;
}

.container {
    width: 100%;
    max-width: 500px;
    padding: 2.5rem;
    text-align: center;
    z-index: 10;
}

.card {
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: 2rem;
    box-shadow: var(--glass-shadow);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    animation: fadeIn 0.6s ease-out;
}

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

h1 {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #fff 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

p {
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
    font-size: 1.1rem;
}

/* Inputs */
input {
    width: 100%;
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
    border-radius: 1rem;
    border: 1px solid var(--glass-border);
    background: rgba(15, 23, 42, 0.6);
    color: white;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

input:focus {
    border-color: var(--accent);
    background: rgba(15, 23, 42, 0.8);
    box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.1);
}

/* Buttons */
button {
    width: 100%;
    padding: 1rem;
    border-radius: 1rem;
    border: none;
    background: linear-gradient(135deg, var(--accent) 0%, #60a5fa 100%);
    color: #020617;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(56, 189, 248, 0.2);
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(56, 189, 248, 0.3);
}

button:active {
    transform: translateY(0) scale(0.98);
}

/* Team Selection List */
#team-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

.team-card {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 1.25rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.team-card:hover {
    background: rgba(255, 255, 255, 0.07);
    transform: translateX(8px);
    border-color: var(--team-color);
    box-shadow: -4px 0 20px -10px var(--team-color);
}

.team-card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 60%;
    background: var(--team-color);
    border-radius: 0 4px 4px 0;
    opacity: 0.5;
    transition: all 0.3s;
}

.team-card:hover::before {
    height: 100%;
    opacity: 1;
}

.team-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Buzzer View */
#buzzer-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2.5rem;
    width: 100%;
    padding: 2rem;
}

#buzzer-btn {
    width: min(70vw, 280px);
    height: min(70vw, 280px);
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #ef4444 0%, #991b1b 100%);
    box-shadow: 
        0 20px 50px rgba(239, 68, 68, 0.3),
        inset 0 -10px 20px rgba(0, 0, 0, 0.4),
        inset 0 10px 20px rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 2.5rem;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    transition: all 0.1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 12px solid rgba(255, 255, 255, 0.05);
}

#buzzer-btn:hover {
    transform: scale(1.02);
    box-shadow: 
        0 30px 60px rgba(239, 68, 68, 0.4),
        inset 0 -10px 20px rgba(0, 0, 0, 0.4),
        inset 0 10px 20px rgba(255, 255, 255, 0.2);
}

#buzzer-btn.buzzed {
    background: #1e293b;
    box-shadow: none;
    transform: translateY(8px) scale(0.95);
    border-color: rgba(255, 255, 255, 0.01);
    cursor: not-allowed;
    opacity: 0.8;
}

/* Organizer View */
.organizer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    width: 100%;
}

#room-code-display {
    background: var(--card-bg);
    padding: 0.6rem 2rem;
    border-radius: 1rem;
    border: 1px solid var(--accent);
    color: var(--accent);
    font-weight: 800;
    font-size: 1.25rem;
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.1);
}

.organizer-dashboard {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (max-width: 800px) {
    .container {
        padding: 1rem;
    }
    .organizer-header {
        flex-direction: column;
        gap: 1rem;
        margin-bottom: 2.5rem;
    }
    
    #room-code-display {
        width: 100%;
    }

    .organizer-dashboard {
        grid-template-columns: 1fr;
    }
    .admin-controls {
        flex-direction: column;
    }
}

#winner-display {
    text-shadow: 0 0 20px rgba(56, 189, 248, 0.3);
}

.status-indicator {
    padding: 0.6rem 1.2rem;
    border-radius: 1rem;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

#history-list {
    max-height: 500px;
}

.status-locked { border: 1px solid rgba(239, 68, 68, 0.3); background: rgba(239, 68, 68, 0.1); color: #fca5a5; }
.status-active { border: 1px solid rgba(34, 197, 94, 0.3); background: rgba(34, 197, 94, 0.1); color: #86efac; }

.hidden {
    display: none !important;
}
