:root {
  color-scheme: dark;
  --bg-a: #121826;
  --bg-b: #26334b;
  --ink: #f4f7fb;
  --muted: #9fb2c9;
  --gold: #f6c66b;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overscroll-behavior: none;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 12%, rgba(76, 184, 196, 0.28), transparent 28rem),
    radial-gradient(circle at 82% 78%, rgba(246, 198, 107, 0.2), transparent 26rem),
    linear-gradient(135deg, var(--bg-a), var(--bg-b));
  color: var(--ink);
  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  overflow: hidden;
  touch-action: none;
}

.shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  gap: 12px;
  padding: 18px;
}

.game-frame {
  position: relative;
  width: min(100vw - 28px, 1120px);
  aspect-ratio: 16 / 9;
  max-height: calc(100vh - 74px);
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: #08111d;
  box-shadow:
    0 28px 90px rgba(0, 0, 0, 0.42),
    inset 0 0 0 4px rgba(255, 255, 255, 0.04);
}

.boot-status {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-content: center;
  gap: 10px;
  padding: 28px;
  background: #08111d;
  color: #fff2c6;
  text-align: center;
  pointer-events: none;
}

.boot-status strong {
  font-size: clamp(18px, 2.5vw, 26px);
}

.boot-status span {
  max-width: 560px;
  color: #c6d7ea;
  font-size: clamp(13px, 1.8vw, 16px);
}

.boot-status.is-hidden {
  display: none;
}

.boot-status.is-error {
  border: 2px solid rgba(239, 107, 107, 0.78);
  color: #ffd6d6;
}

.mobile-pc-warning {
  display: none;
}

#game-container {
  width: 100%;
  height: 100%;
  touch-action: none;
  display: grid;
  place-items: center;
  overflow: hidden;
}

#game-container canvas {
  display: block;
  max-width: 100vw;
  max-height: var(--app-height, 100vh);
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

#game-container:fullscreen {
  width: 100vw;
  height: 100vh;
  background: #050812;
  display: grid;
  place-items: center;
}

#game-container:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  background: #050812;
  display: grid;
  place-items: center;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: clamp(12px, 1.7vw, 15px);
  text-align: center;
}

@media (max-width: 720px) {
  html,
  body {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: var(--app-height, 100svh);
    overflow: hidden;
    background: #050812;
  }

  body {
    min-height: var(--app-height, 100svh);
  }

  .shell {
    position: fixed;
    inset: 0;
    min-height: var(--app-height, 100svh);
    width: 100vw;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    display: block;
  }

  .game-frame {
    width: 100vw;
    height: var(--app-height, 100svh);
    max-width: none;
    max-height: none;
    aspect-ratio: auto;
    border: 0;
    box-shadow: none;
  }

  .hint {
    display: none;
  }
}

@media (pointer: coarse) {
  html,
  body {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: var(--app-height, 100svh);
    overflow: hidden;
    background: #050812;
  }

  .shell {
    position: fixed;
    inset: 0;
    min-height: var(--app-height, 100svh);
    width: 100vw;
    padding: 0;
    display: block;
  }

  .game-frame {
    width: 100vw;
    height: var(--app-height, 100svh);
    max-width: none;
    max-height: none;
    aspect-ratio: auto;
    border: 0;
    box-shadow: none;
  }

  .hint {
    display: none;
  }

  .mobile-pc-warning {
    position: fixed;
    left: 50%;
    bottom: max(12px, env(safe-area-inset-bottom));
    z-index: 20;
    display: block;
    width: min(92vw, 520px);
    transform: translateX(-50%);
    padding: 10px 14px;
    border: 2px solid rgba(242, 196, 95, 0.9);
    border-radius: 8px;
    background: rgba(8, 17, 29, 0.88);
    color: #fff2c6;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
    text-align: center;
    pointer-events: none;
  }
}

@media (pointer: coarse) and (orientation: portrait) {
  .game-frame::before {
    content: "Gira tu celular. Recomendado jugar desde PC.";
    position: fixed;
    top: max(18px, env(safe-area-inset-top));
    left: 50%;
    z-index: 5;
    transform: translateX(-50%);
    padding: 8px 14px;
    border: 2px solid rgba(242, 196, 95, 0.8);
    border-radius: 8px;
    background: rgba(8, 17, 29, 0.86);
    color: #fff2c6;
    font-size: 13px;
    font-weight: 700;
    pointer-events: none;
  }
}
