/* Belajar — ultramarine di atas putih keunguan; jingga hanya untuk api streak.
   Kerangka: sidebar di desktop, bilah atas + tab bawah di HP. */

@font-face { font-family: "Bricolage"; src: url("/fonts/bricolage.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "Literata"; src: url("/fonts/literata.woff2") format("woff2"); font-weight: 200 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Literata"; src: url("/fonts/literata-italic.woff2") format("woff2"); font-weight: 200 900; font-style: italic; font-display: swap; }
/* Huruf baca yang lembut: Nunito (terminal membulat). Literata tetap tersedia sebagai pilihan serif. */
@font-face { font-family: "Nunito"; src: url("/fonts/nunito-latin.woff2") format("woff2"); font-weight: 200 1000; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Nunito"; src: url("/fonts/nunito-latin-ext.woff2") format("woff2"); font-weight: 200 1000; font-style: normal; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Nunito"; src: url("/fonts/nunito-latin-italic.woff2") format("woff2"); font-weight: 200 1000; font-style: italic; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --bg: #F3F2FA; --surface: #FFFFFF; --surface-2: #ECEAF8; --ink: #15133B; --ink-2: #5A5884; --line: #DDDAF0;
  --brand: #3A2FE0; --brand-deep: #2B22B8; --brand-soft: #E4E2FD; --on-brand: #fff;
  --flame: #FF6A2B; --flame-soft: #FFE8DC; --flame-ink: #B8400F;
  --good: #0B8F4D; --good-soft: #DCF4E7; --bad: #D0343B; --bad-soft: #FCE3E4;
  --shadow: 0 1px 2px rgba(21, 19, 59, .05), 0 8px 24px -12px rgba(21, 19, 59, .18);
  --ui: "Bricolage", system-ui, -apple-system, "Segoe UI", sans-serif;
  --read: "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;
  --serif: "Literata", Georgia, "Times New Roman", serif;
  --ink-read: color-mix(in srgb, var(--ink) 86%, var(--bg));
  --fs: 18px; --side: 262px; --mtop: 58px; --tabbar: 66px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0E0D24; --surface: #17163A; --surface-2: #221F4C; --ink: #EEEDFF; --ink-2: #A9A7D6; --line: #2E2C60;
  --brand: #7167FF; --brand-deep: #8B83FF; --brand-soft: #27245E; --on-brand: #fff;
  --flame: #FF7B3F; --flame-soft: #3D2418; --flame-ink: #FFA877;
  --good: #4FD08B; --good-soft: #14352A; --bad: #FF7C82; --bad-soft: #3B1C26;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -12px rgba(0, 0, 0, .6);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E0D24; --surface: #17163A; --surface-2: #221F4C; --ink: #EEEDFF; --ink-2: #A9A7D6; --line: #2E2C60;
    --brand: #7167FF; --brand-deep: #8B83FF; --brand-soft: #27245E; --on-brand: #fff;
    --flame: #FF7B3F; --flame-soft: #3D2418; --flame-ink: #FFA877;
    --good: #4FD08B; --good-soft: #14352A; --bad: #FF7C82; --bad-soft: #3B1C26;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -12px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 450 15.5px/1.55 var(--ui); font-optical-sizing: auto; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
ul.plain, ul.rows { list-style: none; padding: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 8px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 10px; z-index: 100; }
.skip:focus { left: 8px; }
.boot { padding: 48px; color: var(--ink-2); }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); }
.small { font-size: 13.5px; }
svg.i { flex: none; }

/* ======================================================= kerangka */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 22px; padding: 22px 16px 18px; background: var(--surface); border-right: 1px solid var(--line); overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; font: 800 24px/1 var(--ui); letter-spacing: -.045em; text-decoration: none; padding: 0 8px; }
.brand i { width: 34px; height: 34px; border-radius: 11px; background: var(--brand); color: var(--on-brand); display: grid; place-items: center; }
.nav { display: grid; gap: 3px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 13px; font-weight: 650; color: var(--ink-2); text-decoration: none; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--brand-soft); color: var(--brand); }
.sect-lbl { font: 700 11.5px/1 var(--ui); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); padding: 0 12px; margin-bottom: 8px; }
.sjs { display: grid; gap: 2px; }
.sjs a { display: flex; align-items: center; gap: 10px; padding: 7px 12px; border-radius: 10px; font-weight: 550; font-size: 14.5px; color: var(--ink-2); text-decoration: none; }
.sjs a:hover { background: var(--surface-2); color: var(--ink); }
.sjs a[aria-current="true"] { color: var(--ink); background: var(--surface-2); }
.sjs .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; }
.sjs .n { margin-left: auto; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.side .grow { flex: 1; }
.sidecard { border-radius: 18px; padding: 14px; background: var(--flame-soft); color: var(--flame-ink); display: grid; gap: 8px; text-decoration: none; }
.sidecard .r { display: flex; align-items: center; gap: 10px; }
.sidecard svg.f { color: var(--flame); fill: var(--flame); }
.sidecard b { font: 800 22px/1 var(--ui); font-variant-numeric: tabular-nums; }
.sidecard .bar { background: color-mix(in srgb, var(--flame) 22%, transparent); height: 7px; }
.sidecard .bar > i { background: var(--flame); }
.sidecard small { font-size: 12.5px; opacity: .9; }
.sidefoot { display: flex; align-items: center; gap: 6px; padding: 0 4px; }
.sidefoot .status { flex: 1; min-width: 0; }
.iconbtn { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px; border: 0; background: transparent; color: var(--ink-2); cursor: pointer; }
.iconbtn:hover { background: var(--surface-2); color: var(--ink); }
.status { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); padding: 0 8px; }
.status i { width: 9px; height: 9px; border-radius: 50%; background: var(--line); flex: none; }
.status.on i { background: var(--good); box-shadow: 0 0 0 4px color-mix(in srgb, var(--good) 22%, transparent); }
.status.off i { background: var(--bad); }

.mtop, .tabbar { display: none; }
.main { min-width: 0; }
.page { max-width: 1060px; margin: 0 auto; padding: 36px 40px 90px; min-height: 100vh; }
.page:focus { outline: none; }
.banner { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 11px 40px; background: var(--flame-soft); color: var(--flame-ink); font-weight: 600; font-size: 14.5px; border-bottom: 1px solid color-mix(in srgb, var(--flame) 25%, transparent); }
.banner .btn { margin-left: auto; }

/* ======================================================= tipografi & kepala halaman */
h1.title { font: 800 clamp(30px, 4.4vw, 44px)/1.05 var(--ui); letter-spacing: -.035em; text-wrap: balance; }
h2.sec { font: 700 21px/1.2 var(--ui); letter-spacing: -.02em; }
h3 { font: 650 16px/1.3 var(--ui); }
.eyebrow { font: 650 14.5px/1 var(--ui); color: var(--ink-2); margin-bottom: 10px; display: block; }
.lede { margin-top: 10px; font-size: 17px; color: var(--ink-2); max-width: 58ch; }
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 26px; }
.sec-h { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin: 40px 0 14px; }
.sec-h:first-child { margin-top: 0; }
.sec-h .aside { color: var(--ink-2); font-size: 14px; }
a.aside { text-decoration: none; font-weight: 600; color: var(--brand); }
a.aside:hover { text-decoration: underline; }
.back { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 18px; color: var(--ink-2); font-weight: 600; font-size: 14px; text-decoration: none; padding: 4px 10px 4px 6px; margin-left: -6px; border-radius: 99px; }
.back:hover { background: var(--surface-2); color: var(--ink); }

/* ======================================================= kartu, tombol, input */
.card { background: var(--surface); border: 1.5px solid var(--line); border-radius: 24px; padding: 24px; box-shadow: var(--shadow); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 18px; border-radius: 12px; border: 1.5px solid transparent; font: 650 15px/1 var(--ui); cursor: pointer; text-decoration: none; background: var(--brand); color: var(--on-brand); white-space: nowrap; transition: background .12s, transform .06s; }
.btn:hover { background: var(--brand-deep); }
.btn:active { transform: translateY(1px); }
.btn.line { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn.line:hover { border-color: var(--ink-2); background: var(--surface); }
.btn.quiet { background: transparent; color: var(--ink-2); }
.btn.quiet:hover { background: var(--surface-2); color: var(--ink); }
.btn.danger { background: transparent; color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.btn.danger:hover { background: var(--bad-soft); }
.btn.danger.solid { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn.white { background: #fff; color: #2B22B8; }
.btn.white:hover { background: #F1F0FF; }
.btn.lg { min-height: 52px; padding: 0 24px; font-size: 16px; border-radius: 14px; }
.btn.sm { min-height: 34px; padding: 0 13px; font-size: 13.5px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn.wrap { white-space: normal; line-height: 1.35; padding: 12px 18px; text-align: center; overflow-wrap: anywhere; }
.btn.wrap.lg { padding: 14px 20px; }
.btn.wrap .btn-txt { min-width: 0; overflow-wrap: anywhere; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

label.field { display: flex; flex-direction: column; gap: 7px; font-weight: 600; font-size: 14px; }
label.field .hint, .hint { font-weight: 450; color: var(--ink-2); font-size: 13px; }
input[type="text"], input[type="search"], input[type="password"], input[type="number"], select, textarea { width: 100%; min-height: 44px; background: var(--surface); border: 1.5px solid var(--line); border-radius: 12px; padding: 9px 13px; font-weight: 500; }
select { appearance: none; -webkit-appearance: none; padding-right: 38px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237d7aa8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 20%, transparent); }
.inwrap { position: relative; display: block; }
.inwrap > svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--ink-2); pointer-events: none; }
.inwrap input { padding-left: 42px; }
.inwrap .iconbtn { position: absolute; right: 4px; top: 4px; }
.check { display: inline-flex; align-items: center; gap: 9px; font-weight: 500; cursor: pointer; }
.check input { width: 19px; height: 19px; accent-color: var(--brand); }
.form { display: grid; gap: 18px; }
.form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
fieldset.group { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px 22px; }
fieldset.group legend { font-weight: 600; font-size: 14px; padding: 0; margin-bottom: 8px; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 12px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 6px 14px; border-radius: 9px; font-weight: 650; font-size: 14px; color: var(--ink-2); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches button { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--surface); background: var(--c); cursor: pointer; box-shadow: 0 0 0 1.5px var(--line); }
.swatches button[aria-pressed="true"] { box-shadow: 0 0 0 2.5px var(--ink); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { cursor: pointer; display: inline-flex; align-items: center; gap: 7px; padding: 6px 15px; border-radius: 99px; border: 1.5px solid var(--line); background: var(--surface); font-weight: 600; font-size: 14px; text-decoration: none; }
.chip:hover { border-color: var(--ink-2); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chip .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 650; padding: 2px 10px; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; max-width: 100%; min-width: 0; }
.tag.weak { background: var(--bad-soft); color: var(--bad); }
.tag.strong { background: var(--good-soft); color: var(--good); }
.tag.warn { background: var(--flame-soft); color: var(--flame-ink); }
.tag.brand { background: var(--brand-soft); color: var(--brand); }
.tag .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex: none; }
.tag .tag-txt, .tag > span:not(.dot) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

.notice { border-radius: 18px; padding: 16px 18px; margin: 18px 0; display: grid; gap: 10px; background: var(--surface); border: 1.5px solid var(--line); }
.notice.bad { background: var(--bad-soft); border-color: transparent; }
.notice.warn { background: var(--flame-soft); border-color: transparent; }
.notice.soft { background: var(--brand-soft); border-color: transparent; }
.empty { border: 2px dashed var(--line); border-radius: 24px; padding: 40px 28px; display: grid; gap: 14px; justify-items: center; text-align: center; margin-top: 8px; background: color-mix(in srgb, var(--surface) 50%, transparent); }
.empty .art { width: 84px; height: 84px; color: var(--brand); }
.empty h3 { font: 750 20px/1.2 var(--ui); letter-spacing: -.02em; }
.empty p { max-width: 46ch; color: var(--ink-2); font-size: 15.5px; }

.bar { height: 10px; background: var(--surface-2); border-radius: 6px; overflow: hidden; min-width: 70px; }
.bar > i { display: block; height: 100%; background: var(--brand); border-radius: 6px; transition: width .4s; }
.bar.weak > i { background: var(--bad); }
.bar.strong > i { background: var(--good); }
.bar.tall { height: 14px; }
.pbar { display: flex; align-items: center; gap: 12px; }
.pbar .bar { flex: 1; }
.pct { min-width: 40px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

.skel { background: linear-gradient(100deg, var(--surface-2) 30%, color-mix(in srgb, var(--surface-2) 40%, var(--surface)) 50%, var(--surface-2) 70%); background-size: 300% 100%; animation: shimmer 1.4s linear infinite; border-radius: 14px; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* ======================================================= daftar baris */
.rows { display: grid; gap: 10px; }
.row { display: flex; align-items: center; gap: 16px; padding: 14px 18px; background: var(--surface); border: 1.5px solid var(--line); border-radius: 18px; position: relative; }
.row:hover { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); }
.row .grow { flex: 1; min-width: 0; }
.row .name { font-weight: 650; font-size: 16px; overflow-wrap: anywhere; }
.row .meta { color: var(--ink-2); font-size: 13.5px; margin-top: 1px; }
.row a.stretch { text-decoration: none; }
.row a.stretch::after { content: ""; position: absolute; inset: 0; border-radius: 18px; }
.row .go { color: var(--ink-2); display: flex; }
.row .actions, .row .tag, .row .scorepill { position: relative; z-index: 1; }
.tile { flex: none; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font: 750 11.5px/1 var(--ui); letter-spacing: .03em; background: color-mix(in srgb, var(--c, var(--brand)) 16%, var(--surface)); color: color-mix(in srgb, var(--c, var(--brand)) 78%, var(--ink)); }

/* ======================================================= kartu materi */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.dcard { position: relative; display: flex; flex-direction: column; gap: 14px; padding: 20px; background: var(--surface); border: 1.5px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); transition: transform .12s, border-color .12s; min-width: 0; overflow: hidden; }
.dcard:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--c, var(--brand)) 55%, var(--line)); }
.dcard .hd { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; }
.dcard .hd .tag { flex-shrink: 1; min-width: 0; max-width: calc(100% - 56px); position: relative; z-index: 1; }
.dcard h3 { font: 700 18px/1.25 var(--ui); letter-spacing: -.015em; overflow-wrap: anywhere; }
.dcard h3 a { text-decoration: none; }
.dcard h3 a::after { content: ""; position: absolute; inset: 0; border-radius: 22px; }
.dcard .meta { color: var(--ink-2); font-size: 13.5px; }
.dcard .ft { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 13.5px; color: var(--ink-2); min-width: 0; }
.dcard .ft > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dcard .ft .tag { flex-shrink: 0; }
.dcard .ft b { color: var(--ink); }
.dcard .err { color: var(--bad); font-size: 13.5px; }

/* ======================================================= beranda */
.hello { margin-bottom: 22px; }
.home { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 20px; }
.hero { background: var(--brand); color: #fff; border-radius: 30px; padding: 28px 32px; display: grid; gap: 20px; align-content: space-between; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; right: -70px; top: -70px; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(closest-side, rgba(255, 255, 255, .16), transparent); pointer-events: none; }
.hero .tl { display: flex; align-items: center; gap: 12px; font-weight: 650; font-size: 16px; }
.flame-badge { width: 42px; height: 42px; border-radius: 14px; background: var(--flame); display: grid; place-items: center; color: #fff; }
.flame-badge svg { fill: #fff; }
.hero .big { display: flex; align-items: flex-end; gap: 16px; }
.hero .xl { font: 800 clamp(92px, 11vw, 140px)/.8 var(--ui); letter-spacing: -.06em; font-variant-numeric: tabular-nums; }
.hero .unit { font: 650 21px/1.15 var(--ui); padding-bottom: 6px; }
.hero .msg { font-size: 15.5px; opacity: .93; max-width: 44ch; }
.hero .msg.warn { background: rgba(255, 255, 255, .16); border-radius: 12px; padding: 10px 14px; opacity: 1; }
.hero .tag { background: rgba(255, 255, 255, .18); color: #fff; }
.wk { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; position: relative; z-index: 1; }
.wk .d { display: grid; justify-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; opacity: .85; animation: pop .45s cubic-bezier(.2, .8, .3, 1.2) both; animation-delay: calc(var(--i) * 60ms + 120ms); }
.wk .c { width: 100%; max-width: 44px; aspect-ratio: 1; border-radius: 50%; background: rgba(255, 255, 255, .16); display: grid; place-items: center; }
.wk .on { opacity: 1; }
.wk .on .c { background: #fff; color: #2B22B8; }
.wk .now { opacity: 1; font-weight: 800; }
.wk .now:not(.on) .c { outline: 2px dashed rgba(255, 255, 255, .8); outline-offset: 3px; }
@keyframes pop { from { opacity: 0; transform: scale(.55); } }

.today { border-radius: 30px; padding: 26px; display: grid; gap: 18px; align-content: start; }
.today .top-row { display: flex; align-items: center; gap: 20px; }
.ring-box { position: relative; flex: none; }
.ring-box .center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1.1; }
.ring-box .center b { font: 800 30px/1 var(--ui); letter-spacing: -.03em; }
.ring-box .center span { font-size: 12px; color: var(--ink-2); margin-top: 3px; }
svg.ring .trk { stroke: var(--surface-2); }
svg.ring .prg { stroke: var(--brand); animation: ring 1s cubic-bezier(.2, .7, .2, 1) .2s both; }
svg.ring.good .prg { stroke: var(--good); }
svg.ring.bad .prg { stroke: var(--bad); }
svg.ring.mid .prg { stroke: var(--flame); }
@keyframes ring { from { stroke-dashoffset: var(--len); } }
.today h2 { font: 700 20px/1.2 var(--ui); letter-spacing: -.02em; }
.today .sub { color: var(--ink-2); font-size: 14.5px; margin-top: 3px; }
.goals { display: grid; gap: 8px; }
.goal { display: flex; align-items: center; gap: 11px; font-size: 14.5px; font-weight: 550; }
.goal .tick { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; color: transparent; flex: none; }
.goal.done .tick { background: var(--good); border-color: var(--good); color: #fff; }
.goal.done span { color: var(--ink-2); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--ink-2) 50%, transparent); }
.wkbar .lab { display: flex; justify-content: space-between; font-size: 13.5px; color: var(--ink-2); margin-bottom: 7px; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 20px; }
.stat { padding: 18px 20px; border-radius: 20px; background: var(--surface); border: 1.5px solid var(--line); }
.stat dt { color: var(--ink-2); font-size: 13.5px; display: flex; align-items: center; gap: 7px; }
.stat dd { font: 800 30px/1.1 var(--ui); letter-spacing: -.03em; margin-top: 6px; }
.stat dd small { font: 600 14px var(--ui); color: var(--ink-2); letter-spacing: 0; margin-left: 4px; }

.two-col { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 36px; align-items: start; margin-top: 40px; }
.two-col .sec-h { margin-top: 0; }
.two-col .sec-h:not(:first-child), .two-col ul + .sec-h { margin-top: 36px; }
.two-col > div > * + .sec-h { margin-top: 36px; }
.split { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 20px; align-items: start; }

.hm-wrap { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 8px; align-items: start; }
.hm-days { display: grid; grid-template-rows: repeat(7, 1fr); font-size: 11px; color: var(--ink-2); margin-top: 18px; }
.hm-days span { display: flex; align-items: center; }
.hm-months { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 3px; height: 14px; font-size: 11.5px; color: var(--ink-2); }
.hm-months span { white-space: nowrap; line-height: 14px; }
.hm { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, auto); grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 3px; }
.hm i { aspect-ratio: 1; border-radius: 4px; background: var(--surface-2); display: block; }
.hm i.l1 { background: color-mix(in srgb, var(--brand) 26%, var(--surface-2)); }
.hm i.l2 { background: color-mix(in srgb, var(--brand) 50%, var(--surface-2)); }
.hm i.l3 { background: color-mix(in srgb, var(--brand) 76%, var(--surface-2)); }
.hm i.l4 { background: var(--brand); }
.hm i.pad { background: transparent; }
.hm i.td { outline: 2px solid var(--ink); outline-offset: 1px; }
.legend { display: flex; align-items: center; gap: 5px; margin-top: 12px; font-size: 12.5px; color: var(--ink-2); justify-content: flex-end; }
.legend i { width: 13px; height: 13px; border-radius: 4px; display: inline-block; }

.miles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-content: start; }
.miles h3 { grid-column: 1 / -1; }
.miles h3 { font: 700 18px/1.2 var(--ui); }
.mile { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; background: var(--surface-2); opacity: .6; }
.mile .b { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--surface); color: var(--ink-2); flex: none; font: 800 15px var(--ui); }
.mile b { display: block; font-size: 14.5px; }
.mile small { color: var(--ink-2); font-size: 12.5px; }
.mile.got { opacity: 1; background: var(--flame-soft); }
.mile.got .b { background: var(--flame); color: #fff; }
.mile.got small { color: var(--flame-ink); }

svg.chart { width: 100%; height: auto; display: block; overflow: visible; }
svg.chart text { fill: var(--ink-2); font: 12px var(--ui); }
svg.chart .grid { stroke: var(--line); stroke-width: 1; }
svg.chart .area { fill: color-mix(in srgb, var(--brand) 12%, transparent); }
svg.chart .ln { stroke: var(--brand); stroke-width: 3; fill: none; stroke-linejoin: round; stroke-linecap: round; }
svg.chart .pt { fill: var(--surface); stroke: var(--brand); stroke-width: 3; }
svg.chart .pt.last { fill: var(--brand); }
svg.chart .bar-s { fill: color-mix(in srgb, var(--brand) 40%, var(--surface-2)); }
svg.chart .bar-s.today { fill: var(--brand); }
svg.chart .bar-s.none { fill: var(--surface-2); }
.chartbox { min-height: 120px; }

/* ======================================================= tab */
.tabs { display: flex; gap: 4px; margin: 24px 0 24px; border-bottom: 1.5px solid var(--line); }
.tabs button { background: none; border: 0; cursor: pointer; padding: 10px 16px; font-weight: 650; color: var(--ink-2); border-bottom: 3px solid transparent; margin-bottom: -1.5px; border-radius: 10px 10px 0 0; }
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { color: var(--brand); border-bottom-color: var(--brand); }

/* ======================================================= toolbar materi */
.toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.toolbar .inwrap { flex: 1; min-width: 240px; max-width: 420px; }
.toolbar select { width: auto; min-width: 170px; }
.toolbar .sp { flex: 1; }

/* ======================================================= detail materi */
.readbar { position: fixed; left: var(--side); right: 0; top: 0; height: 4px; z-index: 35; background: transparent; }
.readbar i { display: block; height: 100%; width: 0; background: var(--brand); }
.doc { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 52px; align-items: start; }
.doc-main { min-width: 0; }
.dochead h1 { margin-top: 4px; }
.dochead .meta-line { margin-top: 12px; color: var(--ink-2); display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: 14.5px; }
.docstats { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.docstats .pill { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 14px; background: var(--surface); border: 1.5px solid var(--line); font-size: 13.5px; color: var(--ink-2); }
.docstats .pill b { color: var(--ink); font-weight: 750; }
.doc-rail { position: sticky; top: 24px; display: grid; gap: 22px; max-height: calc(100vh - 48px); overflow-y: auto; padding-bottom: 8px; }
.rail-sec { display: grid; gap: 8px; }
.rail-sec h3 { font-size: 12px; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-2); font-weight: 700; }
.toc { display: grid; gap: 2px; border-left: 2px solid var(--line); }
.toc button { text-align: left; background: none; border: 0; cursor: pointer; padding: 5px 0 5px 14px; margin-left: -2px; border-left: 2px solid transparent; color: var(--ink-2); font-weight: 550; font-size: 14px; line-height: 1.35; }
.toc button:hover { color: var(--ink); }
.toc button[aria-current="true"] { color: var(--brand); border-left-color: var(--brand); font-weight: 700; }
.rail-actions { display: grid; gap: 6px; }
.rail-actions .btn { justify-content: flex-start; }
.timer { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); }
.fsz { display: flex; align-items: center; gap: 8px; }

/* Catatan: huruf baca lembut (Nunito), kontras sedikit diturunkan, hierarki judul jelas. */
:root[data-read="serif"] { --read: var(--serif); }
.sheet { font: 430 var(--fs)/1.82 var(--read); color: var(--ink-read); letter-spacing: .004em; max-width: 68ch; overflow-wrap: break-word; font-optical-sizing: auto; text-wrap: pretty; }
.sheet > * + * { margin-top: 1.05em; }
.sheet h1, .sheet h2, .sheet h3, .sheet h4 { font-family: var(--read); color: var(--ink); letter-spacing: -.012em; line-height: 1.25; margin-top: 1.9em; scroll-margin-top: 24px; text-wrap: balance; }
.sheet h1 { font-size: 1.85em; font-weight: 800; margin-top: 0; }
.sheet h2 { font-size: 1.38em; font-weight: 800; padding-top: 1em; border-top: 1px solid var(--line); }
.sheet h2:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.sheet h3 { font-size: 1.1em; font-weight: 750; margin-top: 1.7em; padding-left: .65em; border-left: 3px solid color-mix(in srgb, var(--brand) 38%, transparent); }
.sheet h4 { font-size: .98em; font-weight: 750; color: var(--ink-2); margin-top: 1.4em; }
.sheet h2 + *, .sheet h3 + *, .sheet h4 + * { margin-top: .6em; }
.sheet ul, .sheet ol { padding-left: 1.5em; }
.sheet li + li { margin-top: .32em; }
.sheet li > ul, .sheet li > ol { margin-top: .32em; }
.sheet ul ul { list-style: circle; }
.sheet ul ul ul { list-style: square; }
.sheet li::marker { color: color-mix(in srgb, var(--brand) 80%, var(--ink-2)); font-weight: 700; }
.sheet strong { font-weight: 720; color: var(--ink); background: linear-gradient(transparent 62%, color-mix(in srgb, var(--brand) 13%, transparent) 62%); padding: 0 .08em; }
.sheet em { font-style: italic; }
.sheet blockquote { margin-left: 0; padding: .55em 1em .55em 1.1em; border-left: 4px solid color-mix(in srgb, var(--brand) 55%, transparent); background: color-mix(in srgb, var(--brand-soft) 55%, transparent); border-radius: 0 12px 12px 0; color: var(--ink-2); }
.sheet blockquote > * + * { margin-top: .6em; }
.sheet code { font: .87em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--surface-2); padding: .12em .4em; border-radius: 6px; }
.sheet pre { background: var(--surface-2); padding: 16px 18px; border-radius: 14px; overflow-x: auto; line-height: 1.5; }
.sheet pre code { background: none; padding: 0; }
.sheet .tw { overflow-x: auto; border: 1.5px solid var(--line); border-radius: 14px; background: var(--surface); }
.sheet table { border-collapse: collapse; font: 450 .88em/1.5 var(--read); width: 100%; min-width: 420px; }
.sheet th, .sheet td { padding: 9px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.sheet td + td, .sheet th + th { border-left: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }
.sheet tr:last-child td { border-bottom: 0; }
.sheet tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--surface-2) 42%, transparent); }
.sheet th { background: color-mix(in srgb, var(--brand-soft) 70%, var(--surface)); font-weight: 750; color: var(--ink); }
.sheet hr { border: 0; border-top: 1px solid var(--line); }
.sheet a { color: var(--brand); }
/* rumus (KaTeX) */
.sheet .katex { font-size: 1.07em; }
.sheet .math-block { overflow-x: auto; overflow-y: hidden; padding: .35em .5em; text-align: center; border-radius: 12px; background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.sheet .math-block .katex-display, .sheet p > .katex-display { margin: 0; }
.sheet p > .katex-display { margin: .5em 0; overflow-x: auto; overflow-y: hidden; }
.sheet .katex-error { color: var(--bad); font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85em; }
.sheet .math-fallback { white-space: pre-wrap; }
.sheet td .katex-display, .sheet th .katex-display { margin: 0; text-align: left; }
.sheet .flash { animation: flash 1.8s ease-out; border-radius: 6px; }
@keyframes flash { 0% { background: color-mix(in srgb, var(--flame) 35%, transparent); } 100% { background: transparent; } }
textarea.editor { font: 15px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; min-height: 66vh; resize: vertical; border-radius: 16px; padding: 16px; }
.deep { background: var(--brand-soft); border-radius: 16px; padding: 4px 22px 8px; }
.deep .sheet { font-size: 16.5px; max-width: none; }
.deep .sheet h2 { border: 0; padding-top: 0; font-size: 19px; margin-top: .8em; }

/* ======================================================= kuis: daftar */
.quiz-layout { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 40px; align-items: start; }
.quiz-layout .side2 { position: sticky; top: 24px; }
.scorepill { display: inline-flex; align-items: baseline; gap: 2px; font-weight: 800; font-size: 15px; padding: 2px 11px; border-radius: 99px; background: var(--surface-2); font-variant-numeric: tabular-nums; }
.scorepill.hi { background: var(--good-soft); color: var(--good); }
.scorepill.mid { background: var(--flame-soft); color: var(--flame-ink); }
.scorepill.lo { background: var(--bad-soft); color: var(--bad); }
.panel { background: var(--surface); border: 1.5px solid var(--line); border-radius: 24px; padding: 26px; box-shadow: var(--shadow); }
.panel h2 { font: 700 20px/1.2 var(--ui); letter-spacing: -.02em; margin-bottom: 4px; }
.qrow { display: grid; gap: 12px; }
.qrow .acts { display: flex; gap: 8px; flex-wrap: wrap; }

/* ======================================================= kuis: pengerjaan */
.qwrap { max-width: 760px; margin: 0 auto; }
.qtop { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.qtop .ttl { font-weight: 650; color: var(--ink-2); font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; text-align: center; }
.segs { display: flex; gap: 5px; margin-bottom: 14px; }
.segs > * { flex: 1; height: 8px; border-radius: 4px; background: var(--surface-2); border: 0; padding: 0; min-width: 0; }
.segs button { cursor: pointer; }
.segs .ok { background: var(--good); }
.segs .no { background: var(--bad); }
.segs .ans { background: color-mix(in srgb, var(--brand) 45%, var(--surface-2)); }
.segs .cur { background: var(--brand); outline: 2px solid color-mix(in srgb, var(--brand) 30%, transparent); outline-offset: 2px; }
.qmeta { color: var(--ink-2); font-size: 14.5px; font-weight: 550; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.qtext { font: 500 clamp(21px, 3.2vw, 26px)/1.5 var(--read); margin: 14px 0 26px; text-wrap: pretty; }
.opts { display: grid; gap: 12px; }
.opt { display: flex; gap: 16px; align-items: center; text-align: left; width: 100%; min-height: 62px; padding: 12px 18px; cursor: pointer; background: var(--surface); border: 2px solid var(--line); border-radius: 18px; font: 450 17px/1.45 var(--read); }
.opt:hover:not(:disabled) { border-color: var(--brand); }
.opt .k { flex: none; width: 32px; height: 32px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; font: 750 14px var(--ui); }
.opt .lbl { flex: 1; }
.opt[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); }
.opt[aria-pressed="true"] .k { background: var(--brand); color: #fff; }
.opt.ok { border-color: var(--good); background: var(--good-soft); }
.opt.ok .k { background: var(--good); color: #fff; }
.opt.no { border-color: var(--bad); background: var(--bad-soft); }
.opt.no .k { background: var(--bad); color: #fff; }
.opt:disabled { cursor: default; }
.opt .tagtxt { font: 700 13px var(--ui); white-space: nowrap; display: flex; align-items: center; gap: 4px; }
.short { display: flex; gap: 10px; flex-wrap: wrap; }
.short input { flex: 1; min-width: 220px; min-height: 56px; font-size: 18px; border-radius: 16px; border-width: 2px; }
.short .btn { min-height: 56px; }
.feedback { margin-top: 22px; border-radius: 18px; padding: 18px 22px; display: grid; gap: 8px; background: var(--surface-2); }
.feedback.ok { background: var(--good-soft); }
.feedback.no { background: var(--bad-soft); }
.feedback .verdict { font: 750 18px var(--ui); display: flex; align-items: center; gap: 8px; }
.feedback.ok .verdict { color: var(--good); }
.feedback.no .verdict { color: var(--bad); }
.feedback .why { font: 16.5px/1.65 var(--read); }
.qfoot { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 26px; }
.qfoot .sp { flex: 1; }
.kbd { font: 600 12px var(--ui); border: 1.5px solid var(--line); border-bottom-width: 3px; border-radius: 6px; padding: 0 6px; color: var(--ink-2); background: var(--surface); }
.clock { display: inline-flex; align-items: center; gap: 7px; font: 750 20px var(--ui); font-variant-numeric: tabular-nums; }
.clock.low { color: var(--bad); }

/* ======================================================= hasil */
.result { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 36px; align-items: center; background: var(--surface); border: 1.5px solid var(--line); border-radius: 30px; padding: 30px 36px; box-shadow: var(--shadow); }
.result .score { font: 800 clamp(28px, 4vw, 40px)/1.1 var(--ui); letter-spacing: -.035em; }
.result .actions { margin-top: 18px; }
.rstats { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.qres { background: var(--surface); border: 1.5px solid var(--line); border-radius: 18px; margin-bottom: 10px; overflow: hidden; }
.qres > summary { list-style: none; cursor: pointer; display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; }
.qres > summary::-webkit-details-marker { display: none; }
.qres > summary:hover { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.qres .st { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; margin-top: 1px; background: var(--surface-2); color: var(--ink-2); }
.qres .st.ok { background: var(--good-soft); color: var(--good); }
.qres .st.no { background: var(--bad-soft); color: var(--bad); }
.qres .q { font: 500 17px/1.5 var(--read); flex: 1; }
.qres .chev { color: var(--ink-2); transition: transform .15s; margin-top: 4px; }
.qres[open] .chev { transform: rotate(90deg); }
.qres .body { padding: 0 18px 20px 60px; display: grid; gap: 10px; }
.qres .body .why { font: 16.5px/1.65 var(--read); color: var(--ink-2); }
.qres .v.ok { color: var(--good); font-weight: 700; }
.qres .v.no { color: var(--bad); font-weight: 700; }

/* ======================================================= dialog & toast */
dialog.dlg { width: min(540px, calc(100vw - 28px)); border: 0; border-radius: 28px; padding: 28px; background: var(--surface); color: var(--ink); box-shadow: 0 30px 80px -20px rgba(21, 19, 59, .5); }
dialog.dlg.sm { width: min(440px, calc(100vw - 28px)); }
dialog.dlg::backdrop { background: rgba(14, 13, 36, .6); }
dialog.dlg h2 { font: 800 24px/1.15 var(--ui); letter-spacing: -.03em; margin-bottom: 10px; }
dialog.dlg .msg { color: var(--ink-2); margin-bottom: 18px; }
dialog.dlg .actions { justify-content: flex-end; margin-top: 20px; }
.drop { display: grid; gap: 6px; justify-items: center; text-align: center; padding: 28px 20px; border: 2px dashed var(--line); border-radius: 20px; cursor: pointer; background: var(--bg); position: relative; }
.drop:hover, .drop.over { border-color: var(--brand); background: var(--brand-soft); }
.drop input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.drop:focus-within { outline: 3px solid var(--brand); outline-offset: 2px; }
.drop .ic { width: 46px; height: 46px; border-radius: 14px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; }
.drop.has { border-style: solid; border-color: var(--brand); background: var(--brand-soft); }
#toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: 24px; display: grid; gap: 8px; z-index: 80; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast { background: var(--ink); color: var(--bg); padding: 11px 18px; border-radius: 14px; font-weight: 600; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); animation: rise .2s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.spin { display: inline-block; width: 15px; height: 15px; border: 2.5px solid color-mix(in srgb, currentColor 25%, transparent); border-top-color: currentColor; border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ======================================================= masuk */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.login .lside { background: var(--brand); color: #fff; padding: 44px 56px; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; position: relative; overflow: hidden; }
.login .lside::after { content: ""; position: absolute; right: -120px; bottom: -120px; width: 420px; height: 420px; border-radius: 50%; border: 56px solid rgba(255, 255, 255, .08); pointer-events: none; }
.login .lside .brand i { background: #fff; color: #2B22B8; }
.login .big { font: 800 clamp(48px, 7vw, 92px)/.92 var(--ui); letter-spacing: -.055em; }
.login .lside p { font-size: 18px; opacity: .9; max-width: 32ch; margin-top: 18px; }
.login .feats { display: grid; gap: 10px; margin-top: 26px; font-weight: 600; position: relative; z-index: 1; }
.login .feats span { display: flex; align-items: center; gap: 10px; }
.login .feats svg { background: rgba(255, 255, 255, .18); border-radius: 50%; padding: 4px; width: 24px; height: 24px; }
.login form { padding: 0 56px; display: grid; gap: 18px; align-content: center; max-width: 520px; }
.login form h1 { font: 800 32px/1.1 var(--ui); letter-spacing: -.03em; }

/* ======================================================= layar sempit */
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page { padding: 32px 28px 90px; }
}
@media (max-width: 960px) {
  .home, .two-col, .quiz-layout, .split { grid-template-columns: minmax(0, 1fr); }
  .two-col { gap: 32px; }
  .doc { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .doc-rail { position: static; max-height: none; overflow: visible; order: 1; padding-top: 18px; border-top: 1px solid var(--line); }
  .doc-rail .toc, .doc-rail .rail-sec.tocwrap { display: none; }
  .rail-actions { display: flex; flex-wrap: wrap; }
  .quiz-layout .side2 { position: static; }
}
@media (max-width: 860px) {
  .shell { display: block; }
  .side { display: none; }
  .mtop { display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 30; height: var(--mtop); padding: 0 16px; background: var(--bg); border-bottom: 1px solid var(--line); }
  .mtop .brand { font-size: 21px; padding: 0; }
  .mtop .brand i { width: 30px; height: 30px; }
  .mtop .end { margin-left: auto; display: flex; align-items: center; gap: 8px; }
  .chip-streak { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px 6px 9px; border-radius: 99px; background: var(--flame-soft); color: var(--flame-ink); font-weight: 750; text-decoration: none; font-variant-numeric: tabular-nums; }
  .chip-streak svg { color: var(--flame); fill: var(--flame); }
  .tabbar { display: flex; position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--bg) 94%, transparent); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-top: 1px solid var(--line); }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 4px; font-size: 12px; font-weight: 650; border-radius: 14px; color: var(--ink-2); text-decoration: none; }
  .tabbar a[aria-current="page"] { background: var(--brand-soft); color: var(--brand); }
  .page { padding: 22px 16px 120px; min-height: 0; }
  .banner { padding: 10px 16px; }
  .readbar { left: 0; top: var(--mtop); }
  .hero { padding: 24px 22px; border-radius: 26px; }
  .today { padding: 22px; border-radius: 26px; }
  .today .top-row { gap: 16px; }
  .form .two { grid-template-columns: 1fr; }
  .row { gap: 12px; flex-wrap: wrap; padding: 14px; }
  .row .actions { width: 100%; }
  .login { grid-template-columns: 1fr; }
  .login .lside { padding: 28px 24px 36px; min-height: 38vh; }
  .login .feats { display: none; }
  .login form { padding: 32px 24px 40px; max-width: none; }
  .result { grid-template-columns: 1fr; justify-items: start; padding: 24px; gap: 20px; }
  .qres .body { padding-left: 18px; }
  :root { --fs: 17.5px; }
  .opt { padding: 12px 14px; font-size: 16.5px; }
  #toasts { bottom: 84px; }
  .qfoot .kbd, .qfoot .hintk { display: none; }
  .qfoot .btn.primary-next { flex: 1; }
  .toolbar .inwrap { flex-basis: 100%; max-width: none; }
  .toolbar select { flex: 1; min-width: 0; }
  dialog.dlg { padding: 22px; }
  dialog.dlg .actions { flex-direction: column-reverse; align-items: stretch; }
  dialog.dlg .actions .btn { width: 100%; }
  .hero .xl { font-size: 104px; }
}
@media (max-width: 520px) {
  .stats { gap: 10px; }
  .stat { padding: 14px 16px; }
  .stat dd { font-size: 25px; }
  .cards { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .wk .d, svg.ring .prg, .toast { animation: none; }
  .spin { animation-duration: 3s; }
  .skel { animation: none; }
  .qres .chev, .dcard, .bar > i { transition: none; }
}
@media print {
  .side, .mtop, .tabbar, #toasts, .doc-rail, .tabs, .skip, .back, .readbar, .banner { display: none !important; }
  .shell, .doc { display: block; }
  .page { padding: 0; max-width: none; }
  body { background: #fff; color: #000; }
  .sheet, .sheet h1, .sheet h2, .sheet h3, .sheet h4, .sheet strong { color: #000; }
  .sheet .math-block, .sheet tbody tr:nth-child(even) td { background: none; }
  .mm-bar, .mm-side, .mm-hint { display: none !important; }
}

/* tambahan */
.stats.six { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stats.six .stat { text-align: left; }
.sjlist { display: grid; gap: 8px; max-height: 46vh; overflow-y: auto; margin: 4px 0 6px; }
.sjlist .row { padding: 10px 14px; }
.sjlist .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--c); flex: none; }
.hide-sm { }
@media (max-width: 520px) { .stats.six { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ==================================================================== Chat AI per materi */
/* Mode layar penuh: tinggi dikunci di viewport; hanya utas chat yang menggulung.
   Spesifisitas "body.chat-mode .page.page-chat" menang atas ".page" tanpa !important. */
body.chat-mode { height: 100vh; height: 100dvh; overflow: hidden; }
body.chat-mode .shell { height: 100vh; height: 100dvh; min-height: 0; }
body.chat-mode .main { height: 100vh; height: 100dvh; min-height: 0; display: flex; flex-direction: column; }
body.chat-mode .page.page-chat { flex: 1; min-height: 0; width: 100%; max-width: none; margin: 0; padding: 0; display: flex; flex-direction: column; }

.chat-container { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }

/* ----- kepala: satu baris ringkas dengan blur */
.chat-header { flex: none; z-index: 6; background: color-mix(in srgb, var(--surface) 92%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.chat-header-in { max-width: 920px; margin: 0 auto; padding: 8px 20px; display: flex; align-items: center; gap: 12px; }
.chat-iconbtn { flex: none; width: 38px; height: 38px; display: grid; place-items: center; border: 0; border-radius: 12px; background: transparent; color: var(--ink-2); cursor: pointer; text-decoration: none; }
.chat-iconbtn:hover { background: var(--surface-2); color: var(--ink); }
.chat-iconbtn.chat-del:hover { background: var(--bad-soft); color: var(--bad); }
.chat-doc { flex: 1; min-width: 0; display: grid; gap: 2px; }
.chat-doc-eyebrow { font: 750 10px/1 var(--ui); letter-spacing: .1em; text-transform: uppercase; color: var(--brand); }
.chat-doc-title { font: 800 16.5px/1.25 var(--ui); letter-spacing: -.02em; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-header-end { flex: none; display: flex; align-items: center; gap: 4px; }

/* badge status dengan titik berdenyut */
.chat-badge { display: inline-flex; align-items: center; gap: 7px; font: 700 12px/1 var(--ui); border-radius: 99px; padding: 6px 11px; border: 1px solid transparent; margin-right: 4px; flex: none; }
.chat-badge .pulse-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.chat-badge.preparing { background: var(--flame-soft); color: var(--flame-ink); }
.chat-badge.preparing .pulse-dot { background: var(--flame); animation: pulseDot 1.1s ease-in-out infinite; }
.chat-badge.ready { background: var(--good-soft); color: var(--good); }
.chat-badge.ready .pulse-dot { background: var(--good); animation: pulseDot 2.2s ease-in-out infinite; }
.chat-badge.error { background: var(--bad-soft); color: var(--bad); }
.chat-badge.error .pulse-dot { background: var(--bad); }
.badge-txt-short { display: none; }
@keyframes pulseDot { 0%, 100% { transform: scale(.8); opacity: .55; } 50% { transform: scale(1.15); opacity: 1; } }

/* ----- badan: utas + komposer mengambang */
.chat-body { flex: 1; min-height: 0; position: relative; }
.chat-thread { height: 100%; overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column; gap: 16px; padding: 22px 20px 150px; overscroll-behavior: contain; }
.chat-thread::-webkit-scrollbar { width: 6px; }
.chat-thread::-webkit-scrollbar-track { background: transparent; }
.chat-thread::-webkit-scrollbar-thumb { background: var(--line); border-radius: 99px; }
.chat-thread::-webkit-scrollbar-thumb:hover { background: var(--ink-2); }
.chat-msg, .chat-day, .chat-note { max-width: 780px; width: 100%; margin-left: auto; margin-right: auto; }

/* pil info di puncak utas */
.chat-note { display: flex; align-items: center; justify-content: center; gap: 7px; flex-wrap: wrap; width: -moz-fit-content; width: fit-content; max-width: 100%; text-align: center; font-size: 12px; font-weight: 550; color: var(--ink-2); background: var(--surface); border: 1px solid var(--line); border-radius: 99px; padding: 6px 13px; margin-bottom: 2px; }
.chat-note.bad { color: var(--bad); background: var(--bad-soft); border-color: transparent; }
.chat-note-btn { border: 0; background: none; padding: 0; font: 700 12px var(--ui); color: var(--bad); text-decoration: underline; cursor: pointer; }
.chat-note-btn:hover { opacity: .8; }

/* pemisah hari */
.chat-day { display: flex; align-items: center; gap: 12px; margin-top: 8px; font: 700 11px/1 var(--ui); letter-spacing: .07em; text-transform: uppercase; color: var(--ink-2); }
.chat-day::before, .chat-day::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ----- pesan */
.chat-msg { display: flex; animation: msgIn .22s ease-out both; }
@keyframes msgIn { from { opacity: 0; transform: translateY(8px); } }
.chat-msg.user { flex-direction: column; align-items: flex-end; gap: 4px; }
.chat-msg.ai { gap: 12px; }
.chat-avatar { flex: none; width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; margin-top: 3px; color: #fff; background: linear-gradient(135deg, var(--brand), #7C3AED); box-shadow: 0 4px 12px -3px rgba(58, 47, 224, .45); }
.chat-msg-body { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; max-width: calc(100% - 46px); }
.chat-msg-head { display: flex; align-items: center; gap: 8px; padding: 0 4px; margin-bottom: 5px; }
.chat-msg-name { font: 750 12.5px/1 var(--ui); }
.chat-msg-tag { font: 800 9px/1 var(--ui); letter-spacing: .08em; text-transform: uppercase; color: var(--brand); background: var(--brand-soft); border-radius: 5px; padding: 3px 6px; }
.chat-msg-time { font-size: 11px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.chat-msg-foot { font-size: 11px; color: var(--ink-2); padding-right: 6px; font-variant-numeric: tabular-nums; }

.chat-bubble { padding: 12px 16px; font-size: 15px; line-height: 1.62; word-break: break-word; }
.chat-bubble.user { max-width: min(86%, 640px); color: #fff; background: linear-gradient(135deg, var(--brand) 0%, var(--brand-deep) 100%); border-radius: 18px 18px 5px 18px; box-shadow: 0 6px 18px -8px rgba(58, 47, 224, .5); }
.chat-bubble.ai { width: -moz-fit-content; width: fit-content; max-width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 5px 18px 18px 18px; box-shadow: 0 1px 2px rgba(21, 19, 59, .05); }
.chat-main-text { white-space: pre-wrap; }

/* kutipan di dalam bubble pengguna */
.chat-quote-callout { max-width: 100%; margin-bottom: 8px; padding: 6px 10px; background: rgba(0, 0, 0, .22); border-left: 3px solid rgba(255, 255, 255, .85); border-radius: 8px; }
.chat-quote-head { display: flex; align-items: center; gap: 5px; margin-bottom: 3px; font: 750 9.5px/1 var(--ui); letter-spacing: .07em; text-transform: uppercase; opacity: .8; }
.chat-quote-text { font-size: 12.5px; line-height: 1.45; font-style: italic; color: rgba(255, 255, 255, .95); white-space: pre-wrap; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }

/* Markdown di bubble AI */
.chat-bubble.ai .sheet { max-width: none; font-family: var(--ui); font-size: 15px; line-height: 1.66; }
.chat-bubble.ai .sheet > :first-child { margin-top: 0; }
.chat-bubble.ai .sheet > :last-child { margin-bottom: 0; }
.chat-bubble.ai .sheet h1, .chat-bubble.ai .sheet h2, .chat-bubble.ai .sheet h3, .chat-bubble.ai .sheet h4 { color: var(--brand); margin: 1.1em 0 .4em; }
.chat-bubble.ai .sheet h1, .chat-bubble.ai .sheet h2 { font-size: 16.5px; }
.chat-bubble.ai .sheet blockquote { background: var(--surface-2); border-left: 3px solid var(--brand); border-radius: 0 10px 10px 0; padding: 8px 14px; font-size: 14px; }
.chat-bubble.ai .sheet pre { background: #0C0B20; color: #E4E3FF; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.chat-bubble.ai .sheet code { font-size: .88em; }
.chat-bubble.ai .sheet table { display: block; overflow-x: auto; max-width: 100%; }

/* Kursor streaming kata-per-kata ala ChatGPT */
.chat-cursor {
  display: inline-block;
  width: 7.5px;
  height: 15px;
  margin-left: 3px;
  vertical-align: -2px;
  background-color: var(--brand);
  border-radius: 2px;
  animation: chatCursorBlink .8s ease-in-out infinite;
}
@keyframes chatCursorBlink {
  0%, 100% { opacity: 1; transform: scaleY(1); }
  50% { opacity: 0; transform: scaleY(.85); }
}

/* aksi pesan AI */
.chat-msg-actions { display: flex; gap: 6px; margin-top: 6px; padding: 0 3px; }
.chat-action-btn { display: inline-flex; align-items: center; gap: 5px; font: 600 11.5px/1 var(--ui); color: var(--ink-2); background: transparent; border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; cursor: pointer; transition: color .12s, border-color .12s, background .12s; }
.chat-action-btn:hover { color: var(--brand); border-color: var(--brand); background: var(--brand-soft); }
.chat-action-btn.copied { color: var(--good); border-color: var(--good); background: var(--good-soft); }

/* indikator berpikir */
.thinking-row .chat-bubble { display: flex; align-items: center; gap: 12px; }
.typing-dots { display: inline-flex; gap: 5px; }
.typing-dots span { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); animation: dotPulse 1.4s infinite ease-in-out; }
.typing-dots span:nth-child(2) { animation-delay: .2s; }
.typing-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes dotPulse { 0%, 80%, 100% { transform: scale(.6); opacity: .35; } 40% { transform: scale(1.1); opacity: 1; } }
.thinking-label { font-size: 13.5px; font-weight: 600; color: var(--ink-2); }

/* tombol lompat ke pesan terbaru */
.chat-jump { position: absolute; right: 26px; bottom: 136px; z-index: 5; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); display: grid; place-items: center; cursor: pointer; box-shadow: var(--shadow); opacity: 0; visibility: hidden; transform: translateY(10px); transition: opacity .16s, transform .16s, visibility .16s, color .12s, border-color .12s; }
.chat-jump.show { opacity: 1; visibility: visible; transform: none; }
.chat-jump:hover { color: var(--brand); border-color: var(--brand); }
.chat-jump.ping::after { content: ""; position: absolute; top: -2px; right: -2px; width: 11px; height: 11px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 2.5px var(--surface); }

/* ----- keadaan kosong (siap, belum ada pesan) */
.chat-hero { margin: auto; width: 100%; max-width: 620px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 28px 10px; }
.chat-hero-icon { width: 62px; height: 62px; border-radius: 20px; display: grid; place-items: center; margin-bottom: 8px; color: #fff; background: linear-gradient(135deg, var(--brand), #7C3AED); box-shadow: 0 12px 28px -8px rgba(58, 47, 224, .5); }
.chat-hero-title { font: 800 22px/1.2 var(--ui); letter-spacing: -.025em; }
.chat-hero-desc { max-width: 46ch; font-size: 14.5px; line-height: 1.55; color: var(--ink-2); }
.chat-chips-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; margin-top: 16px; }
.chat-chip { display: flex; align-items: center; gap: 10px; text-align: left; font: 600 13px/1.4 var(--ui); color: var(--ink); background: var(--surface); border: 1.5px solid var(--line); border-radius: 14px; padding: 12px 14px; cursor: pointer; transition: border-color .15s, background .15s, color .15s, transform .15s; }
.chat-chip svg { color: var(--brand); flex: none; }
.chat-chip:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); transform: translateY(-1px); }

/* ----- keadaan menyiapkan konteks */
.chat-prep { margin: auto; width: 100%; max-width: 440px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 20px; }
.prep-icon-wrap { position: relative; width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; margin-bottom: 6px; color: #fff; background: linear-gradient(135deg, var(--brand), #7C3AED); box-shadow: 0 12px 28px -8px rgba(58, 47, 224, .5); }
.prep-pulse-ring { position: absolute; inset: -7px; border-radius: 26px; border: 2px dashed var(--brand); opacity: .5; animation: spinRing 6s linear infinite; }
@keyframes spinRing { to { transform: rotate(360deg); } }
.prep-title { font: 800 20px/1.2 var(--ui); letter-spacing: -.02em; }
.prep-desc { max-width: 42ch; font-size: 14px; line-height: 1.55; color: var(--ink-2); }
.prep-steps { display: grid; gap: 6px; width: 100%; margin-top: 10px; text-align: left; }
.prep-step { display: flex; align-items: center; gap: 10px; padding: 9px 13px; font-size: 13px; font-weight: 550; color: var(--ink-2); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.prep-step.done { color: var(--good); background: var(--good-soft); border-color: color-mix(in srgb, var(--good) 25%, transparent); }
.prep-step.active { color: var(--brand); background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 30%, transparent); font-weight: 650; }
.prep-step.pending { opacity: .65; }
.spin.sm { width: 13px; height: 13px; border-width: 2px; margin-right: 0; }

/* ----- komposer mengambang di dasar utas */
.chat-composer { position: absolute; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; flex-direction: column; gap: 8px; padding: 30px 20px 14px; background: linear-gradient(to top, var(--bg) 58%, transparent); pointer-events: none; }
.chat-composer > * { pointer-events: auto; }
.chat-quote-bar, .chat-dock, .chat-dock-hints { width: 100%; max-width: 780px; margin-left: auto; margin-right: auto; }

/* bar kutipan aktif */
.chat-quote-bar { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 12px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: 14px; box-shadow: 0 8px 22px -12px rgba(21, 19, 59, .3); animation: quoteIn .16s ease-out; }
@keyframes quoteIn { from { opacity: 0; transform: translateY(5px); } }
.chat-quote-ic { flex: none; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.chat-quote-meta { flex: 1; min-width: 0; display: grid; gap: 1px; }
.chat-quote-lbl { font: 750 9.5px/1 var(--ui); letter-spacing: .08em; text-transform: uppercase; color: var(--brand); }
.chat-quote-snip { font-size: 12.5px; font-style: italic; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-quote-clear { flex: none; width: 26px; height: 26px; border: 0; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); cursor: pointer; transition: background .12s, color .12s; }
.chat-quote-clear:hover { background: var(--bad-soft); color: var(--bad); }

/* dermaga input */
.chat-dock { display: flex; align-items: flex-end; gap: 10px; padding: 8px 9px 8px 17px; background: var(--surface); border: 1.5px solid var(--line); border-radius: 22px; box-shadow: 0 12px 32px -14px rgba(21, 19, 59, .35); transition: border-color .15s, box-shadow .15s; }
.chat-dock:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft), 0 14px 34px -14px rgba(58, 47, 224, .4); }
.chat-input { flex: 1; min-width: 0; border: 0; background: none; outline: none; resize: none; max-height: 150px; padding: 8px 0; color: var(--ink); font: 450 15px/1.5 var(--ui); }
.chat-input::placeholder { color: var(--ink-2); opacity: .7; }
.chat-send-btn { flex: none; width: 40px; height: 40px; border: 0; border-radius: 50%; display: grid; place-items: center; color: #fff; cursor: pointer; background: linear-gradient(135deg, var(--brand), var(--brand-deep)); box-shadow: 0 5px 14px -3px rgba(58, 47, 224, .55); transition: transform .15s, box-shadow .15s, opacity .15s; }
.chat-send-btn:hover:not(:disabled) { transform: translateY(-1px) scale(1.05); }
.chat-send-btn:active:not(:disabled) { transform: scale(.96); }
.chat-send-btn:disabled { opacity: .4; cursor: not-allowed; box-shadow: none; }
.chat-dock-hints { display: flex; justify-content: space-between; align-items: center; font-size: 11.5px; color: var(--ink-2); padding: 0 6px; }
.chat-dock-hints kbd { font: inherit; background: var(--surface-2); border: 1px solid var(--line); padding: 1px 5px; border-radius: 5px; color: var(--ink); }
.chat-dock-model { display: inline-flex; align-items: center; gap: 5px; font-weight: 650; color: var(--brand); }

/* popover kutip melayang mengikuti seleksi teks */
.chat-quote-popover { position: fixed; z-index: 999; display: inline-flex; align-items: center; gap: 7px; padding: 9px 15px; background: var(--ink); color: var(--bg); border: 0; border-radius: 99px; font: 650 12.5px/1 var(--ui); cursor: pointer; box-shadow: 0 10px 30px rgba(21, 19, 59, .35); user-select: none; opacity: 0; visibility: hidden; transform: translateY(4px); transition: opacity .14s, transform .14s, visibility .14s; }
.chat-quote-popover.visible { opacity: 1; visibility: visible; transform: none; }
.chat-quote-popover:hover { background: var(--brand); color: #fff; }

/* ----- layar sempit */
@media (max-width: 860px) {
  body.chat-mode .side,
  body.chat-mode .mtop,
  body.chat-mode .tabbar,
  body.chat-mode #banner { display: none; }
  .chat-header-in { padding: 6px 12px; gap: 10px; }
  .chat-thread { padding: 16px 12px 140px; gap: 14px; }
  .chat-composer { padding: 26px 10px calc(10px + env(safe-area-inset-bottom)); }
  .chat-jump { right: 14px; bottom: 122px; }
}
@media (max-width: 640px) {
  .chat-doc-eyebrow { display: none; }
  .chat-doc-title { font-size: 15.5px; }
  .chat-iconbtn { width: 36px; height: 36px; }
  .chat-badge { font-size: 11px; padding: 5px 9px; gap: 5px; }
  .badge-txt-full { display: none; }
  .badge-txt-short { display: inline; }
  .chat-note { font-size: 11.5px; }
  .chat-avatar { width: 29px; height: 29px; border-radius: 9px; }
  .chat-avatar svg { width: 14px; height: 14px; }
  .chat-msg-body { max-width: calc(100% - 40px); }
  .chat-msg-head { margin-bottom: 4px; }
  .chat-msg-name { font-size: 11.5px; }
  .chat-bubble { padding: 10px 13px; font-size: 14.5px; line-height: 1.55; }
  .chat-bubble.user { max-width: 92%; border-radius: 16px 16px 4px 16px; }
  .chat-bubble.ai { border-radius: 4px 16px 16px 16px; }
  .chat-bubble.ai .sheet { font-size: 14.5px; line-height: 1.6; }
  .chat-bubble.ai .sheet pre { padding: 10px 12px; font-size: 12.5px; }
  .chat-quote-callout { padding: 5px 8px; margin-bottom: 6px; }
  .chat-quote-text { font-size: 12px; }
  .chat-chips-grid { grid-template-columns: 1fr; gap: 8px; }
  .chat-hero { padding: 20px 4px; }
  .chat-hero-icon { width: 52px; height: 52px; border-radius: 17px; }
  .chat-hero-title { font-size: 19px; }
  .chat-hero-desc { font-size: 13.5px; }
  .chat-prep { padding: 12px; }
  .chat-input { font-size: 16px; /* cegah zoom otomatis iOS saat fokus */ }
  .chat-dock { border-radius: 20px; padding: 6px 7px 6px 14px; }
  .chat-send-btn { width: 38px; height: 38px; }
  .chat-dock-hints { display: none; }
  .chat-jump { width: 38px; height: 38px; bottom: 108px; }
}
@media (max-width: 420px) {
  .chat-doc-title { max-width: 46vw; }
  .chat-bubble.user { max-width: 100%; }
  .chat-quote-snip { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .chat-msg, .chat-quote-bar, .chat-quote-popover { animation: none; }
  .chat-badge .pulse-dot, .typing-dots span, .prep-pulse-ring { animation: none; }
  .chat-jump { transition: none; }
}

/* ====================================================================== Panel Tanya pada catatan */
.ask-pop {
  position: fixed; z-index: 900; display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 15px; background: var(--ink); color: var(--bg); border: 0; border-radius: 99px;
  font: 650 12.5px/1 var(--ui); cursor: pointer; user-select: none;
  box-shadow: 0 10px 30px rgba(21, 19, 59, .35);
  opacity: 0; visibility: hidden; transform: translateY(4px);
  transition: opacity .14s, transform .14s, visibility .14s;
}
.ask-pop.visible { opacity: 1; visibility: visible; transform: none; }
.ask-pop:hover { background: var(--brand); color: #fff; }

.ask-panel {
  position: fixed; top: 74px; right: 18px; bottom: 18px; width: 396px;
  max-width: calc(100vw - 36px); z-index: 800;
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 24px 60px -18px rgba(21, 19, 59, .4);
  animation: askIn .16s ease-out;
}
@keyframes askIn { from { opacity: 0; transform: translateY(10px); } }

.ask-head {
  flex: none; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 13px 10px 13px 16px; border-bottom: 1px solid var(--line);
}
.ask-head-txt { display: grid; gap: 2px; min-width: 0; }
.ask-title { display: inline-flex; align-items: center; gap: 7px; font: 700 15px/1.2 var(--ui); color: var(--ink); }
.ask-title .i { color: var(--brand); }
.ask-sub { font: 500 12px/1.3 var(--ui); color: var(--ink-2); }

.ask-quote { flex: none; margin: 12px 14px 0; padding: 9px 12px; border-left: 3px solid var(--brand); background: var(--surface-2); border-radius: 4px 10px 10px 4px; }
.ask-quote-head { display: inline-flex; align-items: center; gap: 6px; font: 700 10.5px/1 var(--ui); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 5px; }
.ask-quote-text { font: 500 13px/1.5 var(--ui); color: var(--ink); overflow-wrap: break-word; }

.ask-thread { flex: 1; overflow-y: auto; padding: 14px; display: grid; gap: 14px; align-content: start; }
.ask-item { display: grid; gap: 8px; animation: msgIn .18s ease-out; }
.ask-q {
  justify-self: end; max-width: 88%; padding: 8px 12px; border-radius: 14px 14px 4px 14px;
  background: var(--brand); color: var(--on-brand); font: 600 13px/1.5 var(--ui);
  overflow-wrap: break-word;
}
.ask-answer { min-width: 0; }
.ask-answer .sheet { font: 14px/1.65 var(--read); max-width: none; }
.ask-answer .sheet pre { padding: 10px 12px; font-size: 12.5px; }
.ask-thinking { display: inline-flex; align-items: center; gap: 10px; padding: 8px 2px; }
.ask-err { color: var(--bad); font: 600 13px/1.5 var(--ui); padding: 8px 2px; }

.ask-foot { flex: none; border-top: 1px solid var(--line); padding: 10px 12px 12px; }
.ask-form { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border-radius: 14px; padding: 6px 6px 6px 14px; }
.ask-input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink); font: 500 16px/1.4 var(--ui); outline: none; }
.ask-input::placeholder { color: var(--ink-2); }
.ask-input:disabled { opacity: .55; }
.ask-send {
  flex: none; width: 38px; height: 38px; display: grid; place-items: center;
  border: 0; border-radius: 11px; background: var(--brand); color: var(--on-brand); cursor: pointer;
}
.ask-send:disabled { opacity: .5; cursor: default; }
.ask-hint { display: flex; align-items: center; justify-content: center; gap: 5px; margin-top: 8px; font: 500 11.5px/1 var(--ui); color: var(--ink-2); }
.ask-hint .i { color: var(--brand); }

@media (max-width: 760px) {
  .ask-panel {
    top: auto; left: 0; right: 0; bottom: 0; width: auto; max-width: none;
    max-height: 74vh; border-radius: 20px 20px 0 0; border-left: 0; border-right: 0; border-bottom: 0;
    animation: askUp .2s ease-out;
  }
  .ask-answer .sheet { font-size: 14.5px; }
}
@keyframes askUp { from { transform: translateY(40%); opacity: .4; } }

@media (prefers-reduced-motion: reduce) {
  .ask-pop, .ask-panel, .ask-item { animation: none; transition: none; }
}

/* Utility & Animasi Bersama */
.center { text-align: center; }
.actions.center { justify-content: center; }
@keyframes g-shake { 0%, 100% { transform: none; } 20% { transform: translateX(-7px); } 40% { transform: translateX(7px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }
@keyframes g-pop { 0% { transform: scale(1); } 40% { transform: scale(1.14); } 100% { transform: scale(1); } }
.shake { animation: g-shake .38s ease; }
.pop { animation: g-pop .3s ease; }

/* Kartu Belajar SM-2 */
.fc-stage { max-width: 560px; margin: 18px auto; display: grid; gap: 14px; }
.fc { width: 100%; min-height: 220px; display: grid; place-content: center; gap: 10px; text-align: center; padding: 24px; border-radius: 22px; background: var(--surface); border: 1.5px solid var(--line); box-shadow: var(--shadow); cursor: pointer; }
.fc.back { cursor: default; background: var(--brand-soft); border-color: transparent; }
.fc small { color: var(--ink-2); }
.fc-t { font: 750 clamp(22px, 5vw, 30px)/1.25 var(--ui); }
.fc-t.def { font: 500 calc(var(--fs) * 1.1)/1.5 var(--read); }
.fc-h { font-size: 13px; color: var(--ink-2); }
.fc-rate { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.fc-rate .rate { display: grid; gap: 4px; justify-items: center; padding: 10px 4px; border-radius: 14px; }
.fc-rate .rate.bad { border-color: var(--bad); color: var(--bad); }
.fc-rate .rate.good { border-color: var(--good); color: var(--good); }

/* ======================================================= mind map */
.mm { display: grid; gap: 14px; }
.mm-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.mm-bar .grow { flex: 1 1 auto; }
.mm-bar .seg { margin: 0; }
.mm-canvas { position: relative; height: clamp(440px, 70vh, 800px); background: var(--surface); border: 1.5px solid var(--line); border-radius: 18px; overflow: hidden; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none;
  background-image: radial-gradient(color-mix(in srgb, var(--ink-2) 18%, transparent) 1px, transparent 1px); background-size: 22px 22px; }
.mm-canvas.drag { cursor: grabbing; }
.mm-canvas > svg { display: block; width: 100%; height: 100%; }
.mm-canvas text { font-family: var(--read); pointer-events: none; }
.mm-node { cursor: pointer; }
.mm-node:focus-visible { outline: none; }
.mm-node:focus-visible rect.box, .mm-node.sel rect.box { stroke-width: 3.2; }
.mm-node.sel rect.box { filter: drop-shadow(0 3px 7px rgba(21, 19, 59, .28)); }
.mm-node:hover rect.box { filter: brightness(.97); }
.mm-toggle { cursor: pointer; }
.mm-toggle circle { fill: var(--surface); stroke-width: 1.8; }
.mm-toggle text { font-weight: 800; font-size: 12px; text-anchor: middle; dominant-baseline: central; fill: var(--ink-2); }
.mm-rel { fill: none; stroke: var(--flame); stroke-width: 1.8; stroke-dasharray: 5 4; opacity: .9; }
.mm-rel-lbl text { font-size: 11.5px; font-weight: 700; fill: var(--flame-ink); text-anchor: middle; }
.mm-rel-lbl rect { fill: var(--surface); stroke: var(--flame); stroke-width: 1; }
.mm-zoom { position: absolute; left: 10px; bottom: 10px; display: flex; flex-direction: column; gap: 6px; }
.mm-zoom .btn { min-height: 38px; min-width: 38px; padding: 0; border-radius: 11px; box-shadow: var(--shadow); background: var(--surface); }
.mm-hint { color: var(--ink-2); font-size: 13px; }
.mm-side { position: absolute; z-index: 2; top: 10px; right: 10px; width: min(310px, calc(100% - 20px)); max-height: calc(100% - 20px); overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; cursor: auto; user-select: text; -webkit-user-select: text;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 16px; padding: 14px 16px; box-shadow: 0 10px 30px rgba(21, 19, 59, .18); }
.mm-side[hidden] { display: none; }
.mm-close { position: absolute; top: 6px; right: 6px; min-height: 34px; min-width: 34px; padding: 0; border-radius: 10px; }
.mm-side h3, .mm-side .crumb { padding-right: 34px; }
.mm-side h3 { font: 750 17px/1.3 var(--read); margin-bottom: 4px; }
.mm-side .crumb { font-size: 12.5px; color: var(--ink-2); margin-bottom: 10px; overflow-wrap: anywhere; }
.mm-side .sheet { font-size: 15px; max-width: none; line-height: 1.65; }
.mm-side .chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.mm-side .chips .chip { min-height: 0; padding: 4px 11px; font-size: 13px; text-align: left; }
.mm-side h4 { font: 700 12.5px/1 var(--ui); color: var(--ink-2); margin: 14px 0 0; letter-spacing: .04em; text-transform: uppercase; }

.mm-empty { text-align: center; padding: 40px 18px; border: 1.5px dashed var(--line); border-radius: 18px; background: var(--surface); }
.mm-empty h3 { font: 750 20px/1.2 var(--read); margin-bottom: 8px; }
.mm-empty p { max-width: 52ch; margin: 0 auto 16px; color: var(--ink-2); }
.mm-list { background: var(--surface); border: 1.5px solid var(--line); border-radius: 18px; padding: 14px 18px; font: 450 15.5px/1.6 var(--read); }
.mm-list ul { list-style: none; padding-left: 1.1em; margin: 0; border-left: 2px solid var(--line); }
.mm-list > ul { border-left: 0; padding-left: 0; }
.mm-list li { margin: 4px 0; }
.mm-list summary { cursor: pointer; font-weight: 700; }
.mm-list .lf { padding-left: 1.1em; }
.mm-list .dtl { display: block; color: var(--ink-2); font-size: 14px; font-weight: 450; }
.mm-list button.nodebtn { background: none; border: 0; padding: 0; text-align: left; cursor: pointer; font: inherit; color: inherit; }
.mm-list button.nodebtn:hover { color: var(--brand); text-decoration: underline; }
@media (max-width: 700px) { .mm-canvas { height: clamp(400px, 66vh, 640px); border-radius: 14px; }
  .mm-side { top: auto; bottom: 8px; left: 8px; right: 8px; width: auto; max-height: 48%; } }

/* tab dokumen kini tiga (Catatan, Mind map, Kuis): jangan membungkus label, rapatkan di layar sempit */
.tabs button { white-space: nowrap; }
@media (max-width: 520px) { .tabs { gap: 0; overflow-x: auto; scrollbar-width: none; } .tabs button { padding: 10px 11px; font-size: 15px; } }
