/* Dipakai semua game: layar masuk, lobi, kartu pemain, hasil akhir */

/* Layar masuk dan lobi */
.screen { max-width: 880px; margin: 0 auto; padding: 32px 24px 56px; }
.screen h1 { font-size: 52px; font-size: clamp(44px, 9vw, 72px); margin-top: 16px; }
.back { color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: 15px; }
.back:hover { color: var(--ink); }
.back-btn { background: none; border: 0; padding: 8px 0; cursor: pointer; font-family: var(--body); }
.lede { margin-top: 8px; color: var(--ink-2); font-size: 18px; }
.muted { color: var(--ink-3); font-weight: 400; }

.panel {
  display: grid; gap: 16px; align-content: start;
  padding: 24px; border-radius: 18px;
  background: var(--surface); border: 1px solid var(--line);
}
.panel h2 { font-size: 24px; }
.entry-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 24px; }
.entry-grid.solo, .lobby-grid.solo { grid-template-columns: minmax(0, 460px); }
#createBtn, #joinBtn { width: 100%; }
#dealerBlock { align-content: start; }
.link-row { display: flex; gap: 8px; }
.share-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.share-row .btn { flex: 1; min-width: 150px; }
.btn-wa { background: #25d366; border-color: #25d366; color: #052e16; font-weight: 700; }
.btn-wa:hover { background: #3be07a; }
.app-mode .share-row { justify-content: center; }
.offline-mode .share-row { display: none; }
.code-input { text-transform: uppercase; letter-spacing: .3em; font-weight: 700; }
.code-input::placeholder { letter-spacing: .3em; font-weight: 400; color: var(--ink-3); }
.rules { margin-top: 16px; color: var(--ink-2); }
.rules summary { cursor: pointer; font-weight: 600; padding: 8px 0; }
.rules ul { margin: 4px 0 0; padding-left: 20px; display: grid; gap: 6px; font-size: 15px; }

.code { color: var(--amber); letter-spacing: .06em; }
.lobby-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 24px; }
.qr { width: 100%; max-width: 320px; height: auto; border-radius: 12px; background: var(--ivory); justify-self: center; }
.invite-hint { color: var(--ink-2); font-size: 15px; }
.link-row .input { flex: 1; min-width: 0; font-size: 14px; }
.players { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.players li { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 6px 12px; border-radius: 12px; background: var(--surface-2); }
.players .empty { background: none; border: 1px dashed var(--line); color: var(--ink-3); }
.players .tag { margin-left: auto; font-size: 13px; color: var(--ink-3); }
#startBtn { width: 100%; }
.wait { font-size: 15px; text-align: center; }
.wait:empty { display: none; }

.avatar {
  --p: 0;
  position: relative; flex: none; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--display); font-weight: 800; font-size: 18px;
  background: #3f3425; color: var(--ink);
}
.is-active .avatar { background: var(--amber); color: var(--amber-ink); }
.is-active .avatar::before {
  content: ''; position: absolute; top: -5px; right: -5px; bottom: -5px; left: -5px; border-radius: 50%;
  background: conic-gradient(var(--amber) calc(var(--p) * 360deg), rgba(255, 255, 255, .12) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 0);
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 0);
}
.is-offline .avatar { opacity: .5; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.topbar-right { display: flex; gap: 6px; flex: none; }
.topbar .ic { line-height: 1; }
.topbar .ic + .lbl { margin-left: 6px; }
.topbar .round { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toggle[aria-pressed='true'] { border-color: var(--amber); color: var(--amber); }
.toggle[aria-pressed='false'] { color: var(--ink-3); text-decoration: line-through; }
.round { font-size: 14px; font-weight: 600; color: var(--ink-2); text-align: center; }

.seat {
  position: relative; display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 14px; min-width: 0;
  background: var(--surface); border: 1px solid var(--line);
}
.seat.is-active { border-color: var(--amber); }
.seat-info { min-width: 0; display: grid; gap: 2px; }
.seat-name { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seat-sub { font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.backs { display: flex; gap: 2px; height: 14px; align-items: stretch; }
.backs i { width: 7px; border-radius: 2px; background: #7a3b22; border: 1px solid #a2573a; }
.bubble {
  position: absolute; top: -6px; right: 6px; z-index: 2;
  padding: 2px 10px; border-radius: 999px;
  background: var(--ink); color: var(--pip);
  font-weight: 700; font-size: 13px;
  animation: bubble .25s ease-out;
}
@keyframes bubble { from { transform: translateY(6px) scale(.8); opacity: 0; } }

.overlay {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 20;
  display: grid; place-items: center; padding: 16px;
  background: rgba(10, 8, 5, .72); overflow-y: auto;
}
.result {
  width: 100%; max-width: 560px; padding: 24px; border-radius: 20px;
  background: var(--surface); border: 1px solid var(--line);
  display: grid; gap: 16px;
  animation: rise .25s ease-out;
}
@keyframes rise { from { transform: translateY(14px); opacity: 0; } }
.result h2 { font-size: 28px; font-size: clamp(26px, 6vw, 36px); }
.result .amber { color: var(--amber); }
.result-sub { color: var(--ink-2); }
.result-rows { display: grid; gap: 8px; }
.result-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.result-row.win { outline: 2px solid var(--amber); }
.result-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-score { font-weight: 700; text-align: right; }
.result-tiles { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 3px; min-height: 18px; font-size: 14px; color: var(--ink-2); }
.result-tiles .mini { width: 16px; }
.result-tiles .pips-left { margin-left: 8px; }
.result-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.result-actions .btn { flex: 1 1 auto; }

.banner, .toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 40;
  width: max-content; max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 12px;
  font-weight: 600; font-size: 15px; text-align: center;
}
.banner { top: 8px; background: var(--danger); color: #2b0b03; }
.toast { bottom: 24px; background: var(--ink); color: var(--pip); box-shadow: 0 8px 24px rgba(0, 0, 0, .5); }

/* HP sempit: kartu lawan dipadatkan */
@media (max-width: 560px) {
  .screen { padding: 20px 16px 40px; }
  .lobby-grid, .entry-grid { grid-template-columns: minmax(0, 1fr); }
  .seat { flex-direction: column; gap: 4px; padding: 6px 4px; text-align: center; }
  .seat-info { justify-items: center; width: 100%; }
  .seat-name { max-width: 100%; }
  .avatar { width: 32px; height: 32px; font-size: 15px; }
  .backs i { width: 5px; }
  .seat-sub { font-size: 12px; }
  .btn-small { padding: 0 10px; font-size: 13px; }
  .round { font-size: 13px; }
  /* Header meja: tombol jadi ikon saja supaya muat satu baris. */
  .topbar-right { gap: 4px; }
  .topbar-right .btn-small { min-width: 40px; padding: 0 8px; }
  .topbar .lbl { display: none; }
  .topbar .ic { font-size: 17px; }
  .toggle[aria-pressed='false'] { text-decoration: none; opacity: .5; }
}



/* ---------- Suasana meja ---------- */
/* Meja kayu gelap di bawah satu lampu gantung. */
body {
  background-color: #1a120c;
  background-image:
    radial-gradient(ellipse 70% 55% at 50% -8%, rgba(242, 169, 59, .24), transparent 70%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .022) 0 2px, transparent 2px 150px),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, .18) 0 1px, transparent 1px 37px),
    linear-gradient(180deg, #2a1c12, #130c07);
  background-attachment: fixed;
}
/* Kain hijau bertekstur dengan bingkai kayu (Gaple, Cangkulan). */
.table .felt {
  border: 7px solid transparent;
  border-radius: 24px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E") padding-box,
    radial-gradient(80% 75% at 50% 42%, #1c6e55, #0f4233 70%, #0a2f25) padding-box,
    linear-gradient(135deg, #7a4e2a, #3d2412 35%, #82552e 60%, #3a2211) border-box;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .55), inset 0 0 50px rgba(0, 0, 0, .45), inset 0 0 0 1px rgba(255, 255, 255, .06);
}
/* Meja game kartu dan domino: kain sesuai jenis game, cahaya lampu lembut di tengah,
   bingkai kayu lebih tebal, dan satu jahitan emas tipis. Sengaja tanpa hiasan lain. */
html[data-game="gaple"], html[data-game="draw"], html[data-game="muggins"], html[data-game="poker"] { --felt-a: #1f7a5e; --felt-b: #08302a; }
html[data-game="cangkul"], html[data-game="remi41"], html[data-game="capsa"] { --felt-a: #8e2c3a; --felt-b: #330c15; }
html[data-game="samber"] { --felt-a: #4e2f80; --felt-b: #170c30; }
html[data-game="gaple"] .table .felt, html[data-game="draw"] .table .felt, html[data-game="muggins"] .table .felt,
html[data-game="poker"] .table .felt, html[data-game="cangkul"] .table .felt, html[data-game="remi41"] .table .felt,
html[data-game="capsa"] .table .felt, html[data-game="samber"] .table .felt {
  border-width: 9px;
  background:
    radial-gradient(55% 45% at 50% 38%, rgba(255, 226, 160, .14), transparent 72%) padding-box,
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .08 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E") padding-box,
    radial-gradient(85% 80% at 50% 45%, var(--felt-a), var(--felt-b) 78%) padding-box,
    linear-gradient(150deg, #9a6638, #4a2c15 30%, #a8743f 55%, #3d2412 80%, #6b4422) border-box;
  outline: 1px dashed rgba(255, 224, 160, .22);
  outline-offset: -12px;
  box-shadow: 0 26px 50px rgba(0, 0, 0, .6), inset 0 0 70px rgba(0, 0, 0, .5), inset 0 0 0 1px rgba(242, 169, 59, .28);
}
@media (min-width: 900px) {
  .is-dealer .felt { border-width: 12px; border-radius: 30px; }
  .is-dealer .board-wrap > svg { filter: drop-shadow(0 18px 26px rgba(0, 0, 0, .6)); }
}

/* ---------- Mbak Sari, bandar ---------- */
.host { display: none; }
@media (min-width: 900px) {
  .host.on {
    position: fixed; left: 18px; bottom: 14px; z-index: 6;
    display: flex; align-items: flex-end; gap: 4px;
    width: 380px; pointer-events: none;
  }
  #lobby .host.on { left: auto; right: 24px; bottom: 18px; }
}
.host-figure { position: relative; flex: none; width: 150px; animation: host-bob 3.4s ease-in-out infinite; }
.host-figure svg { display: block; width: 100%; height: auto; filter: drop-shadow(0 10px 14px rgba(0, 0, 0, .5)); }
.host-name {
  position: absolute; left: 50%; bottom: 6px; transform: translateX(-50%); white-space: nowrap;
  padding: 2px 10px; border-radius: 999px; background: rgba(20, 14, 9, .85); color: var(--amber);
  font-size: 12px; font-weight: 700;
}
.host-eyes { transform-box: fill-box; transform-origin: center; animation: host-blink 4.6s infinite; }
.host-mouth-open { opacity: 0; }
.host.talking .host-mouth-open { animation: host-talk .28s steps(1) infinite; }
.host-bubble {
  position: relative; align-self: center; margin-bottom: 70px;
  max-width: 230px; padding: 12px 16px; border-radius: 18px 18px 18px 4px;
  background: var(--ivory); color: var(--pip);
  font-size: 16px; font-weight: 700; line-height: 1.3;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .45);
}
.host-bubble:empty { display: none; }
.host-bubble::before {
  content: ''; position: absolute; left: -9px; bottom: 10px;
  border: 9px solid transparent; border-right-color: var(--ivory); border-left: 0;
}
.host-bubble.pop { animation: host-pop .28s ease-out; }
@keyframes host-bob { 50% { transform: translateY(-4px); } }
@keyframes host-blink { 0%, 93%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
@keyframes host-talk { 0% { opacity: 1; } 50% { opacity: 0; } }
@keyframes host-pop { from { transform: scale(.85); opacity: 0; } }

/* Avatar picker */
.avatar-picker { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.av-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--line);
  background: var(--surface-2); font-size: 22px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform .15s ease, border-color .15s ease;
}
.av-btn:hover { transform: scale(1.1); }
.av-btn.selected { border-color: var(--amber); background: rgba(255, 179, 71, .2); transform: scale(1.12); }

/* Bot controls di lobi */
.bot-controls { display: flex; gap: 8px; margin: 4px 0 8px; }
.bot-controls .btn { flex: 1; font-size: 13px; padding: 6px 10px; }
.tag-bot { background: rgba(52, 152, 219, .2); color: #3498db; border: 1px solid rgba(52, 152, 219, .4); font-weight: 700; }

/* Reaksi Emoji & Chat Bar (Draggable & Collapsible) */
.reaction-bar {
  position: fixed; top: 56px; right: 16px; z-index: 35;
  display: flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px;
  background: rgba(18, 14, 10, .94); border: 1px solid rgba(255, 255, 255, .18);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .55);
  touch-action: none; user-select: none; -webkit-user-select: none;
  cursor: grab;
}
.reaction-bar:active { cursor: grabbing; }
.rx-drag-handle {
  color: var(--ink-3); font-size: 13px; padding: 0 4px; cursor: grab;
  line-height: 1; user-select: none; -webkit-user-select: none;
}
.rx-items { display: flex; align-items: center; gap: 4px; }
.reaction-bar.collapsed .rx-items { display: none; }
.rx-toggle-btn {
  background: none; border: none; font-size: 14px; cursor: pointer; padding: 4px;
  color: var(--ink-2); display: flex; align-items: center; justify-content: center;
  border-radius: 50%; min-width: 24px; min-height: 24px;
}
.rx-toggle-btn:hover { color: var(--ink); background: rgba(255, 255, 255, .1); }
.reaction-bar::-webkit-scrollbar { display: none; }
.rx-btn {
  background: none; border: none; font-size: 20px; cursor: pointer; padding: 2px 4px;
  transition: transform .15s ease;
}
.rx-btn:hover { transform: scale(1.3); }
.rx-btn:active { transform: scale(0.9); }
/* HP sempit: di ujung kanan baris ikon (di bawah tombol Keluar). Bagian itu kosong di semua game,
   jadi tidak menutupi papan, tumpukan kartu, maupun kursi lawan. */
@media (max-width: 560px) {
  .reaction-bar { top: 56px; right: 8px; padding: 4px 6px; }
  .reaction-bar:not(.collapsed) { max-width: calc(100vw - 12px); }
  .rx-items { flex-wrap: wrap; justify-content: center; }
}

.reaction-bubble-area {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 50; overflow: hidden;
}
.reaction-bubble {
  position: absolute; display: flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 999px;
  background: rgba(25, 20, 15, .94); border: 1px solid var(--amber);
  color: #fff; font-size: 14px; font-weight: 700;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .6);
  animation: float-up 2.2s forwards ease-out;
}
.reaction-bubble .rx-emoji { font-size: 24px; line-height: 0; }
@keyframes float-up {
  0% { transform: translateY(0) scale(0.6); opacity: 0; }
  15% { transform: translateY(-20px) scale(1.1); opacity: 1; }
  75% { transform: translateY(-70px) scale(1); opacity: 1; }
  100% { transform: translateY(-110px) scale(0.9); opacity: 0; }
}

/* Mode Main di PC & Dealer Buttons */
.dealer-buttons { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.dealer-buttons .btn { width: 100%; font-size: 14px; }
.host-seat-toggle-wrap { margin-top: 8px; }
.host-seat-toggle-wrap .btn { width: 100%; font-size: 13px; }
.lobby-action-row { display: flex; gap: 8px; margin-top: 10px; }
.lobby-action-row .btn { flex: 1; font-size: 13px; padding: 6px 10px; }

/* Modal Backdrop & Cards (Turnamen & Ganti Game) */
.modal-backdrop {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0;
  background: rgba(10, 8, 6, .85); z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.modal-backdrop[hidden] { display: none !important; }
.modal-card {
  width: 100%; max-width: 480px; max-height: 85vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 20px; padding: 24px; box-shadow: 0 16px 36px rgba(0, 0, 0, .6);
  display: flex; flex-direction: column; gap: 14px;
}
.modal-wide { max-width: 620px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal-head h2 { font-size: 22px; font-family: var(--display); color: var(--ink); }
.modal-close-btn {
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--ink-2); width: 32px; height: 32px; border-radius: 50%;
  font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.modal-close-btn:hover { color: var(--ink); border-color: var(--amber); }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }

/* Leaderboard List */
.standings-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.standing-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--line);
}
.standing-item.first-place {
  border-color: rgba(242, 169, 59, .6); background: rgba(242, 169, 59, .1);
}
.rank-badge { font-size: 18px; font-weight: 800; min-width: 28px; text-align: center; }
.standing-av { font-size: 22px; }
.standing-name { font-weight: 700; flex: 1; font-size: 15px; }
.standing-wins { font-weight: 700; color: var(--amber); font-size: 14px; }

/* Switch Game Grid */
.switch-game-list {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px;
}
@media (max-width: 600px) {
  .switch-game-list { grid-template-columns: 1fr; }
}
.switch-game-btn {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line);
  color: var(--ink); text-align: left; cursor: pointer;
  transition: transform .12s ease, border-color .12s ease;
}
.switch-game-btn:hover {
  transform: translateY(-2px); border-color: var(--amber);
}
.switch-game-btn.current {
  border-color: var(--amber); background: rgba(242, 169, 59, .15);
}
.switch-game-icon { font-size: 24px; flex-shrink: 0; }
.switch-game-title { font-weight: 700; font-size: 15px; display: block; }
.switch-game-meta { font-size: 12px; color: var(--ink-2); display: block; }

/* HP sempit: teks status di meja boleh dua baris, jangan terpotong "…". */
@media (max-width: 560px) {
  body .table .status {
    white-space: normal; text-overflow: clip; line-height: 1.3;
    border-radius: 14px; max-width: calc(100% - 16px); width: max-content;
  }
}

/* ---------- Dadu dilempar (kubus 3D, dipakai Ludo, Ular Tangga, Juragan) ---------- */
.die-throw {
  position: fixed; left: 0; top: 0; width: 0; height: 0; z-index: 30;
  pointer-events: none; transition: opacity .35s ease;
}
.die-throw.out { opacity: 0; }
.d3, .d3-shadow { position: absolute; left: 0; top: 0; will-change: transform; }
.d3 { -webkit-perspective: 520px; perspective: 520px; }
.d3-cube {
  position: relative; width: 100%; height: 100%;
  -webkit-transform-style: preserve-3d; transform-style: preserve-3d;
}
.d3-face {
  position: absolute; left: 0; top: 0; width: 100%; height: 100%;
  border-radius: 18%; background: var(--ivory);
  box-shadow: inset 0 0 0 2px #e2d4b6, inset 0 -5px 10px rgba(120, 90, 40, .22);
  -webkit-backface-visibility: hidden; backface-visibility: hidden;
}
.d3-face svg { display: block; width: 100%; height: 100%; }
.d3-shadow {
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, .55), rgba(0, 0, 0, 0) 70%);
}
.die-throw.lucky .d3-face {
  box-shadow: inset 0 0 0 2px #f2a93b, 0 0 18px rgba(242, 169, 59, .9);
  -webkit-animation: d3-lucky .7s ease-out; animation: d3-lucky .7s ease-out;
}
@-webkit-keyframes d3-lucky { from { background: #fff4d6; } }
@keyframes d3-lucky { from { background: #fff4d6; } }

/* Main otomatis */
.auto-toggle[aria-pressed='true'] { background: #2f6fc6; border-color: #2f6fc6; color: #fff; text-decoration: none; }
.auto-toggle[aria-pressed='false'] { text-decoration: none; color: var(--ink-2); }
.auto-badge { font-size: .9em; }

/* Layar masuk: satu kolom, satu alur */
#entry .entry-grid { grid-template-columns: minmax(0, 1fr); max-width: 520px; margin-top: 16px; gap: 14px; }
#entry .panel { padding: 20px; gap: 14px; }
#entry .entry-acc { justify-content: flex-start; margin-top: 14px; }
#entry .lede { font-size: 17px; }
#identityBlock { grid-template-columns: minmax(0, 1fr); }
#identityBlock .field { display: grid; gap: 6px; }
#identityBlock .avatar-picker { margin: 0; gap: 6px; display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); justify-items: center; }
#identityBlock .av-btn { width: 40px; height: 40px; font-size: 22px; flex: 0 0 auto; }
.solo-panel { background: linear-gradient(160deg, rgba(242, 169, 59, .14), var(--surface) 70%); }
.solo-bots { display: flex; align-items: center; gap: 12px; color: var(--ink-2); font-weight: 600; }
.seg { display: inline-flex; padding: 4px; gap: 4px; border-radius: 12px; background: var(--night); border: 1px solid var(--line); }
.seg button { min-width: 48px; min-height: 40px; border: 0; border-radius: 9px; background: transparent; color: var(--ink-2); font: 700 16px var(--body); cursor: pointer; }
.seg button.on { background: var(--amber); color: var(--amber-ink); }
.btn.big { min-height: 56px; font-size: 18px; }
#soloBtn, #roomBtn, #joinBtn, #createAndPlayBtn { width: 100%; }
#entryForm { grid-template-columns: minmax(0, 1fr); }
#entryForm h2 { font-size: 18px; color: var(--ink-2); font-family: var(--body); font-weight: 700; }
#entryForm .code-input { text-align: center; font-size: 22px; }
.pc-mode { padding: 0; }
.pc-mode > summary { list-style: none; cursor: pointer; padding: 16px 20px; font-weight: 700; color: var(--ink-2); }
.pc-mode > summary::-webkit-details-marker { display: none; }
.pc-mode[open] > summary { color: var(--ink); }
.pc-mode > p, .pc-mode > .dealer-buttons { margin: 0 20px 14px; }
.pc-mode > .dealer-buttons { margin-bottom: 20px; }
#entry.screen { max-width: 584px; }
#entry .entry-grid { max-width: none; }
.pc-mode { display: block; }
#identityBlock .av-btn { width: 38px; height: 38px; font-size: 20px; }
#identityBlock .avatar-picker { gap: 6px 4px; }
#entry .pc-mode { padding: 0; }
.mini-btn { margin-left: auto; min-height: 32px; padding: 4px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font: 600 13px var(--body); cursor: pointer; }
.mini-btn.danger { color: var(--danger); border-color: rgba(255, 138, 112, .45); }
.players .tag + .mini-btn { margin-left: 8px; }
.kick-title { margin: 14px 0 6px; font-size: 15px; color: var(--ink-2); }
.mini-btn { white-space: nowrap; flex: 0 0 auto; }
@media (max-width: 599px) { #voiceBtn { display: none; } }

/* Obrolan meja */
.chat-panel { position: fixed; right: 12px; bottom: 12px; z-index: 90; width: min(380px, calc(100vw - 24px)); max-height: min(70vh, 520px); display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 18px 50px rgba(0, 0, 0, .55); }
.chat-panel[hidden] { display: none; }
.chat-head { display: flex; align-items: center; justify-content: space-between; }
.chat-list { list-style: none; margin: 0; padding: 4px 2px; display: grid; gap: 8px; align-content: start; overflow-y: auto; min-height: 120px; flex: 1; -webkit-overflow-scrolling: touch; }
.chat-msg { display: flex; gap: 8px; align-items: flex-start; }
.chat-av { flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-size: 18px; }
.chat-meta { font-size: 12px; color: var(--ink-3); }
.chat-meta b { color: var(--ink-2); }
.chat-text { margin-top: 2px; padding: 8px 12px; border-radius: 4px 14px 14px 14px; background: var(--surface-2); color: var(--ink); font-size: 15px; line-height: 1.35; overflow-wrap: anywhere; }
.chat-msg.mine .chat-text { background: rgba(242, 169, 59, .22); }
.chat-empty { color: var(--ink-3); text-align: center; padding: 24px 8px; font-size: 14px; }
.chat-quick { display: flex; gap: 6px; flex-wrap: wrap; }
.chat-quick button { min-height: 34px; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2); font: 600 13px var(--body); cursor: pointer; }
.chat-form { display: flex; gap: 8px; }
.chat-form .input { flex: 1; min-width: 0; font-size: 16px; }
.chat-dot { display: inline-block; min-width: 18px; height: 18px; margin-left: 6px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #1c0d08; font: 800 11px/18px var(--body); text-align: center; }
.chat-dot[hidden] { display: none; }

.name-link { background: none; border: 0; padding: 4px 0; color: inherit; font: inherit; text-align: left; cursor: pointer; text-decoration: underline dotted rgba(255, 255, 255, .3); text-underline-offset: 3px; }

.quick-info { color: var(--amber); font-weight: 700; }
.quick-info[hidden] { display: none; }

/* ================= Tampilan PC ================= */
/* Layar masuk: dua kolom (judul dan aturan di kiri, tombol di kanan) */
@media (min-width: 1000px) {
  #entry.screen { max-width: 1080px; display: grid; grid-template-columns: minmax(0, 1fr) 500px; column-gap: 56px; align-content: start; padding-top: 56px; }
  #entry > .back, #entry > h1, #entry > .lede, #entry > .entry-acc, #entry > .rules { grid-column: 1; }
  #entry > .entry-grid { grid-column: 2; grid-row: 1 / span 6; margin-top: 0; }
  #entry > h1 { font-size: 88px; line-height: 1; }
  #entry > .lede { font-size: 19px; max-width: 26em; }
  #entry > .rules { margin-top: 24px; font-size: 16px; }
  #entry > .rules ul { gap: 10px; }
}

/* Main bareng di 1 HP: jendela isian pemain dan layar "berikan HP" */
.local-card { display: grid; gap: 14px; }
.local-count { display: flex; align-items: center; gap: 12px; color: var(--ink-2); font-weight: 600; }
.local-rows { display: grid; gap: 8px; }
.local-row { display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.local-row .input { min-height: 44px; }
.local-av { width: 46px; height: 46px; padding: 3px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface-2); cursor: pointer; }
.local-av:hover { border-color: var(--amber); }
.local-tag { font-size: 12px; font-weight: 700; color: var(--amber); white-space: nowrap; padding: 0 6px; }
.local-bot { margin-left: 0; white-space: nowrap; }
.local-bot.on { border-color: var(--amber); color: var(--amber); }
.local-handoff { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); }
.handoff:not([hidden]) { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 90; display: grid; place-items: center; padding: 20px; background: rgba(8, 10, 18, .82); }
.handoff-card { width: min(360px, 100%); display: grid; justify-items: center; gap: 6px; padding: 28px 24px 24px; border-radius: 24px; background: var(--surface); border: 2px solid var(--amber); box-shadow: 0 24px 60px rgba(0, 0, 0, .6); text-align: center; animation: handoffIn .35s cubic-bezier(.2, .9, .3, 1.2); }
.handoff-av { width: 110px; height: 110px; }
.handoff-lbl { font-size: 13px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--amber); }
.handoff-card b { font: 800 34px var(--display); line-height: 1.1; }
.handoff-hint { color: var(--ink-2); margin-bottom: 10px; }
.handoff-card .btn { width: 100%; }
@keyframes handoffIn { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }

/* Meja dan lobi: panel samping berisi pemain, obrolan, dan reaksi */
.desk-side, .desk-show { display: none; }
@media (min-width: 1180px) and (hover: hover) and (pointer: fine) {
  .desk-side:not([hidden]) {
    position: fixed; top: 0; right: 0; bottom: 0; z-index: 40; width: 340px;
    display: flex; flex-direction: column; gap: 12px; padding: 14px 14px 14px 12px;
    background: rgba(21, 18, 14, .92); border-left: 1px solid var(--line);
  }
  .desk-on #table { padding-right: 340px; }
  .desk-on #lobby.screen { padding-right: 24px; max-width: 928px; margin-left: max(0px, calc((100vw - 340px - 928px) / 2)); margin-right: 0; }
  .desk-on #reactionBar, .desk-on #chatBtn, .desk-on #lobbyChatBtn { display: none !important; }
  .ds-block h3 { margin: 0 0 8px; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); display: flex; align-items: center; gap: 8px; }
  .ds-hide { margin-left: auto; min-height: 28px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2); font: 600 12px var(--body); letter-spacing: 0; text-transform: none; cursor: pointer; }
  .ds-hide:hover { color: var(--ink); border-color: var(--amber); }
  .desk-show:not([hidden]) { display: block; position: fixed; top: 50%; right: 0; z-index: 41; transform: translateY(-50%); padding: 14px 10px; border-radius: 12px 0 0 12px; border: 1px solid var(--line); border-right: 0; background: rgba(21, 18, 14, .92); color: var(--ink-2); font: 700 13px var(--body); cursor: pointer; writing-mode: vertical-rl; }
  .desk-show:hover { color: var(--ink); border-color: var(--amber); }
  .ds-players { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 32vh; overflow-y: auto; }
  .ds-players li { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 12px; background: var(--surface-2); border: 1px solid transparent; }
  .ds-players li.turn { border-color: var(--amber); background: rgba(242, 169, 59, .14); }
  .ds-players li.off { opacity: .55; }
  .ds-av { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); font-size: 17px; }
  .ds-players .name-link { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ds-tag { font-size: 12px; color: var(--ink-3); }
  .ds-score { min-width: 28px; text-align: right; font-weight: 800; color: var(--amber); }
  .ds-chat { flex: 1; min-height: 0; display: flex; }
  .chat-panel.docked { position: static; width: 100%; max-height: none; flex: 1; box-shadow: none; background: transparent; border: 0; padding: 0; z-index: auto; }
  .chat-panel.docked .chat-head { display: none; }
  .chat-panel.docked .chat-list { background: rgba(0, 0, 0, .18); border-radius: 12px; padding: 8px; }
  .ds-react { display: flex; flex-wrap: wrap; gap: 6px; justify-content: space-between; }
  .ds-react .rx-btn { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface-2); font-size: 18px; cursor: pointer; transition: transform .12s ease; }
  .ds-react .rx-btn:hover { transform: scale(1.15); }
  /* bilah atas: tombol hanya ikon + label pendek supaya muat di sisi kiri panel */
  .desk-on .topbar-right .btn-small { padding-left: 10px; padding-right: 10px; }
}

@media (max-width: 430px) {
  .topbar-right { flex: 0 1 auto; min-width: 0; gap: 3px; }
  .topbar-right .btn-small { min-width: 34px; padding: 0 5px; }
  .topbar > .btn { padding: 0 10px; }
}

.topbar-right { flex-wrap: wrap; justify-content: flex-end; }
.topbar { flex-wrap: wrap; row-gap: 6px; }
.topbar-right { flex: 0 1 auto; min-width: 0; }

/* Suara, musik, suara bandar, dan 3D sekarang diatur lewat tombol Pengaturan */
#soundBtn, #musicBtn, #voiceBtn, #view3dBtn { display: none !important; }

/* Aplikasi Android: alamat situs tidak terlihat. Kolom link tetap ada (untuk disalin) tapi tak tampak. */
.app-mode #inviteLink { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.app-mode .link-row { justify-content: center; }
.offline-mode #invitePanel { display: none; }

/* ---- Cari Lawan Online: radar pencarian + layar VS ---- */
#lobby.quick-mode .host, #lobby.quick-mode #lobbyLeave { display: none; }
.quick-panel { max-width: 440px; margin: 24px auto 0; padding: 28px 24px 20px; border-radius: 24px; background: var(--surface); border: 1px solid var(--line); display: grid; gap: 12px; justify-items: center; text-align: center; }
.qp-radar { position: relative; width: 132px; height: 132px; display: grid; place-items: center; margin-bottom: 4px; }
.qp-wave { position: absolute; top: 0; right: 0; bottom: 0; left: 0; border-radius: 50%; border: 2px solid rgba(242, 169, 59, .55); animation: qpWave 2.4s ease-out infinite; }
.qp-wave.d2 { animation-delay: 1.2s; }
@keyframes qpWave { from { transform: scale(.55); opacity: 1; } to { transform: scale(1.15); opacity: 0; } }
.qp-me { position: relative; width: 76px; height: 76px; border-radius: 50%; background: var(--surface-2); border: 2px solid var(--amber); display: grid; place-items: center; font-size: 34px; overflow: hidden; }
.qp-me > *, .qp-av > *, .vs-av > * { max-width: 100%; max-height: 100%; }
.qp-title { margin: 0; font-size: 24px; }
.qp-online { margin: 0; color: #7fd6a4; font-weight: 600; font-size: 14px; min-height: 1.2em; }
.qp-count { margin: 0; color: var(--ink-2); font-size: 14px; }
.qp-card { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: var(--night); border: 1px solid var(--line); text-align: left; }
.qp-av { width: 44px; height: 44px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-size: 22px; flex: none; overflow: hidden; }
.qp-who { flex: 1; min-width: 0; }
.qp-who b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qp-who small { color: var(--ink-3); font-size: 12px; }
.qp-tag { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.qp-tag.guest { background: rgba(167, 154, 131, .2); color: var(--ink-2); }
.qp-tag.acc { background: rgba(93, 173, 226, .18); color: #8cc4f0; }
.qp-stats { width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.qp-stats span { padding: 8px 4px; border-radius: 12px; background: var(--night); border: 1px solid var(--line); font-size: 12px; color: var(--ink-3); }
.qp-stats b { display: block; font-size: 18px; color: var(--ink); }
.qp-note { width: 100%; padding: 10px 12px; border-radius: 12px; font-size: 13px; text-align: left; background: rgba(93, 173, 226, .12); border: 1px solid rgba(93, 173, 226, .3); color: #b9dcf7; }
.qp-note:empty { display: none; }
.qp-note.ok { background: rgba(127, 214, 164, .12); border-color: rgba(127, 214, 164, .35); color: #a9e6c3; }
.qp-actions { width: 100%; display: grid; grid-template-columns: 1fr 1.6fr; gap: 10px; margin-top: 4px; }
.qp-invite { margin: 2px 0 0; font-size: 13px; color: var(--ink-3); }
.qp-link { background: none; border: 0; padding: 0; color: var(--amber); font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; }
.vs-screen { max-width: 640px; margin: 40px auto 0; padding: 28px 20px; border-radius: 24px; background: var(--surface); border: 1px solid var(--line); text-align: center; animation: vsIn .35s ease-out; }
@keyframes vsIn { from { transform: scale(.94); opacity: 0; } to { transform: none; opacity: 1; } }
.vs-head { margin: 0 0 18px; font: 800 24px var(--display); color: var(--amber); }
.vs-row { display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; }
.vs-p { display: grid; justify-items: center; gap: 6px; min-width: 110px; }
.vs-p b { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vs-av { width: 84px; height: 84px; border-radius: 50%; background: var(--surface-2); border: 2px solid var(--line); display: grid; place-items: center; font-size: 38px; overflow: hidden; }
.vs-p.me .vs-av { border-color: var(--amber); }
.vs-x { font: 800 28px var(--display); color: var(--ink-3); }
.vs-foot { margin: 18px 0 0; color: var(--ink-2); font-weight: 600; }
@media (prefers-reduced-motion: reduce) { .qp-wave, .vs-screen { animation: none; } }
@media (max-width: 480px) { .quick-panel { margin-top: 12px; padding: 22px 16px 16px; } .vs-av { width: 64px; height: 64px; font-size: 30px; } }

/* ================= Layar masuk game (desain baru) ================= */
.entry-on .ronda-moon.moon-l, .entry-on .ronda-ground, .entry-on .ronda-flies { display: none; }
.entry-on .ronda-moon.moon-r { display: inline; transform-box: fill-box; transform-origin: center; transform: scale(.55); opacity: .7; }
#entry.screen { max-width: 1120px; padding-top: 0; }
.entry-top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px; padding: 12px 24px; margin: 0 -24px 8px; background: rgba(21, 18, 14, .82); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid rgba(67, 56, 42, .6); }
.entry-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font: 800 19px var(--display); white-space: nowrap; }
.entry-brand i { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: linear-gradient(135deg, #ffbb55, #e8891b); font-style: normal; font-size: 17px; box-shadow: 0 4px 14px rgba(242, 169, 59, .35); }
.entry-crumb { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 14px; color: var(--ink-3); }
.entry-crumb a { color: var(--ink-2); text-decoration: none; white-space: nowrap; }
.entry-crumb a:hover { color: var(--ink); }
.entry-crumb b { color: var(--ink); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#entry .entry-acc { margin: 0 0 0 auto; display: flex; gap: 8px; flex-wrap: nowrap; justify-content: flex-end; }
#entry .entry-acc .acc-chip { white-space: nowrap; }
.entry-hero h1 { margin: 0; font: 800 clamp(40px, 7vw, 68px)/1.02 var(--display); letter-spacing: -.02em; background: linear-gradient(180deg, #fff6e0 10%, #f2a93b 130%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.entry-hero .lede { margin-top: 10px; font-size: 17px; max-width: 30em; }
.entry-pills { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.entry-pills span { padding: 5px 12px; border-radius: 999px; background: rgba(34, 28, 21, .72); border: 1px solid var(--line); font-size: 13px; color: var(--ink-2); white-space: nowrap; }
#entry .entry-grid { margin-top: 18px; gap: 12px; }
#entry .panel { padding: 18px 20px; gap: 12px; border-radius: 18px; }
#entry .panel h2 { font-size: 20px; }
#identityBlock .field label { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.solo-bots { display: grid; grid-template-columns: 92px minmax(0, 1fr); align-items: center; gap: 12px; font-size: 14px; }
.solo-bots .seg { justify-self: start; }
#entry .seg button { min-width: 0; min-height: 36px; padding: 0 14px; font-size: 14px; }
#soloBtn.big { min-height: 52px; font-size: 17px; }
.mode-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.mode-row .btn { width: 100%; min-height: 48px; font-size: 14px; padding: 0 10px; white-space: normal; line-height: 1.2; }
#localBtn.big { min-height: 48px; font-size: 15px; }
#entryForm h2 { font-size: 15px; }
.join-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: stretch; }
.join-row .field { margin: 0; }
.join-row .code-input { min-height: 48px; font-size: 20px; }
.join-row #joinBtn { width: auto; min-height: 48px; padding: 0 18px; white-space: nowrap; }
#entry .rules { margin-top: 18px; padding: 18px 20px; border-radius: 18px; background: rgba(34, 28, 21, .72); border: 1px solid var(--line); color: var(--ink-2); }
#entry .rules h2 { margin: 0 0 10px; font: 700 16px var(--body); color: var(--ink); }
#entry .rules ol { margin: 0; padding: 0; list-style: none; counter-reset: step; display: grid; gap: 10px; font-size: 14.5px; line-height: 1.5; }
#entry .rules li { counter-increment: step; display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 10px; }
#entry .rules li::before { content: counter(step); width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: rgba(242, 169, 59, .16); color: var(--amber); font-weight: 800; font-size: 13px; }
@media (min-width: 1000px) {
  #entry.screen { max-width: 1120px; display: grid; grid-template-columns: minmax(0, 1fr) 480px; column-gap: 48px; align-content: start; padding-top: 0; }
  #entry > .entry-top { grid-column: 1 / -1; grid-row: 1; margin-bottom: 28px; }
  #entry > .entry-hero { grid-column: 1; grid-row: 2; }
  #entry > .rules { grid-column: 1; grid-row: 3; align-self: start; margin-top: 24px; }
  #entry > .entry-grid { grid-column: 2; grid-row: 2 / span 3; margin-top: 0; }
  #entry > .entry-hero h1 { font-size: 72px; }
}
@media (max-width: 760px) {
  .entry-top { padding: 10px 16px; margin: 0 -16px 6px; gap: 10px; }
  .entry-brand span, .entry-crumb a, .entry-crumb span { display: none; }
  .entry-crumb b { font-size: 15px; }
  #entry .entry-acc .hide-sm { display: none; }
  #entry .entry-acc .acc-chip { min-height: 38px; padding: 6px 10px; }
  .entry-hero { margin-top: 10px; }
  .entry-pills span:nth-child(n+3) { display: none; }
}
@media (max-width: 420px) {
  .mode-row { grid-template-columns: minmax(0, 1fr); }
  .solo-bots { grid-template-columns: 78px minmax(0, 1fr); }
  #entry .seg button { padding: 0 10px; }
}

#identityBlock[hidden] { display: none; }

/* ===== HP miring (layar pendek): meja tidak boleh terhimpit ===== */
@media (orientation: landscape) and (max-height: 520px) {
  /* Bilah atas satu baris: tombol cukup ikon, seperti di HP tegak. */
  .topbar .lbl { display: none; }
  .topbar-right { gap: 4px; }
  .topbar .btn-small { min-height: 34px; }
  .topbar-right .btn-small { min-width: 38px; padding: 0 8px; }
  .topbar .ic { font-size: 16px; }
  .round { font-size: 13px; }
  /* Kursi lawan lebih pendek. */
  .seat { padding: 4px 8px; gap: 6px; }
  .avatar { width: 28px; height: 28px; font-size: 14px; }
  .seat-sub { font-size: 12px; }
  /* Bilah reaksi tepat di bawah bilah atas, di sisi kanan (ruang kosong kartu lawan). */
  .reaction-bar { top: 52px; right: 12px; padding: 3px 8px; }
}

/* Game kartu & domino saat HP miring: dua kolom. Meja di kiri setinggi layar,
   kursi lawan + kartu di tangan di kanan. Selektor html[data-game] main.table
   sengaja lebih kuat daripada aturan grid milik tiap game. */
@media (orientation: landscape) and (max-height: 520px) {
  html[data-game="gaple"] main.table, html[data-game="draw"] main.table, html[data-game="muggins"] main.table,
  html[data-game="cangkul"] main.table, html[data-game="capsa"] main.table, html[data-game="remi41"] main.table,
  html[data-game="samber"] main.table, html[data-game="poker"] main.table {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    grid-template-rows: auto auto minmax(0, 1fr);
    column-gap: 10px; row-gap: 6px;
  }
  html[data-game="gaple"] main.table > .topbar, html[data-game="draw"] main.table > .topbar, html[data-game="muggins"] main.table > .topbar, html[data-game="cangkul"] main.table > .topbar, html[data-game="capsa"] main.table > .topbar, html[data-game="remi41"] main.table > .topbar, html[data-game="samber"] main.table > .topbar, html[data-game="poker"] main.table > .topbar { grid-column: 1 / -1; grid-row: 1; }
  html[data-game="gaple"] main.table > .felt, html[data-game="draw"] main.table > .felt, html[data-game="muggins"] main.table > .felt,
  html[data-game="cangkul"] main.table > .felt, html[data-game="capsa"] main.table > .felt, html[data-game="remi41"] main.table > .felt,
  html[data-game="samber"] main.table > .felt, html[data-game="poker"] main.table > .felt {
    grid-column: 1; grid-row: 2 / 4; min-height: 0;
  }
  html[data-game="gaple"] main.table > .me, html[data-game="draw"] main.table > .me, html[data-game="muggins"] main.table > .me,
  html[data-game="cangkul"] main.table > .me, html[data-game="capsa"] main.table > .me, html[data-game="remi41"] main.table > .me,
  html[data-game="samber"] main.table > .me, html[data-game="poker"] main.table > .me {
    grid-column: 2; grid-row: 3; min-height: 0; overflow-y: auto; align-self: end;
  }
  html[data-game="gaple"] main.table > :not(.topbar):not(.felt):not(.me), html[data-game="draw"] main.table > :not(.topbar):not(.felt):not(.me),
  html[data-game="muggins"] main.table > :not(.topbar):not(.felt):not(.me), html[data-game="cangkul"] main.table > :not(.topbar):not(.felt):not(.me),
  html[data-game="capsa"] main.table > :not(.topbar):not(.felt):not(.me), html[data-game="remi41"] main.table > :not(.topbar):not(.felt):not(.me),
  html[data-game="samber"] main.table > :not(.topbar):not(.felt):not(.me), html[data-game="poker"] main.table > :not(.topbar):not(.felt):not(.me) {
    grid-column: 2; grid-row: 2;
  }
}
/* Tangan berisi 9+ kartu saat HP miring (Capsa, Cangkulan, Samber): kartu bertumpuk seperti dipegang,
   angka di pojok kiri atas tetap terlihat, dan semuanya muat tanpa digeser. */
@media (orientation: landscape) and (max-height: 520px) {
  html[data-game] main.table .hand > :first-child:nth-last-child(n+9) ~ * { margin-left: -20px; }
  html[data-game] main.table .hand > :first-child:nth-last-child(n+12) ~ * { margin-left: -24px; }
  html[data-game] main.table .hand > * { position: relative; }
  html[data-game] main.table .hand > *:hover, html[data-game] main.table .hand > *:focus-visible { z-index: 2; }
}
@media (orientation: landscape) and (max-height: 520px) {
  /* Kartu Samber lebih lebar, jadi mulai bertumpuk sejak 6 kartu. */
  html[data-game="samber"] main.table .hand > :first-child:nth-last-child(n+6) ~ * { margin-left: -14px; }
}

/* ===== Responsif HP: isi kartu tidak boleh melebar keluar kartu ===== */
/* Kolom grid kartu dulu mengikuti isi terlebar (baris tombol yang tidak boleh turun baris),
   sehingga seluruh isi kartu meluber ke kanan layar HP. */
.panel { grid-template-columns: minmax(0, 1fr); min-width: 0; }
.panel > * { min-width: 0; }
.lobby-action-row { flex-wrap: wrap; }
.lobby-action-row .btn { flex: 1 1 calc(50% - 4px); min-width: 0; white-space: normal; line-height: 1.2; }
.bot-controls .btn { min-width: 0; white-space: normal; line-height: 1.2; }
.players li { min-width: 0; }
.players li > * { min-width: 0; }

/* Angka online di halaman game */
.entry-online { margin: 2px 0 0; font-size: 13px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.entry-online b { color: #7fd6a4; }
.entry-online .dot { width: 8px; height: 8px; border-radius: 50%; background: #4fd18b; box-shadow: 0 0 0 3px rgba(79,209,139,.18); }
