/* ============================================================
   VivPac v2 - estilos (PC + celular, regla 15)
   ============================================================ */
:root {
    --vp-bg: #000;
    --vp-text: #fff;
    --vp-blue: #22e0ff;
    --vp-yellow: #ffe000;
    --vp-red: #dc2626;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
    background: var(--vp-bg); color: var(--vp-text);
    font-family: "Courier New", Courier, monospace;
    display: flex; justify-content: center; align-items: center;
    overflow: hidden; user-select: none; -webkit-user-select: none;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
#vivpac-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; max-width: 100%; }

/* ---------- HUD ---------- */
#vivpac-hud {
    display: flex; align-items: center; justify-content: space-between; gap: 6px;
    width: 560px; max-width: 100%; padding: 6px 10px;
    background: #0a0a0a; border: 2px solid var(--vp-blue); border-radius: 8px;
    box-shadow: 0 0 15px rgba(34, 224, 255, .3);
}
#vp-exit {
    flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%;
    background: var(--vp-red); color: #fff; text-decoration: none;
    display: flex; align-items: center; justify-content: center;
    font: bold 14px/1 Arial, sans-serif;
}
.vp-hud-item { display: flex; flex-direction: column; align-items: center; min-width: 0; }
.vp-hud-item span { font-size: 10px; font-weight: bold; color: var(--vp-blue); letter-spacing: 1px; }
.vp-hud-item strong { font-size: 18px; line-height: 1.1; color: #fff; }
#vp-lives { color: var(--vp-yellow); letter-spacing: 1px; }
.vp-hud-tools { display: flex; gap: 6px; }
.vp-hud-tools button {
    width: 30px; height: 30px; border-radius: 6px; cursor: pointer;
    background: transparent; color: #fff; border: 1px solid var(--vp-blue); font-size: 14px;
}
.vp-hud-tools button:hover { background: rgba(34, 224, 255, .2); }
.vp-danger { font-style: normal; font-size: 9px; font-weight: bold; letter-spacing: 1px; line-height: 1; }
.vp-danger:empty { display: none; }
.vp-danger.lvl-mid { color: #ffd24a; }
.vp-danger.lvl-high { color: #ff8a3a; }
.vp-danger.lvl-extreme { color: #ff2b4e; animation: vp-blink .8s infinite; }
@keyframes vp-blink { 50% { opacity: .35; } }

/* ---------- Escenario ---------- */
#vivpac-stage {
    position: relative; background: #000; border: 2px solid #111; border-radius: 4px;
    box-shadow: 0 0 30px rgba(0, 0, 0, .8); touch-action: none; line-height: 0;
}
#vivpac-canvas { display: block; touch-action: none; }

/* ---------- Pantalla superpuesta ---------- */
.vp-overlay {
    position: absolute; inset: 0; z-index: 10; padding: 12px; line-height: 1.3;
    background: rgba(0, 0, 0, .86);
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
    overflow-y: auto; text-align: center;
}
.vp-overlay.hidden, .hidden { display: none !important; }
.vp-overlay h1 {
    font-size: clamp(30px, 9vw, 48px); color: var(--vp-yellow); letter-spacing: 4px;
    text-shadow: 0 0 20px rgba(255, 224, 0, .6);
}
.vp-hint { font-size: 14px; color: #cfeaff; min-height: 18px; }
#vp-btn-start, #vp-name-form button {
    padding: 12px 28px; font: bold 18px "Courier New", monospace; cursor: pointer;
    background: transparent; color: var(--vp-yellow);
    border: 2px solid var(--vp-yellow); border-radius: 5px; transition: all .2s;
}
#vp-btn-start:hover, #vp-name-form button:hover {
    background: var(--vp-yellow); color: #000; box-shadow: 0 0 20px rgba(255, 224, 0, .8);
}
#vp-name-form { display: flex; flex-direction: column; gap: 6px; align-items: center; }
#vp-name-form label { font-size: 14px; color: #fff; }
.vp-name-row { display: flex; gap: 8px; }
#vp-name-form input {
    width: 130px; padding: 8px; text-align: center; text-transform: uppercase;
    font: bold 18px "Courier New", monospace; letter-spacing: 3px;
    background: #0a0a0a; color: #fff; border: 2px solid var(--vp-blue); border-radius: 5px; outline: none;
}
#vp-name-form button { padding: 8px 14px; font-size: 15px; }
#vp-top-scores { width: 100%; max-width: 280px; font-size: 14px; }
#vp-top-scores h3 { color: var(--vp-blue); margin-bottom: 4px; letter-spacing: 2px; }
#vp-top-scores div { display: flex; justify-content: space-between; padding: 1px 0; color: #fff; }
#vp-top-scores div:first-of-type { color: var(--vp-yellow); }

/* ---------- Cruceta tactil (solo en dispositivos tactiles) ---------- */
#vivpac-touch {
    display: none; width: 168px; height: 112px; position: relative; flex: 0 0 auto;
}
body.vp-touch #vivpac-touch { display: block; }
#vivpac-touch button {
    position: absolute; width: 54px; height: 54px; border-radius: 12px;
    background: rgba(34, 224, 255, .12); color: var(--vp-blue);
    border: 2px solid var(--vp-blue); font-size: 22px; touch-action: none;
}
#vivpac-touch button:active { background: rgba(34, 224, 255, .45); }
.d-up { left: 57px; top: 0; }
.d-left { left: 0; top: 56px; }
.d-right { left: 114px; top: 56px; }
.d-down { left: 57px; top: 56px; }

/* ---------- Responsivo ---------- */
@media (max-width: 768px) {
    #vivpac-wrap { gap: 6px; }
    .vp-hud-item strong { font-size: 16px; }
}
@media (max-width: 480px) {
    #vivpac-hud { padding: 5px 6px; gap: 3px; }
    .vp-hud-item span { font-size: 8px; letter-spacing: 0; }
    .vp-hud-item strong { font-size: 14px; }
    #vp-exit { width: 26px; height: 26px; }
    .vp-hud-tools button { width: 26px; height: 26px; font-size: 12px; }
    .vp-hint { font-size: 12px; }
    #vp-btn-start { padding: 10px 20px; font-size: 16px; }
    #vp-top-scores { font-size: 12px; }
}
/* Celular en horizontal: sin cruceta (se desliza sobre el juego) */
@media (orientation: landscape) and (max-height: 520px) {
    body.vp-touch #vivpac-touch { display: none; }
    .vp-overlay { gap: 6px; padding: 6px; }
    .vp-overlay h1 { font-size: 26px; }
}
