/* ═══════════════════════════════════════════════════════════════════
   UrnaGames — Landing / Home
   Secuencia: POST (BIOS) → Boot (Windows loading) → Escritorio Win95
   Mobile-first. Requiere tokens.css + VT323 + Press Start 2P + Inter
   ═══════════════════════════════════════════════════════════════════ */

/* ── Reset ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  margin: 0;
  padding: 0;
}
body { background: #000; }

/* ── Fases — capas full-screen fijas ──────────────────────────── */
.ug-phase {
  position: fixed;
  inset: 0;
  transition: opacity 0.35s ease;
}
.ug-phase[hidden] { display: none !important; }
.ug-phase.ug-fading {
  opacity: 0 !important;
  pointer-events: none;
}

/* ══ FASE 1: POST / BIOS ══════════════════════════════════════════ */
#ug-post {
  background: #000;
  padding: 18px 16px;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
}

.ug-post-inner {
  max-width: 640px;
  width: 100%;
  display: flex;
  flex-direction: column;
}

.ug-post-line {
  font-family: 'VT323', 'Courier New', monospace;
  font-size: 1rem;
  color: #c0c0c0;
  line-height: 1.5;
  white-space: pre-wrap;
  opacity: 0;
  transition: opacity 0.07s;
}
.ug-post-line.ug-vis { opacity: 1; }

.ug-cl-white  { color: #ffffff; }
.ug-cl-green  { color: #00b800; }
.ug-cl-yellow { color: #c8b400; }
.ug-cl-dim    { color: #606060; }

.ug-post-skip {
  margin-top: 16px;
  color: #505050;
  font-size: 0.85rem;
  animation: ug-blink 1.1s step-end infinite;
}

/* ══ FASE 2: BOOT (Windows loading) ═══════════════════════════════ */
#ug-boot {
  background: #000080;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
  cursor: pointer;
  opacity: 0;
}

.ug-boot-logo {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(1.3rem, 7vw, 2.6rem);
  color: #fff;
  text-align: center;
  line-height: 1.5;
}

.ug-boot-ver {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(0.45rem, 2.2vw, 0.7rem);
  color: #9090c0;
  text-align: center;
  letter-spacing: 3px;
  margin-top: -10px;
}

.ug-boot-bar-wrap {
  width: min(260px, 75vw);
  height: 22px;
  background: #00004a;
  box-shadow: inset 1px 1px 0 #00003a, inset -1px -1px 0 #6060a0;
  padding: 3px;
  margin-top: 8px;
}

.ug-boot-bar-fill {
  height: 100%;
  width: 0%;
  background-image: repeating-linear-gradient(
    to right,
    #c0c0c0 0px, #c0c0c0 9px,
    transparent 9px, transparent 11px
  );
  transition: width 1.6s steps(13);
}

.ug-boot-tagline {
  font-family: 'VT323', monospace;
  font-size: clamp(0.9rem, 4vw, 1.2rem);
  color: #9090c0;
  text-align: center;
  max-width: 280px;
  line-height: 1.45;
  margin-top: 4px;
}

/* ══ FASE 3: LANDING PAGE ═════════════════════════════════════════ */
#ug-landing {
  background: #008080;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  opacity: 0;
  display: flex;
  flex-direction: column;
}

.ug-land-scroll {
  min-height: 100%;
  flex-shrink: 0; /* no comprimir la columna: dejar que crezca y que #ug-landing scrollee.
                     Sin esto, el flex clampa la columna al viewport y aplasta el video-wrap. */
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 16px 32px;
  gap: 22px;
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
}

/* ── Header ─────────────────────────────────────────────────── */
.ug-land-header { text-align: center; }

.ug-land-title {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(1.2rem, 5vw, 2rem);
  color: #fff;
  text-shadow: 3px 3px 0 rgba(0,0,0,0.25);
  margin: 0 0 10px;
  line-height: 1.4;
}

.ug-land-sub {
  font-family: 'VT323', monospace;
  font-size: clamp(1rem, 4.5vw, 1.3rem);
  color: rgba(255,255,255,0.85);
  margin: 0;
  line-height: 1.4;
}

/* ── Plaza de Mayo — video ───────────────────────────────────── */
.ug-plaza-wrap {
  width: 100%;
  max-width: 560px;
  flex-shrink: 0; /* refuerzo: el recuadro del video nunca debe comprimirse */
  border: 2px solid #606060;
  box-shadow: 2px 2px 0 #fff inset,
              -2px -2px 0 #404040 inset,
              4px 8px 20px rgba(0,0,0,0.45);
  background: #000;
  overflow: hidden;
}

.ug-plaza-tb {
  background: linear-gradient(to right, #000080, #1084d0);
  color: #fff;
  font-family: 'VT323', monospace;
  font-size: 0.9rem;
  padding: 3px 8px 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  line-height: 1;
}

.ug-plaza-dot {
  font-size: 0.55rem;
  color: #FF4444;
  animation: ug-blink 1.2s step-end infinite;
}

.ug-plaza-video-box {
  width: 100%;
  height: 56.25vw; /* 16:9 — igual que el ancho del viewport */
  min-height: 180px; /* fallback si vw no computa bien en mobile */
  max-height: 315px; /* techo: 16:9 del max-width 560px */
  overflow: hidden;
  background: #111;
}

.ug-plaza-video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
}

/* ── Separador de sección ────────────────────────────────────── */
.ug-games-hdr {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
}
.ug-ghdr-line {
  flex: 1;
  height: 1px;
  background: rgba(255,255,255,0.25);
}
.ug-ghdr-txt {
  font-family: 'VT323', monospace;
  font-size: 0.88rem;
  color: rgba(255,255,255,0.65);
  letter-spacing: 2px;
  white-space: nowrap;
}

/* ── Cards de juegos ─────────────────────────────────────────── */
.ug-games {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ug-game-win {
  background: #C0C0C0;
  box-shadow: 2px 2px 0 #fff inset,
              -2px -2px 0 #808080 inset,
              3px 4px 0 rgba(0,0,0,0.4);
  opacity: 0.5;
}
.ug-game-win.ug-game-active {
  opacity: 1;
  cursor: pointer;
  box-shadow: 2px 2px 0 #fff inset,
              -2px -2px 0 #808080 inset,
              4px 5px 0 rgba(0,0,0,0.45);
}
.ug-game-win.ug-game-active:active {
  box-shadow: 1px 1px 0 #808080 inset, -1px -1px 0 #fff inset, 2px 2px 0 rgba(0,0,0,0.3);
}

.ug-game-tb {
  background: #808080;
  color: rgba(255,255,255,0.7);
  font-family: 'VT323', monospace;
  font-size: 1rem;
  padding: 5px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  letter-spacing: 0.02em;
}
.ug-game-win.ug-game-active .ug-game-tb {
  background: linear-gradient(to right, #000080, #1084d0);
  color: #fff;
}

.ug-game-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
}

/* Fila superior: ícono + título al mismo nivel ────────────────── */
.ug-game-top {
  display: flex;
  align-items: center;
  gap: 14px;
}

.ug-game-icon {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  image-rendering: pixelated;
}
.ug-game-icon svg { width: 56px; height: 56px; }

.ug-game-name {
  font-family: 'VT323', monospace;
  font-size: 1.45rem;
  color: #000;
  line-height: 1.15;
  letter-spacing: 0.01em;
}

/* Descripción + CTA debajo ──────────────────────────────────── */
.ug-game-desc {
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
  color: #333;
  line-height: 1.5;
}

.ug-game-cta {
  align-self: flex-start;
  height: 26px;
  padding: 0 16px;
  background: #C0C0C0;
  border: none;
  box-shadow: 1px 1px 0 #fff inset,
              -1px -1px 0 #808080 inset,
              2px 2px 0 #dfdfdf inset,
              -2px -2px 0 #5a5a5a inset;
  font-family: 'VT323', monospace;
  font-size: 1rem;
  color: #000;
  cursor: pointer;
  line-height: 1;
}
.ug-game-cta:active {
  box-shadow: 1px 1px 0 #808080 inset, -1px -1px 0 #fff inset,
              2px 2px 0 #5a5a5a inset, -2px -2px 0 #dfdfdf inset;
  padding-top: 1px;
}

.ug-soon-badge {
  align-self: flex-start;
  font-family: 'VT323', monospace;
  font-size: 0.78rem;
  color: #808080;
  background: #d0d0d0;
  padding: 2px 10px;
  box-shadow: -1px -1px 0 #fff, 1px 1px 0 #808080;
  letter-spacing: 1px;
  display: inline-block;
}

/* ── Footer ──────────────────────────────────────────────────── */
.ug-land-footer {
  font-family: 'VT323', monospace;
  font-size: 0.82rem;
  color: rgba(255,255,255,0.5);
  display: flex;
  align-items: center;
  gap: 8px;
}
.ug-land-sep { opacity: 0.4; }
.ug-land-easter {
  background: none;
  border: none;
  color: rgba(255,255,255,0.25);
  font-size: 0.6rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
.ug-land-easter:hover { color: rgba(255,255,255,0.6); }

/* ── Desktop (≥640px): cards en fila horizontal ─────────────── */
@media (min-width: 640px) {
  .ug-land-scroll { max-width: 860px; }
  .ug-plaza-wrap  { max-width: 820px; }
  .ug-games-hdr   { max-width: 820px; }

  .ug-games {
    flex-direction: row;
    align-items: stretch;
    max-width: 820px;
  }
  .ug-game-win { flex: 1; }

  /* Cards más compactas en desktop */
  .ug-game-body  { padding: 10px 12px; gap: 7px; }
  .ug-game-top   { gap: 10px; }
  .ug-game-icon, .ug-game-icon svg { width: 40px; height: 40px; }
  .ug-game-name  { font-size: 1.2rem; }
  .ug-game-desc  { font-size: 0.72rem; }
  .ug-game-cta   { height: 22px; font-size: 0.9rem; padding: 0 12px; }
  .ug-soon-badge { font-size: 0.72rem; }
}

/* ── dead code section (kept for overlay/easter egg) ────────── */
.ug-wallpaper {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.ug-wallpaper svg {
  width: min(90vmin, 520px);
  height: min(90vmin, 520px);
  opacity: 1;
}

/* ── Íconos de juego: centrados ──────────────────────────────── */
.ug-icons-games {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-content: center;
  gap: 4px;
  padding: 16px 8px 8px;
  z-index: 1;
  position: relative;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* ── Mi PC: esquina superior izquierda ───────────────────────── */
.ug-icons-topleft {
  position: absolute;
  top: 8px;
  left: 6px;
  z-index: 1;
}

/* ── Papelera: esquina inferior izquierda ────────────────────── */
.ug-icons-bottomleft {
  position: absolute;
  bottom: 52px;
  left: 6px;
  z-index: 1;
}

/* ── Archivos sueltos: esquina superior derecha ──────────────── */
.ug-icons-docs {
  position: absolute;
  top: 8px;
  right: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 1;
}

/* ── Sticky note ─────────────────────────────────────────────── */
.ug-sticky {
  position: absolute;
  bottom: 58px;
  right: 14px;
  width: 116px;
  background: #FFFF88;
  border-left: 4px solid #D4B000;
  padding: 8px 8px 12px;
  font-family: 'VT323', monospace;
  font-size: 0.85rem;
  color: #333;
  line-height: 1.45;
  white-space: pre-line;
  transform: rotate(-2.5deg);
  box-shadow: 3px 4px 8px rgba(0,0,0,0.25);
  z-index: 3;
  pointer-events: none;
}

/* ── Íconos de juego: más grandes ────────────────────────────── */
.ug-icons-games .ug-icon {
  width: 100px;
  min-height: 100px;
  padding: 10px 6px 8px;
}
.ug-icons-games .ug-icon-img,
.ug-icons-games .ug-icon-img svg {
  width: 80px;
  height: 80px;
}
.ug-icons-games .ug-icon-label {
  font-size: 0.88rem;
  max-width: 96px;
}

.ug-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  padding: 8px 4px 6px;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  min-height: 80px;
  border-radius: 1px;
}

.ug-icon:active,
.ug-icon.ug-sel {
  background: rgba(0, 0, 128, 0.45);
  outline: 1px dotted rgba(255, 255, 255, 0.8);
  outline-offset: 0;
}

.ug-icon[data-ready="false"] {
  opacity: 0.42;
  cursor: default;
}

.ug-icon-img {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  image-rendering: pixelated;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ug-icon-img svg { width: 48px; height: 48px; }

.ug-icon-label {
  font-family: 'VT323', monospace;
  font-size: 0.78rem;
  color: #fff;
  text-align: center;
  text-shadow: 1px 1px 0 #000,
               -1px 0 0 #000,
                0 -1px 0 #000;
  line-height: 1.25;
  max-width: 84px;
  word-break: break-word;
  white-space: pre-line;
}

/* ── Taskbar ────────────────────────────────────────────────── */
.ug-taskbar {
  height: 44px;
  background: #c0c0c0;
  border-top: 2px solid #fff;
  box-shadow: 0 -1px 0 #808080;
  display: flex;
  align-items: center;
  padding: 0 4px;
  gap: 4px;
  flex-shrink: 0;
  z-index: 50;
}

.ug-start-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding: 0 10px;
  background: #c0c0c0;
  border: none;
  box-shadow: 1px 1px 0 #fff inset,
              -1px -1px 0 #808080 inset,
              2px 2px 0 #dfdfdf inset,
              -2px -2px 0 #5a5a5a inset;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.42rem;
  font-weight: 700;
  color: #000;
  cursor: pointer;
  letter-spacing: 0;
  flex-shrink: 0;
}
.ug-start-btn:active {
  box-shadow: 1px 1px 0 #808080 inset,
              -1px -1px 0 #fff inset,
              2px 2px 0 #5a5a5a inset,
              -2px -2px 0 #dfdfdf inset;
  padding-top: 1px;
  padding-left: 11px;
}

.ug-start-flag {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  image-rendering: pixelated;
}

.ug-taskbar-spacer { flex: 1; }

.ug-taskbar-clock {
  font-family: 'VT323', monospace;
  font-size: 1rem;
  color: #000;
  padding: 3px 8px;
  line-height: 1.4;
  border: 1px solid;
  border-color: #808080 #fff #fff #808080;
  flex-shrink: 0;
  white-space: nowrap;
}

/* ══ OVERLAY: ventana de descripción de ícono ═════════════════════ */
#ug-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.32);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
#ug-overlay[hidden] { display: none; }

.ug-ov-win {
  background: #c0c0c0;
  box-shadow: 2px 2px 0 #fff inset,
              -2px -2px 0 #808080 inset,
              4px 4px 0 #000;
  width: 100%;
  max-width: 300px;
}

.ug-ov-titlebar {
  background: linear-gradient(to right, #000080 0%, #1084d0 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px;
  gap: 6px;
}

.ug-ov-title-text {
  font-family: 'VT323', monospace;
  font-size: 0.92rem;
  color: #fff;
  flex: 1;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ug-ov-close {
  width: 18px;
  height: 16px;
  background: #c0c0c0;
  border: none;
  box-shadow: 1px 1px 0 #fff inset, -1px -1px 0 #808080 inset;
  font-size: 0.6rem;
  font-family: sans-serif;
  font-weight: bold;
  cursor: pointer;
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
  line-height: 1;
}

.ug-ov-body {
  padding: 20px 18px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.ug-ov-icon {
  width: 56px;
  height: 56px;
  image-rendering: pixelated;
}
.ug-ov-icon svg { width: 56px; height: 56px; }

.ug-ov-name {
  font-family: 'VT323', monospace;
  font-size: 1.15rem;
  color: #000;
  line-height: 1.2;
}

.ug-ov-soon-badge {
  font-family: 'VT323', monospace;
  font-size: 0.8rem;
  color: #808080;
  background: #d8d8d8;
  padding: 2px 10px;
  box-shadow: -1px -1px 0 #fff, 1px 1px 0 #808080;
  letter-spacing: 1px;
}

.ug-ov-desc {
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  color: #333;
  line-height: 1.5;
}

.ug-ov-buttons {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.ug-win-btn {
  height: 26px;
  padding: 0 20px;
  background: #c0c0c0;
  border: none;
  box-shadow: 1px 1px 0 #fff inset,
              -1px -1px 0 #808080 inset,
              2px 2px 0 #dfdfdf inset,
              -2px -2px 0 #5a5a5a inset;
  font-family: 'VT323', monospace;
  font-size: 1rem;
  color: #000;
  cursor: pointer;
  line-height: 1;
  min-width: 72px;
}
.ug-win-btn:active {
  box-shadow: 1px 1px 0 #808080 inset,
              -1px -1px 0 #fff inset,
              2px 2px 0 #5a5a5a inset,
              -2px -2px 0 #dfdfdf inset;
  padding-top: 1px;
}
.ug-win-btn:disabled {
  color: #808080;
  cursor: default;
}
.ug-win-btn:disabled:active {
  box-shadow: 1px 1px 0 #fff inset,
              -1px -1px 0 #808080 inset,
              2px 2px 0 #dfdfdf inset,
              -2px -2px 0 #5a5a5a inset;
  padding-top: 0;
}

/* ══ EASTER EGG dialog ════════════════════════════════════════════ */
#ug-easter {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.32);
  z-index: 210;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
#ug-easter[hidden] { display: none; }

.ug-ea-win {
  background: #c0c0c0;
  box-shadow: 2px 2px 0 #fff inset,
              -2px -2px 0 #808080 inset,
              4px 4px 0 #000;
  width: 100%;
  max-width: 320px;
}

.ug-ea-titlebar {
  background: linear-gradient(to right, #000080 0%, #1084d0 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px;
  gap: 6px;
}

.ug-ea-title {
  font-family: 'VT323', monospace;
  font-size: 0.92rem;
  color: #fff;
  flex: 1;
  line-height: 1.4;
}

.ug-ea-close {
  width: 18px;
  height: 16px;
  background: #c0c0c0;
  border: none;
  box-shadow: 1px 1px 0 #fff inset, -1px -1px 0 #808080 inset;
  font-size: 0.6rem;
  font-family: sans-serif;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
}

.ug-ea-body {
  font-family: 'VT323', monospace;
  font-size: 0.88rem;
  color: #000;
  line-height: 1.55;
  white-space: pre-wrap;
  background: #fff;
  box-shadow: 1px 1px 0 #808080 inset, -1px -1px 0 #fff inset;
  margin: 10px;
  padding: 10px;
  max-height: 240px;
  overflow-y: auto;
}

.ug-ea-footer {
  display: flex;
  justify-content: center;
  padding: 0 10px 12px;
}

/* ══ Animaciones ═══════════════════════════════════════════════════ */
@keyframes ug-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ══ Responsive ═══════════════════════════════════════════════════ */
@media (min-width: 768px) {
  #ug-post { padding: 28px 36px; }
  .ug-post-line { font-size: 1.1rem; }

  .ug-icons-games { gap: 8px; padding: 20px 16px 8px; }
  .ug-icon { min-height: 88px; }
  .ug-taskbar { height: 40px; }
  .ug-icons-system { bottom: 48px; left: 8px; }
}

/* ── Desktop — hover ─────────────────────────────────────────── */
@media (min-width: 1024px) and (hover: hover) {
  .ug-icons-games { gap: 12px; }

  .ug-icon:hover {
    background: rgba(0, 0, 128, 0.35);
    outline: 1px dotted rgba(255, 255, 255, 0.7);
    outline-offset: 0;
  }

  .ug-icon[data-ready="false"]:hover {
    background: transparent;
    outline: none;
  }

  .ug-icon[data-ready="true"]:hover .ug-icon-label {
    background: rgba(0, 0, 128, 0.85);
    padding: 1px 4px;
  }
}

/* ══ Reduced motion ═══════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  .ug-phase { transition: none; }
  .ug-boot-bar-fill { transition: none; width: 100% !important; }
  .ug-post-line { opacity: 1 !important; transition: none; }
  .ug-post-skip { animation: none; opacity: 0.55; }
  #ug-boot, #ug-desktop { opacity: 1 !important; }
}
