/* Layar murid */
body { overflow: hidden; background: linear-gradient(180deg, var(--sky-1) 0%, var(--sky-2) 62%, #EAF8FF 100%); touch-action: none; user-select: none; -webkit-user-select: none; transition: background .8s; }
body[data-sky="desa"] { background: linear-gradient(180deg, #9EDBF5 0%, #DDF3E2 65%, #EAF8E8 100%); }
body[data-sky="pantai"] { background: linear-gradient(180deg, #6EC9F2 0%, #CFF0FF 55%, #FFF4DC 100%); }
body[data-sky="angkasa"] { background: linear-gradient(180deg, #0B0726 0%, #1A1440 60%, #2C2160 100%); }
#world { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
#labels { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.nm { position: absolute; transform: translate(-50%, -100%); white-space: nowrap; font-weight: 800; font-size: 12px; padding: 1px 8px; border-radius: 8px; background: rgba(29,26,58,.78); color: #fff; }
.nm.me { background: var(--accent); font-size: 13px; }
.bubble { position: absolute; transform: translate(-50%, -100%); white-space: nowrap; font-weight: 800; font-size: 14px; padding: 3px 10px; border-radius: 12px; background: #fff; border: 2px solid var(--ink); box-shadow: 0 2px 0 var(--ink); }
.bubble::after { content: ""; position: absolute; left: 50%; bottom: -7px; width: 10px; height: 10px; background: #fff; border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink); transform: translateX(-50%) rotate(45deg); }
.pop { position: absolute; transform: translate(-50%, -100%); white-space: nowrap; font-weight: 900; font-size: 15px; padding: 3px 10px; border-radius: 10px; color: #fff; border: 2px solid var(--ink); }

/* Gabung */
#join { position: fixed; inset: 0; display: grid; place-items: end center; padding: 16px; padding-bottom: max(16px, env(safe-area-inset-bottom)); }
@media (min-width: 760px) { #join { place-items: center start; padding-left: 7vw; } }
.join-card { width: min(440px, 100%); padding: 18px 18px 20px; }
.join-card .sub { margin: 0; color: var(--muted); font-size: 15px; }
.row2 { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; }
#pin { font-size: 24px; letter-spacing: .15em; font-weight: 900; text-align: center; }
.pick { display: flex; gap: 8px; flex-wrap: wrap; }
.pick button { border: 2px solid var(--ink); background: #fff; border-radius: 10px; padding: 4px 10px; font-weight: 800; font-size: 14px; cursor: pointer; }
.pick button[aria-pressed=true] { background: var(--ink); color: #fff; }
.sw { width: 34px; height: 34px; padding: 0 !important; border-radius: 50% !important; }
.sw[aria-pressed=true] { outline: 3px solid var(--accent); outline-offset: 2px; }
.pick.sws { gap: 7px; } .pick.sws .sw { width: 30px; height: 30px; }
#go { width: 100%; margin-top: 16px; font-size: 20px; }
#joinErr { color: var(--bad); font-weight: 800; margin: 8px 0 0; min-height: 1em; }

/* HUD */
#hud { position: fixed; inset: 0; pointer-events: none; }
#hud > * { pointer-events: auto; }
.me-card { position: absolute; left: 12px; top: max(12px, env(safe-area-inset-top)); padding: 6px 12px 7px; min-width: 150px; }
.me-card .n { font-weight: 900; font-size: 16px; }
.me-card .s { font-weight: 800; font-size: 14px; color: var(--ink-2); }
#net { position: absolute; right: 12px; top: max(12px, env(safe-area-inset-top)); }
#net.off { background: var(--bad); color: #fff; }
#raceTimer { position: absolute; right: 12px; top: calc(max(12px, env(safe-area-inset-top)) + 34px); font-size: 16px; }
#chip { position: absolute; left: 50%; transform: translateX(-50%); top: max(12px, env(safe-area-inset-top)); font-size: 15px; padding: 5px 14px; white-space: nowrap; max-width: calc(100vw - 24px); overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 760px) { #chip { top: 74px; } }
.arrow { display: inline-block; transition: transform .2s; }

#qcard { position: absolute; left: 50%; transform: translateX(-50%); top: max(12px, env(safe-area-inset-top)); width: min(640px, calc(100vw - 24px)); padding: 10px 14px 12px; }
@media (max-width: 760px) { #qcard { top: 74px; } }
.qmeta { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 14px; color: var(--ink-2); flex-wrap: wrap; }
.qmeta .sp { flex: 1; }
#qstat { font-size: 13px; color: var(--ink); }
#timer { font-size: 18px; color: var(--ink); min-width: 2.4em; text-align: right; }
#qtext { font-weight: 800; font-size: clamp(17px, 2.6vw, 24px); margin-top: 2px; }
.tbar { height: 8px; border: 2px solid var(--ink); border-radius: 99px; margin-top: 8px; overflow: hidden; background: #F1EEE6; }
.tbar i { display: block; height: 100%; width: 100%; background: var(--accent); transform-origin: left; }

#answers { position: absolute; left: 50%; transform: translateX(-50%); bottom: max(12px, env(safe-area-inset-bottom)); width: min(760px, calc(100vw - 24px)); display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
#answers.withstick { width: min(760px, calc(100vw - 190px)); left: calc(50% + 80px); }
.ans { display: flex; align-items: center; gap: 10px; text-align: left; justify-content: flex-start; background: #fff; font-size: clamp(15px, 2vw, 19px); padding: 8px 12px; min-height: 54px; border-left: 12px solid var(--o); }
.ans[aria-pressed=true] { background: var(--o); color: #fff; }
.opt-d.ans[aria-pressed=true] { color: var(--ink); }
.ans.right { background: var(--ok) !important; color: #fff !important; border-left-color: var(--ok); }
.ans.dim { opacity: .4; }
@media (max-width: 560px) { #answers { gap: 7px; } .ans { min-height: 46px; padding: 5px 8px; font-size: 14px; line-height: 1.2; gap: 7px; } #answers.withstick { width: calc(100vw - 24px); left: 50%; bottom: 150px; } }

#stick { position: absolute; left: 22px; bottom: max(22px, env(safe-area-inset-bottom)); width: 132px; height: 132px; border-radius: 50%; background: rgba(255,255,255,.5); border: var(--edge); touch-action: none; }
#stick i { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%; background: var(--accent); border: var(--edge); box-shadow: 0 3px 0 var(--ink); }

#banner { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); text-align: center; padding: 14px 22px 16px; width: min(560px, calc(100vw - 32px)); }
#banner.top { top: max(12px, env(safe-area-inset-top)); transform: translate(-50%, 0); }
@media (max-width: 760px) { #banner.top { top: 74px; } }
#banner h2 { margin: 0; font-size: clamp(20px, 3.6vw, 32px); line-height: 1.15; }
#banner p { margin: 6px 0 0; color: var(--ink-2); font-weight: 600; }
#banner .big { font-size: 84px; font-weight: 900; line-height: 1; }
#banner.ok { background: #E6F7EE; } #banner.bad { background: #FDECEC; }
#banner.compact { width: auto; padding: 6px 18px; }
#banner .cd { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 18px; }
#banner .cd b { font-size: 44px; line-height: 1; }
#banner .bahas { margin-top: 10px; padding-top: 10px; border-top: 2px dashed #ccc; font-size: 16px; color: var(--ink); font-weight: 600; }
.pop-in { animation: popin .35s cubic-bezier(.2,1.6,.4,1); }
@keyframes popin { from { transform: translate(-50%, -50%) scale(.6); opacity: 0; } }

#hint { position: absolute; left: 50%; transform: translateX(-50%); bottom: 150px; font-weight: 800; font-size: 14px; padding: 4px 12px; background: rgba(29,26,58,.8); color: #fff; border-radius: 99px; white-space: nowrap; pointer-events: none; max-width: calc(100vw - 24px); overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 560px) { #hint { bottom: 270px; font-size: 13px; white-space: normal; text-align: center; } }
#action { position: absolute; left: 50%; transform: translateX(-50%); bottom: max(24px, env(safe-area-inset-bottom)); font-size: 20px; min-height: 58px; padding: 10px 22px; background: var(--d); }
#modeBar { position: absolute; right: 12px; bottom: max(14px, env(safe-area-inset-bottom)); display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 560px) { #action { left: auto; right: 10px; transform: none; bottom: 70px; font-size: 16px; max-width: calc(100vw - 180px); min-height: 52px; } #modeBar { right: 10px; bottom: 14px; } }
#emotes { position: absolute; right: 12px; bottom: max(14px, env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(4, auto); gap: 6px; }
#emotes .btn.small { min-height: 34px; padding: 3px 8px; font-size: 14px; }
@media (max-width: 560px) { #emotes { grid-template-columns: repeat(4, 1fr); right: 8px; left: 168px; } #emotes .btn.small { font-size: 18px; padding: 2px; min-height: 38px; } #emotes .tx { display: none; } }
#toast { position: absolute; left: 50%; bottom: 96px; transform: translateX(-50%); padding: 8px 16px; font-weight: 800; max-width: calc(100vw - 24px); }

/* Akhir */
#end { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; background: rgba(255,248,236,.55); }
.end-card { width: min(520px, 100%); padding: 18px; text-align: center; }
.podium { display: grid; grid-template-columns: 1fr 1fr 1fr; align-items: end; gap: 8px; margin: 14px 0; }
.pod { border: var(--edge); border-radius: 12px 12px 0 0; padding: 6px 4px; font-weight: 900; }
.pod .nm2 { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pod .pt { font-size: 12px; font-weight: 700; }
.p1 { background: #FFD54A; min-height: 140px; } .p2 { background: #D7DCE6; min-height: 110px; } .p3 { background: #F0A56B; min-height: 90px; }
.myrank { font-size: 20px; font-weight: 800; }

/* Panel (Detektif & Pasar) */
#panel { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; background: rgba(29,26,58,.35); overflow: auto; }
.sheet { width: min(620px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 16px 18px 18px; }
.sheet h2 { margin: 0; font-size: 22px; line-height: 1.15; }
.sheet h3 { margin: 14px 0 6px; font-size: 17px; }
.sheet .lead { font-size: 16px; color: var(--ink); font-weight: 600; }
.sheet.center { text-align: center; }
.sheet-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.sheet-head > div { flex: 1; min-width: 0; }
.big-ikon { font-size: 34px; width: 52px; height: 52px; display: grid; place-items: center; background: #FFF4D6; border: 2px solid var(--ink); border-radius: 14px; flex: none; }
.kicker { font-size: 13px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.reading { white-space: pre-wrap; background: #FFF8E1; border: 2px solid #E9D9A6; border-left: 6px solid var(--d); border-radius: 12px; padding: 12px 14px; font-size: 16px; line-height: 1.5; font-weight: 600; margin: 6px 0 10px; font-family: "Baloo 2", ui-rounded, system-ui, sans-serif; }
.tag.skill { background: #8E4EC6; }
.sheet .q { font-weight: 800; font-size: 17px; margin: 8px 0; }
.sheet .opts { display: grid; gap: 8px; }
.btn.opt { justify-content: flex-start; text-align: left; font-weight: 700; min-height: 46px; box-shadow: 0 3px 0 var(--ink); }
.btn.opt.right { background: #E6F7EE; border-color: var(--ok); }
.btn.opt.wrong { background: #FDECEC; border-color: var(--bad); }
.btn.opt:disabled { opacity: 1; }
.fb { margin-top: 10px; padding: 10px 12px; border-radius: 12px; border: 2px solid #ddd; font-weight: 600; background: #F7F4EC; }
.fb.ok { background: #E6F7EE; border-color: var(--ok); }
.fb.bad { background: #FDECEC; border-color: var(--bad); }
.fb.note { background: #FFF4D6; border-color: var(--d); text-align: left; }
.fb ol { margin: 6px 0 0; padding-left: 20px; }
.row-end { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; flex-wrap: wrap; }
.btn.wide { width: 100%; margin-top: 12px; }
.steps { padding-left: 20px; font-weight: 600; } .steps li { margin-bottom: 4px; }
.clues { padding-left: 22px; font-weight: 700; } .clues li { margin-bottom: 4px; } .clues.small { font-size: 14px; margin: 4px 0; }
.suspects { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.suspects.mini { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); margin: 8px 0; }
.sus { padding: 8px; border-radius: 12px; box-shadow: 0 3px 0 var(--ink); display: flex; flex-direction: column; gap: 3px; }
.suspects.mini .sus { border: 2px solid var(--ink); align-items: center; flex-direction: row; gap: 6px; padding: 4px 8px; box-shadow: none; }
.sus-h { display: flex; align-items: center; gap: 6px; font-size: 16px; } .sus-h span { font-size: 24px; }
.ciri { display: flex; justify-content: space-between; gap: 6px; font-size: 13px; border-bottom: 1px dashed #ddd; } .ciri span { color: var(--muted); font-weight: 700; }
.sus .btn { margin-top: 6px; }
.stars { font-size: 34px; letter-spacing: 4px; }
.skills { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 10px 0; }
.small-note { font-size: 13px; margin: 8px 0 0; }
.muted { color: var(--muted); }

/* Pasar */
@media (min-width: 900px) { #panel.pasar-dock { place-items: start end; background: transparent; padding-top: 86px; } #panel.pasar-dock .sheet { width: 470px; max-height: calc(100vh - 100px); } }
@media (max-width: 899px) { #panel.pasar-dock { place-items: end center; background: transparent; padding: 8px; top: 120px; } #panel.pasar-dock .sheet { max-height: calc(100vh - 136px); padding: 12px 14px; } .pasar .buyer p { font-size: 15px; } .pasar .item { min-width: 80px; padding: 4px 8px; } .numpad .btn { min-height: 40px; } }
.pasar-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.pasar-head h2 small { font-size: 14px; background: var(--d); padding: 1px 8px; border-radius: 8px; border: 2px solid var(--ink); vertical-align: middle; }
.pchips { display: flex; gap: 6px; flex-wrap: wrap; }
.buyer { display: flex; gap: 10px; align-items: flex-start; background: #FFF8EC; border: 2px solid var(--ink); border-radius: 14px; padding: 8px 12px; }
.buyer .face { font-size: 34px; }
.buyer p { margin: 2px 0 0; font-weight: 700; font-size: 16px; }
.items { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.item { display: flex; flex-direction: column; align-items: center; gap: 1px; border: 2px solid var(--ink); border-radius: 12px; padding: 6px 10px; background: #fff; font-weight: 700; font-size: 14px; min-width: 92px; }
.item .e { font-size: 24px; } .item b { font-size: 13px; color: var(--ink-2); }
.input { margin-top: 8px; }
.display { font-size: 28px; font-weight: 900; text-align: center; border: var(--edge); border-radius: 12px; padding: 4px; background: #1D1A3A; color: #7CF0A8; margin-bottom: 8px; }
.display b { margin-left: 4px; }
.display.small { font-size: 18px; }
.numpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.numpad .btn { min-height: 44px; font-size: 20px; }
.tray { display: flex; flex-wrap: wrap; gap: 6px; min-height: 42px; padding: 6px; border: 2px dashed #CFC8B6; border-radius: 12px; margin-bottom: 8px; align-items: center; }
.denoms { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.money { border: 2px solid var(--ink); background: var(--c); font-weight: 900; cursor: pointer; font-size: 13px; padding: 6px 8px; min-height: 40px; box-shadow: 0 2px 0 var(--ink); }
.money.koin { border-radius: 50%; width: 52px; height: 52px; padding: 0; font-size: 11px; }
.money.uang { border-radius: 6px; min-width: 76px; }
.weight { border: 2px solid var(--ink); background: #9AA5B1; color: #fff; font-weight: 900; border-radius: 8px 8px 4px 4px; padding: 6px 10px; min-height: 40px; cursor: pointer; box-shadow: 0 2px 0 var(--ink); }
.scale { width: 100%; max-width: 320px; display: block; margin: 0 auto; }
.pie { width: 210px; display: block; margin: 0 auto; cursor: pointer; } .pie.locked { cursor: default; }
.pie path:hover { filter: brightness(1.05); }

/* Tombol suara */
#sound { position: absolute; right: 150px; top: max(12px, env(safe-area-inset-top)); display: flex; gap: 6px; }
.sbtn { width: 34px; height: 30px; border: 2px solid var(--ink); border-radius: 10px; background: #fff; font-size: 15px; cursor: pointer; padding: 0; line-height: 1; }
.sbtn.off { opacity: .45; }
#soundHint { position: absolute; left: 12px; top: calc(max(12px, env(safe-area-inset-top)) + 70px); font-size: 13px; background: var(--d); }
@media (max-width: 560px) { #sound { right: 10px; top: auto; bottom: 150px; flex-direction: column; } }
