/* ==========================================================================
   Enchanted Forest — game shell styles
   Scoped with .efo-* so the shared site stylesheet can't leak in and we
   can't leak out. Mobile-first, single file, no image assets — every
   symbol is emoji/CSS.
   ========================================================================== */

:root {
  /* Moonlit glade palette on a deep emerald ground, so it reads premium. */
  --efo-bg-0:        #071712;
  --efo-bg-1:        #0e2a20;
  --efo-bg-2:        #163d2e;
  --efo-emerald:     #2fd08a;
  --efo-emerald-soft:#8beac0;
  --efo-lavender:    #b9a6e8;
  --efo-lavender-soft:#ddd0f7;
  --efo-mint:        #63e6be;
  --efo-silver:      #dce3e0;
  --efo-red:         #ff6b6b;
  --efo-ink:         #f1f7f4;
  --efo-ink-dim:     #b7c9c0;
  --efo-panel:       rgba(7, 23, 18, 0.92);
  --efo-panel-line:  rgba(185, 166, 232, 0.22);
  --efo-chip:        rgba(4, 14, 11, 0.6);
  --efo-cell:        rgba(255, 255, 255, 0.06);
  --efo-radius:      16px;
  --efo-font:        'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  --efo-safe-t:      env(safe-area-inset-top, 0px);
  --efo-safe-b:      env(safe-area-inset-bottom, 0px);
  --efo-safe-l:      env(safe-area-inset-left, 0px);
  --efo-safe-r:      env(safe-area-inset-right, 0px);
}

html, body.efo-body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--efo-bg-0);
  color: var(--efo-ink);
  font-family: var(--efo-font);
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

/* --------------------------------------------------------------------------
   Shared site header — visible on the menu/help, hidden during play.
   -------------------------------------------------------------------------- */
.efo-site-header {
  position: relative;
  z-index: 40;
  font-size: 13px;
}
.efo-site-header header {
  padding: 10px calc(16px + var(--efo-safe-r)) 10px calc(16px + var(--efo-safe-l));
  padding-top: calc(10px + var(--efo-safe-t));
  background: rgba(5, 15, 12, .78);
  border-bottom: 1px solid var(--efo-panel-line);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.efo-site-header a { color: var(--efo-ink-dim); text-decoration: none; padding: 5px 9px; border-radius: 8px; }
.efo-site-header a:hover { color: var(--efo-ink); background: rgba(255,255,255,.07); }
.efo-site-header a.active { color: var(--efo-lavender); background: rgba(185,166,232,.14); }

body:has(.efo-root.is-playing) .efo-site-header,
body:has(.efo-root.is-playing) #footer { display: none; }

.efo-root {
  position: relative;
  min-height: 100vh;
  background:
    radial-gradient(60vw 60vw at 15% -10%, rgba(47, 208, 138, .16), transparent 60%),
    radial-gradient(70vw 70vw at 110% 10%, rgba(185, 166, 232, .16), transparent 60%),
    linear-gradient(180deg, var(--efo-bg-1), var(--efo-bg-0) 60%);
}
.efo-root.is-playing { height: 100vh; overflow: hidden; }

/* --------------------------------------------------------------------------
   Generic dialog-style screens (loading / menu / help / bonus / jackpot)
   -------------------------------------------------------------------------- */
.efo-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(20px + var(--efo-safe-t)) calc(16px + var(--efo-safe-r)) calc(20px + var(--efo-safe-b)) calc(16px + var(--efo-safe-l));
  opacity: 0;
  transform: scale(.98);
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
  z-index: 20;
  overflow-y: auto;
}
.efo-screen.is-open { opacity: 1; transform: none; pointer-events: auto; z-index: 30; }

.efo-panel {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: var(--efo-panel);
  border: 1px solid var(--efo-panel-line);
  border-radius: 22px;
  padding: 28px 24px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.5), 0 0 0 1px rgba(255,255,255,.02) inset;
}
.efo-panel-narrow { max-width: 340px; }
.efo-panel-wide { max-width: 720px; text-align: left; }

.efo-logo {
  margin: 6px 0 4px;
  font-size: 40px;
  font-weight: 800;
  letter-spacing: .5px;
  background: linear-gradient(135deg, var(--efo-emerald), var(--efo-lavender) 55%, var(--efo-silver));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.efo-menu-glyphs { font-size: 26px; letter-spacing: 4px; margin-bottom: 4px; filter: drop-shadow(0 2px 8px rgba(0,0,0,.4)); }
.efo-tagline { color: var(--efo-ink-dim); margin: 0 0 20px; font-size: 14px; }
.efo-muted { color: var(--efo-ink-dim); }

.efo-progress { width: 100%; height: 8px; border-radius: 8px; background: rgba(255,255,255,.08); overflow: hidden; margin-top: 18px; }
.efo-progress-bar { height: 100%; width: 40%; background: linear-gradient(90deg, var(--efo-emerald), var(--efo-lavender)); border-radius: 8px; animation: efo-load 1.1s ease-in-out infinite; }
@keyframes efo-load { 0% { transform: translateX(-100%); } 100% { transform: translateX(250%); } }

.efo-actions { display: flex; flex-direction: column; gap: 10px; margin: 18px 0 8px; }
.efo-actions-secondary { margin-top: 4px; }
.efo-btn {
  appearance: none; border: none; cursor: pointer;
  padding: 14px 20px; border-radius: 14px; font-size: 16px; font-weight: 700;
  font-family: inherit; color: var(--efo-ink);
  transition: transform .12s ease, filter .12s ease, opacity .12s ease;
}
.efo-btn:active { transform: scale(.97); }
.efo-btn-primary { background: linear-gradient(135deg, var(--efo-emerald), #17a869); box-shadow: 0 10px 24px rgba(47,208,138,.35); }
.efo-btn-primary:hover { filter: brightness(1.08); }
.efo-btn-cash { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); color: var(--efo-ink-dim); }
.efo-btn-cash.is-disabled, .efo-btn-cash:disabled { opacity: .55; cursor: not-allowed; }
.efo-btn-ghost { background: rgba(255,255,255,.05); border: 1px solid var(--efo-panel-line); color: var(--efo-ink); }
.efo-btn-ghost:hover { background: rgba(255,255,255,.09); }
.efo-btn-danger { background: rgba(255,93,109,.12); border: 1px solid rgba(255,93,109,.4); color: var(--efo-red); }
.efo-btn-danger:hover { background: rgba(255,93,109,.2); }

.efo-jackpot-teaser {
  display: flex; align-items: baseline; justify-content: center; gap: 8px;
  margin: 14px 0 6px; padding: 10px 16px; border-radius: 14px;
  background: linear-gradient(135deg, rgba(185,166,232,.16), rgba(47,208,138,.1));
  border: 1px solid rgba(185,166,232,.32);
}
.efo-jackpot-teaser-label { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--efo-lavender-soft); }
.efo-jackpot-teaser-value { font-size: 22px; font-weight: 800; color: var(--efo-lavender); font-variant-numeric: tabular-nums; }
.efo-jackpot-teaser-unit { font-size: 12px; color: var(--efo-ink-dim); }

.efo-fineprint { margin-top: 14px; font-size: 11px; color: var(--efo-ink-dim); opacity: .8; line-height: 1.5; }
.efo-version::before { content: 'v' attr(data-v); }

.efo-close {
  position: absolute; top: 14px; right: 14px; width: 34px; height: 34px;
  border-radius: 50%; border: 1px solid var(--efo-panel-line); background: rgba(255,255,255,.06);
  color: var(--efo-ink); font-size: 20px; line-height: 1; cursor: pointer;
}

.efo-h2 { margin: 0 0 14px; font-size: 22px; font-weight: 800; color: var(--efo-ink); }
.efo-h3 { margin: 18px 0 8px; font-size: 15px; color: var(--efo-lavender-soft); text-transform: uppercase; letter-spacing: .06em; }
.efo-h3:first-child { margin-top: 0; }
.efo-body { font-size: 14px; line-height: 1.6; color: var(--efo-ink-dim); margin: 0 0 10px; }
.efo-list { margin: 0; padding-left: 18px; color: var(--efo-ink-dim); font-size: 14px; line-height: 1.7; }
.efo-list b { color: var(--efo-ink); }

.efo-help-cols { display: grid; grid-template-columns: 1fr; gap: 22px; }
@media (min-width: 720px) {
  .efo-help-cols { grid-template-columns: 1.1fr 1fr; }
}

.efo-paytable { display: flex; flex-direction: column; gap: 8px; }
.efo-pay-row {
  display: grid; grid-template-columns: 44px 1fr repeat(3, 56px);
  align-items: center; gap: 6px;
  padding: 8px 10px; border-radius: 10px; background: var(--efo-cell);
  font-size: 13px;
}
.efo-pay-glyph { font-size: 24px; text-align: center; }
.efo-pay-name { color: var(--efo-ink); font-weight: 600; }
.efo-pay-name small { display: block; color: var(--efo-ink-dim); font-weight: 400; font-size: 11px; }
.efo-pay-mult { text-align: right; font-variant-numeric: tabular-nums; color: var(--efo-lavender-soft); }
.efo-pay-head { color: var(--efo-ink-dim); font-size: 11px; text-transform: uppercase; }

/* --------------------------------------------------------------------------
   Play screen
   -------------------------------------------------------------------------- */
#screen-play.efo-screen {
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
  display: none;
  background: transparent;
}
#screen-play.efo-screen.is-open { display: flex; opacity: 1; transform: none; }

.efo-play {
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
  padding: calc(10px + var(--efo-safe-t)) calc(12px + var(--efo-safe-r)) calc(14px + var(--efo-safe-b)) calc(12px + var(--efo-safe-l));
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
  overflow-y: auto;
  box-sizing: border-box;
}

.efo-topbar { display: flex; align-items: center; gap: 8px; }
.efo-chip {
  display: flex; align-items: baseline; gap: 6px; padding: 8px 12px;
  border-radius: 12px; background: var(--efo-chip); border: 1px solid var(--efo-panel-line);
}
.efo-chip-label { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--efo-ink-dim); }
.efo-chip-value { font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; }
.efo-chip-unit { font-size: 11px; color: var(--efo-mint); }
.efo-flash-error { animation: efo-flash-error .5s ease; }
@keyframes efo-flash-error {
  0%, 100% { color: var(--efo-ink); transform: none; }
  30% { color: var(--efo-red); transform: scale(1.12); }
}

.efo-jackpot-chip {
  display: flex; align-items: baseline; gap: 6px; padding: 8px 12px; border-radius: 12px;
  background: linear-gradient(135deg, rgba(185,166,232,.18), rgba(47,208,138,.08));
  border: 1px solid rgba(185,166,232,.38); flex: 1; justify-content: center; overflow: hidden;
}
.efo-jackpot-chip-label { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--efo-lavender-soft); }
.efo-jackpot-chip-value { font-size: 16px; font-weight: 800; color: var(--efo-lavender); font-variant-numeric: tabular-nums; white-space: nowrap; }

.efo-topbar-right { display: flex; gap: 6px; }
.efo-icon-btn {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--efo-panel-line);
  background: var(--efo-chip); color: var(--efo-ink); font-size: 16px; cursor: pointer;
}

.efo-freespin-banner {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px; border-radius: 12px; font-size: 13px; font-weight: 700;
  background: linear-gradient(90deg, rgba(99,230,190,.2), rgba(185,166,232,.2));
  border: 1px solid rgba(99,230,190,.4); color: var(--efo-mint); letter-spacing: .04em;
  animation: efo-pulse-glow 1.6s ease-in-out infinite;
}
.efo-freespin-banner[hidden] { display: none; }
.efo-freespin-banner strong { font-size: 17px; color: var(--efo-ink); }
@keyframes efo-pulse-glow { 0%, 100% { box-shadow: 0 0 0 rgba(99,230,190,0); } 50% { box-shadow: 0 0 16px rgba(99,230,190,.45); } }

.efo-reel-frame {
  position: relative;
  border-radius: 18px;
  padding: 10px;
  background: linear-gradient(180deg, var(--efo-bg-2), var(--efo-bg-1));
  border: 1px solid var(--efo-panel-line);
  box-shadow: inset 0 0 30px rgba(0,0,0,.4);
}

.efo-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
}
.efo-reel {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  background: var(--efo-cell);
  aspect-ratio: 1 / 3;
}
.efo-reel-strip {
  position: absolute;
  inset: 0 0 auto 0;
  display: flex;
  flex-direction: column;
  will-change: transform;
}
.efo-cell-sym {
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(26px, 8vw, 40px);
  line-height: 1;
  position: relative;
}
.efo-cell-sym.is-win {
  animation: efo-cell-pop 1s ease-in-out infinite;
}
.efo-cell-sym.is-win::after {
  content: '';
  position: absolute; inset: 3px;
  border-radius: 8px;
  border: 2px solid var(--efo-lavender);
  box-shadow: 0 0 14px rgba(185,166,232,.7), inset 0 0 10px rgba(185,166,232,.35);
  pointer-events: none;
}
@keyframes efo-cell-pop { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }

.efo-win-overlay {
  position: absolute; inset: 10px;
  pointer-events: none;
}
.efo-win-line {
  fill: none;
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 6px currentColor);
  opacity: .85;
}

.efo-spin-flash {
  position: absolute; inset: 0; border-radius: 18px;
  background: radial-gradient(circle, rgba(255,255,255,.3), transparent 60%);
  opacity: 0; pointer-events: none;
}
.efo-spin-flash.is-flashing { animation: efo-flash .5s ease-out; }
@keyframes efo-flash { 0% { opacity: .9; } 100% { opacity: 0; } }

.efo-win-banner {
  text-align: center; font-size: 20px; font-weight: 800; padding: 8px;
  border-radius: 12px; color: var(--efo-bg-0);
  background: linear-gradient(90deg, var(--efo-lavender), var(--efo-lavender-soft));
  box-shadow: 0 6px 18px rgba(185,166,232,.4);
  animation: efo-banner-in .35s ease;
}
@keyframes efo-banner-in { from { transform: translateY(-8px) scale(.9); opacity: 0; } to { transform: none; opacity: 1; } }

.efo-win-list { display: flex; flex-direction: column; gap: 4px; max-height: 96px; overflow-y: auto; font-size: 12px; }
.efo-win-list:empty { display: none; }
.efo-win-row {
  display: flex; justify-content: space-between; gap: 8px;
  padding: 6px 10px; border-radius: 8px; background: var(--efo-cell); color: var(--efo-ink-dim);
}
.efo-win-row b { color: var(--efo-lavender-soft); }

.efo-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.efo-control-group {
  background: var(--efo-chip); border: 1px solid var(--efo-panel-line); border-radius: 12px;
  padding: 8px 10px; display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.efo-control-total { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; padding: 10px 14px; }
.efo-control-label { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--efo-ink-dim); }
.efo-total-value { font-size: 18px; font-weight: 800; color: var(--efo-mint); font-variant-numeric: tabular-nums; }

.efo-stepper { display: flex; align-items: center; gap: 10px; }
.efo-stepper-btn {
  width: 30px; height: 30px; border-radius: 8px; border: none; cursor: pointer;
  background: rgba(255,255,255,.1); color: var(--efo-ink); font-size: 18px; line-height: 1;
}
.efo-stepper-btn:active { transform: scale(.92); }
.efo-stepper-btn:disabled { opacity: .35; cursor: not-allowed; }
.efo-stepper-value { min-width: 44px; text-align: center; font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }

.efo-presets { display: flex; gap: 4px; }
.efo-preset-btn {
  border: 1px solid var(--efo-panel-line); background: transparent; color: var(--efo-ink-dim);
  border-radius: 8px; padding: 3px 9px; font-size: 11px; cursor: pointer;
}
.efo-preset-btn.is-active { background: rgba(185,166,232,.18); border-color: var(--efo-lavender); color: var(--efo-lavender-soft); }

.efo-spin-btn {
  appearance: none; border: none; cursor: pointer;
  padding: 16px; border-radius: 16px; font-size: 20px; font-weight: 900; letter-spacing: .08em;
  color: var(--efo-bg-0);
  background: linear-gradient(135deg, var(--efo-lavender), var(--efo-emerald));
  box-shadow: 0 12px 26px rgba(47,208,138,.35);
  transition: transform .1s ease, filter .1s ease, opacity .15s ease;
}
.efo-spin-btn:active { transform: scale(.97); }
.efo-spin-btn:disabled { opacity: .55; cursor: not-allowed; filter: grayscale(.3); }

.efo-stats-strip {
  display: flex; justify-content: center; gap: 18px; font-size: 12px; color: var(--efo-ink-dim); padding-bottom: 4px;
}
.efo-stats-strip b { color: var(--efo-ink); font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------------------
   Bonus pick round
   -------------------------------------------------------------------------- */
.efo-bonus-stats { display: flex; justify-content: center; gap: 24px; margin: 14px 0; }
.efo-stat { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.efo-stat-label { font-size: 11px; color: var(--efo-ink-dim); text-transform: uppercase; letter-spacing: .05em; }
.efo-stat-value { font-size: 20px; font-weight: 800; color: var(--efo-lavender-soft); font-variant-numeric: tabular-nums; }

.efo-bonus-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  margin: 6px 0 18px;
}
.efo-bonus-tile {
  aspect-ratio: 1; border-radius: 12px; border: none; cursor: pointer;
  background: linear-gradient(145deg, var(--efo-bg-2), #1f5240);
  color: var(--efo-ink); font-size: 22px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  transition: transform .25s ease, background .25s ease;
  box-shadow: 0 6px 14px rgba(0,0,0,.35);
}
.efo-bonus-tile:not(:disabled):hover { transform: translateY(-2px); }
.efo-bonus-tile:disabled { cursor: default; }
.efo-bonus-tile.is-revealed {
  background: linear-gradient(145deg, var(--efo-lavender), var(--efo-lavender-soft));
  color: var(--efo-bg-0);
  animation: efo-tile-reveal .4s ease;
}
@keyframes efo-tile-reveal { 0% { transform: scale(.7) rotateY(90deg); } 100% { transform: none; } }

/* --------------------------------------------------------------------------
   Jackpot celebration
   -------------------------------------------------------------------------- */
#screen-jackpot.efo-screen {
  background: radial-gradient(circle at 50% 40%, rgba(185,166,232,.25), rgba(7,23,18,.96) 65%);
}
.efo-jackpot-celebrate { text-align: center; }
.efo-jackpot-gems { font-size: 40px; letter-spacing: 8px; margin-bottom: 6px; animation: efo-gem-bounce 1s ease-in-out infinite; }
@keyframes efo-gem-bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.efo-jackpot-title {
  font-size: clamp(40px, 12vw, 72px); font-weight: 900; margin: 0;
  background: linear-gradient(135deg, var(--efo-lavender), #fff 50%, var(--efo-lavender));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: efo-shimmer 1.4s linear infinite;
  background-size: 200% auto;
}
@keyframes efo-shimmer { 0% { background-position: 0% 50%; } 100% { background-position: 200% 50%; } }
.efo-jackpot-amount { font-size: clamp(22px, 6vw, 32px); font-weight: 800; color: var(--efo-ink); margin: 10px 0 26px; font-variant-numeric: tabular-nums; }

@media (min-width: 480px) {
  .efo-controls { grid-template-columns: 1fr 1fr; }
}


/* 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. */
.efo-cell--blur, .efo-cell--blur .efo-glyph {
  filter: blur(2.5px);
  opacity: 0.72;
}

@media (prefers-reduced-motion: reduce) {
  .efo-cell--blur, .efo-cell--blur .efo-glyph { filter: none; opacity: 0.8; }
}
