/* HP tegak: pemain di atas, papan, lalu tombol aksi */
.juragan.table {
  height: 100vh;
  height: var(--app-h);
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  grid-template-areas: 'bar' 'seats' 'board' 'control';
  gap: 6px;
  padding: 8px;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  overflow: hidden;
}
.juragan .topbar { grid-area: bar; }
.jg-seats { grid-area: seats; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; }
.jg-seats.many { grid-auto-flow: row; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.juragan .seat { padding: 6px 8px; gap: 8px; }
.juragan .avatar { background: var(--c); color: var(--on-c, #fff); width: 30px; height: 30px; font-size: 14px; }
.juragan .is-active .avatar { background: var(--c); color: var(--on-c, #fff); }
.juragan .seat.is-active { border-color: var(--c); box-shadow: 0 0 0 1px var(--c); }
.juragan .is-active .avatar::before { background: conic-gradient(var(--c) calc(var(--p) * 360deg), rgba(255, 255, 255, .12) 0); }
.juragan .seat.is-out { opacity: .45; }
.juragan .seat-name { font-size: 13px; }
.cash { font-weight: 700; color: var(--amber); font-size: 13px; }
.juragan .seat-sub { font-size: 12px; }

.board-wrap { grid-area: board; min-height: 0; min-width: 0; display: grid; place-items: center; }
#board { display: block; width: 100%; height: 100%; max-width: 100%; max-height: 100%; }
#board .cell { cursor: pointer; }
#board .cell.picked rect.base { stroke: var(--amber); stroke-width: 6; }
.jg-token { transition: transform .12s ease-out; }
.jg-token.jumping { transition: transform .5s cubic-bezier(.45, 0, .3, 1); }

.jg-log { display: none; }

.control {
  grid-area: control;
  display: grid; gap: 8px;
  padding: 10px 12px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line);
}
.jg-status { font-weight: 600; font-size: 15px; line-height: 1.35; }
.jg-status.mine { color: var(--amber); font-weight: 700; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions:empty { display: none; }
.actions .btn { flex: 1 1 auto; }
.build-list { display: grid; gap: 6px; width: 100%; }
.build-list .btn { justify-content: space-between; min-height: 44px; }
.info { display: grid; gap: 4px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: 14px; }
.info h3 { font-family: var(--display); font-weight: 800; font-size: 18px; display: flex; align-items: center; gap: 8px; }
.info .swatch { width: 14px; height: 14px; border-radius: 3px; flex: none; }
.info table { border-collapse: collapse; font-size: 13px; color: var(--ink-2); }
.info td { padding: 1px 10px 1px 0; }
.info .close { justify-self: end; }
.juragan .timer { height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.juragan .timer-fill { height: 100%; width: 0; background: var(--amber); }
.juragan .timer-fill.low { background: var(--danger); }

/* HP mendatar: papan di kiri */
@media (max-height: 520px) and (orientation: landscape) {
  .juragan.table {
    grid-template-columns: minmax(0, calc(var(--app-h) - 16px)) minmax(0, 1fr);
    grid-template-rows: auto auto minmax(0, 1fr);
    grid-template-areas: 'board bar' 'board seats' 'board control';
  }
  .jg-seats { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .control { align-self: end; overflow-y: auto; max-height: 100%; }
}

/* Layar bandar: pemain di kiri, papan besar, catatan kejadian di kanan */
@media (min-width: 900px) {
  .juragan.table.is-dealer {
    max-width: 1600px; margin: 0 auto; padding: 12px 16px 16px; gap: 12px 24px;
    grid-template-columns: minmax(230px, 1fr) minmax(0, calc(var(--app-h) - 90px)) minmax(260px, 1fr);
    grid-template-rows: auto auto minmax(0, 1fr);
    grid-template-areas: 'bar bar bar' 'seats board host' 'seats board log';
  }
  .is-dealer .jg-seats { display: flex; flex-direction: column; justify-content: center; gap: 10px; }
  .is-dealer .seat { padding: 12px; }
  .is-dealer .seat-name { font-size: 17px; }
  .is-dealer .cash { font-size: 17px; }
  .is-dealer .seat-sub { font-size: 14px; }
  .is-dealer .avatar { width: 40px; height: 40px; font-size: 18px; }
  .is-dealer .control { display: none; }
  .is-dealer .jg-log {
    grid-area: log; display: flex; flex-direction: column; justify-content: center; gap: 10px;
    font-size: 17px; line-height: 1.35; color: var(--ink-2);
  }
  .jg-log p:first-child { color: var(--ink); font-family: var(--display); font-weight: 800; font-size: 24px; }
}

@media (min-width: 900px) {
  .is-dealer.juragan .host.on { position: static; grid-area: host; width: auto; }
  .is-dealer.juragan .host-figure { width: 120px; }
  .is-dealer.juragan .host-bubble { margin-bottom: 40px; }
  .is-dealer .jg-log { justify-content: flex-start; }
}

/* ===== Tampilan baru: papan bergaya, bidak berwajah avatar, efek uang, lelang ===== */
.board-wrap { position: relative; }
#board { filter: drop-shadow(0 18px 36px rgba(0, 0, 0, .55)); }
#board .cell:hover rect.base { stroke: #f2a93b; stroke-width: 2.5; }
.jg-token { transition: transform .14s ease-out; }
.tok-body.hop { animation: jgHop .15s ease-out; }
@keyframes jgHop { 0% { transform: translateY(0); } 45% { transform: translateY(-11px) scale(1.06); } 100% { transform: translateY(0); } }
#marks .pop { transform-box: fill-box; transform-origin: 50% 100%; animation: jgPop .5s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes jgPop { from { transform: scale(0); } }
.jg-pulse { animation: jgPulse 1s ease-in-out infinite; }
@keyframes jgPulse { 50% { opacity: .25; } }

.fx-float .fx-inner { animation: jgFloat 1.6s ease-out forwards; }
.fx-float rect { fill: #1c1712; stroke-width: 2; }
.fx-float text { font: 800 15px Figtree, sans-serif; }
.fx-float.gain rect { stroke: #4cd07d; } .fx-float.gain text { fill: #7dffa8; }
.fx-float.loss rect { stroke: #ff7b68; } .fx-float.loss text { fill: #ffab9e; }
.fx-float.buy rect { stroke: #f2a93b; } .fx-float.buy text { fill: #ffd27a; }
@keyframes jgFloat { 0% { transform: translateY(6px) scale(.6); opacity: 0; } 15% { transform: translateY(-6px) scale(1.08); opacity: 1; } 70% { opacity: 1; } 100% { transform: translateY(-44px) scale(1); opacity: 0; } }

.jg-fx { position: fixed; top: 0; right: 0; bottom: 0; left: 0; pointer-events: none; z-index: 60; }
.jg-chip { position: absolute; transform: translate(-50%, -50%); padding: 3px 10px; border-radius: 999px; font: 800 13px var(--body); white-space: nowrap; background: #1c1712; border: 1.5px solid; animation: jgChip 1.6s ease-out forwards; box-shadow: 0 4px 14px rgba(0, 0, 0, .45); }
.jg-chip.gain { color: #7dffa8; border-color: #4cd07d; }
.jg-chip.loss { color: #ffab9e; border-color: #ff7b68; }
.jg-chip.bid { color: #ffd27a; border-color: #f2a93b; }
@keyframes jgChip { 0% { opacity: 0; margin-top: 10px; } 15% { opacity: 1; margin-top: 0; } 75% { opacity: 1; } 100% { opacity: 0; margin-top: -30px; } }

.jg-card { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 5; pointer-events: none; width: min(300px, 62%); }
.jg-card-in { display: grid; gap: 8px; padding: 16px 18px 18px; border-radius: 16px; text-align: center; background: linear-gradient(160deg, #fff7e3, #f3dfb4); color: #3a2f22; border: 3px solid #f2a93b; box-shadow: 0 20px 50px rgba(0, 0, 0, .55); animation: jgFlip .45s cubic-bezier(.2, 1.3, .4, 1); }
.jg-card-in.bad { border-color: #d0583f; }
.jg-card-head { font: 800 12px var(--body); letter-spacing: .08em; text-transform: uppercase; color: #a85a12; }
.jg-card-in.bad .jg-card-head { color: #b03a2e; }
.jg-card-in p { margin: 0; font: 700 clamp(15px, 2.2vw, 19px)/1.35 var(--body); }
@keyframes jgFlip { from { transform: perspective(600px) rotateY(90deg) scale(.8); opacity: 0; } }

.jg-banner { position: absolute; left: 50%; top: 18%; transform: translateX(-50%); z-index: 6; pointer-events: none; display: grid; gap: 2px; text-align: center; padding: 12px 22px; border-radius: 16px; background: rgba(20, 16, 12, .92); border: 2px solid var(--b); box-shadow: 0 0 0 4px rgba(0, 0, 0, .25), 0 16px 40px rgba(0, 0, 0, .5), 0 0 40px -6px var(--b); width: max-content; max-width: 86%; }
.jg-banner b { font: 800 clamp(17px, 2.6vw, 24px) var(--display); color: #fff6e0; }
.jg-banner span { font-size: 13px; color: var(--ink-2); }
.jg-banner.show { animation: jgBanner 3.2s ease forwards; }
@keyframes jgBanner { 0% { opacity: 0; transform: translateX(-50%) translateY(-14px) scale(.9); } 10% { opacity: 1; transform: translateX(-50%) scale(1.04); } 16% { transform: translateX(-50%) scale(1); } 85% { opacity: 1; } 100% { opacity: 0; } }

/* Kartu pemain */
.juragan .seat { position: relative; overflow: hidden; background: linear-gradient(135deg, color-mix(in srgb, var(--c) 16%, var(--surface)) 0%, var(--surface) 60%); }
.juragan .seat::after { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c); }
.juragan .avatar.av3d { background: var(--c); padding: 2px; }
.seat-info { min-width: 0; display: grid; }
.juragan .seat-sub { color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seat-isl { display: flex; gap: 3px; margin-top: 2px; min-height: 10px; }
.seat-isl em { font-style: normal; font-size: 11px; color: var(--ink-3); }
.seat-isl .isl { width: 10px; height: 10px; border-radius: 3px; border: 2px solid var(--g); background: transparent; }
.seat-isl .isl.full { background: var(--g); box-shadow: 0 0 6px var(--g); }

/* Lelang dan tombol */
.jg-status b { color: #ffd27a; }
.bid-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; width: 100%; }
.bid-row .btn { display: grid; gap: 1px; min-height: 52px; padding: 6px 4px; line-height: 1.15; }
.bid-row .btn small { font-size: 11px; font-weight: 600; opacity: .8; }
.bid-note { width: 100%; margin: 0; font-size: 13px; color: #7dffa8; }
.build-list .swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: 0; }
.control { background: linear-gradient(180deg, var(--surface-2), var(--surface)); }

@media (prefers-reduced-motion: reduce) {
  .tok-body.hop, #marks .pop, .jg-pulse, .fx-float .fx-inner, .jg-chip, .jg-card-in, .jg-banner.show { animation: none; }
}

/* ===== Paket 3: panel Aset & Tukar, tawaran masuk ===== */
.jg-sheet { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 70; display: flex; align-items: flex-end; justify-content: center; padding: 12px; background: rgba(6, 5, 4, .55); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.jg-sheet[hidden] { display: none; }
.jg-offer { align-items: center; z-index: 75; }
.sh-card { width: 100%; max-width: 560px; max-height: min(78vh, 640px); display: flex; flex-direction: column; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 24px 70px rgba(0, 0, 0, .6); overflow: hidden; animation: shUp .22s cubic-bezier(.2, .9, .3, 1); }
@keyframes shUp { from { transform: translateY(24px); opacity: 0; } }
.sh-card header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.sh-tabs { display: flex; gap: 4px; padding: 3px; border-radius: 11px; background: var(--night); }
.sh-tabs button { min-height: 34px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: var(--ink-2); font: 700 13px var(--body); cursor: pointer; }
.sh-tabs button.on { background: var(--surface-2); color: var(--ink); box-shadow: 0 0 0 1px rgba(242, 169, 59, .5); }
.sh-body { overflow-y: auto; padding: 12px 14px 16px; display: grid; gap: 8px; }
.sh-help { margin: 0 0 4px; font-size: 13px; color: var(--ink-3); }
.sh-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; padding: 6px 10px; border-radius: 10px; background: var(--surface-2); }
.sh-name { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; min-width: 0; }
.sh-name .swatch { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.sh-muted { color: var(--ink-3); font-size: 12.5px; margin: 0; }
.sh-players { display: flex; flex-wrap: wrap; gap: 6px; }
.sh-player { display: grid; gap: 1px; min-height: 44px; padding: 4px 12px; border-radius: 10px; border: 1.5px solid var(--line); border-left: 5px solid var(--c); background: var(--surface-2); color: var(--ink); font: 700 13px var(--body); text-align: left; cursor: pointer; }
.sh-player small { font-weight: 600; color: var(--amber); }
.sh-player.on { border-color: var(--c); box-shadow: 0 0 0 2px color-mix(in srgb, var(--c) 40%, transparent); }
.sh-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.sh-cols section { display: grid; gap: 6px; align-content: start; }
.sh-cols h4 { margin: 4px 0 0; font: 800 12px var(--body); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.sh-check { display: block; cursor: pointer; }
.sh-check input { position: absolute; opacity: 0; pointer-events: none; }
.sh-check .sh-row { border: 1.5px solid transparent; }
.sh-check.on .sh-row { border-color: var(--amber); background: rgba(242, 169, 59, .12); }
.sh-check .sh-row { padding: 6px 8px; }
.sh-check .sh-name { font-size: 13px; }
.sh-cash { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 10px; background: var(--night); font-size: 13.5px; }
.sh-cash b { color: var(--amber); }
.sh-cash div { display: flex; gap: 4px; }
.sh-send { width: 100%; min-height: 48px; }
.offer-card { padding: 16px; gap: 10px; display: grid; }
.offer-card h3 { margin: 0; font: 800 19px var(--display); }
.sh-gain { margin: 0; color: #7dffa8; font-weight: 700; }
.sh-loss { margin: 0; color: #ffab9e; font-weight: 700; }
.offer-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.offer-actions .btn { min-height: 48px; }
.offer-card .timer { height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.offer-card .timer-fill { height: 100%; width: 100%; background: var(--amber); transition: width .2s linear; }
@media (max-width: 460px) {
  .sh-cols { grid-template-columns: minmax(0, 1fr); }
  .sh-card { max-height: 86vh; }
  .jg-sheet { padding: 8px; }
}
@media (prefers-reduced-motion: reduce) { .sh-card { animation: none; } }
