/* Scarab Dice — Ancient Egypt. Self-contained styles for this game route. */

.game-page {
  --theme: #8a6a12;
  --theme-ink: #fff6e0;
  --theme-tint: #fbf1d8;
  --theme-deep: #6a4f0c;
}

/* --- shared game-route shell --- */

.game-head {
  padding: var(--s-8) 0;
  background-image:
    linear-gradient(to bottom, rgba(252, 248, 241, 0.5), rgba(252, 248, 241, 0.92) 70%, var(--ivory)),
    url("/assets/img/bg-aurora-band.webp");
  background-size: cover;
  background-position: center 25%;
  border-bottom: 1px solid var(--line-soft);
}

.game-head__grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: var(--s-7);
  align-items: center;
}

.game-head h1 { margin: var(--s-3) 0 var(--s-4); }
.game-head p { max-width: 46ch; margin-bottom: 0; }

.game-head__art {
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: var(--frame);
  box-shadow: var(--sink), var(--float);
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr);
  gap: var(--s-7);
  padding: var(--s-7) 0 var(--s-8);
  align-items: start;
}

.stage { min-width: 0; }

.board {
  border: var(--frame);
  border-radius: var(--radius-lg);
  box-shadow: var(--sink), var(--float);
  padding: var(--s-6);
  margin-bottom: var(--s-5);
  background:
    radial-gradient(70% 60% at 50% 0%, rgba(232, 164, 0, 0.16), transparent 70%),
    linear-gradient(180deg, var(--theme-tint), #fffdf8);
}

.result {
  min-height: 76px;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  background: var(--surface);
  border: 2px solid var(--line-soft);
  border-radius: var(--radius);
  padding: var(--s-4) var(--s-5);
  margin: 0 0 var(--s-5);
  font-weight: 600;
  color: var(--purple);
}

.result.is-win { border-color: var(--gold); background: var(--gold-tint); }
.result.is-loss { border-color: var(--line); }

.controls {
  background: var(--surface);
  border: var(--frame);
  border-radius: var(--radius);
  box-shadow: var(--sink);
  padding: var(--s-5);
  margin-bottom: var(--s-5);
}

.controls fieldset {
  border: 0;
  padding: 0;
  margin: 0 0 var(--s-5);
}

.controls legend {
  padding: 0;
  margin-bottom: var(--s-3);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--purple);
}

.chips { display: flex; flex-wrap: wrap; gap: var(--s-2); }

.chip { position: relative; }

.chip input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  left: 0;
  top: 0;
  margin: 0;
  cursor: pointer;
}

.chip span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 var(--s-4);
  border: 2px solid var(--line-soft);
  border-radius: var(--radius-pill);
  color: var(--purple);
  font-weight: 700;
  font-size: 0.95rem;
  background: var(--surface);
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.chip input:checked + span { border-color: var(--gold); background: var(--gold-tint); color: var(--gold-ink); }
.chip input:focus-visible + span { outline: 3px solid var(--purple-mid); outline-offset: 2px; }
.chip:hover span { border-color: var(--purple-mid); }

.chips--numbers .chip span { min-width: 52px; font-variant-numeric: tabular-nums; }

.stake-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-3);
}

.stake-field {
  display: inline-flex;
  align-items: center;
  border: 2px solid var(--line-soft);
  border-radius: var(--radius-pill);
  background: var(--surface);
  overflow: hidden;
}

.stake-field button {
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  color: var(--purple);
  font: inherit;
  font-size: 1.3rem;
  font-weight: 800;
  cursor: pointer;
}

.stake-field button:hover { background: var(--purple-soft); }

.stake-field input {
  width: 110px;
  height: 44px;
  border: 0;
  text-align: center;
  font: inherit;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--purple);
  background: transparent;
  -moz-appearance: textfield;
}

.stake-field input::-webkit-outer-spin-button,
.stake-field input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.actions { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: center; }

.bank {
  background: var(--surface);
  border: var(--frame);
  border-radius: var(--radius);
  box-shadow: var(--sink);
  padding: var(--s-5);
  display: grid;
  gap: var(--s-3);
}

.bank__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
}

.bank__balance {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--purple);
  font-variant-numeric: tabular-nums;
}

.bank__label {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  display: block;
}

.bank__note { font-size: 0.85rem; color: var(--ink-soft); margin: 0; }
.bank__topup { font-size: 0.85rem; color: var(--gold-ink); font-weight: 700; margin: 0; }

.side { display: grid; gap: var(--s-5); }

.side section {
  background: var(--surface);
  border: var(--frame);
  border-radius: var(--radius);
  box-shadow: var(--sink);
  padding: var(--s-5);
}

.side h2 { font-size: 1.1rem; margin-bottom: var(--s-3); }
.side p, .side li { font-size: 0.92rem; }
.side p:last-child, .side ol:last-child, .side ul:last-child { margin-bottom: 0; }
.side ol, .side ul { padding-left: var(--s-5); margin-bottom: var(--s-4); }

.paytable { width: 100%; border-collapse: collapse; font-size: 0.88rem; margin: 0; }

.paytable caption {
  caption-side: bottom;
  text-align: left;
  padding-top: var(--s-3);
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.paytable th, .paytable td {
  padding: var(--s-2) var(--s-2);
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.paytable thead th {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.paytable td + td, .paytable th + th { text-align: right; font-variant-numeric: tabular-nums; }
.paytable tbody tr:last-child th, .paytable tbody tr:last-child td { border-bottom: 0; }
.paytable tbody th { font-weight: 700; color: var(--purple); }

.more { padding: 0 0 var(--s-8); }
.more h2 { font-size: 1.25rem; margin-bottom: var(--s-5); }

.more__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--s-5);
}

.more__card {
  display: block;
  border: var(--frame);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--sink);
  color: var(--ink);
  font-weight: 600;
}

.more__card:hover { text-decoration: none; border-color: var(--purple-mid); }
.more__card img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }
.more__card span { display: block; padding: var(--s-3) var(--s-4); color: var(--purple); font-weight: 700; }
.more__card em { display: block; font-style: normal; font-size: 0.85rem; color: var(--ink-soft); font-weight: 400; }

@media (max-width: 940px) {
  .game-layout { grid-template-columns: 1fr; gap: var(--s-6); }
  .game-head__grid { grid-template-columns: 1fr; }
  .game-head__art { order: -1; }
}

/* --- the dice table itself --- */

.dice-scene {
  display: grid;
  justify-items: center;
  gap: var(--s-5);
}

.dice-row {
  display: flex;
  gap: var(--s-5);
  justify-content: center;
}

.die {
  width: 120px;
  height: 120px;
  padding: 16px;
  border-radius: 24px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 6px;
  background: linear-gradient(155deg, #fffdf5 0%, #f7ecd6 60%, #ecdfc4 100%);
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.95),
    inset 0 -6px 10px rgba(122, 96, 40, 0.22),
    0 14px 22px -14px rgba(58, 29, 99, 0.55);
}

.die__cell { display: grid; place-items: center; }

.pip {
  width: 74%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, #ffd979, #b9800a 78%);
  box-shadow: inset 0 -2px 3px rgba(80, 50, 0, 0.45);
}

.die.is-rolling { animation: tumble 0.22s linear infinite; }

@keyframes tumble {
  0% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-9px) rotate(-5deg); }
  50% { transform: translateY(0) rotate(0deg); }
  75% { transform: translateY(-5px) rotate(5deg); }
  100% { transform: translateY(0) rotate(0deg); }
}

.plinth {
  width: min(460px, 100%);
  height: 26px;
  border-radius: 0 0 18px 18px;
  background: linear-gradient(180deg, #4a2673, #3a1d63);
  box-shadow: 0 12px 20px -14px rgba(58, 29, 99, 0.8);
  position: relative;
}

.plinth::before {
  content: "";
  position: absolute;
  inset: 7px 18px auto;
  height: 4px;
  border-radius: 2px;
  background: rgba(232, 164, 0, 0.55);
}

.total-readout {
  display: inline-flex;
  align-items: baseline;
  gap: var(--s-2);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.total-readout b {
  font-size: 2rem;
  color: var(--purple);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

.exact-row[hidden] { display: none; }
