:root {
    --bg-color: #0a0a12;
    --neon-blue: #00f3ff;
    --neon-pink: #ff00ea;
    --neon-gold: #FFB703;
    --text-color: #fff;
    --panel-bg: rgba(255, 255, 255, 0.05);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden; /* Sin scroll — todo cabe en pantalla */
}

body {
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(ellipse at 20% 80%, rgba(255, 0, 234, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(0, 243, 255, 0.08) 0%, transparent 50%);
    color: var(--text-color);
    font-family: 'Orbitron', sans-serif;
    overflow: hidden;
    touch-action: none;
    user-select: none;
}

/* === CONTENEDOR PRINCIPAL: ocupa toda la pantalla === */
.tetrix-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    padding: 0.4rem 0.6rem;
    overflow: hidden;
}

/* ===== HEADER ===== */
.tetrix-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    padding: 0.2rem 0;
    margin-bottom: 0.3rem;
}

.tetrix-header h1 {
    font-size: clamp(0.9rem, 3.5vw, 1.5rem);
    text-shadow: 0 0 10px var(--neon-pink), 0 0 30px rgba(255, 0, 234, 0.3);
}

.neon-text {
    color: var(--neon-pink);
}

.btn-back {
    color: var(--neon-blue);
    text-decoration: none;
    border: 1px solid var(--neon-blue);
    padding: 5px 10px;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-size: clamp(0.55rem, 2vw, 0.75rem);
    font-family: 'Orbitron', sans-serif;
}

.btn-back:hover {
    background: var(--neon-blue);
    color: #000;
    box-shadow: 0 0 20px var(--neon-blue);
}

/* ===== WELCOME / TUTORIAL SCREEN ===== */
.welcome-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
    overflow-y: auto;
    animation: fadeInUp 0.6s ease-out;
}

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

.welcome-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(0, 243, 255, 0.2);
    border-radius: 16px;
    padding: 1.2rem 1rem;
    backdrop-filter: blur(10px);
    text-align: center;
    width: 100%;
    max-width: 480px;
}

.welcome-title {
    font-size: clamp(0.9rem, 4vw, 1.4rem);
    color: var(--neon-gold);
    text-shadow: 0 0 15px rgba(255, 183, 3, 0.4);
    margin-bottom: 1rem;
}

.tutorial-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 1rem;
}

.tutorial-item {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 0.6rem;
    transition: border-color 0.3s;
}

.tutorial-item:hover {
    border-color: var(--neon-blue);
}

.tutorial-icon {
    font-size: 1.2rem;
    display: block;
    margin-bottom: 4px;
}

.tutorial-item p {
    font-size: 0.65rem;
    color: #bbb;
    line-height: 1.4;
    font-family: sans-serif;
}

.tutorial-item strong {
    color: #fff;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.7rem;
}

.tutorial-tips {
    background: rgba(255, 183, 3, 0.08);
    border: 1px solid rgba(255, 183, 3, 0.2);
    border-radius: 10px;
    padding: 0.7rem;
    margin-bottom: 1rem;
    text-align: left;
}

.tutorial-tips p {
    font-size: 0.65rem;
    color: #ccc;
    margin-bottom: 4px;
    font-family: sans-serif;
    line-height: 1.4;
}

.tutorial-tips p:last-child { margin-bottom: 0; }

.btn-start-game {
    background: linear-gradient(135deg, var(--neon-pink), #c600bd);
    color: #fff;
    border: none;
    padding: 12px 32px;
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(0.85rem, 3vw, 1.1rem);
    font-weight: 700;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 0 20px rgba(255, 0, 234, 0.4);
    animation: pulseBtn 2s ease-in-out infinite;
}

@keyframes pulseBtn {
    0%, 100% { box-shadow: 0 0 20px rgba(255, 0, 234, 0.4); }
    50% { box-shadow: 0 0 35px rgba(255, 0, 234, 0.7); }
}

.btn-start-game:hover {
    transform: scale(1.05);
}

/* ===== GAME ZONE: layout flex que llena el espacio restante === */
.game-zone {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: fadeInUp 0.4s ease-out;
}

/* === Barra superior de stats === */
.stats-bar {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-shrink: 0;
    margin-bottom: 0.3rem;
}

.stat-box {
    background: var(--panel-bg);
    border: 1px solid rgba(0, 243, 255, 0.2);
    padding: 4px 12px;
    border-radius: 8px;
    text-align: center;
    min-width: 70px;
}

.stat-box h3 {
    font-size: 0.55rem;
    color: #888;
    letter-spacing: 1px;
    margin-bottom: 2px;
}

.stat-box p {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--neon-blue);
    text-shadow: 0 0 8px var(--neon-blue);
}

/* === Área central: canvas + "siguiente" === */
.game-area {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 10px;
    flex: 1;
    overflow: hidden;
}

.canvas-wrapper {
    position: relative;
    flex-shrink: 0;
}

.canvas-container {
    position: relative;
    border: 2px solid var(--neon-pink);
    box-shadow: 0 0 25px rgba(255, 0, 234, 0.4), inset 0 0 15px rgba(255, 0, 234, 0.1);
    background: #000;
    border-radius: 8px;
    display: block;
}

canvas {
    display: block;
}

/* Panel derecho: siguiente pieza + pausa */
.right-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.right-panel .stat-box {
    min-width: 0;
    padding: 4px 8px;
}

.controls-info {
    display: none;
}

/* ===== OVERLAYS ===== */
.overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.88);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
    backdrop-filter: blur(4px);
    border-radius: 6px;
}

.overlay.hidden { display: none; }

.overlay h2 {
    color: var(--neon-pink);
    margin-bottom: 8px;
    font-size: clamp(1rem, 5vw, 1.6rem);
    text-shadow: 0 0 15px var(--neon-pink);
}

.overlay p {
    font-size: 0.75rem;
    color: #ccc;
    text-align: center;
    padding: 0 10px;
}

.btn-neon {
    background: transparent;
    color: var(--neon-blue);
    border: 2px solid var(--neon-blue);
    padding: 8px 18px;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.8rem;
    cursor: pointer;
    margin-top: 16px;
    border-radius: 8px;
    transition: all 0.3s;
}

.btn-neon:hover {
    background: var(--neon-blue);
    color: #000;
    box-shadow: 0 0 20px var(--neon-blue);
}

/* ===== CONTROLES MÓVILES (siempre visibles, compactos) ===== */
.mobile-controls {
    display: flex;
    justify-content: space-around;
    align-items: center;
    flex-shrink: 0;
    padding: 6px 0 4px 0;
    gap: 6px;
}

.control-btn {
    background: rgba(0, 243, 255, 0.08);
    border: 2px solid var(--neon-blue);
    color: white;
    border-radius: 50%;
    font-size: clamp(16px, 5vw, 22px);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.12s;
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.2);
    /* Tamaño responsivo basado en viewport */
    width: clamp(44px, 12vw, 60px);
    height: clamp(44px, 12vw, 60px);
    flex-shrink: 0;
}

.control-btn:active {
    background: rgba(0, 243, 255, 0.25);
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.5);
    transform: scale(0.88);
}

.center-controls {
    display: flex;
    gap: 6px;
}

/* Botón pausa pequeño en la barra */
.btn-pause-inline {
    background: rgba(255, 0, 234, 0.1);
    border: 1px solid var(--neon-pink);
    color: var(--neon-pink);
    border-radius: 8px;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.6rem;
    padding: 5px 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-pause-inline:active {
    background: rgba(255, 0, 234, 0.3);
}

/* Indicador de swipe táctil */
.swipe-hint {
    text-align: center;
    font-size: 0.6rem;
    color: rgba(255,255,255,0.25);
    font-family: sans-serif;
    flex-shrink: 0;
    padding-bottom: 2px;
}
