:root {
    --primary: #5d5cde;
    --secondary: #2ac3ff;
    --accent: #ff007a;
    --bg-dark: #0f172a;
    --glass: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --pixel-font: 'Press Start 2P', cursive;
    --main-font: 'Outfit', sans-serif;
    --success: #10b981;
    --error: #ef4444;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: var(--bg-dark);
    color: #f8fafc;
    font-family: var(--main-font);
    overflow-x: hidden;
    overflow-y: auto;
    min-height: 100vh;
    width: 100vw;
    display: flex;
    flex-direction: column;
}

/* Glassmorphism Classes */
.glass {
    background: var(--glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

/* Typography */
h1, h2, h3, .pixel-text {
    font-family: var(--pixel-font);
    text-transform: uppercase;
}

h1 { font-size: 1.5rem; color: var(--secondary); text-shadow: 4px 4px 0px rgba(0,0,0,0.5); }

/* Navigation Bar */
.navbar {
    height: 70px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    margin: 10px;
    z-index: 100;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-links {
    display: flex;
    gap: 20px;
}

.nav-link {
    color: #fff;
    text-decoration: none;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s ease;
    padding: 8px 12px;
    border-radius: 8px;
}

.nav-link:hover, .nav-link.active {
    background: var(--glass);
    color: var(--secondary);
    transform: translateY(-2px);
}

/* Main Content */
main {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    position: relative;
}

/* Buttons */
.btn {
    font-family: var(--pixel-font);
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-transform: uppercase;
    font-size: 0.7rem;
    outline: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 0px #3b3abe;
}

.btn-primary:active {
    transform: translateY(4px);
    box-shadow: 0 0px 0px #3b3abe;
}

.btn-accent {
    background: var(--accent);
    color: white;
    box-shadow: 0 4px 0px #c2005d;
}

.btn-accent:active {
    transform: translateY(4px);
    box-shadow: 0 0px 0px #c2005d;
}

/* Game Styles */
#game-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    max-width: 800px;
}

#game-canvas {
    background: #000;
    border: 4px solid var(--secondary);
    box-shadow: 0 0 20px var(--secondary);
    max-width: 100%;
    max-height: 80vh;
    border-radius: 4px;
}

.hud {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
}

.hud-item {
    font-family: var(--pixel-font);
    font-size: 0.8rem;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    padding: 10px 18px;
    border-radius: 4px;
    border: 2px solid var(--secondary);
    box-shadow: 0 0 15px rgba(42, 195, 255, 0.3), inset 0 0 10px rgba(42, 195, 255, 0.2);
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s ease;
    animation: hudPulse 4s infinite alternate;
}

@keyframes hudPulse {
    from { border-color: var(--secondary); box-shadow: 0 0 10px rgba(42, 195, 255, 0.3); }
    to { border-color: var(--primary); box-shadow: 0 0 20px rgba(93, 92, 222, 0.5); }
}

.hud-item i {
    font-size: 1.2rem;
    filter: drop-shadow(0 0 5px currentColor);
}

/* Forms (Login/Register) */
.auth-container {
    width: 100%;
    max-width: 400px;
    padding: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
    font-family: var(--pixel-font);
}

.form-input {
    width: 100%;
    padding: 12px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: white;
    font-family: var(--main-font);
    outline: none;
}

.form-input:focus {
    border-color: var(--secondary);
}

/* Table / Lists */
.table-container {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
}

th { font-family: var(--pixel-font); font-size: 0.7rem; color: var(--secondary); }

/* Notifications */
#notification-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

.notification {
    padding: 15px 25px;
    margin-top: 10px;
    border-radius: 8px;
    font-family: var(--main-font);
    font-weight: 600;
    animation: slideIn 0.3s ease forwards;
    display: flex;
    align-items: center;
    gap: 10px;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.success { background: var(--success); }
.error { background: var(--error); }

/* Grid for cards */
.grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    width: 100%;
}

.card {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.card img {
    width: 80px;
    height: 80px;
    image-rendering: pixelated;
}

.active-row {
    background: rgba(42, 195, 255, 0.1) !important;
}

/* Responsive */
@media (max-width: 768px) {
    .navbar { font-size: 0.7rem; padding: 0 1rem; }
    .nav-links { gap: 10px; }
    .nav-text { display: none; }
    .hud-item { font-size: 0.6rem; }
}

@media (min-width: 1025px) {
    #mobile-controls {
        display: none !important;
    }
}

/* Animaciones de mensajes en el juego */
.game-msg {
    font-family: var(--pixel-font);
    font-size: 1.5rem;
    color: white;
    text-shadow: 4px 4px 0 #000, 0 0 10px currentColor;
    animation: popAndFade 1.5s ease-out forwards;
    display: block;
    line-height: 1.4;
}

@keyframes popAndFade {
    0% { transform: scale(0.8); opacity: 0; }
    10% { transform: scale(1); opacity: 1; }
    80% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1); opacity: 0; }
}

/* Animación de entrada para el menú de Fin de Partida */
@keyframes overlayPop {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
    70% { transform: translate(-50%, -50%) scale(1.05); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

#game-overlay {
    animation: overlayPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
