/* Susun Bata: tata letak PC (papan di tengah, panel di samping) dan HP (papan + tombol sentuh di bawah). */
html, body { height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
body { touch-action: manipulation; -webkit-user-select: none; user-select: none; }
.sb { height: var(--app-h, 100vh); display: flex; flex-direction: column; }
.sb-bar { flex: none; display: flex; align-items: center; gap: 10px; padding: 10px 14px; }
.sb-bar a { text-decoration: none; }
.sb-title { flex: 1; text-align: center; font: 800 20px var(--display); color: var(--ink); }
.sb-bar-right { display: flex; gap: 6px; }
.sb-bar .btn-small { min-width: 42px; }
.sb-bar .off { opacity: .5; }

.sb-main { flex: 1; min-height: 0; display: flex; justify-content: center; align-items: center; gap: 18px; padding: 4px 14px 14px; }
.sb-side { flex: none; width: 150px; display: grid; gap: 12px; align-content: start; align-self: stretch; padding-top: 4px; }
.sb-box { padding: 12px; border-radius: 16px; background: rgba(21, 18, 30, .72); border: 1px solid var(--line); }
.sb-box h3 { margin: 0 0 8px; font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.sb-box canvas { display: block; margin: 0 auto; }
#holdCv { width: 96px; height: 72px; }
#nextCv { width: 96px; height: 216px; }
.sb-stats { display: grid; gap: 8px; }
.sb-stats span { display: block; font-size: 12px; color: var(--ink-3); }
.sb-stats b { font: 800 22px var(--display); color: var(--amber); font-variant-numeric: tabular-nums; }
.sb-keys p { margin: 0; font-size: 12px; line-height: 1.6; color: var(--ink-2); }

.sb-well { position: relative; flex: none; min-width: 0; height: 100%; display: flex; align-items: center; justify-content: center; }
.sb-well canvas { display: block; border-radius: 14px; box-shadow: 0 0 0 2px rgba(242, 169, 59, .35), 0 24px 60px rgba(0, 0, 0, .6); background: rgba(8, 10, 20, .86); }
.sb-well.shake { animation: sbShake .18s ease-out; }
@keyframes sbShake { 30% { transform: translateY(5px); } 60% { transform: translateY(-2px); } }

/* Tulisan melayang: "+800", "Kombo x2", "Empat baris!" */
.sb-pop { position: absolute; left: 0; right: 0; top: 34%; text-align: center; pointer-events: none; }
.sb-pop span { display: block; font: 800 30px var(--display); color: #fff3d6; text-shadow: 0 2px 0 #7a3a1a, 0 0 24px rgba(242, 169, 59, .8); animation: sbPop 1.1s ease-out forwards; }
.sb-pop span.small { font-size: 18px; color: var(--amber); }
@keyframes sbPop { 0% { opacity: 0; transform: translateY(14px) scale(.8); } 15% { opacity: 1; transform: translateY(0) scale(1.08); } 70% { opacity: 1; } 100% { opacity: 0; transform: translateY(-34px) scale(1); } }

/* Tombol sentuh: hanya di layar sentuh / sempit */
.sb-pad { display: none; }

.sb-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; place-items: center; padding: 20px; background: rgba(6, 8, 18, .72); }
.sb-overlay[hidden] { display: none; }
.sb-card { width: min(400px, 100%); display: grid; gap: 12px; padding: 26px 24px; border-radius: 24px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 24px 60px rgba(0, 0, 0, .6); text-align: center; }
.sb-card h2 { margin: 0; font: 800 34px var(--display); }
.sb-card p { margin: 0; color: var(--ink-2); line-height: 1.5; }
.sb-card .btn { width: 100%; }
.sb-big { font: 800 44px var(--display); color: var(--amber); line-height: 1; }
.sb-levels { display: flex; justify-content: center; gap: 6px; }
.sb-levels button { min-width: 56px; min-height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2); font: 700 15px var(--body); cursor: pointer; }
.sb-levels button.on { background: var(--amber); color: var(--amber-ink); border-color: var(--amber); }
.sb-name { min-height: 44px; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--night); color: var(--ink); font: 16px var(--body); text-align: center; }
.sb-top { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; text-align: left; max-height: 220px; overflow-y: auto; }
.sb-top li { display: flex; gap: 10px; padding: 6px 10px; border-radius: 10px; background: var(--surface-2); font-size: 14px; }
.sb-top li.me { outline: 2px solid var(--amber); }
.sb-top li b { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-top li span { color: var(--amber); font-weight: 800; font-variant-numeric: tabular-nums; }
.sb-mini { font-size: 12px; color: var(--ink-3); }

@media (max-width: 760px), (hover: none) and (pointer: coarse) {
  .sb-bar { padding: 8px 10px; }
  .sb-title { font-size: 17px; }
  .sb-main { gap: 6px; padding: 2px 6px 6px; align-items: stretch; }
  .sb-side { width: 60px; gap: 6px; }
  .sb-box { padding: 7px 4px; border-radius: 12px; }
  .sb-box h3 { font-size: 9px; letter-spacing: .02em; margin-bottom: 4px; text-align: center; }
  .sb-stats { text-align: center; }
  #holdCv { width: 50px; height: 38px; }
  #nextCv { width: 50px; height: 140px; }
  .sb-keys { display: none; }
  .sb-stats b { font-size: 15px; }
  .sb-stats span { font-size: 10px; }
  .sb-pad { flex: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding: 8px 10px calc(10px + env(safe-area-inset-bottom)); }
  .sb-pad button { min-height: 54px; border-radius: 14px; border: 1px solid var(--line); background: rgba(34, 28, 40, .85); color: var(--ink); font: 700 22px var(--body); display: grid; place-items: center; line-height: 1; touch-action: none; }
  .sb-pad button small { display: block; font-size: 10px; font-weight: 600; color: var(--ink-3); margin-top: 2px; }
  .sb-pad button:active, .sb-pad button.held { background: rgba(242, 169, 59, .3); border-color: var(--amber); }
  .sb-pad .sb-drop { grid-column: span 2; background: rgba(242, 169, 59, .22); border-color: rgba(242, 169, 59, .6); }
}
.calm .sb-pop span, .calm .sb-well.shake { animation: none; }
