/*
 * Página /jogos (src/pages/jogos.astro): abas dos jogos, palco do canvas,
 * telas de início/fim e ranking.
 */

/* Header sem a hero escura por trás: fica sempre no estado "scrolled" do tema */
#header {
  background-color: rgba(20, 20, 20, 0.95);
}

#header .header-top {
  display: none;
}

#header .main-menu {
  background: transparent;
  border: none;
}

.games-page {
  background:
    radial-gradient(ellipse 60% 40% at 15% 0%, rgba(244, 172, 42, 0.16), transparent 70%),
    radial-gradient(ellipse 50% 40% at 90% 30%, rgba(195, 214, 90, 0.1), transparent 70%),
    #121212;
  color: #ccc;
}

/* ---------- topo ---------- */

.games-hero {
  padding: 130px 0 30px;
  text-align: center;
}

.games-hero .section-eyebrow {
  color: #f4ac2a;
}

.games-hero h1 {
  color: #fff;
  font-size: clamp(38px, 6vw, 60px);
  font-weight: 800;
}

.games-hero p {
  max-width: 560px;
  margin: 14px auto 0;
  color: #bdbdbd;
}

.games-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  margin-top: 34px;
}

.games-tab {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 270px;
  padding: 14px 20px;
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  color: #ddd;
  text-align: left;
  transition: border-color 0.25s ease, background 0.25s ease, transform 0.25s ease;
}

.games-tab:hover {
  transform: translateY(-2px);
  border-color: rgba(244, 172, 42, 0.5);
}

.games-tab[aria-selected='true'] {
  border-color: #f4ac2a;
  background: rgba(244, 172, 42, 0.12);
  color: #fff;
}

.games-tab strong {
  display: block;
  font-size: 16px;
}

.games-tab small {
  display: block;
  color: #a8a8a8;
  font-size: 12px;
}

.games-tab-icon {
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: #1f1f1f center / 30px no-repeat;
}

.games-tab-icon-limao {
  background-image: url(../img/cursor-copo.svg);
}

.games-tab-icon-costela {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 40'%3E%3Cg fill='%23f3ead8'%3E%3Crect x='2' y='9' width='60' height='7' rx='3.5'/%3E%3Crect x='2' y='24' width='60' height='7' rx='3.5'/%3E%3C/g%3E%3Crect x='12' y='4' width='40' height='32' rx='11' fill='%23b85c2a'/%3E%3Cpath d='M20 8l8 24M30 8l8 24M40 8l8 24' stroke='%23542511' stroke-width='3'/%3E%3C/svg%3E");
}

/* ---------- arena ---------- */

.games-arena {
  padding: 20px 0 100px;
}

.games-layout {
  display: grid;
  grid-template-columns: minmax(0, 420px) minmax(0, 360px);
  justify-content: center;
  align-items: start;
  gap: 30px;
}

.game-stage {
  position: relative;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5), 0 0 0 2px rgba(244, 172, 42, 0.35);
  user-select: none;
}

#game-canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 2 / 3;
  touch-action: none;
  cursor: none;
}

.game-overlay:not([hidden]) ~ #game-canvas,
.game-overlay:not([hidden]) {
  cursor: auto;
}

.game-mute {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 3;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 18px;
}

.game-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 26px;
  background: rgba(10, 8, 6, 0.82);
  backdrop-filter: blur(3px);
  text-align: center;
  overflow-y: auto;
}

.game-overlay[hidden] {
  display: none;
}

.game-overlay h2 {
  color: #fff;
  font-size: 28px;
  font-weight: 800;
}

.game-overlay p {
  margin: 12px 0 0;
  color: #cfcfcf;
  font-size: 14px;
  line-height: 1.6;
}

.game-best strong {
  color: #f4ac2a;
}

.game-record {
  color: #c3d65a !important;
  font-size: 18px;
}

.game-hint {
  font-size: 12px !important;
  color: #8f8f8f !important;
}

.game-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
  padding: 12px 26px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: 999px;
  background: transparent;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  transition: transform 0.2s ease, background 0.2s ease;
}

.game-btn:hover {
  transform: translateY(-2px);
  color: #fff;
}

.game-btn-primary {
  border-color: #f4ac2a;
  background: #f4ac2a;
  color: #1d1d1d;
  font-size: 17px;
  padding: 14px 40px;
  box-shadow: 0 10px 26px rgba(244, 172, 42, 0.35);
}

.game-btn-primary:hover {
  background: #ffc14d;
  color: #1d1d1d;
}

.game-btn-primary:disabled {
  opacity: 0.7;
  transform: none;
}

.game-btn-share {
  border-color: #25d366;
  background: #25d366;
  color: #fff;
}

.game-over-label {
  color: #f4ac2a !important;
  font-size: 13px !important;
  font-weight: 700;
  letter-spacing: 0.25em;
  text-transform: uppercase;
}

.game-over-score {
  margin-top: 4px !important;
  color: #fff !important;
  font-size: 18px !important;
}

.game-over-score strong {
  font-size: 52px;
  font-weight: 800;
  line-height: 1;
}

.game-over-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.game-over-actions .game-btn {
  margin-top: 14px;
  padding: 10px 20px;
  font-size: 14px;
}

/* formulário do ranking */
.game-form {
  width: 100%;
  max-width: 320px;
  margin-top: 16px;
  padding: 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  text-align: left;
}

.game-form[hidden] {
  display: none;
}

.game-form-title {
  margin: 0 0 10px !important;
  color: #fff !important;
  font-weight: 600;
  text-align: center;
}

.game-form input[type='text'],
.game-form input[type='tel'] {
  width: 100%;
  margin-bottom: 8px;
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.3);
  color: #fff;
  font-size: 15px;
}

.game-form input:focus {
  border-color: #f4ac2a;
  outline: 0;
  box-shadow: 0 0 0 3px rgba(244, 172, 42, 0.25);
}

.game-check {
  display: flex;
  gap: 8px;
  margin: 6px 0 0;
  color: #bdbdbd;
  font-size: 11.5px;
  line-height: 1.45;
  font-weight: 400;
}

.game-check input {
  flex: none;
  margin-top: 2px;
  accent-color: #f4ac2a;
}

.game-check a {
  color: #f4ac2a;
  text-decoration: underline;
}

.game-form-msg {
  min-height: 0;
  margin: 8px 0 0 !important;
  font-size: 13px !important;
}

.game-form-msg.is-error {
  color: #ff8a7d !important;
}

.game-form-msg.is-ok {
  color: #9fe0a8 !important;
}

.game-form .game-btn-primary {
  width: 100%;
  margin-top: 10px;
  padding: 11px 20px;
  font-size: 15px;
}

/* ---------- ranking ---------- */

.game-ranking {
  padding: 26px;
  border-radius: 24px;
  background: #1b1b1b;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
}

.game-ranking h2 {
  color: #fff;
  font-size: 20px;
  line-height: 1.35 !important;
}

.game-ranking h2 .fa {
  color: #f4ac2a;
}

.game-ranking h2 span {
  display: block;
  color: #a8a8a8;
  font-size: 14px;
  font-weight: 500;
}

.ranking-list {
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: none;
}

.ranking-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  color: #ddd;
}

.ranking-list li:nth-child(odd) {
  background: rgba(255, 255, 255, 0.03);
}

.ranking-pos {
  display: grid;
  flex: none;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  font-weight: 700;
  font-size: 13px;
}

.ranking-1 .ranking-pos {
  background: #f4c430;
  color: #1d1d1d;
}

.ranking-2 .ranking-pos {
  background: #c9ced6;
  color: #1d1d1d;
}

.ranking-3 .ranking-pos {
  background: #cd8b52;
  color: #1d1d1d;
}

.ranking-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.ranking-top .ranking-name {
  color: #fff;
  font-weight: 700;
}

.ranking-score {
  color: #f4ac2a;
  font-weight: 800;
}

.ranking-list .ranking-empty {
  display: block;
  color: #9a9a9a;
  text-align: center;
}

.ranking-note {
  margin: 14px 0 0;
  color: #8a8a8a;
  font-size: 12px;
}

/* ---------- celular ---------- */

@media (max-width: 860px) {
  .games-layout {
    grid-template-columns: minmax(0, 420px);
  }
}

@media (max-width: 575px) {
  .games-hero {
    padding: 110px 0 20px;
  }

  .games-tab {
    min-width: 0;
    width: 100%;
  }

  .game-stage {
    border-radius: 18px;
  }

  .game-overlay {
    padding: 18px;
  }
}

/* durante a partida o jogo não pode rolar a página no celular */
body.is-playing {
  overscroll-behavior: none;
}
