/* ==========================================================================
   PALMAGOTCHI: SCOPED GAME STYLES & RETRO SHELL
   ========================================================================== */

:root {
    /* Paleta Pokémon Blue Handheld & USA Flag Theme */
    --gb-blue-main: #1544c0;
    --gb-blue-dark: #0d2b80;
    --gb-blue-light: #2a5de8;
    --gb-blue-shadow: #081b54;
    --gb-bezel: #242938;
    --gb-bezel-border: #161a24;
    
    /* Pantalla LCD Game Boy Retro */
    --lcd-bg: #8ba812;
    --lcd-dark: #0f380f;
    --lcd-mid: #306230;
    --lcd-light: #9bbc0f;
    --lcd-border: #6d840c;
    
    /* Botones y detalles */
    --btn-a: #a81c48;
    --btn-b: #8a1438;
    --btn-dpad: #1e2430;
    --btn-pill: #475569;
    
    /* UI General */
    --card-bg: #091c48;
    --border-color: #1e3a8a;
    --gold: #ffd166;
}

/* ==========================================================================
   FONDO ESTRELLAS BANDERA DE EE.UU. (OLD GLORY BLUE & 51 STARS SATIRE)
   ========================================================================== */
.usa-flag-stars-bg {
    background-color: #041b4e;
    background-image: 
        radial-gradient(circle at 50% 15%, rgba(29, 78, 216, 0.4) 0%, rgba(3, 20, 60, 0.96) 100%),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64' viewBox='0 0 64 64'%3E%3Cg fill='%23ffffff' fill-opacity='0.28'%3E%3Cpath d='M16 4l1.6 4.3 4.5.3-3.4 3 1 4.4-3.7-2.4-3.7 2.4 1-4.4-3.4-3 4.5-.3z'/%3E%3Cpath d='M48 4l1.6 4.3 4.5.3-3.4 3 1 4.4-3.7-2.4-3.7 2.4 1-4.4-3.4-3 4.5-.3z'/%3E%3Cpath d='M32 36l1.6 4.3 4.5.3-3.4 3 1 4.4-3.7-2.4-3.7 2.4 1-4.4-3.4-3 4.5-.3z'/%3E%3Cpath d='M0 36l1.6 4.3 4.5.3-3.4 3 1 4.4-3.7-2.4-3.7 2.4 1-4.4-3.4-3 4.5-.3z'/%3E%3Cpath d='M64 36l1.6 4.3 4.5.3-3.4 3 1 4.4-3.7-2.4-3.7 2.4 1-4.4-3.4-3 4.5-.3z'/%3E%3C/g%3E%3C/svg%3E");
    background-size: 100% 100%, 64px 64px;
    background-repeat: no-repeat, repeat;
    background-attachment: fixed;
    color: #ffffff;
}

.palmagotchi-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    max-width: 980px;
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
}

.palmagotchi-wrapper * {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

/* ==========================================================================
   ENCABEZADO
   ========================================================================== */
.app-header {
    text-align: center;
    padding: 4px 10px;
}

.app-title {
    font-size: clamp(1.8rem, 5vw, 2.5rem);
    font-weight: 900;
    color: #ffffff;
    text-shadow: 0 4px 16px rgba(42, 93, 232, 0.7), 0 2px 4px rgba(0,0,0,0.8);
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.app-subtitle {
    font-size: clamp(0.85rem, 2.8vw, 1rem);
    color: #94a3b8;
    margin-top: 4px;
    font-weight: 500;
}

/* ==========================================================================
   LAYOUT PRINCIPAL
   ========================================================================== */
.game-layout {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    justify-content: center;
    gap: 32px;
    width: 100%;
}

@media (max-width: 880px) {
    .game-layout {
        flex-direction: column;
        align-items: center;
        gap: 24px;
    }
}

/* ==========================================================================
   CARCASA GAME BOY / POKÉMON BLUE EDITION (REALISTA Y PROPORCIONADA)
   ========================================================================== */
.tamagotchi-shell.pokemon-blue-shell {
    width: 100%;
    max-width: 370px;
    min-height: 610px;
    background: linear-gradient(145deg, #255ae8 0%, #1544c0 40%, #0f3499 80%, #092066 100%);
    border-radius: 24px 24px 70px 24px; /* Esquina inferior derecha curva clásica Game Boy */
    padding: 16px 22px 28px;
    box-shadow: 
        inset 0 4px 10px rgba(255, 255, 255, 0.4),
        inset 0 -12px 20px rgba(0, 0, 0, 0.6),
        inset 5px 0 10px rgba(255, 255, 255, 0.15),
        inset -5px 0 10px rgba(0, 0, 0, 0.4),
        0 24px 50px rgba(0, 0, 0, 0.75),
        0 0 0 5px var(--gb-blue-shadow);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    user-select: none;
}

/* Ranura de cartucho Game Boy en la parte superior */
.cartridge-ridge {
    width: calc(100% - 24px);
    background: #0d2b80;
    border-radius: 8px 8px 0 0;
    padding: 3px 0;
    text-align: center;
    font-family: 'Press Start 2P', monospace;
    font-size: 7.5px;
    color: rgba(255, 255, 255, 0.6);
    border-bottom: 2px solid #081b54;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.6);
    margin-bottom: 12px;
    letter-spacing: 0.5px;
}

/* Fila Superior con Marca y LED de Batería */
.shell-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0 4px 10px;
}

.power-led-group {
    display: flex;
    align-items: center;
    gap: 5px;
}

.power-led {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #ff2a2a;
    box-shadow: 0 0 8px #ff2a2a, inset 0 1px 2px rgba(255,255,255,0.8);
    animation: led-glow 2s infinite alternate;
}

@keyframes led-glow {
    from { opacity: 0.8; box-shadow: 0 0 6px #ff2a2a; }
    to { opacity: 1; box-shadow: 0 0 12px #ff4444; }
}

.power-label {
    font-family: 'Press Start 2P', monospace;
    font-size: 6.5px;
    color: #94a3b8;
    letter-spacing: -0.5px;
}

.shell-branding-pokemon {
    display: flex;
    align-items: baseline;
    gap: 4px;
    font-family: 'Press Start 2P', monospace;
}

.brand-game {
    font-size: 9px;
    color: #ffd166;
    text-shadow: 1px 1px 0 #000;
}

.brand-color {
    font-size: 8px;
    background: linear-gradient(90deg, #ff4d6d, #ffd166, #06d6a0, #118ab2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 900;
}

.brand-edition {
    font-size: 6px;
    color: #7dd3fc;
}

/* ==========================================================================
   BISEL Y PANTALLA LCD GAME BOY (PROPORCIONES GRANDES Y VISIBLES)
   ========================================================================== */
.gb-screen-bezel {
    width: 100%;
    background: linear-gradient(180deg, #303748 0%, #1e2433 100%);
    border-radius: 14px 14px 44px 14px; /* Bisel inferior curvo Game Boy Color */
    padding: 14px 16px 16px;
    box-shadow: 
        inset 0 3px 6px rgba(0, 0, 0, 0.7),
        inset 0 -2px 4px rgba(255, 255, 255, 0.15),
        0 4px 8px rgba(0, 0, 0, 0.4);
    border: 3px solid #141824;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
}

/* Líneas características de Game Boy Color */
.bezel-lines {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 100%;
}

.line-magenta {
    height: 2.5px;
    background: #d90429;
    border-radius: 1px;
}

.line-cyan {
    height: 2.5px;
    background: #00b4d8;
    border-radius: 1px;
}

/* Pantalla LCD Game Boy Auténtica */
.lcd-screen {
    width: 100%;
    background-color: var(--lcd-bg);
    border-radius: 8px;
    border: 3px solid var(--lcd-border);
    box-shadow: inset 0 4px 10px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    user-select: none;
}

/* 1. HUD Superior Integrado dentro del LCD */
.lcd-hud-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: 'Press Start 2P', monospace;
    font-size: 7.5px;
    padding: 5px 8px;
    background: #0f380f;
    color: #9bbc0f;
    border-bottom: 2px solid var(--lcd-border);
}

.hud-left {
    display: flex;
    align-items: center;
    gap: 6px;
}

.hud-evo-lvl {
    color: #ffd166;
    font-weight: bold;
    font-size: 8px;
}

.hud-status-badge {
    background: #306230;
    color: #eef5c6;
    padding: 1.5px 5px;
    border-radius: 3px;
    font-size: 6.5px;
}

.hud-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.hud-stat {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.hud-stat b {
    color: #ffffff;
}

/* 2. Área del Viewport (Canvas Grande del Personaje) */
.lcd-viewport {
    position: relative;
    width: 100%;
    height: 165px;
    background: var(--lcd-bg);
    overflow: hidden;
}

@media (min-width: 640px) {
    .lcd-viewport {
        height: 180px;
    }
}

#lcd-canvas {
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    display: block;
}

/* 3. Menús y Alertas Directamente dentro del LCD */
.lcd-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 56, 15, 0.92);
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 5px;
    box-sizing: border-box;
}

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

.lcd-menu-box {
    background: #8ba812;
    border: 3px double #0f380f;
    border-radius: 4px;
    padding: 6px 8px;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    color: #0f380f;
    font-family: 'Press Start 2P', monospace;
    box-sizing: border-box;
}

.lcd-menu-header {
    font-size: 7.5px;
    font-weight: bold;
    border-bottom: 2px solid #0f380f;
    padding-bottom: 3px;
    margin-bottom: 4px;
    text-align: center;
    letter-spacing: 0.5px;
}

.lcd-menu-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-right: 2px;
}

.lcd-menu-item {
    font-size: 6.5px;
    line-height: 1.35;
    padding: 3px 4px;
    border-radius: 3px;
    cursor: pointer;
    display: flex;
    align-items: flex-start;
    gap: 3px;
    border: 1px solid transparent;
}

.lcd-menu-item:hover,
.lcd-menu-item.active {
    background: #0f380f;
    color: #9bbc0f;
    border-color: #0f380f;
}

.lcd-menu-footer {
    display: flex;
    justify-content: space-between;
    font-size: 6px;
    border-top: 1px solid #0f380f;
    padding-top: 3px;
    margin-top: 2px;
    color: #306230;
}

/* Alertas In-Screen (Escándalo, LUMA, Evolución) */
.lcd-alert-box {
    background: #8ba812;
    border: 3px solid #0f380f;
    border-radius: 6px;
    padding: 8px 6px;
    text-align: center;
    color: #0f380f;
    font-family: 'Press Start 2P', monospace;
    width: 100%;
    box-sizing: border-box;
}

.lcd-alert-box.scandal {
    background: #eef5c6;
    border-color: #0f380f;
}

.lcd-alert-box .alert-title {
    font-size: 7.5px;
    font-weight: bold;
    margin-bottom: 5px;
    color: #0f380f;
}

.lcd-alert-box .alert-msg {
    font-size: 6.5px;
    line-height: 1.4;
    margin-bottom: 8px;
    color: #306230;
}

.lcd-alert-box .alert-prompt {
    font-size: 6px;
    background: #0f380f;
    color: #ffd166;
    padding: 3px 6px;
    border-radius: 3px;
    display: inline-block;
}

/* Medidor de Planta en LCD */
.gen-meter-row {
    font-size: 6.5px;
    margin-bottom: 6px;
}

.lcd-gauge {
    width: 100%;
    height: 8px;
    background: #306230;
    border: 1px solid #0f380f;
    border-radius: 3px;
    overflow: hidden;
    margin: 4px 0;
}

.lcd-gauge div {
    height: 100%;
    background: #ffd166;
    transition: width 0.15s ease;
}

/* 4. Cuadro de Diálogo estilo Pokémon Blue RPG */
.pokemon-dialog-box {
    background: #eef5c6;
    border-top: 3px double #0f380f;
    padding: 8px 10px;
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    line-height: 1.45;
    color: #0f380f;
    min-height: 52px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    position: relative;
}

.dialog-text-wrapper {
    flex: 1;
}

.dialog-arrow {
    font-size: 8px;
    color: #0f380f;
    animation: blink-arrow 0.7s infinite alternate;
    margin-left: 4px;
}

@keyframes blink-arrow {
    from { opacity: 0; transform: translateY(-2px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   SECCIÓN DE CONTROLES: D-PAD + BOTONES A, B, C ESTILO POKÉMON
   ========================================================================== */
.gb-controls-area {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 324px;
    margin-top: 18px;
    padding: 0 4px;
}

/* D-PAD Game Boy Clásico */
.dpad-container {
    display: flex;
    align-items: center;
    justify-content: center;
}

.dpad {
    width: 88px;
    height: 88px;
    position: relative;
}

.dpad-btn {
    position: absolute;
    background: #1e2430;
    border: none;
    outline: none;
    color: #475569;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: inset 0 1px 2px rgba(255,255,255,0.2), 0 3px 5px rgba(0,0,0,0.6);
    transition: transform 0.05s, background 0.05s;
    touch-action: manipulation;
}

.dpad-btn:active {
    background: #11151c;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.8);
}

.dpad-up {
    top: 0;
    left: 29px;
    width: 30px;
    height: 32px;
    border-radius: 5px 5px 0 0;
}

.dpad-down {
    bottom: 0;
    left: 29px;
    width: 30px;
    height: 32px;
    border-radius: 0 0 5px 5px;
}

.dpad-left {
    top: 29px;
    left: 0;
    width: 32px;
    height: 30px;
    border-radius: 5px 0 0 5px;
}

.dpad-right {
    top: 29px;
    right: 0;
    width: 32px;
    height: 30px;
    border-radius: 0 5px 5px 0;
}

.dpad-center {
    position: absolute;
    top: 29px;
    left: 29px;
    width: 30px;
    height: 30px;
    background: #1e2430;
}
.dpad-center::after {
    content: '';
    position: absolute;
    top: 6px;
    left: 6px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: radial-gradient(circle, #29303d 0%, #151a24 100%);
}

/* Botones de Acción A, B y C */
.action-buttons-group {
    display: flex;
    align-items: center;
    gap: 10px;
    transform: rotate(-12deg);
    margin-top: -6px;
}

.btn-action-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.gb-round-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    outline: none;
    cursor: pointer;
    font-family: 'Press Start 2P', monospace;
    font-size: 13px;
    font-weight: 900;
    color: #ffffff;
    box-shadow: 
        0 5px 0 #550a22,
        0 8px 12px rgba(0, 0, 0, 0.5),
        inset 0 2px 3px rgba(255, 255, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.08s ease, box-shadow 0.08s ease;
    touch-action: manipulation;
}

.gb-round-btn:active {
    transform: translateY(4px);
    box-shadow: 
        0 1px 0 #550a22,
        0 3px 5px rgba(0, 0, 0, 0.5);
}

.btn-a {
    background: radial-gradient(circle at 35% 35%, #e63946, #a81c48 80%, #750f2e);
    box-shadow: 0 5px 0 #4a081c, 0 8px 12px rgba(0,0,0,0.5);
}

.btn-b {
    background: radial-gradient(circle at 35% 35%, #d90429, #8a1438 80%, #590920);
    box-shadow: 0 5px 0 #3b0514, 0 8px 12px rgba(0,0,0,0.5);
}

.btn-c {
    background: radial-gradient(circle at 35% 35%, #00b4d8, #0077b6 80%, #023e8a);
    box-shadow: 0 5px 0 #012a5e, 0 8px 12px rgba(0,0,0,0.5);
}
.btn-c:active {
    box-shadow: 0 1px 0 #012a5e, 0 3px 5px rgba(0,0,0,0.5);
}

.gb-btn-label {
    font-family: 'Press Start 2P', monospace;
    font-size: 6px;
    color: #e2e8f0;
    text-shadow: 1px 1px 0 #000;
    margin-top: 2px;
}

/* Botones Inferiores Select / Start y Ranuras de Altavoz */
.gb-bottom-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 324px;
    margin-top: 20px;
    padding: 0 6px;
}

.pill-buttons {
    display: flex;
    gap: 14px;
}

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

.gb-pill-btn {
    width: 44px;
    height: 12px;
    border-radius: 6px;
    background: #334155;
    border: none;
    transform: rotate(-25deg);
    cursor: pointer;
    box-shadow: inset 0 1px 2px rgba(255,255,255,0.2), 0 3px 4px rgba(0,0,0,0.5);
    transition: transform 0.08s, background 0.08s;
}

.gb-pill-btn:active {
    background: #1e293b;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.8);
}

.pill-btn-wrap span {
    font-family: 'Press Start 2P', monospace;
    font-size: 5.5px;
    color: #94a3b8;
    margin-top: 4px;
}

.gb-speaker-slits {
    display: flex;
    gap: 4px;
    transform: rotate(-25deg);
}

.gb-speaker-slits .slit {
    width: 4px;
    height: 28px;
    background: #081b54;
    border-radius: 2px;
    box-shadow: inset 0 2px 3px rgba(0,0,0,0.9), 0 1px 1px rgba(255,255,255,0.2);
}

/* ==========================================================================
   PANEL LATERAL DE CONTROL Y ESTADÍSTICAS
   ========================================================================== */
.control-sidebar {
    flex: 1;
    min-width: 320px;
    max-width: 480px;
    width: 100%;
    background: var(--card-bg);
    border-radius: 24px;
    padding: 24px;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.45);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.evolution-card {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    border-radius: 16px;
    padding: 16px 20px;
    border: 1px solid var(--border-color);
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.05);
}

.char-evo-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: #60a5fa;
    letter-spacing: -0.3px;
}

.char-evo-subtitle {
    font-size: 0.85rem;
    color: #94a3b8;
    margin-top: 3px;
    line-height: 1.4;
}

.status-badge {
    display: inline-block;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.72rem;
    font-weight: 800;
    font-family: 'Press Start 2P', monospace;
    text-align: center;
    margin-top: 10px;
    line-height: 1.3;
}

.status-badge.normal {
    background: #0284c7;
    color: #ffffff;
}

.status-badge.shock {
    background: #dc2626;
    color: #ffffff;
    animation: blink-red 0.5s infinite alternate;
}

.status-badge.frenesi {
    background: #d97706;
    color: #ffffff;
}

.status-badge.apathy {
    background: #334155;
    color: #94a3b8;
    border: 1px dashed #64748b;
}

@keyframes blink-red {
    from { opacity: 1; filter: brightness(1.3); }
    to { opacity: 0.5; }
}

.stats-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #0f172a;
    border-radius: 16px;
    padding: 16px;
    border: 1px solid var(--border-color);
}

.stat-row {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.stat-label-container {
    display: flex;
    justify-content: space-between;
    font-size: 0.88rem;
    font-weight: 600;
    color: #e2e8f0;
}

.stat-bar-outer {
    width: 100%;
    height: 14px;
    background: #1e293b;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #475569;
}

.stat-bar-inner {
    height: 100%;
    border-radius: 10px;
    transition: width 0.3s ease;
}

.bar-blue { background: linear-gradient(90deg, #2563eb, #60a5fa); }
.bar-gold { background: linear-gradient(90deg, #d97706, #fbbf24); }
.bar-green { background: linear-gradient(90deg, #059669, #34d399); }

.votes-pill {
    background: #1e293b;
    border-radius: 12px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.9rem;
    border: 1px solid #334155;
    margin-top: 4px;
}

.votes-pill strong {
    color: #38bdf8;
    font-size: 1.3rem;
    font-weight: 900;
}

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

.retro-action-btn {
    background: #334155;
    border: none;
    border-radius: 12px;
    color: #fff;
    padding: 13px 10px;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 0.88rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 0 #1e293b;
    transition: all 0.1s ease;
    min-height: 48px;
    touch-action: manipulation;
}

.retro-action-btn:hover {
    background: #475569;
}

.retro-action-btn:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 #1e293b;
}

.retro-action-btn.btn-feed {
    background: #0284c7;
    box-shadow: 0 4px 0 #0369a1;
}
.retro-action-btn.btn-feed:hover { background: #0369a1; }

.retro-action-btn.btn-denial {
    background: #e11d48;
    box-shadow: 0 4px 0 #be123c;
}
.retro-action-btn.btn-denial:hover { background: #be123c; }

.retro-action-btn.btn-caravan {
    background: #d97706;
    box-shadow: 0 4px 0 #b45309;
}

.retro-action-btn.btn-vote {
    background: #059669;
    box-shadow: 0 4px 0 #047857;
}

.sound-control-row {
    display: flex;
    justify-content: flex-end;
    margin-top: 2px;
}

#btn-sound-toggle {
    padding: 8px 16px;
    font-size: 0.8rem;
}

.scandal-alert-box {
    background: #881337;
    border: 2px solid #f43f5e;
    border-radius: 14px;
    padding: 14px;
    animation: pulse-red 1.2s infinite;
}

.scandal-alert-box h5 {
    color: #ffe4e6;
    font-size: 0.95rem;
    font-weight: 800;
}

.scandal-alert-box p {
    color: #fecdd3;
    font-size: 0.82rem;
    margin-top: 4px;
    line-height: 1.4;
}

/* Alerta de Apagón de LUMA */
.blackout-alert-box {
    background: #451a03;
    border: 2px solid #f59e0b;
    border-radius: 14px;
    padding: 14px;
    animation: pulse-amber 1.1s infinite;
}

.blackout-alert-box h5 {
    color: #fef3c7;
    font-size: 0.95rem;
    font-weight: 800;
}

.blackout-alert-box p {
    color: #fde68a;
    font-size: 0.82rem;
    margin: 4px 0 10px;
    line-height: 1.4;
}

.btn-generator {
    width: 100%;
    background: #d97706;
    box-shadow: 0 4px 0 #b45309;
    color: #fff;
    font-size: 0.85rem;
    padding: 10px;
}

@keyframes pulse-amber {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

/* Modal de la Planta Eléctrica */
.gen-visual-box {
    background: #0f172a;
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 16px;
    border: 1px solid #334155;
}

.gen-gauge-outer {
    width: 100%;
    height: 16px;
    background: #1e293b;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #475569;
}

.gen-gauge-inner {
    height: 100%;
    background: linear-gradient(90deg, #f59e0b, #10b981);
    border-radius: 10px;
    transition: width 0.2s ease;
}

.btn-pull-cord {
    background: #dc2626;
    box-shadow: 0 5px 0 #991b1b;
    color: #fff;
    font-size: 1.05rem;
    width: 100%;
    padding: 16px;
    border-radius: 14px;
    letter-spacing: 0.5px;
}
.btn-pull-cord:active {
    transform: translateY(4px);
    box-shadow: 0 1px 0 #991b1b;
}

@keyframes pulse-red {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

/* ==========================================================================
   FOOTER: WWW.CABUYACREATIVA.COM
   ========================================================================== */
.app-footer {
    width: 100%;
    max-width: 900px;
    text-align: center;
    padding: 18px 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.footer-main-text {
    font-size: 0.95rem;
    color: #cbd5e1;
    font-weight: 600;
}

.footer-brand-link {
    color: #38bdf8;
    text-decoration: none;
    font-weight: 800;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    padding: 2px 4px;
}

.footer-brand-link:hover {
    color: #7dd3fc;
    border-bottom-color: #38bdf8;
    text-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
}

.footer-satire-disclaimer {
    font-size: 0.8rem;
    color: #64748b;
}

/* ==========================================================================
   MODALES (RESPONSIVOS Y OPTIMIZADOS PARA MÓVIL)
   ========================================================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(3, 10, 26, 0.88);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    padding: 16px;
    box-sizing: border-box;
}

.hidden,
.modal-overlay.hidden,
.scandal-alert-box.hidden,
.blackout-alert-box.hidden {
    display: none !important;
}

.modal-content {
    background: #0f172a;
    border: 2px solid #3b82f6;
    border-radius: 22px;
    padding: 18px 16px;
    max-width: 520px;
    width: 100%;
    max-height: 88vh;
    max-height: 88dvh;
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.9);
}

@media (min-width: 640px) {
    .modal-content {
        padding: 24px 26px;
    }
}

.modal-content-large {
    max-width: 600px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid #1e293b;
    padding-bottom: 12px;
    margin-bottom: 14px;
    gap: 10px;
}

.modal-header h3 {
    font-size: 1.15rem;
    font-weight: 800;
    color: #38bdf8;
    line-height: 1.3;
    margin: 0;
}

.close-modal-btn {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 50%;
    color: #94a3b8;
    width: 36px;
    height: 36px;
    min-width: 36px;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    line-height: 1;
    transition: all 0.15s;
    flex-shrink: 0;
}
.close-modal-btn:hover {
    color: #fff;
    background: #dc2626;
    border-color: #ef4444;
}

.headlines-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    box-sizing: border-box;
}

/* Tarjeta Enriquecida de Titulares (Títulos Llamativos vs Impacto Real) */
.headline-card-enhanced {
    background: #0b1329;
    border: 1.5px solid #1e3a8a;
    border-radius: 18px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    transition: transform 0.15s ease, border-color 0.15s ease;
    box-sizing: border-box;
    width: 100%;
    overflow: hidden;
}

.headline-card-enhanced:hover {
    border-color: #60a5fa;
    transform: translateY(-2px);
}

.headline-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.headline-type-badge {
    background: #1e3a8a;
    color: #93c5fd;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 6px;
    letter-spacing: 0.5px;
}

.gain-badge {
    background: #0284c7;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 6px;
    white-space: nowrap;
}

.headline-main-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: #ffffff;
    line-height: 1.35;
    margin: 0;
    word-break: break-word;
}

/* Caja de Impacto Real (La Letra Chiquita) */
.headline-impact-box {
    background: #1c1917;
    border-left: 4px solid #f59e0b;
    border-radius: 8px;
    padding: 12px 14px;
    box-sizing: border-box;
    width: 100%;
}

.impact-header {
    font-size: 0.72rem;
    font-weight: 900;
    color: #fbbf24;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
}

.impact-text {
    font-size: 0.85rem;
    color: #e2e8f0;
    line-height: 1.45;
    margin: 0;
    word-break: break-word;
}

/* Caja de Frase Ciega del Fanático */
.headline-quote-box {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: rgba(30, 58, 138, 0.35);
    border-radius: 8px;
    padding: 10px 14px;
    font-style: italic;
    color: #bfdbfe;
    font-size: 0.82rem;
    line-height: 1.4;
    box-sizing: border-box;
    width: 100%;
}

.quote-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
    line-height: 1;
}

.feed-confirm-btn {
    width: 100%;
    background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
    border: none;
    border-radius: 12px;
    color: #fff;
    padding: 12px 14px;
    font-weight: 800;
    font-size: 0.88rem;
    cursor: pointer;
    box-shadow: 0 4px 0 #1e40af;
    transition: transform 0.05s ease, box-shadow 0.05s ease;
    touch-action: manipulation;
    white-space: normal;
    line-height: 1.35;
    word-break: break-word;
    box-sizing: border-box;
}

.feed-confirm-btn:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 #1e40af;
}

/* Tarjeta Enriquecida de Negación (Botón B) */
.denial-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    box-sizing: border-box;
}

.denial-card-enhanced {
    background: #1a0b1e;
    border: 1.5px solid #be123c;
    border-radius: 16px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    transition: transform 0.15s ease, border-color 0.15s ease;
    box-sizing: border-box;
    width: 100%;
    overflow: hidden;
}

.denial-card-enhanced:hover {
    border-color: #fb7185;
    transform: translateY(-2px);
}

.denial-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.denial-badge {
    background: #881337;
    color: #fecdd3;
    font-size: 0.72rem;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 6px;
}

.denial-restore {
    background: #059669;
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 6px;
}

.denial-quote {
    font-size: 1.02rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.35;
    margin: 0;
    word-break: break-word;
}

.denial-confirm-btn {
    width: 100%;
    background: linear-gradient(180deg, #e11d48 0%, #be123c 100%);
    border: none;
    border-radius: 12px;
    color: #fff;
    padding: 11px 14px;
    font-weight: 800;
    font-size: 0.88rem;
    cursor: pointer;
    box-shadow: 0 4px 0 #881337;
    transition: transform 0.05s ease;
    touch-action: manipulation;
    white-space: normal;
    line-height: 1.35;
    word-break: break-word;
    box-sizing: border-box;
}

.denial-confirm-btn:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 #881337;
}

/* Minijuegos */
#minigame-modal .modal-content {
    max-height: 96vh;
    max-height: 96dvh;
    padding: 12px 14px;
    max-width: 400px;
    overflow-y: auto;
    overflow-x: hidden;
}

#minigame-modal .modal-header {
    margin-bottom: 4px;
}

#minigame-modal #minigame-instruction {
    font-size: 0.76rem;
    margin-bottom: 6px;
    line-height: 1.3;
}

#minigame-modal #minigame-score {
    font-size: 0.8rem;
    margin-bottom: 6px;
}

.caravan-arena {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
}

#caravan-canvas {
    border: 2px solid #38bdf8;
    border-radius: 12px;
    background: #111;
    width: 100%;
    max-width: 340px;
    max-height: min(48vh, 320px);
    aspect-ratio: 340 / 340;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.6);
    touch-action: none;
}

.caravan-controls {
    display: flex;
    gap: 8px;
    width: 100%;
    max-width: 340px;
    justify-content: space-between;
}

.caravan-controls .game-btn {
    flex: 1;
    padding: 10px 4px;
    font-size: 0.82rem;
    border-radius: 10px;
}

/* Leyenda del Minijuego de la Caravana */
.caravan-legend {
    width: 100%;
    max-width: 340px;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 10px;
    padding: 6px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.legend-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 6px;
    font-size: 0.68rem;
}

.legend-badge-title {
    font-weight: 800;
    font-size: 0.68rem;
}

.legend-row.collect .legend-badge-title {
    color: #10b981;
}

.legend-row.avoid .legend-badge-title {
    color: #ef4444;
}

.legend-tag {
    background: #1e293b;
    padding: 2px 5px;
    border-radius: 4px;
    color: #e2e8f0;
    border: 1px solid #334155;
    white-space: nowrap;
}

.game-btn {
    padding: 12px 18px;
    border-radius: 12px;
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    cursor: pointer;
    border: none;
    touch-action: manipulation;
}

.retro-btn {
    background: #3b82f6;
    color: #fff;
    box-shadow: 0 4px 0 #1d4ed8;
}

.btn-horn {
    background: #fbbf24 !important;
    color: #03153d !important;
    font-weight: 900 !important;
    box-shadow: 0 4px 0 #d97706 !important;
}

/* Forzar contraste máximo en botones amarillos */
.btn-yellow-contrast,
.btn-yellow-contrast *,
#btn-nav-share,
#btn-nav-share *,
.btn-share-main,
.btn-share-main * {
    color: #03153d !important;
    font-weight: 900 !important;
}

.btn-stamp {
    background: #dc2626;
    color: #fff;
    font-size: 1.1rem;
    width: 100%;
    padding: 16px;
    box-shadow: 0 6px 0 #991b1b;
}

/* Papeleta de Voto */
.ballot-game-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
    width: 100%;
}

.ballot-paper {
    background: #fafafa;
    color: #111;
    padding: 12px;
    border-radius: 8px;
    width: 100%;
    max-width: 440px;
    position: relative;
    box-shadow: 0 8px 16px rgba(0,0,0,0.4);
    user-select: none;
}

.ballot-header {
    text-align: center;
    font-size: 0.65rem;
    font-weight: 800;
    border-bottom: 2px solid #000;
    padding-bottom: 6px;
    margin-bottom: 8px;
}

.ballot-columns {
    display: grid;
    grid-template-columns: 1.15fr 0.95fr 0.95fr 1.05fr;
    gap: 4px;
    border-bottom: 2px solid #000;
    padding-bottom: 8px;
}

.ballot-col {
    border: 1px dashed #666;
    padding: 5px 4px;
    border-radius: 4px;
    font-size: 0.62rem;
    line-height: 1.3;
}

.ballot-col .symbol {
    font-size: 11px;
}

.ballot-col.palma-col {
    border: 2px solid #0066cc;
    background: #f0f7ff;
}

.ballot-col.ppd-col {
    border: 1.5px solid #dc2626;
    background: #fef2f2;
}

.ballot-col.pip-col {
    border: 1.5px solid #16a34a;
    background: #f0fdf4;
}

.ballot-col.mvc-col {
    border: 1.5px solid #d97706;
    background: #fffbeb;
}

.target-box {
    margin: 4px 0;
    padding: 4px 0;
    background: #e0eeff;
    border: 1.5px solid #0066cc;
    font-size: 0.6rem;
    font-weight: 900;
    text-align: center;
    color: #004494;
}

.reticle {
    position: absolute;
    top: 72px;
    font-size: 28px;
    color: #dc2626;
    font-weight: 900;
    pointer-events: none;
    transform: translateX(-50%);
}

.minigame-result {
    text-align: center;
    padding: 16px;
}

.minigame-result h3 {
    font-size: 1.3rem;
    margin-bottom: 8px;
}

.result-box {
    background: #0f172a;
    padding: 14px;
    border-radius: 12px;
    margin: 16px 0;
    text-align: left;
    font-size: 0.9rem;
    line-height: 1.6;
}

.btn-primary {
    background: #2563eb;
    color: #fff;
    width: 100%;
}

/* ==========================================================================
   OPTIMIZACIONES MÓVILES
   ========================================================================== */
@media (max-width: 420px) {
    body {
        padding: 8px 6px 16px;
    }

    .tamagotchi-shell.pokemon-blue-shell {
        max-width: 330px;
        min-height: 560px;
        padding: 12px 14px 22px;
        border-radius: 20px 20px 50px 20px;
    }

    .gb-screen-bezel {
        max-width: 290px;
        padding: 10px 10px 12px;
    }

    #lcd-canvas {
        height: 135px;
    }

    .dpad {
        width: 76px;
        height: 76px;
    }
    .dpad-up, .dpad-down { left: 25px; width: 26px; height: 28px; }
    .dpad-left, .dpad-right { top: 25px; width: 28px; height: 26px; }
    .dpad-center { top: 25px; left: 25px; width: 26px; height: 26px; }

    .gb-round-btn {
        width: 38px;
        height: 38px;
        font-size: 11px;
    }

    .control-sidebar {
        min-width: 100%;
        padding: 16px;
    }

    .actions-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}
