:root {
  /* Palet biru-baja terinspirasi tampilan Jadiasn.id (HUE 197) */
  --bg: #192838;
  --bg-soft: #263d54;
  --surface: #ffffff;
  --surface-2: #f4f7fb;
  --ink: #1b2733;
  --ink-soft: #5b6776;
  --line: #e2e8f0;
  --brand: #356692;        /* primary-600 */
  --brand-500: #4781b0;    /* primary-500 */
  --brand-dark: #2c5378;   /* primary-700 */
  --brand-50: #f4f7fb;
  --brand-100: #e8eef6;
  --tiu: #6d4bd8;
  --twk: #0d8a7a;
  --tkp: #e0662a;
  --good: #1f9d57;
  --bad: #e0413c;
  --warn: #efa61e;
  --shadow: 0 12px 32px rgba(38, 61, 84, .12);
  --shadow-sm: 0 4px 14px rgba(38, 61, 84, .07);
  --radius: 16px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Urbanist", "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  background: var(--surface-2);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: linear-gradient(120deg, #192838, #2c5378);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.topbar-inner {
  max-width: 1080px; margin: 0 auto; padding: 0 18px;
  height: 62px; display: flex; align-items: center; gap: 20px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; }
.brand-mark {
  background: var(--brand); width: 34px; height: 34px; border-radius: 9px;
  display: grid; place-items: center; font-weight: 800; font-size: .9rem; letter-spacing: .5px;
}
.brand-text { font-size: 1.15rem; font-weight: 500; }
.brand-text strong { font-weight: 800; }
.topnav { margin-left: auto; display: flex; gap: 6px; }
.topnav a {
  color: #cdddec; text-decoration: none; padding: 8px 14px; border-radius: 9px;
  font-size: .95rem; transition: .15s;
}
.topnav a:hover { background: rgba(255,255,255,.1); color: #fff; }
.topnav a.active { background: var(--brand); color: #fff; }
.nav-toggle { display: none; background: none; border: 0; color: #fff; font-size: 1.5rem; cursor: pointer; }

/* ---------- Layout ---------- */
.app { max-width: 1080px; margin: 0 auto; padding: 26px 18px 60px; min-height: 70vh; }
.footer { text-align: center; color: var(--ink-soft); font-size: .82rem; padding: 24px; }

.section-title { font-size: 1.4rem; margin: 0 0 4px; }
.section-sub { color: var(--ink-soft); margin: 0 0 22px; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow-sm);
}
.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(125deg, #2c5378 0%, #4781b0 100%);
  color: #fff; border-radius: 22px; padding: 34px; margin-bottom: 24px;
  box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.hero h1 { font-size: 1.9rem; margin: 0 0 8px; }
.hero p { margin: 0 0 18px; max-width: 620px; color: #e6eef7; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-stats { display: flex; gap: 26px; margin-top: 22px; flex-wrap: wrap; }
.hero-stat b { display: block; font-size: 1.6rem; }
.hero-stat span { color: #cddcef; font-size: .82rem; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  border: 0; border-radius: 11px; padding: 12px 20px; font-size: .96rem; font-weight: 600;
  cursor: pointer; text-decoration: none; transition: .15s; font-family: inherit;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-light { background: #fff; color: var(--brand-dark); }
.btn-light:hover { background: #e8eef6; }
.btn-ghost { background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover { background: #eef1f7; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm { padding: 8px 14px; font-size: .85rem; border-radius: 9px; }

/* ---------- Mode cards ---------- */
.mode-card { display: flex; flex-direction: column; gap: 10px; transition: .15s; }
.mode-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.mode-ico { font-size: 1.8rem; }
.mode-card h3 { margin: 0; font-size: 1.12rem; }
.mode-card p { margin: 0; color: var(--ink-soft); font-size: .9rem; flex: 1; }

.pill {
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .72rem;
  font-weight: 700; letter-spacing: .3px;
}
.pill-tiu { background: #efe7ff; color: var(--tiu); }
.pill-twk { background: #def5f1; color: var(--twk); }
.pill-tkp { background: #ffe7df; color: var(--tkp); }
.pill-soft { background: var(--surface-2); color: var(--ink-soft); }

/* ---------- Forms ---------- */
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: .85rem; color: var(--ink-soft); margin-bottom: 6px; font-weight: 600; }
select, input[type="number"], input[type="date"] {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px;
  font-size: .95rem; font-family: inherit; background: #fff; color: var(--ink);
}
.choice-row { display: flex; flex-wrap: wrap; gap: 10px; }
.choice {
  border: 1.5px solid var(--line); border-radius: 11px; padding: 12px 14px; cursor: pointer;
  flex: 1; min-width: 120px; text-align: center; transition: .15s; background: #fff;
}
.choice small { display: block; color: var(--ink-soft); font-size: .78rem; }
.choice.active { border-color: var(--brand); background: #e8eef6; color: var(--brand-dark); font-weight: 600; }

/* ---------- Quiz (BKN CAT-style) ---------- */
.cat-bar {
  position: sticky; top: 62px; z-index: 30; background: linear-gradient(120deg,#192838,#2c5378);
  color: #fff; border-radius: 14px; padding: 12px 16px; margin-bottom: 16px;
  display: flex; align-items: center; gap: 14px; box-shadow: var(--shadow); flex-wrap: wrap;
}
.cat-bar-info { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cat-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 42vw; }
.cat-timer-wrap {
  margin-left: auto; display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.12); padding: 6px 14px; border-radius: 999px;
}
.cat-timer-ico { font-size: 1.05rem; }
.timer { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 1.25rem; letter-spacing: .5px; }
.timer.danger { color: #ffd1cc; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.progress-bar { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress-bar > i { display: block; height: 100%; background: var(--brand); transition: width .3s; }

/* Two-column layout */
.cat-layout { display: grid; grid-template-columns: 1fr 300px; gap: 16px; align-items: start; }
.cat-main { min-width: 0; }
.cat-side { position: sticky; top: 140px; }
.cat-side-card { padding: 16px; }
.cat-progress-row { display: flex; justify-content: space-between; align-items: baseline; }
.cat-progress-row b { font-size: 1.3rem; }
.nav-head { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; margin-bottom: 10px; }

.qcard { margin-bottom: 16px; }
.qmeta { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.qnum { font-weight: 800; color: var(--ink); font-size: 1.05rem; }
.qstem { font-size: 1.08rem; line-height: 1.7; white-space: pre-wrap; margin-bottom: 18px; }
.options { display: flex; flex-direction: column; gap: 10px; }
.opt {
  display: flex; gap: 12px; align-items: flex-start; border: 1.5px solid var(--line);
  border-radius: 12px; padding: 13px 15px; cursor: pointer; transition: .12s; background: #fff;
}
.opt:hover { border-color: #9fb6cf; background: #f7fafd; }
.opt.selected { border-color: var(--brand); background: #e8eef6; }
.opt .key {
  flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--surface-2);
  display: grid; place-items: center; font-weight: 700; font-size: .9rem; color: var(--ink-soft);
}
.opt.selected .key { background: var(--brand); color: #fff; }
.opt .opt-text { flex: 1; padding-top: 3px; }
.opt.correct { border-color: var(--good); background: #e9f8ef; }
.opt.correct .key { background: var(--good); color: #fff; }
.opt.wrong { border-color: var(--bad); background: #fdeceb; }
.opt.wrong .key { background: var(--bad); color: #fff; }
.opt .score-tag { margin-left: auto; font-size: .75rem; color: var(--ink-soft); font-weight: 700; align-self: center; }

.quiz-foot { display: flex; gap: 10px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.quiz-foot .spacer { flex: 1; }
.btn-warn { background: var(--warn); color: #5a3d00; }
.btn-warn:hover { filter: brightness(.96); }

/* Question navigator grid */
.navigator { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; }
.nav-dot {
  aspect-ratio: 1 / 1; border-radius: 9px; border: 1.5px solid var(--line); background: #fff;
  font-weight: 700; cursor: pointer; font-size: .82rem; color: var(--ink-soft); transition: .1s;
}
.nav-dot:hover { border-color: var(--brand); }
.nav-dot.answered { background: var(--brand); color: #fff; border-color: var(--brand); }
.nav-dot.flagged { background: var(--warn); color: #5a3d00; border-color: var(--warn); }
.nav-dot.flagged.answered { background: var(--warn); color: #5a3d00; }
.nav-dot.current { outline: 3px solid #4781b0; outline-offset: 1px; }
.nav-legend { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; margin-top: 14px; font-size: .76rem; color: var(--ink-soft); }
.nav-legend span { display: flex; align-items: center; gap: 6px; }
.lg { width: 14px; height: 14px; border-radius: 4px; border: 1.5px solid var(--line); display: inline-block; flex: none; }
.lg-answered { background: var(--brand); border-color: var(--brand); }
.lg-ragu { background: var(--warn); border-color: var(--warn); }
.lg-empty { background: #fff; }
.lg-current { background: #fff; outline: 2px solid #4781b0; }

@media (max-width: 820px) {
  .cat-layout { grid-template-columns: 1fr; }
  .cat-side { position: static; order: -1; }
  .cat-title { max-width: 40vw; }
}


/* ---------- Results ---------- */
.score-hero { text-align: center; padding: 30px; }
.score-ring {
  width: 150px; height: 150px; border-radius: 50%; margin: 0 auto 14px;
  display: grid; place-items: center; background: conic-gradient(var(--brand) var(--p,0%), var(--surface-2) 0);
}
.score-ring .inner { width: 118px; height: 118px; background: #fff; border-radius: 50%; display: grid; place-items: center; flex-direction: column; }
.score-ring b { font-size: 2rem; line-height: 1; }
.score-ring span { font-size: .75rem; color: var(--ink-soft); }
.verdict { font-size: 1.2rem; font-weight: 800; }
.verdict.pass { color: var(--good); }
.verdict.fail { color: var(--bad); }

.subscore { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.subscore:last-child { border-bottom: 0; }
.bar { height: 9px; border-radius: 999px; background: var(--surface-2); overflow: hidden; width: 100%; max-width: 260px; }
.bar > i { display: block; height: 100%; }

.review-item {
  border: 1px solid var(--line); border-left: 5px solid var(--line);
  border-radius: 14px; padding: 16px 18px; margin-bottom: 16px; background: #fff;
  box-shadow: var(--shadow-sm);
}
.review-item.r-correct { border-left-color: var(--good); }
.review-item.r-wrong { border-left-color: var(--bad); }
.review-item.r-partial { border-left-color: var(--warn); }
.rv-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.rv-status { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.rv-badge { font-weight: 700; font-size: .8rem; padding: 3px 11px; border-radius: 999px; }
.rv-badge.ok { background: #e9f8ef; color: var(--good); }
.rv-badge.no { background: #fdeceb; color: var(--bad); }
.rv-badge.partial { background: #fff5dd; color: #a9760a; }
.rv-badge.skip { background: var(--surface-2); color: var(--ink-soft); }
.rv-points { font-weight: 800; font-variant-numeric: tabular-nums; color: var(--ink-soft); font-size: .85rem; }
.rv-stem { font-size: 1rem; margin-bottom: 14px; }
.rv-options .opt { cursor: default; }
.rv-options .opt:hover { background: #fff; border-color: var(--line); }
.rv-options .opt.correct:hover { border-color: var(--good); background: #e9f8ef; }
.rv-options .opt.wrong:hover { border-color: var(--bad); background: #fdeceb; }
.opt-flag { margin-left: auto; font-size: .68rem; font-weight: 800; padding: 2px 9px; border-radius: 999px; align-self: center; text-transform: uppercase; letter-spacing: .3px; }
.opt-flag.ok { background: var(--good); color: #fff; }
.opt-flag.no { background: var(--bad); color: #fff; }

.explain {
  background: linear-gradient(180deg,#eef4fa,#f5f7fb); border: 1px solid #dbe6f1;
  border-radius: 12px; padding: 0; margin-top: 14px; font-size: .93rem; overflow: hidden;
}
.explain-head {
  background: var(--brand); color: #fff; font-weight: 700; font-size: .82rem;
  padding: 8px 14px; letter-spacing: .3px;
}
.explain-key { padding: 12px 16px 4px; }
.explain-key b { color: var(--brand-dark); }
.explain-body { padding: 4px 16px 14px; white-space: pre-wrap; line-height: 1.65; color: var(--ink); }
.tag { display:inline-block; background: var(--surface-2); color: var(--ink-soft); border-radius:999px; padding:2px 9px; font-size:.72rem; }

/* ---------- Stats ---------- */
.stat-tile { text-align: center; }
.stat-tile b { font-size: 1.7rem; display: block; }
.stat-tile span { color: var(--ink-soft); font-size: .82rem; }
.chart { display: flex; align-items: flex-end; gap: 8px; height: 170px; padding-top: 10px; }
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; justify-content: flex-end; height: 100%; }
.chart .col .barv { width: 70%; max-width: 42px; background: var(--brand); border-radius: 6px 6px 0 0; transition: height .4s; }
.chart .col .lbl { font-size: .68rem; color: var(--ink-soft); text-align: center; }
.skill-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.skill-row .name { width: 200px; font-size: .88rem; }
.skill-row .bar { max-width: none; }

/* ---------- Plan ---------- */
.plan-day { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; background: #fff; }
.plan-day.today { border-color: var(--brand); box-shadow: 0 0 0 2px #dbe6f1; }
.plan-day.done { background: #f3faf5; }
.day-badge { flex: none; width: 52px; height: 52px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; color: #fff; }
.day-badge.harian { background: var(--brand); }
.day-badge.besar { background: var(--tkp); }
.day-badge.diag { background: linear-gradient(135deg, var(--tiu), var(--brand)); }
.day-badge.review { background: var(--good); }
.day-badge.rest { background: var(--ink-soft); }
.day-badge small { font-size: .6rem; font-weight: 600; }
.plan-day .info { flex: 1; }
.plan-day .info h4 { margin: 0 0 2px; font-size: 1rem; }
.plan-day .info p { margin: 0; color: var(--ink-soft); font-size: .85rem; }
.check { color: var(--good); font-weight: 800; }

.empty { text-align: center; color: var(--ink-soft); padding: 30px; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 10px; box-shadow: var(--shadow); z-index: 100; opacity: 0; transition: .25s; }
.toast.show { opacity: 1; }

.divider { height: 1px; background: var(--line); margin: 22px 0; }
.muted { color: var(--ink-soft); }
.right { text-align: right; }
.mt0 { margin-top: 0; }

@media (max-width: 820px) {
  .grid-3, .grid-2, .grid-4 { grid-template-columns: 1fr; }
  .topnav { position: absolute; top: 62px; right: 0; left: 0; background: #192838; flex-direction: column; padding: 10px; display: none; }
  .topnav.open { display: flex; }
  .nav-toggle { display: block; margin-left: auto; }
  .hero h1 { font-size: 1.5rem; }
  .skill-row .name { width: 120px; }
}


/* ---------- Passcode gate ---------- */
body.locked { overflow: hidden; }
body.locked .topbar, body.locked .app, body.locked .footer { display: none !important; }
.gate-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: linear-gradient(135deg, #192838 0%, #2c5378 60%, #356692 100%);
  display: grid; place-items: center; padding: 20px; transition: opacity .25s;
}
.gate-overlay.gate-hide { opacity: 0; pointer-events: none; }
.gate-card {
  background: #fff; border-radius: 20px; padding: 34px 30px; width: 100%; max-width: 380px;
  text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.gate-card h1 { font-size: 1.5rem; margin: 6px 0 4px; font-weight: 500; }
.gate-card h1 strong { font-weight: 800; }
.gate-card p { color: var(--ink-soft); font-size: .92rem; margin: 0 0 20px; }
.gate-mark {
  width: 56px; height: 56px; border-radius: 15px; margin: 0 auto;
  background: var(--brand); color: #fff; display: grid; place-items: center;
  font-weight: 800; font-size: 1.2rem; letter-spacing: .5px;
}
.gate-card input {
  width: 100%; padding: 13px 14px; border: 1.5px solid var(--line); border-radius: 11px;
  font-size: 1.05rem; text-align: center; letter-spacing: 3px; font-family: inherit;
  margin-bottom: 12px;
}
.gate-card input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-100); }
.gate-err { color: var(--bad); font-size: .85rem; min-height: 20px; margin-bottom: 8px; font-weight: 600; }
.gate-card.shake { animation: gate-shake .4s; }
@keyframes gate-shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-9px); }
  40%, 80% { transform: translateX(9px); }
}
