* {
    font-family: 'Ubuntu', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: #f2fbff;
    /* Cuadrícula icónica idéntica a Agar.io */
    background-image: 
        linear-gradient(to right, rgba(0, 0, 0, 0.06) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(0, 0, 0, 0.06) 1px, transparent 1px);
    background-size: 32px 32px;
}

div {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Burbujas / Células decorativas flotantes en el fondo estilo Agar.io */
.bg-decorations {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.bg-bubble {
    position: absolute;
    border-radius: 50%;
    filter: drop-shadow(0 4px 10px rgba(0,0,0,0.06));
    animation: floatBubble 14s infinite ease-in-out alternate;
}

.b1 { width: 90px; height: 90px; background: rgba(255, 87, 34, 0.75); top: 12%; left: 8%; animation-duration: 12s; }
.b2 { width: 140px; height: 140px; background: rgba(76, 175, 80, 0.65); top: 60%; left: 4%; animation-duration: 16s; }
.b3 { width: 50px; height: 50px; background: rgba(33, 150, 243, 0.8); top: 25%; right: 12%; animation-duration: 10s; }
.b4 { width: 120px; height: 120px; background: rgba(156, 39, 176, 0.6); top: 70%; right: 7%; animation-duration: 18s; }
.b5 { width: 35px; height: 35px; background: rgba(255, 235, 59, 0.9); top: 8%; right: 28%; }
.b6 { width: 45px; height: 45px; background: rgba(0, 188, 212, 0.8); bottom: 15%; left: 32%; }
.b7 { width: 28px; height: 28px; background: rgba(233, 30, 99, 0.85); top: 45%; left: 22%; }
.b8 { width: 32px; height: 32px; background: rgba(139, 195, 74, 0.85); bottom: 25%; right: 26%; }

@keyframes floatBubble {
    0% { transform: translateY(0px) translateX(0px) scale(1); }
    50% { transform: translateY(-25px) translateX(15px) scale(1.05); }
    100% { transform: translateY(15px) translateX(-20px) scale(0.98); }
}

/* Área de Juego y Canvas */
#gameAreaWrapper {
    position: absolute !important;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    z-index: 5;
    transition: opacity 0.4s ease;
}

canvas {
    width: 100%;
    height: 100%;
    display: block;
    background: transparent;
}

/* HUD del Juego */
#status {
    position: absolute;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.5);
    color: #FFF;
    font-size: 14px;
    top: 15px;
    right: 15px;
    font-weight: bold;
    text-align: center;
    border-radius: 6px;
    pointer-events: none;
    z-index: 10;
}

#status .title {
    font-size: 20px;
    display: block;
    margin-bottom: 4px;
}

.chatbox {
    position: absolute;
    width: 300px;
    height: 300px;
    background: rgba(20, 20, 20, 0.75);
    bottom: 10px;
    left: 10px;
    border-radius: 8px;
    pointer-events: none;
    z-index: 10;
}

.chatbox .chat-list {
    padding: 8px;
    margin: 0;
    list-style: none;
    height: 255px;
    overflow: hidden;
    font-size: 13px;
    color: #fff;
}

.chatbox .chat-input {
    pointer-events: all;
    width: 100%;
    padding: 8px 10px;
    background: rgba(0, 0, 0, 0.4);
    border: none;
    border-top: 1px solid rgba(255,255,255,0.2);
    color: #fff;
    outline: none;
    font-size: 13px;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

#mobile {
    position: absolute;
    bottom: 15px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    padding: 0 15px;
    pointer-events: none;
    z-index: 10;
}

#split, #feed {
    width: 75px;
    height: 75px;
    pointer-events: all;
    opacity: 0.85;
}

/* Contenedor del Menú Principal */
#startMenuWrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 15px 30px 15px;
    transition: opacity 0.5s ease, max-height 0.8s ease;
}

/* Barra Superior */
.top-nav-bar {
    width: 100%;
    max-width: 1140px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.brand-badge {
    font-weight: 900;
    font-size: 16px;
    letter-spacing: 1px;
    color: #27ae60;
    background: #e8f8f0;
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid #b7ebcf;
}

.lang-selector {
    display: flex;
    gap: 6px;
}

.lang-btn {
    background: #ffffff;
    border: 1px solid #ced4da;
    border-radius: 18px;
    padding: 4px 10px;
    font-size: 11px;
    cursor: pointer;
    color: #495057;
    transition: all 0.2s;
    font-weight: 500;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.lang-btn:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
}

.lang-btn.active {
    background: #2ecc71;
    color: #fff;
    border-color: #27ae60;
    font-weight: bold;
    box-shadow: 0 2px 6px rgba(46, 204, 113, 0.3);
}

/* Estructura 3 Columnas */
.layout-three-columns {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 20px;
    width: 100%;
    max-width: 1140px;
}

/* Espacios de Publicidad Simulados (Skyscrapers) */
.ad-slot {
    position: relative;
    border: 2px dashed #b0bec5;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.04);
}

.ad-skyscraper {
    width: 280px;
    min-width: 280px;
    height: 580px;
}

.ad-badge {
    position: absolute;
    top: 6px;
    right: 8px;
    font-size: 9px;
    font-weight: bold;
    color: #78909c;
    background: rgba(207, 216, 220, 0.5);
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

.ad-placeholder-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 20px;
}

.ad-icon {
    font-size: 26px;
    opacity: 0.7;
}

.ad-text-main {
    font-size: 13px;
    font-weight: 600;
    color: #546e7a;
}

.ad-text-dim {
    font-size: 11px;
    color: #90a4ae;
}

/* Banner Inferior */
.ad-banner-bottom {
    width: 100%;
    max-width: 1140px;
    height: 90px;
    margin-top: 18px;
}

.ad-placeholder-horizontal {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
}

/* Panel Central del Juego */
#startMenu {
    position: relative;
    width: 380px;
    max-width: 100%;
    background: #ffffff;
    border-radius: 12px;
    padding: 22px;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(0, 0, 0, 0.06);
    text-align: center;
}

.game-title {
    margin: 0;
    padding: 0;
    font-size: 32px;
    font-weight: 900;
    letter-spacing: -0.5px;
    color: #1a1a1a;
}

.game-tagline {
    margin: 3px 0 14px 0;
    font-size: 12px;
    color: #718096;
}

.input-group {
    position: relative;
    margin-bottom: 12px;
}

#playerNameInput {
    width: 100%;
    text-align: center;
    padding: 12px 14px;
    font-size: 15px;
    font-weight: 500;
    border: 1.5px solid #cbd5e0;
    border-radius: 8px;
    outline: none;
    transition: all 0.25s ease;
    background: #f8fafc;
}

#playerNameInput:focus {
    border-color: #2ecc71;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(46, 204, 113, 0.2);
}

.input-error {
    display: block;
    color: #e53e3e;
    font-size: 11px;
    margin-top: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

/* Botones de Acción */
.action-buttons {
    margin-bottom: 14px;
}

#startButton {
    width: 100%;
    height: 46px;
    font-size: 18px;
    font-weight: 800;
    color: #fff;
    background: #2ecc71;
    border: none;
    border-bottom: 4px solid #27ae60;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.1s, background-color 0.2s;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

#startButton:hover {
    background: #27ae60;
}

#startButton:active {
    transform: translateY(2px);
    border-bottom-width: 2px;
}

.button-row {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

#spectateButton, #settingsButton {
    flex: 1;
    height: 36px;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: opacity 0.2s;
}

#spectateButton {
    background: #3498db;
    border-bottom: 3px solid #2980b9;
}

#spectateButton:hover {
    background: #2980b9;
}

#settingsButton {
    background: #718096;
    border-bottom: 3px solid #4a5568;
}

#settingsButton:hover {
    background: #4a5568;
}

/* Módulo de Compartir con Amigos */
.share-box {
    margin: 14px 0 12px 0;
    padding: 10px 12px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #edf2f7;
}

.share-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: #4a5568;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.share-btn-group {
    display: flex;
    gap: 6px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-share {
    padding: 5px 10px;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    text-decoration: none;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s, opacity 0.15s;
}

.btn-share:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-share.wa { background: #25D366; }
.btn-share.x-twitter { background: #111111; }
.btn-share.fb { background: #1877F2; }
.btn-share.copy { background: #4a5568; }

/* Menú de Ajustes */
#settings {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
    text-align: left;
    margin-top: 8px;
}

#settings h3 {
    margin: 6px 0 4px 0;
    font-size: 13px;
    font-weight: 700;
    color: #2d3748;
}

#settings ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

#settings label {
    display: block;
    font-size: 11px;
    color: #4a5568;
    margin-bottom: 4px;
    cursor: pointer;
}

/* Instrucciones de Juego */
#instructions {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #edf2f7;
    text-align: left;
}

#instructions h3 {
    margin: 0 0 6px 0;
    font-size: 12px;
    font-weight: 700;
    color: #2d3748;
}

#instructions ul {
    margin: 0;
    padding-left: 16px;
    font-size: 11px;
    color: #4a5568;
    line-height: 1.45;
}

#instructions li {
    margin-bottom: 3px;
}

/* Bloque SEO */
.seo-section {
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px solid #edf2f7;
    text-align: left;
}

.seo-section h2 {
    font-size: 11px;
    font-weight: 700;
    color: #4a5568;
    margin: 0 0 4px 0;
}

.seo-section p {
    font-size: 10.5px;
    font-weight: 400;
    line-height: 1.45;
    color: #718096;
    margin: 0;
}

/* Responsive / Ocultar Publicidad lateral en móviles y tablets */
@media (max-width: 1080px) {
    .ad-skyscraper {
        display: none !important;
    }
    .layout-three-columns {
        justify-content: center;
    }
}

@media (max-width: 800px) {
    .ad-banner-bottom {
        display: none !important;
    }
    #startMenuWrapper {
        padding: 10px 8px 20px 8px;
    }
    #startMenu {
        width: 100%;
        padding: 18px 14px;
    }
}

@media only screen and (min-width: 1224px) {
    #mobile { display: none; }
}

@media only screen and (max-width: 1224px) {
    #chatbox { display: none; }
}
