/* PIXR GTA — night asphalt / sodium amber / miami teal */
@import url("https://fonts.googleapis.com/css2?family=Bebas+Neue&family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,700;1,9..40,400&display=swap");

:root {
  --bg0: #0a0c10;
  --bg1: #12161e;
  --asphalt: #1a2030;
  --line: rgba(255, 214, 140, 0.16);
  --text: #f3efe6;
  --muted: #9aa3b5;
  --amber: #f0b429;
  --amber-dim: #c4891a;
  --teal: #2ec4b6;
  --danger: #e85d4c;
  --ok: #6fcf97;
  --warn: #f2c94c;
  --accent: var(--amber);
  --radius: 4px;
  --radius-lg: 14px;
  --font-display: "Bebas Neue", Impact, sans-serif;
  --font-body: "DM Sans", system-ui, sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg0);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}
html {
  scroll-behavior: smooth;
}

body {
  background:
    radial-gradient(1200px 600px at 70% -10%, rgba(240, 180, 41, 0.14), transparent 55%),
    radial-gradient(900px 500px at -10% 80%, rgba(46, 196, 182, 0.1), transparent 50%),
    linear-gradient(180deg, #0b0e14 0%, #10141c 40%, #0a0c10 100%);
  background-attachment: fixed;
}
body.modal-open {
  overflow: hidden;
}

a {
  color: var(--teal);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
code {
  font-size: 0.85em;
  background: rgba(255, 255, 255, 0.06);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

.noise {
  pointer-events: none;
  position: fixed;
  inset: 0;
  opacity: 0.04;
  z-index: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.wrap {
  position: relative;
  z-index: 1;
  width: min(1120px, 100% - 2rem);
  margin: 0 auto;
  padding: 0 0 3rem;
}

/* —— TOP BAR —— */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem clamp(1rem, 4vw, 2.5rem);
  background: linear-gradient(180deg, rgba(10, 12, 16, 0.92), rgba(10, 12, 16, 0.6));
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.topbar-brand {
  font-family: var(--font-display);
  font-size: 1.6rem;
  letter-spacing: 0.08em;
  color: var(--text);
}
.topbar-brand span {
  color: var(--amber);
}
.topbar-brand:hover {
  text-decoration: none;
}
.topbar-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.account-slot { position: relative; }
.account-trigger { white-space: nowrap; }
.account-panel {
  position: fixed;
  z-index: 90;
  display: grid;
  gap: 0.5rem;
  padding: 0.95rem;
  background: rgba(12, 14, 20, 0.98);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
}
.account-panel.hidden { display: none !important; }
.account-kicker {
  margin: 0;
  color: var(--amber);
  font-family: var(--font-display);
  letter-spacing: 0.06em;
}
.account-who, .account-note, .account-or, .account-error {
  margin: 0;
  font-size: 0.82rem;
}
.account-or { text-align: center; opacity: 0.65; }
.account-error { color: #ffb4a8; }
.account-panel input, .account-panel .btn { width: 100%; min-height: 42px; }
.account-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  min-height: 44px;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  background: #fff;
  color: #1f1f1f;
  font-weight: 650;
  text-decoration: none;
}
.account-google:hover { text-decoration: none; filter: brightness(0.96); }
.account-switch {
  border: 0;
  background: none;
  color: var(--amber);
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  display: block;
  padding: 0.2rem;
}

/* —— HERO —— */
.hero {
  min-height: min(78vh, 720px);
  display: grid;
  align-content: center;
  padding: 3rem 0 2rem;
  position: relative;
}
.hero::before {
  content: "";
  position: absolute;
  inset: -4rem calc(50% - 50vw) auto;
  height: 70vh;
  background:
    repeating-linear-gradient(90deg, transparent, transparent 48px, rgba(255, 214, 140, 0.03) 48px, rgba(255, 214, 140, 0.03) 49px),
    radial-gradient(ellipse at 50% 30%, rgba(240, 180, 41, 0.2), transparent 60%);
  -webkit-mask-image: radial-gradient(ellipse 70% 80% at 50% 30%, #000 30%, transparent 100%);
  mask-image: radial-gradient(ellipse 70% 80% at 50% 30%, #000 30%, transparent 100%);
  z-index: -1;
  animation: skyPulse 8s ease-in-out infinite alternate;
}
@keyframes skyPulse {
  from { opacity: 0.85; transform: scale(1); }
  to { opacity: 1; transform: scale(1.03); }
}
.kicker {
  letter-spacing: 0.2em;
  color: var(--muted);
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  text-transform: uppercase;
}
.brand {
  font-family: var(--font-display);
  font-size: clamp(3.5rem, 12vw, 7.5rem);
  letter-spacing: 0.04em;
  line-height: 0.9;
  margin: 0;
  text-shadow: 0 0 40px rgba(240, 180, 41, 0.35);
  animation: brandIn 1s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.brand span {
  display: block;
  color: var(--amber);
}
@keyframes brandIn {
  from { opacity: 0; transform: translateY(24px) skewX(-4deg); }
  to { opacity: 1; transform: none; }
}
.tagline {
  margin: 1rem 0 0;
  max-width: 30rem;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1.5;
  animation: brandIn 1s 0.15s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.75rem;
  animation: brandIn 1s 0.28s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

/* —— BUTTONS —— */
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.85rem 1.25rem;
  cursor: pointer;
  border-radius: var(--radius);
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
  text-decoration: none;
}
.btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(240, 180, 41, 0.45);
  text-decoration: none;
}
.btn:active {
  transform: translateY(1px);
}
.btn-primary {
  background: linear-gradient(180deg, var(--amber) 0%, var(--amber-dim) 100%);
  color: #1a1200;
  border-color: transparent;
}
.btn-primary:hover {
  filter: brightness(1.05);
  background: linear-gradient(180deg, var(--amber) 0%, var(--amber-dim) 100%);
}
.btn-ghost {
  background: transparent;
}
.btn-icon {
  padding: 0.55rem 0.8rem;
  font-size: 0.85rem;
}
.btn-sm {
  padding: 0.45rem 0.7rem;
  font-size: 0.8rem;
}
.lang-toggle {
  min-width: 3rem;
  letter-spacing: 0.08em;
}

/* —— SECTIONS —— */
.section {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}
.section h2 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3rem);
  letter-spacing: 0.06em;
  margin: 0 0 0.35rem;
}
.section .lead,
.lead {
  color: var(--muted);
  margin: 0 0 1.5rem;
  max-width: 38rem;
  line-height: 1.5;
}

/* —— GAME CARDS —— */
.game-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.1rem;
}
@media (max-width: 960px) {
  .game-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .game-grid { grid-template-columns: 1fr; }
}
.game-card {
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--asphalt);
  color: inherit;
  overflow: hidden;
  min-height: 24rem;
  transition: border-color 0.25s, transform 0.25s, box-shadow 0.25s;
  isolation: isolate;
}
.game-card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.5), 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent);
  text-decoration: none;
}
.game-card.is-disabled {
  cursor: default;
  opacity: 0.75;
}
.game-card.is-disabled:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--line);
}
.game-art {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  object-position: center top;
  display: block;
  background: #111;
  transition: transform 0.6s ease;
  -webkit-mask-image: linear-gradient(180deg, #000 70%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 70%, transparent 100%);
}
.game-card:hover .game-art {
  transform: scale(1.04);
}
.game-card.is-disabled .game-art {
  filter: grayscale(0.5) brightness(0.7);
}
.game-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 0 1.25rem 1.25rem;
  margin-top: -1.5rem;
  position: relative;
}
.game-meta {
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.game-card h3 {
  font-family: var(--font-display);
  font-size: 2.4rem;
  letter-spacing: 0.04em;
  margin: 0.2rem 0 0.4rem;
  color: var(--accent);
  text-shadow: 0 0 24px color-mix(in srgb, var(--accent) 45%, transparent);
}
.game-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.93rem;
  line-height: 1.45;
  flex: 1;
}
.game-foot {
  margin-top: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.status {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.play-pill {
  font-size: 0.8rem;
  font-weight: 700;
  color: #1a1200;
  background: var(--accent);
  padding: 0.4rem 0.75rem;
  border-radius: 99px;
  letter-spacing: 0.04em;
}
.dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--muted);
}
.dot.ok { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.dot.warn { background: var(--warn); }
.dot.err { background: var(--danger); }
.dot.soon { background: var(--muted); }

/* —— STEPS —— */
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
@media (max-width: 800px) {
  .steps { grid-template-columns: 1fr; }
}
.step {
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.02);
}
.step-n {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: #1a1200;
  background: var(--amber);
}
.step h3 {
  margin: 0.8rem 0 0.3rem;
  font-size: 1.1rem;
}
.step p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

/* —— FORM FIELDS —— */
.field + .field {
  margin-top: 1.1rem;
}
.field label {
  display: block;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.45rem;
}
.field select,
.field input[type="file"] {
  width: 100%;
  background: var(--bg1);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 0.7rem 0.8rem;
  font: inherit;
  border-radius: var(--radius);
}
.hint {
  margin-top: 0.45rem;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.45;
}

.saves-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.save-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.8rem;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--line);
  font-size: 0.9rem;
  border-radius: var(--radius);
}
.save-row .meta {
  color: var(--muted);
  font-size: 0.78rem;
}
.save-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.save-actions button {
  font-size: 0.75rem;
  padding: 0.4rem 0.55rem;
}

.footer {
  margin-top: 4rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.6;
}

/* —— MODAL —— */
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 1rem;
}
.modal.hidden {
  display: none;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 6, 10, 0.75);
  backdrop-filter: blur(6px);
}
.modal-card {
  position: relative;
  width: min(640px, 100%);
  max-height: min(88vh, 760px);
  overflow: auto;
  background: linear-gradient(180deg, #151a24, #0f131b);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  padding: 1.25rem 1.5rem 1.5rem;
  animation: modalIn 0.25s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}
.modal-head h2 {
  font-family: var(--font-display);
  font-size: 2rem;
  letter-spacing: 0.06em;
  margin: 0;
}
.tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.25rem;
}
.tab {
  appearance: none;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  padding: 0.6rem 0.9rem;
  cursor: pointer;
  margin-bottom: -1px;
}
.tab.is-active {
  color: var(--text);
  border-bottom-color: var(--amber);
}
.tab-panel {
  display: none;
}
.tab-panel.is-active {
  display: block;
}

/* —— PLAY SHELL —— */
html, html.is-immersive, html:fullscreen, html:-webkit-full-screen {
  background: #000;
  width: 100%;
  height: 100%;
}
.play-body {
  margin: 0;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
}
.play-chrome {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 45;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0.75rem;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.85), transparent);
  pointer-events: none;
}
.play-chrome > * {
  pointer-events: auto;
}
.play-chrome .title {
  font-family: var(--font-display);
  letter-spacing: 0.06em;
  font-size: 1.35rem;
}
.chrome-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.play-stage {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: #000;
  overflow: hidden;
}
.play-frame {
  position: absolute;
  border: 0;
  background: #000;
}
/* Menu stays visible on desktop and phone. The Vice City HUD is top-right, so the buttons sit top-left. */
.play-body.playing .play-chrome {
  opacity: 1;
  transform: none;
  background: none;
  pointer-events: none;
  justify-content: flex-start;
  padding: calc(0.35rem + env(safe-area-inset-top, 0px)) 0.45rem 0 calc(0.45rem + env(safe-area-inset-left, 0px));
}
.play-body.playing .play-chrome .title {
  display: none;
}
.play-body.playing .chrome-actions {
  pointer-events: auto;
  gap: 0.35rem;
}
.play-body.playing .chrome-actions .btn {
  background: rgba(0, 0, 0, 0.62);
  border-color: rgba(255, 255, 255, 0.28);
  opacity: 1;
}
.btn-fs {
  min-width: 2.2rem;
  padding-left: 0.55rem;
  padding-right: 0.55rem;
  font-size: 1rem;
  line-height: 1;
}
.play-body.is-mobile,
.play-body.is-immersive,
.play-body.playing {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
}
.play-body.is-mobile .play-stage,
.play-body.is-immersive .play-stage,
.play-body.playing .play-stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}
.play-body .play-frame,
.play-body.playing .play-frame {
  position: absolute;
  border: 0;
  background: #000;
  /* sized + scaled by play.js: CSS box = render resolution, transform = fit to stage */
  transform-origin: 0 0;
  will-change: transform;
}
/* GTA 3 on a phone: a scaled WebGL2 frame stays black. Draw it 1:1, like the canvas. */
.play-body.game-gta3.is-mobile .play-frame {
  will-change: auto;
  transform: none;
}
/* Phones: small always-visible buttons in the top-LEFT corner — the Vice City HUD (money, health,
   armor, wanted stars, weapon) lives top-right and must never be covered. */
.play-body.is-mobile.playing .play-chrome {
  opacity: 1;
  transform: none;
  background: none;
  pointer-events: none;
  justify-content: flex-start;
  padding: calc(0.3rem + env(safe-area-inset-top, 0px)) 0.4rem 0 calc(0.4rem + env(safe-area-inset-left, 0px));
}
.play-body.is-mobile.playing .play-chrome .title {
  display: none;
}
.play-body.is-mobile.playing .chrome-actions {
  pointer-events: auto;
  margin: 0;
  gap: 0.3rem;
}
.play-body.is-mobile.playing .chrome-actions .btn {
  background: rgba(0, 0, 0, 0.42);
  border-color: rgba(255, 255, 255, 0.18);
  opacity: 0.75;
  padding: 0.3rem 0.55rem;
  font-size: 0.72rem;
}

/* Boot splash: game art + Play + loading bar, then the engine takes over */
.overlay-panel {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  background: rgba(6, 8, 12, 0.92);
  padding: 1.5rem;
}
.overlay-panel.hidden {
  display: none !important;
  pointer-events: none !important;
}
.boot-splash {
  background: #07060c;
  place-items: end center;
  padding-bottom: max(2.5rem, calc(var(--safe-bottom) + 1.5rem));
}
.boot-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
  opacity: 0.9;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(180deg, #000 45%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 45%, transparent 100%);
}
.overlay-card {
  width: min(440px, 100%);
  text-align: center;
}
.overlay-card h1 {
  font-family: var(--font-display);
  font-size: 2.6rem;
  letter-spacing: 0.05em;
  margin: 0 0 0.5rem;
  color: var(--accent);
}
.boot-card {
  position: relative;
  z-index: 1;
  width: min(480px, 92vw);
  max-width: 92vw;
  overflow: hidden;
  box-sizing: border-box;
  padding: 1.25rem 1.5rem 1.4rem;
  background: rgba(8, 8, 14, 0.8);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  box-shadow: 0 0 40px color-mix(in srgb, var(--accent) 22%, transparent), 0 20px 60px rgba(0, 0, 0, 0.6);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(8px);
}
.boot-kicker {
  margin: 0;
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  color: var(--muted);
  text-transform: uppercase;
}
.boot-card h1 {
  font-size: 3.2rem;
  margin: 0.1rem 0 0.25rem;
  text-shadow: 0 0 18px color-mix(in srgb, var(--accent) 80%, transparent);
}
.boot-msg {
  color: var(--muted);
  margin: 0 0 0.6rem;
  min-height: 1.3em;
  line-height: 1.45;
}
.boot-note {
  margin: 0 0 0.6rem;
  font-size: 0.82rem;
  color: var(--muted);
  opacity: 0.85;
  line-height: 1.4;
}
.boot-actions {
  justify-content: center;
  margin-top: 1rem;
  animation: none;
}
html, body, button, a, canvas, .touch-control, .btn, .stick, .play-chrome {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
input, textarea, select {
  -webkit-user-select: text;
  user-select: text;
}
body.no-select, body.play-body, body.playing {
  -webkit-user-select: none !important;
  user-select: none !important;
  -webkit-touch-callout: none !important;
}
.progress-bar {
  height: 6px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 99px;
  overflow: hidden;
  margin: 1rem auto 0.5rem;
}
.boot-card .progress-bar {
  height: 14px;
  width: 100%;
  max-width: 100%;
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.45);
}
.progress-bar > i {
  display: block;
  height: 100%;
  width: 0%;
  max-width: 100%;
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 60%, #fff), var(--accent));
  transition: width 0.25s ease;
}
.menu-actions {
  display: grid;
  gap: 0.55rem;
  margin-top: 1.15rem;
}
.menu-actions .btn {
  width: 100%;
  min-height: 48px;
}
#menuOverlay {
  z-index: 75;
}
.menu-card {
  max-height: min(92vh, 920px);
  overflow: auto;
}
.menu-cheats {
  display: block;
  margin-top: 0.85rem;
  padding: 0.35rem 0 0.2rem;
  border-top: 1px solid var(--line);
}
.menu-cheats.hidden { display: none !important; }
.menu-cheats .lead {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.82rem;
}
.cheat-section { margin: 0 0 0.95rem; }
.cheat-section h3 {
  margin: 0 0 0.4rem;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--amber);
}
.cheat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}
.cheat-grid.cheat-spawn { grid-template-columns: 1fr 1fr; }
.cheat-grid .btn {
  width: 100%;
  min-height: 42px;
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  text-align: left;
}
.cheat-toggle small {
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.cheat-toggle.on {
  border-color: var(--amber);
  color: var(--amber);
}
.cheat-meter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin: 0 0 0.45rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.cheat-meter p {
  margin: 0;
  font-size: 0.86rem;
}
.cheat-meter strong {
  color: var(--amber);
  font-variant-numeric: tabular-nums;
}
.cheat-step {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.cheat-step .btn {
  width: 36px;
  min-height: 36px;
  padding: 0;
  font-size: 1.1rem;
}
.cheat-step input {
  width: 4.2rem;
  min-height: 36px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.cheat-reset { width: 100%; min-height: 40px; }
.menu-card:has(.menu-cheats:not(.hidden)) {
  width: min(680px, 100%);
}
@media (max-width: 640px) {
  .cheat-grid, .cheat-grid.cheat-spawn { grid-template-columns: 1fr 1fr; }
  .cheat-meter { flex-direction: column; align-items: stretch; }
  .cheat-step { justify-content: flex-end; }
}
.menu-account {
  margin-top: 0.9rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 0.45rem;
}
.menu-account h2 {
  margin: 0;
  font-size: 0.95rem;
  color: var(--amber);
}
.menu-account .who {
  margin: 0;
  font-size: 0.82rem;
  opacity: 0.85;
}
.menu-account input {
  width: 100%;
  min-height: 42px;
}
.menu-account .hidden { display: none !important; }
.menu-account .btn { width: 100%; min-height: 44px; }
.menu-cheats .btn { font-size: 0.78rem; }
.pixr-load {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: none;
  align-items: center;
  justify-content: center;
  background: #07060c;
  pointer-events: none;
}
.pixr-load.on { display: flex; }
.pixr-load .box {
  width: min(280px, 70vw);
  text-align: center;
}
.pixr-load .progress-bar {
  width: 100%;
  max-width: 100%;
  height: 14px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.45);
}
.pixr-load p {
  margin: 0.65rem 0 0;
  color: #fff;
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: 0.04em;
}
.pixr-recover {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  font-weight: 700;
  pointer-events: none;
}
.pixr-recover.on { display: flex; }
#progressLabel {
  color: #fff;
  font-size: 1.35rem;
  font-weight: 800;
  margin: 0.35rem 0 0;
}
.btn-play {
  min-width: 200px;
  font-size: 1.15rem;
  padding: 0.85rem 1.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 70%, #000));
}
.btn-play:disabled {
  opacity: 0.6;
  cursor: progress;
}
.menu-card {
  text-align: left;
  width: min(380px, 100%);
  padding: 1.35rem 1.2rem 1.15rem;
  background: rgba(12, 14, 20, 0.94);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}
.menu-card h1 {
  text-align: center;
  color: var(--amber);
}
.menu-card {
  max-height: min(92vh, 100%);
  overflow: auto;
}
.menu-pad {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}
.menu-pad.hidden {
  display: none;
}

/* —— CONTROLLER PANEL —— */
.pad-panel {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.pad-panel [hidden] {
  display: none !important;
}
.pad-status {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.8rem 0.9rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.02);
}
.pad-status.is-on {
  border-style: solid;
  border-color: rgba(111, 207, 151, 0.55);
  background: rgba(111, 207, 151, 0.08);
}
.pad-status-icon {
  display: inline-grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.35);
  font-size: 1.2rem;
  flex: none;
}
.pad-status-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}
.pad-status-text .hint {
  margin: 0;
}
.pad-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.pad-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.25);
  flex-wrap: wrap;
}
.pad-badge {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  font-weight: 800;
  font-size: 0.95rem;
  color: #fff;
  background: #555;
  flex: none;
}
.pad-badge-xbox { background: #107c10; }
.pad-badge-playstation { background: #0050c8; }
.pad-badge-nintendo { background: #e60012; }
.pad-badge-stadia { background: #ff4c1d; }
.pad-badge-steam { background: #1b2838; }
.pad-badge-8bitdo { background: #222; }
.pad-badge-logitech { background: #00b8fc; }
.pad-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex: 1;
  min-width: 10rem;
}
.pad-card-body .hint {
  margin: 0;
}
.pad-map {
  font-size: 0.78rem;
  color: var(--ok);
}
.pad-map-guess { color: var(--warn); }
.pad-map-custom { color: var(--teal); }
.pad-card-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.pad-test {
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}
.pad-test-buttons {
  display: grid;
  grid-template-columns: repeat(6, minmax(2.4rem, 1fr));
  gap: 0.35rem;
  flex: 1;
}
.pad-chip {
  --v: 0;
  display: inline-grid;
  place-items: center;
  min-height: 2rem;
  padding: 0 0.3rem;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(0deg, rgba(240, 180, 41, calc(var(--v) * 0.9)) 0 calc(var(--v) * 100%), transparent 0);
  color: var(--text);
  transition: background 0.05s;
}
.pad-chip.on {
  border-color: var(--amber);
  color: #1a1200;
  background: var(--amber);
}
.pad-test-sticks {
  display: flex;
  gap: 0.75rem;
}
.pad-stick {
  position: relative;
  width: 3.4rem;
  height: 3.4rem;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: radial-gradient(circle, rgba(255, 255, 255, 0.06), rgba(0, 0, 0, 0.4));
}
.pad-stick i {
  position: absolute;
  left: calc(50% - 0.45rem);
  top: calc(50% - 0.45rem);
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 8px var(--teal);
}
.pad-stick span {
  position: absolute;
  right: -0.1rem;
  bottom: -0.2rem;
  font-size: 0.65rem;
  color: var(--muted);
}
.pad-wizard {
  padding: 1rem;
  border: 1px solid rgba(240, 180, 41, 0.5);
  border-radius: var(--radius-lg);
  background: rgba(240, 180, 41, 0.06);
}
.pad-wizard h3 {
  margin: 0 0 0.4rem;
  font-family: var(--font-display);
  letter-spacing: 0.06em;
  font-size: 1.4rem;
  color: var(--amber);
}
.pad-wizard-prompt {
  margin: 0 0 0.6rem;
  font-size: 1.05rem;
  font-weight: 700;
}
.pad-wizard .progress-bar {
  margin: 0.4rem 0 0.8rem;
}
.pad-prefs {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.pad-toggle {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.2rem 0.6rem;
  align-items: center;
  cursor: pointer;
  font-size: 0.95rem;
}
.pad-toggle input {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--amber);
}
.pad-toggle .hint {
  grid-column: 2;
  margin: 0;
}
.pad-prefs .field input[type="range"] {
  width: 100%;
  accent-color: var(--amber);
}
.pad-db {
  margin: 0;
}
.pad-sheet summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 0.9rem;
}
.pad-sheet-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.3rem 0.8rem;
  margin-top: 0.6rem;
  font-size: 0.88rem;
}
.pad-sheet-grid b {
  color: var(--amber);
  font-variant-numeric: tabular-nums;
}
.pad-sheet-grid .hint {
  margin: 0;
}

/* A physical controller is driving the game: the shell's own touch overlay steps aside too */
.play-body.pad-active .touch-layer {
  display: none !important;
}

/* Touch controls — parent overlay, always on the real viewport (not the scaled iframe) */
.touch-layer {
  position: fixed;
  inset: 0;
  z-index: 15;
  pointer-events: none;
  display: none;
}
.touch-layer.on {
  display: block;
}
.stick,
.btn-pad {
  pointer-events: auto;
  position: absolute;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.stick {
  bottom: calc(1.1rem + env(safe-area-inset-bottom, 0px));
  left: calc(0.9rem + env(safe-area-inset-left, 0px));
  width: 7.6rem;
  height: 7.6rem;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.32);
  background: rgba(0, 0, 0, 0.28);
}
.stick-look {
  left: auto;
  right: calc(0.9rem + env(safe-area-inset-right, 0px));
  bottom: calc(9.4rem + env(safe-area-inset-bottom, 0px));
  width: 5.6rem;
  height: 5.6rem;
  border-color: rgba(255, 255, 255, 0.22);
}
.stick .knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 2.6rem;
  height: 2.6rem;
  margin: -1.3rem 0 0 -1.3rem;
  border-radius: 50%;
  background: rgba(240, 180, 41, 0.85);
  box-shadow: 0 0 16px rgba(240, 180, 41, 0.35);
}
.stick-look .knob {
  width: 2rem;
  height: 2rem;
  margin: -1rem 0 0 -1rem;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: none;
}
.btn-pad {
  right: calc(0.7rem + env(safe-area-inset-right, 0px));
  bottom: calc(1.1rem + env(safe-area-inset-bottom, 0px));
  display: grid;
  grid-template-columns: repeat(4, 3.35rem);
  gap: 0.45rem;
}
.btn-pad button {
  width: 3.35rem;
  height: 3.35rem;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-weight: 700;
  font-size: 0.62rem;
  letter-spacing: 0.04em;
}
.btn-pad button:active,
.btn-pad button.held {
  background: rgba(46, 196, 182, 0.55);
}

.toast {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.85);
  border: 1px solid var(--line);
  padding: 0.65rem 1rem;
  z-index: 70;
  font-size: 0.85rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
  border-radius: var(--radius);
}
.toast.show {
  opacity: 1;
}
