:root {
    --game-scale: 2.0;
}

body, html {
    background-color: black;
    background-image: url('bg.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    color: #fff;
    font-family: Verdana;
    font-size: 12px;
    height: 100vh;
    width: 100vw;
    margin: 0;
    overflow: hidden;
    position: relative;
}

#game-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

#copyright {
    position: fixed;
    bottom: 40px;
    left: 0;
    width: 100%;
    text-align: center;
    font-family: 'Press Start 2P', cursive;
    color: #888;
    font-size: 16px;
    letter-spacing: 1px;
    z-index: 120;
    pointer-events: none;
}

#zoom-controls {
    position: fixed;
    bottom: 70px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 120;
}

.zoom-btn {
    font-family: 'Press Start 2P', cursive;
    background: rgba(34, 34, 34, 0.8);
    color: #39ff14;
    border: 2px solid #39ff14;
    padding: 10px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.1s;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.zoom-btn:hover {
    background: #39ff14;
    color: #000;
}

#parent {
    width: 600px;
    height: 400px;
    position: relative;
    border-radius: 10px;
    transform: scale(var(--game-scale));
    background: #000;
    image-rendering: pixelated;
    box-shadow: 0 0 50px rgba(57, 255, 20, 0.4);
}

/* Overlay CRT Scanlines & Distorsion */
#parent::after {
    content: " ";
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.1) 50%), 
                linear-gradient(90deg, rgba(255, 0, 0, 0.05), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.05));
    z-index: 100;
    background-size: 100% 3px, 3px 100%;
    pointer-events: none;
    border-radius: 10px;
    box-shadow: inset 0 0 100px rgba(0,0,0,0.5); /* Vignette */
}

/* CRT Curve / Fish eye simulation */
#parent {
    overflow: hidden;
    mask-image: radial-gradient(circle, white 70%, transparent 100%);
    -webkit-mask-image: radial-gradient(circle, white 85%, transparent 100%);
}
/* Game Messages (Finish Him / Winner) */
#game-messages {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none; /* Se activa por JS */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 110;
    pointer-events: none;
    font-family: 'Press Start 2P', cursive;
    text-align: center;
    transition: background-color 0.5s ease;
}

#game-messages.dazed-mode {
    display: flex;
    background-color: rgba(0, 0, 0, 0.6);
    pointer-events: none;
}

.message-finish {
    color: #ff0000;
    font-size: 30px;
    text-shadow: 4px 4px #000;
    animation: blink 0.2s infinite;
}

.message-winner {
    color: #ffea00;
    font-size: 24px;
    text-shadow: 3px 3px #aa0000;
    animation: winner-entry 0.5s ease-out;
}

@keyframes blink {
    0% { opacity: 1; }
    50% { opacity: 0; }
    100% { opacity: 1; }
}

@keyframes winner-entry {
    0% { transform: scale(0); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

#arena {
    width: 100%;
    height: 100%;
    background-color: black;
    position: absolute;
    top: 0px;
    left: 0px;
}
#loading {
    display: flex;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.loadingLabel {
    font-family: 'Press Start 2P', cursive;
    color: #ff3300;
    font-size: 24px;
    margin-bottom: 20px;
    text-shadow: 0 0 10px #ff3300;
    animation: tym-pulse 1s infinite;
}

@keyframes tym-pulse {
    0% { transform: scale(1); opacity: 0.7; }
    50% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); opacity: 0.7; }
}

#ranking-overlay {
    background-color: rgba(20, 10, 5, 0.95);
    border: 5px solid #d4af37;
    box-shadow: 0 0 30px rgba(212, 175, 55, 0.5), inset 0 0 20px rgba(0,0,0,0.8);
    padding: 30px;
}

.ranking-title {
    color: #d4af37;
    font-size: 28px;
    text-align: center;
    margin-bottom: 30px;
    text-decoration: underline;
    text-transform: uppercase;
}

.ranking-item {
    font-family: 'Verdana', sans-serif;
    color: #eee;
    font-size: 16px;
    padding: 10px;
    border-bottom: 1px solid #444;
    display: flex;
    justify-content: space-between;
}

.ranking-pos { color: #d4af37; font-weight: bold; margin-right: 15px; }
.ranking-wins { color: #00ff00; }
.ranking-losses { color: #ff0000; }
.lifebar {
    width: 200px;
    height: 18px;
    background-color: #500;
    position: absolute;
    border: 2px solid #fff;
    box-shadow: 0 0 10px rgba(0,0,0,0.8);
}

.special-charges {
    position: absolute;
    top: 52px;
    font-family: 'Press Start 2P', cursive;
    font-size: 8px;
    color: #00ccff;
    letter-spacing: 3px;
    text-shadow: 0 0 6px rgba(0,204,255,0.7);
}
#p1-charges { left: 20px; }
#p2-charges { right: 20px; letter-spacing: 3px; }
#player1LifeBar {
    left: 20px;
    top: 30px;
}
#player1LifeBar .life
{
    float: left;
    background: linear-gradient(to bottom, #ffea00 0%, #3CD400 50%, #1e6b00 100%);
}
#player2LifeBar {
    right: 20px;
    top: 30px;
}
#player2LifeBar .life
{
    float: right;
    background: linear-gradient(to bottom, #ffea00 0%, #3CD400 50%, #1e6b00 100%);
}
.playerName {
    color: white;
    font-weight: bold;
    font-style: italic;
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
    position: absolute;
    text-shadow: 2px 2px #000;
}
#player1Name {
    left: 20px;
    top: 10px;
}
#player2Name {
    right: 20px;
    top: 10px;
}
#arena-timer {
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    color: #ff3300;
    font-family: 'Press Start 2P', cursive;
    font-size: 24px;
    text-shadow: 3px 3px #000;
    z-index: 105;
}
.life {
    width: 100%;
    height: 100%;
    transition: width 0.3s ease-out;
}
#utils {
    visibility: hidden;
    z-index: 100;
    position: absolute;
    left: 0px;
    top: 0px;
    width: 100%;
    height: 100%;
}
.manual {
    width: 600px;
    margin: auto;
    color: #fff;
    font-family: Verdana;
    margin-top: 15px;
    font-size: 14px;
}
.manual > div {
    margin-left: 150px;
}
.manual a {
    color: #fff;
}
.github {
    position: fixed;
    top: 0px;
    right: 0px;
    background-image: url(../images/github.png);
    width: 149px;
    height: 149px;
    cursor: pointer;
}
.formContainer {
    margin: auto;
    text-align: center;
    margin-top: 10px;
    margin-bottom: 10px;
}

/* 8-bit Login Screen Overlay */
#login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-family: 'Press Start 2P', cursive;
    color: #39ff14;
}

#main-row {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 24px;
}

#user-login-bar {
    background: #0a0a1a;
    border: 2px solid #0088ff;
    border-radius: 8px;
    padding: 24px 20px;
    box-shadow: 0 0 18px rgba(0,136,255,0.4);
    min-width: 200px;
    font-family: 'Press Start 2P', cursive;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.pixel-title {
    font-size: 24px;
    color: #ffea00;
    text-align: center;
    text-shadow: 2px 2px #ff0000;
    margin-bottom: 20px;
}

.pixel-subtitle {
    font-size: 16px;
    color: #fff;
    margin-bottom: 50px;
    text-align: center;
}

.pixel-form {
    display: flex;
    flex-direction: column;
    gap: 30px;
    background: #111;
    padding: 40px;
    border: 4px solid #39ff14;
    border-radius: 8px;
    box-shadow: 0 0 15px #39ff14;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.form-group label {
    font-size: 12px;
    color: #aaa;
}

.form-group input, .form-group select {
    font-family: 'Press Start 2P', cursive;
    background-color: #000;
    border: 2px solid #555;
    color: #39ff14;
    padding: 10px;
    font-size: 12px;
    outline: none;
}

.form-group input:focus, .form-group select:focus {
    border-color: #ffea00;
}

#login-btn {
    font-family: 'Press Start 2P', cursive;
    margin-top: 20px;
    padding: 15px;
    background-color: #ff0000;
    color: #fff;
    border: 4px solid #aa0000;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 5px 0 #660000;
    transition: all 0.1s;
}

#login-btn:active {
    transform: translateY(5px);
    box-shadow: none;
}

#login-btn:hover {
    background-color: #ff3333;
}

.pixel-menu {
    display: flex;
    flex-direction: column;
    gap: 20px;
    background: #111;
    padding: 40px;
    border: 4px solid #39ff14;
    border-radius: 8px;
    box-shadow: 0 0 15px #39ff14;
}

.pixel-btn {
    font-family: 'Press Start 2P', cursive;
    padding: 20px;
    background-color: #000;
    color: #39ff14;
    border: 4px solid #555;
    font-size: 14px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
}

.pixel-btn:hover {
    background-color: #222;
    border-color: #39ff14;
    transform: scale(1.02);
    box-shadow: 0 0 15px rgba(57, 255, 20, 0.4);
}

/* Tournament Bracket Glow */
.match-box {
    position: relative;
    box-shadow: 0 0 5px rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    border-radius: 4px;
}

.match-box:hover {
    border-color: #ffea00 !important;
    box-shadow: 0 0 15px rgba(255, 234, 0, 0.4);
    transform: translateY(-2px);
}

.match-box[data-active="true"] {
    animation: neon-glow 1.5s infinite alternate;
    border-color: #39ff14 !important;
}

@keyframes neon-glow {
    from { box-shadow: 0 0 5px #39ff14; }
    to { box-shadow: 0 0 20px #39ff14, 0 0 10px #39ff14; }
}

/* Status Messages Animations */
#invite-status {
    transition: all 0.3s ease;
}

.status-pulse {
    animation: pulse 1s infinite;
}

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

#btn-back {
    font-family: 'Press Start 2P', cursive;
    padding: 15px;
    background-color: #555;
    color: #fff;
    border: 4px solid #333;
    font-size: 14px;
    cursor: pointer;
}

#btn-back:hover {
    background-color: #777;
}

.keyboard-layout {
    display: flex;
    justify-content: center;
    gap: 40px;
    align-items: flex-end;
    margin-top: 15px;
}

.keys-left, .keys-right, .keys-middle {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.key-row {
    display: flex;
    justify-content: center;
    gap: 5px;
}

.kb-key {
    background-color: #eee;
    color: #111;
    font-family: Arial, sans-serif;
    font-size: 14px;
    font-weight: bold;
    border-radius: 4px;
    padding: 8px 10px;
    box-shadow: 0 4px 0 #bbb, 0 5px 5px rgba(0,0,0,0.5);
    border: 1px solid #ccc;
    display: flex;
    justify-content: center;
    align-items: center;
    min-width: 25px;
    min-height: 25px;
    text-shadow: none;
}

.kb-key.wide {
    padding: 8px 30px;
    min-width: 80px;
}

.key-desc {
    color: #ffea00;
    font-size: 10px;
    margin-top: 10px;
    text-shadow: 1px 1px #000;
    font-family: Verdana, sans-serif;
}

/* Intro Sequence (Splash Screens) */
#container {
    position: relative;
    width: 600px;
    height: 400px;
    margin: 50px auto;
    border: 8px solid #222;
    background-color: #000;
    overflow: hidden;
    /* Main CRT Scanlines for everything */
}

#container::after {
    content: " ";
    display: block;
    position: absolute;
    top: 0; left: 0; bottom: 0; right: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.15) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.03), rgba(0, 255, 0, 0.01), rgba(0, 0, 255, 0.03));
    z-index: 10000;
    background-size: 100% 3px, 2px 100%;
    pointer-events: none;
    opacity: 0.8;
}

#intro-sequence {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #000;
    z-index: 20000;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.splash-screen {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 1.5s ease-in-out;
}

.splash-screen.active {
    opacity: 1;
}

.splash-screen img {
    max-width: 80%;
    max-height: 80%;
    object-fit: contain;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

#splash-wbd {
    background: #0044aa; /* Azul sólido más retro */
}

#splash-techknow {
    background-color: #000;
}

/* CRT Scanlines Effect */
#intro-sequence::before {
    content: " ";
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    z-index: 20002;
    background-size: 100% 4px, 3px 100%;
    pointer-events: none;
    animation: flicker 0.15s infinite;
}

@keyframes flicker {
  0% { opacity: 0.97; }
  5% { opacity: 0.95; }
  10% { opacity: 0.97; }
  15% { opacity: 0.94; }
  20% { opacity: 0.98; }
  25% { opacity: 0.95; }
  30% { opacity: 0.99; }
  100% { opacity: 1; }
}
/* Character Selection Screen */
#char-select-overlay {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
}

.char-grid-container {
    display: flex;
    gap: 40px;
    margin: 40px 0;
}

.char-selection-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 200px;
}

.player-label {
    font-family: 'Press Start 2P', cursive;
    font-size: 14px;
    margin-bottom: 20px;
    color: #ffea00;
}

.char-portrait-grid {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.char-portrait {
    width: 80px;
    height: 100px;
    background: #111;
    border: 3px solid #444;
    cursor: pointer;
    overflow: hidden;
    position: relative;
    transition: all 0.2s;
    image-rendering: pixelated;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.char-portrait img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: grayscale(100%) brightness(0.6);
}

.char-portrait.selected {
    border-color: #39ff14;
    box-shadow: 0 0 15px rgba(57, 255, 20, 0.6);
}

.char-portrait.selected img {
    filter: none;
    transform: scale(1.1);
}

.p1-side .char-portrait.selected { border-color: #00ffff; box-shadow: 0 0 15px rgba(0, 255, 255, 0.6); }
.p2-side .char-portrait.selected { border-color: #ff0000; box-shadow: 0 0 15px rgba(255, 0, 0, 0.6); }

.char-name-display {
    font-family: 'Press Start 2P', cursive;
    font-size: 12px;
    margin-top: 15px;
    height: 15px;
}

.vs-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Press Start 2P', cursive;
    font-size: 40px;
    color: #ff0000;
    text-shadow: 4px 4px #000;
    font-style: italic;
}

@keyframes flash-ready {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.btn-fight {
    margin-top: 30px;
    width: 250px;
    font-size: 20px;
    border-color: #ff0000;
    color: #ff0000;
    animation: flash-ready 1s infinite;
}

.btn-fight:hover {
    background: #ff0000;
    color: #fff;
    box-shadow: 0 0 30px rgba(255, 0, 0, 0.6);
}

#lang-selector {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
    justify-content: center;
}
.lang-btn {
    background: transparent;
    border: 1px solid #444;
    border-radius: 4px;
    font-size: 18px;
    padding: 2px 4px;
    cursor: pointer;
    opacity: 0.45;
    transition: opacity 0.15s, border-color 0.15s;
}
.lang-btn:hover   { opacity: 0.8; border-color: #888; }
.lang-btn.lang-active { opacity: 1; border-color: #ffea00; box-shadow: 0 0 6px rgba(255,234,0,0.5); }

.diff-btn[data-diff="easy"]   { border-color: #00cc44; color: #00cc44; }
.diff-btn[data-diff="medium"] { border-color: #ffcc00; color: #ffcc00; }
.diff-btn[data-diff="hard"]   { border-color: #ff3333; color: #ff3333; }
.diff-btn[data-diff="easy"]:hover,   .diff-btn[data-diff="easy"].diff-selected   { background:#003311; border-color:#00ff55; color:#00ff55; box-shadow:0 0 12px rgba(0,255,85,0.5); }
.diff-btn[data-diff="medium"]:hover, .diff-btn[data-diff="medium"].diff-selected { background:#332200; border-color:#ffea00; color:#ffea00; box-shadow:0 0 12px rgba(255,234,0,0.5); }
.diff-btn[data-diff="hard"]:hover,   .diff-btn[data-diff="hard"].diff-selected   { background:#330000; border-color:#ff4444; color:#ff4444; box-shadow:0 0 12px rgba(255,68,68,0.5); }

.portrait-label {
    font-family: 'Press Start 2P', cursive;
    font-size: 5px;
    color: #fff;
    text-align: center;
    padding: 2px 1px 0;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: rgba(0,0,0,0.6);
    position: absolute;
    bottom: 0;
    left: 0;
}

/* Round Announcement Overlay */
#round-announcement {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 112;
    background: rgba(0,0,0,0.75);
    font-family: 'Press Start 2P', cursive;
    pointer-events: none;
}

.round-text {
    color: #ffea00;
    font-size: 28px;
    text-shadow: 4px 4px #aa0000;
    letter-spacing: 4px;
    animation: round-entry 0.4s ease-out;
}

.fight-text {
    color: #ff0000;
    font-size: 40px;
    text-shadow: 4px 4px #000;
    animation: fight-entry 0.3s ease-out;
    margin-top: 12px;
}

.fight-sprite {
    image-rendering: pixelated;
    width: 206px;
    height: 36px;
    margin-top: 12px;
    animation: fight-entry 0.3s ease-out;
}

.finish-sprite {
    image-rendering: pixelated;
    width: 288px;
    height: 36px;
    animation: blink 0.4s infinite;
}

.win-sprite {
    image-rendering: pixelated;
    width: auto;
    height: 36px;
    animation: winner-entry 0.5s ease-out;
}

.round-win-sub {
    font-family: 'Press Start 2P', cursive;
    color: #ffea00;
    font-size: 14px;
    margin-top: 10px;
    text-shadow: 2px 2px #aa0000;
}

@keyframes round-entry {
    0%   { transform: scale(3); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes fight-entry {
    0%   { transform: scaleX(4); opacity: 0; }
    100% { transform: scaleX(1); opacity: 1; }
}

/* Win Indicators (dots / skulls) */
.win-indicators {
    position: absolute;
    display: flex;
    gap: 6px;
    top: 52px;
}

#p1-wins-display { left: 20px; }
#p2-wins-display { right: 20px; }

.win-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid #fff;
    background: transparent;
}

.win-dot.filled { background: #ff0000; }

/* Timer urgency when <= 10 */
#arena-timer.urgent {
    color: #ff3300;
    animation: timer-urgent 0.45s infinite;
}

@keyframes timer-urgent {
    0%   { transform: translateX(-50%) scale(1);   }
    50%  { transform: translateX(-50%) scale(1.35); }
    100% { transform: translateX(-50%) scale(1);   }
}

.char-portrait img {
    width: 100%;
    height: 82px;
    object-fit: contain;
    filter: grayscale(100%) brightness(0.6);
}

/* PvP Waiting Overlay */
#pvp-waiting-overlay {
    font-family: 'Press Start 2P', cursive;
}
#pvp-waiting-overlay .waiting-title {
    font-size: 14px;
    color: #ffea00;
    text-shadow: 0 0 20px #ffea00;
    animation: blink 0.8s step-start infinite;
    margin-bottom: 24px;
}
#pvp-waiting-overlay .waiting-room {
    font-size: 10px;
    color: #39ff14;
    margin-bottom: 8px;
}
#pvp-waiting-overlay .waiting-hint {
    font-size: 8px;
    color: #aaa;
    margin-bottom: 16px;
}
