* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; background: #0b0817; color: #f5e6bd; font-family: system-ui, -apple-system, sans-serif; }

:root {
  --gold: #e8c455; --gold-dark: #b98a2e; --ink: #12102a;
  --bg1: #191233; --bg2: #0d0a1c; --purple: #9b8bd0;
  --cell-h: min(19vw, 90px);
}
.screen { min-height: 100dvh; display: flex; flex-direction: column; align-items: center;
  background: linear-gradient(180deg, var(--bg1), var(--bg2) 70%); }
.hidden { display: none !important; }
.logo { font-weight: 900; letter-spacing: 3px; color: var(--gold); text-shadow: 0 0 16px rgba(232,196,85,.5); font-size: 22px; }
.logo.small { font-size: 14px; }
.pill { font-weight: 700; background: #221a3a; border: 1px solid #8a6d1f; border-radius: 20px; padding: 4px 12px; }
.topbar { width: 100%; max-width: 430px; display: flex; justify-content: space-between; align-items: center; padding: 12px 14px 6px; }
.mute { background: none; border: none; color: var(--gold); font-size: 18px; cursor: pointer; line-height: 1; }
.marquee { font-size: 11px; letter-spacing: 3px; color: var(--purple); padding: 4px 0 8px; }
.reel-window { width: calc(100% - 24px); max-width: 420px; border: 2px solid var(--gold-dark);
  border-radius: 10px; background: #151027; padding: 5px; display: grid;
  grid-template-columns: repeat(5, 1fr); gap: 4px;
  box-shadow: 0 0 24px rgba(232,196,85,.12) inset, 0 4px 16px rgba(0,0,0,.4); }
.reel { height: calc(var(--cell-h) * 3); overflow: hidden; border-radius: 6px; position: relative; }
.strip { will-change: transform; }
.cell { height: var(--cell-h); display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, #241b42, #1c1533); border: 1px solid #322860; border-radius: 6px; }
.cell svg { width: 72%; height: 72%; filter: drop-shadow(0 1px 1px rgba(0,0,0,.5)); }
.strip.spinning .cell svg { filter: blur(2px) brightness(1.15); }
.reel.anticipation { box-shadow: 0 0 14px 2px rgba(232,196,85,.7); }
.win-line { color: var(--gold); font-weight: 700; letter-spacing: 1px; padding: 10px 0 2px; min-height: 1.4em; }
.betrow { font-size: 12px; color: var(--purple); padding-bottom: 10px; }
.spin-btn { width: 84px; height: 84px; border-radius: 50%; border: 2px solid #f8e7ae; cursor: pointer;
  background: radial-gradient(circle at 35% 30%, #f5da8a, var(--gold) 45%, #a97e1e);
  font-weight: 900; font-size: 15px; letter-spacing: 1px; color: #241500;
  box-shadow: 0 6px 20px rgba(232,196,85,.45), 0 2px 0 #6e5210; }
.spin-btn:disabled { filter: grayscale(.6) brightness(.7); }
.cta { padding: 14px 28px; border-radius: 12px; border: none; cursor: pointer; font-weight: 900;
  font-size: 16px; letter-spacing: 1px; color: #241500;
  background: linear-gradient(180deg, #f5da8a, var(--gold-dark)); box-shadow: 0 6px 24px rgba(232,196,85,.4); }
.entry-card { margin: auto; text-align: center; display: flex; flex-direction: column; gap: 18px; align-items: center; padding: 24px; }
.gift { font-size: 56px; }
.entry-sub { color: var(--purple); line-height: 1.5; }
.fs-hud { display: flex; gap: 18px; font-size: 12px; color: var(--gold); font-weight: 700; padding-bottom: 6px; }
.overlay { position: fixed; inset: 0; background: rgba(8,5,20,.88); display: flex;
  align-items: center; justify-content: center; z-index: 50; }
.summary-line { font-size: 18px; color: var(--purple); }
.summary-line.big { font-size: 32px; color: var(--gold); font-weight: 900; text-shadow: 0 0 20px rgba(232,196,85,.6); }
@media (min-width: 700px) { .topbar, .reel-window { max-width: 480px; } }

.win-flash { animation: cellpulse .45s ease-in-out 4 alternate; }
@keyframes cellpulse {
  from { box-shadow: 0 0 0 rgba(232,196,85,0); }
  to   { box-shadow: 0 0 18px 4px rgba(232,196,85,.85); border-color: var(--gold); }
}
.coin { position: fixed; z-index: 60; font-size: 20px; pointer-events: none; }

.banner { text-align: center; display: flex; flex-direction: column; gap: 16px; align-items: center; padding: 24px; }
.gold-text { color: var(--gold); letter-spacing: 2px; text-shadow: 0 0 18px rgba(232,196,85,.7); }
.book-big svg, .chooser svg { width: 110px; height: 110px; }
.chooser.chosen svg { filter: drop-shadow(0 0 18px var(--gold)); transform: scale(1.25); transition: transform .3s; }
.tap-hint { font-size: 11px; color: var(--purple); letter-spacing: 2px; }
.expand-col { position: fixed; z-index: 40; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, rgba(232,196,85,.25), rgba(232,196,85,.08));
  border: 1px solid var(--gold); border-radius: 6px; transform-origin: center; }
.expand-col svg { width: 80%; height: 60%; filter: drop-shadow(0 0 14px var(--gold)); }

.devbar { position: fixed; top: 4px; left: 4px; z-index: 99; opacity: .6; font-size: 11px; }

/* Phone landscape: reflow #game into reels (left) + rail (right) via grid,
   re-using the existing DOM (topbar unwrapped with display:contents so its
   children become direct grid items alongside the other #game children). */
@media (orientation: landscape) and (max-height: 480px) {
  :root { --cell-h: min((100dvh - 68px) / 3, 90px); }

  .marquee { display: none; }

  #game {
    display: grid;
    grid-template-columns: 1fr 132px;
    grid-template-rows: 26px auto auto auto 1fr auto;
    grid-template-areas:
      "logo  mute"
      "reels fshud"
      "reels balance"
      "reels winline"
      "reels spin"
      "reels bet";
    row-gap: 4px;
    column-gap: 10px;
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    padding: 6px 10px;
    align-items: center;
    overflow: hidden;
  }
  #game .topbar { display: contents; }
  #game .logo.small { grid-area: logo; align-self: center; justify-self: start; }
  #game #balance { grid-area: balance; justify-self: center; align-self: center; font-size: 12px; }
  #game #mute-btn { grid-area: mute; align-self: center; justify-self: end; }

  #fs-hud { grid-area: fshud; flex-direction: column; gap: 2px; padding-bottom: 0; font-size: 10px; justify-self: center; }
  #reel-window { grid-area: reels; justify-self: center; align-self: center;
    width: 100%; max-width: calc(var(--cell-h) * 5.5 + 26px); margin: 0; }
  #win-line { grid-area: winline; padding: 0; text-align: center; font-size: 12px; min-height: 1em; }
  .betrow { grid-area: bet; padding-bottom: 0; text-align: center; font-size: 10px; }
  #spin-btn { grid-area: spin; justify-self: center; align-self: center; }

  .banner { gap: 8px; padding: 12px; max-height: 92dvh; overflow: hidden; }
  .book-big svg, .chooser svg { width: 72px; height: 72px; }
}
