/* VOICE: rame, usil, warung — satire yang hangat, bukan sinis.
   IDEA: papan mainan kertas yang dijual di warung: kuning terang, tinta hitam tebal, stempel merah.
   PICTURE: papan 40 petak itu sendiri; di menu, siluet rumah petak vs gedung tinggi.
   COLOUR and TYPE: kuning warung #ffcf33, tinta #1d1a16, merah stempel #e63946; Bungee + Rubik.
   LAYOUT: papan sebesar mungkin; panel aksi di kanan (lebar) atau di bawah (HP). */
:root {
  color-scheme: light dark;
  --bg: light-dark(#ffcf33, #15130e);
  --ink: light-dark(#1d1a16, #f6eedb);
  --paper: light-dark(#fffaee, #24211a);
  --paper2: light-dark(#fff3cf, #2d2920);
  --line: light-dark(#1d1a16, #4a4436);
  --muted: light-dark(#5b5345, #b8ad94);
  --red: #e63946;
  --teal: light-dark(#0f6f6b, #1f8f88);
  --good: light-dark(#1d7a45, #4fc184);
  --bad: light-dark(#b3202b, #ff7a83);
  --shadow: light-dark(#1d1a16, #000);
}
:root[data-theme=light] { color-scheme: light }
:root[data-theme=dark] { color-scheme: dark }
* { box-sizing: border-box; min-width: 0 }
html, body { margin: 0 }
body { background: var(--bg); color: var(--ink); font: 16px/1.5 Rubik, system-ui, sans-serif; overflow-x: clip; min-height: 100vh }
button, input, select { font: inherit; color: inherit }
[hidden] { display: none !important }
h2 { font: 700 13px/1.2 Rubik, sans-serif; margin: 0 0 8px; color: var(--muted) }

/* ---------- buttons ---------- */
.btn { appearance: none; border: 2px solid var(--line); background: var(--ink); color: var(--bg); padding: 10px 16px; min-height: 44px; border-radius: 10px; font-weight: 700; cursor: pointer; box-shadow: 0 3px 0 var(--shadow); transition: transform .08s }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--shadow) }
.btn:disabled { opacity: .4; cursor: not-allowed }
.btn.ghost { background: var(--paper); color: var(--ink) }
.btn.red { background: var(--red); color: #fff }
.btn.big { width: 100%; font-size: 18px; min-height: 52px }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 14px }
.btn:focus-visible, .tab:focus-visible, input:focus-visible, select:focus-visible, .tile:focus-visible { outline: 3px solid var(--red); outline-offset: 2px }
.row { display: flex; gap: 8px; align-items: center }
.row.end { justify-content: flex-end }
.btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px }
.btns .btn { flex: 1 1 140px }

/* ---------- setup ---------- */
#setup { max-width: 560px; margin: 0 auto; padding: 24px 16px 40px }
.hero { text-align: center; margin-bottom: 18px }
.skyline { width: 100%; max-width: 460px; height: auto; display: block; margin: 0 auto 6px }
.skyline .far rect { fill: light-dark(#e3a90f, #3a3424) }
.skyline .near path { fill: var(--ink) }
.skyline .win rect { fill: var(--bg) }
.logo { font: 400 clamp(40px, 12vw, 64px)/1 Bungee, Rubik, sans-serif; margin: 0; letter-spacing: .01em }
.logo span, .brand span { color: var(--red) }
.tag { margin: 8px 0 0; font-weight: 500 }
.setup-card { background: var(--paper); border: 2px solid var(--line); border-radius: 16px; box-shadow: 0 6px 0 var(--shadow); padding: 16px }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: var(--paper2); padding: 4px; border-radius: 12px; margin-bottom: 14px }
.tab { border: 0; background: transparent; padding: 10px; min-height: 44px; border-radius: 9px; font-weight: 700; cursor: pointer; color: var(--muted) }
.tab.on { background: var(--ink); color: var(--bg) }
.tabpane { display: grid; gap: 12px }
.plist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px }
.plist li { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto auto; gap: 8px; align-items: center }
.plist .dot, .players .dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line) }
.plist input, .field input, .field select, .code-in { width: 100%; padding: 10px 12px; min-height: 44px; font-size: 16px; background: var(--paper2); border: 2px solid var(--line); border-radius: 10px }
.plist .who { width: 96px; min-height: 44px; padding: 0 10px; border: 2px solid var(--line); border-radius: 10px; background: var(--paper); font-weight: 700; cursor: pointer; font-size: 14px }
.plist .who.bot { background: var(--teal); color: #fff }
.plist .x { width: 40px; min-height: 44px; border: 0; background: none; font-size: 22px; cursor: pointer; color: var(--muted) }
.plist .tagname { font-weight: 700 }
.plist .sub { font-size: 13px; color: var(--muted) }
.field { display: grid; gap: 4px; font-weight: 700; font-size: 14px }
.hint, .foot { font-size: 14px; color: var(--muted); margin: 0 }
.foot { text-align: center; margin-top: 16px; color: var(--ink); opacity: .7 }
.resume { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-radius: 10px; background: var(--paper2); font-weight: 500 }
.or { text-align: center; font-size: 14px; color: var(--muted) }
.code-in { text-transform: uppercase; letter-spacing: .3em; font-weight: 700; text-align: center }
.lobby-label { margin: 0; font-size: 14px; font-weight: 700; color: var(--muted); text-align: center }
.roomcode { font: 400 44px/1 Bungee, sans-serif; letter-spacing: .12em; background: var(--paper2); border: 2px dashed var(--line); border-radius: 12px; padding: 14px; cursor: pointer; width: 100% }
.msg { margin: 0; min-height: 1.5em; font-weight: 500; color: var(--bad) }

/* ---------- game layout ---------- */
#game { padding: 10px }
.table { display: grid; gap: 12px; max-width: 1240px; margin: 0 auto }
@media (min-width: 1000px) {
  .table { grid-template-columns: minmax(0, 1fr) 360px; align-items: start }
  .panel { position: sticky; top: 10px; max-height: calc(100vh - 20px); overflow-y: auto }
}

/* ---------- board ---------- */
.board {
  --c: 1fr; --k: 1.55fr;
  display: grid; aspect-ratio: 1; width: 100%; max-width: min(100%, calc(100vh - 20px)); margin: 0 auto;
  grid-template-columns: var(--k) repeat(9, var(--c)) var(--k);
  grid-template-rows: var(--k) repeat(9, var(--c)) var(--k);
  background: var(--line); gap: 1px; border: 3px solid var(--line); border-radius: 6px;
  box-shadow: 0 6px 0 var(--shadow);
}
.tile { position: relative; background: var(--paper); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 2px; overflow: hidden; cursor: pointer; font-size: clamp(6.5px, 1.2vw, 11px); line-height: 1.1; border: 0 }
.tile .dyn { display: contents }
.tile .nm { font-weight: 700; overflow-wrap: anywhere; hyphens: auto }
.tile .pr { color: var(--muted); margin-top: 1px; white-space: nowrap }
.tile .band { position: absolute; background: var(--g) }
.side-b .band { left: 0; right: 0; top: 0; height: 22% }
.side-t .band { left: 0; right: 0; bottom: 0; height: 22% }
.side-l .band { top: 0; bottom: 0; right: 0; width: 22% }
.side-r .band { top: 0; bottom: 0; left: 0; width: 22% }
.side-b { padding-top: 24% } .side-t { padding-bottom: 24% } .side-l { padding-right: 24% } .side-r { padding-left: 24% }
.tile.corner { background: var(--paper2); font: 400 clamp(7px, 1.35vw, 12px)/1.05 Bungee, sans-serif }
.tile.corner .ic { font-size: 1.9em; line-height: 1 }
.tile.special .ic { font: 400 1.5em/1 Bungee, sans-serif; color: var(--red) }
.tile.sel { outline: 3px solid var(--red); outline-offset: -3px; z-index: 2 }
.tile.mort::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(45deg, transparent 0 5px, light-dark(#1d1a1633, #ffffff22) 5px 7px); pointer-events: none }
.tile .own { position: absolute; width: 22%; aspect-ratio: 1; border-radius: 50%; border: 1.5px solid var(--line); background: var(--oc) }
.side-b .own { bottom: 3px; right: 3px } .side-t .own { top: 3px; right: 3px } .side-l .own { left: 3px; bottom: 3px } .side-r .own { right: 3px; bottom: 3px }
.tile .lv { position: absolute; display: flex; gap: 1px; z-index: 1 }
.side-b .lv { top: 2%; left: 50%; transform: translateX(-50%) } .side-t .lv { bottom: 2%; left: 50%; transform: translateX(-50%) }
.side-l .lv { right: 2%; top: 50%; transform: translateY(-50%); flex-direction: column } .side-r .lv { left: 2%; top: 50%; transform: translateY(-50%); flex-direction: column }
.lv i { width: clamp(4px, .8vw, 8px); aspect-ratio: 1; background: #fff; border: 1px solid #1d1a16 }
.lv i.g { background: var(--red); width: clamp(7px, 1.4vw, 13px) }
.tokens { position: absolute; inset: 0; display: flex; flex-wrap: wrap; align-content: center; justify-content: center; gap: 1px; pointer-events: none; z-index: 3 }
.tok { width: clamp(9px, 2.1vw, 20px); aspect-ratio: 1; border-radius: 50%; background: var(--pc); border: 2px solid #fff; box-shadow: 0 1px 0 2px #1d1a16; display: grid; place-items: center; color: #fff; font: 700 clamp(5px, 1vw, 10px)/1 Rubik, sans-serif; transition: transform .2s }
.tok.now { transform: scale(1.25); z-index: 4 }

.center { grid-area: 2 / 2 / 11 / 11; background: var(--teal); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: clamp(4px, 1.6vw, 14px); padding: 4%; color: #fff; text-align: center }
.brand { font: 400 clamp(18px, 5.4vw, 52px)/1 Bungee, sans-serif; color: #ffcf33; text-shadow: 0 3px 0 #1d1a16 }
.brand span { color: #fff }
.dice { display: flex; gap: clamp(6px, 1.4vw, 14px) }
.die { width: clamp(28px, 6.5vw, 58px); aspect-ratio: 1; background: #fffaee; border-radius: 18%; border: 2px solid #1d1a16; box-shadow: 0 3px 0 #1d1a16; display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); padding: 14% }
.die b { width: 82%; aspect-ratio: 1; border-radius: 50%; background: #1d1a16; place-self: center }
.die.blank { opacity: .55 }
.dice.roll .die { animation: shake .45s ease }
@keyframes shake { 0% { transform: rotate(0) } 30% { transform: rotate(-18deg) translateY(-6px) } 60% { transform: rotate(14deg) } 100% { transform: rotate(0) } }
@media (prefers-reduced-motion: reduce) { .dice.roll .die { animation: none } .tok { transition: none } }
.evcard { background: #fffaee; color: #1d1a16; border: 2px solid #1d1a16; border-radius: 10px; padding: clamp(6px, 1.4vw, 14px); max-width: 92%; box-shadow: 0 4px 0 #1d1a16; font-size: clamp(10px, 1.7vw, 15px); line-height: 1.3 }
.evcard:empty { display: none }
.evcard .t { font: 400 clamp(9px, 1.4vw, 13px)/1.2 Bungee, sans-serif; margin-bottom: 3px }
.evcard.good .t { color: #1d7a45 } .evcard.bad .t { color: #b3202b }
.round { font-size: clamp(9px, 1.4vw, 13px); opacity: .85 }

/* ---------- panel ---------- */
.panel { display: grid; gap: 12px; align-content: start }
.box, .turnbox, .tileinfo { background: var(--paper); border: 2px solid var(--line); border-radius: 14px; padding: 14px; box-shadow: 0 4px 0 var(--shadow) }
.tileinfo:empty { display: none }
.turnbox .who { display: flex; align-items: center; gap: 10px }
.turnbox .who .dot { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line); flex: none }
.turnbox .nm { font: 400 22px/1.1 Bungee, sans-serif }
.turnbox .cash { font-size: 15px; color: var(--muted); font-variant-numeric: tabular-nums }
.turnbox .note { margin: 10px 0 0; font-weight: 500 }
.turnbox .warn { color: var(--bad) }
.tileinfo .hd { display: flex; align-items: center; gap: 10px; margin-bottom: 8px }
.tileinfo .sw { width: 16px; height: 34px; border-radius: 4px; border: 2px solid var(--line); flex: none }
.tileinfo .ttl { font-weight: 700; font-size: 18px; line-height: 1.2 }
.tileinfo .meta { font-size: 14px; color: var(--muted) }
.rent { width: 100%; border-collapse: collapse; font-size: 14px }
.rent td { padding: 3px 0; border-bottom: 1px dashed light-dark(#1d1a1630, #ffffff20) }
.rent td:last-child { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap }
.rent tr.on td { font-weight: 700; color: var(--red) }
.players { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px }
.players li { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 10px }
.players li.now { background: var(--paper2) }
.players li.out { opacity: .45; text-decoration: line-through }
.players .n { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.players .s { font-size: 12px; color: var(--muted) }
.players .c { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; grid-column: 2 / 4 }
.chip { border: 0; border-left: 6px solid var(--g); background: var(--paper2); padding: 2px 6px; font-size: 12px; border-radius: 4px; cursor: pointer }
.chip.m { text-decoration: line-through; opacity: .6 }
.log { margin: 0; padding: 0 0 0 18px; font-size: 14px; display: grid; gap: 4px; max-height: 220px; overflow-y: auto }
.log li:first-child { font-weight: 700 }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; background: #0008; display: grid; place-items: center; padding: 16px; z-index: 50 }
.sheet { background: var(--paper); border: 2px solid var(--line); border-radius: 14px; padding: 18px; max-width: 380px; width: 100%; box-shadow: 0 6px 0 var(--shadow) }
.sheet p { margin: 0 0 14px; font-weight: 500 }

@media (max-width: 600px) {
  #game { padding: 6px }
  .board { border-width: 2px; box-shadow: 0 3px 0 var(--shadow) }
  .tile .pr { display: none }
  .box, .turnbox, .tileinfo { padding: 12px }
}
