/* Shared party-game UI for /ar/games/ */

.game-page {
  --game-good: #2a9d8f;
  --game-good-ink: #fff;
  --game-warn: #e4572e;
  --game-warn-ink: #fff;
  --game-soft: color-mix(in srgb, var(--hit) 70%, var(--surface));
}

.game-page .main {
  max-width: 40rem;
  padding-bottom: 5.5rem;
}

.game-page .page-title {
  font-family: "Noto Sans Arabic", var(--display), sans-serif;
  font-weight: 700;
  letter-spacing: 0;
  font-size: clamp(1.85rem, 6vw, 2.45rem);
  line-height: 1.2;
  margin: 0.15rem 0 0.4rem;
}

.game-page .sub {
  font-size: 1.05rem;
  line-height: 1.5;
  max-width: 32rem;
}

.game-page.hub-page .main {
  padding-bottom: 2rem;
}

/* —— Hub —— */

.game-hub-intro {
  margin: 0.85rem 0 0;
  padding: 0.95rem 1.05rem;
  border: 2px solid var(--line);
  border-radius: 0.95rem;
  background: var(--game-soft);
  display: grid;
  gap: 0.35rem;
}

.game-hub-intro strong {
  font-size: 1rem;
}

.game-hub-intro span {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

.game-hub-list {
  list-style: none;
  margin: 1.15rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.85rem;
}

.game-hub-list a {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.35rem 0.85rem;
  align-items: center;
  padding: 1.05rem 1.1rem;
  border: var(--border) solid var(--line);
  border-radius: 1rem;
  background: var(--surface);
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.game-hub-list a:hover {
  transform: translateY(-2px);
  box-shadow: 4px 4px 0 var(--line);
}

.game-hub-list a:active {
  transform: translateY(0);
}

.game-hub-mark {
  grid-row: 1 / span 3;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.8rem;
  border: 2px solid var(--line);
  background: var(--hit);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1.15rem;
  font-family: "Noto Sans Arabic", sans-serif;
  line-height: 1;
}

.game-hub-list strong {
  grid-column: 2;
  font-size: 1.2rem;
  line-height: 1.25;
}

.game-hub-list span {
  grid-column: 2;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.4;
}

.game-hub-list em {
  grid-column: 2;
  font-style: normal;
  font-size: 0.82rem;
  color: var(--ink);
  opacity: 0.72;
}

.game-hub-go {
  grid-row: 1 / span 3;
  grid-column: 3;
  align-self: center;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  border: 2px solid var(--line);
  background: var(--ink);
  color: var(--accent-ink);
  white-space: nowrap;
}

/* —— Stages —— */

.game-root {
  position: relative;
  margin-top: 1rem;
  min-height: 16rem;
}

.game-stage {
  display: grid;
  gap: 0.9rem;
  animation: game-stage-in 0.28s ease;
}

@keyframes game-stage-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.game-howto {
  margin: 0;
  padding: 0.85rem 1rem;
  border-radius: 0.85rem;
  border: 2px dashed color-mix(in srgb, var(--line) 55%, transparent);
  background: var(--game-soft);
  display: grid;
  gap: 0.45rem;
}

.game-howto ol {
  margin: 0;
  padding: 0 1.1rem 0 0;
  display: grid;
  gap: 0.25rem;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.4;
}

.game-howto-title {
  margin: 0;
  font-weight: 700;
  font-size: 0.95rem;
}

.game-progress {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0;
}

.game-progress-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
}

.game-progress-dots i {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 999px;
  background: var(--line-soft);
  display: block;
}

.game-progress-dots i.is-done {
  background: var(--game-good);
}

.game-progress-dots i.is-now {
  background: var(--ink);
  transform: scale(1.25);
}

.game-card {
  position: relative;
  overflow: hidden;
  padding: 1.35rem 1.2rem;
  border: var(--border) solid var(--line);
  border-radius: 1.1rem;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.game-card.is-play {
  padding: 1.5rem 1.25rem 1.65rem;
}

.game-card.is-flip {
  animation: game-flip 0.45s ease;
}

@keyframes game-flip {
  0% {
    transform: rotateY(0deg) scale(1);
  }
  45% {
    transform: rotateY(90deg) scale(0.96);
  }
  100% {
    transform: rotateY(0deg) scale(1);
  }
}

.game-kicker {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
  letter-spacing: 0.02em;
  font-weight: 600;
}

.game-big-word {
  margin: 0.45rem 0 0;
  font-family: "Noto Sans Arabic", "Source Sans 3", sans-serif;
  font-size: clamp(2.2rem, 9vw, 3.5rem);
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  word-break: break-word;
}

.game-prompt {
  margin: 0.35rem 0 0;
  font-size: clamp(1.35rem, 5.2vw, 1.9rem);
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
}

.game-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.game-actions.is-sticky {
  position: sticky;
  bottom: 0.65rem;
  z-index: 4;
  padding: 0.55rem;
  margin-inline: -0.15rem;
  border-radius: 1rem;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border: 2px solid var(--line-soft);
}

.game-actions .btn {
  flex: 1 1 8rem;
  min-height: 3.25rem;
  font-size: 1.08rem;
  font-weight: 700;
  border-radius: 0.85rem;
}

.game-actions .btn.is-primary {
  background: var(--ink);
  color: var(--accent-ink);
}

.game-actions .btn.is-good {
  background: var(--game-good);
  border-color: #1f6f66;
  color: var(--game-good-ink);
}

.game-actions .btn.is-skip {
  background: var(--hit);
}

.game-actions .btn.is-bad {
  background: var(--game-warn);
  border-color: #b93d1b;
  color: var(--game-warn-ink);
}

.game-actions .btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.game-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.game-chip {
  appearance: none;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--chip);
  color: inherit;
  padding: 0.55rem 1rem;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, transform 0.12s ease;
}

.game-chip:active {
  transform: scale(0.97);
}

.game-chip.is-on {
  background: var(--ink);
  color: var(--accent-ink);
}

.game-player-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(7.6rem, 1fr));
  gap: 0.7rem;
}

.game-player {
  appearance: none;
  border: var(--border) solid var(--line);
  border-radius: 0.95rem;
  background: var(--surface);
  box-shadow: var(--shadow);
  min-height: 4.5rem;
  padding: 0.85rem;
  font: inherit;
  font-weight: 700;
  font-size: 1.05rem;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease;
}

.game-player:active {
  transform: scale(0.97);
}

.game-player.is-picked {
  background: var(--ink);
  color: var(--accent-ink);
  animation: game-pick-pulse 0.35s ease;
}

.game-player.is-winner {
  background: var(--game-good);
  border-color: #1f6f66;
  color: #fff;
  animation: game-winner 0.55s ease;
}

@keyframes game-pick-pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.04);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes game-winner {
  0% {
    transform: scale(0.92);
  }
  60% {
    transform: scale(1.06);
  }
  100% {
    transform: scale(1);
  }
}

.game-timer {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 4.75rem;
  padding: 0.4rem 0.85rem;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--hit);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  font-size: 1.2rem;
}

.game-timer.is-low {
  background: var(--game-warn);
  color: #fff;
  animation: game-timer-pulse 0.7s ease infinite;
}

@keyframes game-timer-pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

.game-score {
  margin: 0;
  font-size: 1rem;
  color: var(--muted);
}

.game-score strong {
  color: var(--ink);
}

.game-field {
  display: grid;
  gap: 0.4rem;
}

.game-field label {
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 600;
}

.game-field input,
.game-field textarea {
  width: 100%;
  border: 2px solid var(--line);
  border-radius: 0.75rem;
  background: var(--surface);
  color: inherit;
  font: inherit;
  padding: 0.8rem 0.9rem;
}

.game-field input:focus,
.game-field textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--ink) 35%, transparent);
  outline-offset: 1px;
}

.game-field textarea {
  min-height: 5.5rem;
  resize: vertical;
}

.game-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.game-banner {
  margin: 0;
  padding: 0.85rem 1rem;
  border-radius: 0.85rem;
  background: var(--hit);
  font-weight: 700;
  text-align: center;
  line-height: 1.45;
}

.game-countdown {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  border-radius: 1.1rem;
  background: rgba(10, 10, 10, 0.78);
  color: #fff;
  font-family: var(--display);
  font-size: clamp(4rem, 22vw, 7rem);
  pointer-events: none;
}

.game-countdown.is-pop {
  animation: game-count-pop 0.85s ease;
}

@keyframes game-count-pop {
  0% {
    transform: scale(0.6);
    opacity: 0.2;
  }
  35% {
    transform: scale(1.12);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.game-burst {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.game-burst-speck {
  position: absolute;
  left: 50%;
  top: 55%;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 2px;
  animation: game-burst-fly 0.85s ease forwards;
}

@keyframes game-burst-fly {
  to {
    transform: translate(var(--dx), var(--dy)) rotate(var(--rot));
    opacity: 0;
  }
}

.game-forehead {
  min-height: min(48vh, 22rem);
  display: grid;
  place-items: center;
  text-align: center;
}

.game-mode-toggle {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.45rem;
}

.game-mode-toggle .game-chip {
  border-radius: 0.75rem;
  text-align: center;
  min-height: 2.75rem;
}

.game-section-label {
  margin: 0.35rem 0 0;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--muted);
}

@media (max-width: 520px) {
  .game-actions .btn {
    flex-basis: 100%;
  }

  .game-hub-list a {
    grid-template-columns: auto 1fr;
  }

  .game-hub-go {
    grid-row: auto;
    grid-column: 2;
    justify-self: start;
    margin-top: 0.15rem;
  }

  .game-hub-mark {
    grid-row: 1 / span 2;
  }
}

@media (prefers-reduced-motion: reduce) {
  .game-stage,
  .game-card.is-flip,
  .game-countdown.is-pop,
  .game-timer.is-low,
  .game-player.is-picked,
  .game-player.is-winner {
    animation: none;
  }
}
