/* Tata letak bersama untuk layar game: menu pemilih karakter, papan + panel, layar menang. */
/* ---------- Menu ---------- */
#setup { max-width: 960px; margin: 0 auto; padding: 20px 16px 48px; text-align: center; }
.setup-top { display: flex; justify-content: flex-start; margin-bottom: 8px; }
.sub { font-size: 1.1rem; margin: 18px 0; font-weight: 500; }
.pick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 26px; }
@media (max-width: 760px) { .pick { grid-template-columns: repeat(2, 1fr); gap: 16px; } }

.pc { position: relative; padding: 16px 10px 14px; transition: transform 0.15s; display: flex; flex-direction: column; align-items: center; }
.pc.off { opacity: 0.55; }
.pc.off .art { filter: grayscale(0.7); }
.pc-toggle {
  all: unset; cursor: pointer; display: flex; flex-direction: column; align-items: center; width: 100%;
  border-radius: 14px;
}
.pc-toggle:focus-visible { outline: 4px solid #4fa8ff; outline-offset: 4px; }
.pc:hover { transform: translateY(-3px) rotate(-1deg); }
.pc .art { width: 104px; height: 104px; }
.pc.on .art { animation: wob 2.4s ease-in-out infinite; }
.pc h3 { margin: 6px 0 0; font-size: 1.5rem; }
.pc p { margin: 2px 0 10px; font-size: 0.95rem; }
.chk {
  position: absolute; top: -14px; right: -12px; width: 40px; height: 40px; border-radius: 50%;
  border: 3px solid var(--ink); background: #fff; display: grid; place-items: center; color: var(--ink);
}
.pc.on .chk { background: #3fae3d; color: #fff; }
.seg { display: inline-flex; border: 3px solid var(--ink); border-radius: 12px; overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 0.4em 0.75em; min-height: 44px; font-weight: 600; font-size: 0.92rem; }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.btn.big { font-size: 1.35rem; padding: 0.6em 2.2em; }
.hint { min-height: 1.4em; margin: 12px 0 0; font-weight: 500; color: #b8322a; }
.rules { max-width: 620px; margin: 18px auto 0; text-align: left; padding: 16px 24px; }
.rules h2 { margin: 0 0 6px; font-size: 1.25rem; }
.rules ul { margin: 0; padding-left: 22px; line-height: 1.6; font-weight: 500; }

/* ---------- Permainan ---------- */
#game {
  display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px;
  max-width: 1200px; margin: 0 auto; padding: 20px 16px 32px; align-items: start;
}
.board-wrap { padding: 8px; width: 100%; max-width: calc(100vh - 48px); justify-self: center; }
#board { width: 100%; height: auto; display: block; }
.panel { display: flex; flex-direction: column; gap: 16px; }
.topbar { display: flex; justify-content: space-between; gap: 8px; }
.turnbox { padding: 16px 18px; }
.turn { display: flex; align-items: center; gap: 12px; }
.turn-art .art { width: 76px; height: 76px; display: block; animation: wob 1.6s ease-in-out infinite; }
.turn-label { font-size: 0.9rem; font-weight: 500; }
#turnName { font-size: 1.8rem; font-weight: 700; line-height: 1.05; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; }
#turnName .tag { font-size: 0.8rem; font-weight: 600; color: var(--ink); border: 2px solid var(--ink); border-radius: 8px; padding: 0 0.45em; background: #fff; }
.bubble {
  position: relative; margin-top: 14px; background: #fff; border: 3px solid var(--ink);
  border-radius: 16px; padding: 10px 14px; font-weight: 500; font-size: 1.05rem; min-height: 3.1em;
}
.bubble::before { content: ""; position: absolute; top: -12px; left: 28px; border: 10px solid transparent; border-bottom-color: var(--ink); border-top: 0; }
.bubble::after { content: ""; position: absolute; top: -7px; left: 30px; border: 8px solid transparent; border-bottom-color: #fff; border-top: 0; }
.bubble.pop { animation: pop 0.3s ease; }
.dice-row { display: flex; align-items: center; gap: 14px; margin-top: 16px; }
.dice {
  width: 76px; height: 76px; flex: none; background: #fff; border: 4px solid var(--ink); border-radius: 18px;
  box-shadow: 0 5px 0 var(--ink); display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); padding: 9px; gap: 2px;
}
.dice i { width: 13px; height: 13px; border-radius: 50%; place-self: center; }
.dice i.on { background: var(--ink); }
.dice.shake { animation: shake 0.12s linear infinite; }
#rollBtn { flex: 1; font-size: 1.25rem; }

.players { list-style: none; margin: 0; padding: 10px; display: flex; flex-direction: column; gap: 2px; }
.players li { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 14px; border: 3px solid transparent; }
.players li.act { border-color: var(--ink); background: var(--tint); }
.players .art { width: 44px; height: 44px; flex: none; }
.players .nm { font-weight: 700; font-size: 1.15rem; }
.players .tag { font-size: 0.75rem; font-weight: 600; border: 2px solid var(--ink); border-radius: 8px; padding: 0 0.4em; margin-left: 6px; background: #fff; vertical-align: 2px; }
.players .pos {
  margin-left: auto; font-weight: 700; font-size: 1.1rem; background: #fff; border: 3px solid var(--ink);
  border-radius: 12px; padding: 0.1em 0.55em; min-width: 2.8em; text-align: center;
}
.legend { padding: 12px 16px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; font-size: 0.92rem; font-weight: 500; }
.legend div { display: flex; align-items: center; gap: 8px; }

@media (max-width: 880px) {
  #game { grid-template-columns: 1fr; gap: 14px; padding: 10px 10px 28px; }
  .board-wrap { max-width: none; padding: 4px; border-radius: 18px; }
  .panel { gap: 12px; }
  .topbar { order: -1; }
  .turnbox { padding: 12px 14px; }
  .turn-art .art { width: 56px; height: 56px; }
  #turnName { font-size: 1.4rem; }
  .dice { width: 62px; height: 62px; padding: 7px; }
  .dice i { width: 11px; height: 11px; }
  .players { flex-direction: row; padding: 6px; gap: 4px; }
  .players li { flex: 1; flex-direction: column; gap: 2px; padding: 6px 2px; text-align: center; }
  .players .art { width: 40px; height: 40px; }
  .players .nm { font-size: 0.9rem; }
  .players .tag { display: none; }
  .players .pos { margin: 0; font-size: 0.85rem; border-width: 2px; border-radius: 8px; min-width: 2.4em; }
  .legend { display: none; }
}
@media (max-width: 880px) {
  /* papan dulu, lalu panel; tombol menu/suara di atas papan */
  #game { display: flex; flex-direction: column; align-items: stretch; }
  .topbar { order: 0; }
  .board-wrap { order: 1; }
  .panel { display: contents; }
  .turnbox { order: 2; }
  .players { order: 3; }
}

/* ---------- Menang ---------- */
.overlay { position: fixed; inset: 0; background: rgba(43, 33, 64, 0.6); display: grid; place-items: center; z-index: 10; padding: 16px; }
.winbox { text-align: center; padding: 24px 22px; max-width: 380px; width: 100%; animation: pop 0.45s ease; }
.win-art { width: 160px; height: 160px; margin: 0 auto; border-radius: 50%; border: 4px solid var(--ink); display: grid; place-items: center; }
.win-art .art { width: 138px; height: 138px; animation: jump 0.7s ease-in-out infinite alternate; }
.winbox h2 { font-size: 2.2rem; margin: 10px 0 2px; }
.winbox p { margin: 0 0 12px; font-weight: 500; }
.rank { list-style: none; margin: 0 0 16px; padding: 4px; background: #fff; border: 3px solid var(--ink); border-radius: 16px; text-align: left; }
.rank li { display: flex; align-items: center; gap: 10px; padding: 4px 8px; }
.rank .no { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--ink); display: grid; place-items: center; font-weight: 700; font-size: 0.95rem; flex: none; }
.rank li:first-child .no { background: var(--gold); }
.rank .art { width: 36px; height: 36px; flex: none; }
.rank .nm { font-weight: 700; }
.rank .at { margin-left: auto; font-weight: 600; font-size: 0.95rem; }
.winbox .row { display: flex; gap: 10px; }
.winbox .row .btn { flex: 1; padding: 0.6em 0.5em; }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 11; }
