/* ================= Sanatio Vitalis — Styles ================= */
:root {
  /* Palet tinta hitam + perak, diambil dari logo Sanatio Vitalis */
  --bg: #f4f4f5;
  --bg-soft: #ececee;
  --surface: #ffffff;
  --surface-2: #f8f8f9;
  --border: #e2e2e6;
  --text: #121214;
  --text-2: #52525b;
  --muted: #8b8b94;
  --primary: #18181b;
  --primary-2: #3f3f46;
  --primary-soft: #ebebee;
  --on-primary: #ffffff;
  --accent: #a1a1aa;
  --success: #16a34a;
  --success-soft: #e8f8ee;
  --danger: #e11d48;
  --danger-soft: #fdecf0;
  --warn: #d97706;
  --warn-soft: #fef5e6;
  --info: #0284c7;
  --info-soft: #e8f4fc;
  --grad: linear-gradient(135deg, #0b0b0d 0%, #27272c 52%, #5d5d66 115%);
  --sheen: linear-gradient(135deg, #fafafa 0%, #c7c7cc 48%, #f1f1f3 100%);
  --dots: radial-gradient(rgba(255, 255, 255, .09) 1.1px, transparent 1.4px);
  --shadow-sm: 0 1px 2px rgba(18, 18, 20, .05), 0 1px 3px rgba(18, 18, 20, .04);
  --shadow: 0 4px 20px -6px rgba(18, 18, 20, .14), 0 2px 6px -2px rgba(18, 18, 20, .06);
  --shadow-lg: 0 24px 48px -16px rgba(18, 18, 20, .35);
  --glow: rgba(18, 18, 20, .45);
  --radius: 18px;
  --radius-sm: 12px;
  --sidebar-w: 260px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0a0c; --bg-soft: #18181b; --surface: #131315; --surface-2: #19191c;
    --border: #2a2a2f; --text: #ededef; --text-2: #a8a8b0; --muted: #6e6e78;
    --primary: #d9d9de; --primary-2: #f4f4f5; --primary-soft: #232327; --on-primary: #0a0a0c;
    --success: #34d399; --success-soft: #0f2a22; --danger: #fb7185; --danger-soft: #34151f;
    --warn: #fbbf24; --warn-soft: #2e2410; --info: #38bdf8; --info-soft: #0f2536;
    --grad: linear-gradient(135deg, #2c2c32 0%, #1a1a1e 50%, #3d3d45 100%);
    --sheen: linear-gradient(135deg, #f4f4f5 0%, #a1a1aa 50%, #e4e4e7 100%);
    --shadow-sm: 0 1px 2px rgba(0,0,0,.45); --shadow: 0 6px 24px -8px rgba(0,0,0,.65);
    --shadow-lg: 0 24px 48px -16px rgba(0,0,0,.75); --glow: rgba(0,0,0,.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a0a0c; --bg-soft: #18181b; --surface: #131315; --surface-2: #19191c;
  --border: #2a2a2f; --text: #ededef; --text-2: #a8a8b0; --muted: #6e6e78;
  --primary: #d9d9de; --primary-2: #f4f4f5; --primary-soft: #232327; --on-primary: #0a0a0c;
  --success: #34d399; --success-soft: #0f2a22; --danger: #fb7185; --danger-soft: #34151f;
  --warn: #fbbf24; --warn-soft: #2e2410; --info: #38bdf8; --info-soft: #0f2536;
  --grad: linear-gradient(135deg, #2c2c32 0%, #1a1a1e 50%, #3d3d45 100%);
  --sheen: linear-gradient(135deg, #f4f4f5 0%, #a1a1aa 50%, #e4e4e7 100%);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.45); --shadow: 0 6px 24px -8px rgba(0,0,0,.65);
  --shadow-lg: 0 24px 48px -16px rgba(0,0,0,.75); --glow: rgba(0,0,0,.6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font-family: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.02em; }
p { margin: 0; }
::selection { background: color-mix(in srgb, var(--primary) 25%, transparent); }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w);
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 22px 16px; gap: 22px; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px; background: var(--grad);
  display: grid; place-items: center; color: #fff; box-shadow: 0 8px 18px -6px var(--glow);
}
.brand-mark svg { width: 22px; height: 22px; stroke: none; }
.brand-name { font-weight: 800; font-size: 21px; letter-spacing: -.03em; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 12px;
  color: var(--text-2); font-weight: 600; transition: background .15s, color .15s;
}
.nav a:hover { background: var(--bg-soft); color: var(--text); }
.nav a.active { background: var(--primary-soft); color: var(--primary); }
.sidebar-card {
  margin-top: auto; border-radius: var(--radius); padding: 18px; color: #fff;
  background: var(--grad); position: relative; overflow: hidden;
}
.sidebar-card::after {
  content: ""; position: absolute; width: 140px; height: 140px; border-radius: 50%;
  right: -50px; top: -50px; background: rgba(255,255,255,.12);
}
.sidebar-card-title { font-weight: 800; font-size: 16px; margin-bottom: 4px; }
.sidebar-card p { font-size: 13px; opacity: .9; margin-bottom: 14px; }

.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px;
  padding: 14px 32px; background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
}
.search {
  flex: 1; max-width: 520px; display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 0 14px;
  transition: border-color .15s, box-shadow .15s;
}
.search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.search svg { color: var(--muted); width: 18px; height: 18px; }
.search input { flex: 1; border: 0; outline: 0; background: transparent; font: inherit; color: var(--text); padding: 11px 0; min-width: 0; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px;
  font-weight: 700; font-size: 13px; background: var(--surface); border: 1px solid var(--border);
}
.chip svg { width: 16px; height: 16px; }
.chip-streak svg { color: #f97316; }
.chip-xp svg { color: #eab308; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-2);
}
.icon-btn:hover { color: var(--primary); border-color: var(--primary); }

.view { padding: 28px 32px 64px; max-width: 1240px; margin: 0 auto; outline: none; animation: fadeUp .35s ease backwards; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Generic ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 22px;
}
.card-hover { transition: transform .2s ease, box-shadow .2s ease, border-color .2s; }
.card-hover:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--primary) 30%, var(--border)); }
.section { margin-top: 34px; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.section-head h2 { font-size: 20px; }
.section-head p { color: var(--text-2); font-size: 14px; margin-top: 2px; }
.link { color: var(--primary); font-weight: 700; font-size: 14px; display: inline-flex; align-items: center; gap: 4px; }
.link svg { width: 16px; height: 16px; }
.muted { color: var(--muted); }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.page-title { font-size: 30px; font-weight: 800; letter-spacing: -.03em; }
.page-sub { color: var(--text-2); margin-top: 6px; max-width: 640px; }
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700; background: var(--bg-soft); color: var(--text-2);
}
.badge svg { width: 13px; height: 13px; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-primary { background: var(--primary-soft); color: var(--primary); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 20px;
  border-radius: 12px; font-weight: 700; font-size: 14.5px; transition: transform .1s, box-shadow .2s, background .2s, opacity .2s;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--primary); color: var(--on-primary); box-shadow: 0 8px 18px -8px color-mix(in srgb, var(--primary) 80%, transparent); }
.btn-primary:hover { box-shadow: 0 12px 24px -8px color-mix(in srgb, var(--primary) 80%, transparent); }
.btn-grad { background: var(--grad); color: #fff; box-shadow: 0 10px 22px -10px var(--glow), inset 0 1px 0 rgba(255,255,255,.12); }
.btn-ghost { background: var(--surface); border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-light { background: var(--sheen); color: #121214; box-shadow: inset 0 1px 0 #fff, 0 6px 16px -8px rgba(0,0,0,.5); }
.btn-success { background: var(--success); color: #fff; }
.btn-sm { padding: 8px 14px; font-size: 13px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .45; pointer-events: none; }

.progress { height: 8px; border-radius: 99px; background: var(--bg-soft); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--primary); transition: width .6s cubic-bezier(.2,.8,.2,1); }

.subject-icon {
  width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--c) 14%, transparent); color: var(--c);
}
.subject-icon svg { width: 24px; height: 24px; }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: 26px; padding: 34px; color: #fff;
  background: var(--grad); box-shadow: var(--shadow-lg);
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; align-items: center;
}
.hero::before, .hero::after { content: ""; position: absolute; border-radius: 50%; background: rgba(255,255,255,.1); }
.hero::before { width: 320px; height: 320px; right: -80px; top: -120px; }
.hero::after { width: 180px; height: 180px; right: 180px; bottom: -110px; }
.hero > * { position: relative; z-index: 1; }
.hero-eyebrow { display: inline-flex; align-items: center; gap: 8px; background: rgba(255,255,255,.18); padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; }
.hero-eyebrow svg { width: 15px; height: 15px; }
.hero h1 { font-size: 34px; font-weight: 800; margin: 14px 0 10px; letter-spacing: -.035em; }
.hero p { opacity: .92; max-width: 520px; }
.hero-actions { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.hero-actions .btn-ghost { background: rgba(255,255,255,.15); border-color: rgba(255,255,255,.3); color: #fff; }
.hero-actions .btn-ghost:hover { background: rgba(255,255,255,.25); color: #fff; border-color: #fff; }
.hero-continue {
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.25); border-radius: 20px; padding: 20px;
  backdrop-filter: blur(6px);
}
.hero-continue .label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; opacity: .8; }
.hero-continue h3 { font-size: 18px; margin: 8px 0 4px; }
.hero-continue .meta { font-size: 13px; opacity: .85; }
.hero-continue .progress { background: rgba(255,255,255,.25); margin: 14px 0; }
.hero-continue .progress > span { background: #fff; }

/* ---------- Stats ---------- */
.stat { display: flex; align-items: center; gap: 14px; }
.stat-icon { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 14%, transparent); color: var(--c); }
.stat-value { font-size: 24px; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.stat-label { font-size: 13px; color: var(--text-2); font-weight: 600; }

/* ---------- Subject card ---------- */
.subject-card { display: flex; flex-direction: column; gap: 14px; position: relative; overflow: hidden; }
.subject-card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--c); opacity: .9;
}
.subject-card h3 { font-size: 18px; }
.subject-card p { color: var(--text-2); font-size: 14px; flex: 1; }
.subject-card .row { display: flex; align-items: center; justify-content: space-between; font-size: 13px; color: var(--text-2); font-weight: 600; }
.subject-card .progress > span { background: var(--c); }

/* ---------- Subject page ---------- */
.subject-hero {
  border-radius: 24px; padding: 30px; display: flex; gap: 22px; align-items: center;
  background: linear-gradient(135deg, color-mix(in srgb, var(--c) 16%, var(--surface)), var(--surface));
  border: 1px solid color-mix(in srgb, var(--c) 25%, var(--border));
}
.subject-hero .subject-icon { width: 72px; height: 72px; border-radius: 20px; }
.subject-hero .subject-icon svg { width: 36px; height: 36px; }
.subject-hero-stats { margin-left: auto; display: flex; gap: 28px; text-align: center; }
.subject-hero-stats b { display: block; font-size: 24px; letter-spacing: -.03em; }
.subject-hero-stats span { font-size: 13px; color: var(--text-2); font-weight: 600; }

.lesson-row {
  display: flex; align-items: center; gap: 18px; padding: 18px 20px;
}
.lesson-num {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-weight: 800;
  background: var(--bg-soft); color: var(--text-2); flex-shrink: 0;
}
.lesson-num.done { background: var(--success); color: #fff; }
.lesson-row h3 { font-size: 16.5px; }
.lesson-row p { color: var(--text-2); font-size: 14px; margin-top: 2px; }
.lesson-row .meta { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.lesson-row .go { margin-left: auto; color: var(--muted); }
.lesson-row:hover .go { color: var(--primary); }

.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--muted); font-weight: 600; margin-bottom: 18px; flex-wrap: wrap; }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb svg { width: 14px; height: 14px; }

/* ---------- Lesson ---------- */
.lesson-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 28px; align-items: start; }
.lesson-header { margin-bottom: 26px; }
.lesson-header h1 { font-size: 32px; font-weight: 800; letter-spacing: -.035em; margin: 10px 0; }
.lesson-header .meta { display: flex; gap: 8px; flex-wrap: wrap; }
.article { padding: 34px 38px; }
.article h2 { font-size: 21px; margin: 32px 0 12px; scroll-margin-top: 90px; }
.article h2:first-child { margin-top: 0; }
.article p { color: var(--text-2); margin: 10px 0; font-size: 15.5px; line-height: 1.75; }
.article p b, .article li b { color: var(--text); }
.article ul { padding-left: 0; list-style: none; margin: 12px 0; display: grid; gap: 10px; }
.article li { position: relative; padding-left: 26px; color: var(--text-2); font-size: 15.5px; line-height: 1.7; }
.article li::before { content: ""; position: absolute; left: 6px; top: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--primary)); }
.table-wrap { overflow-x: auto; margin: 16px 0; border: 1px solid var(--border); border-radius: 14px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; background: var(--surface-2); color: var(--text); font-weight: 700; padding: 12px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 12px 14px; border-bottom: 1px solid var(--border); color: var(--text-2); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-2); }
.callout { display: flex; gap: 14px; padding: 16px 18px; border-radius: 14px; margin: 18px 0; border: 1px solid; }
.callout svg { margin-top: 2px; }
.callout-title { font-weight: 800; font-size: 14px; margin-bottom: 2px; }
.callout p { margin: 0; font-size: 14.5px; }
.callout-pearl { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 25%, transparent); }
.callout-pearl svg, .callout-pearl .callout-title { color: var(--success); }
.callout-warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.callout-warn svg, .callout-warn .callout-title { color: var(--warn); }
.callout-info { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 25%, transparent); }
.callout-info svg, .callout-info .callout-title { color: var(--info); }

.keypoints { margin-top: 24px; background: linear-gradient(135deg, var(--primary-soft), var(--surface)); }
.keypoints h3 { display: flex; align-items: center; gap: 8px; font-size: 17px; margin-bottom: 14px; }
.keypoints h3 svg { color: var(--primary); }
.keypoints ol { margin: 0; padding: 0; list-style: none; counter-reset: k; display: grid; gap: 10px; }
.keypoints li { counter-increment: k; display: flex; gap: 12px; color: var(--text-2); font-size: 14.5px; }
.keypoints li::before {
  content: counter(k); flex-shrink: 0; width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center;
  background: var(--primary); color: var(--on-primary); font-weight: 800; font-size: 12px; margin-top: 1px;
}
.lesson-cta { display: flex; align-items: center; gap: 16px; margin-top: 24px; flex-wrap: wrap; }
.lesson-cta .text { flex: 1; min-width: 220px; }
.lesson-cta h3 { font-size: 17px; }
.lesson-cta p { color: var(--text-2); font-size: 14px; }
.lesson-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 18px; }
.lesson-nav a { padding: 16px 18px; }
.lesson-nav small { color: var(--muted); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.lesson-nav b { display: block; margin-top: 2px; font-size: 14.5px; }
.lesson-nav .next { text-align: right; }

.toc { position: sticky; top: 92px; display: grid; gap: 16px; }
.toc-card h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 12px; }
.toc-card a { display: block; padding: 7px 12px; border-left: 2px solid var(--border); color: var(--text-2); font-size: 14px; font-weight: 600; }
.toc-card a:hover, .toc-card a.active { color: var(--primary); border-color: var(--primary); }
.reading-bar { position: fixed; top: 0; left: var(--sidebar-w); right: 0; height: 3px; z-index: 40; background: transparent; }
.reading-bar span { display: block; height: 100%; width: 0; background: var(--grad); }

/* ---------- Quiz setup ---------- */
.setup-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 22px; align-items: start; }
.setup-step h3 { font-size: 16px; margin-bottom: 12px; display: flex; align-items: center; gap: 10px; }
.step-n { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); font-size: 13px; font-weight: 800; }
.setup-step + .setup-step { margin-top: 26px; }
.option-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.pick {
  display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 14px;
  border: 1.5px solid var(--border); background: var(--surface); text-align: left; transition: border-color .15s, background .15s, transform .1s;
}
.pick:hover { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); }
.pick.selected { border-color: var(--primary); background: var(--primary-soft); }
.pick .subject-icon { width: 36px; height: 36px; border-radius: 10px; }
.pick .subject-icon svg { width: 18px; height: 18px; }
.pick b { display: block; font-size: 14px; }
.pick small { color: var(--muted); font-size: 12px; font-weight: 600; }
.mode-pick { flex-direction: column; align-items: flex-start; gap: 8px; padding: 18px; }
.mode-pick .mode-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--bg-soft); color: var(--primary); }
.mode-pick.selected .mode-icon { background: var(--primary); color: var(--on-primary); }
.mode-pick p { font-size: 13px; color: var(--text-2); }
.seg { display: inline-flex; background: var(--bg-soft); border-radius: 12px; padding: 4px; gap: 4px; flex-wrap: wrap; }
.seg button { padding: 8px 16px; border-radius: 9px; font-weight: 700; font-size: 14px; color: var(--text-2); }
.seg button.selected { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm); }
.summary-card { position: sticky; top: 92px; }
.summary-card h3 { font-size: 17px; margin-bottom: 14px; }
.summary-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px dashed var(--border); font-size: 14px; }
.summary-row span { color: var(--text-2); }
.summary-row:last-of-type { border-bottom: 0; margin-bottom: 14px; }

/* ---------- Quiz runner ---------- */
.quiz-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 22px; align-items: start; }
.quiz-top { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.quiz-top .progress { flex: 1; height: 10px; }
.quiz-top .progress > span { background: var(--grad); }
.timer { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-variant-numeric: tabular-nums; padding: 8px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.timer.low { color: var(--danger); border-color: var(--danger); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.question-card { padding: 30px; }
.q-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.q-meta .spacer { flex: 1; }
.q-text { font-size: 17.5px; font-weight: 600; line-height: 1.65; margin-bottom: 22px; }
.answers { display: grid; gap: 10px; }
.answer {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 14px; text-align: left;
  border: 1.5px solid var(--border); background: var(--surface); transition: border-color .15s, background .15s, transform .1s; width: 100%;
}
.answer:hover:not(.locked) { border-color: var(--primary); background: var(--primary-soft); }
.answer .letter {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-size: 14px;
  background: var(--bg-soft); color: var(--text-2); flex-shrink: 0; transition: background .15s, color .15s;
}
.answer .txt { flex: 1; font-size: 15px; }
.answer.selected { border-color: var(--primary); background: var(--primary-soft); }
.answer.selected .letter { background: var(--primary); color: var(--on-primary); }
.answer.correct { border-color: var(--success); background: var(--success-soft); }
.answer.correct .letter { background: var(--success); color: #fff; }
.answer.wrong { border-color: var(--danger); background: var(--danger-soft); }
.answer.wrong .letter { background: var(--danger); color: #fff; }
.answer.locked { cursor: default; }
.answer .mark svg { width: 20px; height: 20px; }
.answer.correct .mark { color: var(--success); }
.answer.wrong .mark { color: var(--danger); }
.explain { margin-top: 20px; padding: 18px 20px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); animation: fadeUp .3s ease both; }
.explain-head { display: flex; align-items: center; gap: 8px; font-weight: 800; margin-bottom: 6px; }
.explain-head.ok { color: var(--success); }
.explain-head.no { color: var(--danger); }
.explain p { color: var(--text-2); font-size: 14.5px; line-height: 1.7; }
.quiz-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.nav-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.nav-dot {
  aspect-ratio: 1; border-radius: 10px; font-weight: 700; font-size: 13px; background: var(--bg-soft); color: var(--text-2);
  border: 1.5px solid transparent; position: relative;
}
.nav-dot.answered { background: var(--primary-soft); color: var(--primary); }
.nav-dot.current { border-color: var(--primary); }
.nav-dot.ok { background: var(--success-soft); color: var(--success); }
.nav-dot.no { background: var(--danger-soft); color: var(--danger); }
.nav-dot.flag::after { content: ""; position: absolute; top: 4px; right: 4px; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); }
.legend { display: grid; gap: 6px; margin-top: 14px; font-size: 12.5px; color: var(--text-2); }
.legend span { display: flex; align-items: center; gap: 8px; }
.legend i { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
.icon-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--text-2); padding: 6px 10px; border-radius: 10px; }
.icon-toggle:hover { background: var(--bg-soft); }
.icon-toggle.on { color: var(--warn); }
.icon-toggle svg { width: 16px; height: 16px; }

/* ---------- Results ---------- */
.result-hero { display: grid; grid-template-columns: auto 1fr; gap: 32px; align-items: center; padding: 32px; }
.ring { --p: 0; --c: var(--primary); width: 168px; height: 168px; border-radius: 50%; display: grid; place-items: center; position: relative;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--bg-soft) 0); transition: --p 1s; }
.ring::before { content: ""; position: absolute; inset: 14px; border-radius: 50%; background: var(--surface); }
.ring-inner { position: relative; text-align: center; }
.ring-inner b { display: block; font-size: 40px; font-weight: 800; letter-spacing: -.04em; line-height: 1; }
.ring-inner span { font-size: 13px; color: var(--text-2); font-weight: 600; }
.result-hero h1 { font-size: 28px; font-weight: 800; letter-spacing: -.03em; }
.result-hero > div > p { color: var(--text-2); margin: 6px 0 18px; }
.result-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.result-stats div { background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; }
.result-stats b { display: block; font-size: 20px; letter-spacing: -.02em; }
.result-stats span { font-size: 12.5px; color: var(--text-2); font-weight: 600; }
.review-item { padding: 20px 22px; }
.review-item + .review-item { margin-top: 12px; }
.review-q { display: flex; gap: 12px; }
.review-q .n { width: 30px; height: 30px; flex-shrink: 0; border-radius: 9px; display: grid; place-items: center; font-weight: 800; font-size: 13px; }
.review-q .n.ok { background: var(--success-soft); color: var(--success); }
.review-q .n.no { background: var(--danger-soft); color: var(--danger); }
.review-q p { font-weight: 600; }
.review-ans { margin: 12px 0 0 42px; display: grid; gap: 6px; font-size: 14px; }
.review-ans div { display: flex; gap: 8px; align-items: flex-start; }
.review-ans svg { width: 17px; height: 17px; margin-top: 2px; }
.review-ans .ok { color: var(--success); }
.review-ans .no { color: var(--danger); }
.review-ans details { margin-top: 6px; }
.review-ans summary { cursor: pointer; color: var(--primary); font-weight: 700; font-size: 13.5px; }
.review-ans details p { color: var(--text-2); margin-top: 8px; line-height: 1.7; }
.filter-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 100; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); opacity: .8; } }

/* ---------- Flashcards ---------- */
.flash-stage { max-width: 640px; margin: 0 auto; }
.flash-top { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.flash-top .progress { flex: 1; }
.flashcard { perspective: 1400px; height: 340px; cursor: pointer; outline: none; }
.flash-inner { position: relative; width: 100%; height: 100%; transition: transform .6s cubic-bezier(.2,.8,.2,1); transform-style: preserve-3d; }
.flashcard.flipped .flash-inner { transform: rotateY(180deg); }
.flash-face {
  position: absolute; inset: 0; border-radius: 26px; padding: 34px; display: flex; flex-direction: column;
  justify-content: center; align-items: center; text-align: center; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border: 1px solid var(--border); box-shadow: var(--shadow);
}
.flash-front { background: var(--surface); }
.flash-back { transform: rotateY(180deg); background: var(--grad); color: #fff; border: 0; }
.flash-face .tag { position: absolute; top: 20px; left: 22px; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; opacity: .7; }
.flash-face .hint { position: absolute; bottom: 18px; font-size: 12.5px; opacity: .6; display: flex; gap: 6px; align-items: center; }
.flash-face .hint svg { width: 14px; height: 14px; }
.flash-face h2 { font-size: 24px; font-weight: 700; line-height: 1.4; }
.flash-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 20px; }
.flash-actions .btn { padding: 15px; }
.btn-again { background: var(--danger-soft); color: var(--danger); }
.btn-know { background: var(--success-soft); color: var(--success); }
.kbd { display: inline-block; padding: 1px 7px; border-radius: 6px; background: var(--bg-soft); border: 1px solid var(--border); font-size: 12px; font-weight: 700; color: var(--text-2); }

/* ---------- Progress ---------- */
.bars { display: flex; align-items: flex-end; gap: 10px; height: 180px; padding-top: 10px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar i { width: 100%; max-width: 42px; border-radius: 10px 10px 4px 4px; background: var(--grad); min-height: 4px; transition: height .8s cubic-bezier(.2,.8,.2,1); position: relative; }
.bar b { font-size: 12px; color: var(--text-2); }
.bar small { font-size: 11px; color: var(--muted); font-weight: 600; }
.subject-progress { display: flex; align-items: center; gap: 14px; padding: 12px 0; }
.subject-progress + .subject-progress { border-top: 1px solid var(--border); }
.subject-progress .info { flex: 1; min-width: 0; }
.subject-progress .top { display: flex; justify-content: space-between; font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.subject-progress .top span { color: var(--text-2); font-weight: 600; font-size: 13px; }
.subject-progress .subject-icon { width: 38px; height: 38px; border-radius: 11px; }
.subject-progress .subject-icon svg { width: 19px; height: 19px; }
.subject-progress .progress > span { background: var(--c); }
.level-card { display: flex; align-items: center; gap: 20px; }
.level-badge { width: 76px; height: 76px; border-radius: 22px; background: var(--grad); color: #fff; display: grid; place-items: center; text-align: center; flex-shrink: 0; box-shadow: 0 12px 24px -10px var(--glow); }
.level-badge b { font-size: 28px; line-height: 1; display: block; }
.level-badge span { font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; opacity: .85; }
.history-table td:first-child { white-space: nowrap; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; margin-top: 14px; }
.week div { text-align: center; font-size: 12px; color: var(--muted); font-weight: 700; }
.week i { display: grid; place-items: center; height: 36px; border-radius: 10px; background: var(--bg-soft); margin-top: 6px; }
.week i.on { background: linear-gradient(135deg, #fb923c, #f43f5e); color: #fff; }
.week i svg { width: 16px; height: 16px; }

/* ---------- Empty / search ---------- */
.empty { text-align: center; padding: 48px 20px; color: var(--text-2); }
.empty .em-icon { width: 64px; height: 64px; border-radius: 20px; margin: 0 auto 14px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.empty .em-icon svg { width: 30px; height: 30px; }
.empty h3 { color: var(--text); margin-bottom: 6px; }
.result-item { display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; }
.result-item .subject-icon { width: 40px; height: 40px; border-radius: 12px; }
.result-item .subject-icon svg { width: 20px; height: 20px; }
.result-item h4 { font-size: 15px; }
.result-item p { font-size: 13.5px; color: var(--text-2); margin-top: 3px; }
mark { background: color-mix(in srgb, #facc15 45%, transparent); color: inherit; border-radius: 3px; padding: 0 2px; }

/* ---------- Daily challenge ---------- */
.daily { display: flex; align-items: center; gap: 20px; background: linear-gradient(135deg, color-mix(in srgb, #f97316 14%, var(--surface)), var(--surface)); border-color: color-mix(in srgb, #f97316 30%, var(--border)); }
.daily .d-icon { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: linear-gradient(135deg, #fb923c, #f43f5e); color: #fff; flex-shrink: 0; }
.daily .d-icon svg { width: 28px; height: 28px; }
.daily h3 { font-size: 17px; }
.daily p { font-size: 14px; color: var(--text-2); }
.daily .text { flex: 1; }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 10px; z-index: 200; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 14px; background: var(--text); color: var(--bg);
  font-weight: 600; font-size: 14px; box-shadow: var(--shadow-lg); animation: toastIn .3s ease both;
}
.toast svg { width: 18px; height: 18px; color: #facc15; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px) scale(.96); } }

/* ---------- Bottom nav (mobile) ---------- */
.bottom-nav { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lesson-layout, .quiz-layout, .setup-grid { grid-template-columns: minmax(0, 1fr); }
  .toc { display: none; }
  .summary-card { position: static; }
  .quiz-side { order: -1; }
  .quiz-side .nav-grid { grid-template-columns: repeat(10, 1fr); }
  .quiz-side .legend { display: none; }
}
@media (max-width: 860px) {
  .sidebar { display: none; }
  .main { margin-left: 0; }
  .reading-bar { left: 0; }
  .topbar { padding: 12px 16px; }
  .view { padding: 20px 16px 110px; }
  .hero { grid-template-columns: 1fr; padding: 26px 22px; }
  .hero h1 { font-size: 27px; }
  .subject-hero { flex-wrap: wrap; padding: 22px; }
  .subject-hero-stats { margin-left: 0; width: 100%; justify-content: space-around; }
  .result-hero { grid-template-columns: 1fr; justify-items: center; text-align: center; padding: 24px; }
  .result-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .article { padding: 22px 18px; }
  .lesson-header h1 { font-size: 25px; }
  .page-title { font-size: 25px; }
  .question-card { padding: 20px 18px; }
  .q-text { font-size: 16px; }
  .chip-xp { display: none; }
  .toast-wrap { bottom: 84px; left: 16px; right: 16px; }
  .bottom-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
    background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--border); padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  }
  .bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 700; color: var(--muted); padding: 6px 0; border-radius: 10px; }
  .bottom-nav a.active { color: var(--primary); }
}
@media (max-width: 560px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .grid-4.stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { flex-direction: column; align-items: flex-start; gap: 10px; }
  .lesson-nav { grid-template-columns: 1fr; }
  .lesson-row { padding: 16px; gap: 14px; }
  .lesson-row .go { display: none; }
  .daily { flex-wrap: wrap; }
  .flashcard { height: 300px; }
  .flash-face h2 { font-size: 20px; }
  .quiz-side .nav-grid { grid-template-columns: repeat(6, 1fr); }
  .search input::placeholder { font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* =================== Auth =================== */
body.is-auth .app, body.is-auth .bottom-nav { display: none; }
#auth:empty { display: none; }
.boot { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.spinner { width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--bg-soft); border-top-color: var(--primary); animation: spin .8s linear infinite; margin: 0 auto 12px; }
@keyframes spin { to { transform: rotate(360deg); } }
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-brand { position: relative; overflow: hidden; background: var(--grad); color: #fff; padding: 40px 48px; display: flex; flex-direction: column; }
.auth-brand::before, .auth-brand::after { content: ""; position: absolute; border-radius: 50%; background: rgba(255,255,255,.09); }
.auth-brand::before { width: 520px; height: 520px; right: -200px; top: -160px; }
.auth-brand::after { width: 300px; height: 300px; left: -120px; bottom: -120px; }
.auth-brand > * { position: relative; z-index: 1; }
.auth-brand .brand { padding: 0; }
.auth-brand .brand-mark { background: rgba(255,255,255,.18); box-shadow: none; }
.auth-brand-body { margin: auto 0; max-width: 520px; padding: 40px 0; }
.auth-brand h1 { font-size: 38px; font-weight: 800; letter-spacing: -.035em; line-height: 1.15; }
.auth-features { list-style: none; padding: 0; margin: 32px 0 0; display: grid; gap: 14px; }
.auth-features li { display: flex; gap: 14px; align-items: flex-start; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.18); border-radius: 16px; padding: 14px 16px; backdrop-filter: blur(6px); }
.auth-features svg { width: 22px; height: 22px; margin-top: 2px; }
.auth-features b { display: block; font-size: 15px; }
.auth-features span { font-size: 13.5px; opacity: .9; }
.auth-foot { font-size: 13px; opacity: .75; }
.auth-panel { display: grid; place-items: center; padding: 40px 24px; background: var(--bg); }
.auth-card { width: 100%; max-width: 420px; animation: fadeUp .35s ease both; }
.auth-card h2 { font-size: 26px; font-weight: 800; margin-top: 28px; }
.auth-card > .muted { margin: 6px 0 22px; font-size: 14.5px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--bg-soft); padding: 5px; border-radius: 14px; }
.auth-tabs button { padding: 10px; border-radius: 10px; font-weight: 700; color: var(--text-2); }
.auth-tabs button.selected { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm); }
.auth-switch { text-align: center; margin-top: 20px; font-size: 14px; color: var(--text-2); }
.auth-switch a { color: var(--primary); font-weight: 700; }
#authForm { display: grid; gap: 16px; }
.field { display: grid; gap: 7px; }
.field > span { font-size: 13.5px; font-weight: 700; color: var(--text); }
.input { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1.5px solid var(--border); border-radius: 12px; padding: 0 14px; transition: border-color .15s, box-shadow .15s; }
.input:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.input > svg { color: var(--muted); width: 18px; height: 18px; }
.input input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; color: var(--text); padding: 12px 0; }
.pw-toggle { color: var(--muted); display: grid; place-items: center; padding: 4px; }
.pw-toggle:hover { color: var(--primary); }
.pw-toggle svg { width: 18px; height: 18px; }
.form-error { background: var(--danger-soft); color: var(--danger); border-radius: 12px; padding: 10px 14px; font-size: 14px; font-weight: 600; }

/* =================== User menu =================== */
.user-menu { position: relative; }
.avatar-btn { display: flex; align-items: center; gap: 10px; padding: 4px 12px 4px 4px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); }
.avatar-btn:hover { border-color: var(--primary); }
.avatar { width: 32px; height: 32px; border-radius: 10px; background: var(--grad); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 13px; flex-shrink: 0; }
.avatar.sm { width: 34px; height: 34px; }
.avatar.lg { width: 60px; height: 60px; border-radius: 18px; font-size: 22px; }
.avatar-text { display: grid; text-align: left; line-height: 1.2; }
.avatar-text b { font-size: 13.5px; }
.avatar-text small { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); width: 260px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 8px; z-index: 50; animation: fadeUp .18s ease both; }
.menu-head { padding: 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; display: grid; }
.menu-head small { color: var(--muted); font-size: 12.5px; word-break: break-all; }
.menu-head .badge { justify-self: start; }
.menu a, .menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 10px; font-weight: 600; font-size: 14px; color: var(--text-2); text-align: left; }
.menu a:hover, .menu button:hover { background: var(--bg-soft); color: var(--text); }
.menu svg { width: 18px; height: 18px; }
#logoutBtn:hover { color: var(--danger); }
.nav-label { font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); padding: 0 14px 6px; }

/* =================== Forms =================== */
.form { display: grid; gap: 16px; }
.form h3 { font-size: 17px; }
.control { width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1.5px solid var(--border); border-radius: 12px; padding: 11px 14px; outline: none; transition: border-color .15s, box-shadow .15s; }
.control:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.control:disabled { background: var(--bg-soft); color: var(--muted); }
textarea.control { resize: vertical; line-height: 1.6; }
select.control { cursor: pointer; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row.three { grid-template-columns: 1fr 1.4fr .8fr; }
.opt-edit { display: grid; gap: 8px; }
.opt-row { display: flex; align-items: center; gap: 10px; }
.opt-row input[type="radio"] { width: 18px; height: 18px; accent-color: var(--success); cursor: pointer; flex-shrink: 0; }
.opt-row .letter { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--bg-soft); font-weight: 800; font-size: 13px; color: var(--text-2); flex-shrink: 0; }
.opt-row:has(input[type="radio"]:checked) .letter { background: var(--success); color: #fff; }
.opt-row:has(input[type="radio"]:checked) .control { border-color: var(--success); }

/* =================== Modal =================== */
.modal-backdrop { position: fixed; inset: 0; z-index: 150; background: rgba(15, 23, 42, .5); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 16px; animation: fade .2s ease both; }
@keyframes fade { from { opacity: 0; } }
.modal { width: 100%; max-width: 520px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 22px; box-shadow: var(--shadow-lg); animation: fadeUp .25s ease both; }
.modal-wide { max-width: 760px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 18px; }
.modal-head .icon-btn { width: 36px; height: 36px; }
.modal-body { padding: 22px; overflow-y: auto; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; flex-wrap: wrap; }
.modal-actions.spread { justify-content: space-between; margin-top: 20px; }
.btn-danger-ghost { background: var(--danger-soft); color: var(--danger); }
.btn-danger-ghost:hover { background: var(--danger); color: #fff; }
.detail-head { display: flex; gap: 16px; align-items: center; }
.detail-head h3 { font-size: 19px; }
.mini-title { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 6px; }

/* =================== Admin =================== */
.admin-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.tool-search { max-width: 420px; }
.admin-table td { vertical-align: middle; }
.admin-table td.actions { text-align: right; }
.user-cell { display: flex; align-items: center; gap: 12px; min-width: 220px; }
.user-cell b { display: block; color: var(--text); font-size: 14px; }
.user-cell small { color: var(--muted); font-size: 12.5px; }
.admin-item { display: flex; gap: 16px; align-items: flex-start; padding: 18px 20px; }
.admin-item-main { flex: 1; min-width: 0; }
.admin-q { font-weight: 600; font-size: 14.5px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.admin-item-actions { display: flex; gap: 8px; flex-shrink: 0; }
.mini-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.mini-row + .mini-row { border-top: 1px solid var(--border); }
.mini-info { flex: 1; min-width: 0; display: grid; }
.mini-info b { font-size: 14px; }
.mini-info small { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-weight: 800; font-size: 13px; background: var(--bg-soft); color: var(--text-2); }
.rank.r1 { background: linear-gradient(135deg, #fde047, #f59e0b); color: #fff; }
.rank.r2 { background: linear-gradient(135deg, #e2e8f0, #94a3b8); color: #fff; }
.rank.r3 { background: linear-gradient(135deg, #fdba74, #c2410c); color: #fff; }
.card h3 > svg { vertical-align: -4px; color: #eab308; }
code { background: var(--bg-soft); padding: 2px 6px; border-radius: 6px; font-size: 13px; }

@media (max-width: 960px) {
  .auth { grid-template-columns: 1fr; }
  .auth-brand { padding: 28px 22px; }
  .auth-brand-body { padding: 24px 0 8px; }
  .auth-brand h1 { font-size: 26px; }
  .auth-features, .auth-foot { display: none; }
}
@media (max-width: 860px) {
  .avatar-text { display: none; }
  .avatar-btn { padding: 4px; }
  .form-row, .form-row.three { grid-template-columns: 1fr; }
  .admin-item { flex-direction: column; }
  .modal-body { padding: 18px; }
}

/* =================== Editor materi =================== */
.subject-block { padding: 18px 20px; }
.subject-block-head { display: flex; align-items: center; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.subject-block-head .subject-icon { width: 40px; height: 40px; border-radius: 12px; }
.subject-block-head .subject-icon svg { width: 20px; height: 20px; }
.subject-block-head h3 { font-size: 16.5px; }
.lesson-admin-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; }
.lesson-admin-row + .lesson-admin-row { border-top: 1px dashed var(--border); }
.lesson-admin-row .lesson-num { width: 32px; height: 32px; font-size: 13px; }
.lesson-admin-info { flex: 1; min-width: 0; }
.lesson-admin-info b { display: block; font-size: 14.5px; }
.lesson-admin-info .meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.order-btns { display: flex; flex-direction: column; gap: 2px; }
.icon-btn.sm { width: 30px; height: 30px; border-radius: 9px; }
.icon-btn.sm svg { width: 15px; height: 15px; }
.order-btns .icon-btn svg, .block-tools .icon-btn:nth-child(-n+2) svg { transform: rotate(90deg); }
.icon-btn[disabled] { opacity: .35; pointer-events: none; }
.icon-btn.danger:hover { color: var(--danger); border-color: var(--danger); }

.editor-tabs { display: none; }
.editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .9fr); gap: 22px; align-items: start; padding-bottom: 90px; }
.editor-preview { position: sticky; top: 86px; max-height: calc(100vh - 110px); overflow-y: auto; padding: 16px; border-radius: var(--radius); background: var(--bg-soft); border: 1px dashed var(--border); }
.editor-preview .article { padding: 22px; }
.editor-preview .lesson-header h1 { font-size: 24px; }
.preview-label { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 12px; }
.preview-label svg { width: 15px; height: 15px; }
.inline-input { display: flex; gap: 8px; }
.switch { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; padding: 12px 14px; border: 1.5px solid var(--border); border-radius: 12px; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-ui { width: 42px; height: 24px; border-radius: 99px; background: var(--border); position: relative; flex-shrink: 0; transition: background .2s; margin-top: 2px; }
.switch-ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .2s; }
.switch input:checked + .switch-ui { background: var(--success); }
.switch input:checked + .switch-ui::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-ui { box-shadow: 0 0 0 4px var(--primary-soft); }
.switch b { display: block; font-size: 14px; }
.switch small { color: var(--muted); font-size: 12.5px; }

.blocks { display: grid; gap: 12px; }
.block-card { border: 1.5px solid var(--border); border-radius: 14px; background: var(--surface-2); transition: border-color .2s, box-shadow .2s; }
.block-card:focus-within { border-color: color-mix(in srgb, var(--primary) 50%, var(--border)); box-shadow: 0 0 0 4px var(--primary-soft); }
.block-card.flash { animation: flashIn 1s ease; }
@keyframes flashIn { 0% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--primary) 35%, transparent); } }
.block-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px 8px 14px; border-bottom: 1px solid var(--border); }
.block-type { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); }
.block-type svg { width: 15px; height: 15px; color: var(--primary); }
.block-tools { display: flex; gap: 4px; }
.block-body { padding: 12px 14px; display: grid; gap: 8px; }
.block-body textarea.control { min-height: 44px; }
.block-insert { display: none; gap: 6px; flex-wrap: wrap; padding: 0 14px 12px; }
.block-card:focus-within .block-insert, .block-card:hover .block-insert { display: flex; }
.block-insert button { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; color: var(--muted); padding: 4px 8px; border-radius: 8px; border: 1px dashed var(--border); }
.block-insert button:hover { color: var(--primary); border-color: var(--primary); }
.block-insert svg { width: 13px; height: 13px; }
.fmt-bar { display: flex; gap: 4px; }
.fmt-bar button { min-width: 32px; height: 28px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); font-size: 13px; color: var(--text-2); }
.fmt-bar button:hover { color: var(--primary); border-color: var(--primary); }
.add-block { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--border); }
.add-block > span { font-size: 13px; font-weight: 700; color: var(--muted); }
.table-edit { overflow-x: auto; }
.table-edit table { border-collapse: separate; border-spacing: 4px; font-size: 13.5px; }
.table-edit th, .table-edit td { padding: 0; border: 0; background: none !important; min-width: 130px; }
.table-edit .tight { min-width: 0; width: 30px; vertical-align: middle; }
.table-edit .control { padding: 8px 10px; border-radius: 9px; font-size: 13.5px; }
.table-edit th .control { font-weight: 700; background: var(--bg-soft); }
.table-edit textarea.control { resize: vertical; min-height: 38px; }
.cell-head { display: flex; gap: 4px; align-items: center; }
.cell-x { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); flex-shrink: 0; }
.cell-x:hover { background: var(--danger-soft); color: var(--danger); }
.cell-x svg { width: 14px; height: 14px; }
.table-edit-actions { display: flex; gap: 8px; }
.kp-list { display: grid; gap: 8px; }
.kp-row { display: flex; align-items: center; gap: 10px; }
.kp-n { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--primary); color: var(--on-primary); font-weight: 800; font-size: 12px; flex-shrink: 0; }
.save-bar { position: fixed; left: var(--sidebar-w); right: 0; bottom: 0; z-index: 25; display: flex; align-items: center; gap: 12px; padding: 12px 32px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--border); }
.save-state { font-size: 13.5px; font-weight: 700; color: var(--success); display: inline-flex; align-items: center; gap: 8px; }
.save-state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.save-state.dirty { color: var(--warn); }

@media (max-width: 1100px) {
  .editor-tabs { display: inline-flex; }
  .editor-tabs button { display: inline-flex; align-items: center; gap: 6px; }
  .editor-tabs svg { width: 16px; height: 16px; }
  .editor-layout { grid-template-columns: minmax(0, 1fr); }
  .editor-preview { display: none; position: static; max-height: none; }
  .editor-layout.show-preview .editor-main { display: none; }
  .editor-layout.show-preview .editor-preview { display: block; }
}
@media (max-width: 860px) {
  .save-bar { left: 0; bottom: calc(58px + env(safe-area-inset-bottom)); padding: 10px 16px; }
  .save-bar .btn { padding: 10px 14px; }
  .lesson-admin-row { flex-wrap: wrap; }
  .lesson-admin-row .admin-item-actions { width: 100%; justify-content: flex-end; }
  .block-insert { display: flex; }
}

/* =================== Brand: Sanatio Vitalis =================== */
.brand { gap: 12px; }
.brand-mark { width: 44px; height: 44px; border-radius: 50%; background: #fff; padding: 0; overflow: hidden; box-shadow: 0 6px 16px -6px rgba(15, 23, 42, .45), 0 0 0 1px var(--border); }
.brand-mark img { width: 100%; height: 100%; object-fit: cover; display: block; }
.brand-text { display: grid; line-height: 1.1; }
.brand-name { font-family: "Cinzel", Georgia, "Times New Roman", serif; font-weight: 700; font-size: 17px; letter-spacing: .02em; }
.brand-text small { font-size: 11.5px; color: var(--muted); font-weight: 600; margin-top: 3px; }
.auth-logo-wrap { display: flex; align-items: center; gap: 18px; }
.auth-logo { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; background: #fff; box-shadow: 0 0 0 4px rgba(255,255,255,.35), 0 18px 40px -12px rgba(0,0,0,.45); flex-shrink: 0; }
.auth-wordmark { font-family: "Cinzel", Georgia, serif; font-weight: 700; font-size: 26px; letter-spacing: .03em; line-height: 1.1; }
.auth-tagline { font-family: "Dancing Script", cursive; font-size: 21px; opacity: .92; margin-top: 4px; }
@media (min-width: 961px) { .auth-logo { width: 120px; height: 120px; } .auth-wordmark { font-size: 30px; } }
@media (max-width: 960px) { .auth-logo { width: 72px; height: 72px; } .auth-wordmark { font-size: 21px; } .auth-tagline { font-size: 18px; } }

/* =================== Aksen hitam-perak =================== */
/* Pola titik halftone seperti latar logo */
.hero, .auth-brand, .sidebar-card, .flash-back { background-image: var(--dots), var(--grad); background-size: 14px 14px, auto; }
.hero, .auth-brand { border: 1px solid rgba(255,255,255,.06); }
.sidebar-card { border: 1px solid rgba(255,255,255,.08); }
/* Garis tipis berkilau perak di tepi atas panel gelap */
.hero::before, .auth-brand::before { background: radial-gradient(circle, rgba(255,255,255,.14), rgba(255,255,255,0) 70%); }
.btn-grad:hover { filter: brightness(1.15); }
.brand-mark, .auth-logo { box-shadow: 0 0 0 2px #fff, 0 0 0 3px #a1a1aa, 0 8px 20px -8px rgba(0,0,0,.55); }
.auth-logo { box-shadow: 0 0 0 4px rgba(255,255,255,.85), 0 0 0 6px rgba(161,161,170,.6), 0 18px 40px -12px rgba(0,0,0,.6); }
.level-badge { background-image: var(--dots), var(--grad); background-size: 10px 10px, auto; border: 1px solid rgba(255,255,255,.1); }
.page-title, .hero h1, .lesson-header h1, .auth-brand h1 { letter-spacing: -.03em; }
.d-icon { box-shadow: inset 0 1px 0 rgba(255,255,255,.15); }
.d-icon.mono { background: var(--grad); }
.daily.mono { background: linear-gradient(135deg, color-mix(in srgb, #a1a1aa 16%, var(--surface)), var(--surface)); border-color: color-mix(in srgb, #71717a 28%, var(--border)); }
/* Ikon abu-abu tetap terbaca di mode gelap */
:root[data-theme="dark"] .stat-icon, :root[data-theme="dark"] .subject-icon { color: color-mix(in srgb, var(--c) 60%, var(--text)); background: color-mix(in srgb, var(--c) 22%, transparent); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .stat-icon, :root:not([data-theme="light"]) .subject-icon { color: color-mix(in srgb, var(--c) 60%, var(--text)); background: color-mix(in srgb, var(--c) 22%, transparent); }
}
/* Avatar perak di mode gelap */
:root[data-theme="dark"] .avatar { background: var(--sheen); color: #121214; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .avatar { background: var(--sheen); color: #121214; } }

/* =================== Kredit & Tentang =================== */
.auth-credits { margin-top: 28px; padding-top: 18px; border-top: 1px dashed var(--border); text-align: center; }
.auth-credits span { font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.auth-credits p { font-size: 13px; color: var(--text-2); margin-top: 6px; line-height: 1.7; }
.app-footer { max-width: 1240px; margin: 0 auto; padding: 0 32px 36px; }
.footer-inner { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; padding: 18px 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.footer-brand { display: flex; align-items: center; gap: 10px; }
.footer-brand img { width: 32px; height: 32px; border-radius: 50%; box-shadow: 0 0 0 1px var(--border); }
.footer-brand b { display: block; font-family: "Cinzel", Georgia, serif; font-size: 14px; }
.footer-brand small { font-family: "Dancing Script", cursive; font-size: 15px; color: var(--text-2); }
.footer-credits { flex: 1; min-width: 240px; font-size: 13.5px; color: var(--text-2); }
.footer-credits span { font-weight: 800; color: var(--text); }
.footer-copy { font-size: 12.5px; color: var(--muted); text-align: center; margin-top: 12px; }
body.is-auth .app-footer { display: none; }
.about-hero { display: flex; gap: 32px; align-items: center; padding: 34px; border-radius: 26px; color: #fff; background-image: var(--dots), var(--grad); background-size: 14px 14px, auto; box-shadow: var(--shadow-lg); border: 1px solid rgba(255,255,255,.06); }
.about-hero img { width: 150px; height: 150px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 0 0 4px rgba(255,255,255,.85), 0 0 0 6px rgba(161,161,170,.6), 0 18px 40px -12px rgba(0,0,0,.6); }
.about-hero h1 { font-family: "Cinzel", Georgia, serif; font-size: 36px; font-weight: 700; letter-spacing: .02em; margin-top: 12px; }
.about-tagline { font-family: "Dancing Script", cursive; font-size: 24px; opacity: .92; margin: 2px 0 12px; }
.about-hero p:last-child { opacity: .88; max-width: 620px; }
.team-card { text-align: center; padding: 28px 20px; animation: fadeUp .4s ease backwards; }
.team-avatar { width: 72px; height: 72px; margin: 0 auto 14px; border-radius: 50%; display: grid; place-items: center; font-family: "Cinzel", Georgia, serif; font-weight: 700; font-size: 24px; color: #fff; background-image: var(--dots), var(--grad); background-size: 8px 8px, auto; box-shadow: 0 0 0 3px var(--surface), 0 0 0 4px #a1a1aa, 0 10px 22px -10px rgba(0,0,0,.55); }
.team-card h3 { font-size: 16.5px; }
.team-card p { font-size: 13px; color: var(--muted); margin-top: 4px; font-weight: 600; }
@media (max-width: 860px) {
  .app-footer { padding: 0 16px 110px; }
  .view { padding-bottom: 28px; }
  .about-hero { flex-direction: column; text-align: center; padding: 26px 20px; }
  .about-hero img { width: 112px; height: 112px; }
  .about-hero h1 { font-size: 27px; }
}
@media (max-width: 480px) {
  .auth-logo { width: 64px; height: 64px; }
  .auth-logo-wrap { gap: 14px; }
  .auth-wordmark { font-size: 19px; }
  .auth-tagline { font-size: 15.5px; }
}

/* =================== Blok kuliah =================== */
.badge-block { background: var(--primary-soft); color: var(--primary); }
a.badge-block:hover { background: var(--primary); color: var(--on-primary); }
.badge-soon { background: var(--bg-soft); color: var(--muted); align-self: flex-start; }
.block-card { display: flex; flex-direction: column; gap: 10px; position: relative; overflow: hidden; }
.block-card::after { content: ""; position: absolute; right: -40px; top: -40px; width: 120px; height: 120px; border-radius: 50%; background-image: radial-gradient(color-mix(in srgb, var(--text) 12%, transparent) 1.1px, transparent 1.4px); background-size: 9px 9px; opacity: .7; pointer-events: none; }
.block-card-top { display: flex; align-items: center; justify-content: space-between; }
.block-num { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-family: "Cinzel", Georgia, serif; font-weight: 700; font-size: 19px; color: #fff; background-image: var(--dots), var(--grad); background-size: 7px 7px, auto; box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px #a1a1aa; }
.block-card h3 { font-size: 17px; }
.block-card p { color: var(--text-2); font-size: 13.5px; flex: 1; }
.block-card .row { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-2); font-weight: 600; }
.block-card .progress > span { background: var(--primary); }
.block-card.is-empty { background: var(--surface-2); }
.block-card.is-empty .block-num { opacity: .55; }
.block-card.is-empty h3 { color: var(--text-2); }
.block-hero { display: flex; align-items: center; gap: 26px; padding: 30px; border-radius: 26px; color: #fff; background-image: var(--dots), var(--grad); background-size: 14px 14px, auto; box-shadow: var(--shadow-lg); border: 1px solid rgba(255,255,255,.06); }
.block-hero-num { width: 92px; height: 92px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center; font-family: "Cinzel", Georgia, serif; font-weight: 700; font-size: 44px; background: var(--sheen); color: #121214; box-shadow: 0 0 0 4px rgba(255,255,255,.25), 0 14px 30px -12px rgba(0,0,0,.6); }
.block-hero h1 { font-family: "Cinzel", Georgia, serif; font-size: 32px; font-weight: 700; letter-spacing: .02em; margin: 10px 0 6px; }
.block-hero p { opacity: .88; max-width: 560px; }
.block-hero-stats { margin-left: auto; display: flex; gap: 26px; text-align: center; }
.block-hero-stats b { display: block; font-size: 26px; letter-spacing: -.03em; }
.block-hero-stats span { font-size: 12.5px; opacity: .8; font-weight: 600; }
.blk-list { display: grid; gap: 8px; }
.blk-row { display: grid; grid-template-columns: 1.2fr 70px 1.6fr auto auto auto; gap: 8px; align-items: center; }
.blk-row .control { padding: 9px 12px; }
.blk-new { grid-template-columns: 1.2fr 70px 1.6fr auto; margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--border); }
@media (max-width: 1100px) { .block-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) {
  .block-hero { flex-wrap: wrap; padding: 22px; gap: 16px; }
  .block-hero-num { width: 64px; height: 64px; font-size: 30px; }
  .block-hero h1 { font-size: 24px; }
  .block-hero-stats { margin-left: 0; width: 100%; justify-content: space-around; }
  .blk-row, .blk-new { grid-template-columns: 1fr 70px; }
  .blk-row .control[data-k="description"], .blk-new .control[name="description"] { grid-column: 1 / -1; }
}
@media (max-width: 560px) { .block-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .block-card { padding: 16px; } .block-card p { display: none; } }

/* =================== Perbaikan bilah atas di HP =================== */
.chip, .badge { white-space: nowrap; }
.search { min-width: 0; }
@media (max-width: 560px) {
  .topbar { gap: 8px; padding: 10px 12px; }
  .topbar-right { gap: 6px; flex-shrink: 0; }
  .search { padding: 0 10px; gap: 6px; }
  .search input { padding: 10px 0; font-size: 14px; }
  .search input::placeholder { font-size: 13px; }
  .chip { padding: 6px 9px; font-size: 12.5px; gap: 4px; }
  .icon-btn { width: 36px; height: 36px; }
  .avatar-btn { padding: 2px; border-radius: 12px; }
  .avatar { width: 30px; height: 30px; }
}
.menu-note { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; color: var(--muted); padding: 10px 12px; margin: 0; }
.menu-note svg { width: 15px; height: 15px; margin-top: 2px; }
