:root{
  --bg:#F4F6F3; --card:#FFFFFF; --ink:#18241F; --muted:#5B6B64; --line:#DCE4DF; --line2:#C9D3CE;
  --pri:#0E6B4F; --pri-d:#0A4F3A; --tint:#E3F1EB; --soft:#F7F8F5;
  --amber:#8A5A0B; --amber-bg:#FBF0DC; --flag:#F2B544; --red:#A63A2B; --red-bg:#FBE7E4;
}
*{box-sizing:border-box}
html,body{margin:0;background:var(--bg);color:var(--ink);font-family:'Plus Jakarta Sans',system-ui,-apple-system,'Segoe UI',Roboto,sans-serif;-webkit-text-size-adjust:100%}
body{min-height:100vh;min-height:100dvh}
button,input,textarea{font-family:inherit;font-size:inherit;color:inherit}
button{cursor:pointer}
button:disabled{cursor:not-allowed;opacity:.55}
a{color:var(--pri)}
.ar{font-family:'Noto Naskh Arabic','Amiri','Scheherazade New','Traditional Arabic','Geeza Pro',serif;direction:rtl;text-align:right;unicode-bidi:plaintext}
#app{max-width:560px;margin:0 auto;min-height:100vh;min-height:100dvh;display:flex;flex-direction:column}
.boot{margin:auto;color:var(--muted)}
:focus-visible{outline:3px solid #18241F;outline-offset:2px}

/* tombol & input */
.btn{height:52px;border-radius:12px;border:none;background:var(--pri);color:#fff;font-size:16px;font-weight:700;display:flex;align-items:center;justify-content:center;gap:8px;width:100%;text-decoration:none}
.btn:hover{background:var(--pri-d)}
.btn.ghost{background:#fff;color:var(--ink);border:1.5px solid var(--line2)}
.btn.ghost:hover{background:var(--soft)}
.field{display:flex;flex-direction:column;gap:6px}
.field label{font-size:13px;font-weight:600}
.input{height:52px;border:1.5px solid var(--line2);border-radius:12px;padding:0 16px;font-size:18px;background:#fff;width:100%}
.input:focus{border-color:var(--pri);outline:none;box-shadow:0 0 0 3px var(--tint)}
.input.token{font-size:24px;font-weight:700;letter-spacing:8px;text-transform:uppercase}
.msg{font-size:14px;border-radius:10px;padding:10px 12px;line-height:1.45}
.msg.err{background:var(--red-bg);color:var(--red)}
.msg.warn{background:var(--amber-bg);color:var(--amber)}
.msg.ok{background:var(--tint);color:var(--pri-d)}

/* masuk */
.login{flex:1;display:flex;flex-direction:column}
.login .hero{background:var(--pri);color:#fff;padding:48px 24px 72px;display:flex;flex-direction:column;gap:14px}
.brand{display:flex;align-items:center;gap:10px}
.brand .logo{width:40px;height:40px;border-radius:11px;background:rgba(255,255,255,.14);display:flex;align-items:center;justify-content:center}
.brand b{font-size:17px;font-weight:800;display:block}
.brand span{font-size:12px;opacity:.8}
.login h1{font-size:26px;margin:18px 0 0;line-height:1.2}
.login p.sub{margin:0;opacity:.85;font-size:14px;line-height:1.5}
.sheet{margin:-40px 16px 16px;background:var(--card);border-radius:18px;padding:22px 20px;display:flex;flex-direction:column;gap:16px;box-shadow:0 1px 2px rgba(16,24,20,.06),0 4px 16px rgba(16,24,20,.06)}

/* beranda */
.home-head{background:var(--pri);color:#fff;padding:24px 20px 56px;display:flex;flex-direction:column;gap:18px}
.home-head .who{display:flex;flex-direction:column;gap:4px}
.home-head .who small{font-size:13px;opacity:.85}
.home-head .who strong{font-size:22px}
.home-head .top{display:flex;justify-content:space-between;align-items:center}
.linkbtn{background:rgba(255,255,255,.14);color:#fff;border:none;border-radius:9px;padding:8px 12px;font-size:13px;font-weight:600}
.cards{margin:-36px 16px 16px;display:flex;flex-direction:column;gap:12px}
.card{background:var(--card);border-radius:16px;padding:18px;display:flex;flex-direction:column;gap:14px;box-shadow:0 1px 2px rgba(16,24,20,.06),0 4px 16px rgba(16,24,20,.05)}
.card .row{display:flex;justify-content:space-between;align-items:center;gap:8px}
.eyebrow{font-size:12px;font-weight:700;letter-spacing:.6px;color:var(--muted);text-transform:uppercase}
.pill{font-size:12px;font-weight:700;padding:4px 10px;border-radius:999px;background:#EEF1EE;color:var(--muted);white-space:nowrap}
.pill.green{background:var(--tint);color:var(--pri)}
.pill.amber{background:var(--amber-bg);color:var(--amber)}
.pill.red{background:var(--red-bg);color:var(--red)}
.card h2{margin:0;font-size:20px}
.card .meta{font-size:14px;color:var(--muted);margin-top:2px}
.facts{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
.facts div{background:var(--bg);border-radius:10px;padding:10px;display:flex;flex-direction:column;gap:2px}
.facts small{font-size:11px;color:var(--muted)}
.facts b{font-size:15px}
.empty{text-align:center;color:var(--muted);padding:32px 16px;font-size:15px;line-height:1.5}
.score-big{font-size:28px;font-weight:800;color:var(--pri)}

/* ujian */
.exam{flex:1;display:flex;flex-direction:column;height:100vh;height:100dvh;position:relative;overflow:hidden}
.ex-top{background:#fff;border-bottom:1px solid #E2E8E4;padding:12px 16px;display:flex;flex-direction:column;gap:10px}
.ex-top .row{display:flex;justify-content:space-between;align-items:center;gap:10px}
.ex-top .t b{font-size:15px;display:block}
.ex-top .t span{font-size:12px;color:var(--muted)}
.timer{display:flex;align-items:center;gap:6px;background:var(--ink);color:#fff;border-radius:10px;padding:8px 12px;font-size:17px;font-weight:800;font-variant-numeric:tabular-nums;flex-shrink:0}
.timer.low{background:var(--red)}
.sync{display:flex;align-items:center;gap:8px;border-radius:10px;padding:8px 12px;font-size:12.5px;font-weight:600;background:var(--tint);color:var(--pri-d)}
.sync.off{background:var(--amber-bg);color:var(--amber)}
.ex-body{flex:1;overflow-y:auto;padding:16px;display:flex;flex-direction:column;gap:14px;-webkit-overflow-scrolling:touch}
.qhead{display:flex;justify-content:space-between;align-items:center}
.qhead b{font-size:13px;color:var(--muted)}
.qbox{background:#fff;border-radius:16px;padding:18px;display:flex;flex-direction:column;gap:14px}
.qbox .prompt{margin:0;font-size:16px;line-height:1.6;white-space:pre-wrap;overflow-wrap:anywhere}
.qbox .arabic{margin:0;font-size:28px;line-height:2;background:var(--soft);border-radius:12px;padding:10px 16px;white-space:pre-wrap}
.qbox figure{margin:0;background:var(--soft);border-radius:12px;padding:8px;display:flex;justify-content:center}
.qbox figure img{max-width:100%;max-height:60vh;border-radius:8px;display:block}
.player{display:flex;align-items:center;gap:12px;background:var(--soft);border-radius:12px;padding:12px}
.player button{width:48px;height:48px;border-radius:999px;border:none;background:var(--pri);display:flex;align-items:center;justify-content:center;flex-shrink:0}
.player .bar{height:6px;background:#DCE4DF;border-radius:999px;overflow:hidden}
.player .bar i{display:block;height:100%;width:0;background:var(--pri);border-radius:999px}
.player .info{flex:1;display:flex;flex-direction:column;gap:6px;font-size:12px;color:var(--muted)}
.player .info .r{display:flex;justify-content:space-between}
.player .left{font-weight:700;color:var(--amber)}
.opts{display:flex;flex-direction:column;gap:10px}
.opt{display:flex;align-items:center;gap:12px;width:100%;min-height:56px;padding:10px 14px;border-radius:14px;background:#fff;border:1.5px solid var(--line);text-align:left}
.opt.sel{background:var(--tint);border:2px solid var(--pri)}
.opt .l{flex-shrink:0;width:32px;height:32px;border-radius:999px;display:flex;align-items:center;justify-content:center;font-size:14px;font-weight:800;background:#F0F3F1}
.opt.sel .l{background:var(--pri);color:#fff}
.opt .tx{flex:1;font-size:15px;line-height:1.45;overflow-wrap:anywhere}
.opt .tx.ar{font-size:24px;line-height:1.7}
.essay{border:1.5px solid var(--line2);border-radius:12px;padding:12px 14px;font-size:16px;line-height:1.5;resize:vertical;min-height:180px;width:100%;background:#fff}
.essay:focus,.short:focus{border-color:var(--pri);outline:none;box-shadow:0 0 0 3px var(--tint)}
.hint{font-size:12px;color:var(--muted)}
.ex-foot{background:#fff;border-top:1px solid #E2E8E4;padding:10px 12px calc(12px + env(safe-area-inset-bottom));display:flex;gap:8px;align-items:center}
.sq{width:48px;height:48px;border-radius:12px;border:1.5px solid var(--line2);background:#fff;display:flex;align-items:center;justify-content:center;flex-shrink:0}
.flagbtn{height:48px;padding:0 12px;border-radius:12px;font-size:14px;font-weight:700;display:flex;align-items:center;gap:6px;background:#fff;border:1.5px solid var(--line2)}
.flagbtn.on{background:var(--flag);border-color:var(--flag)}
.cnt{height:48px;padding:0 12px;border-radius:12px;border:1.5px solid var(--line2);background:#fff;font-size:14px;font-weight:700}
.next{flex:1;height:48px;border-radius:12px;border:none;background:var(--pri);color:#fff;font-size:15px;font-weight:700;display:flex;align-items:center;justify-content:center;gap:6px}
.overlay{position:absolute;inset:0;background:rgba(16,24,20,.45);display:flex;flex-direction:column;justify-content:flex-end;z-index:5}
.sheet2{background:#fff;border-radius:20px 20px 0 0;padding:20px 16px calc(18px + env(safe-area-inset-bottom));display:flex;flex-direction:column;gap:14px;max-height:85%;overflow-y:auto}
.sheet2 .row{display:flex;justify-content:space-between;align-items:center}
.sheet2 h3{margin:0;font-size:17px}
.grid{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:10px}
.grid button{height:50px;border-radius:12px;font-size:17px;font-weight:800;background:#fff;border:1.5px solid var(--line2)}
.grid button.ans{background:var(--pri);color:#fff;border:none}
.grid button.flg{background:var(--flag);border:none}
.grid button.cur{outline:3px solid var(--ink);outline-offset:2px}
.legend{display:flex;gap:14px;flex-wrap:wrap;font-size:12px;color:var(--muted)}
.legend span{display:flex;align-items:center;gap:6px}
.legend i{width:12px;height:12px;border-radius:4px;display:inline-block}
.x{width:40px;height:40px;border-radius:10px;border:none;background:#F0F3F1;display:flex;align-items:center;justify-content:center}

/* selesai */
.done-head{background:var(--pri);color:#fff;padding:36px 20px 72px;display:flex;flex-direction:column;align-items:center;gap:8px;text-align:center}
.done-head .ic{width:56px;height:56px;border-radius:999px;background:rgba(255,255,255,.16);display:flex;align-items:center;justify-content:center}
.done-head b{font-size:20px}
.done-head span{font-size:13px;opacity:.85}
.scorecard{margin:-48px 16px 0;background:#fff;border-radius:18px;padding:22px 20px;display:flex;flex-direction:column;align-items:center;gap:6px;box-shadow:0 1px 2px rgba(16,24,20,.06),0 4px 16px rgba(16,24,20,.06)}
.scorecard .n{font-size:64px;font-weight:800;line-height:1;color:var(--pri);font-variant-numeric:tabular-nums}
.scorecard .s{font-size:13px;color:var(--muted);text-align:center;line-height:1.5}
.scorecard .bar{width:100%;height:8px;background:var(--tint);border-radius:999px;overflow:hidden;margin-top:8px}
.scorecard .bar i{display:block;height:100%;background:var(--pri)}
.detail{margin:18px 16px 0;display:flex;flex-direction:column;gap:8px}
.list{background:#fff;border-radius:14px;overflow:hidden}
.list .it{display:flex;align-items:center;gap:12px;padding:12px 14px;border-bottom:1px solid #EEF1EE}
.list .it:last-child{border-bottom:none}
.list .num{width:28px;height:28px;border-radius:999px;display:flex;align-items:center;justify-content:center;font-weight:800;font-size:13px;flex-shrink:0}
.list .lb{flex:1;font-size:14px;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.list .st{font-size:13px;font-weight:700;white-space:nowrap}
.right .num{background:var(--tint);color:var(--pri)} .right .st{color:var(--pri)}
.wrong .num{background:var(--red-bg);color:var(--red)} .wrong .st{color:var(--red)}
.empty2 .num{background:#EEF1EE;color:var(--muted)} .empty2 .st{color:var(--muted)}
.pending .num{background:var(--amber-bg);color:var(--amber)} .pending .st{color:var(--amber)}
.foot{margin-top:auto;padding:16px}
.wait{margin:16px;display:flex;flex-direction:column;gap:12px}
