/* --- RESET & VARIÁVEIS --- */
:root {
    /* Paleta */
    --bg-color: #050510;
    --panel-color: #1a1c2c;
    --accent-pink: #ff0055;
    --accent-green: #00ff9d;
    --text-main: #e0e0e0;
    --text-dim: #6b7280;

    /* Espaçamento e Layout */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --radius: 4px; /* Estilo retro anguloso */
    
    /* Tipografia */
    --font-stack: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
    --font-size-base: 16px;
    --font-size-lg: 24px;
    --font-size-xl: 48px;
    --font-size-huge: 64px;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-color);
    font-family: var(--font-stack);
    color: var(--text-main);
}

/* --- CONTAINER PRINCIPAL --- */
body {
    display: flex;
    justify-content: center;
    align-items: center;
}

#crt-container {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 480px; /* Limite mobile-first */
    background-color: var(--bg-color);
    overflow: hidden;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    transition: transform 0.1s;
}

/* --- CANVAS --- */
#gameCanvas {
    display: block;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* --- EFEITOS CRT/SCANLINE --- */
.scanlines {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(
        to bottom,
        rgba(255,255,255,0),
        rgba(255,255,255,0) 50%,
        rgba(0,0,0,0.1) 50%,
        rgba(0,0,0,0.1)
    );
    background-size: 100% 4px;
    pointer-events: none;
    z-index: 10;
}
.scanlines::after {
    content: " ";
    display: block;
    position: absolute;
    top: 0; left: 0; bottom: 0; right: 0;
    background: rgba(18, 16, 16, 0.02);
    opacity: 0;
    z-index: 2;
    pointer-events: none;
    animation: flicker 0.15s infinite;
}

/* --- UI LAYERS --- */
.game-screen {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 5;
    padding: var(--spacing-lg);
    transition: opacity 0.3s ease;
}

.game-screen.hidden {
    display: none;
    opacity: 0;
    pointer-events: none;
}

/* --- TIPOGRAFIA & GLITCH --- */
h1, h2 {
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 700;
    position: relative;
    color: var(--accent-pink);
    text-shadow: 2px 2px var(--accent-green);
}

h1 { font-size: var(--font-size-huge); line-height: 1; margin-bottom: var(--spacing-xs); }
h2 { font-size: var(--font-size-xl); margin-bottom: var(--spacing-lg); }

.glitch-text {
    position: relative;
}

/* Animação simples de "tremor" no texto */
@keyframes glitch-skew {
    0% { transform: skew(0deg); }
    20% { transform: skew(-2deg); }
    40% { transform: skew(2deg); }
    60% { transform: skew(-1deg); }
    80% { transform: skew(1deg); }
    100% { transform: skew(0deg); }
}

@keyframes flicker {
    0% { opacity: 0.02; }
    5% { opacity: 0.05; }
    10% { opacity: 0.02; }
    100% { opacity: 0.02; }
}

.subtitle {
    font-size: var(--font-size-sm);
    color: var(--text-dim);
    margin-bottom: var(--spacing-xl);
    letter-spacing: 4px;
}

/* --- COMPONENTES UI --- */
.score-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: var(--spacing-xl);
}

.label {
    font-size: var(--font-size-sm);
    color: var(--text-dim);
    text-transform: uppercase;
}

.value {
    font-size: var(--font-size-xl);
    font-weight: bold;
    color: var(--text-main);
}

.hud-score {
    position: absolute;
    top: 10%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 6;
}

.value-large {
    font-size: 80px;
    line-height: 1;
    font-weight: 800;
    color: var(--text-main);
    text-shadow: 0 4px 0 rgba(0,0,0,0.5);
}

/* Botão Retro */
.btn-retro {
    background: transparent;
    border: 2px solid var(--accent-green);
    color: var(--accent-green);
    padding: var(--spacing-md) var(--spacing-xl);
    font-family: var(--font-stack);
    font-size: var(--font-size-lg);
    text-transform: uppercase;
    cursor: pointer;
    position: relative;
    transition: all 0.1s ease;
    box-shadow: 4px 4px 0 var(--panel-color);
    outline: none;
    font-weight: bold;
}

.btn-retro::before {
    content: '';
    position: absolute;
    top: 2px; left: 2px;
    width: 100%; height: 100%;
    background: rgba(0, 255, 157, 0.1);
    z-index: -1;
    transition: background 0.1s;
}

.btn-retro:hover {
    background: var(--accent-green);
    color: var(--bg-color);
    box-shadow: 2px 2px 0 var(--panel-color);
    transform: translate(2px, 2px);
}

.btn-retro:active {
    box-shadow: none;
    transform: translate(4px, 4px);
}

.hint {
    margin-top: var(--spacing-lg);
    font-size: 12px;
    color: var(--text-dim);
    opacity: 0.8;
}

/* Modal Game Over */
.modal-box {
    background: rgba(26, 28, 44, 0.95);
    border: 2px solid var(--accent-pink);
    padding: var(--spacing-lg);
    width: 100%;
    max-width: 320px;
    text-align: center;
    box-shadow: 0 0 20px rgba(255, 0, 85, 0.2);
}

.stats-row {
    display: flex;
    justify-content: space-around;
    margin-bottom: var(--spacing-lg);
    padding: var(--spacing-md) 0;
    border-top: 1px dashed var(--text-dim);
    border-bottom: 1px dashed var(--text-dim);
}

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

.badge-new {
    color: var(--accent-pink);
    font-weight: bold;
    margin-bottom: var(--spacing-md);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.05); }
}

/* Efeito de Treme (Shake) */
.shake {
    animation: shake-anim 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake-anim {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}