:root {
  --bg: #0b0d10;
  --surface: #14171d;
  --surface-2: #1b2028;
  --border: #262c36;
  --text: #e6ebf2;
  --muted: #8b96a5;
  --accent: #ff4d00;
  --accent-2: #ff7836;
  --ok: #22c55e;
  --ok-bg: rgba(34, 197, 94, .12);
  --err: #ef4444;
  --err-bg: rgba(239, 68, 68, .12);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 40px;
}

#app { max-width: 680px; margin: 0 auto; padding: 12px; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 1.05rem;
}
.brand img { border-radius: 6px; }

nav { display: flex; gap: 4px; background: var(--surface); padding: 4px; border-radius: 8px; }
nav .tab {
  background: transparent;
  border: 0;
  color: var(--muted);
  padding: 6px 12px;
  font-size: .85rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
}
nav .tab.active { background: var(--surface-2); color: var(--text); }

.tabpane { display: none; }
.tabpane.active { display: block; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}
.card.tip { background: rgba(255, 77, 0, .06); border-color: rgba(255, 77, 0, .25); }

h1 { font-size: 1.4rem; font-weight: 700; margin-bottom: 4px; }
h2 { font-size: 1.05rem; font-weight: 600; margin: 20px 0 10px; color: var(--text); }
.muted { color: var(--muted); }

.prog-wrap { margin-top: 14px; }
.prog {
  height: 8px;
  background: var(--surface-2);
  border-radius: 99px;
  overflow: hidden;
}
.prog.thin { height: 4px; border-radius: 0; margin-bottom: 12px; }
.prog-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .3s ease;
}
.prog-label { font-size: .8rem; color: var(--muted); margin-top: 6px; text-align: right; }

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
@media (min-width: 480px) {
  .grid { grid-template-columns: 1fr 1fr; }
}

.mapel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  cursor: pointer;
  text-align: left;
  color: inherit;
  transition: border-color .15s;
}
.mapel-card:hover { border-color: var(--accent); }
.mapel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: .95rem;
  margin-bottom: 2px;
}
.mapel-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-2);
}
.mapel-meta { font-size: .8rem; color: var(--muted); }
.mapel-badge {
  display: inline-block;
  font-size: .7rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--accent-2);
  margin-top: 6px;
}

/* Test layout */
.test-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.q-card {
  font-size: 1.05rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.q-card .q-tag {
  display: inline-block;
  font-size: .75rem;
  background: var(--surface-2);
  color: var(--muted);
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 10px;
}

.options { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.opt-btn {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 14px;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  font-size: .95rem;
  line-height: 1.4;
  transition: all .15s;
}
.opt-btn:hover:not(:disabled) { border-color: var(--accent); background: var(--surface-2); }
.opt-key {
  font-family: var(--mono);
  font-weight: 700;
  color: var(--muted);
  min-width: 20px;
}
.opt-btn.correct { background: var(--ok-bg); border-color: var(--ok); color: #86efac; }
.opt-btn.wrong { background: var(--err-bg); border-color: var(--err); color: #fca5a5; }

.feedback {
  margin-top: 14px;
  padding: 14px;
  border-radius: 8px;
  background: var(--surface-2);
  border-left: 3px solid var(--accent);
}
.feedback.ok { border-left-color: var(--ok); }
.feedback.wrong { border-left-color: var(--err); }
.fb-head { font-size: .95rem; margin-bottom: 6px; }
.fb-body { font-size: .9rem; color: var(--muted); line-height: 1.5; white-space: pre-wrap; }
.feedback button { margin-top: 10px; width: 100%; }

/* Buttons */
button { font-family: inherit; }
button.primary {
  background: var(--accent);
  color: #fff;
  border: 0;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
}
button.primary:hover { opacity: .9; }
button.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
}
button.ghost:hover { color: var(--text); border-color: var(--text); }

.row { display: flex; gap: 8px; margin-top: 12px; }
.row button { flex: 1; }

/* Result */
.result-card { text-align: center; padding: 28px 16px; }
.score-big {
  font-size: 3rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.res-detail { margin-top: 10px; font-size: .9rem; color: var(--muted); }

/* Stats & Analisa */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}
.stat-box {
  background: var(--surface-2);
  border-radius: 8px;
  padding: 10px;
  text-align: center;
}
.stat-num { font-size: 1.3rem; font-weight: 700; color: var(--text); }
.stat-lbl { font-size: .75rem; color: var(--muted); }

.weak-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: .88rem;
}
.weak-pct { font-weight: 700; color: var(--err); }
.weak-pct.good { color: var(--ok); }

#sched-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
  margin-top: 10px;
}
#sched-table th, #sched-table td {
  padding: 8px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
#sched-table th { color: var(--muted); font-weight: 500; }
#sched-table tr.current { background: var(--surface-2); font-weight: 700; }

.switch-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}
.switch-row input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 6px;
  width: 80px;
}

/* --- Tipe soal: MCMA / PGK / Match --- */
.opt-btn.multi.selected {
  border-color: var(--accent);
  background: rgba(255, 77, 0, .10);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.q-hint { font-size: .78rem; color: var(--muted); margin-top: 2px; }
.commitbtn { width: 100%; margin-top: 6px; }
.commitbtn:disabled { opacity: .55; cursor: default; }

.stmt-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.stmt-text { font-size: .95rem; line-height: 1.45; }
.stmt-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.bs-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: .85rem;
}
.bs-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--text); }
.bs-btn.selected { border-color: var(--accent); color: var(--text); background: rgba(255, 77, 0, .12); }
.bs-btn.correct { border-color: var(--ok); color: #86efac; background: var(--ok-bg); }
.bs-btn.wrong { border-color: var(--err); color: #fca5a5; background: var(--err-bg); }
.stmt-row.stmt-ok { border-color: rgba(34, 197, 94, .55); }
.stmt-row.stmt-bad { border-color: rgba(239, 68, 68, .55); }
