/* Haze Kings Lounge – shared UI for the table games (Blackjack, Poker).
   Big readable numbers, real chip images, context-sensitive thumb-sized actions. */
:root {
  --gold-1: #fff4c9;
  --gold-2: #f2c350;
  --gold-3: #a8690f;
  --neon: #4dff9a;
  --ink: #eef5ef;
  --muted: #9fb8aa;
  --glass: rgba(4, 14, 10, 0.78);
  --line: rgba(242, 195, 80, 0.28);
  --top-h: 76px;
  --dock-h: 150px;
}

* { box-sizing: border-box; margin: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; overflow: hidden; background: #03100a; color: var(--ink); font-family: Montserrat, Inter, system-ui, sans-serif; user-select: none; -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; overscroll-behavior: none; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; touch-action: manipulation; }
img { -webkit-user-drag: none; }

#stage { position: fixed; inset: 0; }
#stage canvas { display: block; touch-action: none; }

/* ---------- loader ---------- */
#loader { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px;
  background: radial-gradient(ellipse at center, #0f3a27 0%, #03100a 70%); transition: opacity .8s, transform .8s; }
#loader.gone { opacity: 0; transform: scale(1.06); pointer-events: none; }
.load-logo { width: min(520px, 78vw); filter: drop-shadow(0 12px 40px rgba(77, 255, 154, .25)); animation: float 3s ease-in-out infinite; }
.load-track { width: min(420px, 70vw); height: 8px; border-radius: 99px; background: rgba(255, 255, 255, .08); overflow: hidden; box-shadow: inset 0 0 0 1px var(--line); }
#load-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--gold-3), var(--gold-2), var(--gold-1)); box-shadow: 0 0 16px var(--gold-2); transition: width .2s; }
#load-text { font-family: Montserrat, sans-serif; font-weight: 700; letter-spacing: .2em; color: var(--muted); font-size: 14px; text-transform: uppercase; }
.load-note { position: absolute; bottom: 22px; font-size: 12px; color: var(--muted); letter-spacing: .08em; }
@keyframes float { 50% { transform: translateY(-8px); } }

/* ---------- buttons ---------- */
.cta { font-family: Montserrat, sans-serif; font-weight: 900; letter-spacing: .08em; color: #2b1403; border-radius: 16px;
  background: linear-gradient(180deg, var(--gold-1), var(--gold-2) 50%, var(--gold-3));
  box-shadow: 0 0 0 2px #5c360a, 0 8px 28px rgba(242, 195, 80, .45), inset 0 2px 0 rgba(255, 255, 255, .7); }
#load-start { font-size: 22px; padding: 18px 56px; border-radius: 99px; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.05); } }

.round-btn { width: 46px; height: 46px; flex: none; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .06); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12); transition: background .15s; }
.round-btn:hover { background: rgba(255, 255, 255, .14); }
a.round-btn { color: var(--ink, #fff); text-decoration: none; }
.round-btn:focus-visible, .act:focus-visible { outline: 2px solid #ffe9a8; outline-offset: 2px; }
.round-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.round-btn.off { color: #6b7c74; }
.round-btn.off .wave { opacity: 0; }

/* ---------- top bar ---------- */
.topbar { position: fixed; top: 0; left: 0; right: 0; height: calc(var(--top-h) + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 18px 0; z-index: 10;
  display: flex; align-items: center; gap: 14px;
  background: linear-gradient(180deg, rgba(2, 10, 7, .92), rgba(2, 10, 7, .55) 70%, transparent); }
.top-logo { height: 58px; filter: drop-shadow(0 4px 12px rgba(0, 0, 0, .6)); }
.stats { flex: 1; display: flex; justify-content: center; gap: clamp(10px, 3vw, 40px); }
.stat { position: relative; display: flex; flex-direction: column; align-items: center; min-width: 0; padding: 6px 18px; border-radius: 14px; background: rgba(0, 0, 0, .35); box-shadow: inset 0 0 0 1px var(--line); }
.stat .lbl { font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.stat b { font-family: Montserrat, sans-serif; font-weight: 900; font-size: clamp(18px, 2.2vw, 28px); font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat.win b { color: var(--gold-2); text-shadow: 0 0 18px rgba(242, 195, 80, .45); }
.stat.flash b { animation: flash 1s ease-out; }
@keyframes flash { 0% { transform: scale(1.25); color: var(--gold-1); text-shadow: 0 0 30px var(--gold-2); } 100% { transform: scale(1); } }
body.embedded .lobby-back { display: none; }

/* ---------- dock ---------- */
.dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; padding: 10px 18px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(0deg, rgba(2, 10, 7, .96), rgba(2, 10, 7, .7) 75%, transparent); }
.dock-row { display: flex; align-items: center; justify-content: center; gap: 18px; flex-wrap: wrap; }
.dock-hint { text-align: center; font-size: 13px; color: var(--muted); margin-top: 8px; min-height: 16px; }

.chip-rack { display: flex; gap: 8px; align-items: flex-end; }
.chip { width: 66px; height: 66px; border-radius: 50%; position: relative; transition: transform .15s, filter .15s; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .6)); }
.chip img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.chip .val { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 900; font-size: 15px; color: #fff; text-shadow: 0 1px 3px #000, 0 0 6px #000; }
.chip.sel { transform: translateY(-10px) scale(1.08); filter: drop-shadow(0 0 14px rgba(242, 195, 80, .9)) drop-shadow(0 8px 10px rgba(0, 0, 0, .6)); }
.chip:disabled { opacity: .3; }

.actions { display: flex; gap: 10px; align-items: center; }
.act { min-width: 104px; height: 64px; padding: 0 18px; border-radius: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-weight: 800; font-size: 14px; letter-spacing: .04em; transition: transform .1s, opacity .2s, filter .2s; }
.act i { font-style: normal; font-size: 20px; line-height: 1; font-weight: 900; }
.act:active { transform: scale(.95); }
.act:disabled { opacity: .28; filter: grayscale(1); pointer-events: none; }
.act.ghost { background: rgba(255, 255, 255, .06); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14); }
.act.cta { min-width: 190px; font-size: 18px; }
.act.hit { background: linear-gradient(180deg, #37d17a, #0f7a44); box-shadow: 0 6px 20px rgba(55, 209, 122, .35), inset 0 2px 0 rgba(255, 255, 255, .35); }
.act.stand { background: linear-gradient(180deg, #e2544f, #8c1c1c); box-shadow: 0 6px 20px rgba(226, 84, 79, .35), inset 0 2px 0 rgba(255, 255, 255, .3); }
.act.double { background: linear-gradient(180deg, var(--gold-1), var(--gold-2) 55%, var(--gold-3)); color: #2b1403; box-shadow: 0 6px 20px rgba(242, 195, 80, .35), inset 0 2px 0 rgba(255, 255, 255, .6); }
.act.split { background: linear-gradient(180deg, #8e6bff, #4527a0); box-shadow: 0 6px 20px rgba(142, 107, 255, .35), inset 0 2px 0 rgba(255, 255, 255, .3); }
.actions.play .act { min-width: 130px; height: 72px; font-size: 15px; }

/* ---------- modals ---------- */
.modal { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; background: rgba(0, 0, 0, .55); backdrop-filter: blur(4px); padding: 20px; }
.modal-card { position: relative; width: min(460px, 100%); padding: 26px; border-radius: 22px; text-align: center; background: linear-gradient(180deg, #0d2a1d, #051109); box-shadow: 0 0 0 1px var(--line), 0 30px 80px rgba(0, 0, 0, .7); animation: pop .35s cubic-bezier(.2, 1.4, .4, 1); }
.modal-card.wide { width: min(640px, 100%); text-align: left; max-height: 86vh; overflow: auto; }
.modal-card h3 { font-family: Montserrat, sans-serif; font-weight: 900; font-size: 24px; color: var(--gold-2); margin-bottom: 10px; }
.modal-card p { color: #cfe0d6; line-height: 1.5; margin-bottom: 18px; }
.modal-card ul { padding-left: 20px; line-height: 1.7; color: #cfe0d6; }
.modal-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.modal .close { position: absolute; top: 12px; right: 12px; }
@keyframes pop { from { transform: scale(.85); opacity: 0; } }

/* ---------- phone portrait ---------- */
@media (max-width: 700px) {
  :root { --top-h: 64px; }
  .topbar { gap: 8px; padding-left: 10px; padding-right: 10px; }
  .top-logo { display: none; }
  .stats { gap: 6px; }
  .stat { padding: 5px 8px; flex: 1; }
  .stat .lbl { font-size: 10.5px; letter-spacing: .06em; }
  .stats .stat:first-child { flex: 1.6; }
  .stat .refill { width: 20px; height: 20px; font-size: 14px; top: -6px; right: -6px; }
  .stat b { font-size: 16px; }
  .round-btn { width: 40px; height: 40px; }
  #btn-help { display: none; }
  .dock { padding-left: 8px; padding-right: 8px; }
  .dock-row { gap: 10px; }
  .chip-rack { gap: 4px; width: 100%; justify-content: center; }
  .chip { width: 52px; height: 52px; }
  .chip .val { font-size: 13px; }
  .actions { width: 100%; justify-content: center; gap: 6px; }
  .act { min-width: 0; flex: 1; height: 56px; padding: 0 6px; font-size: 12px; }
  .act.cta { flex: 1.6; min-width: 0; font-size: 15px; }
  .actions.play .act { min-width: 0; flex: 1; height: 68px; font-size: 13px; }
  .dock-hint { font-size: 11px; }
}

/* ---------- phone landscape: compact bars ---------- */
@media (orientation: landscape) and (max-height: 520px) {
  :root { --top-h: 52px; }
  .top-logo { height: 40px; }
  .stat { padding: 3px 12px; }
  .stat b { font-size: 16px; }
  .round-btn { width: 38px; height: 38px; }
  .dock { padding-top: 4px; padding-bottom: calc(6px + env(safe-area-inset-bottom)); }
  .dock-row { flex-wrap: nowrap; gap: 10px; }
  .chip { width: 46px; height: 46px; }
  .act { height: 48px; min-width: 84px; font-size: 12px; }
  .act.cta { min-width: 140px; font-size: 14px; }
  .actions.play .act { height: 54px; min-width: 110px; }
  .dock-hint { display: none; }
}

/* line icons inside action buttons (no emoji / font glyphs) */
.act i { display: grid; place-items: center; height: 24px; }
.act i svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.act i.txt { font-family: Montserrat, sans-serif; font-weight: 900; font-size: 19px; letter-spacing: -.02em; }

/* play-money refill: small gold "+" on the balance pill */
.stat .refill { all: unset; cursor: pointer; position: absolute; top: -7px; right: -7px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font: 900 16px/1 Montserrat, sans-serif; color: #2a1604; background: linear-gradient(180deg, #ffe9a8, #e0a43a); box-shadow: 0 2px 8px rgba(0, 0, 0, .6); }
.stat .refill:hover { filter: brightness(1.1); }
.stat .refill:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }