/**
 * Arkanoid / Breakout 3D - Hoja de estilos corporativa
 * Conforme a Lecciones 549, 556 y directrices canónicas de Fijate Tools
 */

:root {
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-heading: 'Outfit', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Superficies y estética synthwave arcade */
    --pub-bg: #070b19;
    --space-surface: #0b1226;
    --space-surface-2: #111a36;
    --space-border: #1e2d5a;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    /* Acentos de luz neón */
    --neon-cyan: #00f0ff;
    --neon-magenta: #ff007f;
    --neon-yellow: #ffea00;
    --neon-green: #00ff88;
    --neon-red: #ff2244;
    --neon-gold: #ffd700;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
}

[data-theme="light"] {
    --pub-bg: #0b1021; /* Mantenemos atmósfera inmersiva arcade oscura incluso en tema claro */
    --space-surface: #0e172e;
    --space-surface-2: #152244;
    --space-border: #233464;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
}

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

html, body {
    margin: 0;
    padding: 0;
    font-family: var(--font-main);
    background-color: var(--pub-bg);
    color: var(--text-primary);
    overflow-x: clip;
    width: 100%;
    max-width: 100%;
    min-height: 100vh;
}

body {
    display: flex;
    flex-direction: column;
}

h1, h2, h3, h4, h5, h6, .brand-title, .section-title, .hero-title, .faq-section-title {
    font-family: var(--font-heading);
    letter-spacing: -0.02em;
}

.text-mono, .mono, code, pre, kbd {
    font-family: var(--font-mono);
}

/* Layout estructural canónico */
.tool-layout {
    max-width: 1200px;
    margin: 1.5rem auto 3rem;
    padding: 0 1rem;
    box-sizing: border-box;
    flex: 1 0 auto;
}

.tool-with-sidebar {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
    width: 100%;
}

.tool-main-content {
    flex: 1 1 0%;
    min-width: 0;
    width: 100%;
}

/* Tarjeta contenedora del visor 3D */
.game-viewport-card {
    position: relative;
    width: 100%;
    background: radial-gradient(circle at 50% 20%, #111a3b 0%, #070b19 80%);
    border: 1px solid var(--space-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 40px rgba(0, 240, 255, 0.08);
    display: flex;
    flex-direction: column;
}

/* Altura inmersiva conforme a Lección 549 */
#arkanoid-canvas-container {
    width: 100%;
    height: clamp(380px, 58vh, 520px);
    cursor: ew-resize;
    position: relative;
    touch-action: none;
}

@media (min-width: 768px) {
    #arkanoid-canvas-container {
        height: clamp(680px, 76vh, 900px);
    }
}

@media (min-width: 1400px) {
    #arkanoid-canvas-container {
        height: clamp(740px, 80vh, 960px);
    }
}

/* HUD Superior */
.game-hud-top {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem 1.25rem;
    background: linear-gradient(180deg, rgba(7, 11, 25, 0.88) 0%, rgba(7, 11, 25, 0) 100%);
    pointer-events: none;
    z-index: 10;
}

.hud-score-block {
    display: flex;
    flex-direction: column;
}

.hud-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.hud-score-value {
    font-size: 1.45rem;
    font-weight: 800;
    color: #ffffff;
    text-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
}

.hud-score-value.is-high {
    color: var(--neon-yellow);
    text-shadow: 0 0 10px rgba(255, 234, 0, 0.5);
}

.hud-center-pill {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.hud-stage-badge {
    background: rgba(0, 240, 255, 0.15);
    border: 1px solid var(--neon-cyan);
    color: var(--neon-cyan);
    font-size: 0.85rem;
    font-weight: 800;
    padding: 0.25rem 0.65rem;
    border-radius: var(--radius-sm);
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.25);
}

.hud-combo-badge {
    background: rgba(255, 0, 127, 0.2);
    border: 1px solid var(--neon-magenta);
    color: var(--neon-magenta);
    font-size: 0.82rem;
    font-weight: 800;
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius-sm);
    box-shadow: 0 0 12px rgba(255, 0, 127, 0.4);
    animation: pulseCombo 0.8s infinite alternate ease-in-out;
}

@keyframes pulseCombo {
    from { transform: scale(1.0); }
    to { transform: scale(1.08); }
}

/* HUD Inferior */
.game-hud-bottom {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.25rem;
    background: linear-gradient(0deg, rgba(7, 11, 25, 0.88) 0%, rgba(7, 11, 25, 0) 100%);
    pointer-events: none;
    z-index: 10;
}

.hud-lives-wrap {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.hud-life-puck {
    display: inline-block;
    width: 20px;
    height: 8px;
    background: var(--neon-cyan);
    border-radius: 4px;
    box-shadow: 0 0 8px var(--neon-cyan);
}

.hud-powerups-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.hud-pu-tag {
    font-size: 0.75rem;
    font-weight: 800;
    padding: 0.2rem 0.55rem;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    animation: fadeInTag 0.3s ease-out;
}

.pu-laser {
    background: rgba(255, 34, 68, 0.25);
    border: 1px solid var(--neon-red);
    color: var(--neon-red);
}

.pu-magnet {
    background: rgba(0, 240, 255, 0.25);
    border: 1px solid var(--neon-cyan);
    color: var(--neon-cyan);
}

.pu-expand {
    background: rgba(255, 234, 0, 0.25);
    border: 1px solid var(--neon-yellow);
    color: var(--neon-yellow);
}

.pu-shield {
    background: rgba(255, 215, 0, 0.25);
    border: 1px solid var(--neon-gold);
    color: var(--neon-gold);
}

@keyframes fadeInTag {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Cartel flotante de estado (Fase, Nivel completado, etc.) */
.hud-status-banner {
    position: absolute;
    top: 42%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    text-align: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 20;
}

.hud-status-banner.is-visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.0);
}

.hud-status-text {
    font-size: 2.2rem;
    font-weight: 900;
    color: #ffffff;
    text-shadow: 0 0 20px rgba(0, 240, 255, 0.8), 0 0 40px rgba(255, 0, 127, 0.6);
    letter-spacing: 0.05em;
}

.hud-status-sub {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--neon-yellow);
    margin-top: 0.3rem;
    letter-spacing: 0.04em;
}

/* Capa de textos flotantes */
.hud-floating-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 15;
}

.hud-floating-badge {
    position: absolute;
    top: 25%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.35rem;
    font-weight: 900;
    text-shadow: 0 0 14px currentColor;
    animation: floatUpFade 1.4s forwards ease-out;
}

@keyframes floatUpFade {
    0% { opacity: 0; transform: translate(-50%, 15px) scale(0.85); }
    20% { opacity: 1; transform: translate(-50%, 0) scale(1.1); }
    75% { opacity: 1; transform: translate(-50%, -20px) scale(1.0); }
    100% { opacity: 0; transform: translate(-50%, -40px) scale(0.95); }
}

/* Barra de control táctil móvil */
.mobile-touch-deck {
    display: none;
    margin-top: 0.75rem;
    gap: 0.75rem;
    align-items: center;
}

@media (max-width: 900px) {
    .mobile-touch-deck {
        display: flex;
    }
}

.touch-slider-track {
    flex: 1 1 0%;
    height: 52px;
    background: var(--space-surface-2);
    border: 1px dashed var(--space-border);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    touch-action: none;
    cursor: pointer;
}

.touch-slider-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    pointer-events: none;
}

.btn-touch-fire {
    flex: 0 0 110px;
    height: 52px;
    background: linear-gradient(135deg, #ff0055 0%, #cc0044 100%);
    color: #ffffff;
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 800;
    border: none;
    border-radius: var(--radius-sm);
    box-shadow: 0 0 15px rgba(255, 0, 85, 0.4);
    cursor: pointer;
    touch-action: manipulation;
}

.btn-touch-fire:active {
    transform: scale(0.96);
}

/* Panel inferior de botones y ajustes */
.game-controls-deck {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding: 0.85rem 1.25rem;
    background: var(--space-surface);
    border: 1px solid var(--space-border);
    border-radius: var(--radius-md);
}

.deck-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.deck-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-right: 0.2rem;
}

.btn-deck-sm {
    background: var(--space-surface-2);
    color: var(--text-secondary);
    border: 1px solid var(--space-border);
    padding: 0.45rem 0.85rem;
    font-size: 0.82rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
}

.btn-deck-sm:hover {
    color: #ffffff;
    border-color: var(--neon-cyan);
    background: rgba(0, 240, 255, 0.08);
}

.btn-deck-sm.is-active {
    background: rgba(0, 240, 255, 0.15);
    border-color: var(--neon-cyan);
    color: var(--neon-cyan);
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.25);
}

.btn-deck-primary {
    background: linear-gradient(135deg, var(--neon-cyan) 0%, #0099ff 100%);
    color: #070b19;
    font-weight: 800;
    border: none;
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.35);
}

.btn-deck-primary:hover {
    background: linear-gradient(135deg, #4df5ff 0%, #33adff 100%);
    color: #070b19;
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.55);
}

/* Modales accesibles sin window.alert() */
.arkanoid-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(4, 7, 18, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.arkanoid-modal-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
}

.arkanoid-modal-card {
    background: var(--space-surface);
    border: 1px solid var(--space-border);
    border-radius: var(--radius-md);
    width: 100%;
    max-width: 520px;
    padding: 1.75rem;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7), 0 0 35px rgba(0, 240, 255, 0.12);
    position: relative;
    transform: translateY(15px);
    transition: transform 0.25s ease;
}

.arkanoid-modal-overlay.is-open .arkanoid-modal-card {
    transform: translateY(0);
}

.arkanoid-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--space-border);
    padding-bottom: 0.85rem;
    margin-bottom: 1.25rem;
}

.arkanoid-modal-title {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 800;
    color: #ffffff;
}

.arkanoid-modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.6rem;
    cursor: pointer;
    line-height: 1;
    padding: 0.2rem 0.5rem;
}

.arkanoid-modal-close:hover {
    color: #ffffff;
}

.stats-grid-modal {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stats-box-item {
    background: var(--space-surface-2);
    border: 1px solid var(--space-border);
    border-radius: var(--radius-sm);
    padding: 0.85rem;
    text-align: center;
}

.stats-box-val {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--neon-cyan);
}

.stats-box-lbl {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}
