:root {
  --bg: #07080d;
  --panel: rgba(12,14,21,.84);
  --panel2: rgba(12,14,21,.96);
  --text: #f6f1e8;
  --muted: #aaaabb;
  --line: rgba(255,255,255,.15);
  --gold: #f4d35e;
  --blue: #8ee8ff;
  --green: #8cffae;
  --red: #ff5c7a;
}
* { box-sizing: border-box; }
.site-container {
  --max-width: 1280px;
}
body.page-games {
  background: radial-gradient(circle at 50% 0%, #1a2131 0%, var(--bg) 55%, #020307 100%);
  color: var(--text);
  transition: background-color 0.4s ease, color 0.4s ease;
}
[data-theme="light"] body.page-games {
  background: radial-gradient(circle at 50% 0%, #dfd7c3 0%, var(--bg) 70%, #eae3d2 100%);
  --text: #0b0b0b;
  --muted: #555566;
  --line: rgba(11, 11, 11, 0.15);
  --panel: rgba(234, 227, 210, 0.84);
  --panel2: rgba(234, 227, 210, 0.96);
}
.shell {
  position: relative;
  width: 100%;
  max-width: 1280px;
  aspect-ratio: 16/9;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: #0d101a;
  box-shadow: 0 24px 80px rgba(0,0,0,.55);
}
canvas { display: block; width: 100%; height: 100%; background: #10131e; }
.hud {
  pointer-events: none;
  position: absolute;
  inset: 0;
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
}
.topbar { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 14px; align-items: start; width: 100%; }
.card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 8px 12px;
  background: var(--panel);
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(0,0,0,.22);
  align-self: start;
}
.title-block h1 { margin: 0; font-size: clamp(18px, 2.2vw, 30px); line-height: 1; text-transform: lowercase; }
.title-block p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.stats { justify-self: center; min-width: 330px; text-align: center; }
.score-line { display: flex; justify-content: center; gap: 16px; font-weight: 850; font-size: 15px; }
.score-line b { color: var(--gold); }
.combo { min-height: 20px; margin-top: 4px; color: var(--blue); font-weight: 780; font-size: 14px; }
.meters { justify-self: end; width: 270px; }
.meter-label { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; margin-bottom: 3px; }
.bar { height: 9px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.1); }
.fill { height: 100%; width: 100%; border-radius: inherit; background: linear-gradient(90deg,var(--green),var(--gold)); transition: width .1s linear; }
.bottom { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 14px; align-items: end; width: 100%; }
.controls { max-width: 850px; color: var(--muted); font-size: 13px; line-height: 1.6; align-self: end; }
.fullscreen-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 16px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(0,0,0,.22);
  width: 48px;
  height: 48px;
  pointer-events: auto;
}
.fullscreen-btn:hover {
  transform: translateY(-2px);
  border-color: var(--gold);
  background: rgba(244, 211, 94, 0.15);
  color: var(--gold);
  box-shadow: 0 12px 36px rgba(244, 211, 94, 0.25);
}
.fullscreen-btn svg {
  width: 22px;
  height: 22px;
}
.controls strong { color: var(--text); }
.toast { min-width: 250px; text-align: right; color: var(--gold); font-weight: 850; text-shadow: 0 2px 20px rgba(244,211,94,.4); align-self: end; margin-bottom: 12px; }
.overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 20px;
  overflow: auto;
  background: linear-gradient(180deg, rgba(4,5,8,.42), rgba(4,5,8,.84));
  backdrop-filter: blur(6px);
}
.hidden { display: none; }
.modal {
  width: min(980px, 94vw);
  max-height: min(94vh, 690px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: clamp(20px, 3vw, 34px);
  background: var(--panel2);
  text-align: center;
  box-shadow: 0 40px 120px rgba(0,0,0,.55);
}
.modal h2 { margin: 0; font-size: clamp(34px, 6vw, 76px); line-height: .9; letter-spacing: -.05em; text-transform: lowercase; }
.subtitle { max-width: 760px; margin: 14px auto 0; color: var(--muted); font-size: 15px; line-height: 1.62; }
.modal h3 { margin: 26px 0 10px; color: var(--gold); font-size: 14px; letter-spacing: .1em; text-transform: uppercase; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-top: 14px; }
.choice {
  min-height: 142px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  background: rgba(255,255,255,.055);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}
.choice:hover { transform: translateY(-2px); border-color: rgba(142,232,255,.65); }
.choice.selected { border-color: var(--gold); background: rgba(244,211,94,.11); }
.choice strong { display: block; margin-bottom: 5px; font-size: 15px; }
.choice span { display: block; color: var(--muted); font-size: 12px; line-height: 1.45; }
.scene-swatch { height: 58px; margin-bottom: 10px; border: 1px solid rgba(255,255,255,.12); border-radius: 12px; }
.rooftop { background: linear-gradient(135deg, #151827, #60548b); }
.gallery { background: linear-gradient(135deg, #22201b, #b69a62); }
.avenue { background: linear-gradient(135deg, #121b28, #4b7d8f); }
.row { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
button {
  border: 0;
  border-radius: 999px;
  padding: 13px 20px;
  color: #071016;
  background: linear-gradient(135deg, var(--blue), var(--gold));
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 12px 36px rgba(142,232,255,.18);
}
button.secondary { background: rgba(255,255,255,.08); color: var(--text); border: 1px solid var(--line); }
kbd {
  border: 1px solid var(--line);
  border-bottom-color: rgba(255,255,255,.32);
  border-radius: 10px;
  background: rgba(255,255,255,.08);
  padding: 6px 9px;
  color: var(--text);
  font-family: inherit;
  font-weight: 850;
}
.kbd-row { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin: 18px auto 0; }
@media (max-width: 760px) {
  .shell { width: 100%; border-radius: 12px; }
  .topbar { grid-template-columns: 1fr; }
  .stats, .meters { justify-self: stretch; width: auto; min-width: 0; }
  .bottom { grid-template-columns: 1fr; }
  .toast { text-align: left; }
  .controls { font-size: 12px; }
}


/* ==========================================================================
   AJUSTES DE UI COMPACTA + CONTROLES NO MENU
   ========================================================================== */
.game-wrapper {
  width: min(100%, 1280px);
  margin: 0 auto 48px;
  display: flex;
  justify-content: center;
}

.shell {
  max-width: 1280px;
  border-radius: 18px;
  box-shadow: 0 20px 64px rgba(0, 0, 0, 0.5);
}

.hud {
  padding: clamp(8px, 1.1vw, 13px);
  gap: clamp(6px, 1vw, 10px);
}

.topbar {
  grid-template-columns: minmax(150px, 1fr) minmax(240px, auto) minmax(180px, 0.9fr);
  gap: clamp(7px, 1vw, 12px);
}

.card {
  min-height: 0;
  border-radius: 12px;
  padding: clamp(6px, 0.85vw, 10px) clamp(8px, 1vw, 12px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
}

.title-block h1 {
  font-size: clamp(14px, 1.45vw, 20px);
  line-height: 1.05;
}

.title-block p {
  font-size: clamp(10px, 0.9vw, 12px);
  line-height: 1.25;
}

.stats {
  min-width: min(255px, 100%);
}

.score-line {
  gap: clamp(8px, 1vw, 12px);
  font-size: clamp(11px, 1vw, 13px);
  white-space: nowrap;
}

.combo,
.status {
  min-height: 16px;
  font-size: clamp(10px, 0.9vw, 12px);
  line-height: 1.25;
}

.meters {
  width: clamp(175px, 20vw, 225px);
}

.meter-label {
  gap: 8px;
  font-size: clamp(9px, 0.8vw, 11px);
  line-height: 1.2;
  margin-bottom: 2px;
}

.bar {
  height: 6px;
}

.bottom {
  grid-template-columns: auto auto;
  justify-content: end;
  gap: clamp(7px, 1vw, 10px);
}

.controls {
  display: none !important;
}

.toast {
  min-width: 0;
  max-width: min(320px, 42vw);
  margin-bottom: 6px;
  font-size: clamp(11px, 1vw, 13px);
  line-height: 1.25;
}

.fullscreen-btn {
  width: 38px;
  min-width: 38px;
  height: 38px;
  border-radius: 12px;
  padding: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
}

.fullscreen-btn svg {
  width: 18px;
  height: 18px;
}

.overlay {
  padding: clamp(10px, 1.5vw, 16px);
}

.modal {
  width: min(780px, 94vw);
  max-height: min(90vh, 620px);
  border-radius: 20px;
  padding: clamp(14px, 2vw, 24px);
  box-shadow: 0 32px 96px rgba(0, 0, 0, 0.55);
}

.modal h2 {
  font-size: clamp(26px, 4vw, 50px);
  letter-spacing: -0.045em;
}

.modal h3 {
  margin: 18px 0 8px;
  font-size: 13px;
}

.subtitle {
  max-width: 680px;
  font-size: 13px;
  line-height: 1.5;
}

.controls-help {
  max-width: 680px;
  margin: 8px auto 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  text-align: center;
}

.controls-help strong {
  color: var(--text);
  font-weight: 850;
}

.grid {
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.choice {
  min-height: 0;
  border-radius: 13px;
  padding: 10px;
}

.choice strong {
  font-size: 13px;
  margin-bottom: 4px;
}

.choice span {
  font-size: 10.5px;
  line-height: 1.35;
}

.scene-swatch,
.region-art {
  height: 46px;
  border-radius: 9px;
  margin-bottom: 7px;
  font-size: 0.72rem;
}

.row {
  gap: 8px;
  margin-top: 16px;
}

button {
  padding: 10px 14px;
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(142, 232, 255, 0.14);
}

kbd {
  border-radius: 8px;
  padding: 4px 7px;
  font-size: 11px;
}

.kbd-row {
  margin: 12px auto 0;
  gap: 6px;
}

.shell:fullscreen,
.shell:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  max-width: none;
  aspect-ratio: auto;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.shell:fullscreen canvas,
.shell:-webkit-full-screen canvas {
  width: 100%;
  height: 100%;
}

.shell:fullscreen .hud,
.shell:-webkit-full-screen .hud {
  padding: clamp(10px, 1.5vw, 18px);
}

.shell:fullscreen .modal,
.shell:-webkit-full-screen .modal {
  width: min(860px, 94vw);
  max-height: calc(100vh - 32px);
}

@media (max-width: 900px) {
  .game-wrapper {
    width: 100%;
  }

  .topbar {
    grid-template-columns: 1fr 1fr;
  }

  .title-block {
    grid-column: span 2;
  }

  .stats,
  .meters {
    justify-self: stretch;
    width: auto;
    min-width: 0;
  }
}

@media (max-width: 760px) {
  .shell {
    border-radius: 12px;
  }

  .hud {
    padding: 7px;
  }

  .title-block {
    display: none;
  }

  .topbar {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .bottom {
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: end;
  }

  .toast {
    max-width: none;
    margin-bottom: 0;
    text-align: left;
    font-size: 11px;
  }

  .fullscreen-btn {
    width: 34px;
    min-width: 34px;
    height: 34px;
    border-radius: 10px;
    padding: 7px;
  }

  .modal {
    width: min(96vw, 720px);
    max-height: 88vh;
    padding: 14px;
    border-radius: 16px;
  }

  .modal h2 {
    font-size: clamp(28px, 10vw, 38px);
  }

  .modal h3 {
    margin-top: 14px;
  }

  .grid {
    grid-template-columns: 1fr 1fr;
  }

  .scene-swatch,
  .region-art {
    height: 42px;
  }
}

@media (max-width: 480px) {
  .grid {
    grid-template-columns: 1fr;
  }

  .score-line {
    flex-wrap: wrap;
    row-gap: 4px;
  }

  .modal {
    max-height: 86vh;
  }
}
