/* ============================================
   🍳 COOKING BATTLE - STYLES
   ============================================ */

:root {
    --primary: #FF6B35;
    --primary-dark: #E84E0F;
    --secondary: #3DDC84;
    --accent: #FFD23F;
    --danger: #EF4444;
    --bg-dark: #1a1a2e;
    --bg-darker: #16213e;
    --bg-card: rgba(30, 41, 59, 0.95);
    --text: #f8fafc;
    --text-dim: #94a3b8;
    --text-muted: #64748b;
    --border: rgba(255, 255, 255, 0.08);
    --glow-orange: 0 0 30px rgba(255, 107, 53, 0.4);
    --glow-green: 0 0 20px rgba(61, 220, 132, 0.3);
    --radius: 16px;
    --radius-sm: 10px;
    --font-display: 'Fredoka One', cursive;
    --font-body: 'Nunito', sans-serif;
}

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

body {
    font-family: var(--font-body);
    background: var(--bg-dark);
    color: var(--text);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

/* ======= SCREENS ======= */
.screen {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 1;
}

.screen.active {
    display: flex;
}

.hidden {
    display: none !important;
}

/* ======= LOBBY ======= */
#lobby-screen {
    align-items: flex-start;
    justify-content: flex-start;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px 0;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Hide scrollbar for lobby */
#lobby-screen::-webkit-scrollbar {
    display: none;
}

.lobby-bg {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 80%, rgba(255, 107, 53, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(61, 220, 132, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(255, 210, 63, 0.05) 0%, transparent 70%),
        linear-gradient(135deg, #0f0c29 0%, #1a1a2e 50%, #24243e 100%);
    animation: bgPulse 8s ease-in-out infinite alternate;
}

@keyframes bgPulse {
    0% {
        filter: brightness(1) hue-rotate(0deg);
    }

    100% {
        filter: brightness(1.1) hue-rotate(5deg);
    }
}

.lobby-container {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    max-width: 600px;
    width: 95%;
    margin: 0 auto;
    padding-bottom: 40px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .lobby-container {
        max-width: 100%;
        width: 90%;
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .lobby-container {
        width: 95%;
        gap: 10px;
    }
}

.logo-container {
    text-align: center;
    animation: logoFloat 3s ease-in-out infinite;
    margin-bottom: 10px;
    margin-top: 20px;
}

@keyframes logoFloat {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-8px);
    }
}

.game-logo {
    font-family: var(--font-display);
    font-size: 48px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    color: var(--primary);
    text-shadow: 0 4px 0 #c44b1a, 0 8px 20px rgba(255, 107, 53, 0.3);
}

/* Responsive logo */
@media (max-width: 768px) {
    .game-logo {
        font-size: 40px;
        gap: 12px;
    }

    .logo-icon {
        font-size: 48px !important;
    }
}

@media (max-width: 480px) {
    .game-logo {
        font-size: 32px;
        gap: 8px;
    }

    .logo-icon {
        font-size: 40px !important;
    }

    .logo-subtitle {
        font-size: 12px;
        letter-spacing: 2px;
    }
}

.logo-icon {
    font-size: 56px;
    animation: iconBounce 2s ease-in-out infinite;
}

.logo-icon:last-child {
    animation-delay: 0.3s;
}

@keyframes iconBounce {

    0%,
    100% {
        transform: scale(1) rotate(0deg);
    }

    25% {
        transform: scale(1.1) rotate(-5deg);
    }

    75% {
        transform: scale(0.95) rotate(3deg);
    }
}

.logo-text {
    background: linear-gradient(135deg, #FF6B35, #FFD23F);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-subtitle {
    font-size: 16px;
    color: var(--text-dim);
    font-weight: 700;
    letter-spacing: 4px;
    text-transform: uppercase;
    margin-top: 8px;
}

/* === LOBBY MENUS === */
.lobby-menu {
    width: 100%;
    margin-top: 10px;
    animation: menuSlideUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes menuSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

.menu-title {
    font-family: var(--font-display);
    color: white;
    text-align: center;
    margin-bottom: 20px;
    font-size: 24px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* LOGIN OVERLAY */
.login-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(12px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 28px;
    padding: 0;
    width: 100%;
    max-width: 420px;
    text-align: center;
    box-shadow: 0 30px 60px -12px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    animation: cardEntrance 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.login-tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.2);
    padding: 8px;
    gap: 8px;
}

.login-tab-btn {
    flex: 1;
    padding: 12px;
    background: transparent;
    border: none;
    border-radius: 12px;
    color: var(--text-dim);
    font-family: var(--font-display);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.login-tab-btn.active {
    background: var(--bg-card);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.auth-form {
    display: none;
    padding: 40px;
    animation: fadeIn 0.3s ease-out;
}

.auth-form.active {
    display: block;
}

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

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

.login-title {
    font-family: var(--font-display);
    font-size: 26px;
    color: white;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.login-input-group {
    text-align: left;
    margin-bottom: 20px;
}

.login-input-group label {
    display: block;
    font-size: 10px;
    font-weight: 900;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 8px;
}

.login-input-group input {
    width: 100%;
    padding: 14px 18px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    border-radius: 14px;
    color: white;
    font-size: 16px;
    outline: none;
    transition: all 0.2s;
}

.login-input-group input:focus {
    border-color: var(--primary);
    background: rgba(255, 107, 53, 0.05);
    box-shadow: 0 0 0 4px rgba(255, 107, 53, 0.1);
}

.btn-login-main {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--primary) 0%, #ff8c42 100%);
    border: none;
    border-radius: 14px;
    color: white;
    font-family: var(--font-display);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.4);
    transition: all 0.2s;
    margin-top: 10px;
}

.btn-login-main.register {
    background: linear-gradient(135deg, var(--secondary) 0%, #6cd6ce 100%);
    box-shadow: 0 4px 15px rgba(78, 205, 196, 0.4);
}

.btn-login-main:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

.btn-login-main:active {
    transform: translateY(1px);
}

.btn-login-guest {
    width: 100%;
    padding: 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px border var(--border);
    border-radius: 14px;
    color: white;
    font-family: var(--font-display);
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

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

/* USER PROFILE */
.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0, 0, 0, 0.4);
    padding: 8px 16px;
    border-radius: 50px;
    border: 1px solid var(--border);
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.user-profile:hover {
    background: rgba(0, 0, 0, 0.6);
    transform: translateY(-2px);
    border-color: var(--primary);
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.user-avatar i {
    font-size: 20px;
    color: var(--accent);
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.edit-hint {
    font-size: 8px;
    color: var(--text-dim);
    opacity: 0.7;
    margin-left: 4px;
}

.user-profile:hover .edit-hint {
    color: var(--accent);
    opacity: 1;
}

.user-name {
    font-family: var(--font-display);
    font-size: 14px;
    color: white;
}

.user-status {
    font-size: 10px;
    color: var(--secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.status-icon {
    font-size: 6px;
}

.btn-logout {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 18px;
    margin-left: 8px;
    transition: color 0.2s;
}

.btn-logout:hover {
    color: var(--danger);
}

/* MAIN MENU BUTTONS */
#menu-main {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Main Menu Layout with Friends Panel */
.main-menu-layout {
    display: flex;
    gap: 16px;
    width: 100%;
}

.menu-buttons-column {
    flex: 0 0 auto;
    width: 220px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 320px;
}

.menu-btn {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

/* Compact variant for main menu */
.menu-btn.compact {
    padding: 10px 12px;
    gap: 8px;
}

.menu-btn.compact .btn-icon {
    font-size: 20px;
    width: 32px;
    height: 32px;
}

.menu-btn.compact .btn-title {
    font-size: 14px;
    line-height: 1.2;
}

.menu-btn.compact .btn-desc {
    font-size: 10px;
    line-height: 1.2;
}

.menu-btn:hover {
    transform: translateX(5px);
    border-color: var(--primary);
    background: rgba(255, 107, 53, 0.1);
}

.menu-btn .btn-icon {
    font-size: 32px;
    background: rgba(0, 0, 0, 0.2);
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.menu-btn .btn-text {
    flex: 1;
}

.btn-title {
    display: block;
    font-family: var(--font-display);
    font-size: 20px;
    color: white;
    margin-bottom: 4px;
}

.btn-desc {
    font-size: 13px;
    color: var(--text-dim);
}

/* Friends Panel (Right Side of Main Menu) */
.friends-panel {
    width: 220px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    display: flex;
    flex-direction: column;
    max-height: 320px;
}

.friends-panel-header {
    font-family: var(--font-display);
    font-size: 14px;
    color: var(--accent);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Add Friend Section in Panel */
.friends-panel-add {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    align-items: center;
    flex-wrap: nowrap;
}

.friends-panel-add input {
    flex: 1;
    min-width: 0;
    padding: 8px 10px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: white;
    font-size: 12px;
    outline: none;
    transition: all 0.2s;
}

.friends-panel-add input:focus {
    border-color: var(--secondary);
    background: rgba(61, 220, 132, 0.05);
}

.friends-panel-add input::placeholder {
    color: var(--text-muted);
    font-size: 11px;
}

.btn-add-friend {
    width: 34px;
    min-width: 34px;
    height: 34px;
    background: var(--secondary);
    border: none;
    border-radius: 8px;
    color: var(--bg-dark);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.btn-add-friend:hover {
    background: #4ef3a0;
    transform: scale(1.05);
}

.btn-add-friend:active {
    transform: scale(0.95);
}

/* Friend Requests Section */
.friend-requests-section {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.friend-requests-header {
    font-family: var(--font-display);
    font-size: 12px;
    color: var(--accent);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.request-count {
    background: var(--danger);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 800;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

.friend-requests-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 120px;
    overflow-y: auto;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.friend-requests-list::-webkit-scrollbar {
    display: none;
}

.friend-request-item {
    background: rgba(255, 210, 63, 0.1);
    border: 1px solid rgba(255, 210, 63, 0.3);
    border-radius: 8px;
    padding: 8px;
    animation: requestPulse 0.4s ease-out;
}

@keyframes requestPulse {
    0% {
        transform: scale(0.9);
        opacity: 0;
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.friend-request-name {
    font-size: 12px;
    font-weight: 700;
    color: white;
    margin-bottom: 6px;
    display: block;
}

.friend-request-actions {
    display: flex;
    gap: 4px;
}

.friend-request-btn {
    flex: 1;
    padding: 4px 8px;
    border: none;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    transition: all 0.2s;
}

.friend-request-btn.accept {
    background: var(--secondary);
    color: var(--bg-dark);
}

.friend-request-btn.accept:hover {
    background: #4ef3a0;
    transform: scale(1.05);
}

.friend-request-btn.reject {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.friend-request-btn.reject:hover {
    background: rgba(239, 68, 68, 0.3);
    transform: scale(1.05);
}

.friends-panel-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.friends-panel-list::-webkit-scrollbar {
    display: none;
}

.friends-empty-msg {
    text-align: center;
    color: var(--text-dim);
    font-size: 12px;
    padding: 20px 10px;
    font-style: italic;
}

.friend-panel-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    border-left: 3px solid var(--secondary);
    font-size: 12px;
    transition: all 0.2s;
}

.friend-panel-item:hover {
    background: rgba(0, 0, 0, 0.5);
    transform: translateX(2px);
}

.friend-panel-item.offline {
    border-left-color: var(--text-muted);
    opacity: 0.6;
}

.friend-panel-item .friend-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--secondary);
    flex-shrink: 0;
}

.friend-panel-item.offline .friend-status-dot {
    background: var(--text-muted);
}

.friend-panel-item.lobby {
    border-left-color: #38bdf8;
}

.friend-panel-item.lobby .friend-status-dot {
    background: #38bdf8;
}

.friend-panel-item.ingame {
    border-left-color: var(--accent);
}

.friend-panel-item.ingame .friend-status-dot {
    background: var(--accent);
}

.friend-panel-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-left: 8px;
    overflow: hidden;
}

.friend-panel-item .friend-name {
    font-weight: 700;
    color: white;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.friend-panel-status {
    font-size: 10px;
    color: var(--text-dim);
    line-height: 1;
}

/* Friends Guest Warning */
.friends-guest-warning {
    background: rgba(239, 68, 68, 0.1);
    border: 2px solid var(--danger);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-bottom: 16px;
    text-align: center;
}

.friends-guest-warning i {
    font-size: 32px;
    color: var(--danger);
    display: block;
    margin-bottom: 8px;
}

.friends-guest-warning p {
    color: var(--text);
    font-size: 13px;
    margin: 4px 0;
}

.friends-guest-warning p:first-of-type {
    font-weight: 700;
}

/* ============================================
   LEADERBOARD PANEL (Column 3)
   ============================================ */
.leaderboard-panel {
    width: 220px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    display: flex;
    flex-direction: column;
    max-height: 320px;
}

.leaderboard-panel-header {
    font-family: var(--font-display);
    font-size: 14px;
    color: var(--accent);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 6px;
}

.leaderboard-panel-filters {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.lb-filter-btn {
    flex: 1;
    padding: 8px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lb-filter-btn:hover {
    background: rgba(0, 0, 0, 0.5);
    border-color: var(--accent);
    color: var(--accent);
}

.lb-filter-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg-dark);
    font-weight: 700;
}

.leaderboard-panel-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.leaderboard-panel-list::-webkit-scrollbar {
    display: none;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    border-left: 3px solid var(--accent);
    font-size: 12px;
    transition: all 0.2s;
}

.leaderboard-item:hover {
    background: rgba(0, 0, 0, 0.5);
    transform: translateX(2px);
}

.leaderboard-item.rank-1 {
    border-left-color: #FFD700;
    background: rgba(255, 215, 0, 0.1);
}

.leaderboard-item.rank-2 {
    border-left-color: #C0C0C0;
    background: rgba(192, 192, 192, 0.1);
}

.leaderboard-item.rank-3 {
    border-left-color: #CD7F32;
    background: rgba(205, 127, 50, 0.1);
}

.leaderboard-rank {
    width: 24px;
    height: 24px;
    background: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 11px;
    color: var(--bg-dark);
    flex-shrink: 0;
}

.leaderboard-item.rank-1 .leaderboard-rank {
    background: #FFD700;
}

.leaderboard-item.rank-2 .leaderboard-rank {
    background: #C0C0C0;
}

.leaderboard-item.rank-3 .leaderboard-rank {
    background: #CD7F32;
}

.leaderboard-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
    flex-shrink: 0;
}

.leaderboard-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.leaderboard-name {
    font-weight: 700;
    color: white;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
}

.leaderboard-stat {
    font-size: 10px;
    color: var(--text-dim);
    line-height: 1;
}

.loading-spinner-small {
    text-align: center;
    color: var(--text-dim);
    font-size: 11px;
    padding: 20px 10px;
    font-style: italic;
}

/* ============================================
   SHOP STYLES
   ============================================ */
.shop-balance {
    background: rgba(255, 210, 63, 0.1);
    border: 1px solid rgba(255, 210, 63, 0.3);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text);
}

.shop-balance i {
    font-size: 20px;
    color: var(--accent);
}

.shop-balance strong {
    color: var(--accent);
    font-size: 16px;
}

.shop-categories {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.shop-category-btn {
    flex: 1;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.shop-category-btn:hover {
    background: rgba(0, 0, 0, 0.5);
    border-color: var(--accent);
    color: var(--accent);
}

.shop-category-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg-dark);
    font-weight: 700;
}

.shop-items-container {
    min-height: 200px;
    max-height: 400px;
    overflow-y: auto;
}

/* Responsive menu buttons */
@media (max-width: 768px) {
    .main-menu-layout {
        flex-direction: column;
    }

    .leaderboard-panel,
    .friends-panel {
        width: 100%;
        max-height: 200px;
    }

    .menu-btn {
        padding: 16px;
        gap: 16px;
    }

    .menu-btn.compact {
        padding: 12px 14px;
        gap: 10px;
    }

    .menu-btn .btn-icon {
        font-size: 28px;
        width: 50px;
        height: 50px;
    }

    .menu-btn.compact .btn-icon {
        font-size: 22px;
        width: 36px;
        height: 36px;
    }

    .btn-title {
        font-size: 18px;
    }

    .menu-btn.compact .btn-title {
        font-size: 15px;
    }

    .btn-desc {
        font-size: 12px;
    }

    .menu-btn.compact .btn-desc {
        font-size: 10px;
    }
}

@media (max-width: 480px) {
    .menu-btn {
        padding: 14px;
        gap: 12px;
    }

    .menu-btn.compact {
        padding: 10px 12px;
        gap: 8px;
    }

    .menu-btn .btn-icon {
        font-size: 24px;
        width: 45px;
        height: 45px;
    }

    .menu-btn.compact .btn-icon {
        font-size: 20px;
        width: 32px;
        height: 32px;
    }

    .btn-title {
        font-size: 16px;
    }

    .menu-btn.compact .btn-title {
        font-size: 14px;
    }

    .btn-desc {
        font-size: 11px;
    }

    .menu-btn.compact .btn-desc {
        font-size: 9px;
    }

    .friends-panel {
        max-height: 150px;
    }

    .friends-panel-header {
        font-size: 12px;
    }

    .friend-panel-item {
        padding: 6px;
        font-size: 11px;
    }
}

/* BANNERS (Single Player / Create) */
.banner-options {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.banner-option {
    flex: 1;
    background: var(--bg-card);
    border: 2px solid transparent;
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 140px;
}

.banner-option:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.05);
}

.banner-option.selected {
    border-color: var(--primary);
    background: rgba(255, 107, 53, 0.1);
    box-shadow: 0 4px 20px rgba(255, 107, 53, 0.2);
}

.banner-icon {
    font-size: 40px;
    margin-bottom: 12px;
}

.banner-option h3 {
    font-family: var(--font-display);
    margin-bottom: 6px;
    color: white;
}

.banner-option p {
    font-size: 12px;
    color: var(--text-dim);
}

/* Responsive banners */
@media (max-width: 768px) {
    .banner-options {
        gap: 12px;
    }

    .banner-option {
        padding: 16px;
        min-width: 120px;
    }

    .banner-icon {
        font-size: 36px;
    }

    .banner-option h3 {
        font-size: 16px;
    }

    .banner-option p {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .banner-options {
        flex-direction: column;
        gap: 10px;
    }

    .banner-option {
        padding: 14px;
        min-width: 100%;
    }

    .banner-icon {
        font-size: 32px;
        margin-bottom: 8px;
    }
}

/* TOGGLES & INPUTS */
.difficulty-toggle {
    display: flex;
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-sm);
    padding: 4px;
    margin-bottom: 16px;
}

.diff-btn {
    flex: 1;
    padding: 8px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-weight: 700;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}

.diff-btn.active {
    background: var(--bg-card);
    color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.section-label {
    display: block;
    font-size: 12px;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.input-group {
    margin-bottom: 16px;
}

.input-group label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-dim);
    margin-bottom: 6px;
}

.input-group input {
    width: 100%;
    padding: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: white;
    font-family: var(--font-body);
}

/* Responsive inputs */
@media (max-width: 768px) {
    .input-group input {
        padding: 10px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .input-group {
        margin-bottom: 12px;
    }

    .input-group input {
        padding: 8px;
        font-size: 13px;
    }

    .input-group label {
        font-size: 11px;
    }
}

/* ACTIONS (Back/Start) */
.menu-actions {
    display: flex;
    gap: 12px;
    margin-top: 10px;
}

.btn-secondary {
    padding: 14px 24px;
    background: transparent;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-dim);
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    flex: 1;
}

.btn-secondary:hover {
    border-color: white;
    color: white;
}

.btn-primary {
    flex: 1;
    padding: 14px 24px;
    background: linear-gradient(135deg, var(--primary) 0%, #ff8c42 100%);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-family: var(--font-display);
    font-size: 18px;
    cursor: pointer;
    text-transform: uppercase;
    box-shadow: 0 4px 0 var(--primary-dark);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 var(--primary-dark), 0 8px 15px rgba(255, 107, 53, 0.3);
}

.btn-primary:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 var(--primary-dark);
}

/* Responsive buttons */
@media (max-width: 768px) {

    .btn-primary,
    .btn-secondary {
        padding: 12px 20px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {

    .btn-primary,
    .btn-secondary {
        padding: 10px 16px;
        font-size: 14px;
    }

    .menu-actions {
        flex-direction: column;
        gap: 8px;
    }

    .menu-actions button {
        width: 100%;
    }
}

/* SERVER LIST */
.server-list-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    height: 250px;
    overflow-y: auto;
    overflow-x: auto;
    margin-bottom: 16px;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.server-list-container::-webkit-scrollbar {
    display: none;
}

.server-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    min-width: 600px;
}

.server-table th {
    text-align: left;
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    position: sticky;
    top: 0;
    white-space: nowrap;
}

.server-table td {
    padding: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.server-table tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Responsive server table */
@media (max-width: 768px) {
    .server-list-container {
        height: 200px;
    }

    .server-table {
        font-size: 12px;
        min-width: 500px;
    }

    .server-table th,
    .server-table td {
        padding: 8px;
    }

    .server-table th {
        font-size: 10px;
    }
}

@media (max-width: 480px) {
    .server-list-container {
        height: 180px;
    }

    .server-table {
        font-size: 11px;
        min-width: 450px;
    }

    .server-table th,
    .server-table td {
        padding: 6px;
    }
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 4px;
    background: var(--secondary);
    color: #1a1a2e;
    border: none;
    font-weight: 800;
    cursor: pointer;
}

.btn-sm:hover {
    filter: brightness(1.1);
}

.btn-sm.btn-reconnect {
    background: var(--accent);
    animation: pulseReconnect 2s infinite;
}

.btn-sm.btn-reconnect:hover {
    background: #ffe066;
}

@keyframes pulseReconnect {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(255, 210, 63, 0.7);
    }

    50% {
        box-shadow: 0 0 0 8px rgba(255, 210, 63, 0);
    }
}

/* WAITING ROOM */
.waiting-room-layout {
    display: flex;
    gap: 16px;
    width: 100%;
}

.waiting-room-main {
    flex: 1;
}

.players-waiting-box {
    background: var(--bg-card);
    padding: 20px;
    border-radius: var(--radius);
    text-align: center;
    border: 1px dashed var(--border);
    margin-bottom: 20px;
}

/* Waiting Room Friends Panel */
.waiting-friends-panel {
    width: 200px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    display: flex;
    flex-direction: column;
    max-height: 400px;
}

.waiting-friends-header {
    font-family: var(--font-display);
    font-size: 13px;
    color: var(--accent);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 6px;
}

.waiting-friends-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.waiting-friends-list::-webkit-scrollbar {
    display: none;
}

.waiting-friend-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    border-left: 3px solid var(--secondary);
    font-size: 11px;
    transition: all 0.2s;
}

.waiting-friend-item:hover {
    background: rgba(0, 0, 0, 0.5);
}

.waiting-friend-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.waiting-friend-name {
    font-weight: 700;
    color: white;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
}

.waiting-friend-status {
    font-size: 9px;
    color: var(--accent);
    opacity: 0.8;
}

.btn-invite-friend {
    padding: 4px 8px;
    background: var(--primary);
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 3px;
}

.btn-invite-friend:hover {
    background: #ff8c42;
    transform: scale(1.05);
}

.btn-invite-friend:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Responsive waiting room */
@media (max-width: 768px) {
    .waiting-room-layout {
        flex-direction: column;
    }

    .waiting-friends-panel {
        width: 100%;
        max-height: 200px;
    }
}

.waiting-hint {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 10px;
    font-style: italic;
    animation: pulseText 2s infinite;
}

@keyframes pulseText {

    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }
}

/* READY STATUS */
.player-tag {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 15px;
    color: white;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border);
    transition: all 0.3s;
    animation: playerPopIn 0.3s ease-out;
    margin-bottom: 8px;
    width: 100%;
}

.player-tag.ready {
    background: rgba(61, 220, 132, 0.1);
    border-color: rgba(61, 220, 132, 0.3);
}

.ready-badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.ready-badge.host {
    background: rgba(255, 210, 63, 0.2);
    color: #FFD23F;
    border: 1px solid rgba(255, 210, 63, 0.3);
}

.ready-badge.success {
    background: rgba(61, 220, 132, 0.2);
    color: var(--secondary);
    border: 1px solid rgba(61, 220, 132, 0.3);
    box-shadow: 0 0 10px rgba(61, 220, 132, 0.2);
}

.ready-badge.pending {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-dim);
    border: 1px solid var(--border);
}

#btn-ready.ready-active {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

.btn-primary.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: saturate(0.5);
    transform: none !important;
    box-shadow: none !important;
}

.waiting-player-list {
    display: flex;
    flex-direction: column;
    width: 100%;
}

@keyframes playerPopIn {
    from {
        transform: scale(0.95);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* ======= GAME HUD ======= */
.hud {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.4) 80%, transparent 100%);
    z-index: 100;
    pointer-events: none;
}

.hud-top-left {
    position: absolute;
    top: 15px;
    left: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: auto;
    width: 300px;
}

.hud-top-right {
    position: absolute;
    top: 15px;
    right: 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    pointer-events: auto;
}

.hud-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.hud-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid var(--accent);
    border-radius: var(--radius-sm);
    padding: 6px 16px;
    min-width: 100px;
}

.score-label {
    font-size: 10px;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: 2px;
    text-transform: uppercase;
}

.score-value {
    font-family: var(--font-display);
    font-size: 32px;
    color: white;
    text-shadow: 0 2px 10px rgba(255, 210, 63, 0.5);
}

.hud-combo {
    font-family: var(--font-display);
    font-size: 18px;
    color: var(--secondary);
    text-shadow: 0 0 10px rgba(61, 220, 132, 0.5);
}

.hud-timer {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid var(--primary);
    border-radius: 30px;
    padding: 6px 16px;
}

.timer-icon {
    font-size: 20px;
}

.timer-value {
    font-family: var(--font-display);
    font-size: 28px;
    color: white;
    min-width: 60px;
    text-align: center;
}

.timer-value.danger {
    color: var(--danger);
    animation: timerFlash 0.5s ease-in-out infinite alternate;
}

@keyframes timerFlash {
    from {
        opacity: 1;
    }

    to {
        opacity: 0.4;
    }
}

.hud-holding {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    background: rgba(0, 0, 0, 0.85);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 14px;
    min-width: 160px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.holding-label {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 2px;
    color: var(--text-dim);
    text-transform: uppercase;
    margin-bottom: 2px;
}

.holding-display {
    font-size: 18px;
    font-weight: 700;
    margin-top: 2px;
    line-height: 1.4;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

/* ======= ORDERS BAR ======= */
.orders-bar {
    position: fixed;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 90;
    padding: 4px 12px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 30px;
    border: 1px solid var(--border);
    backdrop-filter: blur(8px);
    scale: 0.9;
}

.orders-label {
    font-family: var(--font-display);
    font-size: 14px;
    color: var(--accent);
    white-space: nowrap;
}

.orders-list {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    max-width: 70vw;
    -ms-overflow-style: none;
    /* IE and Edge */
    scrollbar-width: none;
    /* Firefox */
}

.orders-list::-webkit-scrollbar {
    display: none;
    /* Chrome, Safari and Opera */
}

.order-card {
    background: rgba(30, 41, 59, 0.95);
    border: 2px solid rgba(255, 210, 63, 0.3);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    min-width: 120px;
    text-align: center;
    position: relative;
    animation: orderSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    flex-shrink: 0;
}

@keyframes orderSlideIn {
    from {
        transform: translateY(-30px) scale(0.8);
        opacity: 0;
    }

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

.order-card.urgent {
    border-color: var(--danger);
    animation: urgentPulse 0.8s ease-in-out infinite alternate;
}

@keyframes urgentPulse {
    from {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }

    to {
        box-shadow: 0 0 15px 3px rgba(239, 68, 68, 0.4);
    }
}

.order-emoji {
    font-size: 28px;
    display: block;
    margin-bottom: 4px;
}

.order-name {
    font-size: 12px;
    font-weight: 800;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.order-ingredients {
    font-size: 16px;
    margin-top: 4px;
}

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

.order-timer-fill {
    height: 100%;
    border-radius: 2px;
    background: var(--secondary);
    transition: width 1s linear, background 0.3s;
}

.order-timer-fill.low {
    background: var(--danger);
}

.order-points {
    font-size: 11px;
    color: var(--accent);
    font-weight: 700;
    margin-top: 3px;
}

/* ======= GAME CANVAS ======= */
#game-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* ======= NOTIFICATIONS ======= */
.notifications {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    z-index: 200;
    pointer-events: none;
}

.notification {
    padding: 10px 24px;
    border-radius: 30px;
    font-family: var(--font-display);
    font-size: 16px;
    color: white;
    animation: notifSlide 0.3s ease-out, notifFade 0.5s ease-in 2s forwards;
    white-space: nowrap;
}

.notification.success {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    box-shadow: 0 4px 20px rgba(46, 204, 113, 0.4);
}

.notification.error {
    background: linear-gradient(135deg, #c0392b, #e74c3c);
    box-shadow: 0 4px 20px rgba(231, 76, 60, 0.4);
}

.notification.info {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

@keyframes notifSlide {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

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

@keyframes notifFade {
    to {
        transform: translateY(-20px);
        opacity: 0;
    }
}

/* ======= QUICK CHAT SIDEBAR (Vertical) ======= */
.quick-chat-sidebar {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(0, 0, 0, 0.4);
    padding: 8px;
    border-radius: 30px;
    border: 1px solid var(--border);
    backdrop-filter: blur(10px);
    z-index: 100;
    pointer-events: auto;
}

.side-chat-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.2s;
}

.side-chat-btn:hover {
    background: var(--primary);
    transform: scale(1.1);
}

.side-chat-btn:active {
    transform: scale(0.95);
}

.side-chat-btn .key-hint {
    position: absolute;
    bottom: -2px;
    right: -2px;
    font-size: 8px;
    background: var(--accent);
    color: var(--bg);
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
}

.side-chat-divider {
    height: 2px;
    background: linear-gradient(to right, transparent, var(--border), transparent);
    margin: 4px 10px;
}

/* ======= FLOATING CHAT INPUT ======= */
.floating-chat-container {
    position: fixed;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    width: 400px;
    background: rgba(15, 23, 42, 0.95);
    border: 2px solid var(--primary);
    border-radius: 30px;
    padding: 6px 16px;
    display: flex;
    gap: 10px;
    z-index: 200;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    animation: slideUpFade 0.3s ease-out;
    pointer-events: auto;
}

@keyframes slideUpFade {
    from {
        transform: translate(-50%, 20px);
        opacity: 0;
    }

    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

.floating-chat-container input {
    flex: 1;
    background: transparent;
    border: none;
    color: white;
    font-size: 16px;
    outline: none;
    font-family: var(--font-body);
}

.floating-chat-container button {
    background: var(--primary);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s;
}

.floating-chat-container button:hover {
    transform: scale(1.1);
}

/* ======= HUD CHAT LOG (Top Left) ======= */
.hud-chat-log {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 150px;
    overflow: hidden;
    pointer-events: none;
    margin-top: 10px;
    mask-image: linear-gradient(to bottom, black 70%, transparent 100%);
}

.hud-chat-line {
    background: none;
    padding: 2px 0;
    font-size: 14px;
    color: white;
    width: fit-content;
    animation: chatPopIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
}

.hud-chat-line .sender {
    font-weight: 800;
    margin-right: 6px;
    font-family: var(--font-display);
    font-size: 11px;
    text-transform: uppercase;
}

.hud-chat-line.system {
    font-style: italic;
    color: var(--text-dim);
    font-size: 12px;
}

.hud-chat-line.system i {
    margin-right: 4px;
}

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

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



.floating-chat-container.hidden {
    display: none;
}

.hud-player-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 200px;
}

.hud-player-tag {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.6);
    padding: 4px 10px;
    border-radius: 8px;
    border-left: 4px solid var(--primary);
    font-size: 12px;
}

.hud-player-tag .player-name {
    font-weight: 700;
}

.hud-player-tag .player-score {
    font-family: var(--font-display);
    color: var(--accent);
}

.key-hint {
    font-size: 9px;
    background: rgba(255, 255, 255, 0.2);
    padding: 1px 4px;
    border-radius: 3px;
    margin-right: 2px;
    vertical-align: middle;
}

/* ======= RECIPE BOOK ======= */
.btn-recipe-toggle {
    position: fixed;
    bottom: 12px;
    right: 12px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 2px solid var(--accent);
    font-size: 24px;
    cursor: pointer;
    z-index: 150;
    transition: transform 0.2s;
}

.btn-recipe-toggle:hover {
    transform: scale(1.1);
}

.recipe-book {
    position: fixed;
    bottom: 70px;
    right: 12px;
    width: 320px;
    max-height: 400px;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    z-index: 150;
    backdrop-filter: blur(20px);
    -ms-overflow-style: none;
    /* IE and Edge */
    scrollbar-width: none;
    /* Firefox */
}

/* Responsive recipe book */
@media (max-width: 768px) {
    .recipe-book {
        width: 280px;
        max-height: 350px;
        padding: 12px;
        right: 10px;
    }

    .btn-recipe-toggle {
        right: 10px;
        bottom: 10px;
    }
}

@media (max-width: 480px) {
    .recipe-book {
        width: calc(100vw - 20px);
        max-height: 60vh;
        padding: 12px;
        right: 10px;
        left: 10px;
    }

    .recipe-item {
        padding: 8px;
        gap: 8px;
    }

    .recipe-item-emoji {
        font-size: 28px;
    }

    .recipe-item-name {
        font-size: 13px;
    }

    .recipe-item-ings {
        font-size: 11px;
    }

    .recipe-item-points {
        font-size: 14px;
    }
}

.recipe-book::-webkit-scrollbar {
    display: none;
    /* Chrome, Safari and Opera */
}

.recipe-book h3 {
    font-family: var(--font-display);
    color: var(--accent);
    margin-bottom: 12px;
}

.recipe-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    margin-bottom: 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.recipe-item-emoji {
    font-size: 32px;
}

.recipe-item-info {
    flex: 1;
}

.recipe-item-name {
    font-weight: 800;
    font-size: 14px;
    margin-bottom: 2px;
}

.recipe-item-ings {
    font-size: 12px;
    color: var(--text-dim);
}

.recipe-item-points {
    font-family: var(--font-display);
    color: var(--accent);
    font-size: 16px;
}

.recipe-process {
    font-size: 11px;
    color: #f39c12;
    font-style: italic;
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* ======= GUIDE BOOK ======= */
.btn-guide-toggle {
    position: fixed;
    bottom: 12px;
    right: 70px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 2px solid var(--secondary);
    font-size: 24px;
    cursor: pointer;
    z-index: 150;
    transition: transform 0.2s;
    color: var(--secondary);
}

.btn-guide-toggle:hover {
    transform: scale(1.1);
    box-shadow: var(--glow-green);
}

.guide-book {
    position: fixed;
    bottom: 70px;
    right: 70px;
    width: 500px;
    max-height: 600px;
    overflow-y: auto;
    background: var(--bg-card);
    border: 2px solid var(--secondary);
    border-radius: var(--radius);
    padding: 20px;
    z-index: 150;
    backdrop-filter: blur(20px);
    box-shadow: var(--glow-green);
}

/* Responsive guide book */
@media (max-width: 768px) {
    .guide-book {
        width: 400px;
        max-height: 500px;
        padding: 16px;
        right: 10px;
        bottom: 70px;
    }

    .btn-guide-toggle {
        right: 10px;
        bottom: 10px;
    }
}

@media (max-width: 480px) {
    .guide-book {
        width: calc(100vw - 20px);
        max-height: 70vh;
        padding: 12px;
        right: 10px;
        left: 10px;
        bottom: 70px;
    }

    .guide-section {
        padding: 12px;
        margin-bottom: 16px;
    }

    .guide-section h4 {
        font-size: 14px;
    }

    .guide-section p,
    .guide-section li {
        font-size: 13px;
    }
}

.guide-book::-webkit-scrollbar {
    width: 8px;
}

.guide-book::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.guide-book::-webkit-scrollbar-thumb {
    background: var(--secondary);
    border-radius: 4px;
}

.guide-book-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--secondary);
}

.guide-book-header h3 {
    font-family: var(--font-display);
    color: var(--secondary);
    font-size: 20px;
}

.guide-book-header button {
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
    transition: color 0.2s;
}

.guide-book-header button:hover {
    color: var(--danger);
}

.guide-content,
.guide-container {
    font-size: 14px;
    line-height: 1.6;
}

.guide-section {
    margin-bottom: 24px;
    padding: 16px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--secondary);
}

.guide-section h4 {
    font-family: var(--font-display);
    color: var(--accent);
    font-size: 16px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.guide-section p {
    color: var(--text-dim);
    margin-bottom: 8px;
}

.guide-section ul {
    list-style: none;
    padding-left: 0;
}

.guide-section li {
    padding: 6px 0;
    padding-left: 24px;
    position: relative;
    color: var(--text);
}

.guide-section li::before {
    content: "▸";
    position: absolute;
    left: 8px;
    color: var(--secondary);
    font-weight: bold;
}

.guide-section .step-number {
    display: inline-block;
    width: 24px;
    height: 24px;
    background: var(--secondary);
    color: var(--bg-dark);
    border-radius: 50%;
    text-align: center;
    line-height: 24px;
    font-weight: 800;
    margin-right: 8px;
    font-size: 12px;
}

.guide-section .emoji-icon {
    font-size: 20px;
    margin-right: 4px;
}

.guide-tip {
    background: rgba(61, 220, 132, 0.1);
    border: 1px solid var(--secondary);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-top: 12px;
    font-size: 13px;
}

.guide-tip strong {
    color: var(--secondary);
}

.guide-warning {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-top: 12px;
    font-size: 13px;
}

.guide-warning strong {
    color: var(--danger);
}

.guide-container {
    max-height: 500px;
    overflow-y: auto;
    padding-right: 8px;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.guide-container::-webkit-scrollbar {
    display: none;
}

.recipe-book-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.recipe-book-header button {
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
}

.recipe-book-header button:hover {
    color: var(--danger);
}

/* ======= GAME OVER ======= */
#gameover-screen {
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    z-index: 500;
}

.gameover-container {
    text-align: center;
    max-width: 600px;
    width: 95%;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: gameoverPop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.gameover-container.vs-mode {
    max-width: 800px;
}

@keyframes gameoverPop {
    from {
        transform: scale(0) rotate(-10deg);
        opacity: 0;
    }

    to {
        transform: scale(1) rotate(0);
        opacity: 1;
    }
}

.gameover-title {
    font-family: var(--font-display);
    font-size: 48px;
    color: var(--primary);
    text-shadow: 0 4px 0 var(--primary-dark), 0 8px 30px rgba(255, 107, 53, 0.4);
    margin-bottom: 24px;
}

.gameover-score {
    margin-bottom: 24px;
}

.final-score {
    font-family: var(--font-display);
    font-size: 72px;
    color: var(--accent);
    text-shadow: 0 0 40px rgba(255, 210, 63, 0.5);
    line-height: 1;
}

.score-label-big {
    font-size: 18px;
    color: var(--text-dim);
    font-weight: 700;
    letter-spacing: 4px;
    text-transform: uppercase;
}

.gameover-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
}

.stat-value {
    font-family: var(--font-display);
    font-size: 28px;
    color: white;
}

.stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.gameover-players {
    margin-bottom: 20px;
}

/* VS Game Over Specific Layouts */
.vs-stats-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    width: 100%;
    margin: 20px 0;
}

.vs-stat-card {
    flex: 1;
    min-width: 0;
    max-width: 250px;
    background: rgba(0, 0, 0, 0.6);
    border: 4px solid var(--border);
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.vs-player-name {
    font-size: 1.8rem;
    margin: 0 0 10px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vs-player-score {
    font-size: 3.5rem;
    font-family: 'Fredoka One', cursive;
    color: #fff;
    text-shadow: 3px 3px 0 #000;
    line-height: 1;
}

.vs-score-label {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: #ffd700;
}

.vs-player-details {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 10px;
    margin-top: 10px;
}

.vs-detail-item {
    font-size: 1.1rem;
    color: #fff;
    margin-bottom: 5px;
}

@media (max-width: 600px) {
    .vs-stats-container {
        gap: 10px;
    }

    .vs-stat-card {
        padding: 10px;
        max-width: 180px;
    }

    .vs-player-name {
        font-size: 1.2rem;
    }

    .vs-player-score {
        font-size: 2.2rem;
    }

    .vs-score-label {
        font-size: 0.9rem;
        margin-bottom: 10px;
    }

    .vs-detail-item {
        font-size: 0.8rem;
    }
}


.star-rating {
    font-size: 48px;
    margin-bottom: 24px;
}

.star-rating .star {
    display: inline-block;
    animation: starPop 0.4s ease-out backwards;
    filter: drop-shadow(0 0 10px rgba(255, 210, 63, 0.5));
}

.star-rating .star:nth-child(1) {
    animation-delay: 0.2s;
}

.star-rating .star:nth-child(2) {
    animation-delay: 0.4s;
}

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

@keyframes starPop {
    from {
        transform: scale(0) rotate(-180deg);
    }

    to {
        transform: scale(1) rotate(0deg);
    }
}

.star-empty {
    filter: grayscale(1) opacity(0.3) !important;
}

.btn-restart {
    display: inline-flex;
    width: auto;
    padding: 16px 48px;
}

/* ======= SCORE POP EFFECT ======= */
.score-pop {
    position: fixed;
    font-family: var(--font-display);
    font-size: 32px;
    color: var(--accent);
    text-shadow: 0 2px 10px rgba(255, 210, 63, 0.8);
    pointer-events: none;
    z-index: 300;
    animation: scorePop 1.2s ease-out forwards;
}

@keyframes scorePop {
    0% {
        transform: translateY(0) scale(0.5);
        opacity: 0;
    }

    20% {
        transform: translateY(-10px) scale(1.2);
        opacity: 1;
    }

    100% {
        transform: translateY(-80px) scale(0.8);
        opacity: 0;
    }
}

/* ======= RESPONSIVE ======= */
@media (max-width: 768px) {
    .game-logo {
        font-size: 32px;
    }

    .logo-icon {
        font-size: 40px;
    }

    .hud {
        padding: 8px 12px;
    }

    .score-value {
        font-size: 24px;
    }

    .timer-value {
        font-size: 22px;
    }

    .orders-bar {
        top: 65px;
    }

    .order-card {
        min-width: 90px;
        padding: 6px 8px;
    }

    .order-emoji {
        font-size: 22px;
    }

    .chat-container {
        width: 200px;
    }

    .gameover-title {
        font-size: 36px;
    }

    .final-score {
        font-size: 56px;
    }
}

/* ======= NEW FEATURES STYLES ======= */

/* Connection Status */
.connection-status {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 20px;
    border: 1px solid var(--border);
    font-size: 12px;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 8px;
}

.connection-status.connected {
    color: var(--secondary);
}

.connection-status.disconnected {
    color: var(--danger);
}

.connection-status.connecting {
    color: var(--accent);
}

/* Connection Quality Indicator */
.connection-quality {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--text-dim);
    margin-top: 4px;
}

.connection-quality.good {
    color: var(--secondary);
}

.connection-quality.medium {
    color: var(--accent);
}

.connection-quality.bad {
    color: var(--danger);
}

/* Room Code Display */
.room-code-display {
    background: rgba(0, 0, 0, 0.4);
    border: 2px dashed var(--accent);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin: 12px 0;
    text-align: center;
}

.room-code-value {
    font-family: 'Courier New', monospace;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: 4px;
    color: var(--accent);
    margin: 8px 0;
}

/* Room Info */
.room-info {
    display: flex;
    justify-content: space-around;
    gap: 12px;
    margin: 12px 0;
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-sm);
    font-size: 13px;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-dim);
}

/* Quick Chat Buttons */
.quick-chat-lobby {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin: 12px 0;
    flex-wrap: wrap;
}

.quick-chat-btn {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text);
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.quick-chat-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.quick-chat-buttons {
    display: flex;
    gap: 4px;
    padding: 4px 8px;
    border-top: 1px solid var(--border);
}

.quick-chat-btn-small {
    flex: 1;
    padding: 6px;
    background: transparent;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 16px;
    transition: color 0.2s;
}

.quick-chat-btn-small:hover {
    color: var(--accent);
}

/* VS Scoreboard */
.vs-scoreboard {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px;
    margin-top: 8px;
    min-width: 150px;
}

.scoreboard-title {
    font-size: 10px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}

#vs-scores-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.vs-score-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.vs-score-item .player-name {
    font-weight: 700;
}

.vs-score-item .player-score {
    color: var(--accent);
    font-weight: 800;
}

/* Server Filters */
.server-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.server-filters select {
    flex: 1;
    min-width: 120px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 13px;
}

.server-filters select:focus {
    outline: none;
    border-color: var(--accent);
}

/* Join Code Section */
.join-code-section {
    margin-bottom: 16px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-sm);
}

.join-code-section label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    gap: 6px;
}

.join-code-input {
    display: flex;
    gap: 8px;
}

.join-code-input input {
    flex: 1;
    padding: 10px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: 'Courier New', monospace;
    font-size: 18px;
    text-align: center;
    letter-spacing: 2px;
}

/* Friends Section */
.friends-section {
    width: 100%;
}

.add-friend-section {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.add-friend-section input {
    flex: 1;
    padding: 10px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
}

.friends-list {
    max-height: 300px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.friend-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.friend-item .friend-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.friend-item .friend-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
}

.friend-details-small {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.friend-status-label {
    font-size: 10px;
    color: var(--text-dim);
}

.btn-sm.unavailable {
    opacity: 0.3;
    cursor: not-allowed !important;
    background: rgba(255, 255, 255, 0.05) !important;
}

.friend-item .friend-status.online {
    background: var(--secondary);
}

.friend-item .friend-status.lobby {
    background: #38bdf8;
}

.friend-item .friend-status.ingame {
    background: var(--accent);
}

/* ======= COUNTDOWN OVERLAY ======= */
.countdown-overlay {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at center, rgba(26, 26, 46, 0.85) 0%, rgba(15, 12, 41, 0.98) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(8px);
    overflow: hidden;
}

.countdown-content {
    text-align: center;
    position: relative;
    z-index: 5;
    animation: contentEntrance 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.countdown-logo {
    font-family: var(--font-display);
    font-size: clamp(60px, 10vw, 120px);
    line-height: 0.85;
    margin-bottom: 2rem;
    text-transform: uppercase;
    background: linear-gradient(135deg, #FF6B35 0%, #FFD23F 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 30px rgba(255, 107, 53, 0.4));
    animation: logoFloat 3s ease-in-out infinite alternate;
}

.countdown-message {
    font-size: clamp(18px, 2vw, 28px);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5em;
    color: var(--primary);
    margin-bottom: 1rem;
    opacity: 0.9;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.countdown-number {
    font-family: var(--font-display);
    font-size: clamp(120px, 25vw, 320px);
    color: #FFD23F;
    text-shadow:
        0 0 20px rgba(255, 210, 63, 0.5),
        0 10px 40px rgba(255, 107, 53, 0.4);
    line-height: 1;
    margin: 0;
    padding: 0;
}

.countdown-overlay::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('https://www.transparenttextures.com/patterns/carbon-fibre.png');
    opacity: 0.1;
    pointer-events: none;
}

@keyframes contentEntrance {
    from {
        transform: scale(0.8) translateY(50px);
        opacity: 0;
    }

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

@keyframes logoFloat {
    from {
        transform: translateY(0) scale(1.0);
    }

    to {
        transform: translateY(-15px) scale(1.02);
    }
}

/* We will re-apply an animation to number in JS for each tick */
.number-pop {
    animation: numberPopIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes numberPopIn {
    0% {
        transform: scale(0.2) rotate(-10deg);
        opacity: 0;
        filter: blur(10px);
    }

    50% {
        transform: scale(1.1) rotate(5deg);
        opacity: 1;
        filter: blur(0);
    }

    100% {
        transform: scale(1) rotate(0);
        opacity: 1;
    }
}

.countdown-overlay.hidden {
    display: none !important;
}

/* Modals */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    max-width: 400px;
    width: 90%;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }

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

/* Mobile responsive modal */
@media (max-width: 768px) {
    .modal {
        padding: 0;
        align-items: center;
        overflow: hidden;
    }

    .modal-content {
        width: 100%;
        max-width: 100%;
        padding: 20px;
        margin: 0;
    }

    /* Full screen for profile modal specifically */
    #profile-modal .modal-content {
        height: 100vh;
        padding: 0;
        border-radius: 0;
    }

    /* Hide mobile header elements */
    .profile-mobile-header {
        display: none !important;
    }
}

@media (max-width: 480px) {
    .modal {
        padding: 0;
    }

    .modal-content {
        width: 100%;
        padding: 16px;
        margin: 0;
    }

    /* Full screen for profile modal specifically */
    #profile-modal .modal-content {
        height: 100vh;
        padding: 0;
        border-radius: 0;
    }

    /* Hide mobile header elements */
    .profile-mobile-header {
        display: none !important;
    }
}

.modal-content h3 {
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-content input {
    width: 100%;
    padding: 12px;
    margin-bottom: 16px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
}

.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.btn-danger {
    background: var(--danger);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 700;
    transition: background 0.2s;
}

.btn-danger:hover {
    background: #dc2626;
}

/* Chat Header */
.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    font-weight: 700;
}

.chat-toggle {
    background: transparent;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 16px;
}

.chat-container.collapsed .chat-messages,
.chat-container.collapsed .chat-input-row,
.chat-container.collapsed .quick-chat-buttons {
    display: none;
}

/* Recipe Book Header */
.recipe-book-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.recipe-book-header button {
    background: transparent;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 20px;
}

/* Pause Menu */
.pause-menu {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    backdrop-filter: blur(10px);
}

.pause-menu.hidden {
    display: none;
}

.pause-content {
    text-align: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    max-width: 300px;
    width: 90%;
}

.pause-content h2 {
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.pause-content button {
    width: 100%;
    margin-bottom: 12px;
}

/* Server Table Status Badges */
.status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.status-badge.waiting {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

.status-badge.ingame {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.status-badge.full {
    background: rgba(107, 114, 128, 0.2);
    color: #9ca3af;
}

/* Button with Icons */
.btn-icon {
    font-size: 24px;
}

.banner-icon {
    font-size: 32px;
}

/* Kick Button */
.btn-kick {
    padding: 6px 10px;
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.4);
    border-radius: 6px;
    color: var(--danger);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-kick:hover {
    background: var(--danger);
    color: white;
    transform: scale(1.05);
}

/* Add Friend Lobby Button */
.btn-add-friend-lobby {
    padding: 4px 8px;
    background: rgba(61, 220, 132, 0.2);
    border: 1px solid rgba(61, 220, 132, 0.4);
    border-radius: 6px;
    color: var(--secondary);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 10px;
    vertical-align: middle;
}

.btn-add-friend-lobby:hover {
    background: var(--secondary);
    color: var(--bg-dark);
    transform: scale(1.1);
}

/* Refresh Button */
.btn-refresh {
    padding: 10px 20px;
    background: rgba(61, 220, 132, 0.2);
    border: 2px solid rgba(61, 220, 132, 0.4);
    border-radius: var(--radius-sm);
    color: var(--secondary);
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-refresh:hover {
    background: var(--secondary);
    color: var(--bg-dark);
    border-color: var(--secondary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(61, 220, 132, 0.3);
}

.btn-refresh:active {
    transform: translateY(0);
}

/* Input Group Checkbox */
.input-group label input[type="checkbox"] {
    margin-right: 8px;
    width: auto;
}

/* Responsive Updates */
@media (max-width: 768px) {
    .room-info {
        flex-direction: column;
        gap: 8px;
    }

    .server-filters {
        flex-direction: column;
    }

    .server-filters select {
        width: 100%;
    }

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

    .quick-chat-lobby {
        flex-direction: column;
    }

    .quick-chat-btn {
        width: 100%;
        justify-content: center;
    }
}


/* Hide all scrollbars globally but keep functionality */
.guide-book::-webkit-scrollbar {
    display: none;
}

.guide-book {
    -ms-overflow-style: none;
    scrollbar-width: none;
}


/* ======= RESPONSIVE GAME HUD ======= */
@media (max-width: 768px) {
    .hud {
        padding: 8px 12px;
    }

    .hud-top-left {
        top: 10px;
        left: 12px;
        width: 250px;
        gap: 8px;
    }

    .hud-top-right {
        top: 10px;
        right: 12px;
        gap: 6px;
    }

    .hud-score {
        padding: 4px 12px;
        min-width: 80px;
    }

    .score-label {
        font-size: 9px;
        letter-spacing: 1px;
    }

    .score-value {
        font-size: 24px;
    }

    .hud-timer {
        padding: 4px 12px;
    }

    .timer-icon {
        font-size: 16px;
    }

    .timer-value {
        font-size: 22px;
        min-width: 50px;
    }

    .hud-combo {
        font-size: 16px;
    }

    .hud-holding {
        padding: 4px 10px;
        min-width: 120px;
    }

    .holding-label {
        font-size: 9px;
        letter-spacing: 1px;
    }

    .holding-display {
        font-size: 14px;
    }

    .hud-player-tag {
        padding: 4px 8px;
        font-size: 12px;
    }

    .orders-bar {
        top: 10px;
        padding: 3px 10px;
        scale: 0.85;
    }

    .orders-label {
        font-size: 10px;
    }

    .order-card {
        padding: 6px;
        min-width: 80px;
    }

    .order-emoji {
        font-size: 20px;
    }

    .order-name {
        font-size: 10px;
    }

    .order-ingredients {
        font-size: 12px;
    }

    .order-points {
        font-size: 10px;
    }
}

@media (max-width: 480px) {
    .hud {
        padding: 6px 8px;
    }

    .hud-top-left {
        top: 8px;
        left: 8px;
        width: 200px;
        gap: 6px;
    }

    .hud-top-right {
        top: 8px;
        right: 8px;
        gap: 4px;
    }

    .hud-row {
        gap: 8px;
        flex-wrap: wrap;
    }

    .hud-score {
        padding: 3px 10px;
        min-width: 70px;
    }

    .score-label {
        font-size: 8px;
        letter-spacing: 0.5px;
    }

    .score-value {
        font-size: 20px;
    }

    .hud-timer {
        padding: 3px 10px;
    }

    .timer-icon {
        font-size: 14px;
    }

    .timer-value {
        font-size: 18px;
        min-width: 45px;
    }

    .hud-combo {
        font-size: 14px;
    }

    .hud-holding {
        padding: 3px 8px;
        min-width: 100px;
    }

    .holding-label {
        font-size: 8px;
        letter-spacing: 0.5px;
    }

    .holding-display {
        font-size: 12px;
    }

    .hud-player-tag {
        padding: 3px 6px;
        font-size: 11px;
    }

    .hud-player-list {
        gap: 3px;
    }

    .orders-bar {
        top: 8px;
        padding: 2px 8px;
        scale: 0.75;
        max-width: calc(100vw - 16px);
    }

    .orders-label {
        font-size: 9px;
    }

    .orders-list {
        gap: 4px;
        overflow-x: auto;
        -ms-overflow-style: none;
        scrollbar-width: none;
    }

    .orders-list::-webkit-scrollbar {
        display: none;
    }

    .order-card {
        padding: 4px;
        min-width: 70px;
    }

    .order-emoji {
        font-size: 18px;
    }

    .order-name {
        font-size: 9px;
    }

    .order-ingredients {
        font-size: 11px;
    }

    .order-points {
        font-size: 9px;
    }

    /* Hide chat log on mobile to save space */
    .hud-chat-log {
        max-height: 100px;
        overflow: hidden;
    }

    /* Smaller connection quality indicator */
    .connection-quality {
        font-size: 10px;
        padding: 2px 6px;
    }

    /* Adjust VS scoreboard for mobile */
    .vs-scoreboard {
        max-width: 180px;
        font-size: 11px;
    }
}

/* Responsive quick chat sidebar */
@media (max-width: 768px) {
    .quick-chat-sidebar {
        right: 8px;
        gap: 6px;
    }

    .side-chat-btn {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .key-hint {
        font-size: 9px;
    }
}

@media (max-width: 480px) {
    .quick-chat-sidebar {
        right: 4px;
        gap: 4px;
        bottom: 60px;
    }

    .side-chat-btn {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }

    .key-hint {
        font-size: 8px;
    }
}

/* Responsive notifications */
@media (max-width: 768px) {
    .notifications {
        top: 10px;
        right: 10px;
        max-width: 280px;
    }

    .notification {
        padding: 10px 14px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .notifications {
        top: 8px;
        right: 8px;
        left: 8px;
        max-width: calc(100vw - 16px);
    }

    .notification {
        padding: 8px 12px;
        font-size: 12px;
    }
}

/* Responsive floating chat input */
@media (max-width: 768px) {
    .floating-chat-container {
        bottom: 15px;
        left: 15px;
        right: 15px;
        max-width: calc(100vw - 30px);
    }

    .floating-chat-container input {
        font-size: 14px;
        padding: 10px;
    }
}

@media (max-width: 480px) {
    .floating-chat-container {
        bottom: 10px;
        left: 10px;
        right: 10px;
        max-width: calc(100vw - 20px);
    }

    .floating-chat-container input {
        font-size: 13px;
        padding: 8px;
    }

    .floating-chat-container button {
        padding: 8px 12px;
    }
}

/* Responsive game over screen */
@media (max-width: 768px) {
    .gameover-container {
        padding: 30px;
        max-width: 90%;
    }

    .gameover-title {
        font-size: 36px;
    }

    .final-score {
        font-size: 64px;
    }

    .score-label-big {
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .gameover-container {
        padding: 20px;
        max-width: 95%;
    }

    .gameover-title {
        font-size: 28px;
    }

    .final-score {
        font-size: 48px;
    }

    .score-label-big {
        font-size: 16px;
    }

    .stat-card {
        padding: 12px;
    }

    .stat-value {
        font-size: 28px;
    }

    .stat-label {
        font-size: 11px;
    }

    .btn-restart {
        padding: 12px 24px;
        font-size: 16px;
    }
}

/* Responsive pause menu */
@media (max-width: 768px) {
    .pause-content {
        padding: 30px;
        max-width: 90%;
    }

    .pause-content h2 {
        font-size: 32px;
    }

    .pause-content button {
        padding: 12px 24px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .pause-content {
        padding: 20px;
        max-width: 95%;
    }

    .pause-content h2 {
        font-size: 24px;
    }

    .pause-content button {
        padding: 10px 20px;
        font-size: 14px;
        width: 100%;
    }
}

/* NOTIFICATIONS SYSTEM */
.notifications-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.notif {
    min-width: 250px;
    padding: 16px 20px;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(10px);
    border-left: 4px solid var(--primary);
    border-radius: 12px;
    color: white;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: notifSlideIn 0.4s cubic-bezier(0.18, 0.89, 0.32, 1.28);
    pointer-events: auto;
}

.notif.success {
    border-color: var(--secondary);
}

.notif.error {
    border-color: #ef4444;
}

.notif.info {
    border-color: #3b82f6;
}

.notif.friend-request {
    border-color: var(--accent);
    min-width: 300px;
}

.notif-icon {
    font-size: 20px;
}

.notif.friend-request .notif-icon {
    color: var(--accent);
}

.notif-content {
    flex: 1;
}

.notif-title {
    font-weight: 800;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: block;
    margin-bottom: 2px;
}

.notif-msg {
    font-size: 13px;
    opacity: 0.9;
    display: block;
    margin-bottom: 8px;
}

.notif-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.notif-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}

.notif-btn.accept {
    background: var(--secondary);
    color: var(--bg-dark);
}

.notif-btn.accept:hover {
    background: #4ef3a0;
    transform: scale(1.05);
}

.notif-btn.reject {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border: 1px solid #ef4444;
}

.notif-btn.reject:hover {
    background: rgba(239, 68, 68, 0.3);
    transform: scale(1.05);
}

@keyframes notifSlideIn {
    from {
        transform: translateX(120%);
        opacity: 0;
    }

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

.notif.fade-out {
    animation: notifFadeOut 0.5s forwards;
}

@keyframes notifFadeOut {
    to {
        transform: translateX(50px);
        opacity: 0;
    }
}

/* === MODERN PLAYER PROFILE MODAL === */
.profile-card-new {
    max-width: 750px;
    width: 90%;
    padding: 0 !important;
    overflow: hidden;
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: 0 40px 100px -20px rgba(0, 0, 0, 0.8);
}

/* Mobile Header - Hidden on desktop */
.profile-mobile-header {
    display: none;
}

.modal-close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.3);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close-btn:hover {
    background: var(--danger);
    transform: rotate(90deg);
}

.profile-layout {
    display: flex;
    height: 550px;
    /* Increased height */
    overflow: hidden;
}

/* Sidebar */
.profile-sidebar {
    width: 250px;
    background: rgba(0, 0, 0, 0.2);
    border-right: 1px solid var(--border);
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    gap: 25px;
    overflow-y: auto;
    /* Enable vertical scroll if content is long */
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE and Edge */
}

.profile-sidebar::-webkit-scrollbar {
    display: none;
    /* Chrome, Safari and Opera */
}

.profile-main-info {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.profile-avatar-container {
    position: relative;
    width: 100px;
    height: 100px;
}

.profile-avatar-container img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary);
    box-shadow: 0 0 20px rgba(255, 107, 53, 0.3);
}

.level-indicator {
    position: absolute;
    bottom: -5px;
    right: -5px;
    background: var(--accent);
    color: var(--bg-dark);
    font-weight: 900;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 10px;
    border: 2px solid var(--bg-dark);
}

#profile-display-name {
    font-family: var(--font-display);
    font-size: 20px;
    color: white;
    margin: 0;
}

.profile-status {
    font-size: 11px;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.status-online {
    color: var(--secondary);
    font-size: 8px;
}

.profile-id-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.4);
    padding: 6px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    margin-top: 5px;
}

.profile-id-badge:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--accent);
    transform: translateY(-1px);
}

.profile-id-badge:active {
    transform: translateY(1px);
}

.id-label {
    font-size: 10px;
    font-weight: 800;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.id-value {
    font-family: 'Courier New', Courier, monospace;
    font-size: 12px;
    color: white;
    font-weight: 700;
}

.id-copy-icon {
    font-size: 12px;
    color: var(--text-dim);
}

.profile-id-badge:hover .id-copy-icon {
    color: var(--accent);
}

/* Progress Bar */
.xp-progress-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.xp-header {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 800;
    color: var(--text-dim);
    text-transform: uppercase;
}

.xp-bar-outline {
    height: 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.xp-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    box-shadow: 0 0 10px rgba(255, 107, 53, 0.3);
    transition: width 0.5s ease;
}

/* Nav Tabs */
.profile-nav-tabs {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.profile-tab-btn {
    background: transparent;
    border: none;
    padding: 12px 16px;
    border-radius: 12px;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.2s;
    text-align: left;
}

.profile-tab-btn i {
    font-size: 18px;
}

.profile-tab-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.profile-tab-btn.active {
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.2), rgba(255, 107, 53, 0.1));
    color: var(--primary);
    border: 1px solid rgba(255, 107, 53, 0.3);
}

/* Content Area */
.profile-content-area {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE and Edge */
}

.profile-content-area::-webkit-scrollbar {
    display: none;
    /* Chrome, Safari and Opera */
}

.profile-tab-content {
    display: none;
    animation: tabFadeIn 0.3s ease-out;
}

.profile-tab-content.active {
    display: block;
}

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

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

.tab-title {
    font-family: var(--font-display);
    font-size: 22px;
    color: white;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.stat-item {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.2s;
}

.stat-item:hover {
    background: rgba(255, 255, 255, 0.03);
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.15);
}

.stat-icon {
    font-size: 28px;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
}

.stat-icon.dish {
    background: rgba(255, 107, 53, 0.1);
    color: var(--primary);
}

.stat-icon.games {
    background: rgba(61, 220, 132, 0.1);
    color: var(--secondary);
}

.stat-icon.rating {
    background: rgba(255, 210, 63, 0.1);
    color: var(--accent);
}

.stat-icon.streak {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.stat-icon.chopped {
    background: rgba(59, 130, 246, 0.1);
    /* Blue background */
}

.stat-icon.cooked {
    background: rgba(236, 72, 153, 0.1);
    /* Pink/Red background */
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-family: var(--font-display);
    font-size: 20px;
    color: white;
}

.stat-label {
    font-size: 11px;
    color: var(--text-dim);
    font-weight: 700;
    text-transform: uppercase;
}

/* History List */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-item {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 16px;
    gap: 16px;
}

/* VS Battle specific layout */
.history-item-vs {
    display: grid;
    grid-template-columns: auto 1fr auto 1fr auto;
    align-items: center;
    gap: 12px;
}

.history-player-name {
    font-weight: 700;
    font-size: 14px;
    color: white;
}

.history-vs-divider {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: 16px;
    color: var(--accent);
    text-align: center;
    letter-spacing: 2px;
    padding: 0 8px;
}

.history-vs-info {
    grid-column: 1 / -1;
    font-size: 11px;
    color: var(--text-dim);
    text-align: center;
    margin-top: 4px;
}

.history-status {
    font-weight: 800;
    font-size: 16px;
    padding: 8px 10px;
    border-radius: 6px;
    min-width: 55px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.history-status.win {
    background: rgba(61, 220, 132, 0.2);
    color: var(--secondary);
}

.history-status.loss {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.history-status.tie {
    background: rgba(255, 210, 63, 0.2);
    color: var(--accent);
}

.history-status.single {
    background: rgba(139, 92, 246, 0.2);
    color: var(--primary);
}

.history-status.coop {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

.history-details {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.history-mode {
    font-weight: 700;
    font-size: 14px;
    color: white;
}

.history-date {
    font-size: 11px;
    color: var(--text-dim);
}

.history-score {
    font-family: var(--font-display);
    font-size: 14px;
    color: var(--accent);
}

/* Achievements */
.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 15px;
}

.achievement-card {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 15px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
    filter: grayscale(1);
    opacity: 0.5;
    transition: all 0.3s;
}

.achievement-card.unlocked {
    filter: none;
    opacity: 1;
    background: linear-gradient(135deg, rgba(255, 210, 63, 0.1), rgba(255, 107, 53, 0.05));
    border-color: var(--accent);
}

.achievement-card.locked {
    filter: grayscale(1);
    opacity: 0.5;
}

.achievement-card i {
    font-size: 24px;
    color: var(--accent);
}

.achievement-img-icon {
    width: 28px;
    height: 28px;
    object-fit: contain;
    transition: all 0.3s;
}

.achievement-img-icon.locked {
    filter: grayscale(1) brightness(0.6);
}

.achievement-img-icon.unlocked {
    filter: none;
}

.achievement-icon-wrapper {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.achievement-info-icon {
    position: absolute;
    top: -4px;
    right: -4px;
    font-size: 12px !important;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    opacity: 1;
    transition: all 0.2s;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.3);
    z-index: 2;
}

.achievement-card:hover .achievement-info-icon {
    opacity: 1;
    background: rgba(0, 0, 0, 0.85);
}

.achievement-info-icon:hover {
    color: var(--accent);
    background: rgba(0, 0, 0, 0.95);
    border-color: var(--accent);
    transform: scale(1.2);
}

.achievement-card span {
    font-size: 10px;
    font-weight: 800;
    color: white;
}

.achievement-card small {
    font-size: 8px;
    color: var(--text-dim);
    margin-top: 4px;
    display: block;
}

.achievement-card .progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    margin-top: 8px;
    overflow: hidden;
}

.achievement-card .progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.5s ease;
}

/* Achievement Level Bars */
.achievement-level-bars {
    display: flex;
    gap: 3px;
    margin-top: 4px;
}

.level-bar {
    width: 8px;
    height: 3px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
    transition: all 0.3s;
}

.level-bar.active {
    background: var(--accent);
    box-shadow: 0 0 4px var(--accent);
}

.achievement-card.unlocked .level-bar.active {
    background: linear-gradient(90deg, var(--accent), var(--secondary));
    box-shadow: 0 0 6px var(--accent);
}

/* Customize Settings */
.customize-section {
    margin-bottom: 25px;
}

.customize-section label {
    display: block;
    font-size: 11px;
    font-weight: 900;
    color: var(--accent);
    text-transform: uppercase;
    margin-bottom: 10px;
}

.compact-input input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: white;
    font-size: 14px;
    outline: none;
}

.compact-avatar-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
}

.compact-avatar-option {
    aspect-ratio: 1;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
}

.compact-avatar-option img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.compact-avatar-option:hover {
    transform: scale(1.05);
    background: rgba(255, 255, 255, 0.1);
}

.compact-avatar-option.selected {
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(255, 107, 53, 0.4);
    background: rgba(255, 107, 53, 0.1);
}

.save-profile-action {
    margin-top: 30px;
    display: flex;
    justify-content: flex-end;
}

/* Mobile adjustments - Full Screen with Side Menu */
@media (max-width: 768px) {
    .profile-card-new {
        width: 100%;
        max-width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        border: none;
    }

    /* Hide Mobile Header - use sidebar profile instead */
    .profile-mobile-header {
        display: none;
    }

    .modal-close-btn {
        top: 16px;
        right: 16px;
        width: 40px;
        height: 40px;
        font-size: 20px;
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(10px);
        z-index: 100;
    }

    .profile-layout {
        flex-direction: row;
        height: 100vh;
        max-height: 100vh;
    }

    .profile-sidebar {
        width: 280px;
        min-width: 280px;
        border-right: 1px solid var(--border);
        border-bottom: none;
        padding: 60px 20px 20px 20px;
        gap: 20px;
        background: rgba(0, 0, 0, 0.4);
    }

    .profile-main-info {
        display: flex;
        gap: 12px;
    }

    .profile-avatar-container {
        width: 90px;
        height: 90px;
    }

    .level-indicator {
        font-size: 11px;
        padding: 4px 8px;
        bottom: -4px;
        right: -4px;
    }

    #profile-display-name {
        font-size: 20px;
        display: block;
    }

    .profile-status {
        font-size: 11px;
        display: flex;
    }

    .profile-id-badge {
        display: flex;
        padding: 6px 12px;
    }

    .id-label {
        font-size: 10px;
    }

    .id-value {
        font-size: 12px;
    }

    .xp-progress-section {
        display: flex;
    }

    .xp-header {
        font-size: 11px;
    }

    .xp-bar-outline {
        height: 8px;
    }

    .profile-nav-tabs {
        flex-direction: column;
        overflow: visible;
        gap: 8px;
        flex: 0 0 auto;
    }

    .profile-nav-tabs::-webkit-scrollbar {
        display: none;
    }

    .profile-tab-btn {
        flex-shrink: 0;
        padding: 14px 16px;
        font-size: 15px;
        gap: 12px;
        white-space: nowrap;
        justify-content: flex-start;
        flex-direction: row;
        align-items: center;
        border-radius: 12px;
        position: relative;
        text-align: left;
    }

    .profile-tab-btn i {
        font-size: 20px;
        margin: 0;
    }

    .profile-tab-btn span {
        display: block;
        line-height: 1.2;
    }

    .profile-tab-btn.active {
        background: linear-gradient(135deg, rgba(255, 107, 53, 0.2), rgba(255, 107, 53, 0.1));
        color: var(--primary);
        border: 1px solid rgba(255, 107, 53, 0.3);
    }

    .profile-tab-btn.active::after {
        display: none;
    }

    .profile-content-area {
        padding: 60px 20px 20px 20px;
        flex: 1;
        overflow-y: auto;
    }

    .tab-title {
        font-size: 20px;
        margin-bottom: 20px;
        gap: 10px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .stat-item {
        padding: 16px;
        gap: 12px;
    }

    .stat-icon {
        font-size: 24px;
        width: 45px;
        height: 45px;
    }

    .stat-value {
        font-size: 18px;
    }

    .stat-label {
        font-size: 10px;
    }

    .achievements-grid {
        grid-template-columns: repeat(auto-fill, minmax(85px, 1fr));
        gap: 12px;
    }

    .achievement-card {
        padding: 12px 8px;
        gap: 8px;
    }

    .achievement-card i {
        font-size: 20px;
    }

    .achievement-img-icon {
        width: 24px;
        height: 24px;
    }

    .achievement-card span {
        font-size: 9px;
    }

    .achievement-card small {
        font-size: 7px;
    }

    .history-item {
        padding: 10px 12px;
        gap: 12px;
        flex-direction: column;
        align-items: flex-start;
    }

    .history-item-vs {
        grid-template-columns: 1fr auto 1fr;
        gap: 8px;
    }

    .history-status {
        grid-column: 1 / -1;
        width: 100%;
        margin-top: 8px;
    }

    .history-player-name {
        font-size: 13px;
    }

    .history-vs-divider {
        font-size: 14px;
    }

    .history-mode {
        font-size: 13px;
    }

    .history-date {
        font-size: 10px;
    }

    .history-score {
        font-size: 13px;
    }

    .compact-avatar-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 10px;
    }

    .customize-section {
        margin-bottom: 20px;
    }

    .customize-section label {
        font-size: 10px;
        margin-bottom: 8px;
    }

    .compact-input input {
        padding: 10px 14px;
        font-size: 13px;
    }

    .save-profile-action {
        margin-top: 20px;
    }

    .save-profile-action .btn-primary {
        width: 100%;
        padding: 12px 20px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .profile-card-new {
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }

    .profile-mobile-header {
        display: none;
    }

    .modal-close-btn {
        top: 12px;
        right: 12px;
        width: 36px;
        height: 36px;
        font-size: 18px;
    }

    .profile-sidebar {
        width: 240px;
        min-width: 240px;
        padding: 50px 16px 16px 16px;
        gap: 16px;
    }

    .profile-avatar-container {
        width: 80px;
        height: 80px;
    }

    .level-indicator {
        font-size: 10px;
        padding: 3px 6px;
    }

    #profile-display-name {
        font-size: 18px;
    }

    .profile-status {
        font-size: 10px;
    }

    .profile-id-badge {
        padding: 5px 10px;
    }

    .id-label {
        font-size: 9px;
    }

    .id-value {
        font-size: 11px;
    }

    .xp-header {
        font-size: 10px;
    }

    .xp-bar-outline {
        height: 7px;
    }

    .profile-tab-btn {
        padding: 12px 14px;
        font-size: 14px;
        gap: 10px;
    }

    .profile-tab-btn i {
        font-size: 18px;
    }

    .profile-content-area {
        padding: 50px 16px 16px 16px;
    }

    .tab-title {
        font-size: 18px;
        margin-bottom: 16px;
        gap: 8px;
    }

    .stats-grid {
        gap: 10px;
    }

    .stat-item {
        padding: 14px;
        gap: 10px;
    }

    .stat-icon {
        font-size: 22px;
        width: 40px;
        height: 40px;
    }

    .stat-value {
        font-size: 16px;
    }

    .stat-label {
        font-size: 9px;
    }

    .achievements-grid {
        grid-template-columns: repeat(auto-fill, minmax(75px, 1fr));
        gap: 10px;
    }

    .achievement-card {
        padding: 10px 6px;
        gap: 6px;
        border-radius: 12px;
    }

    .achievement-card i {
        font-size: 18px;
    }

    .achievement-img-icon {
        width: 20px;
        height: 20px;
    }

    .achievement-icon-wrapper {
        width: 32px;
        height: 32px;
    }

    .achievement-info-icon {
        width: 14px;
        height: 14px;
        font-size: 10px !important;
    }

    .achievement-card span {
        font-size: 8px;
    }

    .achievement-card small {
        font-size: 6px;
    }

    .level-bar {
        width: 6px;
        height: 2px;
    }

    .history-item {
        padding: 8px 10px;
        gap: 10px;
    }

    .history-item-vs {
        gap: 6px;
    }

    .history-player-name {
        font-size: 12px;
    }

    .history-vs-divider {
        font-size: 12px;
        padding: 0 4px;
    }

    .history-status {
        font-size: 14px;
        padding: 6px 8px;
        min-width: 50px;
    }

    .history-mode {
        font-size: 12px;
    }

    .history-date {
        font-size: 9px;
    }

    .history-score {
        font-size: 12px;
    }

    .compact-avatar-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .compact-avatar-option {
        border-radius: 8px;
        padding: 4px;
    }

    .customize-section {
        margin-bottom: 16px;
    }

    .customize-section label {
        font-size: 9px;
        margin-bottom: 6px;
    }

    .compact-input input {
        padding: 8px 12px;
        font-size: 12px;
        border-radius: 10px;
    }

    .save-profile-action {
        margin-top: 16px;
    }

    .save-profile-action .btn-primary {
        padding: 10px 16px;
        font-size: 14px;
    }
}


/* ============================================
   MOBILE RESPONSIVE DESIGN
   ============================================ */

/* Mobile Device Detection */
.mobile-device {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Rotation Warning Overlay */
.rotation-warning {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.rotation-warning.active {
    display: flex;
}

.rotation-warning-content {
    text-align: center;
    padding: 40px;
    animation: rotatePrompt 2s ease-in-out infinite;
}

.rotation-warning-content i {
    font-size: 120px;
    color: var(--accent);
    display: block;
    margin-bottom: 20px;
    animation: rotateIcon 2s ease-in-out infinite;
}

.rotation-warning-content h2 {
    font-family: var(--font-display);
    font-size: 28px;
    color: white;
    margin-bottom: 12px;
}

.rotation-warning-content p {
    font-size: 16px;
    color: var(--text-dim);
    margin-bottom: 20px;
}

.btn-fullscreen-prompt {
    padding: 14px 32px;
    background: linear-gradient(135deg, var(--primary) 0%, #ff8c42 100%);
    border: none;
    border-radius: 30px;
    color: white;
    font-family: var(--font-display);
    font-size: 16px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.4);
    transition: all 0.2s;
    margin-top: 10px;
}

.btn-fullscreen-prompt:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.6);
}

.btn-fullscreen-prompt:active {
    transform: translateY(0);
}

@keyframes rotateIcon {
    0%, 100% {
        transform: rotate(0deg);
    }
    50% {
        transform: rotate(90deg);
    }
}

@keyframes rotatePrompt {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* ============================================
   FULLSCREEN RESTORE BUTTON
   ============================================ */

/* Fullscreen Restore Button (appears when fullscreen is lost) */
.fullscreen-restore-btn {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9998;
    padding: 16px 32px;
    background: linear-gradient(135deg, var(--primary) 0%, #ff8c42 100%);
    border: 3px solid var(--accent);
    border-radius: 30px;
    color: white;
    font-family: var(--font-display);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 8px 30px rgba(255, 107, 53, 0.6), 0 0 0 0 rgba(255, 210, 63, 0.7);
    transition: all 0.3s;
    animation: pulseFullscreen 2s ease-in-out infinite;
}

.fullscreen-restore-btn.hidden {
    display: none;
}

.fullscreen-restore-btn i {
    font-size: 24px;
}

.fullscreen-restore-btn:hover {
    transform: translate(-50%, -50%) scale(1.05);
    box-shadow: 0 10px 40px rgba(255, 107, 53, 0.8), 0 0 20px rgba(255, 210, 63, 0.5);
}

.fullscreen-restore-btn:active {
    transform: translate(-50%, -50%) scale(0.98);
}

@keyframes pulseFullscreen {
    0%, 100% {
        box-shadow: 0 8px 30px rgba(255, 107, 53, 0.6), 0 0 0 0 rgba(255, 210, 63, 0.7);
    }
    50% {
        box-shadow: 0 8px 30px rgba(255, 107, 53, 0.6), 0 0 0 20px rgba(255, 210, 63, 0);
    }
}

/* ============================================
   MOBILE PORTRAIT MODE (Login Screen)
   ============================================ */

@media (max-width: 768px) and (orientation: portrait) {
    /* Optimize lobby for portrait */
    .lobby-container {
        padding: 10px;
        gap: 10px;
    }

    .logo-container {
        margin-top: 10px;
        margin-bottom: 5px;
    }

    .game-logo {
        font-size: 28px;
        gap: 8px;
    }

    .logo-icon {
        font-size: 36px !important;
    }

    .logo-subtitle {
        font-size: 11px;
        letter-spacing: 2px;
    }

    /* Login Card - Optimized for portrait */
    .login-card {
        max-width: 90%;
        padding: 0;
    }

    .auth-form {
        padding: 24px;
    }

    .login-title {
        font-size: 22px;
        margin-bottom: 20px;
    }

    .login-input-group {
        margin-bottom: 16px;
    }

    .login-input-group input {
        padding: 12px 16px;
        font-size: 15px;
    }

    /* User Profile */
    .user-profile {
        padding: 6px 12px;
        gap: 8px;
    }

    .user-avatar {
        width: 28px;
        height: 28px;
    }

    .user-name {
        font-size: 13px;
    }

    .user-status {
        font-size: 9px;
    }

    /* Connection Status */
    .connection-status {
        font-size: 11px;
        padding: 6px 12px;
    }

    /* Main Menu Layout - Stack vertically */
    .main-menu-layout {
        flex-direction: column;
        gap: 12px;
    }

    .menu-buttons-column {
        width: 100%;
        min-height: auto;
    }

    .friends-panel,
    .leaderboard-panel {
        width: 100%;
        max-height: 180px;
    }

    /* Menu Buttons - Compact for mobile */
    .menu-btn.compact {
        padding: 10px;
        gap: 8px;
    }

    .menu-btn.compact .btn-icon {
        font-size: 20px;
        width: 32px;
        height: 32px;
    }

    .menu-btn.compact .btn-title {
        font-size: 14px;
    }

    .menu-btn.compact .btn-desc {
        font-size: 10px;
    }

    /* Banner Options */
    .banner-options {
        flex-direction: column;
        gap: 10px;
    }

    .banner-option {
        width: 100%;
        padding: 14px;
    }

    /* Menu Actions */
    .menu-actions {
        flex-direction: column;
        gap: 8px;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
        padding: 12px;
        font-size: 15px;
    }

    /* Server Table - Horizontal scroll */
    .server-list-container {
        overflow-x: auto;
    }

    .server-table {
        min-width: 500px;
        font-size: 11px;
    }

    .server-table th,
    .server-table td {
        padding: 6px;
        font-size: 10px;
    }

    /* Waiting Room */
    .waiting-room-layout {
        flex-direction: column;
    }

    .waiting-friends-panel {
        width: 100%;
        max-height: 150px;
    }
}

/* ============================================
   MOBILE LANDSCAPE MODE (Main Menu/Lobby)
   ============================================ */

@media (max-width: 926px) and (orientation: landscape) {
    /* Disable scrolling - fit everything on screen */
    body {
        overflow: hidden;
    }

    /* Lobby Screen - Fixed height, no scroll */
    #lobby-screen {
        overflow: hidden;
        padding: 0;
        height: 100vh;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Lobby Container - Reduce vertical spacing */
    .lobby-container {
        padding-bottom: 8px;
        padding-top: 8px;
        gap: 4px;
        max-width: 96%;
        width: 96%;
        height: auto;
        max-height: 100vh;
        overflow: visible;
    }

    /* Logo - Smaller for landscape, keep centered */
    .logo-container {
        margin-top: 0;
        margin-bottom: 2px;
    }

    .game-logo {
        font-size: 16px;
        gap: 5px;
    }

    .logo-icon {
        font-size: 22px !important;
    }

    .logo-subtitle {
        font-size: 7px;
        letter-spacing: 1px;
        margin-top: 1px;
    }

    /* User Profile - Compact */
    .user-profile {
        padding: 3px 8px;
        margin-bottom: 2px;
        gap: 6px;
    }

    .user-avatar {
        width: 20px;
        height: 20px;
    }

    .user-avatar i {
        font-size: 13px;
    }

    .user-name {
        font-size: 10px;
    }

    .user-status {
        font-size: 7px;
    }

    .edit-hint {
        font-size: 6px;
    }

    .btn-logout {
        font-size: 13px;
        margin-left: 4px;
    }

    /* Connection Status */
    .connection-status {
        padding: 3px 8px;
        font-size: 8px;
        margin-bottom: 2px;
    }

    .connection-status i {
        font-size: 8px;
    }

    /* Push menu content down slightly */
    .lobby-menu {
        margin-top: 3px;
    }

    /* When on sub-menu, remove top margin */
    .lobby-menu:not(#menu-main) {
        margin-top: 0;
    }

    /* Smaller menu title for sub-menus */
    .lobby-menu .menu-title {
        font-size: 18px;
        margin-bottom: 12px;
    }

    /* Main Menu Layout - 3 Column Grid for Landscape */
    .main-menu-layout {
        display: grid;
        grid-template-columns: 1fr 1fr 1fr;
        gap: 8px;
        width: 100%;
        max-width: 100%;
        align-items: stretch;
        grid-auto-rows: 1fr;
    }

    /* Menu Buttons Column - Smaller width */
    .menu-buttons-column {
        width: 100%;
        min-height: 100%;
        height: 100%;
        gap: 4px;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }

    /* Compact Menu Buttons for Landscape */
    .menu-btn.compact {
        padding: 6px 8px;
        gap: 6px;
        min-height: auto;
        flex: 1;
        display: flex;
        align-items: center;
    }

    .menu-btn.compact .btn-icon {
        font-size: 16px;
        width: 26px;
        height: 26px;
        min-width: 26px;
        flex-shrink: 0;
    }

    .menu-btn.compact .btn-title {
        font-size: 11px;
        line-height: 1.1;
        margin-bottom: 1px;
    }

    .menu-btn.compact .btn-desc {
        font-size: 8px;
        line-height: 1.1;
    }

    /* Friends Panel - Fit in grid */
    .friends-panel {
        width: 100%;
        min-height: 100%;
        height: 100%;
        padding: 8px;
        display: flex;
        flex-direction: column;
    }

    .friends-panel-header {
        font-size: 11px;
        margin-bottom: 5px;
        padding-bottom: 4px;
    }

    .friends-panel-header i {
        font-size: 11px;
    }

    .friends-panel-add {
        margin-bottom: 5px;
        padding-bottom: 5px;
        gap: 4px;
    }

    .friends-panel-add input {
        padding: 5px 7px;
        font-size: 10px;
    }

    .friends-panel-add input::placeholder {
        font-size: 9px;
    }

    .btn-add-friend {
        width: 28px;
        min-width: 28px;
        height: 28px;
        font-size: 13px;
    }

    .friend-panel-item {
        padding: 5px;
        font-size: 10px;
        gap: 4px;
        border-left-width: 2px;
    }

    .friend-panel-item .friend-status-dot {
        width: 5px;
        height: 5px;
    }

    .friend-panel-info {
        margin-left: 4px;
    }

    .friend-panel-item .friend-name {
        font-size: 10px;
    }

    .friend-panel-status {
        font-size: 8px;
    }

    /* Friend Requests */
    .friend-requests-header {
        font-size: 10px;
        margin-bottom: 4px;
        gap: 4px;
    }

    .friend-requests-header i {
        font-size: 10px;
    }

    .request-count {
        font-size: 8px;
        padding: 2px 4px;
    }

    .friend-request-item {
        padding: 5px;
    }

    .friend-request-name {
        font-size: 10px;
        margin-bottom: 3px;
    }

    .friend-request-actions {
        gap: 3px;
    }

    .friend-request-btn {
        padding: 3px 5px;
        font-size: 8px;
        gap: 2px;
    }

    .friend-request-btn i {
        font-size: 8px;
    }

    /* Leaderboard Panel - Fit in grid */
    .leaderboard-panel {
        width: 100%;
        min-height: 100%;
        height: 100%;
        padding: 8px;
        display: flex;
        flex-direction: column;
    }

    .leaderboard-panel-header {
        font-size: 11px;
        margin-bottom: 5px;
        padding-bottom: 4px;
    }

    .leaderboard-panel-header i {
        font-size: 11px;
    }

    .leaderboard-panel-filters {
        gap: 3px;
        margin-bottom: 5px;
        padding-bottom: 5px;
    }

    .lb-filter-btn {
        padding: 5px;
        font-size: 11px;
    }

    .lb-filter-btn i {
        font-size: 11px;
    }

    .leaderboard-item {
        padding: 5px;
        font-size: 10px;
        gap: 4px;
        border-left-width: 2px;
    }

    .leaderboard-rank {
        width: 18px;
        height: 18px;
        font-size: 9px;
        line-height: 18px;
    }

    .leaderboard-avatar {
        width: 20px;
        height: 20px;
        border-width: 1px;
    }

    .leaderboard-name {
        font-size: 10px;
    }

    .leaderboard-stat {
        font-size: 8px;
    }

    .loading-spinner-small {
        font-size: 9px;
        padding: 12px 6px;
    }

    .friends-empty-msg {
        font-size: 10px;
        padding: 12px 6px;
    }

    /* Menu Title - Compact */
    .menu-title {
        font-size: 14px;
        margin-bottom: 5px;
    }

    /* Banner Options - Ultra compact */
    .banner-options {
        flex-direction: row;
        gap: 6px;
        margin-bottom: 5px;
    }

    .banner-option {
        padding: 8px 6px;
        min-width: 0;
        flex: 1;
    }

    .banner-icon {
        font-size: 20px;
        margin-bottom: 3px;
    }

    .banner-option h3 {
        font-size: 11px;
        margin-bottom: 2px;
    }

    .banner-option p {
        font-size: 9px;
    }

    /* Input Groups - Minimal */
    .input-group {
        margin-bottom: 5px;
    }

    .input-group label {
        font-size: 9px;
        margin-bottom: 2px;
    }

    .input-group input {
        padding: 6px 8px;
        font-size: 11px;
    }

    .section-label {
        font-size: 9px;
        margin-bottom: 3px;
        margin-top: 2px;
    }

    /* Difficulty Toggle - Compact */
    .difficulty-toggle {
        margin-bottom: 5px;
        padding: 2px;
    }

    .diff-btn {
        padding: 5px;
        font-size: 10px;
    }

    /* Menu Actions - Compact */
    .menu-actions {
        flex-direction: row;
        gap: 6px;
        margin-top: 5px;
    }

    .btn-primary,
    .btn-secondary {
        padding: 7px 12px;
        font-size: 11px;
    }

    .btn-primary {
        font-size: 12px;
    }

    /* Shop Balance */
    .shop-balance {
        padding: 8px 10px;
        margin-bottom: 10px;
        font-size: 12px;
    }

    .shop-balance i {
        font-size: 16px;
    }

    .shop-balance strong {
        font-size: 13px;
    }

    /* Shop Categories */
    .shop-categories {
        gap: 5px;
        margin-bottom: 10px;
    }

    .shop-category-btn {
        padding: 7px;
        font-size: 11px;
        gap: 4px;
    }

    /* Server Browser */
    /* Join Room - Hide title for landscape mobile */
    #menu-join .menu-title {
        display: none;
    }

    .join-code-section {
        margin-bottom: 4px;
        padding: 4px 6px;
        background: rgba(0, 0, 0, 0.2);
        border-radius: 3px;
    }

    .join-code-section label {
        font-size: 9px;
        margin-bottom: 2px;
        display: block;
    }

    /* 2 column grid: input (wider) + button (narrower) */
    .join-code-input {
        display: grid;
        grid-template-columns: 1fr auto;
        gap: 3px;
        align-items: stretch;
    }

    .join-code-input input {
        padding: 5px 8px;
        font-size: 10px;
    }

    .join-code-input .btn-sm {
        padding: 5px 12px;
        font-size: 10px;
    }

    /* Filters row: 3 equal columns - Mode, Difficulty, Clear */
    .server-filters {
        display: grid;
        grid-template-columns: 1fr 1fr 1fr;
        gap: 3px;
        margin-bottom: 4px;
    }

    .server-filters select {
        padding: 5px 8px;
        font-size: 10px;
        width: 100%;
    }

    .server-filters .btn-sm {
        padding: 5px 8px;
        font-size: 9px;
        white-space: nowrap;
        width: 100%;
    }

    .server-list-container {
        max-height: 145px;
        margin-bottom: 4px;
        overflow-x: auto;
        overflow-y: auto;
        background: rgba(0, 0, 0, 0.2);
        border-radius: 3px;
    }

    .server-table {
        font-size: 9px;
        min-width: 100%;
        width: 100%;
    }

    .server-table th {
        font-size: 9px;
        padding: 4px 5px;
        background: rgba(0, 0, 0, 0.3);
    }

    .server-table td {
        padding: 5px 5px;
        font-size: 9px;
    }

    /* Make action buttons in table smaller and consistent */
    .server-table .btn-join,
    .server-table .btn-reconnect {
        padding: 4px 8px !important;
        font-size: 9px !important;
        min-width: auto !important;
        white-space: nowrap;
    }

    .server-table .status-badge {
        font-size: 8px;
        padding: 2px 5px;
    }

    #menu-join .menu-actions {
        gap: 4px;
        margin-top: 4px;
    }

    #menu-join .btn-secondary,
    #menu-join .btn-refresh {
        padding: 6px 10px;
        font-size: 10px;
    }

    /* Waiting Room - 2 column layout: left (room info) + right (friends) */
    .waiting-room-layout {
        display: grid;
        grid-template-columns: 1fr 135px;
        gap: 6px;
        height: 100%;
    }

    .waiting-room-main {
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

    /* Hide title in waiting room for landscape mobile */
    #menu-waiting .menu-title {
        display: none;
    }

    /* Show friends panel on right side */
    .waiting-friends-panel {
        display: flex;
        flex-direction: column;
        width: 100%;
        padding: 6px;
        max-height: 100%;
        overflow-y: auto;
        background: rgba(0, 0, 0, 0.3);
        border-radius: 4px;
    }

    .waiting-friends-header {
        font-size: 10px;
        margin-bottom: 4px;
        padding-bottom: 3px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .waiting-friend-item {
        padding: 3px;
        font-size: 9px;
        margin-bottom: 2px;
    }

    .waiting-friend-name {
        font-size: 9px;
    }

    .waiting-friend-status {
        font-size: 8px;
    }

    .btn-invite-friend {
        padding: 3px 5px;
        font-size: 8px;
    }

    .waiting-friends-list {
        flex: 1;
        overflow-y: auto;
    }

    /* Room code - balanced size */
    .room-code-display {
        padding: 5px 8px;
        margin-bottom: 4px;
        text-align: left;
        background: rgba(0, 0, 0, 0.2);
        border-radius: 4px;
    }

    .room-code-display label {
        font-size: 10px;
        display: inline;
        margin-right: 5px;
    }

    .room-code-value {
        font-size: 13px;
        padding: 3px 6px;
        display: inline-block;
        background: rgba(255, 255, 255, 0.1);
        border-radius: 3px;
        font-weight: bold;
        letter-spacing: 1px;
    }

    .room-code-display .btn-sm {
        padding: 3px 6px;
        font-size: 9px;
        margin-left: 5px;
    }

    /* Room info - horizontal */
    .room-info {
        display: flex;
        gap: 5px;
        margin-bottom: 4px;
        flex-wrap: wrap;
    }

    .info-item {
        font-size: 10px;
        padding: 4px 6px;
        flex: 0 0 auto;
        background: rgba(0, 0, 0, 0.2);
        border-radius: 3px;
    }

    .info-item i {
        font-size: 10px;
        margin-right: 3px;
    }

    /* Players box */
    .players-waiting-box {
        padding: 6px;
        margin-bottom: 4px;
        flex: 1;
        min-height: 0;
        background: rgba(0, 0, 0, 0.2);
        border-radius: 4px;
    }

    .players-waiting-box h3 {
        font-size: 11px;
        margin-bottom: 4px;
    }

    .player-list {
        max-height: 60px;
        overflow-y: auto;
    }

    .player-tag {
        padding: 4px 6px;
        font-size: 10px;
        margin-bottom: 2px;
    }

    .ready-badge {
        padding: 2px 4px;
        font-size: 8px;
    }

    .waiting-hint {
        font-size: 9px;
        margin-top: 3px;
    }

    /* Waiting room buttons */
    #menu-waiting .menu-actions {
        margin-top: 4px;
        gap: 5px;
    }

    #menu-waiting .btn-primary,
    #menu-waiting .btn-secondary {
        padding: 8px 12px;
        font-size: 11px;
    }

    #menu-waiting .btn-primary {
        font-size: 12px;
    }

    /* Login Card - Adjust for landscape */
    .login-card {
        max-width: 360px;
        padding: 0;
    }

    .login-tabs {
        padding: 5px;
        gap: 5px;
    }

    .login-tab-btn {
        padding: 9px;
        font-size: 12px;
    }

    .auth-form {
        padding: 25px;
    }

    .login-title {
        font-size: 20px;
        margin-bottom: 18px;
        gap: 8px;
    }

    .login-title i {
        font-size: 20px;
    }

    .login-input-group {
        margin-bottom: 14px;
    }

    .login-input-group label {
        font-size: 9px;
        margin-bottom: 5px;
    }

    .login-input-group input {
        padding: 11px 14px;
        font-size: 13px;
    }

    .btn-login-main {
        padding: 13px;
        font-size: 15px;
        gap: 8px;
        margin-top: 8px;
    }

    .btn-login-main i {
        font-size: 15px;
    }

    .btn-login-guest {
        padding: 13px;
        font-size: 13px;
    }

    .login-subtitle {
        font-size: 11px;
        margin-bottom: 14px;
    }

    .login-footer {
        font-size: 10px;
        margin-top: 12px;
    }

    /* Friends Guest Warning */
    .friends-guest-warning {
        padding: 12px;
        margin-bottom: 12px;
    }

    .friends-guest-warning i {
        font-size: 28px;
        margin-bottom: 6px;
    }

    .friends-guest-warning p {
        font-size: 12px;
        margin: 3px 0;
    }

    /* Guide Book in Lobby */
    .guide-container {
        max-height: 300px;
        font-size: 12px;
    }

    .guide-section {
        margin-bottom: 16px;
        padding: 12px;
    }

    .guide-section h4 {
        font-size: 14px;
        margin-bottom: 8px;
    }

    .guide-section p,
    .guide-section li {
        font-size: 12px;
    }

    /* Leaderboard Full Page */
    .leaderboard-filters {
        gap: 6px;
        margin-bottom: 12px;
    }

    .filter-btn {
        padding: 7px 10px;
        font-size: 11px;
    }

    .leaderboard-container {
        max-height: 280px;
    }

    /* Friends Full Page */
    .add-friend-section {
        margin-bottom: 12px;
    }

    .add-friend-section input {
        padding: 8px 10px;
        font-size: 12px;
    }

    .friends-list {
        max-height: 260px;
    }
}

/* ============================================
   MOBILE LANDSCAPE MODE (Gameplay)
   ============================================ */

@media (max-width: 926px) and (orientation: landscape) {
    /* Optimize HUD for landscape mobile */
    .hud {
        padding: 8px 12px;
    }

    .hud-top-left {
        top: 10px;
        left: 12px;
        width: 200px;
    }

    .hud-top-right {
        top: 10px;
        right: 12px;
    }

    /* Compact Score Display */
    .hud-score {
        padding: 4px 12px;
        min-width: 80px;
    }

    .score-label {
        font-size: 8px;
        letter-spacing: 1px;
    }

    .score-value {
        font-size: 24px;
    }

    /* Compact Timer */
    .hud-timer {
        padding: 4px 12px;
        gap: 6px;
    }

    .timer-icon {
        font-size: 16px;
    }

    .timer-value {
        font-size: 20px;
        min-width: 50px;
    }

    /* Compact Holding Display */
    .hud-holding {
        padding: 6px 10px;
        min-width: 120px;
    }

    .holding-label {
        font-size: 8px;
        letter-spacing: 1px;
    }

    .holding-display {
        font-size: 14px;
    }

    /* Compact Orders Bar */
    .orders-bar {
        top: 10px;
        padding: 3px 10px;
        scale: 0.85;
    }

    .orders-label {
        font-size: 12px;
    }

    .order-card {
        padding: 8px 10px;
        min-width: 100px;
    }

    .order-emoji {
        font-size: 24px;
    }

    .order-name {
        font-size: 10px;
    }

    .order-ingredients {
        font-size: 14px;
    }

    .order-points {
        font-size: 10px;
    }

    /* Compact Quick Chat Sidebar */
    .quick-chat-sidebar {
        right: 12px;
        padding: 6px;
        gap: 6px;
    }

    .side-chat-btn {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }

    .side-chat-btn .key-hint {
        width: 12px;
        height: 12px;
        font-size: 7px;
    }

    /* Compact Chat Input */
    .floating-chat-container {
        width: 300px;
        bottom: 80px;
        padding: 4px 12px;
    }

    .floating-chat-container input {
        font-size: 14px;
    }

    .floating-chat-container button {
        width: 32px;
        height: 32px;
    }

    /* Compact Recipe Book */
    .btn-recipe-toggle {
        width: 40px;
        height: 40px;
        font-size: 20px;
        bottom: 10px;
        right: 10px;
    }

    .recipe-book {
        width: 260px;
        max-height: 300px;
        padding: 12px;
        bottom: 55px;
        right: 10px;
    }

    .recipe-item {
        padding: 8px;
        gap: 8px;
    }

    .recipe-item-emoji {
        font-size: 24px;
    }

    .recipe-item-name {
        font-size: 12px;
    }

    .recipe-item-ings {
        font-size: 10px;
    }

    /* Compact Guide Book */
    .btn-guide-toggle {
        width: 40px;
        height: 40px;
        font-size: 20px;
        bottom: 10px;
        right: 55px;
    }

    .guide-book {
        width: 350px;
        max-height: 400px;
        padding: 14px;
        bottom: 55px;
        right: 55px;
    }

    .guide-section {
        padding: 12px;
        margin-bottom: 16px;
    }

    .guide-section h4 {
        font-size: 14px;
    }

    .guide-section p,
    .guide-section li {
        font-size: 12px;
    }

    /* Compact Player List */
    .hud-player-list {
        width: 150px;
        gap: 4px;
    }

    .hud-player-tag {
        padding: 3px 8px;
        font-size: 11px;
    }

    /* Compact VS Scoreboard */
    .vs-scoreboard {
        padding: 8px;
        max-width: 180px;
    }

    /* Compact Connection Quality */
    .connection-quality {
        font-size: 11px;
        padding: 4px 8px;
    }

    /* Compact Chat Log */
    .hud-chat-log {
        max-height: 100px;
    }

    .hud-chat-line {
        font-size: 12px;
    }

    .hud-chat-line .sender {
        font-size: 10px;
    }
}

/* ============================================
   EXTRA SMALL MOBILE (< 480px)
   ============================================ */

@media (max-width: 480px) {
    /* Portrait Mode Adjustments */
    .lobby-container {
        width: 98%;
        padding: 8px;
    }

    .game-logo {
        font-size: 24px;
        gap: 6px;
    }

    .logo-icon {
        font-size: 32px !important;
    }

    .logo-subtitle {
        font-size: 10px;
        letter-spacing: 1px;
    }

    .login-card {
        max-width: 95%;
    }

    .auth-form {
        padding: 20px;
    }

    .login-title {
        font-size: 20px;
        gap: 8px;
    }

    .login-input-group input {
        padding: 10px 14px;
        font-size: 14px;
    }

    .btn-login-main {
        padding: 14px;
        font-size: 16px;
    }

    /* Menu Buttons */
    .menu-btn.compact {
        padding: 8px;
    }

    .menu-btn.compact .btn-icon {
        font-size: 18px;
        width: 28px;
        height: 28px;
    }

    .menu-btn.compact .btn-title {
        font-size: 13px;
    }

    .menu-btn.compact .btn-desc {
        font-size: 9px;
    }

    /* Panels */
    .friends-panel,
    .leaderboard-panel {
        max-height: 150px;
        padding: 10px;
    }

    .friends-panel-header,
    .leaderboard-panel-header {
        font-size: 12px;
        margin-bottom: 10px;
    }

    .friend-panel-item,
    .leaderboard-item {
        padding: 6px;
        font-size: 11px;
    }

    /* Input Groups */
    .input-group input {
        padding: 10px;
        font-size: 13px;
    }

    .input-group label {
        font-size: 10px;
    }

    /* Buttons */
    .btn-primary,
    .btn-secondary {
        padding: 10px;
        font-size: 14px;
    }

    .menu-title {
        font-size: 20px;
        margin-bottom: 16px;
    }
}

/* ============================================
   TOUCH OPTIMIZATIONS
   ============================================ */

@media (hover: none) and (pointer: coarse) {
    /* Increase touch targets */
    .menu-btn,
    .btn-primary,
    .btn-secondary,
    .btn-sm {
        min-height: 44px;
    }

    .side-chat-btn {
        min-width: 44px;
        min-height: 44px;
    }

    .login-tab-btn {
        min-height: 44px;
    }

    /* Remove hover effects on touch devices */
    .menu-btn:hover,
    .btn-primary:hover,
    .btn-secondary:hover {
        transform: none;
    }

    /* Add active states instead */
    .menu-btn:active {
        transform: scale(0.98);
        opacity: 0.9;
    }

    .btn-primary:active,
    .btn-secondary:active {
        transform: scale(0.98);
    }

    .side-chat-btn:active {
        transform: scale(0.95);
    }
}

/* ============================================
   FULLSCREEN MODE ADJUSTMENTS
   ============================================ */

.mobile-device:fullscreen,
.mobile-device:-webkit-full-screen,
.mobile-device:-moz-full-screen,
.mobile-device:-ms-fullscreen {
    /* Ensure proper rendering in fullscreen */
    width: 100vw;
    height: 100vh;
}

.mobile-device:fullscreen #game-canvas,
.mobile-device:-webkit-full-screen #game-canvas,
.mobile-device:-moz-full-screen #game-canvas {
    width: 100vw !important;
    height: 100vh !important;
}

/* ============================================
   SAFE AREA INSETS (iPhone Notch Support)
   ============================================ */

@supports (padding: max(0px)) {
    .mobile-device .hud {
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
        padding-top: max(12px, env(safe-area-inset-top));
    }

    .mobile-device .lobby-container {
        padding-left: max(10px, env(safe-area-inset-left));
        padding-right: max(10px, env(safe-area-inset-right));
        padding-bottom: max(40px, env(safe-area-inset-bottom));
    }

    .mobile-device .quick-chat-sidebar {
        right: max(12px, env(safe-area-inset-right));
    }

    .mobile-device .btn-recipe-toggle {
        right: max(12px, env(safe-area-inset-right));
        bottom: max(12px, env(safe-area-inset-bottom));
    }
}


/* ============================================
   VIRTUAL JOYSTICK (Mobile Touch Controls)
   ============================================ */

.virtual-joystick-container {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 50%; /* Left half of screen */
    height: 100%;
    z-index: 150;
    pointer-events: auto;
    display: none;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.virtual-joystick-container.active {
    display: block;
}

.joystick-base {
    position: absolute;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, 
        rgba(255, 255, 255, 0.15) 0%, 
        rgba(255, 255, 255, 0.08) 40%, 
        rgba(0, 0, 0, 0.2) 100%);
    border: 4px solid rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(15px);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.4),
        inset 0 2px 10px rgba(255, 255, 255, 0.15),
        inset 0 -2px 10px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8);
    transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
}

.virtual-joystick-container.touching .joystick-base {
    transform: translate(-50%, -50%) scale(1);
}

/* Center dot indicator - shows deadzone */
.joystick-base::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 56px; /* 20% of 140px base = 28px radius = 56px diameter */
    height: 56px;
    border-radius: 50%;
    background: radial-gradient(circle at center,
        rgba(255, 255, 255, 0.25) 0%,
        rgba(255, 255, 255, 0.1) 50%,
        transparent 100%);
    transform: translate(-50%, -50%);
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 
        inset 0 2px 5px rgba(255, 255, 255, 0.2),
        inset 0 -2px 5px rgba(0, 0, 0, 0.2);
}

/* Directional cross indicators */
.joystick-base::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    transform: translate(-50%, -50%);
    background: 
        linear-gradient(0deg, transparent 47%, rgba(255, 255, 255, 0.1) 47%, rgba(255, 255, 255, 0.1) 53%, transparent 53%),
        linear-gradient(90deg, transparent 47%, rgba(255, 255, 255, 0.1) 47%, rgba(255, 255, 255, 0.1) 53%, transparent 53%);
    border-radius: 50%;
    pointer-events: none;
}

.joystick-stick {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: linear-gradient(135deg, 
        rgba(255, 107, 53, 1) 0%, 
        rgba(255, 140, 66, 1) 50%,
        rgba(255, 107, 53, 0.9) 100%);
    border: 4px solid rgba(255, 255, 255, 0.6);
    box-shadow: 
        0 6px 20px rgba(255, 107, 53, 0.6),
        0 0 30px rgba(255, 107, 53, 0.3),
        inset 0 3px 8px rgba(255, 255, 255, 0.4),
        inset 0 -3px 8px rgba(0, 0, 0, 0.4);
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 2;
}

/* Inner highlight on stick */
.joystick-stick::before {
    content: '';
    position: absolute;
    top: 15%;
    left: 15%;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%,
        rgba(255, 255, 255, 0.6) 0%,
        rgba(255, 255, 255, 0.2) 50%,
        transparent 100%);
    transform: translate(0, 0);
}

/* Outer glow ring */
.joystick-stick::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 85px;
    height: 85px;
    border-radius: 50%;
    background: radial-gradient(circle at center,
        transparent 60%,
        rgba(255, 107, 53, 0.3) 70%,
        transparent 100%);
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.virtual-joystick-container.touching .joystick-stick::after {
    opacity: 1;
    animation: joystickGlow 1.5s ease-in-out infinite;
}

@keyframes joystickGlow {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.6;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 0.3;
    }
}

/* Active state glow */
.virtual-joystick-container.touching .joystick-stick {
    box-shadow: 
        0 6px 25px rgba(255, 107, 53, 0.8),
        0 0 40px rgba(255, 107, 53, 0.5),
        inset 0 3px 8px rgba(255, 255, 255, 0.4),
        inset 0 -3px 8px rgba(0, 0, 0, 0.4);
}

/* Idle state - subtle pulse to show it's there */
.virtual-joystick-container:not(.touching) .joystick-base {
    animation: joystickIdlePulse 3s ease-in-out infinite;
}

@keyframes joystickIdlePulse {
    0%, 100% {
        opacity: 0.3;
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        opacity: 0.5;
        transform: translate(-50%, -50%) scale(1.05);
    }
}

/* Responsive adjustments */
@media (max-width: 768px) and (orientation: landscape) {
    .joystick-base {
        width: 120px;
        height: 120px;
        border-width: 3px;
    }

    .joystick-base::before {
        width: 45px;
        height: 45px;
    }

    .joystick-stick {
        width: 60px;
        height: 60px;
        border-width: 3px;
    }

    .joystick-stick::before {
        width: 25px;
        height: 25px;
    }

    .joystick-stick::after {
        width: 75px;
        height: 75px;
    }
}

@media (max-width: 480px) and (orientation: landscape) {
    .joystick-base {
        width: 100px;
        height: 100px;
        border-width: 3px;
    }

    .joystick-base::before {
        width: 40px;
        height: 40px;
    }

    .joystick-stick {
        width: 50px;
        height: 50px;
        border-width: 3px;
    }

    .joystick-stick::before {
        width: 20px;
        height: 20px;
    }

    .joystick-stick::after {
        width: 65px;
        height: 65px;
    }
}

/* Hide on desktop */
@media (min-width: 769px) {
    .virtual-joystick-container {
        display: none !important;
    }
}

/* Pop-in animation when joystick appears */
@keyframes joystickPopIn {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    60% {
        transform: translate(-50%, -50%) scale(1.1);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.joystick-base[style*="opacity: 1"] {
    animation: joystickPopIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}


/* ============================================
   MOBILE ACTION BUTTON (Right Side) - UNIFIED
   ============================================ */

.mobile-action-buttons {
    position: fixed;
    bottom: 80px; /* Adjusted - not too high, not too low */
    right: 80px;
    display: none;
    z-index: 150;
    pointer-events: auto;
    touch-action: none;
}

.mobile-action-buttons.active {
    display: block;
}

.action-btn {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.6);
    background: linear-gradient(135deg, #FFD23F 0%, #FFB020 100%);
    color: white;
    font-size: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 
        0 6px 25px rgba(255, 210, 63, 0.7),
        inset 0 3px 8px rgba(255, 255, 255, 0.3);
    transition: all 0.15s ease;
    position: relative;
}

.action-btn:active,
.action-btn.active {
    transform: scale(0.9);
    box-shadow: 0 3px 15px rgba(255, 210, 63, 0.9);
}

/* Holding state - changes to orange */
.action-btn.holding {
    background: linear-gradient(135deg, #FF6B35 0%, #FF8C42 100%);
    box-shadow: 
        0 6px 25px rgba(255, 107, 53, 0.8),
        inset 0 3px 8px rgba(255, 255, 255, 0.3);
    animation: holdPulse 0.6s ease-in-out infinite;
}

@keyframes holdPulse {
    0%, 100% {
        transform: scale(0.9);
    }
    50% {
        transform: scale(0.95);
    }
}

/* Responsive */
@media (max-width: 768px) and (orientation: landscape) {
    .mobile-action-buttons {
        bottom: 70px;
        right: 70px;
    }

    .action-btn {
        width: 80px;
        height: 80px;
        font-size: 32px;
    }
}

@media (max-width: 480px) and (orientation: landscape) {
    .mobile-action-buttons {
        bottom: 60px;
        right: 60px;
    }

    .action-btn {
        width: 70px;
        height: 70px;
        font-size: 28px;
    }
}

/* Hide on desktop */
@media (min-width: 769px) {
    .mobile-action-buttons {
        display: none !important;
    }
}

/* ======= SERVER SETTINGS MINI MODAL ======= */
.btn-server-settings {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 4px;
    color: var(--text-dim);
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    margin-left: 8px;
}

.btn-server-settings:hover {
    background: var(--primary);
    color: white;
}

.server-mini-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 0;
    width: 90%;
    max-width: 320px;
    z-index: 3000;
    box-shadow: 0 20px 50px rgba(0,0,0,0.8);
    backdrop-filter: blur(10px);
}

.mini-modal-content {
    display: flex;
    flex-direction: column;
}

.mini-modal-header {
    background: rgba(0,0,0,0.3);
    padding: 12px 16px;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--font-display);
    font-size: 14px;
    color: var(--accent);
}

.mini-modal-header button {
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-size: 20px;
    cursor: pointer;
}

.mini-modal-body {
    padding: 20px;
}

.mini-modal-body label {
    display: block;
    font-size: 10px;
    font-weight: 800;
    color: var(--text-dim);
    margin-bottom: 8px;
}

.mini-modal-body input {
    width: 100%;
    padding: 10px 14px;
    background: rgba(0,0,0,0.4);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: white;
    font-size: 14px;
    margin-bottom: 8px;
    outline: none;
}

.mini-modal-body input:focus {
    border-color: var(--primary);
}

.mini-hint {
    font-size: 10px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.btn-apply-server {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    border: none;
    border-radius: 10px;
    color: white;
    font-family: var(--font-display);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-apply-server:hover {
    filter: brightness(1.2);
    transform: translateY(-2px);
}

/* ======= SETTINGS BUTTON ======= */
.settings-fab {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 22px;
    cursor: pointer;
    z-index: 3000;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.settings-fab:hover {
    background: var(--primary);
    transform: rotate(45deg) scale(1.1);
    border-color: rgba(255, 255, 255, 0.3);
}

.settings-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    z-index: 3100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.settings-modal.active {
    display: flex;
}

.settings-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 30px;
    width: 100%;
    max-width: 350px;
    text-align: center;
    position: relative;
    animation: menuSlideUp 0.3s ease-out;
}
