/* Game Bus Simulator: tampilan. Aturan: window.BUS (bus.js). Gambar: window.BS_SVG[id] (svg-bus.js). Jalan pseudo-3D digambar game.js di kanvas 2D. */
.bs { --bs: #0f766e; --bs-ink: #0f172a; --cb: clamp(56px, 8.5vh, 92px); }
.bs-wrap { flex: 1; min-height: 0; display: flex; padding: clamp(4px, .8vw, 10px); overflow: hidden; background: linear-gradient(180deg, #ecfdf5, #f8fafc 60%); position: relative; }
.bs-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.bs-panels { flex: 1; min-height: 0; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: clamp(4px, .8vw, 10px); }
.bs-panels.dua { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.bs-panel { position: relative; min-width: 0; min-height: 0; border: 4px solid var(--t); border-radius: 16px; overflow: hidden; background: #7dd3fc; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
.bs-panel canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; background: #7dd3fc; }
.bs-panel.shake canvas { animation: bs-shake .28s linear; }

/* HUD */
.bs-top { position: absolute; left: 6px; right: 6px; top: 6px; z-index: 3; display: flex; flex-direction: column; gap: 4px; pointer-events: none; max-height: 70%; overflow: hidden; }
.bs-hud { display: flex; flex-wrap: wrap; gap: 4px 6px; pointer-events: none; align-items: flex-start; }
.bs-chip { display: inline-flex; align-items: center; gap: 5px; background: rgba(15, 23, 42, .78); color: #fff; border-radius: 999px; padding: 0 10px 0 4px; min-height: 28px; font: 800 clamp(13px, 1.25vw, 19px) var(--font); font-variant-numeric: tabular-nums; white-space: nowrap; border: 2px solid rgba(255, 255, 255, .25); }
.bs-chip .ic { width: 22px; height: 22px; flex: none; display: inline-block; }
.bs-chip .ic svg { width: 100%; height: 100%; display: block; }
.bs-chip .tx { line-height: 1.1; }
.bs-chip.nm { background: var(--t); padding: 0 12px; }
.bs-chip.low { background: #be123c; animation: bs-blink 1s steps(2) infinite; }
.bs-chip.warn { background: #b45309; }
.bs-gauge { width: clamp(44px, 5vw, 80px); height: 10px; background: rgba(255, 255, 255, .25); border-radius: 99px; overflow: hidden; display: inline-block; }
.bs-gauge i { display: block; height: 100%; background: #22c55e; width: 50%; }
.bs-gauge.low i { background: #ef4444; }
.bs-next { align-self: center; max-width: 100%; background: rgba(255, 255, 255, .92); color: #0f172a; border: 3px solid #f59e0b; border-radius: 14px; padding: 0 12px; line-height: 1.5; font: 800 clamp(13px, 1.4vw, 21px) var(--font); text-align: center; pointer-events: none; white-space: nowrap; display: flex; gap: 6px; align-items: center; }
.bs-next .ic { width: 24px; height: 24px; display: inline-block; }
.bs-next .ic svg { width: 100%; height: 100%; display: block; }
.bs-next.dekat { background: #fde68a; border-color: #b45309; }
.bs-next.stop { background: #bbf7d0; border-color: #15803d; }
.bs-next[hidden] { display: none; }
.bs-pax { display: flex; flex-direction: column; gap: 3px; overflow: hidden; pointer-events: none; }
.bs-pax .p { display: inline-flex; align-items: center; gap: 4px; background: rgba(255, 255, 255, .88); border-radius: 10px; padding: 0 7px 0 3px; font: 800 clamp(11px, 1vw, 15px) var(--font); color: #0f172a; line-height: 1.5; white-space: nowrap; align-self: flex-start; max-width: 190px; overflow: hidden; text-overflow: ellipsis; }
.bs-pax .p .ic { width: 18px; height: 18px; flex: none; }
.bs-pax .p .ic svg { width: 100%; height: 100%; display: block; }
.bs-pax .p.minta { background: #fde68a; }
.bs-pax .more { background: rgba(15, 23, 42, .75); color: #fff; }

/* toast dan kilat */
.bs-toast { position: absolute; left: 50%; top: 38%; transform: translateX(-50%); z-index: 6; max-width: 90%; background: var(--c, #0f766e); color: #fff; border: 3px solid #fff; border-radius: 14px; box-shadow: 0 6px 18px rgba(0, 0, 0, .3); padding: 2px 14px; font: 800 clamp(14px, 1.6vw, 24px) var(--font); text-align: center; pointer-events: none; animation: bs-pop .25s ease-out; }
.bs-toast[hidden] { display: none; }
.bs-flash { position: absolute; inset: 0; z-index: 2; pointer-events: none; background: rgba(239, 68, 68, .0); transition: background .2s; }
.bs-flash.on { background: rgba(239, 68, 68, .22); transition: none; }

/* tombol sentuh */
.bs-b.rem { width: calc(var(--cb) * 1.5); height: calc(var(--cb) * 1.25); }
.bs-ctl { position: absolute; bottom: 8px; z-index: 8; display: flex; gap: 8px; align-items: flex-end; }
.bs-ctl.kiri { left: 8px; }
.bs-ctl.kanan { right: 8px; flex-direction: row; }
.bs-b { width: var(--cb); height: var(--cb); min-width: 48px; min-height: 48px; border-radius: 22px; border: 4px solid #fff; background: rgba(15, 23, 42, .62); color: #fff; display: grid; place-items: center; padding: 0; cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; box-shadow: 0 4px 0 rgba(0, 0, 0, .35); font: 800 12px var(--font); }
.bs-b svg { width: 70%; height: 70%; display: block; pointer-events: none; }
.bs-b .fb { font-size: 12px; pointer-events: none; }
.bs-b.gas { background: rgba(5, 150, 105, .85); height: calc(var(--cb) * 1.25); }
.bs-b.rem { background: rgba(190, 18, 60, .85); }
.bs-b.on { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0, 0, 0, .35); filter: brightness(1.25); }
.bs-b.rem.kilat { filter: brightness(1.5); }
.bs-b:focus-visible { outline: 3px solid #f59e0b; outline-offset: 2px; }

/* lembar bawah: berhenti, kembalian, bensin */
.bs-sheet { position: absolute; left: 8px; right: calc(var(--cb) * 4 + 70px); bottom: 6px; z-index: 7; max-height: 56%; overflow-y: auto; background: #fff; border: 4px solid var(--t); border-radius: 16px; padding: 6px 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .35); text-align: left; color: var(--bs-ink); font-family: var(--font); }
.bs-sheet[hidden] { display: none; }
.bs-sheet h2 { margin: 0; font-size: clamp(15px, 1.5vw, 22px); text-align: center; }
.bs-sheet .sub { margin: 0 0 4px; font-weight: 700; color: #475569; font-size: clamp(12px, 1.15vw, 16px); text-align: center; }
.bs-sheet .q { font-weight: 800; font-size: clamp(13px, 1.3vw, 19px); margin: 3px 0; overflow-wrap: anywhere; }
.bs-kas { display: flex; flex-wrap: wrap; gap: 4px 8px; justify-content: center; margin: 2px 0; font-weight: 700; font-size: clamp(12px, 1.1vw, 16px); color: #475569; }
.bs-kas b { color: var(--bs-ink); font-variant-numeric: tabular-nums; }
.bs-kas .tot { background: #fef9c3; border-radius: 8px; padding: 0 8px; }
.bs-kas .tot.pas { background: #dcfce7; } .bs-kas .tot.lebih { background: #ffe4e6; }
.bs-uang { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; margin: 4px 0; }
.bs-uang button { position: relative; min-height: 48px; border: 3px solid #cbd5e1; background: #fff; border-radius: 10px; padding: 1px; cursor: pointer; touch-action: manipulation; display: flex; flex-direction: column; align-items: center; justify-content: center; font: 800 11px var(--font); color: #0f172a; }
.bs-uang button svg { width: 100%; height: clamp(26px, 4.4vh, 44px); display: block; }
.bs-uang button .n { position: absolute; right: -3px; top: -6px; min-width: 20px; height: 20px; border-radius: 99px; background: #0f766e; color: #fff; font-size: 12px; line-height: 20px; text-align: center; display: none; padding: 0 4px; }
.bs-uang button.has .n { display: block; }
.bs-row { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-top: 4px; }
.bs-btn { min-height: 48px; min-width: 96px; padding: 0 18px; border-radius: 999px; border: 0; background: #059669; color: #fff; font: 800 clamp(14px, 1.4vw, 19px) var(--font); cursor: pointer; box-shadow: 0 3px 0 #047857; touch-action: manipulation; }
.bs-btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 #047857; }
.bs-btn:disabled { background: #94a3b8; box-shadow: 0 3px 0 #64748b; cursor: default; }
.bs-btn.sec { background: #fff; color: #334155; border: 3px solid #94a3b8; box-shadow: none; }
.bs-btn:focus-visible { outline: 3px solid #f59e0b; outline-offset: 2px; }
.bs-opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; margin-top: 4px; }
.bs-o { min-height: 46px; border: 3px solid #bae6fd; background: #f0f9ff; color: var(--bs-ink); border-radius: 12px; font: 800 clamp(13px, 1.3vw, 18px) var(--font); cursor: pointer; touch-action: manipulation; }
.bs-o.ok { background: #dcfce7; border-color: #16a34a; } .bs-o.bad { background: #ffe4e6; border-color: #e11d48; }
.bs-lit { display: flex; gap: 4px; justify-content: center; align-items: center; flex-wrap: wrap; margin: 3px 0; }
.bs-lit button { min-height: 44px; min-width: 52px; border-radius: 12px; border: 3px solid #94a3b8; background: #fff; font: 800 15px var(--font); cursor: pointer; touch-action: manipulation; }
.bs-lit .v { font-weight: 800; font-size: clamp(16px, 1.8vw, 24px); min-width: 70px; text-align: center; font-variant-numeric: tabular-nums; }
.bs-fb { border-radius: 10px; padding: 3px 8px; margin-top: 4px; font-weight: 700; font-size: clamp(12px, 1.15vw, 16px); background: #f1f5f9; }
.bs-fb.ok { background: #dcfce7; } .bs-fb.bad { background: #ffe4e6; }

/* akhir */
.bs-names { display: grid; gap: 6px; }
.bs-names input { font: 700 16px var(--font); padding: 8px 14px; border: 2px solid var(--line); border-radius: 999px; min-width: 0; width: 100%; box-sizing: border-box; text-align: center; min-height: 44px; }
.bs-names input[hidden] { display: none; }
.bs-how { margin: 8px 0 0; text-align: left; font-size: 14px; font-weight: 600; color: #334155; }
.bs-how summary { cursor: pointer; font-weight: 800; min-height: 32px; }
.bs-how ol { margin: 4px 0 0; padding-left: 20px; }
.bs-res { width: min(900px, 100%); }
.bs-lapw { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; text-align: left; margin: 8px 0; }
.bs-lap { border: 3px solid var(--t, #94a3b8); border-radius: 14px; padding: 8px 12px; font-weight: 700; color: #0f172a; }
.bs-lap.win { background: #fef9c3; }
.bs-lap h3 { margin: 0 0 4px; font-size: 18px; color: var(--t); }
.bs-lap .r { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px dashed #cbd5e1; font-size: 15px; font-variant-numeric: tabular-nums; }
.bs-lap .r.big { font-size: 18px; font-weight: 800; border-bottom: 0; }
.bs-lap .st { font-size: 24px; letter-spacing: 2px; color: #f59e0b; text-align: center; }
.bs-lap .sq { margin-top: 6px; }
.bs-lap .sq .bs-o { min-height: 44px; }

@media (max-width: 700px) and (orientation: portrait) {
  .bs-panels.dua { grid-template-columns: minmax(0, 1fr); grid-template-rows: repeat(2, minmax(0, 1fr)); }
  .rotate-hint:not([hidden]) { display: flex; }
  .topbar .title { display: none; }
  .bs { --cb: 52px; }
  .bs-sheet { left: 6px; right: 6px; bottom: calc(var(--cb) * 1.25 + 14px); max-height: 50%; }
  .bs-panels.dua .bs-sheet { bottom: 6px; left: 8px; right: calc(var(--cb) * 4 + 70px); }
  .bs-pax { display: none; }
}
.rotate-hint[hidden] { display: none; }
@media (max-height: 560px) {
  .bs-wrap { padding: 3px; }
  .bs-panel { border-width: 3px; border-radius: 12px; }
  .bs { --cb: clamp(48px, 15vh, 64px); }
  .bs-chip { min-height: 24px; font-size: 12px; padding: 0 7px 0 3px; }
  .bs-chip .ic { width: 18px; height: 18px; }
  .bs-top { top: 3px; left: 4px; right: 4px; gap: 3px; }
  .bs-hud { gap: 3px; }
  .bs-next { font-size: 12px; line-height: 1.4; }
  .bs-pax .p { font-size: 11px; line-height: 1.35; }
  .bs-ctl { bottom: 4px; gap: 5px; } .bs-ctl.kiri { left: 4px; } .bs-ctl.kanan { right: 4px; }
  .bs-sheet { bottom: 4px; padding: 4px 8px; max-height: 78%; left: 8px; right: calc(var(--cb) * 4 + 70px); }
  .bs-uang button { min-height: 44px; }
  .bs-btn { min-height: 44px; }
  .bs-o { min-height: 44px; }
  .bs-toast { top: 34%; }
}
@media (max-width: 1000px) { .bs-panels.dua .bs-sheet[data-t="k"] h2, .bs-panels.dua .bs-sheet .hint { display: none; } .bs-panels.dua .bs-lit { flex-wrap: nowrap; } .bs-panels.dua .bs-lit button { min-width: 44px; min-height: 40px; } .bs-panels.dua .bs-o { min-height: 40px; font-size: 13px; } .bs-panels.dua .bs-sheet .q { font-size: 12px; margin: 1px 0; } .bs-panels.dua .bs-btn { min-width: 0; padding: 0 8px; font-size: 12px; min-height: 40px; } .bs-panels.dua .bs-row { flex-wrap: nowrap; gap: 4px; } .bs-panels.dua .bs-sheet { padding: 4px 6px; } .bs-panels.dua .bs-uang button { min-height: 40px; } .bs-panels.dua .bs-uang button svg { height: 22px; } .bs-panels.dua .bs-sheet { left: 6px; right: 6px; bottom: calc(var(--cb) + 12px); max-height: 52%; } .bs-panels.dua .bs-pax { display: none; } .bs-panels.dua .bs-chip { font-size: 11px; min-height: 22px; padding-right: 6px; } .bs-panels.dua .bs-chip.hide-s, .bs-panels.dua .bs-chip.nm { display: none; } .bs-panels.dua .bs-next { font-size: 11px; } }
@media (max-height: 560px) and (max-width: 760px) { .bs-pax .p:nth-child(n+4) { display: none; } .bs-chip.hide-s { display: none; } }
@media (max-width: 999px), (max-aspect-ratio: 1/1) { .bs-panels.bot { grid-template-columns: minmax(0, 1fr); } .bs-panels.bot .bs-panel.botp { display: none; } }
@media (min-width: 1000px) and (min-aspect-ratio: 1/1) { .bs-chip.opp { display: none; } }
@keyframes bs-blink { 50% { opacity: .65; } }
@keyframes bs-pop { from { transform: translate(-50%, 0) scale(.7); opacity: 0; } to { transform: translate(-50%, 0) scale(1); opacity: 1; } }
@keyframes bs-shake { 20% { transform: translate(-4px, 3px); } 40% { transform: translate(4px, -3px); } 60% { transform: translate(-3px, 2px); } 80% { transform: translate(3px, -1px); } }
@media (prefers-reduced-motion: reduce) { .bs-panel.shake canvas, .bs-toast, .bs-chip.low { animation: none; } }

/* semua tombol berkumpul di kanan bawah */
.bs-ctl.kanan { gap: 10px; }
.bs-ctl .bs-b.rem { margin-left: calc(var(--cb) * .45); }

/* 2 pemain: pemain 1 berkumpul di pojok kiri, pemain 2 di pojok kanan */
.bs-panels.dua .bs-panel:first-child .bs-ctl.kanan { right: auto; left: 8px; }
.bs-panels.dua .bs-panel:first-child .bs-sheet { left: calc(var(--cb) * 4 + 70px); right: 8px; }
@media (max-width: 1000px) { .bs-panels.dua .bs-panel:first-child .bs-sheet { left: 6px; right: 6px; } }
