* { box-sizing: border-box; margin: 0; padding: 0; }
button { font-family: inherit; }
body { font-family: -apple-system, 'Segoe UI', Roboto, Arial, sans-serif; background: #f2f5f9; color: #1c2733; line-height: 1.55; }
.hidden { display: none !important; }

.topbar { background: linear-gradient(90deg, #0b5cad, #0e7ad6); color: #fff; padding: 12px 20px; display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 10; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.brand { font-size: 18px; cursor: pointer; }
.brand span { opacity: .85; font-size: 13px; margin-left: 8px; }
.timer { font-family: monospace; font-size: 20px; font-weight: 700; background: rgba(255,255,255,.15); padding: 6px 14px; border-radius: 10px; }
.timer.danger { background: #d33; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .6; } }

.container { max-width: 1080px; margin: 0 auto; padding: 20px 16px 40px; }
.hero { text-align: center; margin: 10px 0 24px; }
.hero h1 { font-size: 30px; color: #0b5cad; }
.hero p { margin-top: 6px; }
.muted { color: #5b6b7a; }
.small { font-size: 13px; }
.center { text-align: center; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.card { background: #fff; border-radius: 14px; padding: 20px; box-shadow: 0 2px 10px rgba(16,40,70,.08); margin-bottom: 16px; }
.card-emoji { font-size: 34px; }
.card h2 { margin: 6px 0 8px; }

.btn { background: #0b5cad; color: #fff; border: none; border-radius: 10px; padding: 11px 18px; font-size: 15px; font-weight: 600; cursor: pointer; }
.btn:hover { background: #084a8a; }
.btn:disabled { opacity: .45; cursor: default; }
.btn-big { width: 100%; padding: 14px; font-size: 16px; margin-top: 12px; }
.btn-green { background: #1e9e50; }
.btn-green:hover { background: #177a3d; }
.btn-ghost { background: #eef2f6; color: #1c2733; }
.btn-ghost:hover { background: #dde5ec; }
.arena-btns { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.arena-btns .btn { flex: 1; }

.tbl { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 14px; }
.tbl th, .tbl td { border-bottom: 1px solid #dbe3ea; padding: 9px 8px; text-align: left; }
.tbl th { background: #f2f5f9; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.badge.pass { background: #dcf5e3; color: #177a3d; }
.badge.fail { background: #fde3e3; color: #b3261e; }

.test-layout { display: grid; grid-template-columns: 1fr 300px; gap: 16px; align-items: start; }
.q-panel { position: sticky; top: 76px; }
.q-meta { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; margin-bottom: 10px; flex-wrap: wrap; }
.sec-badge { padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 700; color: #fff; }
.sec-badge.TWK { background: #7b2fbe; }
.sec-badge.TIU { background: #0b5cad; }
.sec-badge.TKP { background: #1e9e50; }
.progress { height: 8px; background: #e6ebf0; border-radius: 6px; overflow: hidden; margin-bottom: 16px; }
.progress > div { height: 100%; background: #0b5cad; transition: width .3s; }
.q-text { font-size: 17px; font-weight: 600; white-space: pre-wrap; margin-bottom: 16px; }
.options { display: flex; flex-direction: column; gap: 10px; }
.opt { display: flex; gap: 12px; align-items: flex-start; text-align: left; background: #f7fafc; border: 2px solid #dbe3ea; border-radius: 12px; padding: 12px 14px; font-size: 15px; cursor: pointer; color: #1c2733; }
.opt:hover { border-color: #0b5cad; }
.opt-letter { flex: 0 0 28px; height: 28px; border-radius: 50%; background: #dbe3ea; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.opt.selected { border-color: #0b5cad; background: #e8f2fd; }
.opt.selected .opt-letter { background: #0b5cad; color: #fff; }
.opt.correct { border-color: #1e9e50; background: #dcf5e3; }
.opt.correct .opt-letter { background: #1e9e50; color: #fff; }
.opt.wrong { border-color: #d33; background: #fde3e3; }
.opt.wrong .opt-letter { background: #d33; color: #fff; }
.opt.dim { opacity: .55; }
.opt:disabled { cursor: default; }
.flag-row { display: block; margin: 16px 0 4px; font-size: 14px; color: #5b6b7a; cursor: pointer; }
.q-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 16px; }

.side { position: sticky; top: 76px; }
.side-title { font-weight: 700; margin-bottom: 10px; }
.grid-label { font-size: 12px; font-weight: 700; color: #5b6b7a; margin: 10px 0 6px; }
.numgrid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.num { height: 36px; border-radius: 8px; border: 1px solid #dbe3ea; background: #fff; font-size: 13px; cursor: pointer; }
.num.done { background: #1e9e50; color: #fff; border-color: #1e9e50; }
.num.flagged { background: #fff3cd; border-color: #e6a700; color: #7a5b00; }
.num.flagged.done { background: #1e9e50; color: #fff; box-shadow: inset 0 0 0 2px #e6a700; }
.num.current { outline: 3px solid #0b5cad; outline-offset: 1px; font-weight: 700; }
.legend { display: flex; gap: 14px; font-size: 12px; color: #5b6b7a; margin: 14px 0; flex-wrap: wrap; }
.lg { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
.lg.done { background: #1e9e50; }
.lg.flagged { background: #e6a700; }
.lg.current { background: #fff; outline: 2px solid #0b5cad; }

.result { text-align: center; }
.result-badge { display: inline-block; font-size: 28px; font-weight: 800; padding: 10px 28px; border-radius: 14px; margin: 8px 0 14px; }
.result-badge.pass { background: #dcf5e3; color: #177a3d; }
.result-badge.fail { background: #fde3e3; color: #b3261e; }
.result h2 { margin-bottom: 8px; }
.btn-row { display: flex; gap: 10px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.review { text-align: left; margin-top: 20px; }
.review summary { cursor: pointer; font-weight: 700; padding: 10px; background: #f2f5f9; border-radius: 10px; }
.rev-item { border-bottom: 1px solid #dbe3ea; padding: 12px 4px; font-size: 14px; }
.rev-item.ok { border-left: 4px solid #1e9e50; padding-left: 10px; }
.rev-item.bad { border-left: 4px solid #d33; padding-left: 10px; }
.q-text-sm { white-space: pre-wrap; font-weight: 600; }
.expl { display: block; background: #fff8e1; border-left: 4px solid #e6a700; padding: 8px 10px; border-radius: 6px; margin-top: 6px; }
.feedback { border-radius: 12px; padding: 14px; margin-top: 14px; font-size: 15px; }
.feedback.ok { background: #dcf5e3; border: 1px solid #1e9e50; }
.feedback.bad { background: #fde3e3; border: 1px solid #d33; }

.foot { text-align: center; color: #8a97a3; font-size: 12px; padding: 0 16px 24px; }
.userbox { font-size: 13px; color: #e0e7ff; display: flex; gap: 8px; align-items: center; }
.linkbtn { background: none; border: none; color: #fff; text-decoration: underline; cursor: pointer; font-size: 13px; padding: 0; }

@media (max-width: 860px) {
  .test-layout { grid-template-columns: 1fr; }
  .q-panel, .side { position: static; }
  .grid2 { grid-template-columns: 1fr; }
  .hero h1 { font-size: 24px; }
  .brand span { display: none; }
}

/* Menu pengguna di header */
.userbox { position: relative; }
.usermenu-btn { background: rgba(255,255,255,.18); color: #fff; border: 1.5px solid rgba(255,255,255,.7); border-radius: 999px; padding: 8px 16px; font-size: 14px; font-weight: 700; cursor: pointer; display: flex; gap: 6px; align-items: center; }
.usermenu-btn:hover { background: rgba(255,255,255,.28); }
.usermenu { position: absolute; right: 0; top: calc(100% + 8px); background: #fff; border-radius: 12px; box-shadow: 0 8px 24px rgba(16,40,70,.18); min-width: 210px; padding: 6px; z-index: 20; }
.usermenu button { display: flex; width: 100%; text-align: left; background: none; border: none; padding: 11px 12px; font-size: 14px; color: #1c2733; border-radius: 8px; cursor: pointer; }
.usermenu button:hover { background: #eef2f6; }

/* Gambar soal */
.q-img { max-width: 100%; border-radius: 12px; margin: 4px 0 16px; display: block; border: 1px solid #dbe3ea; background: #fff; }

/* Kehadiran: titik hijau kalau ada yang aktif, merah kalau 0 */
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.dot.green { background: #22c55e; }
.dot.red { background: #ef4444; }
.presence { margin-top: 0; font-size: 13px; color: #5b6b7a; text-align: right; }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
