:root {
  --page-bg:    #0d1117;
  --window-bg:  #161b22;
  --text:       #e6edf3;
  --muted:      #8b949e;
  --accent:     #58a6ff;
  --btn-bg:     #21262d;
  --btn-text:   #c9d1d9;
  --btn-hover:  #30363d;
  --border:     #30363d;
  --tag-bg:     #1a2740;
  --tag-text:   #79c0ff;
  --warn-bg:    rgba(210, 153, 34, 0.1);
  --warn-border:#9e6a03;
  --warn-text:  #e3b341;
}

:root { color-scheme: dark; }

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

::-webkit-scrollbar             { width: 8px; height: 8px; }
::-webkit-scrollbar-track       { background: transparent; }
::-webkit-scrollbar-thumb       { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--page-bg);
  color: var(--text);
  line-height: 1.5;
}

::selection { background: rgba(88, 166, 255, 0.25); color: var(--text); }

a { color: var(--accent); }

/* ---------- Cabecera (igual que la web) ---------- */

.container { max-width: 1100px; margin: 0 auto; padding: 1.5rem 2rem; }

.nav { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }

.logo { color: var(--text); font-weight: 600; text-decoration: none; transition: opacity 0.15s; }
.logo:hover { opacity: 0.75; }

.lang { display: flex; gap: 0.5rem; }
.lang button {
  background: none; border: 0; cursor: pointer; font: inherit;
  color: var(--muted); font-size: 0.9rem; font-weight: 500;
  padding: 2px 6px; border-radius: 4px; transition: color 0.15s;
}
.lang button[aria-pressed="true"] { color: var(--text); background: var(--btn-bg); }
.lang button:hover { color: var(--text); }

/* ---------- Escritorio: información + móvil ---------- */

.stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3rem;
  align-items: center;
  padding-top: 0.5rem;
  padding-bottom: 1.5rem;
}

.window {
  background: var(--window-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 1px 0 rgba(255, 255, 255, 0.04);
  padding: 1.75rem 2.25rem;
}

.game-heading { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.game-logo {
  width: 72px; height: 72px; flex: 0 0 72px;
  object-fit: contain; image-rendering: pixelated;
}

h1 { font-size: 2.2rem; margin: 0 0 0.3rem; }
h2 { font-size: 1.2rem; font-weight: 400; color: var(--muted); margin: 0; }

.intro { margin: 0.75rem 0; line-height: 1.65; color: var(--muted); max-width: 560px; }

.tags { margin: 0.5rem 0 1.25rem; }
.tag {
  display: inline-block; margin: 2px 3px 2px 0; padding: 3px 10px;
  background: var(--tag-bg); color: var(--tag-text); border-radius: 20px;
  font-size: 0.8rem; font-weight: 500;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
}

.notice {
  border: 1px solid var(--warn-border);
  background: var(--warn-bg);
  border-radius: 10px;
  padding: 0.8rem 1.1rem;
  margin: 1rem 0;
  font-size: 0.92rem;
  line-height: 1.6;
}
.notice strong { color: var(--warn-text); }
.notice ul { margin: 0.5rem 0 0; padding-left: 1.2rem; color: var(--btn-text); }
.notice li { margin-bottom: 0.25rem; }

.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.25rem; }

.btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.5rem 1rem;
  background: var(--btn-bg); color: var(--btn-text);
  border: 1px solid var(--border); border-radius: 8px;
  text-decoration: none; font: inherit; font-weight: 500; font-size: 0.9rem;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.btn:hover { background: var(--btn-hover); border-color: var(--muted); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.primary { background: var(--accent); color: #0d1117; border-color: var(--accent); }
.btn.primary:hover { background: #79c0ff; border-color: #79c0ff; }

/* ---------- Ventana de macOS ---------- */

/* BlockFall es un juego de escritorio: en el ordenador se muestra dentro de
   una ventana de macOS (modo oscuro) en vez de en un marco de móvil. */
/* La columna toma el ancho de la ventana; la ayuda se ajusta a ese ancho. */
.app-column { width: min-content; }

.mac-window {
  border-radius: 11px;
  overflow: hidden;
  background: #000;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.6),
    0 30px 80px rgba(0, 0, 0, 0.6),
    0 10px 25px rgba(0, 0, 0, 0.35);
}

.titlebar {
  position: relative;
  height: 30px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(#3b3b3d, #2e2e30);
  border-bottom: 1px solid #000;
  user-select: none;
}
.titlebar .title { color: #d0d0d2; font-size: 13px; font-weight: 600; }

.traffic {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  display: flex; gap: 8px;
}
.traffic span {
  width: 12px; height: 12px; border-radius: 50%;
  box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.35);
}
.traffic .close    { background: #ff5f57; }
.traffic .minimize { background: #febc2e; }
.traffic .zoom     { background: #28c840; }

/* El juego es vertical (540 × 960). La ventana tiene el mismo ancho que el
   marco del móvil de las otras demos (390 / 844 de la altura disponible),
   para que la ficha mida lo mismo; pygbag ajusta el lienzo al iframe. */
.screen {
  width: min(390px, calc((100dvh - 10rem) * 390 / 844));
  aspect-ratio: 540 / 960;
  background: #000;
}
.screen iframe { display: block; width: 100%; height: 100%; border: 0; background: #000; }

.hint { text-align: center; color: var(--muted); font-size: 0.82rem; margin-top: 0.9rem; }

/* ---------- Móvil real: la app a pantalla completa ---------- */

.mobile-only { display: none; }

@media (max-width: 760px), (max-height: 560px) {
  body { overflow: hidden; }
  header, .stage { display: none; }
  .mobile-only { display: block; }

  .fullscreen-app {
    position: fixed; inset: 0;
    width: 100vw; height: 100dvh;
    border: 0; background: #000;
  }

  /* Botón de información, discreto en el borde derecho */
  .info-fab {
    position: fixed; right: 0; top: 50%; transform: translateY(-50%);
    z-index: 2;
    width: 30px; height: 52px;
    border: 1px solid var(--border); border-right: 0;
    border-radius: 12px 0 0 12px;
    background: rgba(22, 27, 34, 0.85); color: var(--text);
    font: 600 1rem/1 Georgia, serif; cursor: pointer;
    backdrop-filter: blur(6px);
  }

  /* Hoja de información */
  .sheet {
    position: fixed; inset: auto 0 0 0; z-index: 3;
    max-height: 88dvh; overflow-y: auto;
    background: var(--window-bg);
    border-top: 1px solid var(--border);
    border-radius: 18px 18px 0 0;
    padding: 1.25rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom));
    box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.6);
    transform: translateY(105%);
    transition: transform 0.25s ease;
  }
  .sheet.open { transform: none; }
  .sheet-backdrop {
    position: fixed; inset: 0; z-index: 2;
    background: rgba(1, 4, 9, 0.6);
    opacity: 0; pointer-events: none; transition: opacity 0.25s ease;
  }
  .sheet-backdrop.open { opacity: 1; pointer-events: auto; }
  .sheet .game-heading { gap: 0.8rem; }
  .sheet .game-logo { width: 56px; height: 56px; flex-basis: 56px; }
  .sheet h1 { font-size: 1.6rem; }
  .sheet .grabber { width: 40px; height: 4px; border-radius: 2px; background: var(--border); margin: -0.25rem auto 1rem; }
  .sheet .actions .btn { flex: 1 1 auto; justify-content: center; }
}
