*{box-sizing:border-box}
html,body{margin:0;height:100%;overflow:hidden;background:#17102b;color:#fff;font-family:ui-monospace,Menlo,Consolas,"Courier New",monospace;-webkit-user-select:none;user-select:none;touch-action:none}
#view{position:fixed;inset:0;width:100%;height:100%;image-rendering:pixelated;display:block}
button{font:inherit;cursor:pointer}
.box{background:#2b2150;border:4px solid #ffd34d;box-shadow:0 0 0 4px #17102b,8px 8px 0 4px rgba(0,0,0,.4);padding:16px;max-width:92vw}
#hud{position:fixed;top:8px;left:8px;right:8px;display:flex;gap:6px;flex-wrap:wrap;align-items:center;pointer-events:none;font-size:12px}
#hud>*{background:#2b2150e6;border:2px solid #ffd34d;padding:4px 8px;pointer-events:auto}
#hud #roomname{font-weight:700;color:#ffd34d}
#phase.lobby{color:#9fd4ff}#phase.panel{color:#7dff9e}#phase.parallel{color:#ffb86b}#phase.all{color:#fff}
#linkbtn{background:#ffd34d;color:#2b2150;font-weight:700;margin-left:auto}
#announce{position:fixed;top:44px;left:8px;right:8px;background:#ffd34d;color:#2b2150;font-size:12px;font-weight:700;padding:6px 10px;border:2px solid #17102b;text-align:center;pointer-events:none}
#hint{position:fixed;bottom:20px;left:50%;transform:translateX(-50%);background:#17102bdd;border:2px solid #7dff9e;padding:6px 12px;font-size:13px;pointer-events:none;white-space:nowrap}
#toast{position:fixed;top:30%;left:50%;transform:translateX(-50%);background:#ff5d73;color:#fff;border:3px solid #17102b;padding:10px 14px;font-weight:700;max-width:86vw;text-align:center;z-index:30}
#pad{position:fixed;left:0;right:0;bottom:12px;height:150px;pointer-events:none}
#pad button{position:absolute;width:52px;height:52px;border:3px solid #17102b;background:#ffd34dcc;color:#2b2150;font-size:20px;font-weight:700;pointer-events:auto;touch-action:none}
#pad .up{left:62px;bottom:94px}#pad .down{left:62px;bottom:10px}#pad .left{left:8px;bottom:52px}#pad .right{left:116px;bottom:52px}
#pad #abtn{right:18px;bottom:52px;width:64px;height:64px;border-radius:50%;background:#7dff9ecc;font-size:24px}

#modal .box{position:relative;width:560px;max-height:90vh;overflow:auto;-webkit-user-select:text;user-select:text}
.x{position:absolute;right:6px;top:6px;background:#ff5d73;color:#fff;border:2px solid #17102b;width:30px;height:30px}
#mbody h2{margin:0 30px 6px 0;font-size:18px;color:#ffd34d}
#mbody p{margin:6px 0;line-height:1.5;font-size:14px}
#mbody img{max-width:100%;border:3px solid #ffd34d;display:block;margin:8px 0}
#mbody .big{display:block;text-align:center;background:#7dff9e;color:#17102b;font-weight:700;padding:12px;margin:10px 0;border:3px solid #17102b;text-decoration:none;font-size:16px}
#mbody .sec{background:#ffd34d;color:#17102b;border:3px solid #17102b;padding:8px 12px;font-weight:700;margin-right:6px}
#mbody a.pdf{color:#9fd4ff}
#chatbtn,#sndbtn{color:#fff;background:#2b2150e6}
#chat{position:fixed;left:0;right:0;bottom:0;z-index:25;pointer-events:none;display:flex;justify-content:center}
#cform{display:none;gap:4px;width:min(520px,100vw);padding:6px;background:#17102bf2;border-top:3px solid #ffd34d;pointer-events:auto}
#chat.open #cform{display:flex}
#cin{flex:1;min-width:0;font:inherit;font-size:13px;padding:7px;border:3px solid #17102b;background:#fff;color:#17102b;-webkit-user-select:text;user-select:text}
#cform button{background:#7dff9e;border:3px solid #17102b;font-weight:700;padding:0 10px}
body.coarse #pad{z-index:4}
#modal .box{touch-action:pan-y}
#mbody form label{display:block;font-size:12px;margin:8px 0 2px;color:#cfc4ff}
#mbody form input,#mbody form textarea{width:100%;font:inherit;font-size:14px;padding:8px;border:3px solid #17102b;background:#fff;color:#17102b}
#mbody textarea{resize:vertical}
#mbody fieldset.au{border:3px solid #ffd34d55;margin:10px 0;padding:4px 10px 10px}
#mbody fieldset legend{color:#ffd34d;font-size:13px;font-weight:700;padding:0 6px}
#mbody .g2{display:grid;grid-template-columns:1fr 1fr;gap:8px}
#mbody .chk{display:flex;gap:8px;align-items:flex-start;font-size:12px;margin-top:12px}
#mbody .chk input{width:auto;margin-top:2px}
#mbody .rerr{color:#ff8a8a;min-height:18px;font-size:13px;margin:6px 0}
#mbody button.big{width:100%;font:inherit;font-weight:700;cursor:pointer}
#mbody button.big:disabled{opacity:.6}
#mbody .hp{position:absolute;left:-9999px;width:1px;height:1px;opacity:0}
#mbody .note{font-size:12px;opacity:.85}
#mbody .rm{margin-top:8px;font-size:12px;padding:5px 8px}
#codebtn{color:#fff;background:#2b2150e6}
@media (max-width:480px){#mbody .g2{grid-template-columns:1fr}}
select{font:inherit;font-size:13px;padding:7px;border:3px solid #17102b;background:#fff;color:#17102b;width:100%;box-sizing:border-box}
.prim{display:flex;gap:6px;align-items:center;margin:8px 0 0;font-size:12px;color:#cfc4ff}
.prim input{width:auto;margin:0}

/* modal */
#modal{position:fixed;inset:0;background:#0009;display:grid;place-items:center;z-index:20;padding:10px}
#modal[hidden]{display:none}

/* pembuat karakter dan layar masuk */
[hidden]{display:none!important}
#creator,#welcome{position:fixed;inset:0;display:flex;align-items:center;justify-content:center;background:#17102bd9;z-index:22;padding:10px;-webkit-user-select:text;user-select:text}
.panel{background:#2b2150;border:4px solid #17102b;box-shadow:0 0 0 3px #ffd34d;padding:16px;max-width:96vw;max-height:96vh;overflow:auto}
.panel h1{margin:0 0 2px;font-size:20px;color:#ffd34d}
.panel .sub{margin:0 0 10px;font-size:12px;opacity:.8}
#cbody{display:flex;gap:18px;align-items:flex-start;flex-wrap:wrap}
#pvwrap{text-align:center}
#pv{width:128px;height:224px;image-rendering:pixelated;background:#cfd0d6;border:3px solid #17102b;display:block}
#pvwrap .rot{margin-top:6px;display:flex;gap:6px;justify-content:center}
.opts{width:340px;max-width:100%;min-height:230px}
.opts .lbl{font-size:12px;color:#cfc4ff;margin:10px 0 4px}
.opts .lbl:first-child{margin-top:0}
.row{display:flex;flex-wrap:wrap;gap:5px}
.sw{width:28px;height:28px;border:3px solid #17102b;padding:0}
.sw.sel{border-color:#7dff9e;box-shadow:0 0 0 2px #7dff9e}
.bt{background:#3b2f70;color:#fff;border:3px solid #17102b;padding:5px 9px;font-size:13px}
.bt.sel{background:#7dff9e;color:#17102b;font-weight:700}
.campus{display:flex;align-items:center;gap:8px}
.chip{display:inline-flex;width:34px;height:18px;border:2px solid #17102b}
.chip i{flex:1}
#nav{display:flex;justify-content:space-between;align-items:center;margin-top:14px;gap:8px}
#nav .steps{font-size:12px;opacity:.85}
#nav button,#welcome .btns button{background:#7dff9e;color:#17102b;border:3px solid #17102b;font-weight:700;padding:7px 14px}
#nav button.sec,#welcome .btns button.sec{background:#3b2f70;color:#fff}
#nm{width:100%;font:inherit;font-size:15px;padding:8px;border:3px solid #17102b;background:#fff;color:#17102b}
.note{font-size:11px;opacity:.7;margin-top:8px}
#welcome .panel{text-align:center;width:420px}
#wpv{width:96px;height:168px;image-rendering:pixelated;background:#cfd0d6;border:3px solid #17102b;margin:6px 0}
#wname{font-size:18px;margin-bottom:6px}
#welcome label{display:block;text-align:left;font-size:12px;margin:8px 0 2px;color:#cfc4ff}
#welcome input{width:100%;font:inherit;padding:8px;border:3px solid #17102b;background:#fff;color:#17102b}
#lerr{color:#ff8a8a;min-height:18px;margin-top:6px;font-size:13px}
#welcome .btns{display:flex;gap:8px;justify-content:center;margin-top:8px}
.keys{font-size:11px;opacity:.7;margin:8px 0 0}
#hud #charbtn{color:#fff;background:#2b2150e6}
/* layar sempit (HP): pengumuman di atas tombol layar agar tidak menutupi baris HUD kedua */
@media (max-width:520px){#announce{top:auto;bottom:176px}}

#hud #padbtn{color:#fff;background:#2b2150e6}#hud #padbtn.on{background:#7dff9e;color:#17102b}
body.coarse #hint{pointer-events:auto;cursor:pointer;padding:10px 14px;font-size:14px}

body.coarse #hint{bottom:172px}
@media (max-width:520px){body.coarse #announce{bottom:222px}}

/* obrolan privat meja */
#privbar{position:fixed;top:84px;left:50%;transform:translateX(-50%);max-width:min(560px,94vw);background:#17102bf2;border:3px solid #ffd34d;padding:8px 12px;font-size:13px;z-index:15;text-align:center;line-height:1.5}
#privbar button{margin-left:6px;background:#7dff9e;color:#17102b;border:2px solid #17102b;font-weight:700;padding:4px 10px}
#privbar button.sec{background:#ffd34d}
#ptx{position:fixed;left:8px;bottom:64px;width:min(300px,60vw);max-height:30vh;overflow:auto;background:#17102bd9;border:2px solid #ffd34d;padding:6px 8px;font-size:12px;z-index:14;-webkit-user-select:text;user-select:text}
#ptx div{margin:2px 0;line-height:1.35;word-break:break-word}
#ptx .me{color:#7dff9e}
#ptx .empty{opacity:.7}
@media (max-width:520px){#privbar{top:auto;bottom:232px}body.coarse #ptx{bottom:232px;left:auto;right:8px}}

#hud #musicbtn{color:#fff;background:#2b2150e6}

/* stik analog bulat transparan + tombol A bulat transparan (layar sentuh) */
#pad #stick{position:absolute;left:24px;bottom:28px;width:136px;height:136px;border-radius:50%;background:rgba(255,255,255,.09);border:2px solid rgba(255,255,255,.28);pointer-events:auto;touch-action:none;box-shadow:inset 0 0 18px rgba(255,255,255,.10)}
#pad #knob{position:absolute;left:50%;top:50%;width:60px;height:60px;margin:-30px 0 0 -30px;border-radius:50%;background:rgba(255,255,255,.26);border:2px solid rgba(255,255,255,.42);pointer-events:none;transition:transform .04s linear}
#pad #abtn{right:28px;bottom:48px;width:76px;height:76px;border-radius:50%;background:rgba(125,255,158,.20);border:2px solid rgba(255,255,255,.42);color:rgba(255,255,255,.85);font-size:26px;font-weight:700}
#pad #abtn:active{background:rgba(125,255,158,.40)}
#hud #privchip{color:#7dff9e;font-size:12px;max-width:46vw;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
body.coarse #ptx{max-height:20vh;opacity:.9}
