/* Bola Tangkas — tema BIRU "neo-retro": neon arcade + panel kaca modern.
   Peran warna: biru = aksi/utama, cyan = info, emas = koin & kemenangan, merah muda = peringatan. */
:root {
  --bg: #040a1c;
  --panel: rgba(13, 24, 48, 0.94);
  --panel-solid: #0a1838;
  --edge: rgba(148, 197, 255, 0.16);
  --blue: #2f7bff;
  --blue-deep: #1846c9;
  --cyan: #38d6ff;
  --gold: #ffd84d;
  --text: #eef4ff;
  --muted: #9db3d9;
  --danger: #ff6b8a;
  --red-suit: #e0174f;
  --black-suit: #101a33;
  --radius: 18px;
  --gap: clamp(6px, 1.4vw, 12px);
  --font-display: 'Rubik', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-logo: 'Bungee', 'Arial Black', system-ui, sans-serif;
  --font-body: 'Rubik', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: clamp(15px, 1.1vw + 10px, 19px);
}
html[data-size='large'] { font-size: clamp(18px, 1.3vw + 12px, 23px); }

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 500;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }

#bg, #fx { position: fixed; inset: 0; display: block; }
#bg { z-index: 0; }
#fx { z-index: 10; pointer-events: none; }
.screen { position: relative; z-index: 1; min-height: 100dvh; }

/* ---- Judul neon ---------------------------------------------------------- */
.title, .brand {
  margin: 0;
  font-family: var(--font-logo);
  font-weight: 400;
  letter-spacing: 0.04em;
  line-height: 1;
  color: #fff;
  text-shadow: 0 0 6px var(--blue), 0 0 18px var(--blue), 0 0 40px rgba(47, 123, 255, 0.6);
}
.title { font-size: clamp(1.8rem, 6vw, 3rem); animation: neon 4s infinite; }
.title span:last-child, .brand span:last-child {
  color: var(--gold);
  text-shadow: 0 0 6px #ff9a00, 0 0 18px #ff9a00, 0 0 40px rgba(255, 154, 0, 0.5);
}
@keyframes neon {
  0%, 92%, 100% { opacity: 1; }
  93% { opacity: 0.55; }
  94% { opacity: 1; }
  96% { opacity: 0.7; }
}

/* ---- Tombol --------------------------------------------------------------- */
.btn {
  --c1: #23396e; --c2: #16264f; --edge-c: #0a1430;
  min-height: 52px;
  padding: 10px 16px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(180deg, var(--c1), var(--c2));
  box-shadow: 0 5px 0 var(--edge-c), 0 10px 20px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.02rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: transform 0.06s, box-shadow 0.06s, filter 0.15s;
  touch-action: manipulation;
}
.btn small { display: block; font-family: var(--font-body); font-size: 0.72rem; font-weight: 700; opacity: 0.85; letter-spacing: 0; }
.btn:hover:not(:disabled) { filter: brightness(1.12); }
.btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 var(--edge-c), 0 4px 10px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.25); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn:focus-visible, .tool:focus-visible, .menu-item:focus-visible, .tab:focus-visible, .link:focus-visible {
  outline: 3px solid var(--cyan); outline-offset: 3px;
}
.btn.primary { --c1: #4d93ff; --c2: #1f5fe6; --edge-c: #0c2f80; box-shadow: 0 5px 0 var(--edge-c), 0 0 22px rgba(47, 123, 255, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.35); }
.btn.gold { --c1: #ffe27a; --c2: #f0a500; --edge-c: #7a5000; color: #3a1d00; }
.btn.cyan { --c1: #6fe6ff; --c2: #10a8d6; --edge-c: #045a75; color: #00253a; }
.btn.ghost { --c1: rgba(255, 255, 255, 0.08); --c2: rgba(255, 255, 255, 0.04); --edge-c: rgba(0, 0, 0, 0.5); }
.btn.danger { color: var(--danger); }
.btn.pulse { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.25); }
}
.link {
  background: none; border: 0; padding: 6px;
  color: var(--cyan); font: 700 0.9rem var(--font-body);
  cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
}

/* ---- Layar masuk ---------------------------------------------------------- */
.auth-screen {
  display: grid;
  place-items: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
}
.auth-card {
  width: min(440px, 100%);
  padding: 26px 22px 18px;
  border-radius: 24px;
  background: var(--panel);
  border: 1px solid var(--edge);
  backdrop-filter: blur(14px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(47, 123, 255, 0.15);
  text-align: center;
}
.tagline { margin: 10px 0 18px; color: var(--muted); }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 14px; background: rgba(0, 0, 0, 0.35); margin-bottom: 16px; }
.tab {
  min-height: 42px; border: 0; border-radius: 10px;
  background: transparent; color: var(--muted);
  font: 700 0.95rem var(--font-display); cursor: pointer;
}
.tab[aria-selected='true'] { background: linear-gradient(180deg, #3d86ff, #1f5fe6); color: #fff; box-shadow: 0 0 14px rgba(47, 123, 255, 0.5); }
.auth-form { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.auth-form label { display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: 0.9rem; color: var(--muted); }
.auth-form input:not([type='checkbox']) {
  min-height: 50px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1.5px solid rgba(148, 197, 255, 0.25);
  background: rgba(2, 8, 24, 0.7);
  color: var(--text);
  font: 500 1.05rem var(--font-body);
}
.auth-form input:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(56, 214, 255, 0.2); }
.auth-form .check { flex-direction: row; align-items: center; gap: 10px; color: var(--text); }
.auth-form .check input { width: 22px; height: 22px; accent-color: var(--blue); }
.auth-form .link { align-self: center; }
.note { margin: 0; font-size: 0.85rem; color: var(--muted); line-height: 1.45; }
.form-msg { min-height: 1.4em; margin: 12px 0 0; font-weight: 700; }
.form-msg.good { color: var(--gold); }
.form-msg.bad { color: var(--danger); }
.fineprint { margin: 10px 0 0; font-size: 0.72rem; color: var(--muted); opacity: 0.8; }

/* ---- Lobi ------------------------------------------------------------------ */
.lobby {
  display: grid;
  grid-template-columns: minmax(220px, 260px) 1fr;
  gap: 14px;
  max-width: 1280px;
  margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
           max(12px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.lobby-side {
  display: flex; flex-direction: column; gap: 10px;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--edge);
  backdrop-filter: blur(12px);
  align-self: start;
  position: sticky; top: 12px;
}
.brand-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.brand { font-size: 1.15rem; padding: 4px 0; }
.brand-row .tool { width: 40px; height: 40px; }
.profile-card { display: flex; gap: 10px; align-items: center; }
.avatar {
  flex: none; width: 52px; height: 52px; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(160deg, var(--cyan), var(--blue-deep));
  font: 700 1.4rem var(--font-display);
  box-shadow: 0 0 16px rgba(56, 214, 255, 0.45);
}
.pf-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.pf-info > b { font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-level { font-size: 0.72rem; font-weight: 700; color: var(--muted); letter-spacing: 0.08em; }
.pf-level b { color: var(--cyan); font-size: 0.9rem; }
.exp-bar { height: 7px; border-radius: 99px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.exp-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--cyan), var(--blue)); transition: width 0.6s; }
.pf-exp { font-size: 0.7rem; color: var(--muted); }
.coin-pill {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 8px 12px; border-radius: 14px;
  background: rgba(0, 0, 0, 0.45); border: 1px solid rgba(255, 216, 77, 0.35);
}
.coin-pill b { font: 700 1.35rem var(--font-display); color: var(--gold); text-shadow: 0 0 10px rgba(255, 216, 77, 0.5); font-variant-numeric: tabular-nums; }
.coin-ico {
  width: 22px; height: 22px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff3b0, #ffcf33 45%, #b97800);
  box-shadow: 0 0 10px rgba(255, 207, 51, 0.6);
}
.menu { display: flex; flex-direction: column; gap: 2px; padding: 8px; border-radius: 14px; background: rgba(0, 0, 0, 0.25); }
.menu-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 4px 6px 8px; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.1em; color: var(--muted);
}
.online { display: flex; align-items: center; gap: 6px; letter-spacing: 0; color: var(--text); }
.online i { width: 9px; height: 9px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 8px var(--cyan); animation: pulse 1.6s infinite; }
.menu-item {
  display: flex; align-items: center; gap: 12px;
  min-height: 44px; padding: 8px 12px;
  border: 0; border-radius: 12px;
  background: transparent; color: var(--text);
  font: 700 0.98rem var(--font-body); text-align: left; cursor: pointer;
}
.menu-item span { width: 1.4em; text-align: center; }
.menu-item:hover { background: rgba(255, 255, 255, 0.06); }
.menu-item.active { background: linear-gradient(90deg, rgba(47, 123, 255, 0.35), rgba(47, 123, 255, 0.05)); box-shadow: inset 3px 0 0 var(--blue); }
.quick { margin-top: 4px; }

.lobby-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.lobby > * { min-width: 0; }
.lobby-main h2 { margin: 0 0 8px; font: 700 1.05rem var(--font-display); letter-spacing: 0.04em; }

.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--edge); backdrop-filter: blur(12px);
}
.game-tab {
  padding: 10px 18px; border-radius: 12px;
  background: linear-gradient(180deg, #4d93ff, #1f5fe6);
  box-shadow: 0 0 18px rgba(47, 123, 255, 0.5);
  font: 700 1rem var(--font-display);
}
.user-pill {
  margin-left: auto;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 12px;
  background: rgba(0, 0, 0, 0.35); border: 1px solid var(--edge);
  max-width: 40%;
}
.user-pill b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.promos { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.promo {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 4px; align-items: flex-start; text-align: left;
  min-height: 96px; padding: 14px 90px 14px 16px;
  border-radius: var(--radius); border: 1px solid var(--edge);
  color: var(--text); font-family: var(--font-body); cursor: pointer;
}
.promo b { font: 700 1.15rem var(--font-display); }
.promo span { color: #d6e4ff; font-size: 0.88rem; }
.promo i { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); font-size: 3rem; font-style: normal; filter: drop-shadow(0 0 14px rgba(255, 255, 255, 0.35)); }
.promo.p1 { background: radial-gradient(circle at 90% 50%, rgba(56, 214, 255, 0.35), transparent 55%), linear-gradient(120deg, #0b2c6b, #164bb8); }
.promo.p2 { background: radial-gradient(circle at 90% 50%, rgba(255, 216, 77, 0.35), transparent 55%), linear-gradient(120deg, #1b1a5e, #3b2fb0); }
.promo:hover { filter: brightness(1.1); }

.banner {
  position: relative;
  min-height: clamp(130px, 22vw, 200px);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--edge);
}
.slide {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; justify-content: center; gap: 6px;
  padding: 18px clamp(18px, 4vw, 40px);
  opacity: 0; transition: opacity 0.6s;
}
.slide.on { opacity: 1; }
.slide h3 { margin: 0; font: 700 clamp(1.2rem, 3vw, 2rem) var(--font-display); text-shadow: 0 2px 12px rgba(0, 0, 0, 0.5); }
.slide p { margin: 0; max-width: 36ch; color: #dbe7ff; }
.slide .art { position: absolute; right: clamp(10px, 4vw, 40px); top: 50%; transform: translateY(-50%); font-size: clamp(3rem, 9vw, 6rem); filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.35)); }
.slide.s1 { background: radial-gradient(circle at 85% 50%, rgba(56, 214, 255, 0.45), transparent 55%), linear-gradient(120deg, #0d2a7a, #1f5fe6); }
.slide.s2 { background: radial-gradient(circle at 85% 50%, rgba(255, 216, 77, 0.45), transparent 55%), linear-gradient(120deg, #3a1d70, #1846c9); }
.slide.s3 { background: radial-gradient(circle at 85% 50%, rgba(56, 214, 255, 0.4), transparent 55%), linear-gradient(120deg, #052b46, #0b5e8f); }
.dots { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); display: flex; gap: 6px; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: rgba(255, 255, 255, 0.35); }
.dots i.on { background: #fff; }

.wins-row { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x mandatory; }
.win-card {
  flex: 0 0 auto; scroll-snap-align: start;
  display: flex; gap: 10px; align-items: center;
  min-width: 210px; padding: 10px 12px;
  border-radius: 14px; background: var(--panel); border: 1px solid var(--edge);
}
.win-card .avatar { width: 40px; height: 40px; font-size: 1rem; }
.win-card b { display: block; }
.win-card small { color: var(--muted); }
.win-card .amt { margin-left: auto; color: var(--gold); font: 700 1rem var(--font-display); }
.empty { color: var(--muted); padding: 10px 2px; }

.resume {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 14px; border-radius: 14px;
  background: rgba(255, 216, 77, 0.12); border: 1px solid rgba(255, 216, 77, 0.45);
}
.resume .btn { min-height: 42px; }

.table-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.tcard {
  position: relative;
  display: flex; flex-direction: column; gap: 8px;
  padding: 14px;
  border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(20, 60, 140, 0.75), rgba(8, 20, 52, 0.9));
  border: 1.5px solid rgba(56, 214, 255, 0.35);
  box-shadow: 0 0 18px rgba(47, 123, 255, 0.15);
}
.tcard .code { align-self: flex-start; padding: 2px 10px; border-radius: 99px; background: rgba(0, 0, 0, 0.4); color: var(--cyan); font: 700 0.8rem var(--font-display); }
.tcard h3 { margin: 0; font: 700 1.2rem var(--font-display); }
.tcard .meta { display: flex; flex-wrap: wrap; gap: 6px 12px; color: var(--muted); font-size: 0.85rem; }
.tcard .meta b { color: var(--text); }
.tcard .top-pay { color: var(--gold); font-weight: 700; font-size: 0.9rem; }
.tcard .btn { margin-top: auto; }

/* ---- Meja ----------------------------------------------------------------
   HP tegak: bertumpuk. HP miring & layar lebar: 3 kolom ala mesin (lihat media query di bawah). */
.machine {
  position: relative;
  max-width: 960px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
           max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  will-change: transform;
}
.machine > .top { order: 0; }
.machine > .paytable { order: 1; }
.machine > .table { order: 2; }
.machine > .message { order: 3; }
.machine > .stats { order: 4; }
.machine > .controls { order: 5; }

.top {
  display: flex; align-items: center; gap: 8px;
  padding: 6px; border-radius: 14px;
  background: var(--panel); border: 1px solid var(--edge); backdrop-filter: blur(10px);
}
.chip {
  flex: none; padding: 8px 12px; border-radius: 10px;
  background: rgba(0, 0, 0, 0.35); border: 1px solid var(--edge);
  font: 700 0.85rem var(--font-display); letter-spacing: 0.04em; white-space: nowrap;
}
.code-chip { color: var(--cyan); }
.mode-chip { background: linear-gradient(90deg, rgba(47, 123, 255, 0.45), rgba(56, 214, 255, 0.15)); }
.table-title { flex: 1; min-width: 0; color: var(--muted); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tools { display: flex; gap: 6px; }
.tool {
  width: 46px; height: 46px;
  border-radius: 12px;
  border: 1px solid var(--edge);
  background: var(--panel);
  backdrop-filter: blur(8px);
  color: var(--text);
  font: 700 1.05rem var(--font-body);
  cursor: pointer;
}
.tool[aria-pressed='false'] { opacity: 0.45; }
.tool[aria-pressed='true'] { box-shadow: 0 0 12px rgba(56, 214, 255, 0.4); border-color: rgba(56, 214, 255, 0.5); }
.tool.back-btn { font-size: 1.3rem; }

.paytable {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px 14px;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--edge);
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4), inset 0 0 30px rgba(47, 123, 255, 0.1);
}
.pay {
  display: flex; justify-content: space-between; gap: 8px;
  padding: 4px 8px; border-radius: 8px;
  font-weight: 700; font-size: 0.92rem; color: var(--muted);
}
.pay b { color: var(--gold); font-variant-numeric: tabular-nums; }
.pay.lit { animation: lit 0.45s steps(1) infinite; }
@keyframes lit {
  0% { background: var(--gold); color: #2a1300; }
  50% { background: transparent; color: var(--text); }
}
.pay.lit b { color: inherit; }

.table {
  position: relative;
  padding: clamp(12px, 2.5vw, 22px);
  border-radius: calc(var(--radius) + 6px);
  background:
    radial-gradient(ellipse at 50% 0%, rgba(56, 214, 255, 0.2), transparent 60%),
    linear-gradient(160deg, rgba(18, 56, 130, 0.8), rgba(6, 16, 46, 0.9));
  border: 2px solid rgba(56, 214, 255, 0.45);
  box-shadow: 0 0 24px rgba(47, 123, 255, 0.3), inset 0 0 40px rgba(0, 0, 0, 0.45);
}
.cards { display: grid; grid-template-columns: repeat(7, 1fr); gap: var(--gap); perspective: 900px; }

.card { aspect-ratio: 5 / 7; position: relative; }
.card .inner {
  position: absolute; inset: 0;
  transform-style: preserve-3d;
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1), translate 0.25s;
}
.card.down .inner { transform: rotateY(180deg); }
.card.empty { border-radius: 10px; border: 2px dashed rgba(255, 255, 255, 0.18); background: rgba(0, 0, 0, 0.15); }
.face {
  position: absolute; inset: 0;
  border-radius: clamp(6px, 1.2vw, 12px);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
}
.front {
  background: linear-gradient(160deg, #ffffff, #e9eef9);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(0, 0, 0, 0.08);
  color: var(--black-suit);
  container-type: inline-size;
}
.front.red { color: var(--red-suit); }
.corner {
  position: absolute; top: 5%; left: 8%;
  display: flex; flex-direction: column; align-items: center;
  font-weight: 900; line-height: 0.95; font-size: 26cqw;
}
.corner small { font-size: 22cqw; }
.corner.br { top: auto; left: auto; bottom: 5%; right: 8%; transform: rotate(180deg); }
.pip { position: absolute; inset: 0; display: grid; place-items: center; font-size: 58cqw; line-height: 1; }
.front.face-card .pip {
  font-family: var(--font-display); font-size: 46cqw;
  background: radial-gradient(circle at 50% 50%, rgba(56, 214, 255, 0.3), transparent 60%);
}
.front.joker { background: linear-gradient(160deg, #1d4ed8, #7c3aed); color: #fff; }
.front.joker .pip { font-size: 60cqw; text-shadow: 0 0 12px var(--gold); color: var(--gold); }
.front.joker .label { position: absolute; left: 0; right: 0; bottom: 8%; text-align: center; font-family: var(--font-display); font-size: 17cqw; letter-spacing: 0.04em; }
.back {
  transform: rotateY(180deg);
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.08) 0 6px, transparent 6px 12px),
    linear-gradient(160deg, #2f7bff, #0d2a7a);
  border: 3px solid #fff;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.45);
}
.back::after {
  content: '★';
  position: absolute; inset: 0;
  display: grid; place-items: center;
  color: var(--gold); font-size: 2rem; text-shadow: 0 0 10px var(--gold);
}
.card.deal { animation: deal 0.42s cubic-bezier(0.22, 1.2, 0.36, 1) both; }
@keyframes deal {
  from { transform: translateY(-60px) scale(0.6) rotate(-8deg); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.card.hit .inner { translate: 0 -10px; }
.card.hit .front { box-shadow: 0 0 0 3px var(--gold), 0 0 24px var(--gold), 0 10px 18px rgba(0, 0, 0, 0.5); }
.card.dim .inner { filter: brightness(0.5) saturate(0.6); }
@keyframes pop { 0% { transform: scale(1.25, 0.8); } 100% { transform: none; } }

.double {
  display: flex; align-items: center; justify-content: center; gap: 20px;
  margin-top: var(--gap); padding: 12px;
  border-radius: 14px; background: rgba(0, 0, 0, 0.3);
  border: 1px dashed rgba(255, 216, 77, 0.6);
}
.double-text { display: flex; flex-direction: column; gap: 4px; max-width: 26ch; }
.double-text strong { font-family: var(--font-display); font-weight: 700; color: var(--gold); font-size: 1.3rem; }
.double-text em { font-style: normal; color: var(--cyan); }
.card-slot { width: clamp(70px, 14vw, 110px); perspective: 900px; }

.message {
  margin: 0; min-height: 2.4em;
  display: grid; place-items: center; text-align: center;
  font-family: var(--font-display); font-weight: 900;
  font-size: clamp(1.05rem, 2.6vw, 1.5rem);
  letter-spacing: 0.03em;
  color: #fff;
  text-shadow: 0 0 10px rgba(56, 214, 255, 0.7);
}
.message.good { color: var(--gold); text-shadow: 0 0 12px #ff9a00; animation: pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1); }
.message.bad { color: #ffb1c4; text-shadow: 0 0 10px var(--danger); }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); }
.stat {
  display: flex; flex-direction: column; align-items: center;
  padding: 8px 6px; border-radius: 14px;
  background: rgba(0, 0, 0, 0.55); border: 1px solid var(--edge);
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.6);
}
.stat span { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.12em; color: var(--muted); }
.stat b {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(1.3rem, 3.6vw, 2rem);
  color: var(--cyan); text-shadow: 0 0 10px rgba(56, 214, 255, 0.6);
  font-variant-numeric: tabular-nums;
}
.stat.win b { color: var(--gold); text-shadow: 0 0 10px rgba(255, 216, 77, 0.7); }

.controls { display: flex; flex-wrap: wrap; gap: var(--gap); justify-content: center; }
.controls .btn { flex: 1 1 130px; max-width: 260px; min-height: 62px; font-size: 1.1rem; }
.controls .btn.small { flex: 0 1 80px; font-size: 1.5rem; }

/* ---- Dialog & toast -------------------------------------------------------- */
dialog {
  max-width: min(560px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px);
  border: 1px solid rgba(56, 214, 255, 0.4);
  border-radius: 20px;
  background: var(--panel-solid);
  color: var(--text);
  padding: 22px 24px;
  box-shadow: 0 0 40px rgba(47, 123, 255, 0.35);
  line-height: 1.55;
}
dialog::backdrop { background: rgba(2, 6, 20, 0.75); backdrop-filter: blur(4px); }
dialog h2 { margin: 0 0 8px; font-family: var(--font-display); font-weight: 700; color: var(--gold); }
dialog ol { padding-left: 1.2em; }
dialog li { margin-bottom: 8px; }
dialog form > .btn { width: 100%; margin-top: 12px; }
.toggle {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 4px; border-bottom: 1px solid var(--edge); font-weight: 700;
}
.toggle input { width: 24px; height: 24px; accent-color: var(--blue); }
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.dialog-actions .btn { min-height: 46px; font-size: 0.85rem; }
#soon { text-align: center; }
.soon-icon { font-size: 3.5rem; filter: drop-shadow(0 0 16px rgba(56, 214, 255, 0.6)); }

.toast {
  position: fixed; z-index: 30; left: 50%; bottom: max(20px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  padding: 12px 18px; border-radius: 14px;
  background: #2a0f1d; border: 1px solid var(--danger); color: #ffd6e0;
  font-weight: 700; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* ---- Layar sempit (HP tegak) ---------------------------------------------- */
@media (max-width: 760px) and (orientation: portrait) {
  .lobby { grid-template-columns: 1fr; gap: 10px; }
  .lobby-side { position: static; padding: 12px; gap: 8px; }
  .menu-head { display: none; }
  .menu { flex-direction: row; overflow-x: auto; gap: 6px; padding: 6px; }
  .menu-item { flex: none; min-height: 38px; padding: 6px 12px; font-size: 0.85rem; background: rgba(255, 255, 255, 0.05); }
  .menu-item.active { box-shadow: inset 0 -3px 0 var(--blue); }
}
@media (max-width: 640px) and (orientation: portrait) {
  .machine > .stats { margin-top: auto; }
  .top { gap: 5px; }
  .chip { padding: 6px 8px; font-size: 0.75rem; }
  .tools { gap: 4px; }
  .paytable { grid-template-columns: repeat(2, 1fr); gap: 2px 8px; padding: 10px; }
  .pay { font-size: 0.8rem; padding: 3px 6px; }
  .tool { width: 36px; height: 36px; }
  .table-title { display: none; }
  .controls .btn { flex-basis: 120px; min-height: 58px; font-size: 1rem; }
  .double { flex-direction: column; gap: 10px; text-align: center; }
  .promos { grid-template-columns: 1fr; }
  .user-pill { display: none; }
}

/* ---- Meja 3 kolom ala mesin: HP miring & layar lebar ----------------------- */
@media (min-width: 900px) and (min-height: 600px), (orientation: landscape) and (max-height: 560px) {
  .machine {
    max-width: 1280px;
    height: 100dvh;
    display: grid;
    grid-template-columns: minmax(150px, 19%) 1fr minmax(160px, 21%);
    grid-template-rows: auto auto 1fr auto;
    grid-template-areas:
      'top   top   top'
      'stats pay   ctrl'
      'stats table ctrl'
      'stats msg   ctrl';
    column-gap: 12px;
  }
  .machine > .top { grid-area: top; }
  .machine > .stats { grid-area: stats; grid-template-columns: 1fr; align-content: start; }
  .machine > .paytable { grid-area: pay; }
  .machine > .table { grid-area: table; align-self: center; }
  .machine > .message { grid-area: msg; }
  .machine > .controls {
    grid-area: ctrl;
    display: grid; grid-template-columns: 1fr 1fr; align-content: center; gap: 10px;
  }
  .paytable { grid-template-columns: repeat(2, 1fr); background: rgba(0, 0, 0, 0.35); }
  .controls .btn { grid-column: span 2; max-width: none; width: 100%; }
  .controls .btn.small { grid-column: span 1; }
  /* Tombol utama bulat besar, seperti tombol BET di mesin. */
  .controls .btn[data-primary] { min-height: 96px; border-radius: 999px; font-size: 1.35rem; }
  .double {
    position: absolute; inset: 6px; margin: 0; z-index: 2;
    flex-direction: row; gap: 16px;
    background: rgba(4, 12, 34, 0.94); border-style: solid;
  }
  .card-slot { width: auto; height: 100%; aspect-ratio: 5 / 7; }
  .card-slot .card { height: 100%; }
}

/* ---- HP posisi landscape: ukuran dipadatkan -------------------------------------- */
@media (orientation: landscape) and (max-height: 560px) {
  :root { font-size: clamp(12px, 3.4vh, 16px); --gap: 6px; }
  html[data-size='large'] { font-size: clamp(14px, 4vh, 18px); }

  .lobby { grid-template-columns: 210px 1fr; padding-top: max(8px, env(safe-area-inset-top)); }
  .lobby-side { max-height: calc(100dvh - 16px); overflow-y: auto; padding: 10px; gap: 6px; }
  .brand { font-size: 1rem; }
  .avatar { width: 40px; height: 40px; font-size: 1.1rem; }
  .menu-item { min-height: 34px; padding: 4px 10px; }
  .banner { min-height: 110px; }
  .topbar { padding: 6px; }
  .game-tab { padding: 6px 12px; }

  .machine { padding-top: max(6px, env(safe-area-inset-top)); padding-bottom: max(6px, env(safe-area-inset-bottom)); row-gap: 6px; }
  .top { padding: 4px; }
  .tool { width: 34px; height: 34px; border-radius: 9px; font-size: 0.9rem; }
  .chip { padding: 5px 8px; font-size: 0.72rem; }
  .paytable { gap: 0 10px; padding: 5px 8px; }
  .pay { font-size: 0.78rem; padding: 0 6px; }
  .cards { max-width: calc(7 * 30dvh * 5 / 7 + 6 * var(--gap)); width: 100%; margin: 0 auto; }
  .table { padding: 6px 8px; }
  .message { min-height: 1.4em; font-size: 0.95rem; }
  .stat { padding: 4px 6px; }
  .stat b { font-size: 1.15rem; }
  .controls { gap: 6px; }
  .controls .btn { min-height: 44px; padding: 4px 8px; font-size: 0.9rem; }
  .controls .btn small { font-size: 0.64rem; }
  .controls .btn[data-primary] { min-height: 72px; font-size: 1.1rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ---- Halaman menu (Shop, Bonus, dll.) -------------------------------------------- */
.panel-view { display: flex; flex-direction: column; gap: 14px; }
.page-head { display: flex; align-items: center; gap: 12px; }
.page-head h2 { margin: 0; font-size: 1.5rem; }
.page-icon { font-size: 2rem; }
.soon-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
  padding: 22px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--edge);
}
.soon-card b { padding: 4px 12px; border-radius: 99px; background: rgba(47, 123, 255, 0.25); color: var(--cyan); }
.soon-card p { margin: 0; color: #d6e4ff; max-width: 60ch; line-height: 1.5; }

/* ---- Minta HP diputar (HP tegak, setelah login) -------------------------------- */
.rotate {
  display: none;
  position: fixed; inset: 0; z-index: 40;
  place-content: center; justify-items: center; gap: 14px;
  padding: 24px; text-align: center;
  background: radial-gradient(circle at 50% 30%, rgba(47, 123, 255, 0.3), transparent 60%), #040a1c;
}
.rotate h2 { margin: 0; font-size: 1.6rem; font-weight: 900; }
.rotate p { margin: 0; max-width: 30ch; color: #cfdcf7; }
.rotate small { color: var(--muted); max-width: 32ch; }
.rotate .btn { min-width: 220px; }
.rotate-phone {
  width: 70px; height: 120px; margin-bottom: 10px;
  border: 4px solid var(--cyan); border-radius: 14px;
  box-shadow: 0 0 24px rgba(56, 214, 255, 0.5);
  position: relative;
  animation: turn 2.2s ease-in-out infinite;
}
.rotate-phone i { position: absolute; left: 50%; bottom: 8px; width: 16px; height: 4px; margin-left: -8px; border-radius: 4px; background: var(--cyan); }
@keyframes turn {
  0%, 20% { transform: rotate(0deg); }
  50%, 75% { transform: rotate(-90deg); }
  100% { transform: rotate(0deg); }
}
@media (orientation: portrait) and (pointer: coarse) and (max-width: 820px) {
  body.in-game .rotate { display: grid; }
  body.in-game { overflow: hidden; }
}

/* ---- Lobi "fix" satu layar ala GLX (HP miring & desktop); halaman lain scroll di dalam ---- */
@media (min-width: 761px), (orientation: landscape) {
  .lobby { height: 100dvh; overflow: hidden; }
  .lobby-side { position: static; max-height: 100%; overflow-y: auto; }
  .lobby-main { height: 100%; min-height: 0; overflow: hidden; }
  .lobby-main > .view { flex: 1; min-height: 0; overflow-y: auto; }
  #viewLobby { display: grid; grid-template-rows: minmax(0, 1fr) auto auto; gap: 12px; overflow: hidden; }
  #viewLobby .banner { min-height: 0; }
}

.menu-item { position: relative; }
.badge {
  margin-left: auto; min-width: 22px; height: 22px; padding: 0 6px;
  display: grid; place-items: center; border-radius: 99px;
  background: var(--gold); color: #3a1d00; font: 900 0.75rem var(--font-body); font-style: normal;
  box-shadow: 0 0 10px rgba(255, 216, 77, 0.6);
}
.promos { grid-template-columns: repeat(3, 1fr); }
.promo.p3 { background: radial-gradient(circle at 90% 50%, rgba(56, 214, 255, 0.3), transparent 55%), linear-gradient(120deg, #0a2140, #0f3d6e); }
.promo.ready { box-shadow: 0 0 0 2px var(--gold), 0 0 24px rgba(255, 216, 77, 0.45); }

.page-head { flex-wrap: wrap; }
.filters { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; }
.chip-btn {
  min-height: 36px; padding: 6px 14px; border-radius: 99px;
  border: 1px solid var(--edge); background: rgba(255, 255, 255, 0.05);
  color: var(--text); font: 700 0.85rem var(--font-body); cursor: pointer;
}
.chip-btn.active { background: linear-gradient(180deg, #4d93ff, #1f5fe6); border-color: transparent; }
.rooms-view { display: flex; flex-direction: column; gap: 12px; }
.tcard .tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { padding: 2px 10px; border-radius: 99px; font-size: 0.75rem; font-weight: 700; background: rgba(0, 0, 0, 0.4); color: var(--cyan); }
.tag.jackpot { background: rgba(255, 216, 77, 0.18); color: var(--gold); }
.tcard.playing { border-color: var(--gold); box-shadow: 0 0 18px rgba(255, 216, 77, 0.35); }

/* ---- Halaman bonus ---- */
.bonus-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.bcard {
  display: flex; flex-direction: column; gap: 8px; align-items: center; text-align: center;
  padding: 18px 14px; border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(20, 60, 140, 0.75), rgba(8, 20, 52, 0.9));
  border: 1.5px solid var(--edge);
}
.bcard.ready { border-color: var(--gold); box-shadow: 0 0 22px rgba(255, 216, 77, 0.3); }
.bcard .bicon { font-size: 2.6rem; }
.bcard h3 { margin: 0; font-size: 1.1rem; }
.bcard .amt { font: 900 1.5rem var(--font-body); color: var(--gold); }
.bcard p { margin: 0; color: var(--muted); font-size: 0.85rem; }
.bcard .btn { width: 100%; margin-top: auto; }
.bcard .wait { font: 900 1.05rem var(--font-body); color: var(--cyan); font-variant-numeric: tabular-nums; }
.bonus-note { margin: 0; color: var(--muted); font-size: 0.85rem; }

@media (orientation: landscape) and (max-height: 560px) {
  .lobby { gap: 10px; }
  .lobby-side { gap: 5px; padding: 8px; }
  .brand-row .tool { width: 32px; height: 32px; }
  .profile-card .avatar { width: 36px; height: 36px; font-size: 1rem; }
  .pf-exp { display: none; }
  .menu { padding: 4px; }
  .menu-head { padding: 2px 6px 4px; }
  .menu-item { min-height: 29px; padding: 2px 10px; font-size: 0.85rem; }
  .quick { min-height: 40px; }
  .lobby-main { gap: 8px; }
  .lobby-main h2 { margin-bottom: 4px; font-size: 0.9rem; }
  #viewLobby { gap: 8px; }
  .slide { padding: 12px 18px; }
  .slide h3 { font-size: 1.25rem; }
  .slide p { font-size: 0.85rem; }
  .win-card { min-width: 180px; padding: 6px 10px; }
  .win-card .avatar { width: 30px; height: 30px; }
  .empty { padding: 4px 2px; font-size: 0.85rem; }
  .promo { min-height: 64px; padding: 8px 54px 8px 12px; }
  .promo b { font-size: 0.95rem; }
  .promo span { font-size: 0.75rem; }
  .promo i { font-size: 2rem; right: 10px; }
  .bcard { padding: 10px; gap: 4px; }
  .bcard .bicon { font-size: 1.8rem; }
}

/* Penyesuaian lobi satu layar */
.wins-row { min-height: 52px; align-items: center; }
@media (orientation: landscape) and (max-height: 560px) {
  .lobby { padding-top: max(6px, env(safe-area-inset-top)); padding-bottom: max(6px, env(safe-area-inset-bottom)); }
  .lobby-side { gap: 4px; }
  .brand-row .tool { width: 28px; height: 28px; font-size: 0.85rem; }
  .menu-item { min-height: 27px; }
  .quick { min-height: 36px; padding: 4px 10px; font-size: 0.9rem; }
  .wins-row { min-height: 44px; }
}

/* ---- Shop ---- */
.pack-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.pack {
  display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
  padding: 16px 12px; border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(20, 60, 140, 0.75), rgba(8, 20, 52, 0.9));
  border: 1.5px solid var(--edge);
}
.pack .coin-stack { font-size: 2.4rem; }
.pack h3 { margin: 0; font-size: 1rem; }
.pack .amt { font: 900 1.25rem var(--font-body); color: var(--gold); }
.pack .btn { width: 100%; margin-top: 4px; }
h2.sub { margin: 10px 0 0; font-size: 1rem; }
.history { display: flex; flex-direction: column; gap: 6px; }
.hrow {
  display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr auto; gap: 10px; align-items: center;
  padding: 8px 12px; border-radius: 12px; background: var(--panel); border: 1px solid var(--edge); font-size: 0.88rem;
}
.st { font-weight: 700; }
.st.paid { color: var(--cyan); }
.st.pending { color: var(--gold); }
.st.expired, .st.failed, .st.canceled { color: var(--danger); }

.toast.good { background: #0d2b57; border-color: var(--cyan); color: #e6f6ff; }

/* HP miring yang sangat pendek (bilah alamat browser masih terlihat): menu dipadatkan lagi. */
@media (orientation: landscape) and (max-height: 380px) {
  .lobby { grid-template-columns: 190px 1fr; gap: 8px; }
  .lobby-side { gap: 3px; padding: 6px; }
  .brand { font-size: 0.85rem; }
  .profile-card { gap: 6px; }
  .profile-card .avatar { width: 30px; height: 30px; font-size: 0.9rem; }
  .pf-info > b { font-size: 0.9rem; }
  .menu-head { display: none; }
  .menu-item { min-height: 24px; padding: 1px 8px; font-size: 0.8rem; gap: 8px; }
  .badge { min-width: 18px; height: 18px; font-size: 0.68rem; }
  .quick { min-height: 32px; font-size: 0.8rem; }
  .topbar { padding: 4px; }
  .game-tab, .user-pill { padding: 4px 10px; }
  .coin-pill { padding: 4px 10px; }
  .coin-pill b { font-size: 1.1rem; }
  .wins-row { min-height: 36px; }
  .promo { min-height: 52px; }
  .promo span { display: none; }
}
@media (orientation: landscape) and (max-height: 330px) {
  .exp-bar { display: none; }
  .brand-row .tool { width: 24px; height: 24px; font-size: 0.75rem; }
  .menu { padding: 2px; gap: 0; }
  .menu-item { min-height: 21px; font-size: 0.76rem; }
  .quick { min-height: 28px; padding: 2px 8px; }
}

/* Tombol layar penuh di bar atas & petunjuk iPhone */
.topbar .tool { flex: none; }
.ios-hint {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 12px; font-size: 0.85rem;
  background: rgba(47, 123, 255, 0.18); border: 1px solid rgba(56, 214, 255, 0.4);
}
.ios-hint > span { flex: 1; }

/* ---- Menu samping "fix": mengisi tinggi layar persis, tanpa scroll --------------------
   Tombol menu berbagi sisa tinggi secara merata (flex), jadi otomatis mengecil/membesar
   mengikuti layar. Berlaku untuk lobi satu layar (HP miring & desktop). */
@media (min-width: 761px), (orientation: landscape) {
  .lobby { align-items: stretch; }
  .lobby .lobby-side {
    align-self: stretch; height: 100%; max-height: none; overflow: hidden;
    display: flex; flex-direction: column;
  }
  .lobby .menu { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
  .lobby .menu-head { flex: none; }
  .lobby .menu-item { flex: 1 1 0; min-height: 0; max-height: 54px; padding-top: 0; padding-bottom: 0; }
  .lobby .quick { flex: none; }
}

/* ---- Dialog: tombol ✕ selalu terlihat di pojok kanan atas; isi pas layar ---- */
dialog { padding-top: 16px; }
dialog form { position: relative; }
.dlg-x {
  position: sticky; top: 0; float: right; z-index: 2;
  width: 40px; height: 40px; margin: -4px -8px 0 8px;
  border-radius: 50%; border: 1px solid var(--edge);
  background: rgba(255, 255, 255, 0.08); color: var(--text);
  font: 900 1.1rem var(--font-body); cursor: pointer;
}
.dlg-x:hover { background: rgba(255, 255, 255, 0.16); }
.dlg-x:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; }
dialog h2 { padding-right: 48px; }
.toggles { display: grid; grid-template-columns: 1fr; }
dialog.compact { overflow: hidden; }
@media (orientation: landscape) and (max-height: 560px) {
  dialog { padding: 12px 16px; max-height: calc(100dvh - 16px); }
  dialog h2 { font-size: 1.1rem; margin-bottom: 4px; }
  .dlg-x { width: 34px; height: 34px; }
  .toggles { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .toggle { flex-direction: column; gap: 6px; padding: 10px 6px; border: 1px solid var(--edge); border-radius: 12px; text-align: center; }
  .dialog-actions { margin-top: 10px; }
  .dialog-actions .btn { min-height: 40px; }
}

/* ---- Ajakan layar penuh (setelah HP dimiringkan) ---- */
.fs-prompt {
  position: fixed; inset: 0; z-index: 41;
  display: grid; place-items: center; padding: 12px;
  background: radial-gradient(circle at 50% 30%, rgba(47, 123, 255, 0.35), transparent 60%), rgba(4, 10, 28, 0.96);
}
.fs-card { display: flex; flex-direction: column; align-items: center; gap: 8px; max-width: 460px; text-align: center; }
.fs-icon { font-size: 2.6rem; color: var(--cyan); text-shadow: 0 0 18px rgba(56, 214, 255, 0.7); line-height: 1; }
.fs-card h2 { margin: 0; font-size: 1.4rem; font-weight: 900; }
.fs-card p { margin: 0; color: #cfdcf7; }
.fs-card .btn { min-width: 260px; min-height: 54px; font-size: 1.05rem; }
.fs-ios { margin: 0; padding-left: 1.2em; text-align: left; color: #e2ebff; }
.fs-ios li { margin: 2px 0; }
@media (orientation: landscape) and (max-height: 380px) {
  .fs-icon { font-size: 1.8rem; }
  .fs-card { gap: 5px; }
  .fs-card h2 { font-size: 1.15rem; }
  .fs-card p { font-size: 0.85rem; }
  .fs-card .btn { min-height: 44px; }
}

/* ---- iPhone: "geser ke atas" agar bilah alamat Safari mengecil ----
   Halaman diberi ruang gulir ekstra; layar game dikunci mengisi layar yang terlihat. */
html.ios-swipe body { min-height: calc(100vh + 260px); }
html.ios-swipe .screen:not([hidden]) { position: fixed; inset: 0; height: 100%; min-height: 0; overflow: hidden; }
html.ios-swipe .lobby, html.ios-swipe .machine { height: 100%; }
.fs-prompt.swipe { background: rgba(4, 10, 28, 0.82); touch-action: pan-y; }
.swipe-hint { position: relative; height: 70px; width: 60px; }
.swipe-hand { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); font-size: 2.6rem; animation: swipe-up 1.4s ease-in-out infinite; }
.swipe-arrow { position: absolute; left: 50%; top: -6px; transform: translateX(-50%); font: 900 2rem var(--font-body); color: var(--cyan); opacity: 0.8; }
@keyframes swipe-up {
  0% { transform: translate(-50%, 10px); opacity: 0; }
  20% { opacity: 1; }
  80% { transform: translate(-50%, -38px); opacity: 1; }
  100% { transform: translate(-50%, -44px); opacity: 0; }
}
.fs-tip { font-size: 0.78rem; color: var(--muted) !important; }
@media (prefers-reduced-motion: reduce) { .swipe-hand { animation: none; } }
.fs-prompt.swipe { background: radial-gradient(circle at 50% 40%, rgba(47, 123, 255, 0.35), transparent 60%), rgba(4, 10, 28, 0.93); }
.fs-prompt.swipe .fs-icon { display: none; }
.fs-prompt.swipe .swipe-hint { height: 110px; width: 90px; margin-top: 4px; }
.fs-prompt.swipe .swipe-hand { font-size: 3.6rem; }
.fs-prompt.swipe .swipe-arrow { font-size: 2.6rem; top: -14px; }
@media (orientation: landscape) and (max-height: 380px) {
  .fs-prompt.swipe .swipe-hint { height: 84px; }
  .fs-prompt.swipe .swipe-hand { font-size: 2.8rem; }
}

/* iPhone/Safari memberi gaya bawaan pada <button> (latar terang). Matikan untuk semua tombol. */
button { -webkit-appearance: none; appearance: none; }

/* Kartu promo lobi: latar cadangan (bila gradien tidak didukung), ukuran seragam & sejajar. */
.promos { grid-auto-rows: 1fr; align-items: stretch; }
.promo {
  background-color: #12306e;
  color: var(--text);
  height: 100%; min-width: 0;
  justify-content: center;
  -webkit-text-fill-color: currentColor;
}
.promo b, .promo span { width: 100%; overflow: hidden; text-overflow: ellipsis; }
.promo b { white-space: nowrap; }
.promo span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
@media (orientation: landscape) and (max-height: 380px) {
  .promo span { display: none; }
}

/* ---- Lobi "kaku" seperti layar game: tidak ada yang bisa digeser; elemen & tulisan
   mengecil mengikuti tinggi layar (unit vh) supaya tetap rapi di HP kecil. ---- */
@media (min-width: 761px), (orientation: landscape) {
  #scrLobby, #scrLobby .lobby-main, #viewLobby { overflow: hidden; overscroll-behavior: none; }
  #viewLobby .wins-row {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.4vh;
    overflow: hidden; scroll-snap-type: none; padding-bottom: 0;
  }
  #viewLobby .win-card { min-width: 0; }
  #viewLobby .win-card > div:nth-child(2) { min-width: 0; }
  #viewLobby .win-card b, #viewLobby .win-card small {
    display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  #viewLobby .win-card .amt { flex: none; }
  #viewLobby .wins-row > .empty { grid-column: 1 / -1; }
}
body.in-game { overscroll-behavior: none; }

/* Skala mengikuti tinggi layar pada HP miring: semua ukuran rem ikut mengecil. */
@media (orientation: landscape) and (max-height: 560px) {
  :root { font-size: clamp(10px, 3.5vh, 16px); }
  #viewLobby .win-card { padding: 0.6vh 1.2vh; gap: 1.2vh; }
  #viewLobby .win-card .avatar { width: 9vh; height: 9vh; font-size: 3.6vh; flex: none; }
  #viewLobby .win-card b { font-size: 3.8vh; }
  #viewLobby .win-card small { font-size: 3vh; }
  #viewLobby .win-card .amt { font-size: 3.8vh; }
}

/* =========================================================================================
   LOBI = KANVAS TETAP 1280×720 (seperti layar game, mengikuti susunan lobi GLX).
   Dirancang sekali dalam piksel tetap, lalu diskalakan UTUH oleh JS (--stage-scale) agar pas
   di layar mana pun dan diletakkan di tengah. Semua elemen tetap di posisinya; di layar kecil
   tulisan ikut mengecil tapi susunannya sama. Selektor diawali `html.stage-mode #scrLobby`
   supaya mengalahkan aturan responsif lama di atas.
   ========================================================================================= */
html.stage-mode { font-size: 18px; }
html.stage-mode body { overflow: hidden; }

html.stage-mode #scrLobby {
  position: fixed; inset: auto; left: 50%; top: 50%; margin: 0;
  width: 1280px; height: 720px; min-height: 0; max-width: none;
  transform: translate(-50%, -50%) scale(var(--stage-scale, 1));
  transform-origin: center center;
  display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 22px;
  padding: 26px 30px; overflow: hidden;
}

/* ---- Kolom kiri ---- */
html.stage-mode #scrLobby .lobby-side {
  position: static; height: 100%; max-height: none; overflow: hidden;
  display: flex; flex-direction: column; gap: 14px; padding: 16px; align-self: stretch;
}
html.stage-mode #scrLobby .brand-row { flex: none; height: 52px; }
html.stage-mode #scrLobby .brand { display: block; font-size: 23px; padding: 0; }
html.stage-mode #scrLobby .brand-row .tool { width: 46px; height: 46px; font-size: 20px; border-radius: 12px; }
html.stage-mode #scrLobby .profile-card { flex: none; gap: 14px; padding: 14px; border-radius: 16px; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--edge); }
html.stage-mode #scrLobby .profile-card .avatar { width: 58px; height: 58px; font-size: 26px; }
html.stage-mode #scrLobby .pf-info { gap: 4px; }
html.stage-mode #scrLobby .pf-info > b { font-size: 21px; }
html.stage-mode #scrLobby .pf-level { font-size: 13px; }
html.stage-mode #scrLobby .pf-level b { font-size: 16px; }
html.stage-mode #scrLobby .exp-bar { display: block; height: 8px; }
html.stage-mode #scrLobby .pf-exp { display: block; font-size: 13px; }
html.stage-mode #scrLobby .menu {
  flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 2px;
  padding: 10px; overflow: hidden; border-radius: 16px;
}
html.stage-mode #scrLobby .menu-head { display: flex; flex: none; font-size: 14px; padding: 4px 10px 10px; }
html.stage-mode #scrLobby .online { font-size: 15px; }
html.stage-mode #scrLobby .menu-item {
  flex: 1 1 0; min-height: 0; max-height: 62px; padding: 0 14px; gap: 14px;
  font-size: 20px; background: transparent; box-shadow: none;
}
html.stage-mode #scrLobby .menu-item span { width: 30px; font-size: 22px; }
html.stage-mode #scrLobby .menu-item.active { background: linear-gradient(90deg, rgba(47, 123, 255, 0.35), rgba(47, 123, 255, 0.05)); box-shadow: inset 4px 0 0 var(--blue); }
html.stage-mode #scrLobby .badge { min-width: 28px; height: 28px; font-size: 15px; }
html.stage-mode #scrLobby .quick { flex: none; min-height: 66px; font-size: 21px; padding: 0 16px; border-radius: 16px; }

/* ---- Kolom kanan ---- */
html.stage-mode #scrLobby .lobby-main { height: 100%; min-height: 0; overflow: hidden; gap: 16px; display: flex; flex-direction: column; }
html.stage-mode #scrLobby .topbar { flex: none; height: 78px; padding: 12px 14px; gap: 14px; border-radius: 18px; }
html.stage-mode #scrLobby .game-tab { padding: 12px 24px; font-size: 21px; border-radius: 12px; }
html.stage-mode #scrLobby .user-pill { display: flex; padding: 10px 20px; font-size: 19px; gap: 10px; max-width: 34%; border-radius: 12px; }
html.stage-mode #scrLobby .coin-pill { padding: 8px 18px; gap: 12px; border-radius: 12px; }
html.stage-mode #scrLobby .coin-pill b { font-size: 25px; }
html.stage-mode #scrLobby .coin-ico { width: 30px; height: 30px; }
html.stage-mode #scrLobby .topbar .tool { width: 50px; height: 50px; font-size: 20px; }

html.stage-mode #scrLobby .lobby-main > .view { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
html.stage-mode #scrLobby #viewLobby {
  display: grid; grid-template-rows: minmax(0, 1fr) auto auto; gap: 16px; overflow: hidden;
}
html.stage-mode #scrLobby #viewLobby .banner { min-height: 0; border-radius: 18px; }
html.stage-mode #scrLobby .slide { padding: 28px 46px; gap: 10px; }
html.stage-mode #scrLobby .slide h3 { font-size: 36px; }
html.stage-mode #scrLobby .slide p { font-size: 19px; max-width: 34ch; }
html.stage-mode #scrLobby .slide .art { font-size: 110px; right: 50px; }
html.stage-mode #scrLobby .dots i { width: 10px; height: 10px; }

html.stage-mode #scrLobby .wins h2 { font-size: 18px; margin: 0 0 8px; }
html.stage-mode #scrLobby #viewLobby .wins-row {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px;
  height: 86px; min-height: 0; overflow: hidden; padding: 0;
}
html.stage-mode #scrLobby #viewLobby .win-card { min-width: 0; padding: 12px 18px; gap: 14px; border-radius: 16px; }
html.stage-mode #scrLobby #viewLobby .win-card .avatar { width: 54px; height: 54px; font-size: 22px; flex: none; }
html.stage-mode #scrLobby #viewLobby .win-card b { font-size: 19px; }
html.stage-mode #scrLobby #viewLobby .win-card small { font-size: 14px; }
html.stage-mode #scrLobby #viewLobby .win-card .amt { font-size: 21px; }
html.stage-mode #scrLobby #viewLobby .wins-row > .empty { font-size: 16px; padding: 0; align-self: center; }

html.stage-mode #scrLobby .promos { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: 1fr; gap: 14px; height: 124px; }
html.stage-mode #scrLobby .promo { min-height: 0; height: 100%; padding: 18px 100px 18px 22px; gap: 6px; border-radius: 18px; }
html.stage-mode #scrLobby .promo b { font-size: 23px; }
html.stage-mode #scrLobby .promo span { display: -webkit-box; font-size: 15px; }
html.stage-mode #scrLobby .promo i { font-size: 58px; right: 22px; }

/* Halaman lain di dalam lobi (Pilih Room, Bonus, Shop, ...) tetap bisa di-scroll di area kanan. */
html.stage-mode #scrLobby .page-head h2 { font-size: 26px; }

/* Kartu kemenangan ala GLX: nama di atas, kombinasi + jumlah menang di bawah. */
.win-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.win-info b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.win-line { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; min-width: 0; }
.win-line small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.win-line .amt { margin-left: 0; flex: none; }
html.stage-mode #scrLobby #viewLobby .win-card b { font-size: 20px; }
html.stage-mode #scrLobby #viewLobby .win-line small { font-size: 15px; }
html.stage-mode #scrLobby #viewLobby .win-line .amt { font-size: 22px; }
html.ios-swipe .view, html.ios-swipe dialog, html.ios-swipe .table-grid { overscroll-behavior: contain; }

/* Kartu promo: tanpa bingkai kuning "siap"; sedikit lebih ramping dan tidak menempel ke tepi bawah. */
.promo.ready, html.stage-mode #scrLobby .promo.ready { box-shadow: none; }
html.stage-mode #scrLobby { padding-bottom: 30px; }
html.stage-mode #scrLobby #viewLobby { padding: 2px 2px 4px; gap: 14px; }
html.stage-mode #scrLobby .promos { height: 112px; }
html.stage-mode #scrLobby .promo { padding: 16px 96px 16px 22px; border: 1px solid rgba(148, 197, 255, 0.22); }
html.stage-mode #scrLobby .promo b { font-size: 22px; }
html.stage-mode #scrLobby .promo span { font-size: 15px; line-height: 1.35; }
html.stage-mode #scrLobby .promo i { font-size: 54px; }
/* Logo lobi sedikit menjauh dari tepi kiri panel. */
html.stage-mode #scrLobby .brand-row { padding-left: 10px; }
