:root {
  --navy: #1e2a5a;
  --navy-2: #2b3a7a;
  --blue: #3b5bdb;
  --blue-soft: #e7ecff;
  --yellow: #fcc419;
  --yellow-d: #e8a800;
  --green: #2f9e44;
  --green-l: #40c057;
  --orange: #f76707;
  --purple: #7c4dff;
  --red: #e03131;
  --bg: #eef1fb;
  --card: #ffffff;
  --ink: #1e2a5a;
  --muted: #6b7394;
  --line: #dfe4f5;
  --radius: 18px;
  --shadow: 0 6px 0 rgba(30, 42, 90, .08), 0 10px 30px rgba(30, 42, 90, .08);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: Nunito, system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  overflow: hidden;
  overscroll-behavior: none;
}
h1, h2, h3, h4 { font-family: "Baloo 2", Nunito, sans-serif; margin: 0; line-height: 1.1; }
button { font: inherit; color: inherit; cursor: pointer; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.spacer { flex: 1; }
.hint { font-size: 13px; color: var(--muted); margin: 8px 0 0; text-align: center; }

/* ---------- screens ---------- */
#app { height: 100%; }
.screen { display: none; height: 100%; overflow-y: auto; padding: calc(16px + var(--safe-t)) 16px calc(16px + var(--safe-b)); }
.screen.active { display: block; animation: fadeIn .3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card.dark { background: var(--navy); color: #fff; }

/* ---------- buttons ---------- */
.btn {
  border: 0; border-radius: 14px; padding: 13px 18px; min-height: 48px;
  font-weight: 800; font-size: 17px; letter-spacing: .2px;
  background: var(--blue-soft); color: var(--navy);
  box-shadow: 0 4px 0 rgba(0, 0, 0, .15); transition: transform .08s, box-shadow .08s, opacity .2s;
}
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0, 0, 0, .15); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--blue); color: #fff; box-shadow: 0 4px 0 #2a44b0; }
.btn-yellow { background: var(--yellow); color: var(--navy); box-shadow: 0 4px 0 var(--yellow-d); }
.btn-green { background: var(--green-l); color: #fff; box-shadow: 0 4px 0 #2b8a3e; }
.btn-orange { background: var(--orange); color: #fff; box-shadow: 0 4px 0 #c2410c; }
.btn-red { background: #fff0f0; color: var(--red); box-shadow: 0 4px 0 #ffc9c9; }
.btn-ghost { background: #fff; color: var(--navy); box-shadow: 0 4px 0 var(--line); border: 2px solid var(--line); }
.btn-block { width: 100%; display: block; margin-top: 12px; }
.btn-xl { font-size: 20px; padding: 18px 26px; min-height: 60px; }
.btn-sm { font-size: 14px; min-height: 38px; padding: 8px 14px; border-radius: 12px; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 0; background: #fff; box-shadow: var(--shadow); font-size: 18px; }
.back { position: absolute; left: 14px; top: 14px; width: 40px; height: 40px; border-radius: 12px; border: 0; background: var(--blue-soft); font-size: 20px; font-weight: 800; }

/* ---------- chips ---------- */
.chip-type { display: inline-block; padding: 4px 10px; border-radius: 99px; font-weight: 800; font-size: 13px; }
.t-grammar { background: #e3edff; color: #2f6fe4; }
.t-vocab { background: #e2f7e6; color: #2b8a3e; }
.t-speaking { background: #efe7ff; color: #6f3ff5; }
.t-prank { background: #fff0e3; color: #e8590c; }
.t-start { background: #fff4c2; color: #a37800; }
.t-jail { background: #eceff3; color: #5c6370; }
.chip-soft { padding: 4px 10px; border-radius: 99px; background: var(--blue-soft); font-weight: 700; font-size: 13px; }
.pill { background: #fff; border-radius: 99px; padding: 6px 12px; font-weight: 800; font-size: 13px; box-shadow: 0 2px 0 var(--line); white-space: nowrap; }
.badge { font-size: 12px; font-weight: 800; padding: 4px 10px; border-radius: 99px; background: #f1f3f9; color: var(--muted); }
.badge.ok { background: #d3f9d8; color: #2b8a3e; }
.tag { font-size: 10px; background: #eceff3; color: #5c6370; padding: 1px 6px; border-radius: 99px; font-weight: 800; vertical-align: middle; }

/* ---------- avatar ---------- */
.avatar { width: 40px; height: 40px; border-radius: 50%; background: color-mix(in srgb, var(--c, #ccc) 22%, #fff); border: 3px solid var(--c, #ccc); object-fit: cover; flex: none; display: inline-grid; place-items: center; }
.avatar { position: relative; overflow: hidden; font-size: 22px; line-height: 1; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { font-size: 30px; }
.avatar.sm { width: 30px; height: 30px; border-width: 2px; }
.avatar.lg { width: 52px; height: 52px; }
.avatar.xl { width: 150px; height: 150px; border-width: 5px; font-size: 84px; }

/* ---------- home ---------- */
#s-home { background: radial-gradient(1200px 600px at 50% -10%, #c8d3ff 0%, var(--bg) 60%); }
.home-wrap { max-width: 1040px; margin: 0 auto; display: grid; gap: 20px; padding-top: 8px; }
.hero { text-align: center; padding: 20px 0 0; }
.hero-badge { display: inline-block; background: #fff; border-radius: 99px; padding: 6px 14px; font-weight: 800; font-size: 13px; color: var(--blue); box-shadow: 0 2px 0 var(--line); }
.logo { font-size: 46px; color: var(--navy); margin: 14px 0 8px; letter-spacing: -.5px; }
.logo span { color: var(--blue); font-size: 52px; }
.lead { font-size: 17px; max-width: 460px; margin: 0 auto 20px; line-height: 1.5; color: #3f4870; }
.hero-actions { display: grid; gap: 14px; max-width: 360px; margin: 0 auto; }
.hero-chars { display: flex; justify-content: center; gap: 4px; margin-top: 22px; flex-wrap: wrap; }
.hero-char { animation: bob 2s ease-in-out infinite; animation-delay: calc(var(--i) * .15s); }
.hero-char .avatar { width: 54px; height: 54px; }
@keyframes bob { 50% { transform: translateY(-8px); } }
.howto h2 { font-size: 22px; margin-bottom: 8px; }
.howto ol { padding-left: 20px; margin: 0; line-height: 1.6; }
.howto li { margin: 6px 0; }
.legend { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.link-guru { display: inline-block; margin-top: 14px; color: var(--blue); font-weight: 800; text-decoration: none; }

/* ---------- forms ---------- */
#s-create, #s-join { display: none; }
#s-create.active, #s-join.active { display: grid; place-items: center; }
.form-card { position: relative; width: 100%; max-width: 440px; padding: 26px 20px 22px; }
.form-card h2 { text-align: center; font-size: 28px; }
.form-card > .muted { text-align: center; margin: 4px 0 10px; }
.field-label { display: block; font-weight: 800; font-size: 14px; margin: 14px 0 6px; }
.input { width: 100%; font: inherit; font-size: 17px; padding: 12px 14px; border-radius: 12px; border: 2px solid var(--line); background: #f8f9fe; color: var(--ink); min-height: 48px; }
.input:focus { outline: none; border-color: var(--blue); background: #fff; }
.seg { display: flex; gap: 6px; background: #f1f3fb; padding: 5px; border-radius: 14px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 10px 6px; border-radius: 10px; font-weight: 800; font-size: 14px; color: var(--muted); min-height: 42px; }
.seg button.on { background: #fff; color: var(--blue); box-shadow: 0 2px 0 var(--line); }
.code-input { display: flex; gap: 8px; justify-content: center; margin: 18px 0 6px; }
.code-input input { width: 46px; height: 58px; text-align: center; font: 800 28px "Baloo 2", sans-serif; border-radius: 12px; border: 2px solid var(--line); background: #f8f9fe; color: var(--navy); }
.code-input input:focus { outline: none; border-color: var(--yellow-d); background: #fffbea; }

/* ---------- lobby ---------- */
.lobby { max-width: 1000px; margin: 0 auto; }
.lobby-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.lobby-head .back { position: static; }
.lobby-head > div { flex: 1; }
.room-code { font: 800 34px "Baloo 2", sans-serif; letter-spacing: 3px; color: var(--blue); line-height: 1; }
.lobby-grid { display: grid; gap: 14px; }
.profile h3, .plist h3 { font-size: 20px; margin-bottom: 8px; }
.stage-wrap { position: relative; height: 230px; margin: 0 -6px; background: radial-gradient(circle at 50% 70%, #fff7d6, #f3f5ff 70%); border-radius: 16px; overflow: hidden; }
.stage-wrap canvas { width: 100%; height: 100%; display: block; touch-action: pan-y; }
.stage-fallback { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.stage-fallback:empty { display: none; }
.stage-fallback .taken { filter: grayscale(1); opacity: .6; }
.nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; border: 0; background: #fff; font-size: 28px; font-weight: 800; box-shadow: var(--shadow); z-index: 2; color: var(--navy); }
.nav.prev { left: 10px; } .nav.next { right: 10px; }
.char-name { text-align: center; margin-top: 10px; font-size: 20px; font-family: "Baloo 2"; }
.char-trait { text-align: center; }
.char-dots { display: flex; justify-content: center; gap: 6px; margin: 8px 0 2px; }
.char-dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); opacity: .35; }
.char-dots i.on { opacity: 1; transform: scale(1.3); }
.char-dots i.taken { background: #adb5bd; }
#lobby-players { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
#lobby-players li { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; background: #f7f8fd; }
#lobby-players li.offline { opacity: .5; }
.pl-text { flex: 1; display: grid; min-width: 0; }
.pl-text b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.host-box { margin-top: 14px; padding-top: 14px; border-top: 2px dashed var(--line); }
body.screen-host .lobby-grid { grid-template-columns: 1fr !important; }
body.screen-host .room-code { font-size: 56px; }

/* ---------- game ---------- */
#s-game { padding: 0; overflow: hidden; }
#s-game.active { display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 6px; padding: calc(8px + var(--safe-t)) 12px 8px; flex: none; min-height: 56px; }
.money { background: var(--navy); color: #fff; box-shadow: none; }
.game-body { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.board-wrap {
  position: relative; flex: none; height: 52vh; margin: 0 10px; border-radius: 22px; overflow: hidden;
  background: linear-gradient(180deg, #8fd3ff 0%, #c9ecff 55%, #eaf7ff 100%);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .6), var(--shadow);
}
#board { width: 100%; height: 100%; display: block; touch-action: none; }
#board2d { display: none; }
body[data-board="2d"] #board { display: none; }
body[data-board="2d"] #board2d { display: grid; }
body[data-board="2d"] .board-wrap { background: var(--navy); }
.float-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.floater { position: absolute; transform: translate(-50%, -50%); font: 800 24px "Baloo 2", sans-serif; animation: floatUp 1.8s ease-out forwards; text-shadow: 0 2px 0 #fff, 0 0 6px #fff; white-space: nowrap; }
.floater.plus { color: var(--green); } .floater.minus { color: var(--red); } .floater.money { color: #b8860b; }
.floater.emoji { font-size: 34px; text-shadow: none; }
@keyframes floatUp { 0% { opacity: 0; transform: translate(-50%, -20%) scale(.6); } 15% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); } 100% { opacity: 0; transform: translate(-50%, -260%) scale(1); } }
.dice-total { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%) scale(.3); opacity: 0; font: 800 84px "Baloo 2", sans-serif; color: #fff; text-shadow: 0 5px 0 var(--navy), 0 0 30px rgba(30, 42, 90, .5); pointer-events: none; transition: .3s cubic-bezier(.3, 1.6, .5, 1); text-align: center; line-height: .9; }
.dice-total small { display: block; font-size: 24px; color: var(--yellow); }
.dice-total.on { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.skip { position: absolute; right: 10px; bottom: 10px; opacity: 0; pointer-events: none; transition: opacity .2s; }
.skip.on { opacity: 1; pointer-events: auto; }
.banner { position: absolute; left: 50%; top: 12px; transform: translate(-50%, -80px); background: var(--yellow); color: var(--navy); font-weight: 800; padding: 8px 16px; border-radius: 99px; transition: transform .35s cubic-bezier(.3, 1.5, .5, 1); box-shadow: 0 4px 0 var(--yellow-d); white-space: nowrap; }
.banner.on { transform: translate(-50%, 0); }

.side { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; padding: 10px 10px calc(10px + var(--safe-b)); overflow-y: auto; }
.turn-card { display: none; align-items: center; gap: 12px; padding: 12px 14px; }
.turn-text { flex: 1; min-width: 0; }
.turn-name { font: 800 22px "Baloo 2", sans-serif; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ring { position: relative; width: 44px; height: 44px; flex: none; }
.ring.big { width: 54px; height: 54px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 4.5; }
.ring .track { stroke: #eef0f8; }
.ring .bar { stroke: var(--green-l); stroke-linecap: round; transition: stroke-dashoffset .25s linear, stroke .3s; }
.ring.urgent .bar { stroke: var(--red); }
.ring span { position: absolute; inset: 0; display: grid; place-items: center; font: 800 17px "Baloo 2"; }
.ring.big span { font-size: 21px; }
.ring.urgent span { color: var(--red); animation: beat .5s infinite; }
@keyframes beat { 50% { transform: scale(1.15); } }

.action { display: grid; grid-template-columns: auto 1fr; grid-template-areas: "dice text" "btn btn" "hint hint" "ov ov"; align-items: center; gap: 4px 14px; padding: 14px 16px; touch-action: none; }
.action-dice { grid-area: dice; display: flex; gap: 6px; }
.die { width: 42px; height: 42px; border-radius: 10px; background: #fff; color: var(--navy); display: grid; place-items: center; font-size: 44px; line-height: 1; }
.action-text { grid-area: text; font-weight: 800; font-size: 17px; }
.action-text .hl { color: var(--yellow); font-size: 22px; }
.btn-roll { grid-area: btn; margin-top: 8px; font-size: 19px; }
.btn-roll.pulse { animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 4px 0 var(--yellow-d), 0 0 0 8px rgba(252, 196, 25, .3); } }
.swipe-hint { grid-area: hint; text-align: center; font-size: 12px; opacity: .7; }
.host-override { grid-area: ov; }

.players-card h4, .log-card h4 { font-size: 17px; margin-bottom: 8px; }
.players-card { padding: 12px; }
.players { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 2px; }
.pchip { scroll-snap-align: start; flex: none; display: grid; grid-template-columns: auto auto; grid-template-areas: "av name" "av stats"; column-gap: 8px; align-items: center; padding: 6px 12px 6px 6px; border-radius: 99px; background: #f4f6fc; border: 2px solid transparent; }
.pchip .avatar { grid-area: av; width: 36px; height: 36px; }
.pc-name { grid-area: name; font-weight: 800; font-size: 14px; white-space: nowrap; }
.pc-money, .pc-pts { font-size: 12px; font-weight: 700; color: var(--muted); }
.pc-money { grid-area: stats; }
.pc-pts { grid-area: stats; margin-left: 58px; }
.pchip.turn { background: #fff6d1; border-color: var(--yellow); }
.pchip.offline { opacity: .5; }
.log-card { display: none; }
.log { list-style: none; margin: 0; padding: 0; font-size: 14px; display: grid; gap: 6px; }
.log li:first-child { font-weight: 800; }
.reactions { display: flex; justify-content: center; gap: 6px; }
.reactions button { border: 0; background: #fff; width: 44px; height: 44px; border-radius: 50%; font-size: 21px; box-shadow: 0 3px 0 var(--line); }
.reactions button:active { transform: scale(.9); }
body.screen-host .reactions { display: none; }

/* ---------- sheet soal ---------- */
.sheet { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; justify-content: center; pointer-events: none; visibility: hidden; transition: visibility 0s .4s; }
.sheet.on { visibility: visible; transition: none; }
.sheet::before { content: ""; position: absolute; inset: 0; background: rgba(30, 42, 90, .35); opacity: 0; transition: opacity .3s; }
.sheet.on { pointer-events: auto; }
.sheet.on::before { opacity: 1; }
.sheet-inner { position: relative; width: 100%; max-width: 640px; max-height: 70vh; overflow-y: auto; background: #fff; border-radius: 26px 26px 0 0; padding: 10px 18px calc(18px + var(--safe-b)); transform: translateY(105%); transition: transform .4s cubic-bezier(.2, 1.1, .4, 1); box-shadow: 0 -10px 40px rgba(30, 42, 90, .2); }
.sheet.on .sheet-inner { transform: none; }
.sheet.type-grammar .sheet-inner { border-top: 6px solid #4c8dff; }
.sheet.type-vocab .sheet-inner { border-top: 6px solid var(--green-l); }
.sheet.type-speaking .sheet-inner { border-top: 6px solid var(--purple); }
.grip { width: 44px; height: 5px; border-radius: 9px; background: var(--line); margin: 0 auto 10px; }
.q-head { display: flex; align-items: center; gap: 8px; }
.q-who { margin-top: 6px; }
.q-prompt { font-weight: 800; margin-top: 10px; color: #4a5378; font-size: 15px; }
.q-text { font: 800 26px/1.25 "Baloo 2", sans-serif; margin: 4px 0 14px; }
.q-text .blank { color: var(--blue); }
.q-choices { display: grid; gap: 10px; }
.choice { display: flex; align-items: center; gap: 12px; text-align: left; border: 2px solid var(--line); background: #f8f9ff; border-radius: 14px; padding: 12px 14px; font-weight: 800; font-size: 18px; min-height: 54px; transition: .15s; }
.choice:not(:disabled):active { transform: scale(.98); }
.choice .key { width: 30px; height: 30px; flex: none; display: grid; place-items: center; background: #fff; border-radius: 9px; font-size: 14px; box-shadow: 0 2px 0 var(--line); }
.choice.picked { border-color: var(--blue); background: var(--blue-soft); }
.choice.right { border-color: var(--green-l); background: #d3f9d8; color: #1b6b2e; animation: pop .4s; }
.choice.wrong { border-color: var(--red); background: #ffe3e3; color: #a61e1e; animation: shake .4s; }
.choice:disabled { cursor: default; }
.choice:disabled:not(.right):not(.wrong):not(.picked) { opacity: .75; }
@keyframes pop { 50% { transform: scale(1.04); } }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.q-speak { display: grid; justify-items: center; gap: 12px; }
.mic { width: 96px; height: 96px; border-radius: 50%; border: 0; font-size: 42px; background: var(--purple); color: #fff; box-shadow: 0 6px 0 #5a2fd1; }
.mic.rec { background: var(--red); box-shadow: 0 6px 0 #a61e1e, 0 0 0 0 rgba(224, 49, 49, .5); animation: rec 1.2s infinite; }
@keyframes rec { 70% { box-shadow: 0 6px 0 #a61e1e, 0 0 0 22px rgba(224, 49, 49, 0); } }
.transcript { font-weight: 700; text-align: center; color: #4a5378; min-height: 22px; }
.type-fallback { display: flex; gap: 8px; width: 100%; }
.q-result { display: none; margin-top: 12px; padding: 12px 14px; border-radius: 14px; font-weight: 800; font-size: 17px; text-align: center; }
.q-result.on { display: grid; gap: 6px; justify-items: center; animation: pop .4s; }
.q-result.ok { background: #d3f9d8; color: #1b6b2e; }
.q-result.bad { background: #fff0f0; color: #a61e1e; }
.q-foot { text-align: center; margin-top: 12px; }

/* ---------- modal kartu & penjara ---------- */
.modal { position: fixed; inset: 0; z-index: 30; display: none; place-items: center; background: rgba(30, 42, 90, .5); padding: 16px; perspective: 1000px; }
.modal.on { display: grid; animation: fadeIn .2s; }
.card3d { position: relative; width: min(290px, 80vw); aspect-ratio: 5 / 7; transform-style: preserve-3d; transition: transform .6s cubic-bezier(.3, 1.3, .5, 1); transform: translateY(-40px) rotateY(0) scale(.7); animation: lift .45s ease-out; }
@keyframes lift { from { transform: translateY(160px) rotateX(70deg) scale(.4); opacity: 0; } }
.card3d.flipped { transform: rotateY(180deg) scale(1); }
.card3d.fly { transform: rotateY(180deg) translateY(200px) scale(.2); opacity: 0; transition: .4s ease-in; }
.face { position: absolute; inset: 0; border-radius: 22px; backface-visibility: hidden; display: grid; place-items: center; align-content: center; padding: 22px; text-align: center; box-shadow: 0 16px 40px rgba(0, 0, 0, .3); border: 6px solid #fff; }
.face.back { color: #fff; gap: 10px; }
.face.back span { font-size: 90px; line-height: 1; }
.face.back b { font: 800 22px/1.1 "Baloo 2"; }
.face.front { transform: rotateY(180deg); background: #fff; gap: 6px; }
.modal.chance .face.back { background: var(--green); }
.modal.prank .face.back { background: var(--orange); }
.card-kind { font-weight: 800; font-size: 13px; letter-spacing: 1px; text-transform: uppercase; padding: 4px 12px; border-radius: 99px; }
.modal.chance .card-kind { background: #d3f9d8; color: var(--green); }
.modal.prank .card-kind { background: #ffe8d6; color: var(--orange); }
.modal.chance .face.front { border-color: var(--green-l); }
.modal.prank .face.front { border-color: var(--orange); }
.card-art { font-size: 72px; line-height: 1.1; }
.face.front h3 { font-size: 26px; }
.face.front p { margin: 0; font-weight: 800; font-size: 18px; color: #4a5378; }
.particles { position: absolute; left: 50%; top: 50%; pointer-events: none; }
.particles i { position: absolute; font-style: normal; font-size: 22px; animation: burst var(--d) ease-out forwards; }
@keyframes burst { from { transform: translate(0, 0) scale(.3); opacity: 1; } to { transform: translate(var(--x), var(--y)) scale(1.2) rotate(180deg); opacity: 0; } }
.jail-card { width: min(380px, 100%); text-align: center; border-top: 8px solid #868e96; }
.jail-icon { font-size: 60px; animation: clank .5s; }
@keyframes clank { 0% { transform: translateY(-40px) scale(1.4); } 60% { transform: translateY(4px); } }
.jail-card h3 { font-size: 26px; margin: 6px 0 2px; }

/* ---------- hasil ---------- */
#s-result { background: radial-gradient(900px 500px at 50% 0%, #c8d3ff, var(--bg) 70%); position: relative; }
.result { max-width: 560px; margin: 0 auto; }
.result-head { text-align: center; margin: 8px 0 12px; }
.kicker { font-weight: 800; letter-spacing: 2px; font-size: 13px; color: var(--blue); }
.result-head h1 { font-size: 38px; }
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 8px; margin: 10px 0 16px; }
.pod { flex: 1; max-width: 150px; text-align: center; }
.crown { font-size: 30px; animation: bob 1.5s infinite; }
.pod-av { display: grid; place-items: center; }
.pod-av.dance { animation: dance 1s ease-in-out infinite; }
.pod-2 .pod-av { animation-delay: .2s; } .pod-3 .pod-av { animation-delay: .4s; }
@keyframes dance { 25% { transform: rotate(-10deg) translateY(-6px); } 75% { transform: rotate(10deg) translateY(-6px); } }
.pod-name { font-weight: 800; margin: 4px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pod-block { border-radius: 14px 14px 0 0; display: grid; align-content: start; padding-top: 10px; font-family: "Baloo 2"; }
.pod-block b { font-size: 38px; line-height: 1; }
.pod-1 .pod-block { height: 150px; background: var(--yellow); }
.pod-2 .pod-block { height: 110px; background: #d0d8ff; }
.pod-3 .pod-block { height: 80px; background: #ffe2c6; }
.rank-card h3 { font-size: 20px; margin-bottom: 6px; }
.rank { width: 100%; border-collapse: collapse; }
.rank th { text-align: left; font-size: 13px; color: var(--muted); padding: 6px 4px; }
.rank td { padding: 8px 4px; border-top: 1px solid var(--line); vertical-align: middle; }
.rank td:nth-child(2) { display: flex; gap: 8px; align-items: center; }
.rank tr.me td { background: #fff8db; }
.result-actions { margin-top: 6px; padding-bottom: 16px; }
.confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 16px; border-radius: 3px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

/* ---------- menu & toast ---------- */
.drawer { position: fixed; inset: 0; z-index: 40; background: rgba(30, 42, 90, .4); display: none; padding: 16px; }
.drawer.on { display: grid; place-items: center; }
.drawer-panel { width: min(420px, 100%); max-height: 90vh; overflow-y: auto; }
.toggle { display: flex; align-items: center; gap: 10px; font-weight: 800; margin: 16px 0 6px; }
.toggle input { width: 22px; height: 22px; }
.rules { margin: 10px 0; }
.rules summary { font-weight: 800; cursor: pointer; padding: 8px 0; }
.mini { width: 100%; font-size: 13px; border-collapse: collapse; }
.mini th, .mini td { border-bottom: 1px solid var(--line); padding: 6px 4px; text-align: left; }
.toast { position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translate(-50%, 200px); opacity: 0; background: var(--navy); color: #fff; padding: 12px 18px; border-radius: 14px; font-weight: 800; z-index: 60; transition: transform .3s; max-width: calc(100% - 32px); text-align: center; }
.toast.on { transform: translate(-50%, 0); opacity: 1; }

/* ---------- papan 2D cadangan ---------- */
.board2d { position: absolute; inset: 8px; margin: auto; aspect-ratio: 1; max-height: calc(100% - 16px); max-width: calc(100% - 16px); grid-template: repeat(11, 1fr) / repeat(11, 1fr); gap: 2px; }
.t2 { border-radius: 5px; display: grid; place-items: center; align-content: center; font-weight: 800; font-size: clamp(7px, 1.6vmin, 13px); line-height: 1; border: 1.5px solid; }
.t2 i { font-style: normal; font-size: .8em; }
.t2.t-grammar { border-color: #a5c4ff; } .t2.t-vocab { border-color: #a8e6b4; } .t2.t-speaking { border-color: #cdb8ff; } .t2.t-prank { border-color: #ffc59e; }
.t2.t-start { background: var(--yellow); border-color: var(--yellow-d); font-size: clamp(6px, 1.3vmin, 11px); } .t2.t-jail { border-color: #ced4da; font-size: clamp(5px, 1.1vmin, 10px); }
.t2.mark { animation: blink .4s infinite alternate; }
@keyframes blink { to { box-shadow: 0 0 0 3px var(--yellow); transform: scale(1.1); } }
.b2-center { grid-area: 2 / 2 / 11 / 11; background: #f5f7ff; border-radius: 10px; display: grid; place-items: center; align-content: center; gap: 8px; text-align: center; padding: 6px; }
.b2-center h3 { font-size: clamp(14px, 4vmin, 30px); }
.b2-center h3 span { color: var(--blue); }
.die2 { font-size: clamp(30px, 8vmin, 60px); line-height: 1; }
.b2-legend { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; }
.lg { font-size: clamp(8px, 1.6vmin, 12px); font-weight: 800; padding: 2px 6px; border-radius: 99px; }
.lg.g { background: #e3edff; } .lg.v { background: #e2f7e6; } .lg.s { background: #efe7ff; } .lg.p { background: #fff0e3; }
.pawn2 { position: absolute; transform: translate(-50%, -50%); font-size: clamp(14px, 3.6vmin, 24px); transition: left .25s, top .25s; filter: drop-shadow(0 0 0 var(--c)) drop-shadow(0 2px 2px rgba(0, 0, 0, .4)); z-index: 2; }
.pawn2.turn { font-size: clamp(18px, 4.4vmin, 30px); z-index: 3; }
.pawn2.jailed { filter: grayscale(.7); }
.pawn2[data-anim="happy"] { animation: hop .3s 4; }
.pawn2[data-anim="sad"] { animation: shake .4s 2; }
.pawn2[data-anim="surprise"] { animation: pop .4s 2; }
@keyframes hop { 50% { transform: translate(-50%, -90%); } }

/* ---------- tablet & desktop ---------- */
@media (min-width: 600px) {
  .lobby-grid { grid-template-columns: 1.1fr 1fr; align-items: start; }
  .board-wrap { height: 56vh; }
  .code-input input { width: 56px; height: 66px; }
}
@media (min-width: 900px) {
  .home-wrap { grid-template-columns: 1.3fr 1fr; align-items: center; min-height: calc(100vh - 32px); }
  .hero { text-align: left; }
  .hero-actions { grid-template-columns: 1fr 1fr; margin: 0; max-width: 480px; }
  .hero-chars, .lead { justify-content: flex-start; margin-left: 0; }
  .logo { font-size: 64px; } .logo span { font-size: 72px; }
}
@media (min-width: 1024px) {
  .game-body { flex-direction: row; padding: 0 14px 14px; gap: 14px; }
  .board-wrap { flex: 1; height: auto; margin: 0; }
  .side { flex: none; width: 360px; padding: 0; }
  .turn-card { display: flex; }
  .log-card { display: block; }
  .players { display: grid; gap: 6px; }
  .pchip { border-radius: 14px; grid-template-columns: auto 1fr auto auto; grid-template-areas: "av name money pts"; padding: 8px 12px 8px 8px; }
  .pc-money { grid-area: money; margin-right: 10px; } .pc-pts { grid-area: pts; margin: 0; }
  .sheet { align-items: center; }
  .sheet-inner { border-radius: 24px; max-height: 86vh; padding: 18px 24px 22px; }
  .q-choices { grid-template-columns: 1fr 1fr; }
  body.screen-host .side { width: 320px; }
}
/* HP landscape: papan kiri 60%, panel kanan 40% */
@media (max-height: 500px) and (orientation: landscape) {
  .game-body { flex-direction: row; }
  .board-wrap { flex: 0 0 60%; height: auto; margin: 0 0 10px 10px; }
  .side { flex: 1; }
  .topbar { min-height: 44px; padding-top: 4px; padding-bottom: 4px; }
  .sheet-inner { max-height: 92vh; }
}
@media (max-width: 599px) {
  .hide-sm { display: none; }
  .topbar .pill { font-size: 12px; padding: 6px 10px; }
}
@media (max-width: 380px) {
  .q-text { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
