:root {
  --bg: #07080d;
  --panel: rgba(12, 14, 21, 0.84);
  --panel2: rgba(12, 14, 21, 0.96);
  --text: #f4f4f4;
  --muted: #aaaabb;
  --line: rgba(255, 255, 255, 0.15);
  --accent: #8ee8ff;
  --gold: #f4d35e;
  --danger: #ff5c7a;
  --good: #8cffae;
}

* {
  box-sizing: border-box;
}

.site-container {
  --max-width: 1280px;
}

body.page-games {
  background: radial-gradient(circle at 50% 0%, #151827 0%, #07080d 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);
}

/* ==========================================================================
   CAICK SKATING BOARD — UI COMPACTA, RESPONSIVA E COM TELA CHEIA
   ========================================================================== */

.game-wrapper {
  width: min(100%, 1280px);
  margin: 0 auto 48px;
  display: flex;
  justify-content: center;
}

.shell {
  position: relative;
  width: 100%;
  max-width: 1280px;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  background: #0d101a;
  box-shadow: 0 20px 64px rgba(0, 0, 0, 0.5);
}

.shell canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #10131e;
}

.shell .hud {
  pointer-events: none;
  position: absolute;
  inset: 0;
  padding: clamp(8px, 1.1vw, 13px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: clamp(6px, 1vw, 10px);
}

.shell .topbar {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(240px, auto) minmax(180px, 0.9fr);
  align-items: start;
  gap: clamp(7px, 1vw, 12px);
  width: 100%;
}

.shell .card {
  min-height: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: clamp(6px, 0.85vw, 10px) clamp(8px, 1vw, 12px);
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
  align-self: start;
}

.shell .title-block h1 {
  margin: 0;
  font-size: clamp(14px, 1.45vw, 20px);
  line-height: 1.05;
  letter-spacing: 0.02em;
  text-transform: lowercase;
}

.shell .title-block p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: clamp(10px, 0.9vw, 12px);
  line-height: 1.25;
}

.shell .stats {
  justify-self: center;
  text-align: center;
  min-width: min(255px, 100%);
}

.shell .score-line {
  display: flex;
  justify-content: center;
  gap: clamp(8px, 1vw, 12px);
  font-weight: 850;
  font-size: clamp(11px, 1vw, 13px);
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.shell .score-line b {
  color: var(--gold);
}

.shell .combo {
  margin-top: 4px;
  min-height: 16px;
  color: var(--accent);
  font-weight: 760;
  font-size: clamp(10px, 0.9vw, 12px);
  line-height: 1.25;
}

.shell .meters {
  justify-self: end;
  width: clamp(180px, 20vw, 230px);
}

.shell .meter {
  margin-top: 4px;
}

.shell .meter:first-child {
  margin-top: 0;
}

.shell .meter-label {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: clamp(9px, 0.8vw, 11px);
  line-height: 1.2;
  margin-bottom: 2px;
}

.shell .bar {
  height: 6px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.1);
}

.shell .fill {
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--good));
  transition: width 0.1s linear;
}

.shell .fill.danger {
  background: linear-gradient(90deg, var(--danger), var(--gold));
}

.shell .bottom {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: clamp(7px, 1vw, 10px);
  align-items: end;
  width: 100%;
}


.shell .toast {
  min-width: 170px;
  max-width: 260px;
  text-align: right;
  font-weight: 850;
  color: var(--gold);
  text-shadow: 0 2px 20px rgba(244, 211, 94, 0.4);
  align-self: end;
  margin-bottom: 6px;
  font-size: clamp(11px, 1vw, 13px);
  line-height: 1.25;
}

/* Botão de tela cheia */
.shell .fullscreen-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  min-width: 38px;
  height: 38px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  pointer-events: auto;
  transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.24s ease,
              background-color 0.24s ease,
              color 0.24s ease,
              box-shadow 0.24s ease;
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
}

.shell .fullscreen-btn:hover {
  transform: translateY(-2px);
  border-color: var(--gold);
  background: rgba(244, 211, 94, 0.15);
  color: var(--gold);
  box-shadow: 0 12px 32px rgba(244, 211, 94, 0.22);
}

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

/* Menus do jogo */
.shell .overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, rgba(4, 5, 8, 0.42), rgba(4, 5, 8, 0.84));
  backdrop-filter: blur(6px);
  padding: clamp(10px, 1.5vw, 16px);
  overflow: auto;
  z-index: 5;
}

.shell .hidden {
  display: none;
}

.shell .modal {
  width: min(780px, 94vw);
  max-height: min(90vh, 620px);
  overflow: auto;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: clamp(14px, 2vw, 24px);
  box-shadow: 0 32px 96px rgba(0, 0, 0, 0.55);
  text-align: center;
}

.shell .modal h2 {
  margin: 0;
  font-size: clamp(26px, 4vw, 50px);
  letter-spacing: -0.045em;
  line-height: 0.92;
  text-transform: lowercase;
}

.shell .modal h3 {
  margin: 18px 0 8px;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
}

.shell .subtitle {
  margin: 10px auto 0;
  max-width: 680px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.shell .menu-controls-text {
  max-width: 720px;
  margin: 8px auto 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  text-align: center;
}

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

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

.shell .compact-grid {
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
}

.shell .choice {
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: transform 0.16s ease,
              border-color 0.16s ease,
              background-color 0.16s ease;
}

.shell .choice:hover {
  transform: translateY(-2px);
  border-color: rgba(142, 232, 255, 0.65);
}

.shell .choice.selected {
  border-color: var(--gold);
  background: rgba(244, 211, 94, 0.11);
}

.shell .choice.locked {
  opacity: 0.5;
  cursor: not-allowed;
}

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

.shell .choice span {
  display: block;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.35;
}

.shell .country-image {
  height: 46px;
  border-radius: 9px;
  margin-bottom: 7px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  overflow: hidden;
  position: relative;
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.shell .country-image::after {
  content: attr(data-flag);
  position: absolute;
  right: 8px;
  bottom: 4px;
  font-size: 21px;
  letter-spacing: 0;
  text-shadow: none;
}

.shell .flag-england {
  background:
    linear-gradient(90deg, transparent 0 42%, #c8102e 42% 58%, transparent 58% 100%),
    linear-gradient(0deg, transparent 0 38%, #c8102e 38% 62%, transparent 62% 100%),
    linear-gradient(135deg, transparent 0 43%, #fff 43% 47%, #c8102e 47% 53%, #fff 53% 57%, transparent 57% 100%),
    linear-gradient(45deg, #012169 0 43%, #fff 43% 47%, #c8102e 47% 53%, #fff 53% 57%, #012169 57% 100%);
}

.shell .flag-japan {
  background: radial-gradient(circle at 50% 50%, #bc002d 0 24%, transparent 25%), #f5f5f5;
  color: #222;
  text-shadow: none;
}

.shell .flag-brazil {
  background: radial-gradient(circle at 50% 50%, #002776 0 15%, #f7df38 16% 34%, transparent 35%), #009b3a;
}

.shell .flag-italy {
  background: linear-gradient(90deg, #009246 0 33%, #f1f2f1 33% 66%, #ce2b37 66% 100%);
  color: #161616;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}

.shell .row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.shell button {
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  color: #071016;
  background: linear-gradient(135deg, var(--accent), var(--gold));
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(142, 232, 255, 0.14);
}

.shell button.secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border: 1px solid var(--line);
}

.shell kbd {
  border: 1px solid var(--line);
  border-bottom-color: rgba(255, 255, 255, 0.32);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  padding: 4px 7px;
  color: var(--text);
  font-size: 11px;
  font-weight: 850;
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.25);
  font-family: inherit;
}

.shell .kbd-row {
  margin: 12px auto 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.shell .unlock-note {
  min-height: 20px;
  margin-top: 12px;
  color: var(--good);
  font-weight: 800;
}

/* Tela cheia */
.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);
}

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

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

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

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

}

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

  .shell .hud {
    padding: 7px;
  }

  .shell .title-block {
    display: none;
  }

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

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


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

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

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

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

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

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

  .shell .compact-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .shell .country-image {
    height: 42px;
  }
}

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

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

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