@import url("../../css/games/trivia3.css");

/* === GLOBAL OVERRIDES === */
:root {
    --accent-color: #e23636;
    --accent-rgb: 226, 54, 54;
    --glass-bg: rgba(20, 20, 35, 0.85);
    --glass-border: rgba(255, 255, 255, 0.1);
    --success-color: #4cd137;
    --error-color: #e84118;
    --gold-color: #fbc531;
}

body {
    overflow-x: hidden;
    /* Prevent horizontal scroll from chat */
}

/* === GAME LAYOUT === */
.game-wrapper {
    display: flex;
    justify-content: center;
    width: 100%;
    min-height: 85vh;
    position: relative;
}

.game-main-row {
    display: flex;
    justify-content: center;
    width: 100%;
    max-width: 1400px;
    /* Match single player */
    position: relative;
}

#game-container {
    width: 100%;
    max-width: 1000px;
    /* Match single player */
    min-height: 700px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
    transition: all 0.5s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

/* === SCREENS === */
.screen {
    display: none;
    width: 100%;
    max-width: 1400px;
    /* Match single player */
    position: relative;
}

#game-container {
    width: 100%;
    max-width: 850px;
    min-height: 600px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
    transition: all 0.5s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

/* === SCREENS === */
.screen {
    display: none;
    width: 100%;
    height: 100%;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.5s ease;
}

.screen.active {
    display: flex;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* === START SCREEN === */
.start-content {
    text-align: center;
    z-index: 2;
}

.logo-container {
    margin-bottom: 2rem;
}

.game-logo {
    max-width: 350px;
    filter: drop-shadow(0 0 20px rgba(226, 54, 54, 0.4));
    animation: float 6s ease-in-out infinite;
}

.sub-text {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 3rem;
}

.multi-actions {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
}

.pulse-btn {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(226, 54, 54, 0.4);
    }

    70% {
        box-shadow: 0 0 0 15px rgba(226, 54, 54, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(226, 54, 54, 0);
    }
}

/* === BROWSE LOBBIES SCREEN === */
#browse-lobbies-screen {
    padding: 1.5rem;
    max-width: 680px;
    max-height: 720px;
}

#browse-lobbies-screen h2 {
    margin-bottom: 1.5rem;
    font-size: 2.1rem;
    text-align: center;
}

.manual-join-section {
    background: rgba(255, 255, 255, 0.05);
    padding: 1.5rem;
    border-radius: 16px;
    margin-bottom: 1.5rem;
}

.manual-join-section label {
    display: block;
    margin-bottom: 1rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.7rem;
}

.code-input-group {
    display: flex;
    gap: 1rem;
}

.room-code-input {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    color: white;
    font-family: 'Inter', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
    text-align: center;
    transition: all 0.3s;
}

.room-code-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 20px rgba(var(--accent-rgb), 0.3);
}

.room-code-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
    letter-spacing: 5px;
}

.section-divider {
    text-align: center;
    margin: 2rem 0;
    position: relative;
}

.section-divider::before,
.section-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.2), transparent);
}

.section-divider::before {
    left: 0;
}

.section-divider::after {
    right: 0;
}

.section-divider span {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.5rem 1.5rem;
    border-radius: 20px;
    font-size: 0.6rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.public-rooms-section {
    background: rgba(0, 0, 0, 0.2);
    padding: 1.5rem;
    /* Was 2rem */
    border-radius: 16px;
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.05);
}


.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.0rem;
}

.section-header h3 {
    font-size: 1.2rem;
    margin: 0;
    color: rgba(255, 255, 255, 0.9);
}

.icon-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.rooms-list {
    min-height: 200px;
    max-height: 400px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.room-card {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s;
}

.room-card:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--accent-color);
    transform: translateX(5px);
}

.room-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.room-code-badge {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 3px;
    color: var(--accent-color);
    text-shadow: 0 0 10px rgba(var(--accent-rgb), 0.3);
}

.room-details {
    display: flex;
    gap: 1.5rem;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
}

.room-detail {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.room-status {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.room-status.waiting {
    background: rgba(76, 209, 55, 0.2);
    color: var(--success-color);
    border: 1px solid var(--success-color);
}

.room-status.playing {
    background: rgba(226, 54, 54, 0.2);
    color: var(--accent-color);
    border: 1px solid var(--accent-color);
}

.join-room-btn {
    background: var(--accent-color);
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.join-room-btn:hover {
    background: rgba(var(--accent-rgb), 0.8);
    transform: scale(1.05);
}

.loading-state,
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.empty-state p {
    font-size: 1.1rem;
    margin: 0;
}

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

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* === HOST SETUP SCREEN (Compact Grid) === */
.setup-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto auto;
    gap: 1.25rem;
    width: 100%;
    max-width: 765px;
    background: rgba(0, 0, 0, 0.2);
    padding: 1.5rem;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Top Left: Room Code */
.room-code-display {
    grid-column: 1 / 2;
    grid-row: 1 / 2;
    background: rgba(255, 255, 255, 0.05);
    padding: 1.5rem;
    border-radius: 16px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.room-code-display h1 {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: 5px;
    color: var(--accent-color);
    margin: 0.5rem 0;
    text-shadow: 0 0 20px rgba(var(--accent-rgb), 0.4);
}

/* Top Right: Player List */
.joined-players-list {
    grid-column: 2 / 3;
    grid-row: 1 / 2;
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem;
    border-radius: 16px;
    max-height: 200px;
    overflow-y: auto;
}

.joined-players-list h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.player-list-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.player-joined {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    animation: slideIn 0.3s ease;
}

/* Middle: Theme Selector (Full Width) */
.theme-selector {
    grid-column: 1 / -1;
    grid-row: 2 / 3;
    background: rgba(0, 0, 0, 0.3);
    padding: 1.5rem;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.theme-selector h3 {
    margin-bottom: 1rem;
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.8);
}

.quick-select-bar {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.quick-icon {
    width: 40px;
    height: 40px;
    object-fit: contain;
    cursor: pointer;
    opacity: 0.5;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    filter: grayscale(100%);
}

.quick-icon:hover {
    opacity: 0.8;
    transform: scale(1.1);
    filter: grayscale(50%);
}

.quick-icon.selected {
    opacity: 1;
    transform: scale(1.2);
    filter: grayscale(0%);
    filter: drop-shadow(0 0 10px var(--accent-color));
}

.selected-theme-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    animation: fadeIn 0.3s ease;
}

.selected-theme-display img {
    height: 80px;
    object-fit: contain;
}

.selected-theme-display p {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent-color);
}

/* Bottom: Start Button (Full Width) */
#start-lobby-btn {
    grid-column: 1 / -1;
    grid-row: 3 / 4;
    width: 100%;
    padding: 1rem;
    font-size: 1.2rem;
}

/* Back Button */
.back-btn {
    margin-top: 1rem;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* === LOBBY SCREEN === */
.lobby-header {
    text-align: center;
    margin-bottom: 2rem;
}

.room-badge {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.5rem 2rem;
    border-radius: 50px;
    font-weight: 700;
    display: inline-block;
    margin-top: 1rem;
    font-size: 1.2rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.lobby-players {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    margin-bottom: 2rem;
    width: 100%;
}

.lobby-slot {
    background: rgba(0, 0, 0, 0.4);
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    padding: 2rem;
    min-height: 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    position: relative;
    transition: all 0.3s;
}

.lobby-slot.occupied {
    background: rgba(255, 255, 255, 0.08);
    border-style: solid;
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    max-height: 140px;
}

.lobby-slot.ready {
    border-color: var(--success-color);
    box-shadow: 0 0 20px rgba(76, 209, 55, 0.2);
}

.lobby-slot .avatar {
    font-size: 4rem;
    filter: drop-shadow(0 5px 15px rgba(0, 0, 0, 0.3));
}

.lobby-slot .name {
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: 0.5px;
}

.ready-indicator {
    position: absolute;
    top: 15px;
    right: 15px;
    background: var(--success-color);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 0 10px var(--success-color);
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.lobby-slot.ready .ready-indicator {
    display: flex;
}

.emoji-bar {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.emoji-bar button {
    font-size: 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    cursor: pointer;
    transition: transform 0.2s;
}

.emoji-bar button:hover {
    transform: scale(1.2);
    background: rgba(255, 255, 255, 0.2);
}

/* === CHAT PANEL (Draggable) === */
.chat-panel {
    position: fixed;
    top: 100px;
    right: 50px;
    /* Default spawn */
    width: 320px;
    height: 500px;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    z-index: 1000;
    resize: both;
    overflow: hidden;
    min-width: 280px;
    min-height: 300px;
}

.chat-panel.hidden {
    display: none;
}

.chat-header {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: grab;
}

.chat-header:active {
    cursor: grabbing;
}

.chat-header h4 {
    margin: 0;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    pointer-events: none;
}

.chat-control-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 0.5rem;
}

.chat-content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.chat-message {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    max-width: 85%;
}

.chat-message.self {
    align-self: flex-end;
    align-items: flex-end;
}

.message-header {
    display: flex;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
    align-items: center;
}

.message-bubble {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.6rem 1rem;
    border-radius: 12px;
    border-top-left-radius: 2px;
    font-size: 0.9rem;
    line-height: 1.4;
}

.chat-message.self .message-bubble {
    background: var(--accent-color);
    color: white;
    border-radius: 12px;
    border-top-right-radius: 2px;
}

.chat-message.system .message-bubble {
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid rgba(255, 215, 0, 0.3);
    color: var(--gold-color);
    text-align: center;
    font-size: 0.8rem;
    border-radius: 8px;
    width: 100%;
}

.chat-message.system {
    max-width: 100%;
    align-self: center;
}

.chat-input-area {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    gap: 0.5rem;
}

.chat-input {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 0.6rem 1rem;
    color: white;
    font-family: inherit;
}

.send-btn {
    background: var(--accent-color);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.emoji-quick-bar {
    padding: 0.5rem 1rem;
    display: flex;
    gap: 0.5rem;
    background: rgba(0, 0, 0, 0.2);
}

.emoji-quick-bar .emoji-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.2rem;
    opacity: 0.7;
}

.emoji-quick-bar .emoji-btn:hover {
    opacity: 1;
    transform: scale(1.2);
}

/* Minimized Chat */
.chat-minimized {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: var(--accent-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    transition: transform 0.2s;
}

.chat-minimized:hover {
    transform: scale(1.1);
}

.chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--error-color);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: bold;
    display: none;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

.chat-badge.visible {
    display: flex;
}

/* === PROGRESS BAR === */
.progress-bar-container {
    width: 100%;
    padding: 0 0 1.5rem;
    margin-bottom: 0.5rem;
}

.progress-track {
    display: flex;
    gap: 4px;
    height: 8px;
    width: 100%;
}

.progress-step {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    transition: all 0.3s;
}

.progress-step.completed {
    background: var(--success-color);
    opacity: 0.5;
}

.progress-step.active {
    background: var(--accent-color);
    box-shadow: 0 0 10px var(--accent-color);
    transform: scaleY(1.5);
}

.progress-step.milestone {
    border: 1px solid rgba(255, 255, 255, 0.4);
}

/* === SCORE PILLS === */
.player-scores {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 1rem;
    z-index: 100;
    pointer-events: none;
}

.score-pill {
    display: none;
    align-items: center;
    gap: 0.8rem;
    background: rgba(20, 20, 35, 0.9);
    backdrop-filter: blur(15px);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 50px;
    padding: 0.6rem 1.2rem;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    min-width: 140px;
}

.score-pill.active {
    display: flex;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.score-pill.you {
    border-color: var(--accent-color);
    box-shadow: 0 0 25px rgba(var(--accent-rgb), 0.4);
    transform: translateY(-10px);
}

.score-pill.flash-correct {
    animation: pillFlashGreen 0.6s;
}

.score-pill.flash-wrong {
    animation: pillFlashRed 0.6s;
}

@keyframes pillFlashGreen {

    0%,
    100% {
        background: rgba(20, 20, 35, 0.9);
        border-color: rgba(255, 255, 255, 0.1);
    }

    50% {
        background: rgba(76, 209, 55, 0.9);
        border-color: var(--success-color);
        box-shadow: 0 0 40px var(--success-color);
        transform: scale(1.1);
    }
}

@keyframes pillFlashRed {

    0%,
    100% {
        background: rgba(20, 20, 35, 0.9);
        border-color: rgba(255, 255, 255, 0.1);
    }

    50% {
        background: rgba(232, 65, 24, 0.9);
        border-color: var(--error-color);
        box-shadow: 0 0 40px var(--error-color);
        transform: translateX(5px);
    }
}

.pill-avatar {
    font-size: 1.8rem;
}

.pill-name {
    font-size: 1rem;
    font-weight: 600;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pill-score {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--gold-color);
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .setup-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
    }

    .room-code-display,
    .joined-players-list,
    .theme-selector,
    #start-lobby-btn {
        grid-column: 1 / -1;
        grid-row: auto;
    }

    .lobby-players {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .chat-panel {
        width: 100%;
        height: 300px;
        top: auto;
        bottom: 0;
        right: 0;
        left: 0;
        border-radius: 16px 16px 0 0;
    }

    .player-scores {
        flex-wrap: wrap;
        bottom: 1rem;
        gap: 0.5rem;
        width: 90%;
        justify-content: center;
    }

    #browse-lobbies-screen {
        padding: 1rem;
    }

    .code-input-group {
        flex-direction: column;
    }

    .room-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .join-room-btn {
        width: 100%;
    }
}


/* Fix for 1080p displays and smaller */
@media (max-height: 950px) {
    #game-container {
        min-height: 600px;
        padding: 1.5rem;
    }
}

@media (max-height: 800px) {
    #game-container {
        min-height: 500px;
        padding: 1rem;
    }
}

.hidden {
    display: none !important;
}

/* === GAMIFIED END SCREEN === */
.end-content {
    max-width: 900px;
    /* Wider for podium */
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.podium-container {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 1.5rem;
    height: 350px;
    margin: 2rem 0;
    padding-bottom: 1rem;
    width: 100%;
}

.podium-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    width: 140px;
    opacity: 0;
    /* Hidden initially */
    transform: translateY(50px);
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.podium-step.revealed {
    opacity: 1;
    transform: translateY(0);
}

.podium-bar {
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 16px 16px 0 0;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 1rem;
    transition: height 1s cubic-bezier(0.34, 1.56, 0.64, 1);
    height: 0;
    /* Animate to height */
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.podium-step.winner .podium-bar {
    background: linear-gradient(to top, rgba(226, 54, 54, 0.2), rgba(226, 54, 54, 0.6));
    border-color: var(--accent-color);
    box-shadow: 0 0 40px rgba(226, 54, 54, 0.4);
}

.podium-rank {
    font-size: 4rem;
    font-weight: 900;
    color: rgba(255, 255, 255, 0.2);
    margin-bottom: 0.5rem;
    line-height: 1;
}

.podium-step.winner .podium-rank {
    color: rgba(255, 215, 0, 0.3);
}

.podium-avatar {
    font-size: 4rem;
    margin-bottom: 1rem;
    filter: drop-shadow(0 5px 15px rgba(0, 0, 0, 0.4));
    transition: transform 0.3s;
}

.podium-step.winner .podium-avatar {
    font-size: 5rem;
    transform: scale(1.1);
}

.podium-name {
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-align: center;
    font-size: 1.1rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.podium-score {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--gold-color);
    margin-bottom: 0.5rem;
    text-shadow: 0 0 20px rgba(251, 197, 49, 0.4);
}

.winner-crown {
    position: absolute;
    top: -250px;
    font-size: 3rem;
    animation: bounce 2s infinite;
    filter: drop-shadow(0 0 15px rgba(255, 215, 0, 0.6));
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0) rotate(-5deg);
    }

    50% {
        transform: translateY(-15px) rotate(5deg);
    }
}

.runners-up-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    width: 100%;
    max-width: 600px;
    margin: 1rem auto;
}

.runner-up-card {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    gap: 1.5rem;
    opacity: 0;
    transform: translateX(-30px);
    transition: all 0.4s ease;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.runner-up-card.revealed {
    opacity: 1;
    transform: translateX(0);
}

.runner-up-card .rank {
    font-size: 1.2rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.5);
    width: 40px;
}

.runner-up-card .avatar {
    font-size: 2rem;
}

.runner-up-card .name {
    font-weight: 600;
    font-size: 1.1rem;
}

.runner-up-card .score {
    margin-left: auto;
    font-weight: 700;
    font-size: 1.3rem;
    color: rgba(255, 255, 255, 0.8);
}

/* Responsive Podium */
@media (max-width: 768px) {
    .podium-container {
        height: auto;
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }

    .podium-step {
        width: 100%;
        flex-direction: row;
        background: rgba(255, 255, 255, 0.05);
        padding: 1rem;
        border-radius: 12px;
        justify-content: space-between;
        transform: translateX(-20px);
    }

    .podium-bar {
        display: none;
        /* Hide bars on mobile, just show list style */
    }

    .podium-avatar {
        font-size: 2.5rem;
        margin: 0;
    }

    .winner-crown {
        position: static;
        font-size: 2rem;
        animation: none;
    }
}

/* === AVATAR MODAL === */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 2rem;
    border-radius: 20px;
    text-align: center;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.avatar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
    max-height: 400px;
    overflow-y: auto;
    padding: 0.5rem;
}

.avatar-option {
    font-size: 2.5rem;
    cursor: pointer;
    transition: transform 0.2s;
    padding: 0.5rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
}

.avatar-option:hover {}

.podium-rank {
    font-size: 4rem;
    font-weight: 900;
    color: rgba(255, 255, 255, 0.2);
    margin-bottom: 0.5rem;
    line-height: 1;
}

.podium-step.winner .podium-rank {
    color: rgba(255, 215, 0, 0.3);
}

.podium-avatar {
    font-size: 4rem;
    margin-bottom: 1rem;
    filter: drop-shadow(0 5px 15px rgba(0, 0, 0, 0.4));
    transition: transform 0.3s;
}

.podium-step.winner .podium-avatar {
    font-size: 5rem;
    transform: scale(1.1);
}

.podium-name {
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-align: center;
    font-size: 1.1rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.podium-score {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--gold-color);
    margin-bottom: 0.5rem;
    text-shadow: 0 0 20px rgba(251, 197, 49, 0.4);
}

.winner-crown {
    position: absolute;
    top: -250px;
    font-size: 3rem;
    animation: bounce 2s infinite;
    filter: drop-shadow(0 0 15px rgba(255, 215, 0, 0.6));
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0) rotate(-5deg);
    }

    50% {
        transform: translateY(-15px) rotate(5deg);
    }
}

.runners-up-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    width: 100%;
    max-width: 600px;
    margin: 1rem auto;
}

.runner-up-card {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    gap: 1.5rem;
    opacity: 0;
    transform: translateX(-30px);
    transition: all 0.4s ease;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.runner-up-card.revealed {
    opacity: 1;
    transform: translateX(0);
}

.runner-up-card .rank {
    font-size: 1.2rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.5);
    width: 40px;
}

.runner-up-card .avatar {
    font-size: 2rem;
}

.runner-up-card .name {
    font-weight: 600;
    font-size: 1.1rem;
}

.runner-up-card .score {
    margin-left: auto;
    font-weight: 700;
    font-size: 1.3rem;
    color: rgba(255, 255, 255, 0.8);
}

/* Responsive Podium */
@media (max-width: 768px) {
    .podium-container {
        height: auto;
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }

    .podium-step {
        width: 100%;
        flex-direction: row;
        background: rgba(255, 255, 255, 0.05);
        padding: 1rem;
        border-radius: 12px;
        justify-content: space-between;
        transform: translateX(-20px);
    }

    .podium-bar {
        display: none;
        /* Hide bars on mobile, just show list style */
    }

    .podium-avatar {
        font-size: 2.5rem;
        margin: 0;
    }

    .winner-crown {
        position: static;
        font-size: 2rem;
        animation: none;
    }
}

/* === AVATAR MODAL === */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 2rem;
    border-radius: 20px;
    text-align: center;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.avatar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
    max-height: 400px;
    overflow-y: auto;
    padding: 0.5rem;
}

.avatar-option {
    font-size: 2.5rem;
    cursor: pointer;
    transition: transform 0.2s;
    padding: 0.5rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
}

.avatar-option:hover {
    transform: scale(1.2);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 15px var(--accent-color);
}

.avatar-edit-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.avatar-edit-btn:hover {
    background: var(--accent-color);
    transform: scale(1.1);
    border-color: var(--accent-color);
}

/* Settings Button */
.settings-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: clamp(32px, 5vw, 36px);
    height: clamp(32px, 5vw, 36px);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-color);
    font-size: clamp(1rem, 2vw, 1.1rem);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0;
    margin-right: 0;
    /* Fixed spacing issue */
}

.settings-btn:hover {
    transform: translateY(-2px) scale(1.05);
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

/* Settings Modal Content */
.settings-content {
    max-width: 500px;
    width: 90%;
    padding: 2rem;
    text-align: left;
    background: rgba(20, 20, 20, 0.85);
    /* More transparent/glassy */
    backdrop-filter: blur(20px);
    /* Stronger blur */
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: scaleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.settings-content h2 {
    margin: 0 0 1.5rem 0;
    font-size: 28px;
    text-align: center;
    background: linear-gradient(135deg, #fff 0%, #ccc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
}

.settings-section {
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
}

.setting-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.setting-icon {
    font-size: 24px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.setting-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0;
}

.setting-item label {
    font-size: 15px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
}

/* Volume Control */
.volume-control {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    max-width: 220px;
    margin-left: 1.5rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 8px 12px;
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.volume-icon {
    font-size: 14px;
    opacity: 0.6;
}

.volume-control input[type="range"] {
    flex: 1;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.volume-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 2px solid var(--accent-color);
}

.volume-control input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* Settings Footer */
.settings-footer {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.settings-version {
    font-size: 12px;
    opacity: 0.4;
    font-family: monospace;
}



/* === COMPREHENSIVE MOBILE OPTIMIZATION FOR SAMSUNG S20 (360x800) === */
@media screen and (max-width: 400px) {

    /* === GLOBAL & CONTAINER === */
    body {
        font-size: 14px;
        /* Slightly smaller base font */
    }

    .game-wrapper {
        min-height: calc(100vh - 60px);
        padding: 0;
        /* Remove wrapper padding */
    }

    .game-main-row {
        padding: 0;
        /* Remove padding - was 0.5rem */
        max-width: 100%;
        width: 100%;
    }

    #game-container {
        padding: 1rem 0.5rem;
        /* Reduce horizontal padding - was 0.8rem */
        width: 100%;
        /* Full width */
        max-width: 100%;
        /* Remove max-width constraint */
        min-height: 600px;
        border-radius: 8px;
        /* Slightly smaller radius */
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
        margin: 0;
        /* Ensure no margin */
    }

    main {
        padding: 0 0.95rem;
        /* Small horizontal gap - just 4px on each side */
    }

    /* === HEADER === */
    header {
        padding: 0.5rem 0.8rem;
        height: auto;
    }

    header h4 {
        font-size: 0.85rem;
    }

    #header-title {
        font-size: 0.85rem;
    }

    .header-right {
        gap: 0.3rem;
    }

    .social-icons {
        gap: 0.25rem;
    }

    .social-link,
    .settings-btn,
    .mute-btn {
        font-size: 0.9rem;
        padding: 0.3rem 0.4rem;
        min-width: 32px;
        min-height: 32px;
    }

    /* === TYPOGRAPHY === */
    h1 {
        font-size: 1.8rem;
    }

    h2 {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }

    h3 {
        font-size: 1.2rem;
    }

    .sub-text {
        font-size: 0.95rem;
        margin-bottom: 2rem;
    }

    /* === BUTTONS === */
    .primary-btn,
    .secondary-btn {
        font-size: 0.95rem;
        padding: 0.9rem 1.5rem;
        border-radius: 10px;
        min-height: 44px;
        /* Touch-friendly */
    }

    .small-btn {
        font-size: 0.85rem;
        padding: 0.6rem 1.2rem;
        min-height: 38px;
    }

    .icon-btn {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    /* === START SCREEN === */
    .start-content {
        padding: 0 0.5rem;
    }

    .logo-container {
        margin-bottom: 1.5rem;
    }

    .game-logo {
        max-width: 220px;
        /* Smaller logo for mobile */
        width: 90%;
    }

    .multi-actions {
        flex-direction: column;
        /* Stack buttons vertically */
        gap: 1rem;
        width: 100%;
    }

    .multi-actions button {
        width: 100%;
        max-width: 280px;
    }

    /* === BROWSE LOBBIES SCREEN === */
    #browse-lobbies-screen {
        padding: 1rem;
        max-width: 100%;
        max-height: none;
    }

    #browse-lobbies-screen h2 {
        font-size: 1.6rem;
        margin-bottom: 1rem;
    }

    .manual-join-section {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .manual-join-section label {
        font-size: 0.65rem;
        margin-bottom: 0.6rem;
    }

    .code-input-group {
        flex-direction: column;
        gap: 0.8rem;
    }

    .room-code-input {
        width: 100%;
        padding: 0.9rem 1rem;
        font-size: 1.3rem;
        letter-spacing: 2px;
    }

    .section-divider {
        margin: 1.5rem 0;
    }

    .section-divider span {
        font-size: 0.55rem;
        padding: 0.4rem 1rem;
    }

    .public-rooms-section {
        padding: 1rem;
    }

    .section-header h3 {
        font-size: 1rem;
    }

    .rooms-list {
        max-height: 300px;
        gap: 0.8rem;
    }

    .room-card {
        flex-direction: column;
        padding: 1rem;
        gap: 0.8rem;
        text-align: center;
    }

    .room-code-badge {
        font-size: 1.3rem;
        letter-spacing: 2px;
    }

    .room-details {
        flex-direction: column;
        gap: 0.5rem;
        font-size: 0.85rem;
    }

    .room-status {
        font-size: 0.7rem;
        padding: 0.2rem 0.6rem;
    }

    .join-room-btn {
        width: 100%;
        padding: 0.7rem 1.5rem;
    }

    /* === HOST SETUP SCREEN === */
    #host-setup-screen {
        padding: 1rem;
    }

    #host-setup-screen h2 {
        font-size: 1.6rem;
    }

    .setup-container {
        grid-template-columns: 1fr;
        /* Stack everything */
        gap: 1rem;
        padding: 1rem;
    }

    .room-code-display,
    .joined-players-list,
    .theme-selector,
    #start-lobby-btn {
        grid-column: auto;
        grid-row: auto;
    }

    .room-code-display {
        padding: 1rem;
    }

    .room-code-display p {
        font-size: 0.85rem;
    }

    .room-code-display h1 {
        font-size: 1.8rem;
        letter-spacing: 3px;
    }

    #copy-code-btn {
        font-size: 0.8rem;
        padding: 0.5rem 1rem;
    }

    .joined-players-list {
        padding: 1rem;
        max-height: 180px;
    }

    .joined-players-list h3 {
        font-size: 0.9rem;
    }

    .player-list-grid {
        grid-template-columns: 1fr;
        /* Single column */
    }

    .player-joined {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }

    .theme-selector {
        padding: 1rem;
    }

    .theme-selector h3 {
        font-size: 1rem;
        margin-bottom: 0.8rem;
    }

    .quick-select-bar {
        gap: 0.8rem;
        margin-bottom: 1rem;
    }

    .quick-icon {
        width: 35px;
        height: 35px;
    }

    .selected-theme-display img {
        height: 60px;
    }

    .selected-theme-display p {
        font-size: 1rem;
    }

    #start-lobby-btn {
        padding: 0.9rem;
        font-size: 1.1rem;
    }

    .back-btn {
        margin-top: 0.8rem;
        font-size: 0.8rem;
    }

    /* === LOBBY SCREEN === */
    #lobby-screen {
        padding: 1rem;
    }

    .lobby-header h2 {
        font-size: 1.6rem;
    }

    .room-badge {
        padding: 0.5rem 1.5rem;
        font-size: 1rem;
    }

    .lobby-players {
        grid-template-columns: 1fr;
        /* Stack vertically */
        gap: 0.8rem;
        margin-bottom: 1.5rem;
    }

    .lobby-slot {
        min-height: 80px;
        padding: 1rem;
        flex-direction: row;
        /* Horizontal to save space */
        justify-content: flex-start;
    }

    .lobby-slot .avatar {
        font-size: 2.5rem;
        margin-bottom: 0;
    }

    .lobby-slot .name {
        font-size: 1rem;
    }

    .ready-indicator {
        width: 28px;
        height: 28px;
        font-size: 1rem;
        top: 50%;
        transform: translateY(-50%);
        right: 12px;
    }

    .lobby-controls {
        margin-bottom: 1rem;
    }

    .emoji-bar {
        gap: 0.6rem;
        margin-top: 1.5rem;
        flex-wrap: wrap;
        justify-content: center;
    }

    .emoji-bar button {
        font-size: 1.3rem;
        width: 44px;
        height: 44px;
    }

    /* === THEME INTRO SCREEN === */
    #theme-intro-screen .intro-content {
        padding: 1rem;
    }

    .intro-logo {
        max-height: 120px;
        width: auto;
        max-width: 200px;
    }

    #intro-theme-name {
        font-size: 1.4rem;
        margin: 1rem 0;
    }

    .instructions p {
        font-size: 0.95rem;
    }

    .highlight-text {
        font-size: 1.1rem;
    }

    /* === QUESTION SCREEN === */
    #question-screen {
        padding: 0.5rem 0.5rem 1rem;
        /* Reduce top padding to move everything up */
    }

    .progress-bar-container {
        margin-bottom: 0.3rem;
        /* Even tighter - move closer to top */
        margin-top: -0.5rem;
        /* Pull it up into the padding space */
        padding: 0 0.5rem;
    }

    .progress-track {
        gap: 0.2rem;
        /* Even tighter spacing between steps */
    }

    .progress-step {
        width: 24px;
        /* Even smaller - was 28px */
        height: 15px;
        /* Even smaller - was 28px */
        font-size: 0.65rem;
        /* Smaller text */
    }

    .timer-container {
        margin-top: 0.8rem;
        /* Push timer DOWN away from progress bar */
        margin-bottom: 1rem;
        /* Space before question */
        height: 5px;
        /* Even thinner - was 6px */
    }

    .question-area {
        padding: 1rem;
        margin-bottom: 1.5rem;
    }

    #question-text {
        font-size: 1.1rem;
        line-height: 1.5;
    }

    .options-grid {
        grid-template-columns: 1fr;
        /* Stack options vertically */
        gap: 0.8rem;
        margin-bottom: 1.5rem;
    }

    .option-btn {
        font-size: 0.95rem;
        padding: 1rem;
        min-height: 50px;
        text-align: left;
    }

    .power-ups-bar {
        justify-content: center;
        gap: 0.8rem;
    }

    .power-up-btn {
        font-size: 0.85rem;
        padding: 0.6rem 1.2rem;
    }

    .power-up-btn .icon {
        font-size: 1.2rem;
    }

    /* === GAME OVER SCREEN === */
    #game-over-screen .end-content {
        padding: 1rem;
    }

    #game-over-screen h2 {
        font-size: 1.8rem;
    }

    .winner-display {
        font-size: 1.2rem;
        padding: 1rem;
        margin: 1.5rem 0;
    }

    #winner-name {
        font-size: 1.3rem;
    }

    .final-scoreboard {
        gap: 0.8rem;
        margin-bottom: 2rem;
    }

    .final-score-item {
        padding: 1rem;
        font-size: 0.95rem;
    }

    /* === MODALS === */
    .modal-content {
        width: 90%;
        max-width: 340px;
        padding: 1.5rem;
        border-radius: 16px;
    }

    .modal-content h3 {
        font-size: 1.3rem;
        margin-bottom: 1.2rem;
    }

    /* Avatar Modal */
    .avatar-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.8rem;
    }

    .avatar-option {
        font-size: 2rem;
        width: 50px;
        height: 50px;
    }

    /* Settings Modal */
    .settings-content {
        max-width: 320px;
    }

    .setting-group {
        margin-bottom: 1.2rem;
    }

    .setting-group label {
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
    }

    .setting-group input[type="range"] {
        width: 100%;
    }

    /* === CHAT PANEL === */
    .chat-panel {
        width: 92%;
        height: 350px;
        top: auto;
        bottom: 70px;
        /* Above score pills */
        right: 4%;
        left: 4%;
        border-radius: 12px;
        min-width: 240px;
        min-height: 280px;
    }

    .chat-header {
        padding: 0.8rem;
    }

    .chat-header h4 {
        font-size: 0.85rem;
    }

    .chat-messages {
        padding: 0.8rem;
        gap: 0.6rem;
    }

    .message-header {
        font-size: 0.7rem;
    }

    .message-bubble {
        font-size: 0.85rem;
        padding: 0.5rem 0.8rem;
    }

    .chat-input {
        font-size: 0.9rem;
        padding: 0.6rem;
    }

    .emoji-quick-bar {
        padding: 0.5rem;
        gap: 0.4rem;
    }

    .emoji-btn {
        font-size: 1.2rem;
        width: 36px;
        height: 36px;
    }

    .send-btn {
        padding: 0.6rem 1rem;
        font-size: 1.2rem;
    }

    /* Chat Minimized */
    .chat-minimized {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
        bottom: 70px;
        right: 15px;
    }

    .chat-badge {
        width: 18px;
        height: 18px;
        font-size: 0.7rem;
        top: 3px;
        right: 3px;
    }

    /* === PLAYER SCORE PILLS === */
    .player-scores {
        bottom: 10px;
        left: 5%;
        right: 5%;
        padding: 0.5rem;
        gap: 0.5rem;
        justify-content: flex-start;
        overflow-x: auto;
        flex-wrap: nowrap;
        /* Hide scrollbar */
        -ms-overflow-style: none;
        scrollbar-width: none;
    }

    .player-scores::-webkit-scrollbar {
        display: none;
    }

    .score-pill {
        min-width: 85px;
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
        flex-shrink: 0;
    }

    .pill-avatar {
        font-size: 1.2rem;
    }

    .pill-name {
        max-width: 40px;
        font-size: 0.75rem;
    }

    .pill-score {
        font-size: 0.85rem;
        font-weight: 700;
    }

    /* === FOOTER === */
    footer {
        padding: 1rem 0.5rem;
        font-size: 0.75rem;
    }

    footer p {
        font-size: 0.75rem;
    }

    .version {
        font-size: 0.65rem;
    }
}