/*
 * Globals
 */

/* Links */
a,
a:focus,
a:hover {
    font-weight: 400;
    color: #f6fb7b;
}


/*
 * Base structure
 */

html,
body {
    height: 100%;
    background-color: #000000;
}

body {
    display: -ms-flexbox;
    display: -webkit-box;
    display: flex;
    -ms-flex-pack: center;
    -webkit-box-pack: center;
    justify-content: center;
    color: #fff;
    text-shadow: 0 .05rem .1rem rgba(0, 0, 0, .5);
    box-shadow: inset 0 0 5rem rgba(0, 0, 0, .5);
}

.cover-container {
    max-width: 54em;
}

.popover {
    max-width: 1000px;
}

/*
 * Header
 */
.masthead {
    margin-top: 1rem;
    margin-bottom: 2rem;
}

.nav-masthead .nav-link {
    padding: .25rem 0;
    font-weight: 700;
    color: rgba(255, 255, 255, .5);
    background-color: transparent;
    border-bottom: .25rem solid transparent;
}

    .nav-masthead .nav-link:hover,
    .nav-masthead .nav-link:focus {
        border-bottom-color: rgba(255, 255, 255, .25);
    }

    .nav-masthead .nav-link + .nav-link {
        margin-left: 1rem;
    }

.nav-masthead .active {
    color: #fff;
    border-bottom-color: #fff;
}

@media (min-width: 48em) {
    .masthead-brand {
        float: left;
    }

    .nav-masthead {
        float: right;
    }
}


/*
 * Cover
 */
.cover {
    padding: 0 1.5rem;
}

html, body {
    width: 100%;
    height: 100%;
    margin: 0px;
    border: 0;
    overflow: hidden;
    background-color: #000000;
    display: block;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

/* Fullscreen responsive canvas */
canvas, #gameCanvas, #fullCanvas {
    width: 100vw !important;
    height: 100vh !important;
    object-fit: contain !important; /* Mantiene la relación de aspecto original */
    background: black !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    z-index: 1;
    display: block;
}

/* Responsive Fullscreen Overlay HUD */
.game-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 20;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.overlay-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 14px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0) 100%);
    pointer-events: auto;
    transition: opacity 0.3s ease;
    gap: 8px;
    flex-wrap: wrap;
}

.overlay-brand {
    font-weight: 800;
    font-size: 1.1rem;
    margin: 0;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    gap: 6px;
}

.overlay-controls-group {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.overlay-select {
    background: rgba(20, 20, 30, 0.85);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 0.85rem;
    outline: none;
    max-width: 170px;
    cursor: pointer;
}

.overlay-btn {
    background: rgba(30, 35, 55, 0.8);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 0.85rem;
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: all 0.2s ease;
}

.overlay-btn:hover, .overlay-btn:active {
    background: rgba(60, 75, 120, 0.95);
    border-color: #f6fb7b;
}

/* Mobile Virtual Touch Controls */
.mobile-controls {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100vw;
    height: 190px;
    pointer-events: none;
    z-index: 99999;
    padding: 10px 18px 20px 18px;
    box-sizing: border-box;
}

.mobile-controls.active {
    display: flex !important;
    justify-content: space-between !important;
    align-items: flex-end !important;
}

.touch-joystick-zone {
    width: 140px;
    height: 140px;
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.touch-joystick-base {
    width: 116px;
    height: 116px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    border: 2px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    backdrop-filter: blur(4px);
}

.touch-joystick-thumb {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: radial-gradient(circle, #e52521 0%, #b31217 100%);
    border: 2px solid #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
    position: absolute;
    transform: translate(0, 0);
    pointer-events: none;
}

.touch-buttons-zone {
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-end;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.touch-btn-row {
    display: flex;
    gap: 12px;
    align-items: center;
}

.touch-btn {
    border-radius: 50%;
    font-weight: 800;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-user-select: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.6);
    border: 2px solid rgba(255,255,255,0.45);
    outline: none;
    touch-action: manipulation;
    transition: transform 0.06s ease;
}

.touch-btn:active, .touch-btn.pressed {
    transform: scale(0.90);
    filter: brightness(1.25);
}

.touch-btn-a {
    width: 64px;
    height: 64px;
    font-size: 1.5rem;
    background: radial-gradient(circle, #0088ff 0%, #0055b3 100%);
}

.touch-btn-b {
    width: 56px;
    height: 56px;
    font-size: 1.3rem;
    background: radial-gradient(circle, #00c853 0%, #008a38 100%);
}

.touch-btn-z {
    width: 50px;
    height: 50px;
    font-size: 1.15rem;
    background: radial-gradient(circle, #7b1fa2 0%, #4a148c 100%);
}

.touch-btn-cam {
    width: 42px;
    height: 42px;
    font-size: 0.9rem;
    background: radial-gradient(circle, #ffb300 0%, #ff8f00 100%);
    color: #000;
}

.touch-btn-start {
    width: 64px;
    height: 34px;
    border-radius: 17px;
    font-size: 0.8rem;
    background: rgba(60, 60, 70, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

/* PWA Installation & Orientation Modals */
.pwa-install-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.78);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
    animation: pwaFadeIn 0.25s ease;
}

@keyframes pwaFadeIn {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

.pwa-install-card {
    background: linear-gradient(145deg, rgba(26, 32, 54, 0.96) 0%, rgba(15, 18, 30, 0.98) 100%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 22px;
    padding: 22px;
    max-width: 440px;
    width: 100%;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.85), 0 0 40px rgba(229, 37, 33, 0.25);
    text-align: left;
    color: #fff;
    position: relative;
}

.pwa-close-btn {
    position: absolute;
    top: 14px;
    right: 14px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    font-size: 1.4rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: background 0.2s;
}

.pwa-close-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.pwa-install-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
    padding-right: 30px;
}

.pwa-app-icon {
    width: 60px;
    height: 60px;
    border-radius: 14px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
    flex-shrink: 0;
    object-fit: cover;
}

.pwa-text-group {
    flex: 1;
}

.pwa-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
}

.pwa-subtitle {
    margin: 3px 0 0 0;
    font-size: 0.86rem;
    color: rgba(255, 255, 255, 0.7);
}

/* Tabs */
.pwa-tabs {
    display: flex;
    gap: 6px;
    background: rgba(0, 0, 0, 0.35);
    padding: 4px;
    border-radius: 12px;
    margin-bottom: 14px;
}

.pwa-tab {
    flex: 1;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 7px 6px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.pwa-tab.active {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.pwa-description {
    font-size: 0.88rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.9);
    margin: 8px 0 12px 0;
    background: rgba(255, 255, 255, 0.05);
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.pwa-highlight {
    background: rgba(255, 230, 0, 0.2);
    color: #ffee55;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
}

.pwa-extra-tip {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.65);
    margin-bottom: 16px;
    line-height: 1.4;
    padding: 0 4px;
}

.pwa-btn-group {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    align-items: center;
}

.pwa-btn {
    border: none;
    border-radius: 12px;
    padding: 10px 18px;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pwa-btn-secondary {
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.85);
}

.pwa-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.pwa-btn-primary {
    background: linear-gradient(135deg, #e52521 0%, #ff5252 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(229, 37, 33, 0.4);
}

.pwa-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(229, 37, 33, 0.6);
}

/* Orientation Modal & Cards */
.orientation-icon-badge {
    font-size: 2.2rem;
    line-height: 1;
}

.orientation-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 10px;
}

.orientation-option-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 14px;
    padding: 12px 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.orientation-option-card:hover, .orientation-option-card:focus, .orientation-option-card.selected {
    border-color: #ffd700;
    background: rgba(255, 215, 0, 0.08);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}

.orient-opt-badge {
    position: absolute;
    top: -9px;
    right: 14px;
    background: #00c853;
    color: #000;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
}

.orient-opt-preview {
    width: 60px;
    height: 60px;
    border-radius: 10px;
    background: #090a10;
    border: 1px solid rgba(255, 255, 255, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
    padding: 4px;
    box-sizing: border-box;
}

.orient-preview-portrait .mini-game-screen {
    height: 52%;
    background: #0088ff;
    border-radius: 4px;
    font-size: 0.55rem;
    font-weight: 800;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.orient-preview-portrait .mini-console-controls {
    height: 48%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2px 4px;
}

.mini-stick {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #e52521;
    display: inline-block;
}

.mini-btn-ab {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #00c853;
    display: inline-block;
}

.orient-preview-landscape {
    flex-direction: row !important;
    align-items: center;
}

.mini-game-screen-land {
    flex: 1;
    height: 100%;
    background: #0088ff;
    border-radius: 4px;
    font-size: 0.55rem;
    font-weight: 800;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mini-land-controls-left, .mini-land-controls-right {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #e52521;
    margin: 0 2px;
}

.mini-land-controls-right {
    background: #00c853 !important;
}

.orient-opt-info {
    flex: 1;
}

.orient-opt-title {
    margin: 0 0 4px 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
}

.orient-opt-desc {
    margin: 0;
    font-size: 0.78rem;
    line-height: 1.35;
    color: rgba(255, 255, 255, 0.7);
}

/* Header buttons styling */
.overlay-btn-orient {
    background: rgba(30, 90, 160, 0.85) !important;
    border-color: rgba(100, 180, 255, 0.5) !important;
    font-weight: 600;
}

.overlay-btn-install {
    background: linear-gradient(135deg, #e52521 0%, #ff5252 100%) !important;
    border-color: rgba(255, 255, 255, 0.4) !important;
    font-weight: 700;
    animation: installPulse 2s infinite ease-in-out;
}

@keyframes installPulse {
    0%, 100% { box-shadow: 0 0 0 rgba(229, 37, 33, 0); }
    50% { box-shadow: 0 0 10px rgba(229, 37, 33, 0.6); }
}

/* ==========================================================
   PORTRAIT / VERTICAL HANDHELD CONSOLE MODE
   ========================================================== */
body.mode-portrait canvas,
body.mode-portrait #gameCanvas,
body.mode-portrait #fullCanvas {
    top: 42px !important;
    left: 0 !important;
    width: 100vw !important;
    height: min(48vh, 75vw) !important;
    max-height: 48vh !important;
    object-fit: contain !important;
    position: fixed !important;
    z-index: 2 !important;
}

body.mode-portrait .mobile-controls {
    display: flex !important;
    position: fixed !important;
    top: calc(min(48vh, 75vw) + 42px) !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: auto !important;
    background: linear-gradient(180deg, #181c2b 0%, #0d0f18 100%) !important;
    border-top: 2px solid rgba(255, 255, 255, 0.18) !important;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.7) !important;
    padding: 12px 14px 24px 14px !important;
    justify-content: space-around !important;
    align-items: center !important;
    z-index: 100 !important;
    box-sizing: border-box !important;
}

body.mode-portrait .touch-joystick-zone {
    width: 130px !important;
    height: 130px !important;
}

body.mode-portrait .touch-joystick-base {
    width: 110px !important;
    height: 110px !important;
    background: rgba(255, 255, 255, 0.08) !important;
}

body.mode-portrait .touch-buttons-zone {
    gap: 8px !important;
}

/* ==========================================================
   LANDSCAPE / HORIZONTAL FULLSCREEN MODE
   ========================================================== */
body.mode-landscape canvas,
body.mode-landscape #gameCanvas,
body.mode-landscape #fullCanvas {
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    object-fit: contain !important;
    position: absolute !important;
    z-index: 1 !important;
}

body.mode-landscape .mobile-controls {
    top: auto !important;
    bottom: 0 !important;
    height: 190px !important;
    background: transparent !important;
    border-top: none !important;
    box-shadow: none !important;
    padding: 10px 18px 20px 18px !important;
}
