/* =========================================================================
   JUNGLE KING — game.css
   Every rule is scoped under .jki- so this file can't leak into, or be
   leaked into by, the shared site stylesheet (/css/styles.css).
   No image assets — all 11 symbols are emoji/CSS glyphs.
   ========================================================================= */

:root {
  --jki-canopy-deep: #071a12;
  --jki-canopy-mid: #0e2b1c;
  --jki-canopy-glow: #163d27;
  --jki-panel: #0c2318;
  --jki-panel-2: #123423;
  --jki-gold: #f0b429;
  --jki-gold-bright: #ffd873;
  --jki-orange: #ff8c42;
  --jki-orange-bright: #ffb066;
  --jki-ink: #f6f3e7;
  --jki-ink-dim: #cbdccb;
  --jki-ink-faint: #82a487;
  --jki-win-green: #6fe08a;
  --jki-danger: #ff6b5d;
  --jki-line-glow: #ffcf5c;
  --jki-border: rgba(240, 180, 41, 0.28);
  --jki-shadow: rgba(0, 0, 0, 0.55);

  --jki-radius-sm: 8px;
  --jki-radius-md: 14px;
  --jki-radius-lg: 22px;

  --jki-safe-top: env(safe-area-inset-top, 0px);
  --jki-safe-bottom: env(safe-area-inset-bottom, 0px);
  --jki-safe-left: env(safe-area-inset-left, 0px);
  --jki-safe-right: env(safe-area-inset-right, 0px);

  --jki-font: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
}

/* Hide the shared site chrome while a hand is actually in progress. */
body:has(.jki-root.is-playing) .jki-site-header,
body:has(.jki-root.is-playing) #footer {
  display: none;
}

.jki-root {
  font-family: var(--jki-font);
  color: var(--jki-ink);
  background:
    radial-gradient(ellipse at 50% -10%, rgba(255, 140, 66, 0.12), transparent 55%),
    linear-gradient(180deg, var(--jki-canopy-deep) 0%, var(--jki-canopy-mid) 55%, var(--jki-canopy-glow) 100%);
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
  overflow-x: hidden;
  padding-left: var(--jki-safe-left);
  padding-right: var(--jki-safe-right);
  box-sizing: border-box;
}

.jki-root * {
  box-sizing: border-box;
}

.jki-screen {
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: calc(1.25rem + var(--jki-safe-top)) 1rem calc(1.25rem + var(--jki-safe-bottom));
}

/* Belt-and-suspenders: an unconditional default plus the [hidden] guard, so
   no later rule with a "display: flex/block" on .jki-screen can beat the
   browser's native [hidden] behavior and leave a screen visible+clickable
   underneath the active one. */
.jki-screen {
  display: none;
}
.jki-screen:not([hidden]) {
  display: flex;
}
.jki-screen[hidden] {
  display: none !important;
}

/* -------------------------------------------------------------------------
   Ambient canopy shimmer — pure CSS, no per-frame JS. Warm gold/orange
   light drifting through leaves, instead of Zeus's cold lightning flicker.
   ------------------------------------------------------------------------- */
.jki-canopy-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(ellipse 65% 45% at 25% 0%, rgba(255, 216, 115, 0.22), transparent 60%);
  opacity: 0;
  animation: jki-shimmer 6s infinite ease-in-out;
}

@keyframes jki-shimmer {
  0%, 100% { opacity: 0.1; transform: translateX(0); }
  35% { opacity: 0.35; transform: translateX(2%); }
  60% { opacity: 0.15; transform: translateX(-1%); }
  80% { opacity: 0.3; transform: translateX(1%); }
}

@media (prefers-reduced-motion: reduce) {
  .jki-canopy-bg { animation: none; opacity: 0.14; }
}

/* -------------------------------------------------------------------------
   Buttons
   ------------------------------------------------------------------------- */
.jki-btn {
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border-radius: var(--jki-radius-md);
  border: 1px solid var(--jki-border);
  padding: 0.85rem 1.25rem;
  cursor: pointer;
  background: var(--jki-panel-2);
  color: var(--jki-ink);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.jki-btn:hover { filter: brightness(1.1); }
.jki-btn:active { transform: scale(0.97); }

.jki-btn--primary {
  background: linear-gradient(180deg, var(--jki-gold-bright), var(--jki-gold));
  color: #241905;
  border-color: transparent;
  box-shadow: 0 6px 22px rgba(240, 180, 41, 0.35);
}

.jki-btn--ghost {
  background: transparent;
  border-color: var(--jki-border);
}

.jki-btn--disabled,
.jki-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.4);
}
.jki-btn:disabled:active { transform: none; }

.jki-btn--icon {
  padding: 0.5rem 0.8rem;
  border-radius: 999px;
  font-size: 1.1rem;
  line-height: 1;
}

/* -------------------------------------------------------------------------
   Menu screen
   ------------------------------------------------------------------------- */
.jki-screen--menu { justify-content: center; }

.jki-menu-card {
  width: 100%;
  max-width: 460px;
  background: linear-gradient(180deg, var(--jki-panel), var(--jki-panel-2));
  border: 1px solid var(--jki-border);
  border-radius: var(--jki-radius-lg);
  padding: 2rem 1.5rem;
  text-align: center;
  box-shadow: 0 20px 60px var(--jki-shadow);
}

.jki-menu-glyphs {
  font-size: 2.6rem;
  margin-bottom: 0.25rem;
  filter: drop-shadow(0 0 18px rgba(240, 180, 41, 0.5));
}

.jki-title {
  font-size: 2.9rem;
  margin: 0;
  letter-spacing: 0.1em;
  background: linear-gradient(180deg, var(--jki-gold-bright), var(--jki-orange) 65%, #a9600f);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 30px rgba(240, 180, 41, 0.25);
}

.jki-tagline {
  color: var(--jki-ink-dim);
  margin: 0.6rem 0 1.4rem;
  font-size: 0.98rem;
  font-style: italic;
}

.jki-menu-jackpot {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.4rem;
  background: rgba(240, 180, 41, 0.08);
  border: 1px solid var(--jki-border);
  border-radius: var(--jki-radius-md);
  padding: 0.7rem 1rem;
  margin-bottom: 1.5rem;
}

.jki-menu-jackpot-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--jki-ink-faint);
}

.jki-menu-jackpot-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--jki-gold-bright);
  font-variant-numeric: tabular-nums;
}

.jki-menu-jackpot-unit {
  font-size: 0.78rem;
  color: var(--jki-ink-faint);
}

.jki-menu-actions {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.jki-fineprint {
  margin-top: 1.4rem;
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--jki-ink-faint);
}

/* -------------------------------------------------------------------------
   Help / paytable screen
   ------------------------------------------------------------------------- */
.jki-screen--help { align-items: stretch; padding-left: 0; padding-right: 0; }

.jki-help-panel {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  background: var(--jki-panel);
  border: 1px solid var(--jki-border);
  border-radius: var(--jki-radius-lg);
  overflow: hidden;
}

.jki-help-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--jki-border);
  position: sticky;
  top: 0;
  background: var(--jki-panel);
  z-index: 2;
}

.jki-help-header h2 { margin: 0; font-size: 1.2rem; }

.jki-help-body { padding: 1.25rem; }

.jki-help-note {
  color: var(--jki-ink-dim);
  font-size: 0.9rem;
  line-height: 1.5;
  margin-top: 0;
}

.jki-paytable-wrap {
  overflow-x: auto;
  border-radius: var(--jki-radius-md);
  border: 1px solid var(--jki-border);
  margin: 1rem 0 1.5rem;
}

.jki-paytable {
  width: 100%;
  border-collapse: collapse;
  min-width: 480px;
  font-size: 0.88rem;
}

.jki-paytable th, .jki-paytable td {
  padding: 0.55rem 0.7rem;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  white-space: nowrap;
}

.jki-paytable th {
  color: var(--jki-ink-faint);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
}

.jki-paytable td:first-child, .jki-paytable th:first-child {
  text-align: left;
  position: sticky;
  left: 0;
  background: var(--jki-panel);
}

.jki-paytable-glyph { font-size: 1.3rem; margin-right: 0.4rem; }
.jki-paytable-name { color: var(--jki-ink); font-weight: 600; }
.jki-paytable-sub { display: block; color: var(--jki-ink-faint); font-size: 0.72rem; font-weight: 400; }

.jki-help-rules h3 {
  font-size: 0.98rem;
  margin: 1.1rem 0 0.35rem;
  color: var(--jki-gold-bright);
}
.jki-help-rules p {
  margin: 0 0 0.6rem;
  color: var(--jki-ink-dim);
  font-size: 0.88rem;
  line-height: 1.5;
}

/* -------------------------------------------------------------------------
   Play screen
   ------------------------------------------------------------------------- */
.jki-screen--play {
  position: relative;
  padding-top: calc(0.6rem + var(--jki-safe-top));
  gap: 0.6rem;
}

.jki-play-topbar {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 640px;
  display: grid;
  grid-template-columns: auto 1fr 1fr auto;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.jki-chip {
  background: var(--jki-panel-2);
  border: 1px solid var(--jki-border);
  border-radius: 999px;
  padding: 0.4rem 0.8rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.1;
  min-width: 0;
}

.jki-chip-label {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--jki-ink-faint);
}

.jki-chip-value {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--jki-gold-bright);
  font-size: 0.95rem;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.jki-chip--jackpot .jki-chip-value { color: var(--jki-orange-bright); }

.jki-status-strip {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 640px;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-size: 0.78rem;
  color: var(--jki-ink-faint);
  margin-bottom: 0.4rem;
}

.jki-status-item strong { color: var(--jki-ink); }

#freeSpinsIndicator strong, #bonusIndicator strong { color: var(--jki-gold-bright); }

.jki-reel-frame {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 640px;
  background: linear-gradient(180deg, var(--jki-panel), var(--jki-panel-2));
  border: 1px solid var(--jki-border);
  border-radius: var(--jki-radius-lg);
  padding: 0.6rem;
  box-shadow: 0 16px 50px var(--jki-shadow), inset 0 0 40px rgba(255, 140, 66, 0.06);
  /* Content-sized on purpose — no flex-grow / centering wrapper here. Inside
     .jki-screen's min-height:100vh column, "flex: 1 1 auto" plus centered
     content would stretch this card to fill leftover viewport height and
     leave dead space above/below the (correctly, tightly sized) reel grid. */
}

.jki-reels {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.35rem;
  width: 100%;
  aspect-ratio: 5 / 3;
  max-height: 52vh;
}

.jki-reel {
  position: relative;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 0%, rgba(22, 61, 39, 0.9), rgba(7, 26, 18, 0.95));
  border-radius: var(--jki-radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.jki-reel--thud { animation: jki-thud 0.18s ease-out; }
@keyframes jki-thud {
  0% { transform: translateY(-3px); }
  100% { transform: translateY(0); }
}

.jki-strip {
  display: flex;
  flex-direction: column;
  will-change: transform;
}

.jki-cell {
  height: 0;
  flex: 0 0 auto;
  /* Padding-percentage resolves against the element's own WIDTH, not the
     strip's height — so to make each cell exactly 1/3 of a 5:3 reel frame
     (i.e. square, matching one column's width) this must be 100%, not
     33.3334%. Using aspect-ratio would be simpler still, but the cell needs
     to be a flex child sized purely by padding for the strip's translateY
     math in Reels.js to line up, so this stays padding-top: 100%. */
  padding-top: 100%; /* keeps cells square inside the flex strip */
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.jki-cell .jki-glyph {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1.4rem, 6.4vw, 2.6rem);
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.5));
}

.jki-cell--wild .jki-glyph { filter: drop-shadow(0 0 10px rgba(240, 180, 41, 0.8)); }

.jki-cell--top .jki-glyph {
  font-size: clamp(1.6rem, 7.4vw, 3rem);
  filter: drop-shadow(0 0 16px rgba(255, 216, 115, 1)) drop-shadow(0 0 6px #fff) drop-shadow(0 0 2px #fff);
}

.jki-cell--scatter .jki-glyph { filter: drop-shadow(0 0 8px rgba(255, 140, 66, 0.85)); }

.jki-cell--win::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 6px;
  border: 2px solid var(--jki-line-glow);
  box-shadow: 0 0 14px var(--jki-line-glow), inset 0 0 10px rgba(255, 207, 92, 0.4);
  pointer-events: none;
}

.jki-cell--win-pulse::after { animation: jki-win-pulse 0.9s ease-in-out infinite; }
@keyframes jki-win-pulse {
  0%, 100% { opacity: 0.65; }
  50% { opacity: 1; }
}

.jki-win-banner {
  position: absolute;
  left: 50%;
  top: 8%;
  transform: translateX(-50%);
  background: rgba(7, 26, 18, 0.9);
  border: 1px solid var(--jki-gold);
  color: var(--jki-gold-bright);
  font-weight: 800;
  font-size: clamp(1rem, 4vw, 1.5rem);
  padding: 0.5rem 1.1rem;
  border-radius: 999px;
  box-shadow: 0 0 26px rgba(240, 180, 41, 0.5);
  z-index: 3;
  animation: jki-banner-pop 0.35s ease-out;
  pointer-events: none;
}

@keyframes jki-banner-pop {
  0% { opacity: 0; transform: translateX(-50%) translateY(-8px) scale(0.9); }
  100% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

/* -------------------------------------------------------------------------
   Controls
   ------------------------------------------------------------------------- */
.jki-controls {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 640px;
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  grid-template-rows: auto auto;
  gap: 0.5rem 0.6rem;
  margin-top: 0.6rem;
  align-items: end;
}

.jki-control-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.jki-control-group--total { grid-column: 1 / 3; flex-direction: row; align-items: baseline; gap: 0.5rem; }

.jki-control-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--jki-ink-faint);
}

.jki-select {
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  background: var(--jki-panel-2);
  color: var(--jki-ink);
  border: 1px solid var(--jki-border);
  border-radius: var(--jki-radius-sm);
  padding: 0.5rem 0.6rem;
}

.jki-total-bet {
  font-weight: 800;
  color: var(--jki-gold-bright);
  font-variant-numeric: tabular-nums;
}

.jki-btn--spin {
  grid-column: 3;
  grid-row: 1 / 3;
  min-width: 108px;
  min-height: 64px;
  border-radius: var(--jki-radius-lg);
  background: linear-gradient(180deg, var(--jki-gold-bright), var(--jki-orange));
  color: #241905;
  border: none;
  box-shadow: 0 8px 26px rgba(240, 180, 41, 0.4);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
}

.jki-spin-label { font-size: 1rem; letter-spacing: 0.06em; }
.jki-spin-glyph { font-size: 1.3rem; }

.jki-btn--spin.is-spinning .jki-spin-glyph { animation: jki-glyph-spin 0.6s linear infinite; }
@keyframes jki-glyph-spin {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.2) rotate(12deg); }
}

@media (min-width: 720px) {
  .jki-controls { grid-template-columns: 1fr 1fr 1fr auto; }
  .jki-control-group--total { grid-column: 3; flex-direction: column; align-items: flex-start; }
  .jki-btn--spin { grid-column: 4; }
}

/* -------------------------------------------------------------------------
   Bonus pick overlay
   ------------------------------------------------------------------------- */
.jki-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem calc(1rem + var(--jki-safe-right)) calc(1rem + var(--jki-safe-bottom)) calc(1rem + var(--jki-safe-left));
  background: rgba(4, 12, 8, 0.82);
  backdrop-filter: blur(2px);
}

.jki-overlay[hidden] {
  display: none;
}

.jki-bonus-panel {
  width: 100%;
  max-width: 460px;
  background: linear-gradient(180deg, var(--jki-panel), var(--jki-canopy-glow));
  border: 1px solid var(--jki-border);
  border-radius: var(--jki-radius-lg);
  padding: 1.5rem;
  text-align: center;
  box-shadow: 0 20px 60px var(--jki-shadow);
}

.jki-bonus-title { margin: 0 0 0.2rem; color: var(--jki-gold-bright); }
.jki-bonus-sub { margin: 0 0 1rem; color: var(--jki-ink-dim); font-size: 0.9rem; }

.jki-bonus-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.jki-bonus-tile {
  aspect-ratio: 1;
  border-radius: var(--jki-radius-md);
  border: 1px solid var(--jki-border);
  background: radial-gradient(circle at 50% 30%, #1c4a2e, #0c2318);
  font-size: 1.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--jki-ink);
  transition: transform 0.12s ease, filter 0.12s ease;
}

.jki-bonus-tile:hover:not(.is-revealed) { transform: translateY(-2px); filter: brightness(1.15); }
.jki-bonus-tile:active:not(.is-revealed) { transform: scale(0.96); }

.jki-bonus-tile.is-revealed {
  cursor: default;
  background: radial-gradient(circle at 50% 30%, #4a3a10, #241905);
  border-color: var(--jki-gold);
  flex-direction: column;
  font-size: 1rem;
  font-weight: 800;
  color: var(--jki-gold-bright);
  animation: jki-tile-reveal 0.35s ease-out;
}

.jki-bonus-tile.is-dim { opacity: 0.35; cursor: default; }

@keyframes jki-tile-reveal {
  0% { transform: scale(0.7) rotateY(90deg); }
  100% { transform: scale(1) rotateY(0); }
}

.jki-bonus-total { color: var(--jki-ink-dim); font-size: 0.95rem; }
.jki-bonus-total strong { color: var(--jki-gold-bright); }

/* -------------------------------------------------------------------------
   Jackpot overlay
   ------------------------------------------------------------------------- */
.jki-overlay--jackpot { background: rgba(3, 8, 5, 0.92); }

.jki-jackpot-flash {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 20%, rgba(255, 216, 115, 0.85), transparent 60%);
  animation: jki-jackpot-flash 1.6s ease-in-out infinite;
}

@keyframes jki-jackpot-flash {
  0%, 100% { opacity: 0; }
  4% { opacity: 1; }
  8% { opacity: 0.15; }
  12% { opacity: 0.85; }
  16% { opacity: 0; }
  55% { opacity: 0; }
  58% { opacity: 0.6; }
  61% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .jki-jackpot-flash { animation: none; opacity: 0.15; }
}

.jki-jackpot-panel {
  position: relative;
  text-align: center;
  z-index: 1;
}

.jki-jackpot-glyph {
  font-size: 2.6rem;
  margin-bottom: 0.5rem;
  filter: drop-shadow(0 0 30px rgba(255, 216, 115, 0.9));
}

.jki-jackpot-title {
  font-size: clamp(1.8rem, 8.5vw, 3.1rem);
  margin: 0;
  letter-spacing: 0.06em;
  background: linear-gradient(180deg, #fff, var(--jki-gold-bright) 55%, var(--jki-orange));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.jki-jackpot-sub { color: var(--jki-ink-dim); margin: 0.4rem 0; }

.jki-jackpot-amount {
  font-size: clamp(1.6rem, 7vw, 2.6rem);
  font-weight: 800;
  color: var(--jki-gold-bright);
  margin: 0.6rem 0 1.4rem;
  font-variant-numeric: tabular-nums;
}

/* -------------------------------------------------------------------------
   Loading screen
   ------------------------------------------------------------------------- */
.jki-screen--loading { justify-content: center; align-items: center; }
.jki-loading-glyph { font-size: 3rem; animation: jki-loading-pulse 1s ease-in-out infinite; }
.jki-loading-text { color: var(--jki-ink-dim); margin-top: 0.5rem; }
@keyframes jki-loading-pulse {
  0%, 100% { opacity: 0.4; transform: scale(0.95); }
  50% { opacity: 1; transform: scale(1.08); }
}


/* Shown while the reels turn waiting on the server's outcome (SMO mode only). Softened so
   the swap between symbols reads as motion rather than a flicker. */
.jki-cell--blur, .jki-cell--blur .jki-glyph {
  filter: blur(2.5px);
  opacity: 0.72;
}

@media (prefers-reduced-motion: reduce) {
  .jki-cell--blur, .jki-cell--blur .jki-glyph { filter: none; opacity: 0.8; }
}
