/* ==========================================================================
   kka.css — Design system KKA Kelas 8 · SMP Al Falah Darmo Surabaya
   Satu file untuk semua halaman: index, materi, kuis, worksheet, STS,
   project, game, dan dashboard guru.

   Tidak ada font dari internet. Lab komputer sekolah sering lambat atau
   offline, jadi semua pakai font yang sudah ada di Windows/macOS.
   ========================================================================== */

/* ----------------------------------------------------------------- tokens */
:root {
  /* brand */
  --brand:      #0D9488;
  --brand-600:  #0b857a;
  --brand-700:  #0f766e;
  --brand-800:  #115e59;
  --brand-50:   #f0fdfa;
  --brand-100:  #ccfbf1;
  --brand-200:  #99f6e4;

  --accent:     #F59E0B;
  --accent-50:  #fffbeb;
  --accent-200: #fde68a;

  /* status */
  --ok:        #16a34a;  --ok-50:   #f0fdf4;  --ok-200: #bbf7d0;
  --warn:      #d97706;  --warn-50: #fffbeb;  --warn-200:#fde68a;
  --bad:       #dc2626;  --bad-50:  #fef2f2;  --bad-200: #fecaca;
  --info:      #2563eb;  --info-50: #eff6ff;  --info-200:#bfdbfe;

  /* ink & surface */
  --ink:       #111827;
  --ink-2:     #374151;
  --ink-3:     #6b7280;
  --ink-4:     #9ca3af;
  --surface:   #ffffff;
  --surface-2: #f9fafb;
  --surface-3: #f3f4f6;
  --line:      #e8eaed;
  --line-2:    #d8dce1;

  /* type */
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas,
          "Liberation Mono", monospace;

  /* shape */
  --r-sm: 8px;  --r: 12px;  --r-lg: 16px;  --r-xl: 22px;
  --sh-1: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.04);
  --sh-2: 0 2px 4px rgba(16,24,40,.04), 0 6px 16px rgba(16,24,40,.06);
  --sh-3: 0 8px 24px rgba(16,24,40,.10), 0 2px 6px rgba(16,24,40,.05);

  /* rhythm */
  --gap: 16px;
  --pad-card: 26px 24px;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--surface);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Latar motif kode — dibikin lebih tipis supaya teks tetap enak dibaca */
body.page {
  background-color: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='420' height='420' viewBox='0 0 420 420'%3E%3Cg fill='none' stroke='%230D9488' stroke-width='2' opacity='.035' font-family='monospace' font-weight='bold'%3E%3Ctext x='24' y='64' font-size='34'%3E%26lt%3B/%26gt%3B%3C/text%3E%3Ctext x='220' y='42' font-size='26'%3E%7B %7D%3C/text%3E%3Ctext x='316' y='136' font-size='22'%3E%3B%3C/text%3E%3Ctext x='64' y='198' font-size='18'%3E01%3C/text%3E%3Ctext x='352' y='262' font-size='30'%3E%26lt%3B/%26gt%3B%3C/text%3E%3Ctext x='32' y='314' font-size='24'%3E%7B %7D%3C/text%3E%3Ctext x='178' y='376' font-size='22'%3E%3B%3C/text%3E%3Ctext x='262' y='388' font-size='16'%3E10%3C/text%3E%3C/g%3E%3Cg fill='%23F59E0B' opacity='.18'%3E%3Cpath d='M248 208 l6 -18 l6 18 l6 -6 l-12 -12 l-12 12 l6 6 z'/%3E%3Cpath d='M104 342 l4 -12 l4 12 l4 -4 l-8 -8 l-8 8 l4 4 z'/%3E%3Cpath d='M332 42 l3 -9 l3 9 l3 -3 l-6 -6 l-6 6 l3 3 z'/%3E%3C/g%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 420px 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 52px 20px 40px;
}

/* ------------------------------------------------------------- shell/head */
.shell     { width: 100%; max-width: 680px; }
.shell-wide{ width: 100%; max-width: 1180px; }
.container { width: 100%; max-width: 680px; }

.rule, .top-line {
  width: 52px; height: 4px; border-radius: 99px;
  background: linear-gradient(90deg, var(--brand), var(--brand-200));
  margin: 0 auto 22px;
}

h1, .h-page {
  font-size: clamp(24px, 3.4vw, 31px);
  font-weight: 800;
  letter-spacing: -.022em;
  line-height: 1.18;
  text-align: center;
  color: var(--brand-700);
  margin-bottom: 10px;
  text-wrap: balance;
}
p.subtitle, .lead {
  font-size: 15px;
  text-align: center;
  color: var(--ink-3);
  max-width: 520px;
  margin: 0 auto 42px;
  line-height: 1.62;
  text-wrap: pretty;
}
h2 { font-size: 20px; font-weight: 700; letter-spacing: -.015em; line-height: 1.3; }
h3 { font-size: 16px; font-weight: 700; letter-spacing: -.01em; }

.muted      { color: var(--ink-3); }
.small      { font-size: 13px; }
.tiny       { font-size: 12px; }
.center     { text-align: center; }
.mono       { font-family: var(--mono); }
.nowrap     { white-space: nowrap; }
.hidden     { display: none !important; }

/* --------------------------------------------------------------- sections */
.section { width: 100%; margin-bottom: 38px; }
.section-title, .eyebrow {
  font-size: 11.5px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .1em; color: var(--brand-700);
  margin-bottom: 14px; padding-bottom: 9px;
  border-bottom: 1.5px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.section-title .hint { font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--ink-4); font-size: 12px; }

/* ------------------------------------------------------------------ cards */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--pad-card);
  box-shadow: var(--sh-1);
  margin-bottom: 20px;
}
.card-tight { padding: 18px 20px; }
.h-card, .card > h2:first-child {
  font-size: 15px; font-weight: 800; color: var(--brand-700);
  letter-spacing: -.005em; margin-bottom: 16px;
}

/* Kartu yang bisa diklik (index, daftar materi) */
.cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--gap); width: 100%; }
.cards-3 { grid-template-columns: repeat(3, 1fr); }
.cards-1 { grid-template-columns: 1fr; }

.tile {
  position: relative;
  display: flex; flex-direction: column; gap: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px 20px 18px;
  text-decoration: none; color: inherit;
  box-shadow: var(--sh-1);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
  overflow: hidden;
}
.tile::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 3px;
  background: var(--brand); opacity: 0; transition: opacity .16s ease;
}
.tile:hover { transform: translateY(-3px); box-shadow: var(--sh-2); border-color: var(--brand-200); }
.tile:hover::before { opacity: 1; }
.tile:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.tile .t-step {
  font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  color: var(--brand); display: flex; align-items: center; gap: 7px;
}
.tile .t-title { font-size: 15.5px; font-weight: 700; color: var(--ink); line-height: 1.35; letter-spacing: -.01em; }
.tile .t-desc  { font-size: 12.5px; color: var(--ink-3); line-height: 1.5; }
.tile .t-meta  { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.tile.is-locked { opacity: .55; pointer-events: none; }
.tile.is-accent::before { background: var(--accent); opacity: 1; }
.tile.is-accent .t-step { color: var(--accent); }

/* Kartu materi lama (1-opening-rules) */
.materi-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.materi-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 18px 16px; box-shadow: var(--sh-1);
}
.materi-card .bab { font-size: 11px; font-weight: 800; color: var(--brand); text-transform: uppercase; letter-spacing: .07em; }
.materi-card .title { font-size: 15px; font-weight: 700; color: var(--ink); margin: 6px 0 4px; line-height: 1.35; }
.materi-card .desc, .card p.desc { font-size: 12.5px; color: var(--ink-3); line-height: 1.5; }
.card .num, .tile .num { font-size: 30px; font-weight: 800; color: var(--brand); line-height: 1; margin-bottom: 8px; letter-spacing: -.03em; }

/* ------------------------------------------------------------------ chips */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 99px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .01em;
  background: var(--surface-3); color: var(--ink-2);
  border: 1px solid var(--line);
}
.chip-brand { background: var(--brand-50); color: var(--brand-700); border-color: var(--brand-200); }
.chip-ok    { background: var(--ok-50);    color: #15803d;          border-color: var(--ok-200); }
.chip-warn  { background: var(--warn-50);  color: #b45309;          border-color: var(--warn-200); }
.chip-bad   { background: var(--bad-50);   color: #b91c1c;          border-color: var(--bad-200); }
.chip-info  { background: var(--info-50);  color: #1d4ed8;          border-color: var(--info-200); }
.badge-class { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11.5px; font-weight: 700;
               background: var(--brand-50); color: var(--brand-700); border: 1px solid var(--brand-200); }

/* ---------------------------------------------------------------- buttons */
.btn, .next-btn, .btn-next-tab {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px; border: 1px solid transparent; border-radius: 10px;
  font-family: inherit; font-size: 14px; font-weight: 700; letter-spacing: -.005em;
  cursor: pointer; text-decoration: none; line-height: 1.2;
  transition: background .14s ease, box-shadow .14s ease, transform .1s ease, border-color .14s ease;
}
.btn:active, .next-btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.btn[disabled], .btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.btn-primary, .next-btn, .btn-next-tab { background: var(--brand); color: #fff; box-shadow: 0 1px 2px rgba(13,148,136,.3); }
.btn-primary:hover, .next-btn:hover, .btn-next-tab:hover { background: var(--brand-600); }
.btn-ghost   { background: var(--surface); color: var(--ink-2); border-color: var(--line-2); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--ink-4); }
.btn-soft    { background: var(--brand-50); color: var(--brand-700); border-color: var(--brand-200); }
.btn-soft:hover { background: var(--brand-100); }
.btn-danger  { background: var(--bad-50); color: #b91c1c; border-color: var(--bad-200); }
.btn-danger:hover { background: #fee2e2; }
.btn-accent  { background: var(--accent); color: #fff; }
.btn-accent:hover { background: #d97706; }
.btn-sm      { padding: 6px 13px; font-size: 12.5px; border-radius: 8px; }
.btn-xs      { padding: 3px 9px;  font-size: 11.5px; border-radius: 7px; gap: 4px; }
.btn-block   { width: 100%; }
.btn-row     { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.next-btn { display: none; margin-top: 16px; }
.next-btn.show { display: inline-flex; }

.back {
  display: inline-block; margin-top: 10px;
  font-size: 13.5px; font-weight: 600; color: var(--brand-700); text-decoration: none;
}
.back:hover { text-decoration: underline; }

/* ------------------------------------------------------------------- tabs */
.tabs {
  display: flex; gap: 2px; margin-bottom: 28px;
  border-bottom: 1.5px solid var(--line);
  overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: 12px 17px; font-size: 12.5px; font-weight: 800;
  color: var(--ink-4); cursor: pointer; white-space: nowrap;
  border-bottom: 2.5px solid transparent; margin-bottom: -1.5px;
  text-transform: uppercase; letter-spacing: .055em;
  transition: color .14s ease, border-color .14s ease;
  background: none; border-top: 0; border-left: 0; border-right: 0; font-family: inherit;
}
.tab:hover { color: var(--brand); }
.tab.active { color: var(--brand-700); border-bottom-color: var(--brand); }
.tab .tab-n {
  margin-left: 6px; padding: 1px 6px; border-radius: 99px;
  background: var(--surface-3); color: var(--ink-3); font-size: 10.5px; letter-spacing: 0;
}
.tab.active .tab-n { background: var(--brand-100); color: var(--brand-700); }

.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn .26s ease; }
.panel { display: none; }
.panel.active { display: block; animation: fadeIn .26s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }

/* --------------------------------------------------------------- progress */
.progress-wrap { margin-bottom: 22px; }
.progress-info { display: flex; justify-content: space-between; font-size: 12px; font-weight: 700; color: var(--ink-3); margin-bottom: 7px; }
.progress-bar  { width: 100%; height: 7px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--brand), #2dd4bf); border-radius: 99px; transition: width .45s cubic-bezier(.4,0,.2,1); }
.meter      { height: 7px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.meter > i  { display: block; height: 100%; border-radius: 99px; background: var(--brand); transition: width .5s ease; }
.meter.high > i { background: var(--ok); }
.meter.mid  > i { background: var(--accent); }
.meter.low  > i { background: var(--bad); }

/* ------------------------------------------------------------ quiz cards */
.q-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 26px 24px;
  box-shadow: var(--sh-1); margin-bottom: 18px;
}
.q-number {
  font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em;
  color: var(--brand); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.q-badge { padding: 2px 8px; border-radius: 99px; background: var(--brand-50); color: var(--brand-700);
           border: 1px solid var(--brand-200); letter-spacing: .02em; }
.q-text  { font-size: 15.5px; font-weight: 650; color: var(--ink); line-height: 1.55; margin-bottom: 16px; }
.q-text b, .q-text strong { font-weight: 800; }

.q-code, pre.code, .codeblock {
  background: #0f172a; color: #e2e8f0;
  font-family: var(--mono); font-size: 13px;
  padding: 15px 17px; border-radius: var(--r);
  margin-bottom: 16px; line-height: 1.68;
  overflow-x: auto; white-space: pre; tab-size: 2;
  border: 1px solid #1e293b;
}
.q-code .kw, .codeblock .kw { color: #c4b5fd; }
.q-code .str,.codeblock .str{ color: #86efac; }
.q-code .num,.codeblock .num{ color: #fcd34d; }
.q-code .cm, .codeblock .cm { color: #64748b; font-style: italic; }
.q-code .fn, .codeblock .fn { color: #7dd3fc; }
code {
  font-family: var(--mono); font-size: .9em;
  background: var(--surface-3); color: var(--brand-800);
  padding: 1.5px 6px; border-radius: 5px; border: 1px solid var(--line);
}

.options { display: flex; flex-direction: column; gap: 8px; }
.opt-btn {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 15px; width: 100%;
  border: 1.5px solid var(--line-2); border-radius: 11px;
  background: var(--surface); cursor: pointer;
  font-family: inherit; font-size: 14.5px; color: var(--ink-2);
  text-align: left; line-height: 1.45;
  transition: border-color .14s ease, background .14s ease, transform .1s ease;
}
.opt-btn:hover:not(.locked) { border-color: var(--brand); background: var(--brand-50); }
.opt-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.opt-btn .letter {
  flex-shrink: 0; width: 27px; height: 27px; border-radius: 8px;
  background: var(--surface-3); color: var(--ink-3);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800;
  transition: background .14s ease, color .14s ease;
}
.opt-btn.correct { border-color: var(--ok); background: var(--ok-50); }
.opt-btn.correct .letter { background: var(--ok); color: #fff; }
.opt-btn.wrong   { border-color: var(--bad); background: var(--bad-50); }
.opt-btn.wrong .letter { background: var(--bad); color: #fff; }
.opt-btn.reveal  { border-color: var(--ok); background: var(--ok-50); opacity: .72; }
.opt-btn.selected { border-color: var(--brand); background: var(--brand-50); }
.opt-btn.selected .letter { background: var(--brand); color: #fff; }
.opt-btn.locked  { cursor: default; }

.feedback {
  margin-top: 14px; padding: 11px 14px; border-radius: 10px;
  font-size: 13.5px; line-height: 1.55; display: none;
}
.feedback.show    { display: block; }
.feedback.correct { background: var(--ok-50);  color: #15803d; border: 1px solid var(--ok-200); }
.feedback.wrong   { background: var(--bad-50); color: #b91c1c; border: 1px solid var(--bad-200); }

/* ------------------------------------------------------------ result card */
.result-card {
  display: none; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-xl); padding: 34px 28px;
  box-shadow: var(--sh-2); text-align: center;
}
.result-card.show { display: block; }
.result-emoji { font-size: 46px; line-height: 1; margin-bottom: 12px; }
.result-score { font-size: 44px; font-weight: 800; color: var(--brand-700); line-height: 1; letter-spacing: -.035em; }
.result-of    { font-size: 15px; color: var(--ink-3); margin-bottom: 6px; }
.result-label { font-size: 15px; font-weight: 700; color: var(--ink); margin-bottom: 20px; }
.result-bar-wrap { max-width: 260px; margin: 0 auto 20px; }
.result-bar { height: 9px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.result-bar-fill { height: 100%; width: 0; border-radius: 99px; transition: width .8s cubic-bezier(.4,0,.2,1); }
.result-bar-fill.high { background: var(--ok); }
.result-bar-fill.mid  { background: var(--accent); }
.result-bar-fill.low  { background: var(--bad); }
.result-detail { display: flex; justify-content: center; gap: 30px; margin-bottom: 20px; flex-wrap: wrap; }
.rd-num   { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.rd-num.green { color: var(--ok); } .rd-num.red { color: var(--bad); }
.rd-label { font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; margin-top: 2px; }

/* ------------------------------------------------------------- worksheet */
.ws-question { margin-bottom: 20px; }
.ws-q-num {
  font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .09em;
  color: var(--brand); margin-bottom: 7px;
}
.ws-q-text { font-size: 14.5px; color: var(--ink); line-height: 1.6; margin-bottom: 10px; }
.ws-q-text ul, .ws-q-text ol { margin: 8px 0 0 20px; }
.ws-q-text li { margin-bottom: 4px; }
.ws-answer, textarea.ws-answer {
  width: 100%; min-height: 96px; padding: 12px 14px;
  border: 1.5px solid var(--line-2); border-radius: 10px;
  font-family: var(--mono); font-size: 13.5px; line-height: 1.65;
  color: var(--ink); background: var(--surface); resize: vertical;
}
.ws-answer:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-50); }
.uraian-area {
  width: 100%; min-height: 110px; padding: 13px 15px;
  border: 1.5px solid var(--line-2); border-radius: 10px;
  font-family: var(--mono); font-size: 13.5px; line-height: 1.65; resize: vertical;
}
.uraian-area:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-50); }

/* ═══════════════════ isi halaman materi (dipakai semua bab) ═══════════════
   Dulu aturan-aturan ini ditulis ulang di tiap halaman dengan nilai yang
   sedikit berbeda, jadi tiap bab tampil agak lain. Sekarang satu sumber. */
.materi-section, .game-section {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: var(--pad-card);
  box-shadow: var(--sh-1); margin-bottom: 20px;
}
.materi-section h2, .game-section h2 {
  font-size: 17px; font-weight: 800; color: var(--brand-700);
  margin-bottom: 14px; letter-spacing: -.015em; line-height: 1.3;
}
.game-section h2 { margin-bottom: 6px; }
.materi-section h3 { font-size: 14.5px; font-weight: 800; color: var(--ink); margin: 18px 0 8px; letter-spacing: -.005em; }
.materi-section h3:first-of-type { margin-top: 0; }
.materi-section p { font-size: 14.5px; color: var(--ink-2); line-height: 1.72; margin-bottom: 11px; }
.materi-section ol, .materi-section ul { padding-left: 21px; margin-bottom: 11px; }
.materi-section li { font-size: 14.5px; color: var(--ink-2); line-height: 1.72; margin-bottom: 5px; }
.materi-section strong, .game-section strong { color: var(--ink); font-weight: 700; }
.game-section .game-desc { font-size: 13px; color: var(--ink-3); margin-bottom: 16px; line-height: 1.6; }

/* tabel penjelasan */
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; margin: 10px 0 16px; font-size: 13.5px;
              border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.data-table th {
  background: var(--brand); color: #fff; padding: 10px 13px; text-align: left;
  font-weight: 700; font-size: 12px; letter-spacing: .03em;
}
.data-table td { padding: 10px 13px; border-bottom: 1px solid var(--surface-3); color: var(--ink-2); vertical-align: top; line-height: 1.6; }
.data-table tr:last-child td { border-bottom: none; }
.data-table .code, .materi-section .code {
  font-family: var(--mono); background: var(--surface-3); color: var(--brand-800);
  padding: 2px 6px; border-radius: 5px; font-size: 12.5px; border: 1px solid var(--line);
}

/* tabel kebenaran */
.truth-table { width: 100%; border-collapse: collapse; margin: 8px 0 16px; font-size: 13.5px; text-align: center; }
.truth-table th {
  background: var(--brand-50); color: var(--brand-700); padding: 9px;
  font-weight: 800; border: 1px solid var(--line-2); font-size: 12px;
  text-transform: uppercase; letter-spacing: .05em;
}
.truth-table td { padding: 9px; border: 1px solid var(--line); font-family: var(--mono); font-weight: 700; color: var(--ink-2); }
.truth-table .t { color: var(--ok); }
.truth-table .f { color: var(--bad); }

/* blok pseudocode */
.pseudo-code {
  background: #0f172a; color: #e2e8f0; font-family: var(--mono); font-size: 13px;
  padding: 16px 18px; border-radius: var(--r); line-height: 1.72;
  margin: 10px 0 16px; white-space: pre-wrap; border: 1px solid #1e293b; overflow-x: auto;
}
.pseudo-code .kw { color: #c4b5fd; } .pseudo-code .str { color: #86efac; }
.pseudo-code .num { color: #fcd34d; } .pseudo-code .cm  { color: #64748b; font-style: italic; }
.pseudo-code .fn  { color: #7dd3fc; }

/* kotak catatan di dalam materi */
.tip-box {
  background: var(--accent-50); border: 1px solid var(--accent-200);
  border-radius: var(--r); padding: 13px 16px; margin: 12px 0;
  font-size: 13.5px; color: #92400e; line-height: 1.65;
}
.apersepsi, .ws-intro {
  background: var(--brand-50); border: 1px solid var(--brand-200);
  border-radius: var(--r); padding: 15px 19px; margin-bottom: 20px;
  font-size: 14px; color: var(--brand-800); line-height: 1.7;
}
.ws-intro p { font-size: 14px; color: var(--brand-800); line-height: 1.65; margin: 0; }

/* pemilih kelas & nama di worksheet */
.ws-selector { display: flex; gap: 11px; margin-bottom: 16px; flex-wrap: wrap; align-items: flex-end; }
.ws-field { flex: 1; min-width: 130px; }
.ws-field label {
  display: block; font-size: 10.5px; font-weight: 800; color: var(--ink-3);
  margin-bottom: 5px; text-transform: uppercase; letter-spacing: .08em;
}
.ws-field select, .ws-field input {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--line-2);
  border-radius: 9px; font-size: 14px; font-family: inherit;
  background: var(--surface); color: var(--ink); cursor: pointer;
}
.ws-field select:focus, .ws-field input:focus {
  border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-50);
}
.ws-field select:disabled { background: var(--surface-2); color: var(--ink-4); cursor: not-allowed; }

.ws-submit, .game-btn {
  padding: 12px 26px; background: var(--brand); color: #fff; border: none;
  border-radius: 10px; font-size: 14px; font-weight: 700; cursor: pointer;
  font-family: inherit; margin-top: 8px; box-shadow: 0 1px 2px rgba(13,148,136,.3);
  transition: background .14s ease;
}
.ws-submit:hover:not(:disabled), .game-btn:hover:not(:disabled) { background: var(--brand-600); }
.ws-submit:disabled, .game-btn:disabled { opacity: .4; cursor: not-allowed; }
.game-btn { width: 100%; margin: 0 0 12px; padding: 12px; }

.ws-msg { margin-top: 12px; padding: 11px 14px; border-radius: 9px; font-size: 13.5px; display: none; line-height: 1.55; }
.ws-msg.show { display: block; }
.ws-msg.ok  { background: var(--ok-50);  color: #15803d; border: 1px solid var(--ok-200); }
.ws-msg.err { background: var(--bad-50); color: #b91c1c; border: 1px solid var(--bad-200); }

/* simulator kecil di halaman materi */
.game-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; margin-bottom: 16px; }
.game-input-group { display: flex; flex-direction: column; gap: 5px; }
.game-input-group label { font-size: 12px; font-weight: 700; color: var(--ink-2); }
.game-input-group input, .game-input-group select {
  padding: 10px 12px; border: 1.5px solid var(--line-2); border-radius: 9px;
  font-size: 14px; font-family: inherit; background: var(--surface); color: var(--ink);
}
.game-input-group input:focus, .game-input-group select:focus {
  border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-50);
}
.game-output {
  min-height: 60px; background: var(--surface-2); border: 2px dashed var(--line-2);
  border-radius: var(--r); padding: 16px; font-size: 14px; color: var(--ink-2);
  line-height: 1.7; text-align: center; transition: border-color .25s ease, background .25s ease;
}
.game-output.active { border-color: var(--brand); background: var(--brand-50); border-style: solid; }
.game-trace { margin-top: 12px; font-size: 12.5px; color: var(--ink-3); line-height: 1.75; text-align: left; }
.game-trace .step { padding: 5px 9px; border-radius: 7px; margin-bottom: 4px; display: block; }
.game-trace .step.true   { background: var(--ok-50);  color: #15803d; border-left: 3px solid var(--ok); }
.game-trace .step.false  { background: var(--bad-50); color: #b91c1c; border-left: 3px solid var(--bad); }
.game-trace .step.event  { background: var(--accent-50); color: #92400e; border-left: 3px solid var(--accent); }
.game-trace .step.result { background: var(--info-50); color: #1e40af; border-left: 3px solid var(--info); font-weight: 700; }

.btn-to-materi, .btn-next-tab {
  padding: 10px 24px; background: var(--brand); color: #fff; border: none;
  border-radius: 10px; font-size: 14px; font-weight: 700; cursor: pointer; font-family: inherit;
}
.btn-to-materi:hover { background: var(--brand-600); }

/* ------------------------------------------------------------------ forms */
.row   { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; align-items: flex-end; }
.field { flex: 1; min-width: 130px; }
.field label, .lbl {
  display: block; font-size: 10.5px; font-weight: 800; color: var(--ink-3);
  margin-bottom: 5px; text-transform: uppercase; letter-spacing: .08em;
}
.field input, .field select, .field textarea,
input.inp, select.inp, textarea.inp {
  width: 100%; padding: 9px 12px;
  border: 1.5px solid var(--line-2); border-radius: 9px;
  font-size: 14px; font-family: inherit; color: var(--ink); background: var(--surface);
  transition: border-color .14s ease, box-shadow .14s ease;
}
.field select, select.inp { cursor: pointer; }
.field input:focus, .field select:focus, .field textarea:focus,
input.inp:focus, select.inp:focus, textarea.inp:focus {
  border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-50);
}
.field input[disabled], .field select[disabled] { background: var(--surface-2); color: var(--ink-4); cursor: not-allowed; }
.filter-row { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; align-items: flex-end; }
.switch { display: inline-flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--ink-2); cursor: pointer; }
.switch input { width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; }

/* ----------------------------------------------------------------- notes */
.note, .info-box, .warn-box {
  padding: 13px 16px; border-radius: var(--r);
  font-size: 13.5px; line-height: 1.6; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--ink-2);
}
.note + .note { margin-top: 10px; }
.note strong { font-weight: 700; }
.note-info, .info-box { background: var(--info-50); border-color: var(--info-200); color: #1e40af; }
.note-ok    { background: var(--ok-50);   border-color: var(--ok-200);   color: #15803d; }
.note-warn, .warn-box { background: var(--warn-50); border-color: var(--warn-200); color: #92400e; }
.note-bad   { background: var(--bad-50);  border-color: var(--bad-200);  color: #b91c1c; }

.msg { padding: 10px 14px; border-radius: 9px; font-size: 13.5px; margin-bottom: 12px; display: none; }
.msg.show { display: block; }
.msg.ok  { background: var(--ok-50);  color: #15803d; border: 1px solid var(--ok-200); }
.msg.err { background: var(--bad-50); color: #b91c1c; border: 1px solid var(--bad-200); }

/* ------------------------------------------------------------------ stats */
.statgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 12px; }
.stat-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.stat-row > .stat { flex: 1; min-width: 108px; }
.stat {
  background: var(--brand-50); border: 1px solid var(--brand-200);
  border-radius: var(--r); padding: 13px 14px; text-align: center;
}
.stat-n, .stat .num { font-size: 25px; font-weight: 800; color: var(--brand-700); line-height: 1.1; letter-spacing: -.03em; }
.stat-l, .stat .lbl { font-size: 11px; color: var(--ink-3); margin-top: 3px; line-height: 1.35; }
.stat.is-warn { background: var(--warn-50); border-color: var(--warn-200); }
.stat.is-warn .stat-n { color: #b45309; }
.stat.is-bad  { background: var(--bad-50);  border-color: var(--bad-200); }
.stat.is-bad  .stat-n { color: #b91c1c; }
.stat.is-ok   { background: var(--ok-50);   border-color: var(--ok-200); }
.stat.is-ok   .stat-n { color: #15803d; }
.stat.is-plain{ background: var(--surface-2); border-color: var(--line); }
.stat.is-plain .stat-n { color: var(--ink); }

/* ------------------------------------------------------------------ table
   Catatan penting: JANGAN pernah pakai position:absolute untuk menaruh
   tombol di dalam sel yang sudah berisi input — itu yang bikin angka nilai
   ketimpa tombol. Tombol aksi selalu dapat kolomnya sendiri.              */
.tbl-wrap {
  margin-top: 12px; overflow: auto;
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface);
  max-height: 72vh;
}
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.tbl th {
  background: var(--surface-2); padding: 9px 11px; text-align: left;
  font-weight: 800; color: var(--ink-3); font-size: 10.5px;
  text-transform: uppercase; letter-spacing: .07em; white-space: nowrap;
  border-bottom: 1.5px solid var(--line-2);
  position: sticky; top: 0; z-index: 3;
}
.tbl thead tr:nth-child(2) th { top: 32px; z-index: 3; }
.tbl th.grp {
  text-align: center; border-left: 1px solid var(--line);
  color: var(--brand-700); background: var(--brand-50);
}
.tbl th.sub { text-align: center; font-size: 10px; letter-spacing: .04em; }
.tbl td {
  padding: 7px 11px; border-bottom: 1px solid var(--surface-3);
  vertical-align: middle; background: var(--surface);
}
.tbl tbody tr:hover td { background: var(--brand-50); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl td.c, .tbl th.c { text-align: center; }
.tbl td.r, .tbl th.r { text-align: right; }
.tbl td.sep, .tbl th.sep { border-left: 1px solid var(--line); }

/* kolom nama & kelas menempel saat tabel digeser ke samping */
.tbl .stick   { position: sticky; z-index: 2; }
.tbl .stick-1 { left: 0;    min-width: 42px;  }
.tbl .stick-2 { left: 42px; min-width: 190px; }
.tbl th.stick { z-index: 4; }
.tbl .stick::after {
  content: ""; position: absolute; top: 0; right: -1px; bottom: 0; width: 1px; background: var(--line);
}
.tbl .stick-2::after { box-shadow: 3px 0 7px -3px rgba(16,24,40,.14); width: 1px; }

.tbl .name { font-weight: 600; color: var(--ink); }
.tbl input.score-input {
  width: 54px; padding: 5px 6px;
  border: 1.5px solid var(--line-2); border-radius: 7px;
  font-size: 13.5px; text-align: center; font-family: inherit; color: var(--ink);
  background: var(--surface);
}
.tbl input.score-input:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-50); }
.tbl input.score-input.filled { background: var(--brand-50); font-weight: 700; color: var(--brand-800); border-color: var(--brand-200); }
.tbl input.score-input.saving { border-color: var(--accent); }
.tbl input.score-input.saved  { border-color: var(--ok); }
.tbl input.score-input.low    { color: var(--bad); }
.tbl .cell-eye { width: 30px; padding-left: 0; padding-right: 6px; }
.eye {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 7px; cursor: pointer;
  background: var(--surface-3); border: 1px solid var(--line);
  color: var(--ink-3); font-size: 12px; line-height: 1;
  transition: background .14s ease, color .14s ease;
}
.eye:hover { background: var(--brand-100); color: var(--brand-700); border-color: var(--brand-200); }
.eye.is-off { opacity: .22; pointer-events: none; }
.empty-cell { color: var(--ink-4); }
.tbl-empty { text-align: center; color: var(--ink-4); padding: 28px 12px; font-size: 13.5px; }

/* ----------------------------------------------------------------- topbar */
.topbar {
  background: var(--brand); color: #fff;
  padding: 12px 22px; display: flex; justify-content: space-between;
  align-items: center; gap: 14px;
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 1px 3px rgba(0,0,0,.12);
}
.topbar h1 { font-size: 15.5px; font-weight: 800; color: #fff; text-align: left; margin: 0; letter-spacing: -.01em; }
.topbar .tb-right { display: flex; align-items: center; gap: 10px; }
.topbar button, .topbar .tb-btn {
  background: rgba(255,255,255,.17); color: #fff; border: 1px solid rgba(255,255,255,.22);
  padding: 6px 13px; border-radius: 8px; font-size: 12.5px; cursor: pointer;
  font-weight: 700; font-family: inherit; text-decoration: none;
}
.topbar button:hover, .topbar .tb-btn:hover { background: rgba(255,255,255,.28); }

/* Breadcrumb untuk halaman materi */
.crumb {
  width: 100%; max-width: 680px; margin: -30px auto 24px;
  display: flex; align-items: center; gap: 7px;
  font-size: 12.5px; color: var(--ink-4); flex-wrap: wrap;
}
.crumb a { color: var(--brand-700); text-decoration: none; font-weight: 600; }
.crumb a:hover { text-decoration: underline; }
.crumb span.sep { color: var(--line-2); }

.app-tabs {
  display: flex; gap: 0; background: var(--surface);
  border-bottom: 1px solid var(--line); padding: 0 22px;
  position: sticky; top: 45px; z-index: 40; overflow-x: auto; scrollbar-width: none;
}
.app-tabs::-webkit-scrollbar { display: none; }
.content { padding: 24px 22px 48px; max-width: 1180px; margin: 0 auto; }

/* ------------------------------------------------------------------ modal */
.modal-bg {
  display: none; position: fixed; inset: 0;
  background: rgba(17,24,39,.55); z-index: 100;
  justify-content: center; align-items: center; padding: 20px;
  backdrop-filter: blur(2px);
}
.modal-bg.show { display: flex; }
.modal {
  background: var(--surface); border-radius: var(--r-xl);
  padding: 28px 26px; max-width: 580px; width: 100%;
  max-height: 86vh; overflow-y: auto; box-shadow: var(--sh-3);
}
.modal-lg { max-width: 820px; }
.modal h3 { font-size: 17px; color: var(--brand-700); margin-bottom: 6px; font-weight: 800; letter-spacing: -.015em; }
.modal .modal-sub { font-size: 13px; color: var(--ink-3); margin-bottom: 18px; }
.modal .ans-item { padding: 14px 0; border-bottom: 1px solid var(--surface-3); }
.modal .ans-item:last-of-type { border-bottom: 0; }
.modal .ans-q { font-size: 12.5px; font-weight: 700; color: var(--brand-700); margin-bottom: 6px; line-height: 1.5; }
.modal .ans-a {
  font-size: 13.5px; color: var(--ink-2); line-height: 1.65; white-space: pre-wrap;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 9px; padding: 11px 13px; font-family: var(--mono);
}
.modal .ans-a.is-empty { color: var(--ink-4); font-style: italic; font-family: var(--font); }
.modal .close-btn {
  margin-top: 18px; padding: 9px 20px; background: var(--surface-3); color: var(--ink-2);
  border: 1px solid var(--line-2); border-radius: 9px; font-size: 13.5px; font-weight: 700;
  cursor: pointer; font-family: inherit;
}
.modal .close-btn:hover { background: var(--line); }
.modal-foot { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 18px;
              padding-top: 16px; border-top: 1px solid var(--line); }

/* ------------------------------------------------------------------ login */
.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.login-box {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-xl); padding: 38px 32px; max-width: 390px; width: 100%;
  box-shadow: var(--sh-3); text-align: center;
}
.login-box h1 { font-size: 21px; color: var(--brand-700); margin-bottom: 6px; }
.login-box p  { font-size: 13px; color: var(--ink-3); margin-bottom: 22px; }
.login-box input {
  width: 100%; padding: 11px 15px; border: 1.5px solid var(--line-2);
  border-radius: 10px; font-size: 14px; font-family: inherit; margin-bottom: 11px;
}
.login-box input:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-50); }
.login-box button { width: 100%; padding: 11px; background: var(--brand); color: #fff; border: 0;
                    border-radius: 10px; font-size: 14px; font-weight: 700; cursor: pointer; font-family: inherit; }
.login-box button:hover { background: var(--brand-600); }
.login-err { color: var(--bad); font-size: 13px; margin-top: 8px; display: none; }

/* ----------------------------------------------------------------- footer */
footer, .foot {
  margin-top: 52px; font-size: 12px; color: var(--ink-4);
  text-align: center; line-height: 1.6;
}

/* ------------------------------------------------------------------- misc */
.divider { height: 1px; background: var(--line); margin: 22px 0; border: 0; }
.spread  { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.stack   { display: flex; flex-direction: column; gap: 10px; }
.inline  { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.scroll-x{ overflow-x: auto; }

/* ------------------------------------------------------------- responsive */
@media (max-width: 760px) {
  body.page { padding: 34px 16px 32px; }
  .content  { padding: 18px 16px 40px; }
  .app-tabs { padding: 0 16px; }
  .topbar   { padding: 11px 16px; }
  .crumb    { margin: -18px auto 20px; }
  .card     { padding: 20px 18px; }
  .q-card, .materi-section, .game-section { padding: 20px 18px; }
  .ws-selector { flex-direction: column; align-items: stretch; }
  .game-grid   { grid-template-columns: 1fr; }
  .cards, .cards-3 { grid-template-columns: 1fr; }
  .materi-grid { grid-template-columns: 1fr; }
  .row      { flex-direction: column; align-items: stretch; }
  .tbl .stick-2 { min-width: 150px; }
  .tbl-wrap { max-height: none; }
  .result-card { padding: 26px 20px; }
}
@media (max-width: 420px) {
  .tbl .stick { position: static; }
  .tbl .stick::after { display: none; }
}

@media print {
  body.page { background: #fff; padding: 0; }
  .topbar, .app-tabs, .tabs, .btn, .back, .eye, .modal-bg { display: none !important; }
  .card { box-shadow: none; border-color: #ccc; break-inside: avoid; }
  .tbl-wrap { max-height: none; overflow: visible; border: 0; }
  .tbl th { position: static; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
