/* ===========================================================
   Games — shared layout & individual styles
   =========================================================== */

.game-page {
  background: linear-gradient(180deg, var(--night-700) 0%, var(--night-900) 100%);
  color: var(--sand-100);
  min-height: 100vh;
}
.game-page .header {
  background: rgba(20, 10, 18, 0.6);
  border-bottom: 1px solid rgba(244, 210, 122, 0.12);
}
.game-page .nav__link { color: var(--sand-100); }
.game-page .nav__link:hover { background: rgba(244, 210, 122, 0.1); color: var(--sand-50); }
.game-page .nav__link.is-active { background: var(--gold-300); color: var(--night-700); }
.game-page .brand__name { color: var(--sand-50); }
.game-page .menu-toggle { background: rgba(244, 210, 122, 0.1); }
.game-page .menu-toggle span,
.game-page .menu-toggle span::before,
.game-page .menu-toggle span::after { background: var(--sand-100); }
.game-page .nav.is-open { background: var(--night-700); }

.game-stage {
  padding: 60px 0 100px;
  position: relative;
  overflow: hidden;
}
.game-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
          radial-gradient(circle at 20% 10%, rgba(231, 111, 46, 0.18), transparent 50%),
          radial-gradient(circle at 80% 90%, rgba(244, 210, 122, 0.1), transparent 50%);
  pointer-events: none;
}

.game-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--gold-300);
  margin-bottom: 30px;
}
.game-back:hover { color: var(--sand-50); }

.game-header {
  text-align: center;
  max-width: 720px;
  margin: 0 auto 50px;
  position: relative;
}
.game-header .eyebrow { color: var(--gold-300); }
.game-header .eyebrow::before { background: var(--gold-300); }
.game-header h1 {
  color: var(--sand-50);
  margin-top: 14px;
  font-weight: 400;
}
.game-header h1 em { color: var(--gold-300); font-style: italic; }
.game-header p { color: var(--sand-200); margin-top: 14px; }

.game-board {
  background: linear-gradient(160deg, rgba(75, 42, 79, 0.6), rgba(26, 15, 34, 0.85));
  border-radius: 28px;
  border: 1px solid rgba(244, 210, 122, 0.18);
  padding: 44px;
  max-width: 880px;
  margin: 0 auto;
  box-shadow: 0 30px 60px rgba(0,0,0,0.4), inset 0 1px 0 rgba(244, 210, 122, 0.12);
  position: relative;
  z-index: 1;
}

.game-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 34px;
  padding-bottom: 24px;
  border-bottom: 1px dashed rgba(244, 210, 122, 0.18);
}
.game-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.game-stat__label {
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--gold-300);
}
.game-stat__value {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 500;
  color: var(--sand-50);
  font-variation-settings: "opsz" 144;
}

.game-controls {
  margin-top: 32px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}
.game-message {
  margin-top: 24px;
  padding: 16px 22px;
  border-radius: 14px;
  background: rgba(244, 210, 122, 0.1);
  border: 1px solid rgba(244, 210, 122, 0.25);
  text-align: center;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.1rem;
  color: var(--sand-100);
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .3s ease;
}
.game-message--win {
  background: rgba(140, 200, 100, 0.15);
  border-color: rgba(140, 200, 100, 0.4);
  color: #C8E6B0;
}
.game-message--lose {
  background: rgba(231, 111, 46, 0.12);
  border-color: rgba(231, 111, 46, 0.35);
  color: #F5C8AE;
}

.game-tip {
  text-align: center;
  margin-top: 26px;
  font-size: 0.85rem;
  color: var(--sand-300);
  max-width: 540px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.5;
}

@media (max-width: 720px) {
  .game-board { padding: 28px 22px; border-radius: 20px; }
}

/* ===========================================================
   GAME 1 — Dune Slots (3-reel slot)
   =========================================================== */
.slots-machine {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  background: linear-gradient(180deg, #2A1234, #14081C);
  padding: 24px;
  border-radius: 20px;
  border: 2px solid var(--gold-500);
  box-shadow: inset 0 0 30px rgba(0,0,0,0.5), 0 0 50px rgba(212, 162, 62, 0.2);
  margin: 0 auto;
  max-width: 540px;
}
.slot-reel {
  height: 140px;
  background: linear-gradient(180deg, #FBE4C2, #E89776);
  border-radius: 14px;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 4px 12px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}
.slot-reel::before, .slot-reel::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  height: 22px;
  z-index: 2;
  pointer-events: none;
}
.slot-reel::before { top: 0; background: linear-gradient(180deg, rgba(20,8,28,0.5), transparent); }
.slot-reel::after  { bottom: 0; background: linear-gradient(0deg, rgba(20,8,28,0.5), transparent); }

.slot-reel__strip {
  position: absolute;
  left: 0; right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 1.4s cubic-bezier(.2,.65,.3,1);
}
.slot-reel.is-spinning .slot-reel__strip {
  transition: none;
  animation: reel-spin .15s linear infinite;
}
@keyframes reel-spin {
  from { transform: translateY(0); }
  to { transform: translateY(-140px); }
}
.slot-symbol {
  height: 140px;
  width: 100%;
  display: grid;
  place-items: center;
  font-size: 4rem;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.2));
}

.slots-payline {
  position: absolute;
  left: 16px; right: 16px;
  top: 50%;
  transform: translateY(-50%);
  height: 2px;
  background: linear-gradient(to right, transparent, var(--gold-300), transparent);
  z-index: 3;
  pointer-events: none;
  opacity: 0.6;
}

@media (max-width: 540px) {
  .slot-reel { height: 110px; }
  .slot-symbol { font-size: 3rem; height: 110px; }
}

/* ===========================================================
   GAME 2 — Mirage Wheel
   =========================================================== */
.wheel-wrap {
  position: relative;
  width: min(420px, 90vw);
  aspect-ratio: 1;
  margin: 0 auto;
}
.wheel {
  width: 100%; height: 100%;
  border-radius: 50%;
  position: relative;
  transform: rotate(0deg);
  transition: transform 4s cubic-bezier(.15,.65,.25,1);
  box-shadow: 0 0 0 8px var(--gold-500), 0 20px 50px rgba(0,0,0,0.5), inset 0 0 60px rgba(0,0,0,0.3);
}
.wheel svg { width: 100%; height: 100%; display: block; border-radius: 50%; }

.wheel-pointer {
  position: absolute;
  top: -22px;
  left: 50%;
  transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 18px solid transparent;
  border-right: 18px solid transparent;
  border-top: 30px solid var(--gold-300);
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.4));
  z-index: 4;
}
.wheel-center {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 80px; height: 80px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--gold-300), var(--gold-700));
  border: 4px solid var(--night-700);
  display: grid;
  place-items: center;
  box-shadow: inset 0 -4px 8px rgba(0,0,0,0.2), 0 0 16px rgba(244, 210, 122, 0.5);
  z-index: 3;
}
.wheel-center svg {
  width: 60%;
  height: 60%;
  display: block;
}

/* ===========================================================
   GAME 3 — Oasis Match (memory match)
   =========================================================== */
.match-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  max-width: 480px;
  margin: 0 auto;
}
.match-card {
  aspect-ratio: 1;
  perspective: 800px;
  cursor: pointer;
}
.match-card__inner {
  width: 100%; height: 100%;
  transform-style: preserve-3d;
  transition: transform .6s cubic-bezier(.3,.6,.4,1);
  position: relative;
}
.match-card.is-flipped .match-card__inner,
.match-card.is-matched .match-card__inner { transform: rotateY(180deg); }

.match-card__face {
  position: absolute;
  inset: 0;
  border-radius: 14px;
  display: grid;
  place-items: center;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  font-size: 2.2rem;
  border: 1px solid rgba(244, 210, 122, 0.3);
}
.match-card__back {
  background: linear-gradient(135deg, #4B2A4F, #7A3A1B);
  color: var(--gold-300);
  position: relative;
  overflow: hidden;
}
.match-card__back svg {
  width: 56%;
  height: 56%;
  display: block;
  filter: drop-shadow(0 0 6px rgba(244, 210, 122, 0.35));
  transition: transform .3s ease;
}
.match-card:hover:not(.is-flipped):not(.is-matched) .match-card__back svg {
  transform: scale(1.08) rotate(8deg);
}
.match-card__back::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px dashed rgba(244, 210, 122, 0.35);
  border-radius: 10px;
}
.match-card__front {
  transform: rotateY(180deg);
  background: linear-gradient(135deg, #FBE4C2, #E89776);
}
.match-card.is-matched .match-card__front {
  background: linear-gradient(135deg, #C9E2A8, #8FB97A);
  box-shadow: 0 0 20px rgba(140, 200, 100, 0.5);
  animation: match-pop .5s ease;
}
@keyframes match-pop {
  0%, 100% { transform: rotateY(180deg) scale(1); }
  50% { transform: rotateY(180deg) scale(1.08); }
}

@media (max-width: 480px) {
  .match-grid { gap: 8px; }
  .match-card__face { font-size: 1.7rem; border-radius: 10px; }
}

/* ===========================================================
   GAME 4 — Sand Hi-Lo
   =========================================================== */
.hilo-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  flex-wrap: wrap;
  margin: 30px 0;
}
.hilo-card {
  width: 180px;
  aspect-ratio: 5 / 7;
  border-radius: 18px;
  background: linear-gradient(160deg, #FBE4C2, #E89776);
  display: grid;
  place-items: center;
  position: relative;
  box-shadow: 0 12px 30px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.3);
  border: 2px solid var(--gold-500);
  transition: transform .35s cubic-bezier(.2,.7,.3,1.2);
}
.hilo-card.is-flipping { animation: hilo-flip .6s ease; }
@keyframes hilo-flip {
  0%   { transform: rotateY(0deg) scale(1); }
  50%  { transform: rotateY(90deg) scale(0.9); }
  100% { transform: rotateY(0deg) scale(1); }
}
.hilo-card__value {
  font-family: var(--font-display);
  font-size: 5rem;
  font-weight: 500;
  color: var(--clay-700);
  line-height: 1;
  font-variation-settings: "opsz" 144;
}
.hilo-card__label {
  position: absolute;
  top: 12px; left: 14px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--clay-500);
}
.hilo-card__corner {
  position: absolute;
  bottom: 12px; right: 14px;
  font-size: 1.2rem;
  color: var(--clay-500);
  transform: rotate(180deg);
}
.hilo-card--hidden {
  background: linear-gradient(160deg, #4B2A4F, #2A1234);
  color: var(--gold-300);
}
.hilo-card--hidden .hilo-card__value { color: var(--gold-300); font-style: italic; }

.hilo-vs {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.4rem;
  color: var(--gold-300);
  letter-spacing: 0.08em;
}

.hilo-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.hilo-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 16px 32px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: transform .2s ease, box-shadow .2s ease;
}
.hilo-btn--up {
  background: linear-gradient(135deg, #8FB97A, #5A8E48);
  color: white;
  box-shadow: 0 10px 24px -8px rgba(140, 200, 100, 0.5);
}
.hilo-btn--down {
  background: linear-gradient(135deg, #E76F2E, #B25A2D);
  color: white;
  box-shadow: 0 10px 24px -8px rgba(231, 111, 46, 0.5);
}
.hilo-btn:hover { transform: translateY(-2px); }
.hilo-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.hilo-history {
  margin-top: 22px;
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
}
.hilo-history-pip {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.78rem;
  font-weight: 700;
  background: rgba(244, 210, 122, 0.15);
  color: var(--sand-200);
  border: 1px solid rgba(244, 210, 122, 0.3);
}
.hilo-history-pip--win  { background: rgba(140, 200, 100, 0.25); color: #C9E2A8; border-color: rgba(140, 200, 100, 0.5); }
.hilo-history-pip--lose { background: rgba(231, 111, 46, 0.25); color: #F5C8AE; border-color: rgba(231, 111, 46, 0.5); }

@media (max-width: 540px) {
  .hilo-card { width: 140px; }
  .hilo-card__value { font-size: 3.6rem; }
}