:root {
  color-scheme: dark;
  --ink: #f6eddf;
  --gold: #f4cb85;
  --line: #b8825966;
  --serif: "Iowan Old Style", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; background: #100b17; color: var(--ink); font: 1rem var(--sans); }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible { outline: 2px solid #ffe2a5; outline-offset: 3px; }
h1, h2, p { margin: 0; }

.masthead { position: relative; z-index: 2; background: #110d18; border-bottom: 1px solid #b882593e; }
.masthead-inner { max-width: 1280px; min-height: 58px; padding: 0 34px; margin: auto; display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 13px; }
.brand-icon { width: 27px; height: 27px; display: grid; place-items: center; border: 1px solid #b8814d; rotate: 45deg; background: linear-gradient(135deg,#493023,#211223); box-shadow: inset 0 0 9px #e5956435,0 0 13px #e595642b; margin-inline: 4px 6px; }
.brand-icon i { width: 14px; height: 21px; rotate: -45deg; background: #ffe2a3; clip-path: polygon(54% 0,93% 0,59% 39%,94% 39%,14% 100%,39% 51%,9% 51%); }
.brand strong { font: 800 1.04rem var(--serif); letter-spacing: .075em; text-transform: uppercase; white-space: nowrap; }
.icon-button { background: #23192b; border: 1px solid #b8875866; border-radius: 5px; padding: 8px 12px; font-size: .875rem; }
.icon-button:hover { background: #39253c; border-color: #d5ad76; }
#sound-state { color: var(--gold); margin-left: 2px; }

.temple { position: relative; isolation: isolate; min-height: calc(100svh - 59px); padding: 17px 15px 24px; overflow: hidden; }
.temple::before, .temple::after { content: ""; position: absolute; inset: 0; z-index: -2; pointer-events: none; }
.temple::before { background: radial-gradient(ellipse at 50% 39%,#301b44 0%,#140d21 58%,#0e0a14 100%) center, url("assets/temple.webp") center 43% / cover; background-blend-mode: soft-light, normal; }
.temple::after { z-index: -1; background: linear-gradient(180deg,#120a21a8,#18102028 26%,#1a0f2552 63%,#100b17e3); }
.title-block { display: flex; justify-content: center; align-items: center; gap: 12px; text-align: center; margin: 0 auto 10px; }
.title-block h1 { text-wrap: balance; text-transform: uppercase; font: 900 clamp(1.95rem,4.0vw,3.46rem)/1.04 var(--serif); letter-spacing: .042em; padding-left: .042em; color: #fff2d6; text-shadow: 0 3px 1px #78502d,0 5px 24px #d588506b,0 0 40px #331939; }
.title-rule { position: relative; flex: 0 1 42px; height: 1px; background: linear-gradient(90deg,transparent,#e6b981); }
.title-rule::after { content: ""; position: absolute; right: 0; width: 5px; height: 5px; top: -2px; rotate: 45deg; background: #efc48b; }
.title-rule:last-child { rotate: 180deg; }

.battle { position: relative; min-width: 0; width: min(100%,700px); margin: auto; --magic: #ffd69a; --magic-deep: #c3854e; --magic-shadow: #a45ae2; }
.battle[data-theme="poseidon"] { --magic: #9dfff3; --magic-deep: #42aaa8; --magic-shadow: #4c89d0; }
.combat-window { position: relative; }
.combat-window .combat-scene { height: clamp(237px,22.7vw,326px); margin-top: 0; }
.combat-window .combat-boss { top: 33px; }
.boss { position: absolute; top: 0; left: 0; right: 0; z-index: 2; padding: 9px 14px 16px; background: linear-gradient(180deg,#190f1def,#1b0f20d2 65%,transparent); border-radius: 5px 5px 0 0; }
.boss-name-row { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.boss-name-row h2 { font: 800 clamp(1.09rem,2.4vw,1.38rem)/1.08 var(--serif); letter-spacing: .03em; white-space: nowrap; }
#god-name { margin-right: auto; margin-left: 6px; color: var(--magic); font-size: .69rem; letter-spacing: .075em; text-transform: uppercase; }
#boss-hp { color: #ffe2ce; font: 700 .88rem var(--sans); font-variant-numeric: tabular-nums; white-space: nowrap; }
.health-track { position: relative; height: 11px; margin-top: 6px; border: 1px solid #d79d76a8; border-radius: 3px; overflow: hidden; background: #08060e; }
#health-trail { position: absolute; inset: 0 auto 0 0; width: 100%; background: linear-gradient(90deg,#983f42,#ffd6a7); transition: width .73s .13s ease-out; }
#health-fill { position: relative; height: 100%; width: 100%; background: linear-gradient(90deg,#7b2744,#be414f 74%,#ff9872); transition: width .38s cubic-bezier(.23,.8,.27,1); box-shadow: inset 0 1px #ffbfa894; }
.reset-health #health-trail, .reset-health #health-fill { transition: none; }

.board-frame { position: relative; isolation: isolate; margin-top: 6px; padding: 13px 17px; background: linear-gradient(90deg,#1d1325,#422b36 50%,#1d1325); border: 1px solid #bc895aa8; border-radius: 5px; box-shadow: 0 15px 40px #06030ba6,inset 0 0 0 4px #221526,inset 0 0 0 5px #b882593d; }
.board-frame::before, .board-rim { content: ""; position: absolute; left: 13px; right: 13px; height: 2px; background: linear-gradient(90deg,transparent,#a77249 15%,#f2c688 51%,#a77249 85%,transparent); opacity: .65; }
.board-frame::before { top: 5px; }
.board-rim { bottom: 5px; }
.frame-side { position: absolute; width: 5px; inset-block: 17px; z-index: 1; background: repeating-linear-gradient(178deg,#c58d52 0 2px,#452940 2px 5px,transparent 5px 17px); opacity: .56; }
.frame-side.left { left: 6px; }
.frame-side.right { right: 6px; }
.relic-board { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 6px; padding: 6px; border-radius: 3px; background: #110a18; box-shadow: 0 0 0 1px #be905d57,inset 0 1px 8px #000; }
.relic { position: relative; display: grid; place-items: center; isolation: isolate; aspect-ratio: 1.78; overflow: hidden; border: 1px solid #8b68824d; border-radius: 4px; background: radial-gradient(ellipse at 50% 51%,color-mix(in srgb,var(--symbol) 17%,#21162b),#1b1125 75%); box-shadow: inset 0 1px #dfb6d418,inset 0 0 10px #0805118c; }
.relic::before, .relic::after { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.relic::before { inset: 4px; border: 1px solid #d3add313; border-radius: 2px; }
.relic::after { opacity: 0; background: radial-gradient(ellipse at 50% 50%,transparent 18%,color-mix(in srgb,var(--magic) 61%,transparent)); box-shadow: inset 0 0 0 1px var(--magic),inset 0 0 18px var(--magic-deep); }
.relic-art { width: 100%; height: 100%; object-fit: contain; position: absolute; mix-blend-mode: screen; filter: saturate(1.12) contrast(1.08); scale: 1.08; }
.relic-fallback { position: absolute; color: var(--symbol); font: bold clamp(1.5rem,4.8vw,3.9rem)/1 Georgia,serif; text-shadow: 0 0 14px var(--symbol); }
.relic.matched { border-color: var(--magic); box-shadow: 0 0 13px var(--magic-deep),inset 0 0 13px var(--magic-shadow); z-index: 3; }
.relic.matched::after { opacity: .64; animation: relic-light .64s ease-out both; }
.relic.matched .relic-art { filter: saturate(1.24) brightness(1.29); }
.battle[data-tier="jackpot"] .relic.matched { border-color: #ffe4a0; box-shadow: 0 0 14px #ffbb69,inset 0 0 18px #dc843c; }
.relic.spinning .relic-art, .relic.spinning .relic-fallback { filter: blur(3px) brightness(.85); transform: translateY(10%) scaleY(1.23); }
.relic.stopped .relic-art, .relic.stopped .relic-fallback { animation: tile-settle .2s cubic-bezier(.13,.55,.4,1.22) both; }
@keyframes relic-light { from { opacity: .94; } to { opacity: .55; } }
@keyframes tile-settle { 0% { transform: translateY(-26%) scaleY(1.14); opacity: .63; } 100% { transform: none; opacity: 1; } }

#effects, .damage-layer { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 5; }
.damage-layer { z-index: 6; }
.damage-floater { position: absolute; margin-left: -.35em; color: var(--magic); font: bold 2.8rem/.92 Georgia,serif; letter-spacing: -.02em; text-shadow: 0 2px #381432,0 0 9px #fff8b597,0 0 18px var(--magic-shadow); animation: rise .8s cubic-bezier(.13,.73,.48,1) both; }
.damage-floater.blocked { color: #f1e5d7; font: 800 1.45rem/1.1 var(--serif); text-shadow: 0 2px #35242a,0 0 12px #bca68d; }
@keyframes rise { 0% { transform: translateY(15px) scale(.73); opacity: 0; } 16% { transform: translateY(0) scale(1.08); opacity: 1; } 48% { opacity: 1; } 100% { transform: translateY(-51px); opacity: 0; } }
.light-line { position: absolute; height: 2px; transform-origin: 0 center; transform: rotate(var(--angle)) scaleX(0); border-radius: 100%; background: #fff7d9; box-shadow: 0 0 5px 2px var(--magic),0 0 18px 5px var(--magic-deep),0 0 29px 8px var(--magic-shadow); opacity: 0; animation: line-strike .59s cubic-bezier(.1,.65,.41,1) forwards; }
@keyframes line-strike { 0% { opacity: .82; transform: rotate(var(--angle)) scaleX(0); } 26% { opacity: .93; transform: rotate(var(--angle)) scaleX(1); } 100% { opacity: 0; transform: rotate(var(--angle)) scaleX(1); } }

.console { position: relative; z-index: 7; margin-top: 7px; padding: 9px 11px 7px; border: 1px solid var(--line); border-radius: 5px; background: #19101eeb; box-shadow: 0 12px 30px #07040b9e,inset 0 1px #f1ba8830; }
.balance-cell {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 10px;
  margin-bottom: 7px;
  background: #0f0b16;
  border: 1px solid #b8825952;
  border-radius: 4px;
}
.balance-cell > span { color: #dbc8ca; font-size: .83rem; font-weight: 650; }
.balance-cell strong { color: #ffe3b1; font: 800 1.48rem/1.1 var(--serif); font-variant-numeric: tabular-nums; }
.balance-cell small { color: #bca381; font-size: .74rem; }
.balance-cell.credited { animation: balance-credited 1.05s cubic-bezier(.2,.68,.35,1) both; }
@keyframes balance-credited {
  0% { border-color: #f7cf88; background-color: #48301f; box-shadow: inset 0 0 18px #ffba4f33; }
  100% { border-color: #b8825952; background-color: #0f0b16; }
}
.action-row { display: grid; grid-template-columns: minmax(0,1.24fr) minmax(0,1fr); gap: 8px; }
.wager-box { display: flex; align-items: center; gap: 10px; min-height: 55px; padding-inline: 10px; border: 1px solid #a47d636b; border-radius: 5px; background: #23172b; }
#wager-label { white-space: nowrap; font-size: .84rem; color: #dec7d7; }
.wager-options { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 6px; flex: 1; }
.wager-chip { min-width: 0; min-height: 38px; padding: 4px 3px; border: 1px solid #a7836878; border-radius: 4px; background: #281b2e; color: #ead4c9; white-space: nowrap; text-align: center; font: bold 1rem Georgia,serif; }
.wager-chip:hover:not(:disabled) { border-color: #f1ca91; }
.wager-chip[aria-pressed="true"] { border-color: #efbe7f; background: #503134; color: #ffe5b4; box-shadow: inset 0 0 12px #ec9f6b28; }
.wager-chip:disabled { opacity: .63; }
.spin-button { min-height: 55px; padding: 8px; border: 1px solid #ffe2a7; border-radius: 5px; background: linear-gradient(180deg,#ffe7b0,#eab371 48%,#b67645); color: #322013; font-weight: 850; display: flex; gap: 9px; align-items: center; justify-content: center; white-space: nowrap; font-size: 1.15rem; letter-spacing: .15em; box-shadow: 0 4px 15px #c9854d45,inset 0 0 0 3px #f5cd8d58,inset 0 1px #fff4d5; }
.spin-button:hover:not(:disabled) { background: linear-gradient(180deg,#fff1c7,#fbc788 48%,#ce8d56); box-shadow: 0 4px 22px #e7a86183,inset 0 0 0 3px #f5cd8d85; }
.spin-button:active:not(:disabled) { transform: translateY(1px); }
.spin-button:disabled { opacity: .71; }
.spin-glyph { width: 20px; height: 20px; border: 2px solid #594026; border-right-color: transparent; border-radius: 50%; position: relative; }
.spin-glyph::before { content: ""; position: absolute; top: -2px; right: -1px; border: 4px solid transparent; border-top-color: #594026; rotate: -13deg; }
.spin-button.rolling .spin-glyph { animation: rotate .64s linear infinite; }
@keyframes rotate { to { transform: rotate(1turn); } }
.screen-reader { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.win-reveal {
  position: absolute;
  left: 50%;
  z-index: 8;
  display: grid;
  justify-items: center;
  min-width: clamp(178px,46vw,306px);
  padding: 10px 22px 16px;
  transform: translate(-50%,-48%);
  border: 1px solid #ffe2a4d1;
  border-radius: 7px;
  background: radial-gradient(ellipse at 50% 0,#624029,#271526 61%,#140e1b 100%);
  box-shadow: inset 0 0 0 3px #b87c3a32,0 0 34px #e0a35a73,0 16px 28px #100710ba;
  color: #fff3ca;
  text-align: center;
  pointer-events: none;
  animation: win-reveal 1.45s cubic-bezier(.16,.74,.24,1) both;
}
.win-kicker { display: flex; align-items: center; gap: 9px; margin-bottom: 1px; color: #ffd88f; font: 800 .82rem var(--sans); letter-spacing: .15em; white-space: nowrap; }
.win-kicker > span:first-child, .win-kicker > span:last-child { width: 16px; height: 1px; background: #d6a65c; }
.win-reveal strong { font: 900 clamp(2.1rem,7.2vw,4.32rem)/.96 var(--serif); letter-spacing: -.03em; font-variant-numeric: tabular-nums; text-shadow: 0 3px #6b3f22,0 0 18px #ed9b4e8c; }
.win-reveal small { margin-left: 7px; color: #f0cd90; font-size: .9rem; font-weight: 750; }
@keyframes win-reveal {
  0% { transform: translate(-50%,-24%) scale(.78); opacity: 0; }
  10% { transform: translate(-50%,-50%) scale(1.04); opacity: 1; }
  24%,89% { transform: translate(-50%,-48%) scale(1); opacity: 1; }
  100% { transform: translate(-50%,-62%) scale(.98); opacity: 0; }
}
.battle[data-tier="win"] .board-frame::after,
.battle[data-tier="big"] .board-frame::after,
.battle[data-tier="jackpot"] .board-frame::after {
  content: "";
  position: absolute;
  inset: -7px;
  z-index: -1;
  border-radius: 9px;
  box-shadow: 0 0 20px var(--magic-deep), inset 0 0 12px var(--magic-shadow);
  pointer-events: none;
  animation: win-halo .82s ease-out both;
}
@keyframes win-halo { from { opacity: .86; } to { opacity: 0; } }

@media (min-width: 800px) and (max-height: 850px) {
  .temple { padding-top: 12px; }
  .title-block h1 { font-size: 3rem; }
  .combat-window .combat-scene { height: 238px; }
  .relic { aspect-ratio: 1.96; }
}
@media (max-width: 560px) {
  .masthead-inner { padding: 0 13px; min-height: 51px; }
  .brand { gap: 8px; }
  .brand-icon { width: 23px; height: 23px; margin-left: 2px; }
  .brand-icon i { width: 12px; height: 18px; }
  .brand strong { font-size: 1.04rem; }
    .icon-button { padding: 7px 8px; font-size: .81rem; }
  .temple { padding: 16px 10px 21px; min-height: calc(100svh - 52px); }
  .temple::before { background-position: center top; background-size: auto,auto 700px; background-repeat: no-repeat; }
  .title-block { gap: 6px; margin-bottom: 10px; }
  .title-block h1 { font-size: clamp(1.59rem,6.3vw,2.45rem); }
  .title-rule { flex-basis: 15px; }
  .combat-window .combat-scene { height: clamp(218px,67vw,286px); }
  .combat-window .combat-boss { top: 30px; }
  .boss { padding: 7px 8px 13px; }
  #boss-hp { font-size: .76rem; }
  #god-name { font-size: .62rem; }
  .boss-name-row h2 { font-size: clamp(.98rem,4vw,1.2rem); }
  .health-track { height: 9px; margin-top: 5px; }
  .board-frame { padding: 11px 9px; }
  .board-frame::before { top: 4px; }
  .board-rim { bottom: 4px; }
  .frame-side { width: 3px; }
  .frame-side.left { left: 3px; }
  .frame-side.right { right: 3px; }
  .relic-board { gap: 4px; padding: 4px; }
  .relic { aspect-ratio: 1.13; }
  .relic::before { inset: 2px; }
  .console { padding: 7px 6px 6px; }
  .action-row { gap: 5px; }
  .balance-cell { padding: 5px 8px; margin-bottom: 5px; }
  .balance-cell strong { font-size: 1.21rem; }
  .action-row { grid-template-columns: minmax(0,1.32fr) minmax(0,1fr); }
  .wager-box { padding-inline: 5px; gap: 5px; min-height: 50px; }
  #wager-label { font-size: .73rem; }
  .wager-options { gap: 3px; }
  .wager-chip { min-height: 36px; font-size: .88rem; }
  .spin-button { min-height: 50px; gap: 6px; font-size: 1.02rem; }
  .spin-glyph { width: 17px; height: 17px; }
}
@media (max-width: 560px) and (max-height: 675px) {
  .masthead-inner { min-height: 45px; }
  .temple { padding-top: 10px; }
  .title-block { margin-bottom: 7px; }
  .relic { aspect-ratio: 1.38; }
  .combat-window .combat-scene { height: clamp(184px,52vw,237px); }
}
@media (prefers-reduced-motion: reduce) {
  #health-trail, #health-fill { transition-duration: .01ms; transition-delay: 0s; }
  .relic, .relic::after, .relic-art, .relic-fallback, .spin-glyph, .damage-floater,
  .win-reveal, .balance-cell.credited, .battle .board-frame::after { animation: none !important; }
}
