/* Elysa's Gates (gates.js). One sunlit Elysium world: marble, mint water, gold. */
:root {
  color-scheme: dark;
  /* Golden Hour (docs/design/brand.md): vest green, mint, laurel gold, bow pink, marble; Fredoka for everything here */
  --mint: #97fce4; --teal: #0f3a33; --gold: #f4c95d; --gold-d: #a8741a; --ink: #f6efe4; --pink: #ff9ec4;
  --f-ui: "Fredoka", system-ui, sans-serif; --f-num: "Fredoka", system-ui, sans-serif;
  --cell: 92px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #2a1d16; color: var(--ink); font: 600 15px/1.3 var(--f-ui); }
.stage { position: fixed; inset: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr); background: #3a2a1f url("assets/gates/bg.webp") center / cover; }
.stage::before { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 45%, rgba(0,0,0,0) 30%, rgba(30,15,5,.45) 100%); pointer-events: none; }

.banner { position: relative; justify-self: center; margin-top: calc(10px + env(safe-area-inset-top, 0px)); padding: 8px 34px 10px; min-width: min(420px, 90vw); text-align: center;
  background: linear-gradient(180deg, #1d5c52, #0f3933); border: 3px solid var(--gold); border-radius: 18px; box-shadow: 0 6px 0 var(--gold-d), 0 12px 30px rgba(0,0,0,.4); display: grid; }
.banner__l { font: 700 13px/1 var(--f-ui); letter-spacing: .22em; text-transform: uppercase; color: var(--mint); }
.banner__v { font: 700 clamp(22px, 4vw, 34px)/1.15 var(--f-num); color: #fff3c4; text-shadow: 0 2px 0 var(--gold-d), 0 0 18px rgba(244,201,93,.6); font-variant-numeric: tabular-nums; }
.banner.is-hot { animation: pulse .5s ease-out; }
@keyframes pulse { 40% { transform: scale(1.08); } }

.play { position: relative; min-width: 0; overflow: hidden; display: flex; align-items: center; justify-content: center; gap: 2vw; min-height: 0; }
.frame { position: relative; padding: 12px; border-radius: 26px; background: linear-gradient(160deg, #ffe9a8, #d9a43c 40%, #8a5a12); box-shadow: 0 18px 40px rgba(0,0,0,.45), inset 0 2px 0 #fff6d0; }
.frame::before { content: ""; position: absolute; inset: 7px; border-radius: 20px; border: 2px solid rgba(151,252,228,.7); pointer-events: none; }
.grid { position: relative; width: calc(var(--cell) * 6); height: calc(var(--cell) * 5); border-radius: 16px; overflow: hidden;
  background: linear-gradient(180deg, rgba(255,250,236,.92), rgba(222,248,240,.9)); box-shadow: inset 0 0 24px rgba(15,57,51,.25); }
.grid::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 calc(var(--cell) - 1px), rgba(15,57,51,.07) calc(var(--cell) - 1px) var(--cell)); pointer-events: none; }
.cell { position: absolute; left: 0; top: 0; width: var(--cell); height: var(--cell); display: grid; place-items: center; will-change: transform; z-index: 1; }
.cell img { width: 84%; height: 84%; object-fit: contain; filter: drop-shadow(0 4px 4px rgba(60,30,0,.25)); pointer-events: none; }
.s-lyre img { filter: grayscale(1) brightness(1.18) contrast(1.05) drop-shadow(0 4px 4px rgba(20,40,60,.3)); }
.s-hex img { filter: hue-rotate(-28deg) saturate(1.7) brightness(1.02) drop-shadow(0 4px 4px rgba(90,30,0,.3)); }
.cell.is-win img { animation: glow .55s ease-in-out infinite alternate; }
.cell.is-win::before { content: ""; position: absolute; inset: 4px; border-radius: 14px; border: 3px solid var(--gold); box-shadow: 0 0 14px var(--gold), inset 0 0 14px rgba(244,201,93,.6); }
@keyframes glow { to { transform: scale(1.12); filter: drop-shadow(0 0 10px #fff3a0) brightness(1.15); } }
.cell.is-pop { animation: pop .26s ease-in forwards; }
@keyframes pop { 40% { transform: var(--t) scale(1.25); opacity: 1; } to { transform: var(--t) scale(0); opacity: 0; } }
.cell.coin b { position: absolute; font: 700 calc(var(--cell) * .26)/1 var(--f-num); color: #6b3d00; text-shadow: 0 1px 0 #fff3c4; }
.cell.coin img { filter: drop-shadow(0 0 10px rgba(255,220,120,.9)); animation: coin 1.6s ease-in-out infinite; }
@keyframes coin { 50% { filter: drop-shadow(0 0 18px rgba(255,236,160,1)) brightness(1.1); } }
.cell.is-fly { z-index: 5; transition: transform .55s cubic-bezier(.5, -0.3, .7, 1), opacity .55s; }
/* the shatter (gates-fx.js): a layer over the grid that lets pieces fly out past the frame */
.grid::before { content: ""; position: absolute; inset: 0; z-index: 2; background: radial-gradient(ellipse at 50% 50%, rgba(15,57,51,.28), rgba(15,57,51,.5)); opacity: 0; transition: opacity .2s; pointer-events: none; }
.grid.is-hit::before { opacity: 1; }
.cell.is-win { z-index: 3; }
.cell.is-gone { opacity: 0; }
.fxl { position: absolute; left: 12px; top: 12px; width: calc(var(--cell) * 6); height: calc(var(--cell) * 5); pointer-events: none; z-index: 7; }
.fxl > * { position: absolute; left: 0; top: 0; pointer-events: none; will-change: transform, opacity; }
.fx-flash { border-radius: 50%; background: radial-gradient(circle, #fff 0 16%, var(--c) 38%, transparent 68%); }
.fx-ring { border-radius: 50%; border: 6px solid var(--c); box-shadow: 0 0 18px var(--c), inset 0 0 12px var(--c); }
.fx-shard { object-fit: contain; }
.fx-dot { border-radius: 50%; background: radial-gradient(circle, #fff 0 28%, var(--c) 52%, transparent 72%); }
.fx-star { background: radial-gradient(circle, #fff 0 22%, var(--c) 70%); clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%); }
.fx-amt { font: 700 calc(var(--cell) * .36)/1 var(--f-num); color: #fff3c4; white-space: nowrap; font-variant-numeric: tabular-nums; z-index: 2;
  -webkit-text-stroke: 5px #5a3300; paint-order: stroke fill; text-shadow: 0 4px 0 #3d2200, 0 0 18px rgba(255,214,110,.9); }

.host { height: min(68vh, calc(var(--cell) * 6.4)); width: auto; filter: drop-shadow(0 18px 26px rgba(0,0,0,.4)); transform-origin: 50% 100%; animation: idle 3.4s ease-in-out infinite; }
@keyframes idle { 50% { transform: translateY(-6px) rotate(-1deg); } }
.host.is-throw { animation: throw .5s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes throw { 30% { transform: rotate(-6deg) translateY(-14px) scale(1.04); } }

.bar { position: relative; display: flex; align-items: center; justify-content: center; gap: clamp(10px, 3vw, 34px); padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(0deg, rgba(15,57,51,.95), rgba(15,57,51,.75)); border-top: 2px solid var(--gold); flex-wrap: wrap; }
.bet { display: flex; align-items: center; gap: 8px; }
.round { width: 38px; height: 38px; border-radius: 50%; border: 2px solid var(--gold); background: #134a42; color: var(--ink); font: 700 22px/1 var(--f-ui); cursor: pointer; }
.bet__v, .bal { display: grid; text-align: center; }
.bet__v small, .bal small { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--mint); }
.bet__v b, .bal b { font: 800 20px/1.1 var(--f-num); font-variant-numeric: tabular-nums; }
.spin { width: 86px; height: 86px; border-radius: 50%; border: 4px solid #fff3c4; cursor: pointer; background: radial-gradient(circle at 35% 30%, #fff6c8, var(--gold) 45%, var(--gold-d)); box-shadow: 0 6px 0 #6b4410, 0 10px 24px rgba(0,0,0,.4); color: #4a2a00; font: 700 18px/1 var(--f-num); letter-spacing: .06em; transition: transform .1s; }
.spin:active { transform: translateY(3px) scale(.97); box-shadow: 0 3px 0 #6b4410; }
.spin[disabled] { filter: saturate(.6) brightness(.85); cursor: default; }
.spin.is-busy span { display: inline-block; animation: spinlbl .6s linear infinite; }
@keyframes spinlbl { to { transform: rotate(360deg); } }
.ctls { display: flex; gap: 6px; }
.chip { padding: 8px 12px; border-radius: 999px; border: 2px solid rgba(244,201,93,.5); background: transparent; color: var(--ink); font: 700 13px/1 var(--f-ui); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--gold); color: #3a2200; border-color: var(--gold); }
:focus-visible { outline: 3px solid var(--mint); outline-offset: 2px; }

.bigwin { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 2vw; background: radial-gradient(circle, rgba(15,57,51,.6), rgba(10,20,15,.88)); opacity: 0; pointer-events: none; transition: opacity .3s; z-index: 20; }
.bigwin.is-on { opacity: 1; pointer-events: auto; cursor: pointer; }
.bigwin img { height: min(60vh, 460px); transform: scale(.6) translateY(40px); transition: transform .6s cubic-bezier(.2, 1.6, .4, 1); }
.bigwin.is-on img { transform: none; }
.bigwin div { display: grid; text-align: center; }
.bigwin span { font: 700 clamp(34px, 7vw, 72px)/1 var(--f-num); color: #fff3c4; text-shadow: 0 4px 0 var(--gold-d), 0 0 30px rgba(244,201,93,.8); letter-spacing: .04em; }
.bigwin b { font: 700 clamp(40px, 9vw, 96px)/1.1 var(--f-num); color: #fff; text-shadow: 0 0 30px var(--gold); font-variant-numeric: tabular-nums; }

@media (max-width: 760px) {
  /* Elysa stands behind the table: she fills the space above the grid and the frame hides her legs */
  .host { position: absolute; top: 4px; left: 0; right: 0; margin-inline: auto; z-index: 0; pointer-events: none;
    height: clamp(100px, calc(100% - var(--cell) * 3 - 36px), 64vh); }
  .frame { z-index: 1; }
  .play { padding-inline: 8px; align-items: flex-end; padding-bottom: 8px; }
  .bigwin { flex-direction: column; } .bigwin img { height: 34vh; }
}
@media (prefers-reduced-motion: reduce) { *, *::before { animation-duration: .01s !important; transition-duration: .01s !important; } }

.potbox { position: absolute; left: 16px; top: calc(12px + env(safe-area-inset-top, 0px)); z-index: 4; display: grid; padding: 6px 14px; border-radius: 14px; background: rgba(15,57,51,.85); border: 2px solid var(--gold); text-align: center; }
.potbox small { font: 700 11px/1 var(--f-ui); letter-spacing: .14em; text-transform: uppercase; color: var(--mint); }
.potbox b { font: 700 20px/1.2 var(--f-num); color: #fff3c4; font-variant-numeric: tabular-nums; }
.cell.scatter img { width: 80%; height: 80%; border-radius: 50%; border: 3px solid var(--gold); box-shadow: 0 0 14px rgba(244,201,93,.8); animation: coin 1.6s ease-in-out infinite; }
.fsbar { position: absolute; left: 50%; bottom: -14px; transform: translateX(-50%); padding: 4px 14px; border-radius: 999px; background: var(--teal); border: 2px solid var(--gold); font: 800 13px/1.2 var(--f-num); letter-spacing: .06em; white-space: nowrap; color: #fff3c4; }
.fsbar:empty { display: none; }
.buy { display: grid; padding: 8px 14px; border-radius: 16px; border: 2px solid var(--pink); background: linear-gradient(180deg, #ff9fcb, #d9458a); color: #fff; cursor: pointer; box-shadow: 0 4px 0 #8a1f52; text-align: center; }
.buy small { font: 700 11px/1 var(--f-ui); letter-spacing: .1em; text-transform: uppercase; }
.buy b { font: 700 16px/1.2 var(--f-num); font-variant-numeric: tabular-nums; }
.buy[disabled] { filter: saturate(.5) brightness(.8); cursor: default; }
.bigwin small { font: 700 16px/1.4 var(--f-ui); color: var(--mint); }
.fsintro { position: absolute; inset: 0; z-index: 21; display: grid; place-content: center; text-align: center; gap: 8px; background: radial-gradient(circle, rgba(15,57,51,.7), rgba(10,20,15,.92)); opacity: 0; pointer-events: none; transition: opacity .3s; }
.fsintro.is-on { opacity: 1; }
.fsintro b { font: 700 clamp(40px, 9vw, 90px)/1 var(--f-num); color: #fff3c4; text-shadow: 0 4px 0 var(--gold-d), 0 0 30px rgba(244,201,93,.9); transform: scale(.6); transition: transform .6s cubic-bezier(.2, 1.6, .4, 1); }
.fsintro.is-on b { transform: none; }
.fsintro span { font: 700 18px/1 var(--f-ui); color: var(--mint); }
@media (max-width: 760px) { .potbox { top: calc(66px + env(safe-area-inset-top, 0px)); left: 8px; padding: 2px 10px; display: flex; gap: 6px; align-items: baseline; } .potbox b { font-size: 14px; } .play { padding-top: 28px; } .buy { padding: 6px 10px; } }

.grid.is-wait .cell { animation: wait .5s ease-in-out infinite alternate; filter: blur(1.5px) saturate(.7); }
.grid.is-wait .cell:nth-child(3n) { animation-delay: -.2s; } .grid.is-wait .cell:nth-child(3n+1) { animation-delay: -.35s; }
@keyframes wait { to { transform: var(--t) translateY(-6px) scale(.96); } }
.chip--mode[aria-pressed="true"] { background: var(--mint); color: var(--teal); border-color: var(--mint); }
.chip--login { border-color: var(--mint); color: var(--mint); }
.chip--home { text-decoration: none; display: inline-flex; align-items: center; }
@media (max-width: 760px) { .chip--home { order: -1; } }

/* instant play: free spins waiting (set by gates.js) */
#spin { position: relative; }
#spin[data-free]:not([data-free=''])::after {
  content: attr(data-free); position: absolute; top: -8px; right: -10px; padding: 2px 8px; border-radius: 999px;
  background: linear-gradient(180deg, #ffe58a, #f5b83d); color: #4a2a00; font: 800 11px/1.4 var(--font-ui, system-ui);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .35); pointer-events: none;
}
