:root {
    --primary: #4364F7;
    --secondary: #6FB1FC;
    --accent: #FF512F;
    --bg-gradient: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
    --card-bg: rgba(255, 255, 255, 0.05);
    --text-main: #ffffff;
    --text-muted: #a0a0a0;
    --success: #00b09b;
    --error: #FF416C;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
}

body {
    background: var(--bg-gradient);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

#app {
    width: 100%;
    height: 100%;
    position: relative;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.screen.active {
    display: flex;
    animation: fadeIn 0.5s ease;
}

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

/* --- LOBBY SCREEN (Premium) --- */
.title {
    font-family: 'Anton', sans-serif;
    font-size: 5rem;
    line-height: 0.9;
    text-align: center;
    text-transform: uppercase;
    background: linear-gradient(to right, #4facfe 0%, #00f2fe 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 2rem;
    text-shadow: 0 10px 30px rgba(0, 242, 254, 0.3);
}

.lobby-card {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 40px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    text-align: center;
}

.input-wrapper {
    position: relative;
    margin-bottom: 30px;
}

.lobby-input {
    width: 100%;
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: white;
    font-size: 1.2rem;
    font-weight: 600;
    text-align: center;
    transition: all 0.3s ease;
}

.lobby-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(67, 100, 247, 0.3);
}

.btn-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.btn {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.btn:active {
    transform: scale(0.98);
}

.btn-play {
    background: linear-gradient(45deg, #FF512F, #DD2476);
    color: white;
    box-shadow: 0 10px 20px rgba(221, 36, 118, 0.3);
}

.btn-create {
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 10px 20px rgba(67, 100, 247, 0.3);
}

.btn-join {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-join:hover {
    background: rgba(255, 255, 255, 0.2);
}

.divider {
    display: flex;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    margin: 15px 0;
}
.divider::before, .divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
}
.divider span { margin: 0 10px; }

.join-row {
    display: flex;
    gap: 10px;
}

/* --- WAITING SCREEN --- */
.room-info {
    text-align: center;
    margin-bottom: 40px;
}

.room-code-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.1);
    padding: 10px 20px;
    border-radius: 50px;
    font-family: 'Anton', sans-serif;
    font-size: 2.5rem;
    letter-spacing: 2px;
    color: var(--secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.waiting-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 15px;
    width: 100%;
    max-width: 600px;
    margin-bottom: 40px;
}

.player-card {
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 12px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.05);
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

.settings-panel {
    background: rgba(0, 0, 0, 0.2);
    padding: 20px;
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    margin-bottom: 20px;
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.input-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 5px;
    text-transform: uppercase;
}

.setting-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    padding: 10px;
    border-radius: 8px;
    color: white;
    text-align: center;
    font-weight: 600;
}

.setting-input option {
    background: #24243e;
    color: white;
}

/* --- GAME SCREEN --- */
.game-header {
    display: flex;
    justify-content: space-between;
    width: 100%;
    max-width: 800px;
    margin-bottom: 30px;
    align-items: center;
}

.score-pill {
    background: rgba(0,0,0,0.3);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    border: 1px solid rgba(255,255,255,0.1);
}

.event-display {
    text-align: center;
    margin-bottom: 40px;
}

#event-text {
    font-family: 'Anton', sans-serif;
    font-size: 3rem;
    line-height: 1.1;
    text-transform: uppercase;
}

.turn-indicator {
    background: rgba(255, 255, 255, 0.1);
    padding: 10px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
    max-width: 300px;
}

.current-player-name {
    color: var(--secondary);
    font-size: 1.2rem;
}

.timer-bar {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.timer-fill {
    height: 100%;
    background: var(--accent);
    width: 100%;
    transition: width 0.1s linear;
}

.input-zone {
    display: flex;
    gap: 10px;
    width: 100%;
    max-width: 400px;
}

.year-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 15px;
    color: white;
    font-size: 1.5rem;
    text-align: center;
    font-family: 'Anton', sans-serif;
}

#guess-history {
    max-height: 200px;
    overflow-y: auto;
    width: 100%;
    margin-top: 20px;
    padding-right: 5px;
    /* Scrollbar Styling */
    scrollbar-width: thin;
    scrollbar-color: var(--secondary) transparent;
}

#guess-history::-webkit-scrollbar {
    width: 6px;
}
#guess-history::-webkit-scrollbar-track {
    background: transparent;
}
#guess-history::-webkit-scrollbar-thumb {
    background-color: var(--secondary);
    border-radius: 10px;
}

/* Overlays */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85); /* Darker */
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.feedback-large {
    font-family: 'Anton', sans-serif;
    font-size: 6rem;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.feedback-correct {
    color: var(--success);
    text-shadow: 0 0 30px rgba(0, 176, 155, 0.5);
}

.feedback-wrong {
    color: var(--error);
}

.result-info {
    font-size: 1.5rem;
    color: var(--text-muted);
}

.winner-announcement {
    text-align: center;
}

.winner-name {
    display: block;
    font-size: 3rem;
    font-weight: 700;
    color: var(--success);
    margin-bottom: 10px;
}

.hidden { display: none !important; }
