/* Layout: panggung lomba. Papan skor tiga regu selalu di atas, soal besar di tengah, tombol moderator di bawah. Setiap regu punya warna dan nomor. */
:root {
  --bg: #EEF4F0;
  --surface: #FFFFFF;
  --surface-2: #E3EBE5;
  --ink: #10232A;
  --ink-2: #435B5F;
  --line: #CCDACF;
  --accent: #11704A;
  --accent-ink: #FFFFFF;
  --accent-soft: #D6EDDF;
  --banner: #0D3B26;
  --banner-ink: #F2FBF8;
  --gold: #C9A84C;
  --good: #157A3C;
  --good-bg: #DCF2E3;
  --bad: #AE2929;
  --bad-bg: #FADFDF;
  --warn: #7A4F00;
  --warn-bg: #FBEFD2;
  --t1: #2A5FAE; --t1-bg: #DBE7F8;
  --t2: #A85F00; --t2-bg: #F7E7C9;
  --t3: #B3304F; --t3-bg: #F7DDE3;
  --t-ink: #FFFFFF;
  --m1: #11704A; --m1-bg: #D6EDDF;
  --m2: #8F5506; --m2-bg: #F7E7C9;
  --m3: #2A5FAE; --m3-bg: #DBE7F8;
  --m4: #A8324B; --m4-bg: #F7DDE3;
  --m5: #566F17; --m5-bg: #E4EDCB;
  --shadow: 0 1px 2px rgba(16, 35, 42, .06), 0 6px 18px rgba(16, 35, 42, .07);
  --f-display: 'Poppins', 'Amiri', 'Trebuchet MS', system-ui, sans-serif;
  --f-body: 'Inter', 'Amiri', system-ui, 'Segoe UI', sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B1618; --surface: #13262A; --surface-2: #1A3237; --ink: #E3EEEB; --ink-2: #9FB6B3; --line: #28423F;
    --accent: #4CCB93; --accent-ink: #05210F; --accent-soft: #15402B; --banner: #0D3B26; --banner-ink: #EAF8F4;
    --gold: #D9BB5E; --good: #5FD08A; --good-bg: #153826; --bad: #F28B8B; --bad-bg: #401F21; --warn: #EDB257; --warn-bg: #3E2E10;
    --t1: #7FB0F0; --t1-bg: #172F52; --t2: #EDB257; --t2-bg: #3E2E10; --t3: #F08BA2; --t3-bg: #46202B; --t-ink: #0B1618;
    --m1: #4CCB93; --m1-bg: #15402B; --m2: #EDB257; --m2-bg: #3E2E10; --m3: #7FB0F0; --m3-bg: #172F52;
    --m4: #F08BA2; --m4-bg: #46202B; --m5: #B5D36A; --m5-bg: #2D3A12;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 18px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0B1618; --surface: #13262A; --surface-2: #1A3237; --ink: #E3EEEB; --ink-2: #9FB6B3; --line: #28423F;
  --accent: #4CCB93; --accent-ink: #05210F; --accent-soft: #15402B; --banner: #0D3B26; --banner-ink: #EAF8F4;
  --gold: #D9BB5E; --good: #5FD08A; --good-bg: #153826; --bad: #F28B8B; --bad-bg: #401F21; --warn: #EDB257; --warn-bg: #3E2E10;
  --t1: #7FB0F0; --t1-bg: #172F52; --t2: #EDB257; --t2-bg: #3E2E10; --t3: #F08BA2; --t3-bg: #46202B; --t-ink: #0B1618;
  --m1: #4CCB93; --m1-bg: #15402B; --m2: #EDB257; --m2-bg: #3E2E10; --m3: #7FB0F0; --m3-bg: #172F52;
  --m4: #F08BA2; --m4-bg: #46202B; --m5: #B5D36A; --m5-bg: #2D3A12;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 18px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 16px; line-height: 1.55; }
h1, h2, h3 { font-family: var(--f-display); line-height: 1.2; margin: 0; text-wrap: balance; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.t1 { --tc: var(--t1); --tc-bg: var(--t1-bg); }
.t2 { --tc: var(--t2); --tc-bg: var(--t2-bg); }
.t3 { --tc: var(--t3); --tc-bg: var(--t3-bg); }
.m1 { --mc: var(--m1); --mc-bg: var(--m1-bg); }
.m2 { --mc: var(--m2); --mc-bg: var(--m2-bg); }
.m3 { --mc: var(--m3); --mc-bg: var(--m3-bg); }
.m4 { --mc: var(--m4); --mc-bg: var(--m4-bg); }
.m5 { --mc: var(--m5); --mc-bg: var(--m5-bg); }

.wrap {
  max-width: 1100px; margin: 0 auto; padding-block: 16px 56px;
  padding-top: max(16px, env(safe-area-inset-top, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/* Banner */
.banner { position: relative; overflow: hidden; isolation: isolate; background: var(--banner); color: var(--banner-ink); border-radius: 20px 20px 14px 14px; padding: 16px 18px 0; }
.banner .pat { position: absolute; inset: 0; width: 100%; height: 100%; color: #fff; opacity: .1; z-index: -1; }
.brand { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; padding-bottom: 16px; }
.brand > div { min-width: 0; }
.brand > div:not(.hbtns) { flex: 1 1 auto; min-width: 72px; }
.brand h1 { font-size: 1.6rem; font-weight: 800; letter-spacing: -.01em; }
.brand p { font-size: .85rem; opacity: .88; line-height: 1.35; margin-top: 2px; }
.star { flex: none; width: 40px; height: 40px; }
.mark { flex: none; display: block; width: 46px; height: 46px; border-radius: 13px; background: #fff; }
.star .a { fill: var(--gold); }
.star .b { fill: var(--banner); }
.hbtns { margin-left: auto; flex: none; display: flex; gap: 8px; align-items: center; }
.snd { flex: none; border: 0; text-decoration: none; cursor: pointer; font-family: inherit; background: rgba(255, 255, 255, .14); color: var(--banner-ink); padding: 7px 14px; border-radius: 999px; font-size: .8rem; font-weight: 500; }
.snd:hover { background: rgba(255, 255, 255, .24); }
.tabs { display: flex; gap: 4px; }
.tab { flex: 1; min-width: 0; border: 0; background: rgba(255, 255, 255, .1); color: var(--banner-ink); padding: 11px 6px; border-radius: 12px 12px 0 0; font-weight: 500; font-size: .92rem; }
.tab:hover { background: rgba(255, 255, 255, .18); }
.tab[aria-selected="true"] { background: var(--bg); color: var(--ink); font-weight: 600; }

.view { display: grid; gap: 16px; padding-top: 18px; }
.view > * { min-width: 0; }
.mut { color: var(--ink-2); }
.small { font-size: .85rem; }
.pl { white-space: pre-line; }
.sec-h { display: grid; gap: 4px; }
.sec-h h2 { font-size: 1.4rem; font-weight: 800; }

/* Elemen umum */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px; display: grid; gap: 14px; }
.card > div > h2, .card > h2 { font-size: 1.2rem; font-weight: 800; }
.pill { display: inline-flex; align-items: center; width: fit-content; font-size: .72rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--mc, var(--ink-2)); background: var(--mc-bg, var(--surface-2)); padding: 3px 10px; border-radius: 999px; }
.pill.kpg { color: var(--m3); background: var(--m3-bg); }
.pill.kes { color: var(--m4); background: var(--m4-bg); }
.btn { border: 2px solid transparent; background: var(--accent); color: var(--accent-ink); padding: 11px 20px; border-radius: 12px; font-weight: 600; min-height: 46px; }
.btn:hover { filter: brightness(1.07); }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.btn.sec { background: transparent; color: var(--accent); border-color: var(--accent); }
.btn.quiet { background: var(--surface-2); color: var(--ink); }
.btn.warn { background: var(--bad); color: #fff; }
.btn.big { min-height: 56px; padding-inline: 28px; font-size: 1.1rem; }
.btn.sm { min-height: 38px; padding: 6px 14px; font-size: .9rem; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.lnk { border: 0; background: none; color: var(--accent); font-weight: 600; padding: 6px 4px; text-decoration: underline; text-underline-offset: 3px; }
.lnk.bad { color: var(--bad); }
.lnk:disabled { opacity: .45; cursor: not-allowed; }
.note { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); font-size: .92rem; }
.note.err { background: var(--bad-bg); color: var(--bad); }
.note.ok { background: var(--good-bg); color: var(--good); }
.note ul { margin: 0; padding-left: 20px; }
.field { display: grid; gap: 6px; align-content: start; }
.field > label, .lab { font-weight: 500; font-size: .9rem; }
input[type="text"], input[type="password"], input:not([type]), select, textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
textarea { min-height: 88px; resize: vertical; line-height: 1.5; }
.cols { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: sp .9s linear infinite; vertical-align: -2px; margin-right: 8px; }
@keyframes sp { to { transform: rotate(360deg); } }

/* Atur lomba */
.tin { display: grid; grid-template-columns: 40px 1fr; gap: 10px; align-items: end; }
.badge { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--tc, var(--ink-2)); color: var(--t-ink); font-family: var(--f-display); font-weight: 800; font-size: 1.1rem; }
.tin .badge { margin-bottom: 1px; }
.tgroup { display: grid; gap: 6px; }
.tgroup > .pill { margin-top: 4px; }
.trow { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); min-height: 48px; cursor: pointer; }
.trow input { width: 20px; height: 20px; flex: none; accent-color: var(--accent); }
.trow .tt { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.trow .mut { flex: none; text-align: right; }
.babak { display: grid; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); }
.babak h3 { font-size: 1.05rem; font-weight: 800; }
.babak .def { font-size: .88rem; color: var(--ink-2); }
.sumline { display: flex; flex-wrap: wrap; gap: 6px 18px; font-weight: 600; }
.sumline span { font-variant-numeric: tabular-nums; }

/* Papan skor */
.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.team { background: var(--surface); border: 3px solid var(--line); border-radius: 18px; padding: 12px 12px 8px; display: grid; gap: 2px; justify-items: center; text-align: center; min-width: 0; }
.team.on { border-color: var(--tc); background: var(--tc-bg); box-shadow: var(--shadow); }
.team.lock { opacity: .62; }
.thead { display: flex; gap: 8px; align-items: center; justify-content: center; max-width: 100%; }
.thead .badge { width: 30px; height: 30px; font-size: .95rem; background: var(--tc); }
.tn { font-family: var(--f-display); font-weight: 800; font-size: 1.05rem; overflow-wrap: anywhere; line-height: 1.15; min-width: 0; }
.ts { font-family: var(--f-display); font-weight: 800; font-size: clamp(2.2rem, 6vw, 3.8rem); line-height: 1.05; font-variant-numeric: tabular-nums; }
.ts.flash { animation: pop .5s ease-out; }
@keyframes pop { 0% { transform: scale(.82); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }
.tst { min-height: 1.7em; display: flex; gap: 8px; align-items: center; justify-content: center; font-size: .82rem; font-weight: 600; color: var(--ink-2); }
.team.on .tst span { background: var(--tc); color: var(--t-ink); padding: 1px 10px; border-radius: 999px; }
.chg { font-variant-numeric: tabular-nums; font-size: .95rem; }
.chg.pos { color: var(--good); }
.chg.neg { color: var(--bad); }
.adj { display: flex; gap: 6px; opacity: .55; }
.team:hover .adj, .adj:focus-within { opacity: 1; }
.adjb { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; min-width: 36px; height: 28px; font-size: .8rem; font-weight: 600; padding: 0 6px; }

/* Panggung soal */
.stage { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: clamp(14px, 3vw, 26px); display: grid; gap: 16px; box-shadow: var(--shadow); }
.shead { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; }
.sno { margin-left: auto; font-variant-numeric: tabular-nums; }
.turn { display: grid; gap: 1px; padding: 12px 16px; border-radius: 14px; background: var(--surface-2); color: var(--ink); }
.turn.t1, .turn.t2, .turn.t3 { background: var(--tc); color: var(--t-ink); }
.turn b { font-family: var(--f-display); font-size: clamp(1.25rem, 3.2vw, 1.8rem); font-weight: 800; line-height: 1.2; }
.turn span { font-size: .9rem; opacity: .92; }
.turn.open { background: var(--gold); color: #1B1300; }
.timer { display: flex; align-items: center; gap: 14px; }
.tnum { font-family: var(--f-display); font-weight: 800; font-size: 2.4rem; line-height: 1; min-width: 2ch; text-align: center; font-variant-numeric: tabular-nums; }
.timer .bar { flex: 1; height: 14px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.timer .bar > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.timer.low .tnum { color: var(--bad); }
.timer.low .bar > i { background: var(--bad); }
.tpause { font-size: .8rem; font-weight: 600; color: var(--warn); background: var(--warn-bg); padding: 2px 10px; border-radius: 999px; }
.qtext { font-family: var(--f-display); font-size: clamp(1.3rem, 2.6vw + .7rem, 2.2rem); font-weight: 600; line-height: 1.35; }
.opts { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); }
.opt { display: flex; gap: 12px; align-items: flex-start; text-align: left; width: 100%; padding: 12px 14px; min-height: 60px; border: 2px solid var(--line); background: var(--surface); border-radius: 14px; font-size: clamp(1.05rem, 1.2vw + .8rem, 1.35rem); }
button.opt:hover { border-color: var(--accent); background: var(--accent-soft); }
.opt .ltr { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-weight: 600; font-size: 1rem; }
.opt .txt { flex: 1; padding-top: 4px; min-width: 0; overflow-wrap: anywhere; }
.opt .tag { flex: none; font-size: .75rem; font-weight: 600; padding-top: 8px; }
.opt.ok { border-color: var(--good); background: var(--good-bg); }
.opt.ok .ltr { background: var(--good); color: #fff; }
.opt.ok .tag { color: var(--good); }
.opt.no { border-color: var(--bad); background: var(--bad-bg); }
.opt.no .ltr { background: var(--bad); color: #fff; }
.opt.no .tag { color: var(--bad); }
.opt.gone .txt { text-decoration: line-through; opacity: .75; }
.opt.dim { opacity: .55; }
.enote { display: grid; gap: 2px; padding: 12px 16px; border-radius: 14px; background: var(--m4-bg); color: var(--ink); }
.enote b { color: var(--m4); }
.kunci { background: var(--accent-soft); border-radius: 14px; padding: 14px 16px; display: grid; gap: 4px; }
.kunci b { color: var(--accent); font-size: .85rem; letter-spacing: .04em; text-transform: uppercase; }
.rubric { display: grid; gap: 8px; }
.rub { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; min-height: 52px; border: 2px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; }
.rub input { width: 24px; height: 24px; flex: none; accent-color: var(--accent); margin-top: 1px; }
.rub.on { border-color: var(--good); background: var(--good-bg); }
.calc { font-size: 1.3rem; }
.calc b { font-family: var(--f-display); font-size: 2rem; font-variant-numeric: tabular-nums; }
.bells { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.bell { min-height: 92px; border: 0; border-radius: 18px; background: var(--tc); color: var(--t-ink); display: grid; place-items: center; align-content: center; gap: 2px; padding: 10px 6px; font-family: var(--f-display); font-weight: 800; font-size: 1.15rem; overflow-wrap: anywhere; }
.bell small { font-family: var(--f-body); font-weight: 500; font-size: .8rem; opacity: .9; }
.bell:hover:not(:disabled) { filter: brightness(1.08); }
.bell:disabled { background: var(--surface-2); color: var(--ink-2); cursor: not-allowed; }
.fb { border-radius: 14px; padding: 14px 16px; display: grid; gap: 6px; background: var(--surface-2); }
.fb.ok { background: var(--good-bg); }
.fb.no { background: var(--bad-bg); }
.fb.warn { background: var(--warn-bg); }
.fb ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 2px; }
.ctl { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.util { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; }
.util .note { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }

/* Hasil akhir */
.hero { text-align: center; padding: 22px 16px; border-radius: 20px; background: var(--banner); color: var(--banner-ink); display: grid; gap: 6px; justify-items: center; }
.hero .star { width: 56px; height: 56px; }
.hero h2 { font-size: clamp(1.5rem, 4vw, 2.3rem); font-weight: 800; }
.ranks { display: grid; gap: 10px; }
.rk { display: grid; grid-template-columns: 56px 1fr auto; gap: 14px; align-items: center; padding: 14px 16px; border: 3px solid var(--line); border-radius: 18px; background: var(--surface); }
.rk.first { border-color: var(--tc); background: var(--tc-bg); }
.rk .no1 { font-family: var(--f-display); font-weight: 800; font-size: 2.2rem; text-align: center; line-height: 1; }
.rk .nm { display: grid; gap: 2px; min-width: 0; }
.rk .nm b { font-family: var(--f-display); font-size: 1.25rem; overflow-wrap: anywhere; }
.rk .sc { font-family: var(--f-display); font-weight: 800; font-size: 2.4rem; font-variant-numeric: tabular-nums; }
.recap { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.rc { padding: 14px 0; border-top: 1px solid var(--line); display: grid; gap: 4px; }
.rc:first-child { border-top: 0; }
details > summary { cursor: pointer; font-family: var(--f-display); font-weight: 800; font-size: 1.1rem; padding: 4px 0; }

/* Bank soal */
.ed { gap: 18px; }
.sub { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; gap: 10px; background: var(--bg); }
.subhead { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.optrow { display: flex; align-items: center; gap: 10px; }
.optrow input[type="radio"] { width: 20px; height: 20px; flex: none; accent-color: var(--accent); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .95rem; }
.check input { width: 20px; height: 20px; margin-top: 3px; flex: none; accent-color: var(--accent); }
.lib { display: grid; gap: 0; }
.lrow { display: grid; gap: 8px; padding: 14px 0; border-top: 1px solid var(--line); }
.lrow:first-child { border-top: 0; }
.lrow h3 { font-size: 1.05rem; font-weight: 800; }

@media (prefers-reduced-motion: reduce) { .spin, .ts.flash { animation: none; } * { scroll-behavior: auto !important; } }
@media (max-width: 560px) {
  .brand h1 { font-size: 1.15rem; }
  .mark { width: 40px; height: 40px; border-radius: 11px; }
  .snd { padding: 6px 10px; font-size: .75rem; }
  .brand p { display: none; }
  .team { padding: 10px 6px 8px; border-radius: 14px; }
  .tn { font-size: .88rem; }
  .thead { flex-direction: column; gap: 4px; }
  .bell { min-height: 80px; font-size: 1rem; }
  .rk { grid-template-columns: 40px 1fr auto; gap: 10px; padding: 12px; }
  .rk .no1 { font-size: 1.6rem; }
  .rk .sc { font-size: 1.8rem; }
  .trow { flex-wrap: wrap; }
}

.pastebox { margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--line); display: grid; gap: 12px; }
textarea.mono, .fmt { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace; font-size: .84rem; line-height: 1.5; }
textarea.tall { min-height: 240px; }
.fmt { margin: 8px 0; padding: 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; white-space: pre-wrap; overflow-x: auto; }
.wlist { display: grid; gap: 8px; max-height: 320px; overflow: auto; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.ok-t { color: var(--good); }
.foot { margin-top: 24px; text-align: center; font-size: .8rem; color: var(--ink-2); }
.flogo { display: block; width: 224px; max-width: 70%; height: auto; margin: 0 auto 12px; border-radius: 18px; border: 1px solid var(--line); background: #fff; }
.steps { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 6px; }

/* ===== Materi pelajaran ===== */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 8px 14px; border-radius: 999px; font-size: .88rem; font-weight: 500; min-height: 38px; text-align: left; }
.chip:hover { border-color: var(--accent); }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.mgrid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); }
.mcard { display: flex; flex-direction: column; padding: 0; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); overflow: hidden; text-align: left; box-shadow: var(--shadow); transition: transform .15s ease, border-color .15s ease; }
.mcard:hover { transform: translateY(-3px); border-color: var(--mc, var(--accent)); }
.mthumb { display: block; aspect-ratio: 16 / 9; overflow: hidden; background: var(--banner); }
.mthumb svg, .mthumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.mbody { display: grid; gap: 8px; padding: 14px 16px 16px; align-content: start; }
.mt { font-family: var(--f-display); font-weight: 800; font-size: 1.05rem; line-height: 1.25; }
.mbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.mbar [data-act="mshow"] { margin-left: auto; }
.mprog { position: fixed; top: 0; left: 0; right: 0; height: 4px; z-index: 30; background: transparent; }
.mprog i { display: block; height: 100%; width: 0; background: var(--gold); border-radius: 0 4px 4px 0; transition: width .12s linear; }

.lesson { display: grid; gap: 18px; font-size: 1rem; }
.mhero { position: relative; border-radius: 22px; overflow: hidden; aspect-ratio: 16 / 7; min-height: 210px; background: var(--banner); box-shadow: var(--shadow); isolation: isolate; }
.mhero-art { position: absolute; inset: 0; }
.mhero-art svg, .mhero-art img { display: block; width: 100%; height: 100%; object-fit: cover; }
.mhero-txt { position: absolute; left: 0; right: 0; bottom: 0; padding: 40px 22px 18px; color: #fff; display: grid; gap: 6px; background: linear-gradient(to top, rgba(5, 28, 18, .94), rgba(5, 28, 18, .6) 55%, rgba(5, 28, 18, 0)); }
.mhero-txt h2 { font-size: clamp(1.4rem, 4.2vw, 2.1rem); font-weight: 800; text-wrap: balance; }
.mhero-txt .pill { background: rgba(255, 255, 255, .18); color: #fff; }
.mhero-txt .small { opacity: .9; }
.lead { margin: 0; background: var(--surface); border: 1px solid var(--line); border-left: 6px solid var(--gold); border-radius: 16px; padding: 18px 20px; font-size: 1.1em; line-height: 1.75; }
.mblock { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 18px 20px; display: grid; gap: 12px; }
.mh { display: flex; align-items: center; gap: 10px; font-family: var(--f-display); font-weight: 700; font-size: .8em; letter-spacing: .12em; text-transform: uppercase; color: var(--mc, var(--accent)); margin: 0; }
.mh::before { content: ''; flex: none; width: .55em; height: .55em; background: var(--gold); transform: rotate(45deg); border-radius: 2px; }
.goals { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.goals li { display: flex; gap: 12px; align-items: flex-start; line-height: 1.55; }
.goals li::before { content: '\2713'; flex: none; width: 1.6em; height: 1.6em; border-radius: 50%; display: grid; place-items: center; background: var(--mc, var(--accent)); color: var(--surface); font-weight: 700; font-size: .85em; margin-top: .1em; }
.toc { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.toc .mh { margin-right: 4px; }
.msec { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 18px 20px; display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 12px 14px; align-items: start; scroll-margin-top: 14px; }
.mnum { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--mc, var(--accent)); color: var(--surface); font-family: var(--f-display); font-weight: 800; font-size: 1.1rem; }
.mtxt h3 { font-size: 1.18em; font-weight: 800; margin-bottom: 6px; }
.pl { white-space: pre-line; line-height: 1.72; }
.mfig { margin: 0; grid-column: 2; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); }
.mfig svg, .mfig img { display: block; width: 100%; height: auto; }
.mfig img.up { max-height: 420px; object-fit: cover; }
.mfig figcaption { padding: 8px 12px; font-size: .84rem; color: var(--ink-2); }
@media (min-width: 860px) {
  .msec.has-fig { grid-template-columns: 44px minmax(0, 1fr) minmax(260px, 40%); }
  .msec.has-fig .mfig { grid-column: 3; grid-row: 1 / span 2; }
}
.dalil { margin: 0; text-align: center; padding: 26px 20px 20px; border-radius: 18px; color: #F2FBF8; border: 1px solid var(--gold); background: radial-gradient(circle at 50% 0, #14684A, #0D3B26 70%); }
.dalil + .dalil { margin-top: 12px; }
.dalil::before { content: '\2726'; display: block; color: var(--gold); font-size: 1.1rem; margin-bottom: 4px; }
.dalil .ar { font-family: 'Amiri', 'Traditional Arabic', serif; font-size: clamp(1.7rem, 5vw, 2.4rem); line-height: 2.15; color: #F6E9B8; }
.dalil .arti { margin-top: 10px; font-style: italic; line-height: 1.65; }
.dalil figcaption { display: inline-block; margin-top: 12px; padding: 4px 14px; border-radius: 999px; background: rgba(201, 168, 76, .24); color: #F0DC9A; font-size: .84rem; font-weight: 600; }
.terms { display: grid; gap: 10px; margin: 0; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); }
.term { background: var(--mc-bg, var(--accent-soft)); border-radius: 14px; padding: 12px 14px; }
.term dt { font-family: var(--f-display); font-weight: 800; color: var(--mc, var(--accent)); }
.term dd { margin: 4px 0 0; font-size: .93em; line-height: 1.5; }
.bubbles { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.bubbles li { position: relative; background: var(--accent-soft); border-radius: 18px 18px 18px 4px; padding: 13px 18px 13px 46px; line-height: 1.6; }
.bubbles li::before { content: '\201C'; position: absolute; left: 14px; top: 2px; font-family: var(--f-display); font-size: 2.2rem; line-height: 1.3; color: var(--gold); }
.cta { text-align: center; justify-items: center; background: var(--accent-soft); }
.cta .row { justify-content: center; }

.ar-in { font-family: 'Amiri', 'Traditional Arabic', serif; font-size: 1.28em; line-height: 1.2; unicode-bidi: isolate; }
@media (max-width: 560px) {
  .mhero { aspect-ratio: 16 / 10; }
  .mbar { gap: 8px; }
  .mbar .btn.sm { padding: 6px 10px; font-size: .84rem; }
  .lead { padding: 14px 16px; font-size: 1.04em; }
  .msec { grid-template-columns: 36px minmax(0, 1fr); padding: 14px; gap: 10px 12px; }
  .mnum { width: 34px; height: 34px; border-radius: 10px; font-size: 1rem; }
  .mblock { padding: 16px; }
}
@media (max-width: 420px) {
  .brand { gap: 10px; }
  .brand h1 { font-size: 1.05rem; }
  .hbtns { gap: 6px; }
  .snd { padding: 6px 9px; font-size: .72rem; }
}

/* mode tayang */
.tayang { position: fixed; inset: 0; z-index: 100; background: var(--bg); display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; gap: 12px; padding: max(12px, env(safe-area-inset-top, 0px)) clamp(12px, 3vw, 36px) max(14px, env(safe-area-inset-bottom, 0px)); }
.sl-top { display: flex; gap: 10px; align-items: center; }
.sl-title { flex: 1; min-width: 0; font-family: var(--f-display); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sl-count { font-variant-numeric: tabular-nums; color: var(--ink-2); font-weight: 600; }
.sl-btn { background: var(--surface-2); color: var(--ink); }
.sl-btn:hover { background: var(--line); }
.sl-body { overflow: auto; display: grid; grid-template-columns: minmax(0, 1fr); align-items: center; justify-items: center; padding: 4px 0; }
.sl { width: min(1120px, 100%); min-width: 0; font-size: clamp(1.05rem, 2.5vw, 1.8rem); display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-content: center; }
.sl .mh { font-size: .52em; }
.sl-lead { line-height: 1.7; background: var(--surface); border-left: 8px solid var(--gold); border-radius: 18px; padding: 24px 28px; }
.sl .goals li, .sl .term dd, .sl .bubbles li { font-size: 1em; }
.sl .terms { grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.sl .term { padding: 16px 18px; }
.sl-cover { position: relative; border-radius: 26px; overflow: hidden; aspect-ratio: 16 / 8; width: min(1120px, 100%); max-height: 100%; background: var(--banner); }
.sl-art { position: absolute; inset: 0; }
.sl-art svg, .sl-art img { display: block; width: 100%; height: 100%; object-fit: cover; }
.sl-ct { position: absolute; left: 0; right: 0; bottom: 0; padding: 60px 5% 4%; color: #fff; display: grid; gap: 8px; background: linear-gradient(to top, rgba(5, 28, 18, .95), rgba(5, 28, 18, 0)); }
.sl-ct h2 { font-size: clamp(1.7rem, 5.4vw, 3.6rem); font-weight: 800; text-wrap: balance; }
.sl-ct .pill { background: rgba(255, 255, 255, .2); color: #fff; font-size: .45em; }
.sl-ct p { opacity: .9; font-size: .6em; }
.sl-sec { grid-template-columns: minmax(0, 1fr); gap: 22px; align-items: center; }
.sl-sec .mtxt { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 26px 30px; display: grid; gap: 10px; }
.sl-sec .mnum { width: 1.8em; height: 1.8em; border-radius: 14px; font-size: .9em; }
.sl-sec h3 { font-size: 1.15em; margin: 0; }
.sl-sec .mfig { grid-column: auto; }
@media (min-width: 900px) { .sl-sec.has-fig { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); } }
.sl .dalil { padding: 34px 28px 26px; }
.sl .dalil .ar { font-size: clamp(2rem, 6vw, 3.6rem); }
.sl-nav { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; }
.sl-bar { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.sl-bar i { display: block; height: 100%; background: var(--gold); border-radius: 999px; }
@media (max-width: 560px) { .sl-nav { grid-template-columns: 1fr 1fr; } .sl-bar { grid-column: 1 / -1; grid-row: 1; } .sl-sec .mtxt { padding: 18px; } }

/* penyunting materi */
.medprev { max-width: 380px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.medprev svg, .medprev img { display: block; width: 100%; height: auto; }
textarea.arin { font-family: 'Amiri', 'Traditional Arabic', serif; font-size: 1.45rem; line-height: 2; min-height: 84px; }

/* spanduk pembaruan */
.updbar { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: space-between; margin-top: 12px; padding: 10px 14px; border-radius: 14px; background: var(--accent-soft); color: var(--ink); font-size: .92rem; line-height: 1.45; }
.updbar.ok { background: var(--good-bg); color: var(--good); }
.updbar.new, .updbar.warn { background: var(--warn-bg); color: var(--warn); }
.updbar .ub-b { display: flex; gap: 8px; flex-wrap: wrap; }
.updbar .btn.quiet { background: rgba(0, 0, 0, .08); color: inherit; }

/* cetak: hanya halaman pelajaran, terang di kertas putih */
@media print {
  :root, :root:not([data-theme="light"]), :root[data-theme="dark"] {
    --bg: #fff; --surface: #fff; --surface-2: #f2f2f2; --ink: #111; --ink-2: #444; --line: #bbb; --accent: #0d5a3a; --accent-soft: #eef6f1; --mc: #0d5a3a; --mc-bg: #eef6f1; --shadow: none; color-scheme: light;
  }
  body { background: #fff; color: #111; font-size: 12pt; }
  .banner, .foot, .tabs, .no-print, .mprog, .updbar, .tayang { display: none !important; }
  .wrap { max-width: none; padding: 0; }
  .view { padding-top: 0; }
  .mhero { aspect-ratio: 16 / 6; min-height: 0; box-shadow: none; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .dalil, .mnum, .goals li::before, .mhero-txt { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .msec, .mblock, .dalil, .term, .bubbles li, .lead { break-inside: avoid; }
  .msec, .mblock, .lead { border-color: #bbb; }
}
