/* game.css — layar permainan PIPWORK, gaya lembar spec pabrik terang */
:root {
  --bone: #F4F0E6;
  --paper: #FBF8F1;
  --ink: #1A1917;
  --ink-soft: #55524B;
  --line: #D9D2C2;
  --cobalt: #2B4BD8;
  --hazard: #F5B50A;
  --stamp: #D8402B;
  --mint: #2E9E6B;
  --font-head: "Archivo", sans-serif;
  --font-mono: "IBM Plex Mono", monospace;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  background: var(--bone);
  color: var(--ink);
  font-family: var(--font-mono);
  overflow: hidden;
}

/* ---------- bilah atas ---------- */
.topbar {
  position: fixed; inset: 0 0 auto 0; height: 56px; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px;
  background: var(--paper);
  border-bottom: 2px solid var(--ink);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.emblem { width: 30px; height: 30px; }
.wordmark { font-family: var(--font-head); font-weight: 900; font-size: 15px; letter-spacing: 2px; }
.shift-meta { display: flex; gap: 8px; }
.chip {
  font-size: 11px; font-weight: 700; letter-spacing: 1px;
  padding: 5px 10px; border: 1.5px solid var(--ink);
  background: var(--hazard); color: var(--ink);
}
.chip-ghost { background: transparent; border-color: var(--line); color: var(--ink-soft); }

/* ---------- panggung ---------- */
.stage { position: fixed; inset: 56px 0 0 0; }
#scene-wrap, #scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.panel {
  position: absolute; z-index: 10;
  background: var(--paper);
  border: 2px solid var(--ink);
  box-shadow: 5px 5px 0 rgba(26, 25, 23, 0.14);
}
.panel-title { font-family: var(--font-head); font-size: 14px; letter-spacing: 2px; }
.panel-sub { font-size: 10.5px; color: var(--ink-soft); margin: 4px 0 10px; line-height: 1.45; }

/* manifest kiri */
.panel-manifest {
  left: 16px; top: 16px; width: 172px; max-height: calc(100% - 32px);
  padding: 14px; overflow: auto;
}
.manifest-list { list-style: none; display: grid; gap: 4px; }
.manifest-list li {
  display: flex; align-items: center; gap: 8px;
  font-size: 11.5px; padding: 3px 6px; border: 1px solid transparent;
}
.manifest-list li .idx { color: var(--ink-soft); width: 22px; }
.manifest-list li .dice { font-weight: 700; }
.manifest-list li.done { opacity: 0.32; text-decoration: line-through; }
.manifest-list li.now { border-color: var(--cobalt); background: #E9EDFF; }

/* kendali kanan */
.panel-control {
  right: 16px; top: 16px; width: 270px; max-height: calc(100% - 32px);
  padding: 14px; display: flex; flex-direction: column; gap: 12px; overflow: auto;
}
.wallet-cash { display: flex; justify-content: space-between; align-items: baseline; }
.w-label { font-size: 10px; letter-spacing: 1.5px; color: var(--ink-soft); }
.w-val { font-family: var(--font-head); font-weight: 900; font-size: 26px; }
.wallet-row { display: flex; gap: 6px; margin-top: 8px; }

.next-rolls .roll-pips { display: flex; gap: 6px; margin-top: 6px; }
.die-face {
  width: 34px; height: 34px; border: 2px solid var(--ink); background: #fff;
  display: grid; place-items: center;
  font-family: var(--font-head); font-weight: 900; font-size: 15px;
}
.die-face.small { width: 26px; height: 26px; font-size: 12px; }
.die-face.ghost { opacity: 0.4; }

.actions { display: flex; flex-direction: column; gap: 8px; }
.tune-row, .manage-row, .qa-row { display: flex; gap: 6px; flex-wrap: wrap; }
.btn {
  font-family: var(--font-mono); font-weight: 700; font-size: 12px; letter-spacing: 0.5px;
  padding: 10px 12px; border: 2px solid var(--ink); background: #fff; color: var(--ink);
  cursor: pointer; box-shadow: 3px 3px 0 rgba(26,25,23,0.18);
  transition: transform 0.06s ease, box-shadow 0.06s ease;
}
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 rgba(26,25,23,0.18); }
.btn:disabled { opacity: 0.35; cursor: default; }
.btn-roll { background: var(--cobalt); color: #fff; flex: 1; font-size: 14px; }
.btn-tune { background: var(--hazard); }
.btn-buy { background: var(--mint); color: #fff; }
.btn-permit { background: #fff; }
.btn-end { background: var(--ink); color: var(--bone); }
.btn-upgrade { background: #fff; }
.hidden { display: none !important; }

/* rival bots */
.rivals { display: grid; gap: 5px; }
.rival {
  display: flex; justify-content: space-between; font-size: 11.5px;
  padding: 5px 8px; border: 1px solid var(--line);
}
.rival .dot { display: inline-block; width: 9px; height: 9px; margin-right: 6px; border: 1px solid var(--ink); }
.rival.active { border-color: var(--ink); background: #FFF6DE; }

/* log */
.log {
  flex: 1; min-height: 70px; max-height: 160px; overflow: auto;
  border-top: 1.5px dashed var(--line); padding-top: 8px;
  font-size: 11px; line-height: 1.55; color: var(--ink-soft);
}
.log b { color: var(--ink); }
.log .me b { color: var(--cobalt); }

/* ---------- kartu event ---------- */
.card-toast {
  position: fixed; left: 50%; top: 76px; transform: translateX(-50%); z-index: 30;
  width: min(420px, 86vw); padding: 16px 18px;
  background: var(--paper); border: 2.5px solid var(--ink);
  box-shadow: 6px 6px 0 rgba(26,25,23,0.2);
  animation: drop 0.25s ease;
}
@keyframes drop { from { transform: translate(-50%, -14px); opacity: 0; } }
.card-kind {
  font-size: 10px; font-weight: 700; letter-spacing: 2px;
  padding: 3px 8px; border: 1.5px solid var(--ink); background: var(--hazard);
}
.card-kind.bad { background: var(--stamp); color: #fff; }
.card-text { margin-top: 10px; font-size: 13.5px; line-height: 1.5; }

/* ---------- modal ---------- */
.modal {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(26,25,23,0.45);
  display: grid; place-items: center;
}
.modal-box {
  width: min(460px, 90vw); max-height: 86vh; overflow: auto;
  background: var(--paper); border: 2.5px solid var(--ink);
  box-shadow: 8px 8px 0 rgba(26,25,23,0.3);
  padding: 22px;
}
.modal-box h3 { font-family: var(--font-head); letter-spacing: 1.5px; margin-bottom: 14px; }
#upgrade-list { display: grid; gap: 8px; margin-bottom: 14px; }
.up-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  border: 1px solid var(--line); padding: 8px 10px; font-size: 12px;
}
.up-row .lvl { color: var(--ink-soft); }
.up-row button { padding: 6px 10px; font-size: 11px; }

/* layar akhir */
.over-box { text-align: center; }
.over-stamp {
  display: inline-block; font-family: var(--font-head); font-weight: 900;
  font-size: 13px; letter-spacing: 3px; color: var(--stamp);
  border: 3px solid var(--stamp); padding: 6px 14px; transform: rotate(-4deg);
  margin-bottom: 12px;
}
.over-board { list-style: none; display: grid; gap: 6px; margin: 14px 0; text-align: left; }
.over-board li {
  display: flex; justify-content: space-between;
  border: 1.5px solid var(--line); padding: 9px 12px; font-size: 13px;
}
.over-board li.me { border-color: var(--cobalt); background: #E9EDFF; font-weight: 700; }
.over-note { font-size: 12px; color: var(--ink-soft); margin-bottom: 14px; }
.over-actions { display: flex; gap: 8px; justify-content: center; }
.over-next { margin-top: 12px; font-size: 11px; color: var(--ink-soft); letter-spacing: 0.5px; }

/* ---------- ponsel ---------- */
@media (max-width: 900px) {
  .panel-manifest { display: none; }
  .panel-control {
    left: 10px; right: 10px; top: auto; bottom: 10px; width: auto;
    max-height: 46vh; padding: 12px;
  }
  .log { max-height: 60px; }
  .wordmark { font-size: 12px; }
}
