:root {
  --egypt-night: #171006;
  --egypt-brown: #3b2209;
  --egypt-gold: #dba72d;
  --egypt-light: #ffe7a0;
  --egypt-lapis: #08798c;
  --egypt-red: #9f2f1f;
  --egypt-sand: #f2dfb5;
}

body {
  background-color: #efe0ba;
  background-image:
    linear-gradient(rgba(92, 58, 13, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(92, 58, 13, 0.08) 1px, transparent 1px);
  background-size: 22px 22px;
}

button,
input {
  border-radius: 0 !important;
}

.game-hero {
  position: relative;
  overflow: hidden;
  padding: clamp(3rem, 7vw, 6.5rem) 0;
  color: #fff5d5;
  text-align: center;
  background:
    radial-gradient(circle at 50% 105%, rgba(219, 167, 45, 0.38), transparent 38%),
    linear-gradient(100deg, rgba(0, 0, 0, 0.22), transparent 40%, rgba(0, 0, 0, 0.22)),
    var(--egypt-night);
  border-bottom: 8px solid var(--egypt-gold);
}

.game-hero::before,
.game-hero::after {
  content: "𓂀 𓆣 𓋹 𓁹 𓆣 𓂀 𓋹 𓁹 𓆣 𓂀 𓋹";
  position: absolute;
  left: 0;
  width: 100%;
  overflow: hidden;
  color: var(--egypt-gold);
  font-size: 1.35rem;
  letter-spacing: 1rem;
  white-space: nowrap;
  opacity: 0.75;
}

.game-hero::before { top: 13px; }
.game-hero::after { bottom: 13px; transform: rotate(180deg); }

.game-hero .container {
  position: relative;
  z-index: 1;
}

.eyebrow {
  max-width: none;
  margin: 0 0 0.6rem;
  color: var(--egypt-gold);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.game-hero h1 {
  margin-bottom: 0.7rem;
  color: #fff1be;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3rem, 9vw, 7.4rem);
  font-weight: 700;
  letter-spacing: -0.06em;
  line-height: 0.9;
  text-shadow: 0 3px 0 #6d3c08, 0 8px 24px #000;
}

.hero-copy {
  max-width: 670px;
  margin: 0 auto;
  color: #e7d6ad;
  font-size: clamp(1rem, 2vw, 1.2rem);
}

.game-shell {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 0;
  margin-block: clamp(2rem, 5vw, 4rem);
  padding-inline: 0;
  border: 3px solid var(--egypt-night);
  box-shadow: 10px 10px 0 rgba(64, 39, 7, 0.2);
}

.temple-stage {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: clamp(1rem, 3vw, 2rem);
  color: #fff5d5;
  background:
    linear-gradient(90deg, rgba(219, 167, 45, 0.08) 1px, transparent 1px),
    var(--egypt-night);
  background-size: 30px 100%;
  border-right: 3px solid var(--egypt-night);
}

.stage-heading,
.board-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  color: var(--egypt-gold);
}

.stage-heading {
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(219, 167, 45, 0.5);
}

.stage-heading p {
  margin: 0;
  color: #f6e7bd;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
}

.dice-tray {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(0.65rem, 2vw, 1rem);
  min-height: 210px;
  padding: 2rem 0;
  perspective: 700px;
}

.die {
  --pip: #2b1704;
  position: relative;
  display: grid;
  width: clamp(70px, 9vw, 92px);
  aspect-ratio: 1;
  grid-template: repeat(3, 1fr) / repeat(3, 1fr);
  padding: 13%;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.9), transparent 34%),
    linear-gradient(315deg, #c99a39, #fff0bd 65%);
  border: 2px solid #7c4b0a;
  box-shadow:
    inset -7px -8px 12px rgba(79, 39, 0, 0.28),
    inset 5px 5px 10px rgba(255, 255, 255, 0.75),
    0 8px 0 #764509,
    0 14px 20px rgba(0, 0, 0, 0.45);
  transform: rotateX(5deg);
}

.pip {
  width: 58%;
  aspect-ratio: 1;
  place-self: center;
  background: radial-gradient(circle at 38% 34%, #70400e 0 17%, var(--pip) 52%, transparent 55%);
}

.die.is-rolling {
  animation: dice-tumble 0.72s cubic-bezier(0.2, 0.75, 0.25, 1) both;
}

.die:nth-child(2).is-rolling { animation-delay: 0.06s; }
.die:nth-child(3).is-rolling { animation-delay: 0.12s; }

@keyframes dice-tumble {
  0% { transform: translateY(0) rotateX(5deg) rotateZ(0); }
  25% { transform: translateY(-35px) rotateX(110deg) rotateZ(75deg) scale(1.06); }
  55% { transform: translateY(5px) rotateX(230deg) rotateZ(180deg); }
  78% { transform: translateY(-10px) rotateX(320deg) rotateZ(300deg); }
  100% { transform: translateY(0) rotateX(365deg) rotateZ(360deg); }
}

.result-panel {
  display: grid;
  gap: 0.25rem;
  min-height: 108px;
  padding: 1rem;
  text-align: center;
  background: rgba(219, 167, 45, 0.08);
  border: 1px solid rgba(219, 167, 45, 0.55);
}

.result-label {
  color: var(--egypt-gold);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

#result-title {
  color: #fff0b4;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.4rem;
}

#result-detail {
  color: #d8c89f;
  font-size: 0.9rem;
}

.result-panel.win { border-color: #ffcb49; background: rgba(219, 167, 45, 0.2); }
.result-panel.loss { border-color: #a85d4b; }

.stake-controls {
  display: grid;
  grid-template-columns: minmax(150px, 0.75fr) 1.25fr;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.stake-field label {
  display: block;
  margin-bottom: 0.35rem;
  color: #cfbd8d;
  font-size: 0.78rem;
  font-weight: 700;
}

.stake-input {
  display: grid;
  grid-template-columns: 42px 1fr 42px;
}

.stake-input button,
.stake-input input {
  min-width: 0;
  min-height: 48px;
  color: var(--egypt-night);
  font: 800 1rem var(--font-mono);
  background: var(--egypt-sand);
  border: 2px solid var(--egypt-gold);
}

.stake-input button {
  cursor: pointer;
}

.stake-input button:hover {
  background: var(--egypt-light);
}

.stake-input input {
  width: 100%;
  text-align: center;
  border-right: 0;
  border-left: 0;
  appearance: textfield;
}

.roll-button {
  align-self: end;
  min-height: 48px;
  padding: 0.8rem 1rem;
  color: #171006;
  font: 900 1rem var(--font-display);
  text-transform: uppercase;
  background: linear-gradient(#ffde76, #d39818);
  border: 2px solid #ffdc6a;
  box-shadow: 4px 4px 0 #704008;
  cursor: pointer;
}

.roll-button:hover:not(:disabled) {
  background: #ffe396;
  transform: translate(-1px, -1px);
  box-shadow: 5px 5px 0 #704008;
}

.roll-button:active:not(:disabled) {
  transform: translate(3px, 3px);
  box-shadow: 1px 1px 0 #704008;
}

.roll-button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.8);
  opacity: 0.55;
}

.selection-note {
  min-height: 1.4em;
  margin: 0.7rem 0 0;
  color: #d9c391;
  font-size: 0.82rem;
  text-align: center;
}

.betting-board {
  min-width: 0;
  padding: clamp(1rem, 3vw, 2rem);
  background:
    linear-gradient(45deg, transparent 48%, rgba(83, 43, 5, 0.08) 49%, rgba(83, 43, 5, 0.08) 51%, transparent 52%),
    #ead5a5;
  background-size: 20px 20px;
}

.board-title {
  color: var(--egypt-brown);
}

.board-title h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
}

.betting-board h3 {
  margin: 1.5rem 0 0.7rem;
  color: #5b350b;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-align: center;
  text-transform: uppercase;
}

.main-bets {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 1.3rem;
}

.bet-tile {
  min-height: 68px;
  padding: 0.65rem;
  color: var(--egypt-night);
  background: rgba(255, 246, 213, 0.78);
  border: 2px solid #754810;
  box-shadow: 3px 3px 0 rgba(72, 40, 6, 0.27);
  cursor: pointer;
}

.bet-tile:hover {
  background: #fff0bd;
  border-color: #171006;
  transform: translateY(-2px);
}

.bet-tile[aria-pressed="true"] {
  color: #fff4c9;
  background: var(--egypt-lapis);
  border-color: #023f49;
  box-shadow: inset 0 0 0 3px #e8b942, 4px 4px 0 rgba(72, 40, 6, 0.3);
}

.bet-main {
  display: grid;
  min-height: 120px;
  align-content: center;
  gap: 0.2rem;
}

.bet-name {
  font: 800 clamp(1.5rem, 3vw, 2.4rem) Georgia, "Times New Roman", serif;
  text-transform: uppercase;
}

.bet-range {
  font-weight: 800;
}

.bet-odds {
  font-size: 0.75rem;
}

.total-bets {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.5rem;
}

.total-bets .bet-tile {
  display: grid;
  place-content: center;
  gap: 0.1rem;
}

.total-bets b {
  font: 800 1.25rem Georgia, "Times New Roman", serif;
}

.total-bets span {
  font: 700 0.7rem var(--font-mono);
}

.rules-section {
  margin-bottom: clamp(3rem, 7vw, 6rem);
}

.rules-section details {
  background: #fff8e7;
  border: 2px solid var(--egypt-brown);
}

.rules-section summary {
  padding: 1rem 1.25rem;
  color: #fff4cf;
  font: 800 1.05rem var(--font-display);
  background: var(--egypt-brown);
  cursor: pointer;
}

.rules-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  padding: clamp(1rem, 3vw, 2rem);
}

.rules-content h2 {
  color: var(--egypt-red);
  font-size: 1.25rem;
}

.rules-content p:last-child,
.rules-content ol:last-child {
  margin-bottom: 0;
}

.reset-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: #dbc28c;
  border: 2px solid var(--egypt-brown);
  border-top: 0;
}

.reset-panel p {
  margin: 0;
  font-size: 0.9rem;
}

.reset-button {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0.6rem 1rem;
  color: var(--egypt-brown);
  font-weight: 800;
  background: transparent;
  border: 2px solid var(--egypt-brown);
  cursor: pointer;
}

.reset-button:hover {
  color: white;
  background: var(--egypt-brown);
}

.site-footer a {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.noscript-note {
  max-width: none;
  margin: 0;
  padding: 1rem;
  color: white;
  text-align: center;
  background: #7b1d13;
}

@media (max-width: 860px) {
  .game-shell {
    grid-template-columns: 1fr;
    width: min(100% - 1rem, var(--max));
  }

  .temple-stage {
    border-right: 0;
    border-bottom: 3px solid var(--egypt-night);
  }

  .total-bets {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 560px) {
  .game-hero {
    padding-block: 4.5rem;
  }

  .game-hero h1 {
    font-size: clamp(3rem, 18vw, 5rem);
  }

  .dice-tray {
    min-height: 170px;
  }

  .die {
    width: min(24vw, 78px);
  }

  .stake-controls,
  .rules-content {
    grid-template-columns: 1fr;
  }

  .main-bets {
    gap: 0.5rem;
  }

  .bet-main {
    min-height: 110px;
    padding-inline: 0.35rem;
  }

  .bet-name {
    font-size: 1.4rem;
  }

  .total-bets {
    grid-template-columns: repeat(3, 1fr);
  }

  .reset-panel {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto !important;
  }
}
