@import url('https://fonts.googleapis.com/css2?family=Fredoka+One&family=Nunito:wght@400;600;700;800&display=swap');

/* ==========================================
   RESET & BASE - Mobile First
   ========================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Prevent pull-to-refresh and overscroll on mobile */
html {
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
}

:root {
    --theme-bg-start: #1a0533;
    --theme-bg-end: #6b3fa0;
    --theme-accent: #ff4757;
    
    /* Z-index layers - organizados para evitar conflitos */
    --z-bg: 0;
    --z-game: 1;
    --z-header: 10;
    --z-effects: 50;
    --z-status: 100;
    --z-modal: 200;
    --z-celebration: 2000;
    --z-floating: 2900;
    --z-combo: 3000;
    --z-overlay: 3100;
}

body {
    font-family: 'Nunito', sans-serif;
    background: linear-gradient(180deg, var(--theme-bg-start) 0%, #2d1b4e 30%, #4a2c7a 60%, var(--theme-bg-end) 100%);
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
    color: white;
    transition: background 1s ease-in-out;
    /* Prevent text selection on game elements */
    -webkit-user-select: none;
    user-select: none;
    /* Prevent tap highlight */
    -webkit-tap-highlight-color: transparent;
}

/* Animated background */
.bg-particles {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: var(--z-bg);
}

.bg-particle {
    position: absolute;
    border-radius: 50%;
    animation: float 15s infinite ease-in-out;
    opacity: 0.3;
    box-shadow: 0 0 20px currentColor, 0 0 40px currentColor;
    filter: blur(1px);
}

@keyframes float {

    0%,
    100% {
        transform: translateY(100vh) rotate(0deg) scale(0.5);
        opacity: 0;
    }

    10% {
        opacity: 0.4;
        transform: translateY(90vh) rotate(72deg) scale(1);
    }

    90% {
        opacity: 0.4;
        transform: translateY(10vh) rotate(648deg) scale(1);
    }

    100% {
        transform: translateY(-100px) rotate(720deg) scale(0.5);
        opacity: 0;
    }
}

#game-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    /* Dynamic viewport height for mobile */
    position: relative;
    z-index: var(--z-game);
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    /* Prevenir scroll indesejado */
    overflow: hidden;
    /* GPU acceleration para transições suaves */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

/* Header - Ultra Compact Mobile-First */
#header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 8px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.5) 0%, transparent 100%);
    gap: 8px;
}

.header-top {
    display: contents;
    /* Remove wrapper, let children flow into parent flex */
}

.logo {
    flex-shrink: 0;
}

.logo-icon {
    font-size: 1.4rem;
}

.level-info {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    white-space: nowrap;
    overflow: hidden;
}

.level-info #level-name {
    color: #ffd700;
    font-weight: 700;
}

.level-divider {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.6rem;
}

.level-info .highlight {
    color: #fff;
    font-weight: 800;
    font-size: 0.9rem;
    text-shadow: 0 0 6px rgba(255, 215, 0, 0.5);
}

#user-info {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

#user-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid #ffd700;
    display: none;
}

.btn-icon {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

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

/* Google Sign-In Button container */
#g_id_signin {
    display: block;
    transform: scale(0.9);
    transform-origin: center;
}

#logout-btn {
    display: none;
}

/* Connection status - small dot in top left corner */
#connection-status {
    position: fixed;
    top: 8px;
    left: 8px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    padding: 0;
    z-index: var(--z-status);
    background: transparent;
}

#connection-status .status-dot {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    animation: blink 2s infinite;
}

#connection-status #status-text {
    display: none;
}

.connected .status-dot {
    background: #4caf50;
    box-shadow: 0 0 4px #4caf50;
}

.disconnected .status-dot {
    background: #f44336;
    box-shadow: 0 0 4px #f44336;
}

/* Legacy button styles (for modals) */
.btn {
    background: linear-gradient(180deg, #4caf50 0%, #2e7d32 100%);
    border: none;
    padding: 12px 24px;
    border-radius: 30px;
    color: white;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4), inset 0 2px 0 rgba(255, 255, 255, 0.2);
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.5);
}

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

/* Main content - Mobile First */
#main-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    padding: 4px;
    gap: 6px;
    min-height: 0;
}

/* Panels - Mobile First */
.side-panel {
    width: 100%;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    gap: 8px;
    flex-shrink: 0;
}

.panel-card {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.05) 100%);
    border-radius: 10px;
    padding: 6px 10px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    flex: 1;
    min-width: 0;
    text-align: center;
}

.panel-title {
    font-size: 0.55rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 2px;
}

.score-value {
    font-family: 'Fredoka One', cursive;
    font-size: 1.3rem;
    background: linear-gradient(180deg, #fff 0%, #ffeb3b 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.moves-value {
    font-family: 'Fredoka One', cursive;
    font-size: 1.3rem;
    color: #4fc3f7;
}

/* Combo Display - Centralizado na tela */
.combo-display {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    text-align: center;
    opacity: 0;
    z-index: var(--z-combo);
    pointer-events: none;
    will-change: transform, opacity;
}

.combo-display.active {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.combo-text {
    font-family: 'Fredoka One', cursive;
    font-size: clamp(2rem, 10vw, 3rem);
    color: #ff4081;
    text-shadow: 0 4px 15px rgba(255, 64, 129, 0.5), 0 0 30px rgba(255, 255, 255, 0.3);
    animation: pulse 0.5s infinite;
}

@keyframes pulse {

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

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

/* Dynamic Combo Display (for stacking) */
.combo-display-dynamic {
    font-family: 'Fredoka One', cursive;
}

.combo-text-dynamic {
    font-size: clamp(1.8rem, 8vw, 2.5rem);
    color: #ff4081;
    text-shadow:
        0 4px 15px rgba(255, 64, 129, 0.6),
        0 0 30px rgba(255, 255, 255, 0.4),
        0 2px 0 #c51162;
    font-weight: 900;
    display: block;
}

/* Canvas */
#canvas-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    min-height: 0;
    min-width: 0;
    /* Important for flex shrinking */
    overflow: hidden;
    padding: 0;
    /* Prevenir overflow do canvas */
    contain: layout size;
}

#game-canvas {
    border-radius: 0;
    box-shadow: none;
    max-width: 100%;
    max-height: 100%;
    touch-action: manipulation;
    /* Better touch handling */
    /* Evitar bugs de renderização no mobile */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

/* Leaderboard */
#leaderboard-panel {
    width: 250px;
}

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

.leaderboard-entry {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    transition: all 0.3s;
}

.leaderboard-entry:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(5px);
}

.rank {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 800;
    font-size: 0.85rem;
}

.rank-1 {
    background: linear-gradient(180deg, #ffd700 0%, #ffaa00 100%);
    color: #000;
}

.rank-2 {
    background: linear-gradient(180deg, #c0c0c0 0%, #a0a0a0 100%);
    color: #000;
}

.rank-3 {
    background: linear-gradient(180deg, #cd7f32 0%, #8b4513 100%);
    color: #fff;
}

.rank-default {
    background: rgba(255, 255, 255, 0.2);
}

/* Leaderboard Items - Improved Layout */
.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    transition: all 0.2s ease;
}

.leaderboard-item:hover {
    background: rgba(255, 255, 255, 0.15);
}

.leaderboard-item.highlight {
    background: rgba(255, 215, 0, 0.15);
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.leaderboard-item .player-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
    /* Allow truncation */
}

.leaderboard-item .player-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
}

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

.leaderboard-item .player-score {
    font-weight: 800;
    color: #ffeb3b;
    font-size: 0.9rem;
    text-align: right;
    min-width: 50px;
}

.player-name {
    flex: 1;
    font-weight: 600;
}

.player-score {
    font-weight: 800;
    color: #ffeb3b;
}

/* Objective Display in Side Panel */
.objective-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 1.2rem;
}

.objective-display #objective-icon {
    font-size: 1.5rem;
}

.objective-display .highlight {
    color: #ffeaa7;
    font-weight: 800;
    font-size: 1.3rem;
}

/* Leaderboard Tabs */
.leaderboard-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 8px;
    justify-content: center;
}

.tab-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.8);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn.active {
    background: rgba(255, 215, 0, 0.3);
    border-color: #ffd700;
    color: #fff;
}

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

/* Add Friend Button in Leaderboard */
.add-friend-btn {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: rgba(46, 204, 113, 0.8);
    color: #fff;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 5px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.add-friend-btn:hover {
    background: #2ecc71;
    transform: scale(1.1);
}

/* Effects */
.score-popup {
    position: absolute;
    font-family: 'Fredoka One', cursive;
    font-size: 1.5rem;
    color: #ffeb3b;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    z-index: 100;
}

.match-flash {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
    pointer-events: none;
    opacity: 0;
    z-index: var(--z-effects);
    will-change: opacity;
}

/* Status - Unified (removido duplicação) */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: blink 2s infinite;
}

.connected .status-dot {
    background: #4caf50;
}

.disconnected .status-dot {
    background: #f44336;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

/* Modals - Mobile First */
.level-complete {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease-out;
    padding: 20px;
    padding-top: max(20px, env(safe-area-inset-top));
    padding-bottom: max(20px, env(safe-area-inset-bottom));
    /* Prevenir scroll quando modal está aberto */
    overflow: hidden;
    overscroll-behavior: contain;
}

.level-complete.show {
    opacity: 1;
    pointer-events: auto;
}

.level-complete.show h2 {
    animation: bounceIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.level-complete.show .panel-card {
    animation: slideUp 0.5s ease-out 0.2s forwards;
    opacity: 0;
    transform: translateY(30px);
}

.level-complete h2 {
    font-family: 'Fredoka One', cursive;
    font-size: clamp(2rem, 8vw, 4rem);
    background: linear-gradient(180deg, #fff 0%, #ffeb3b 50%, #ff9800 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-align: center;
    margin-bottom: 10px;
    transform: scale(0);
}

.level-complete .panel-card {
    width: auto;
    min-width: 280px;
    max-width: 320px;
    padding: 20px 24px;
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.18) 0%, rgba(255, 255, 255, 0.08) 100%);
    border: 2px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
    height: auto;
    flex: none;
}

.level-complete .btn {
    width: 100%;
    padding: 16px 24px;
    font-size: 1.1rem;
    border-radius: 16px;
    margin-top: 20px;
    background: linear-gradient(180deg, #4caf50 0%, #388e3c 100%);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
}

.level-complete .btn:active {
    transform: scale(0.96);
    box-shadow: 0 3px 10px rgba(76, 175, 80, 0.3);
}

/* Modal Card - Compacto e ajustado ao conteúdo */
.modal-card {
    margin-top: 15px;
    text-align: center;
    width: auto;
    min-width: 0;
    max-width: 320px;
    padding: 20px 24px;
    height: auto;
}

.modal-objective-label {
    font-size: clamp(1rem, 4vw, 1.3rem);
    margin: 12px 0 8px;
    color: rgba(255, 255, 255, 0.8);
}

.modal-objective-value {
    font-size: clamp(1.4rem, 5vw, 1.8rem);
    color: #ffeb3b;
    margin-bottom: 15px;
    font-weight: 700;
}

.modal-score {
    font-size: clamp(2rem, 8vw, 3rem) !important;
    margin-bottom: 15px;
}

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

    50% {
        transform: scale(1.15) rotate(3deg);
    }

    70% {
        transform: scale(0.95) rotate(-1deg);
    }

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

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

@keyframes celebrate {
    0% {
        transform: scale(0) rotate(-10deg);
    }

    50% {
        transform: scale(1.2) rotate(5deg);
    }

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

/* Level name (used in level-info) */
#level-name {
    font-size: inherit;
    color: #ffd700;
    margin: 0;
    font-weight: 700;
}

/* Hide leaderboard and combo on mobile by default */
#leaderboard-panel {
    display: none;
}

#combo-display {
    display: none;
}

/* ==========================================
   TABLET STYLES (768px - 900px)
   ========================================== */
@media (min-width: 768px) and (max-width: 900px) {
    body {
        background: linear-gradient(135deg, var(--theme-bg-start) 0%, #2d1b4e 25%, #4a2c7a 50%, var(--theme-bg-end) 75%, #1a0533 100%);
        background-size: 400% 400%;
        animation: gradientShift 20s ease infinite;
    }

    @keyframes gradientShift {
        0%, 100% { background-position: 0% 50%; }
        50% { background-position: 100% 50%; }
    }

    #header {
        padding: 10px 16px;
        gap: 12px;
        background: linear-gradient(180deg, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0.2) 80%, transparent 100%);
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .logo-icon {
        font-size: 1.8rem;
        filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    }

    .level-info {
        font-size: 1rem;
        gap: 8px;
    }

    .level-info .highlight {
        font-size: 1.1rem;
    }

    #user-info {
        gap: 8px;
    }

    .btn-icon {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
        background: rgba(255, 255, 255, 0.12);
        border: 1px solid rgba(255, 255, 255, 0.15);
        transition: all 0.3s ease;
    }

    .btn-icon:hover {
        background: rgba(255, 255, 255, 0.25);
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }

    #main-content {
        flex-direction: row;
        padding: 12px 16px;
        gap: 16px;
    }

    .side-panel {
        width: 140px;
        flex-direction: column;
        gap: 12px;
        flex-shrink: 0;
    }

    .panel-card {
        padding: 16px;
        border-radius: 16px;
        border: 1px solid rgba(255, 255, 255, 0.2);
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
        text-align: center;
        background: linear-gradient(180deg, rgba(255, 255, 255, 0.18) 0%, rgba(255, 255, 255, 0.06) 100%);
        backdrop-filter: blur(15px);
        transition: transform 0.3s ease, box-shadow 0.3s ease;
    }

    .panel-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
    }

    .panel-title {
        font-size: 0.7rem;
        margin-bottom: 6px;
        letter-spacing: 1.5px;
        color: rgba(255, 255, 255, 0.8);
    }

    .score-value {
        font-size: 1.8rem;
    }

    .moves-value {
        font-size: 1.6rem;
    }

    .objective-display {
        flex-direction: column;
        gap: 6px;
    }

    .objective-display #objective-icon {
        font-size: 2rem;
    }

    .objective-display .highlight {
        font-size: 1.4rem;
    }

    #canvas-container {
        flex: 1;
        border-radius: 20px;
        background: rgba(0, 0, 0, 0.15);
        box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.2);
        padding: 8px;
    }

    #game-canvas {
        border-radius: 16px;
    }

    /* Show leaderboard on tablet in sidebar */
    #leaderboard-panel {
        display: flex;
        width: 180px;
    }

    .leaderboard-list {
        max-height: 350px;
    }

    .tab-btn {
        padding: 6px 10px;
        font-size: 0.75rem;
    }

    /* Level complete modal improvements */
    .level-complete h2 {
        font-size: 3rem;
    }

    .level-complete .panel-card {
        min-width: 320px;
        max-width: 380px;
        padding: 28px 32px;
    }

    .modal-score {
        font-size: 2.5rem !important;
    }

    .level-complete .btn {
        padding: 18px 32px;
        font-size: 1.15rem;
    }
}

/* ==========================================
   DESKTOP STYLES (min-width: 901px)
   ========================================== */
@media (min-width: 901px) {
    body {
        background: linear-gradient(135deg, var(--theme-bg-start) 0%, #2d1b4e 20%, #4a2c7a 45%, var(--theme-bg-end) 70%, #2d1b4e 90%, var(--theme-bg-start) 100%);
        background-size: 400% 400%;
        animation: gradientShiftDesktop 25s ease infinite;
    }

    @keyframes gradientShiftDesktop {
        0%, 100% { background-position: 0% 50%; }
        25% { background-position: 50% 100%; }
        50% { background-position: 100% 50%; }
        75% { background-position: 50% 0%; }
    }

    #game-container {
        max-width: 1600px;
        margin: 0 auto;
        padding: 0 20px;
    }

    #header {
        padding: 12px 24px;
        gap: 20px;
        background: linear-gradient(180deg, rgba(0, 0, 0, 0.65) 0%, rgba(0, 0, 0, 0.25) 70%, transparent 100%);
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 0 0 20px 20px;
        margin: 0 20px;
    }

    .logo-icon {
        font-size: 2.2rem;
        filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.4));
        transition: transform 0.3s ease;
    }

    .logo-icon:hover {
        transform: scale(1.15) rotate(10deg);
    }

    .level-info {
        font-size: 1.1rem;
        gap: 12px;
        background: rgba(255, 255, 255, 0.08);
        padding: 8px 20px;
        border-radius: 25px;
        border: 1px solid rgba(255, 255, 255, 0.12);
    }

    .level-info #level-name {
        font-size: 1.2rem;
    }

    .level-info .highlight {
        font-size: 1.2rem;
    }

    #user-info {
        gap: 10px;
    }

    #user-avatar {
        width: 38px;
        height: 38px;
        border-width: 3px;
        transition: transform 0.3s ease;
    }

    #user-avatar:hover {
        transform: scale(1.1);
    }

    .btn-icon {
        width: 44px;
        height: 44px;
        font-size: 1.2rem;
        background: rgba(255, 255, 255, 0.12);
        border: 1px solid rgba(255, 255, 255, 0.18);
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .btn-icon:hover {
        background: rgba(255, 255, 255, 0.28);
        transform: translateY(-3px) scale(1.05);
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
        border-color: rgba(255, 255, 255, 0.3);
    }

    .btn-icon:active {
        transform: translateY(0) scale(0.98);
    }

    #main-content {
        flex-direction: row;
        padding: 16px 24px;
        gap: 24px;
    }

    .side-panel {
        width: 220px;
        flex-direction: column;
        gap: 16px;
        flex-shrink: 0;
    }

    .panel-card {
        padding: 22px 20px;
        border-radius: 20px;
        border: 2px solid rgba(255, 255, 255, 0.2);
        box-shadow: 
            0 10px 40px rgba(0, 0, 0, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.15);
        text-align: center;
        background: linear-gradient(180deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0.06) 100%);
        backdrop-filter: blur(20px);
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        position: relative;
        overflow: hidden;
    }

    .panel-card::before {
        content: '';
        position: absolute;
        top: 0;
        left: -100%;
        width: 100%;
        height: 100%;
        background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
        transition: left 0.6s ease;
    }

    .panel-card:hover {
        transform: translateY(-4px) scale(1.02);
        box-shadow: 
            0 15px 50px rgba(0, 0, 0, 0.4),
            0 0 30px rgba(107, 79, 160, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.2);
        border-color: rgba(255, 215, 0, 0.4);
    }

    .panel-card:hover::before {
        left: 100%;
    }

    .panel-title {
        font-size: 0.85rem;
        margin-bottom: 10px;
        letter-spacing: 2.5px;
        color: rgba(255, 255, 255, 0.85);
        text-transform: uppercase;
        font-weight: 700;
    }

    .score-value {
        font-size: 2.8rem;
        filter: drop-shadow(0 2px 8px rgba(255, 235, 59, 0.4));
    }

    .moves-value {
        font-size: 2.4rem;
        filter: drop-shadow(0 2px 8px rgba(79, 195, 247, 0.4));
    }

    .objective-display {
        flex-direction: column;
        gap: 8px;
    }

    .objective-display #objective-icon {
        font-size: 2.8rem;
        filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
        transition: transform 0.3s ease;
    }

    .panel-card:hover .objective-display #objective-icon {
        transform: scale(1.1) rotate(5deg);
    }

    .objective-display .highlight {
        font-size: 1.8rem;
    }

    #combo-display {
        display: block;
    }

    /* Game canvas container styling for desktop */
    #canvas-container {
        flex: 1;
        border-radius: 24px;
        background: linear-gradient(180deg, rgba(0, 0, 0, 0.2) 0%, rgba(0, 0, 0, 0.1) 100%);
        box-shadow: 
            inset 0 4px 20px rgba(0, 0, 0, 0.3),
            0 0 60px rgba(107, 79, 160, 0.15);
        padding: 12px;
        border: 1px solid rgba(255, 255, 255, 0.1);
    }

    #game-canvas {
        border-radius: 20px;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    }

    /* Leaderboard panel desktop */
    #leaderboard-panel {
        display: flex;
        width: 280px;
    }

    #leaderboard-panel .panel-card {
        padding: 20px;
    }

    .leaderboard-tabs {
        gap: 6px;
        margin-bottom: 12px;
    }

    .tab-btn {
        padding: 8px 14px;
        font-size: 0.8rem;
        border-radius: 10px;
        transition: all 0.3s ease;
    }

    .tab-btn:hover {
        background: rgba(255, 255, 255, 0.25);
        transform: translateY(-2px);
    }

    .tab-btn.active {
        background: linear-gradient(180deg, rgba(255, 215, 0, 0.4) 0%, rgba(255, 165, 0, 0.3) 100%);
        box-shadow: 0 4px 12px rgba(255, 215, 0, 0.25);
    }

    .leaderboard-list {
        max-height: 450px;
        padding-right: 6px;
    }

    .leaderboard-list::-webkit-scrollbar {
        width: 6px;
    }

    .leaderboard-list::-webkit-scrollbar-track {
        background: rgba(255, 255, 255, 0.05);
        border-radius: 3px;
    }

    .leaderboard-list::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.2);
        border-radius: 3px;
    }

    .leaderboard-list::-webkit-scrollbar-thumb:hover {
        background: rgba(255, 255, 255, 0.35);
    }

    .leaderboard-item {
        padding: 12px 14px;
        border-radius: 14px;
        transition: all 0.3s ease;
    }

    .leaderboard-item:hover {
        background: rgba(255, 255, 255, 0.18);
        transform: translateX(6px);
    }

    .leaderboard-item .player-avatar {
        width: 40px;
        height: 40px;
    }

    .leaderboard-item .player-name {
        font-size: 0.95rem;
    }

    .leaderboard-item .player-score {
        font-size: 1rem;
    }

    .rank {
        width: 34px;
        height: 34px;
        font-size: 0.95rem;
    }

    /* Level complete modal - Desktop enhanced */
    .level-complete h2 {
        font-size: 4rem;
        margin-bottom: 20px;
    }

    .level-complete .panel-card {
        min-width: 400px;
        max-width: 480px;
        padding: 36px 44px;
        border-radius: 28px;
    }

    .modal-objective-label {
        font-size: 1.4rem;
    }

    .modal-objective-value {
        font-size: 2rem;
    }

    .modal-score {
        font-size: 3.5rem !important;
    }

    .level-complete .btn {
        padding: 20px 40px;
        font-size: 1.25rem;
        border-radius: 20px;
        margin-top: 28px;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .level-complete .btn:hover {
        transform: translateY(-4px) scale(1.05);
        box-shadow: 0 10px 30px rgba(76, 175, 80, 0.5);
    }

    /* Celebration overlay desktop */
    .celebration-title {
        font-size: 5rem;
    }

    .unlock-icon-large {
        font-size: 14rem;
    }

    .unlock-name-large {
        font-size: 3.5rem;
    }

    .celebration-overlay .btn {
        padding: 20px 50px;
        font-size: 1.3rem;
    }

    /* Floating text desktop */
    .floating-text {
        font-size: 3rem;
    }

    .score-popup {
        font-size: 2rem;
    }

    /* Ready go overlay desktop */
    #ready-go-overlay {
        font-size: 10rem;
    }
}

/* ==========================================
   LARGE DESKTOP (min-width: 1400px)
   ========================================== */
@media (min-width: 1400px) {
    #game-container {
        max-width: 1800px;
    }

    #header {
        padding: 16px 32px;
        margin: 0 40px;
    }

    .logo-icon {
        font-size: 2.5rem;
    }

    .level-info {
        font-size: 1.2rem;
        padding: 10px 28px;
    }

    .btn-icon {
        width: 48px;
        height: 48px;
    }

    #main-content {
        padding: 20px 40px;
        gap: 32px;
    }

    .side-panel {
        width: 260px;
        gap: 20px;
    }

    .panel-card {
        padding: 28px 24px;
        border-radius: 24px;
    }

    .panel-title {
        font-size: 0.95rem;
        margin-bottom: 14px;
    }

    .score-value {
        font-size: 3.2rem;
    }

    .moves-value {
        font-size: 2.8rem;
    }

    .objective-display #objective-icon {
        font-size: 3.2rem;
    }

    .objective-display .highlight {
        font-size: 2rem;
    }

    #canvas-container {
        border-radius: 28px;
        padding: 16px;
    }

    #game-canvas {
        border-radius: 24px;
    }

    #leaderboard-panel {
        width: 320px;
    }

    .leaderboard-item .player-avatar {
        width: 48px;
        height: 48px;
    }

    .leaderboard-item .player-name {
        font-size: 1.05rem;
    }

    .leaderboard-item .player-score {
        font-size: 1.1rem;
    }

    .rank {
        width: 40px;
        height: 40px;
        font-size: 1.05rem;
    }
}

/* Extra small mobile (< 400px width) */
@media (max-width: 400px) {
    #header {
        padding: 3px 6px;
        gap: 3px;
    }

    .logo-icon {
        font-size: 1.3rem;
    }

    .panel-card {
        padding: 5px 8px;
        border-radius: 8px;
    }

    .panel-title {
        font-size: 0.5rem;
    }

    .score-value,
    .moves-value {
        font-size: 1.1rem;
    }

    #user-info {
        display: flex;
        gap: 4px;
    }

    #user-avatar {
        width: 24px;
        height: 24px;
    }

    .btn-icon {
        width: 26px;
        height: 26px;
        font-size: 0.85rem;
    }

    .level-complete h2 {
        font-size: 1.8rem;
    }

    .level-complete .panel-card {
        padding: 16px;
    }

    #ready-go-overlay {
        font-size: 2.5rem;
    }
}

/* Portrait orientation specific */
@media (max-width: 600px) and (orientation: portrait) {
    #game-container {
        height: 100dvh;
        height: 100vh;
    }

    #main-content {
        flex: 1;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    #canvas-container {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0;
    }

    /* Ensure the game board is visible and well-sized */
    #game-canvas {
        max-width: 100vw;
        max-height: 100%;
    }
}

/* Unlocked Items */
#unlocked-items-container h3 {
    margin-bottom: 15px;
    color: #ffd700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    font-size: 1.2rem;
}

.unlocked-grid {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.unlocked-item {
    background: rgba(255, 255, 255, 0.15);
    padding: 10px;
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 80px;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.item-icon {
    font-size: 2.5rem;
    margin-bottom: 5px;
    filter: drop-shadow(0 4px 4px rgba(0, 0, 0, 0.3));
}

.item-name {
    font-size: 0.8rem;
    color: #fff;
    text-transform: capitalize;
    text-align: center;
}

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

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

/* Celebration Overlay - Mobile First */
.celebration-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 5, 20, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: var(--z-celebration);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.5s ease-out;
    padding: 20px;
    padding-top: max(20px, env(safe-area-inset-top));
    padding-bottom: max(20px, env(safe-area-inset-bottom));
}

.celebration-overlay.show {
    display: flex;
    opacity: 1;
}

.celebration-title {
    font-size: clamp(1.8rem, 9vw, 4rem);
    font-weight: 900;
    background: linear-gradient(to bottom, #fff, #ffd700);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
    text-shadow: 0 0 30px rgba(255, 215, 0, 0.6);
    z-index: 2;
    transform: scale(0);
    font-family: 'Fredoka One', cursive;
    text-align: center;
    max-width: 90vw;
    padding: 0 10px;
    line-height: 1.1;
}

.unlock-icon-large {
    font-size: clamp(8rem, 30vw, 12rem);
    margin: 15px;
    z-index: 2;
    filter: drop-shadow(0 0 50px rgba(255, 255, 255, 0.6));
    transform: scale(0);
}

.unlock-name-large {
    font-size: clamp(2rem, 8vw, 3rem);
    color: #fff;
    margin-bottom: 30px;
    z-index: 2;
    opacity: 0;
    font-family: 'Fredoka One', cursive;
    text-align: center;
}

.celebration-overlay .btn {
    padding: 16px 40px;
    font-size: 1.1rem;
    border-radius: 30px;
    z-index: 2;
}

/* Sunburst/Rays Effect */
.rays-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 150vmax;
    height: 150vmax;
    z-index: 1;
    pointer-events: none;
    opacity: 0.4;
}

.rays {
    width: 100%;
    height: 100%;
    background: repeating-conic-gradient(from 0deg,
            rgba(255, 215, 0, 0.15) 0deg 15deg,
            transparent 15deg 30deg);
    animation: rotateRays 15s linear infinite;
}

@keyframes rotateRays {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Floating Text (Combos & Score) - Centralizado */
.floating-text {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    font-weight: 900;
    font-size: clamp(1.5rem, 6vw, 2.5rem);
    color: #fff;
    text-shadow: 0 4px 10px rgba(0, 0, 0, 0.5), 0 0 20px rgba(255, 255, 255, 0.4);
    z-index: var(--z-combo);
    white-space: nowrap;
    font-family: 'Fredoka One', cursive;
    text-align: center;
    max-width: 90vw;
    will-change: transform, opacity;
}

.score-popup {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    font-weight: 900;
    font-size: clamp(1.2rem, 5vw, 1.8rem);
    color: #ffeb3b;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6), 0 0 20px rgba(255, 235, 59, 0.5);
    z-index: var(--z-floating);
    text-align: center;
    will-change: transform, opacity;
}

/* Ready Go Message - Mobile First */
#ready-go-overlay {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: clamp(3rem, 15vw, 8rem);
    font-weight: 900;
    color: #fff;
    text-shadow:
        0 0 30px rgba(255, 255, 255, 0.8),
        0 4px 20px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    z-index: var(--z-overlay);
    opacity: 0;
    font-family: 'Fredoka One', cursive;
    text-align: center;
    max-width: 90vw;
    line-height: 1;
}

/* Screen Shake (applied to body or canvas container) */
.shake {
    animation: shake 0.3s cubic-bezier(.36, .07, .19, .97) both;
}

@keyframes shake {

    10%,
    90% {
        transform: translate3d(-1px, 0, 0);
    }

    20%,
    80% {
        transform: translate3d(2px, 0, 0);
    }

    30%,
    50%,
    70% {
        transform: translate3d(-4px, 0, 0);
    }

    40%,
    60% {
        transform: translate3d(4px, 0, 0);
    }
}

/* Shine Button Effect */
.btn-shine {
    position: relative;
    overflow: hidden;
}

.btn-shine::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(to bottom right,
            rgba(255, 255, 255, 0) 0%,
            rgba(255, 255, 255, 0.2) 40%,
            rgba(255, 255, 255, 0.4) 50%,
            rgba(255, 255, 255, 0.2) 60%,
            rgba(255, 255, 255, 0) 100%);
    transform: rotate(30deg);
    animation: shine 2s infinite;
}

@keyframes shine {
    0% {
        transform: translateX(-100%) rotate(30deg);
    }

    20% {
        transform: translateX(100%) rotate(30deg);
    }

    100% {
        transform: translateX(100%) rotate(30deg);
    }
}

/* Mobile Leaderboard Toggle FAB */
.leaderboard-fab {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6b4fa2 0%, #4a2c7a 100%);
    border: 2px solid rgba(255, 215, 0, 0.5);
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 1000;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    transition: all 0.3s;
    align-items: center;
    justify-content: center;
}

.leaderboard-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}

.leaderboard-fab .material-icons {
    font-size: 1.8rem;
}

/* Mobile Leaderboard Panel Overlay */
@media (max-width: 768px) {
    .leaderboard-fab {
        display: flex;
    }

    #leaderboard-panel {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        z-index: 999;
        background: rgba(26, 16, 50, 0.98);
        padding: 20px;
        padding-top: max(60px, env(safe-area-inset-top));
        padding-bottom: max(20px, env(safe-area-inset-bottom));
    }

    #leaderboard-panel.open {
        display: flex;
    }

    #leaderboard-panel .panel-card {
        max-height: 100%;
        overflow-y: auto;
    }

    .leaderboard-close-btn {
        display: flex !important;
        position: absolute;
        top: max(15px, calc(env(safe-area-inset-top) + 10px));
        right: 15px;
        font-size: 1.5rem;
        background: rgba(0, 0, 0, 0.5);
        border: none;
        color: #fff;
        cursor: pointer;
        z-index: 10;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        align-items: center;
        justify-content: center;
        transition: all 0.2s;
    }
    
    .leaderboard-close-btn:hover {
        background: rgba(255, 71, 87, 0.8);
        transform: scale(1.1);
    }
}

/* Hide close button on desktop */
.leaderboard-close-btn {
    display: none;
}

/* ========================================
   LANDSCAPE MODE - Sidebar Minimalista
   ======================================== */
@media (orientation: landscape) and (max-height: 600px) {
    #game-container {
        flex-direction: row;
    }

    #header {
        flex-direction: column;
        width: 55px;
        padding: 6px 3px;
        gap: 10px;
        align-items: center;
        background: linear-gradient(90deg, rgba(0, 0, 0, 0.5) 0%, transparent 100%);
        flex-shrink: 0;
    }

    .logo {
        order: 1;
    }

    .level-info {
        order: 2;
        flex-direction: column;
        writing-mode: vertical-rl;
        transform: rotate(180deg);
        font-size: 0.65rem;
        margin: 10px 0;
    }

    #user-info {
        order: 3;
        flex-direction: column;
        gap: 8px;
        margin-top: auto;
    }

    .btn-icon {
        width: 32px;
        height: 32px;
    }

    #main-content {
        flex-direction: row;
        flex: 1;
        padding: 4px;
        gap: 6px;
    }

    .side-panel {
        width: 80px;
        flex-direction: column;
        order: 1;
        gap: 6px;
        flex-shrink: 0;
    }

    .panel-card {
        padding: 8px 6px;
        border-radius: 12px;
        text-align: center;
    }

    .panel-title {
        font-size: 0.5rem;
        margin-bottom: 4px;
        letter-spacing: 1px;
    }

    .score-value {
        font-size: 1.5rem;
    }

    .moves-value {
        font-size: 1.3rem;
    }

    .objective-display {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
    }

    #objective-icon {
        font-size: 1.5rem;
    }

    #objective-progress {
        font-size: 0.85rem;
    }

    #canvas-container {
        order: 2;
        flex: 1;
        padding: 0;
    }

    /* Connection status - move to bottom left in landscape */
    #connection-status {
        left: 75px;
        bottom: 8px;
        top: auto;
    }

    /* Modals - adjust for landscape */
    .level-complete .panel-card {
        max-width: 400px;
    }
}

/* Landscape - Tablets (larger screens with more height) */
@media (orientation: landscape) and (min-height: 600px) and (max-width: 1200px) {
    #game-container {
        flex-direction: row;
    }

    #header {
        flex-direction: column;
        width: 80px;
        padding: 12px 6px;
        gap: 14px;
        align-items: center;
        background: linear-gradient(90deg, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0.1) 80%, transparent 100%);
        flex-shrink: 0;
        border-right: 1px solid rgba(255, 255, 255, 0.1);
    }

    .logo {
        order: 1;
    }

    .logo-icon {
        font-size: 1.8rem;
        filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
    }

    .level-info {
        order: 2;
        flex-direction: column;
        writing-mode: vertical-rl;
        transform: rotate(180deg);
        font-size: 0.8rem;
        margin: 12px 0;
        gap: 8px;
        background: rgba(255, 255, 255, 0.08);
        padding: 12px 6px;
        border-radius: 10px;
    }

    #user-info {
        order: 3;
        flex-direction: column;
        gap: 10px;
        margin-top: auto;
    }

    .btn-icon {
        width: 42px;
        height: 42px;
        font-size: 1.1rem;
        transition: all 0.3s ease;
    }

    .btn-icon:hover {
        background: rgba(255, 255, 255, 0.25);
        transform: scale(1.1);
    }

    #user-avatar {
        width: 42px;
        height: 42px;
    }

    #main-content {
        flex-direction: row;
        flex: 1;
        padding: 12px;
        gap: 14px;
    }

    .side-panel {
        width: 130px;
        flex-direction: column;
        order: 1;
        gap: 12px;
        flex-shrink: 0;
    }

    .panel-card {
        padding: 14px 12px;
        border-radius: 16px;
        text-align: center;
        border: 1px solid rgba(255, 255, 255, 0.15);
        transition: all 0.3s ease;
    }

    .panel-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    }

    .panel-title {
        font-size: 0.65rem;
        margin-bottom: 8px;
        letter-spacing: 1.5px;
    }

    .score-value {
        font-size: 2rem;
    }

    .moves-value {
        font-size: 1.7rem;
    }

    .objective-display {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 6px;
    }

    #objective-icon {
        font-size: 2.2rem;
    }

    #objective-progress {
        font-size: 1.1rem;
    }

    #canvas-container {
        order: 2;
        flex: 1;
        padding: 8px;
        border-radius: 18px;
        background: rgba(0, 0, 0, 0.15);
    }

    #game-canvas {
        border-radius: 14px;
    }

    /* Show leaderboard on tablet landscape */
    #leaderboard-panel {
        display: flex;
        width: 200px;
        order: 3;
    }

    #leaderboard-panel .panel-card {
        padding: 16px;
    }

    .leaderboard-list {
        max-height: 350px;
    }

    /* Connection status */
    #connection-status {
        left: 100px;
        bottom: 12px;
        top: auto;
    }

    /* Modals */
    .level-complete h2 {
        font-size: 3rem;
    }

    .level-complete .panel-card {
        max-width: 420px;
        padding: 28px 32px;
    }
}

/* Landscape - Desktop (larger screens) */
@media (orientation: landscape) and (min-height: 600px) and (min-width: 1201px) {
    #game-container {
        flex-direction: column;
    }

    #header {
        flex-direction: row;
        width: auto;
        padding: 14px 28px;
        background: linear-gradient(180deg, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0.2) 80%, transparent 100%);
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 0 0 24px 24px;
        margin: 0 24px;
    }

    .logo-icon {
        font-size: 2rem;
    }

    .level-info {
        flex-direction: row;
        writing-mode: horizontal-tb;
        transform: none;
        font-size: 1.1rem;
        margin: 0;
        gap: 12px;
        background: rgba(255, 255, 255, 0.1);
        padding: 8px 20px;
        border-radius: 20px;
    }

    #user-info {
        flex-direction: row;
        margin-top: 0;
        gap: 10px;
    }

    .btn-icon {
        width: 44px;
        height: 44px;
    }

    #main-content {
        flex-direction: row;
        padding: 16px 28px;
        gap: 24px;
    }

    .side-panel {
        width: 220px;
        flex-direction: column;
        gap: 16px;
    }

    .panel-card {
        padding: 22px 18px;
        border-radius: 20px;
        text-align: center;
    }

    .panel-title {
        font-size: 0.8rem;
        margin-bottom: 10px;
    }

    .score-value {
        font-size: 2.5rem;
    }

    .moves-value {
        font-size: 2.2rem;
    }

    #objective-icon {
        font-size: 2.5rem;
    }

    #objective-progress {
        font-size: 1.4rem;
    }

    #canvas-container {
        flex: 1;
        border-radius: 24px;
        background: rgba(0, 0, 0, 0.15);
        padding: 12px;
    }

    #game-canvas {
        border-radius: 20px;
    }

    #leaderboard-panel {
        display: flex;
        width: 280px;
    }

    .leaderboard-list {
        max-height: 450px;
    }

    /* Connection status */
    #connection-status {
        left: 12px;
        top: 12px;
        bottom: auto;
    }
}