/* Lucky Lounge — one stylesheet. Built for a tablet held by an older player:
   big targets (56px+), big type, one accent (gold), unmistakable states. */

:root {
  --bg: #0e1016;
  --bg-2: #141824;
  --panel: #171a23;
  --panel-2: #1f2330;
  --line: #2b3040;
  --text: #f4f1e8;
  --muted: #a9adb8;
  --gold: #f5c542;
  --gold-2: #d9a520;
  --gold-3: #8a6410;
  --red: #e5484d;
  --red-2: #b91c1c;
  --green: #3ecf8e;
  --blue: #4f8cff;
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --emoji: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", "Android Emoji", sans-serif;
  --topbar-h: 64px;
}
:root[data-theme="club"] { --bg: #0a2619; --bg-2: #0f3322; --panel: #12392a; --panel-2: #174a36; --line: #24634a; }
:root[data-theme="warm"] { --bg: #1a1210; --bg-2: #22171a; --panel: #281b17; --panel-2: #35241e; --line: #4d322a; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* solid colour on html AND body: iOS paints the page canvas (overscroll, standalone viewport gaps) with these,
   and a gradient alone leaves those areas white */
html { height: 100%; margin: 0; background-color: var(--bg); }
body {
  height: 100%; min-height: 100%; margin: 0;
  background-color: var(--bg);
  background-image: radial-gradient(1200px 600px at 50% -10%, var(--bg-2), var(--bg) 70%);
  color: var(--text);
  font-family: var(--font);
  font-size: 20px;
  line-height: 1.3;
  overflow: hidden;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  overscroll-behavior: none;
}
button { font-family: inherit; color: inherit; cursor: pointer; }
h1, h2, h3 { margin: 0; font-weight: 800; letter-spacing: .01em; }
.num, #balance, .value, .win-banner, .celebrate-amount, .cashier-balance, .gamble-amount { font-variant-numeric: tabular-nums; }

#app { height: 100%; display: flex; flex-direction: column; padding-bottom: env(safe-area-inset-bottom); }
#view { flex: 1; min-height: 0; position: relative; }

/* ---------- top bar ---------- */
#topbar {
  height: calc(var(--topbar-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 12px 0 12px;
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(#1b1f2b, #12151d);
  border-bottom: 2px solid var(--gold-3);
}
#title { font-weight: 900; font-size: 22px; color: var(--gold); letter-spacing: .04em; text-transform: uppercase; }
body[data-screen="lobby"] #btn-home { visibility: hidden; }
#balance-wrap { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; line-height: 1; }
#balance-wrap .label { font-size: 12px; color: var(--muted); letter-spacing: .12em; font-weight: 700; }
#balance { font-size: 30px; font-weight: 900; color: var(--gold); margin-top: 2px; }
.topbtn {
  min-height: 48px; padding: 0 16px; border-radius: 12px; border: 2px solid var(--line);
  background: var(--panel-2); font-size: 17px; font-weight: 800; letter-spacing: .04em;
}
.topbtn.gold { background: linear-gradient(#ffd966, var(--gold-2)); color: #2a1d00; border-color: #ffe9a8; }
.topbtn:active { transform: translateY(1px); filter: brightness(1.1); }
#btn-settings { font-size: 24px; min-width: 52px; padding: 0; }

/* ---------- buttons ---------- */
.btn {
  min-height: 56px; padding: 0 22px; border-radius: 14px; border: 2px solid transparent;
  font-size: 20px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
  background: var(--panel-2); color: var(--text); transition: transform .08s, filter .12s, opacity .1s;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:active:not(:disabled) { transform: translateY(2px) scale(.98); filter: brightness(1.12); }
.btn:disabled { opacity: .38; cursor: default; }
.btn-primary { background: linear-gradient(#ffd966, var(--gold-2)); color: #2a1d00; border-color: #ffe9a8; box-shadow: 0 4px 0 #8a6410; }
.btn-secondary { background: var(--panel-2); border-color: var(--line); }
.btn-danger { background: var(--red-2); border-color: #f87171; }
.btn-round { width: 60px; height: 60px; padding: 0; border-radius: 50%; font-size: 32px; line-height: 1; background: var(--panel-2); border: 2px solid var(--line); }

/* ---------- modals ---------- */
.modal-back {
  position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, .72); opacity: 0; transition: opacity .16s; padding: 16px;
}
.modal-back.open { opacity: 1; }
.modal {
  background: var(--panel); border: 2px solid var(--line); border-radius: 20px; padding: 24px;
  max-width: min(720px, 100%); max-height: calc(100% - 16px); overflow: auto; box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
  transform: translateY(12px); transition: transform .16s;
}
.modal-back.open .modal { transform: none; }
.modal h2 { font-size: 30px; margin-bottom: 12px; color: var(--gold); }
.dialog p { color: var(--muted); font-size: 20px; }
.dialog-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 20px; }
.btn-close { width: 100%; margin-top: 18px; }

#toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); z-index: 60;
  background: #000c; color: var(--gold); padding: 14px 24px; border-radius: 14px; font-weight: 800; font-size: 20px;
  opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; border: 1px solid var(--gold-3);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- cashier & settings ---------- */
.cashier { width: 560px; max-width: 100%; text-align: center; }
.cashier .label { font-size: 13px; letter-spacing: .12em; color: var(--muted); font-weight: 800; }
.cashier-balance { font-size: 48px; font-weight: 900; color: var(--gold); margin: 4px 0 16px; }
.cashier-msg { color: #ffb4b4; font-weight: 700; margin: 0 0 12px; }
.btn-topup {
  width: 100%; min-height: 84px; font-size: 26px; border-radius: 20px;
  background: linear-gradient(#5be49b, #1f9d61); color: #04210f; border-color: #b9f5d3; box-shadow: 0 6px 0 #0f5f39;
}
.cashier-note { color: var(--muted); font-size: 16px; margin: 12px 0 16px; }
.stats { text-align: left; border-top: 1px solid var(--line); padding-top: 10px; }
.stat-row { display: flex; justify-content: space-between; padding: 8px 0; font-size: 18px; border-bottom: 1px solid var(--line); }
.stat-k { color: var(--muted); }
.stat-v { font-weight: 700; }
.settings { width: 620px; max-width: 100%; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 20px; font-weight: 700; }
.seg { display: inline-flex; border: 2px solid var(--line); border-radius: 12px; overflow: hidden; }
.seg button { min-height: 52px; padding: 0 16px; border: 0; background: transparent; font-size: 17px; font-weight: 800; }
.seg button.active { background: var(--gold); color: #2a1d00; }
.about { color: var(--muted); font-size: 15px; margin: 16px 0 0; text-align: center; }

/* ---------- lobby ---------- */
.lobby { height: 100%; overflow: auto; padding: 20px 24px 40px; -webkit-overflow-scrolling: touch; }
.lobby-hero { text-align: center; padding: 8px 0 18px; }
.lobby-hero h1 {
  font-size: 54px; letter-spacing: .06em; text-transform: uppercase;
  background: linear-gradient(#fff2b3, var(--gold) 45%, #b8811a); -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: none;
}
.lobby-hero p { margin: 4px 0 0; color: var(--muted); font-size: 20px; }
.section { font-size: 22px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 18px 0 12px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.tile {
  min-height: 180px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  background: linear-gradient(160deg, var(--panel-2), var(--panel)); border: 2px solid var(--line); border-radius: 20px;
  padding: 14px; text-align: center; transition: transform .08s, border-color .12s; position: relative; overflow: hidden;
}
.tile::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 6px; background: var(--line); }
.tile.pokie::before { background: linear-gradient(90deg, #ffd966, var(--gold-2)); }
.tile.table::before { background: linear-gradient(90deg, #5be49b, #1f9d61); }
.tile:active { transform: scale(.97); border-color: var(--gold); }
.tile-icon { font-size: 56px; line-height: 1.1; font-family: var(--emoji); }
.tile-title { font-size: 25px; font-weight: 900; }
.tile-tag { font-size: 16px; color: var(--muted); }
.tile-best { font-size: 14px; color: var(--gold); font-weight: 700; margin-top: 4px; }
.lobby-stats { text-align: center; color: var(--muted); margin-top: 26px; font-size: 18px; }

/* ---------- celebration ---------- */
.celebrate {
  position: fixed; inset: 0; z-index: 70; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, .78); opacity: 0; transition: opacity .25s; overflow: hidden;
}
.celebrate.open { opacity: 1; }
.celebrate-glow { position: absolute; inset: 0; background: radial-gradient(600px 400px at 50% 50%, rgba(245, 197, 66, .35), transparent 70%); animation: pulse 1.2s ease-in-out infinite alternate; }
.celebrate-title {
  position: relative; font-size: clamp(56px, 11vw, 120px); font-weight: 900; letter-spacing: .06em;
  background: linear-gradient(#fff6c8, var(--gold) 50%, #c48a12); -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: pop .5s cubic-bezier(.2, 1.6, .4, 1);
}
.tier-2 .celebrate-title { background: linear-gradient(#ffd7d7, #ff6b6b 50%, #b91c1c); -webkit-background-clip: text; background-clip: text; }
.tier-3 .celebrate-title { background: linear-gradient(#e0f2ff, #7dd3fc 50%, #2563eb); -webkit-background-clip: text; background-clip: text; }
.celebrate-amount { position: relative; font-size: clamp(48px, 9vw, 96px); font-weight: 900; color: #fff; text-shadow: 0 4px 30px rgba(245, 197, 66, .6); }
.celebrate-hint { position: relative; margin-top: 18px; color: var(--muted); font-size: 18px; }
.celebrate .coin { position: absolute; top: -60px; animation: fall linear infinite; font-family: var(--emoji); }
@keyframes fall { from { transform: translateY(0) rotate(0); } to { transform: translateY(120vh) rotate(720deg); } }
@keyframes pulse { from { opacity: .6; } to { opacity: 1; } }
@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- pokies ---------- */
.slots { height: 100%; display: flex; flex-direction: column; background: var(--m-bg, var(--bg)); }
.slots.theme-outback { --m-bg: radial-gradient(900px 500px at 50% 20%, #5a2e12, #1d0e06 75%); --m-accent: #ffb347; --m-cell: linear-gradient(#3b2114, #241108); }
.slots.theme-pharaoh { --m-bg: radial-gradient(900px 500px at 50% 20%, #1b2b6b, #070b23 75%); --m-accent: #f5c542; --m-cell: linear-gradient(#1e2a5e, #0f163a); }
.slots.theme-dragon { --m-bg: radial-gradient(900px 500px at 50% 20%, #7a1616, #230505 75%); --m-accent: #ffd166; --m-cell: linear-gradient(#5a1010, #300707); }
.slots.theme-fruit { --m-bg: radial-gradient(900px 500px at 50% 20%, #4a1660, #150520 75%); --m-accent: #ff77c8; --m-cell: linear-gradient(#3a1250, #1e0830); }

.slots-head { height: 46px; display: flex; align-items: center; justify-content: center; gap: 20px; padding: 0 16px; position: relative; }
.machine-name { font-size: 22px; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; color: var(--m-accent, var(--gold)); }
.machine-icon { font-family: var(--emoji); }
.feature-banner {
  position: absolute; right: 16px; top: 6px; height: 34px; padding: 0 14px; border-radius: 17px; display: none; align-items: center;
  background: var(--gold); color: #2a1d00; font-weight: 900; font-size: 16px; letter-spacing: .04em; animation: pulse .6s ease-in-out infinite alternate;
}
.feature-banner.show { display: flex; }

.reels-wrap { flex: 1; min-height: 0; position: relative; display: flex; align-items: center; justify-content: center; padding: 12px; }
.reels {
  position: relative; display: grid; grid-template-columns: repeat(var(--reels), 1fr); gap: 4px; padding: 4px;
  background: #000a; border: 3px solid var(--m-accent, var(--gold)); border-radius: 12px; box-shadow: 0 0 0 4px #0008, 0 20px 60px #000a, inset 0 0 40px #000;
}
.reel { position: relative; overflow: hidden; border-radius: 6px; background: #0006; }
.strip { position: absolute; left: 0; right: 0; top: 0; will-change: transform; }
.reel.blur .strip { filter: blur(1.5px); }
.reel.anticipate { box-shadow: inset 0 0 0 3px var(--gold), inset 0 0 30px var(--gold); animation: pulse .35s ease-in-out infinite alternate; }
.cell {
  height: var(--cellH, 100px); display: flex; align-items: center; justify-content: center; position: relative;
  background: var(--m-cell, var(--panel)); border-bottom: 1px solid #0006; overflow: hidden;
}
.cell .emoji { font-family: var(--emoji); font-size: calc(var(--cellH, 100px) * .6); line-height: 1; filter: drop-shadow(0 4px 6px #0009); }
.cell.text .txt {
  font-size: calc(var(--cellH, 100px) * .52); font-weight: 900; line-height: 1; letter-spacing: -.02em;
  -webkit-text-stroke: 1px #0008; text-shadow: 0 3px 8px #000b;
}
.sym-A .txt { color: #ff6b6b; } .sym-K .txt { color: #ffb347; } .sym-Q .txt { color: #c084fc; }
.sym-J .txt { color: #4ade80; } .sym-T .txt { color: #60a5fa; } .sym-N .txt { color: #2dd4bf; }
.sym-seven .txt { color: #ff3b3b; font-size: calc(var(--cellH, 100px) * .7); font-style: italic; -webkit-text-stroke: 2px #fff; }
.sym-wild.text .txt { font-size: calc(var(--cellH, 100px) * .34); background: linear-gradient(#fff6c8, var(--gold) 50%, #c48a12); -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-stroke: 0; }
.cell .bar { display: block; width: 78%; background: linear-gradient(#ffe89a, #d9a520); color: #2a1d00; border: 2px solid #5a3d00; border-radius: 6px; text-align: center; font-weight: 900; font-size: calc(var(--cellH, 100px) * .16); line-height: 1.2; margin: 2px 0; letter-spacing: .1em; }
.cell svg { width: 70%; height: 70%; filter: drop-shadow(0 4px 6px #0009); }
.cell .tag { position: absolute; bottom: 6px; left: 50%; transform: translateX(-50%); background: #2a1d00; color: var(--gold); font-weight: 900; font-size: calc(var(--cellH, 100px) * .14); padding: 1px 8px; border-radius: 8px; letter-spacing: .1em; }
.cell.kind-wild { box-shadow: inset 0 0 0 3px var(--gold), inset 0 0 24px #f5c54266; }
.cell.kind-scatter { box-shadow: inset 0 0 0 3px #7dd3fc, inset 0 0 24px #7dd3fc55; }
.cell.dim { filter: brightness(.35) saturate(.4); }
.cell.hit { animation: hit .7s ease-in-out infinite alternate; z-index: 2; }
@keyframes hit { from { box-shadow: inset 0 0 0 4px #fff, 0 0 0 2px var(--gold); filter: brightness(1.15); } to { box-shadow: inset 0 0 0 6px var(--gold), 0 0 24px var(--gold); filter: brightness(1.35); } }

.lines-overlay { position: absolute; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; }
.lines-overlay .line { fill: none; stroke-width: 6; stroke-linejoin: round; stroke-linecap: round; }
.lines-overlay .line-glow { fill: none; stroke-width: 16; opacity: .35; stroke-linejoin: round; stroke-linecap: round; }
.win-banner {
  position: absolute; top: 4px; left: 50%; transform: translate(-50%, -20px); opacity: 0; transition: opacity .2s, transform .2s;
  background: linear-gradient(#fff2b3, var(--gold)); color: #2a1d00; font-weight: 900; font-size: 24px; padding: 8px 22px; border-radius: 22px;
  box-shadow: 0 8px 30px #000a; white-space: nowrap; z-index: 5; pointer-events: none; max-width: 95%; overflow: hidden; text-overflow: ellipsis;
}
.win-banner.show { opacity: 1; transform: translate(-50%, 0); }
.big-message, .flash {
  position: absolute; inset: 12px; display: flex; align-items: center; justify-content: center; text-align: center; z-index: 6;
  background: rgba(0, 0, 0, .8); border: 3px solid var(--gold); border-radius: 16px; opacity: 0; transform: scale(.9); transition: opacity .25s, transform .25s;
}
.big-message.show, .flash.show { opacity: 1; transform: none; }
.flash { inset: 25% 10%; font-size: 40px; font-weight: 900; color: var(--gold); }
.big-title { font-size: clamp(40px, 7vw, 76px); font-weight: 900; color: var(--gold); letter-spacing: .06em; animation: pop .5s cubic-bezier(.2, 1.6, .4, 1); }
.big-sub { font-size: clamp(22px, 3.5vw, 34px); font-weight: 800; color: #fff; margin-top: 6px; }
.big-amount { font-size: clamp(44px, 8vw, 90px); font-weight: 900; color: #fff; }
.big-hint { color: var(--muted); font-size: 18px; margin-top: 16px; }

.slots-controls {
  display: flex; align-items: center; gap: 16px; padding: 10px 16px 14px; flex-wrap: wrap;
  background: linear-gradient(#0000, #0006);
}
.ctl-group { display: flex; align-items: center; gap: 10px; background: #0006; border: 2px solid #ffffff22; border-radius: 16px; padding: 6px 14px; min-height: 76px; }
.ctl-group .label { font-size: 13px; font-weight: 800; letter-spacing: .12em; color: var(--muted); }
.ctl-group .value { font-size: 28px; font-weight: 900; min-width: 96px; text-align: center; }
.win-group .value { color: var(--gold); min-width: 150px; }
.btn-max { min-height: 48px; font-size: 15px; padding: 0 12px; }
.btn-max.active { border-color: var(--gold); color: var(--gold); }
.ctl-actions { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.btn-pays { min-height: 56px; font-size: 16px; }
.btn-gamble { background: var(--panel-2); border-color: var(--line); min-width: 130px; }
.btn-gamble.ready { background: linear-gradient(#c084fc, #7e22ce); border-color: #e9d5ff; box-shadow: 0 4px 0 #4c1d95; animation: pulse .5s ease-in-out infinite alternate; }
.btn-auto { min-width: 120px; border-color: var(--line); }
.btn-auto.active { background: #1f9d61; border-color: #b9f5d3; }
.btn-spin {
  min-width: 190px; min-height: 84px; border-radius: 42px; font-size: 32px; letter-spacing: .08em;
  background: linear-gradient(#ff7b7b, #d92d2d); border: 3px solid #ffd7a0; color: #fff; text-shadow: 0 2px 4px #0008;
  box-shadow: 0 7px 0 #8a1010, 0 12px 30px #000a;
}
.btn-spin:active:not(:disabled) { box-shadow: 0 3px 0 #8a1010, 0 6px 18px #000a; transform: translateY(4px); }
.btn-spin.stop { background: linear-gradient(#ffd966, var(--gold-2)); color: #2a1d00; text-shadow: none; box-shadow: 0 7px 0 #8a6410, 0 12px 30px #000a; }

/* gamble */
.gamble { width: 560px; max-width: 100%; text-align: center; }
.gamble-amount { font-size: 44px; font-weight: 900; color: var(--gold); }
.gcard {
  width: 120px; height: 168px; margin: 14px auto; border-radius: 12px; background: #fff; color: #111; display: flex; align-items: center; justify-content: center;
  font-size: 44px; font-weight: 900; box-shadow: 0 10px 30px #000a; transition: transform .35s; transform-style: preserve-3d;
}
.gcard.back { background: repeating-linear-gradient(45deg, #7e22ce 0 8px, #5b21b6 8px 16px); color: #fff; }
.gcard.red { color: #d61c1c; }
.gcard.black { color: #111; }
.gcard.flip { animation: flip .35s ease-out; }
@keyframes flip { from { transform: rotateY(90deg); } to { transform: none; } }
.gamble-msg { color: var(--muted); min-height: 30px; margin-bottom: 10px; }
.gamble-buttons { display: flex; gap: 10px; justify-content: center; margin-bottom: 10px; flex-wrap: wrap; }
.gbtn { min-width: 150px; }
.gbtn.red { background: #d61c1c; border-color: #fca5a5; }
.gbtn.black { background: #111; border-color: #555; }
.gbtn.suit { min-width: 100px; font-size: 28px; }
.gamble-history { min-height: 32px; display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin: 6px 0 10px; }
.gchip { background: #fff; color: #111; border-radius: 6px; padding: 2px 8px; font-weight: 800; }
.gchip.red { color: #d61c1c; }
.btn-take { width: 100%; min-height: 64px; font-size: 24px; }

/* paytable */
.paytable { width: 700px; max-width: 100%; }
.paysub { color: var(--muted); margin: 0 0 12px; font-size: 16px; }
.payrows { display: grid; gap: 8px; }
.payrow { display: flex; gap: 14px; align-items: center; background: var(--panel-2); border-radius: 12px; padding: 8px; }
.paycell { --cellH: 72px; width: 78px; flex: none; }
.paycell .cell { width: 78px; border-radius: 8px; }
.payname { font-weight: 800; font-size: 18px; }
.paypays { color: var(--gold); font-weight: 700; font-size: 17px; white-space: pre-wrap; }
.paynote { color: var(--muted); font-size: 14px; }

/* ---------- portrait / small ---------- */
@media (orientation: portrait), (max-width: 900px) {
  .ctl-actions { margin-left: 0; width: 100%; justify-content: space-between; }
  .btn-spin { flex: 1; }
  #title { display: none; }
  .lobby-hero h1 { font-size: 40px; }
}
@media (max-height: 640px) {
  .slots-head { height: 36px; }
  .ctl-group { min-height: 60px; }
  .btn-spin { min-height: 68px; font-size: 26px; }
}
