:root {
  --green: #1f6f4a;
  --green-d: #17573a;
  --green-l: #e8f3ec;
  --ink: #1c2421;
  --ink-2: #4a5752;
  --muted: #8a9691;
  --line: #e2e8e4;
  --bg: #f5f7f5;
  --card: #fff;
  --good: #1f8a52;   --good-bg: #e3f4ea;
  --great: #0d6b8c;  --great-bg: #e0f1f7;
  --warn: #a8650a;   --warn-bg: #fdf1dc;
  --bad: #b3342b;    --bad-bg: #fbe5e3;
  --radius: 12px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--green); }
h1 { font-size: 1.35rem; margin: .2rem 0 1rem; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 0 0 .5rem; }
p { margin: 0 0 .75rem; }
small, .small { font-size: .85em; color: var(--ink-2); }
.muted { color: var(--muted); }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 14px; }
.main { padding-top: 16px; padding-bottom: 40px; min-height: 70vh; }
.foot { color: var(--muted); font-size: .8rem; padding-bottom: 24px; }

/* top bar */
.topbar { background: var(--green); color: #fff; position: sticky; top: 0; z-index: 20; box-shadow: 0 1px 0 rgba(0,0,0,.08); }
.topbar-in { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 52px; }
.brand { color: #fff; text-decoration: none; display: flex; align-items: center; gap: 8px; font-weight: 650; }
.brand small { display: block; font-weight: 400; font-size: .72rem; color: rgba(255,255,255,.8); line-height: 1.1; }
.brand > span:last-child { line-height: 1.15; }
.logo { font-size: 1.35rem; }
.who { display: flex; align-items: center; gap: 10px; font-size: .85rem; }
.who span { max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who form { margin: 0; }
.link { background: none; border: 0; color: inherit; text-decoration: underline; cursor: pointer; font: inherit; padding: 0; }
.nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; padding-bottom: 6px; }
.nav::-webkit-scrollbar { display: none; }
.nav a { color: rgba(255,255,255,.88); text-decoration: none; padding: 6px 12px; border-radius: 999px; white-space: nowrap; font-size: .9rem; }
.nav a.on { background: #fff; color: var(--green-d); font-weight: 600; }

/* cards & layout */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.card.tight { padding: 10px 12px; }
.grid { display: grid; gap: 12px; }
.grid.c2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid.c3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid.c4 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 10px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.stat b { display: block; font-size: 1.6rem; line-height: 1.1; }
.stat span { color: var(--ink-2); font-size: .85rem; }
.pagehead { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.pagehead h1 { margin-bottom: .5rem; }
.crumb { font-size: .85rem; margin-bottom: 4px; }
.crumb a { text-decoration: none; }

/* forms */
label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 4px; }
.field { margin-bottom: 12px; }
.hint { font-weight: 400; color: var(--ink-2); font-size: .82rem; margin-top: 3px; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=datetime-local], input[type=url], select, textarea {
  width: 100%; padding: 10px 11px; border: 1px solid #cfd8d3; border-radius: 9px; font: inherit; background: #fff; color: var(--ink);
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(31,111,74,.25); border-color: var(--green); }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--green); vertical-align: middle; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 400; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 15px; border-radius: 9px; border: 1px solid var(--green); background: var(--green); color: #fff; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--green-d); }
.btn.ghost { background: #fff; color: var(--green); }
.btn.ghost:hover { background: var(--green-l); }
.btn.danger { background: #fff; color: var(--bad); border-color: #e4b4b0; }
.btn.danger:hover { background: var(--bad-bg); }
.btn.sm { padding: 5px 10px; font-size: .85rem; border-radius: 7px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
form.inline { display: inline; margin: 0; }

/* tables */
.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { background: #f0f4f1; font-size: .8rem; text-transform: uppercase; letter-spacing: .02em; color: var(--ink-2); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: center; }
.sticky-col { position: sticky; left: 0; background: #fff; z-index: 1; }
th.sticky-col { background: #f0f4f1; }
.nowrap { white-space: nowrap; }
.recap td { white-space: nowrap; }
.recap td.desc { white-space: normal; min-width: 280px; font-size: .85rem; color: var(--ink-2); }

/* badges & scores */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .75rem; font-weight: 600; background: #eef1ef; color: var(--ink-2); white-space: nowrap; }
.badge.good { background: var(--good-bg); color: var(--good); }
.badge.great { background: var(--great-bg); color: var(--great); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.info { background: var(--green-l); color: var(--green-d); }
.sc { display: inline-block; min-width: 38px; text-align: center; padding: 2px 6px; border-radius: 6px; font-weight: 700; font-variant-numeric: tabular-nums; }
.sc.good { background: var(--good-bg); color: var(--good); }
.sc.great { background: var(--great-bg); color: var(--great); }
.sc.warn { background: var(--warn-bg); color: var(--warn); }
.sc.bad { background: var(--bad-bg); color: var(--bad); }
.sc.muted { color: var(--muted); font-weight: 400; }
.big-score { font-size: 2.6rem; font-weight: 800; line-height: 1; color: var(--green-d); }
.bar { height: 8px; background: #e7ece9; border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--green); border-radius: 99px; }

.flash { padding: 10px 14px; border-radius: 10px; margin-bottom: 12px; background: var(--good-bg); color: var(--good); border: 1px solid #bfe3cd; }
.flash.err { background: var(--bad-bg); color: var(--bad); border-color: #f0c2bd; }
.flash.warn { background: var(--warn-bg); color: var(--warn); border-color: #f2d7a7; }
.empty { text-align: center; padding: 28px 10px; color: var(--muted); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tabs a, .tabs button { padding: 7px 13px; border-radius: 999px; border: 1px solid var(--line); background: #fff; text-decoration: none; color: var(--ink-2); font: inherit; cursor: pointer; }
.tabs a.on, .tabs button.on { background: var(--green); border-color: var(--green); color: #fff; font-weight: 600; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: #eef3f0; padding: 1px 6px; border-radius: 5px; font-size: .9em; }
details > summary { cursor: pointer; font-weight: 600; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }

/* login */
body.login-page { background: linear-gradient(160deg, #1f6f4a 0%, #2c8a60 45%, #f5f7f5 45.1%); min-height: 100vh; }
.login-box { max-width: 420px; margin: 7vh auto 0; }
.login-box .brandbig { color: #fff; text-align: center; margin-bottom: 18px; }
.login-box .brandbig .logo { font-size: 2.6rem; display: block; }
.login-box .brandbig h1 { margin: 4px 0 0; font-size: 1.5rem; }
.login-box .brandbig p { color: rgba(255,255,255,.85); margin: 2px 0 0; }
.ltabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; background: #eef2ef; padding: 4px; border-radius: 10px; margin-bottom: 14px; }
.ltabs button { border: 0; background: transparent; padding: 8px 4px; border-radius: 8px; font: inherit; font-size: .9rem; cursor: pointer; color: var(--ink-2); }
.ltabs button.on { background: #fff; color: var(--green-d); font-weight: 650; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.lpane { display: none; }
.lpane.on { display: block; }
input.pin { letter-spacing: .35em; font-size: 1.2rem; text-align: center; }

/* score input */
.score-table td { padding: 6px 8px; }
.score-table input.score { width: 76px; text-align: center; font-size: 1.05rem; padding: 8px 4px; font-variant-numeric: tabular-nums; }
.score-table input.note { min-width: 140px; padding: 7px 8px; font-size: .88rem; }
.score-table tr.saved input.score { border-color: var(--good); background: #f6fcf8; }
.score-table tr.err input.score { border-color: var(--bad); background: #fff7f6; }
.score-table .st { font-size: .75rem; min-width: 50px; display: inline-block; }
.toggle { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 34px; border-radius: 8px; border: 1px solid #cfd8d3; background: #fff; cursor: pointer; font-size: 1.1rem; }
.toggle.on { background: var(--good-bg); border-color: var(--good); color: var(--good); }
.savebar { position: sticky; bottom: 0; background: rgba(245,247,245,.96); padding: 10px 0; border-top: 1px solid var(--line); margin-top: 12px; z-index: 5; }

/* quiz */
.q { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.q .qno { font-weight: 700; color: var(--green-d); font-size: .85rem; margin-bottom: 4px; }
.q .qbody { white-space: pre-line; margin-bottom: 10px; }
.q img { max-width: 100%; border-radius: 8px; margin-bottom: 10px; }
.opt { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 7px; cursor: pointer; font-weight: 400; }
.opt:has(input:checked) { border-color: var(--green); background: var(--green-l); }
.opt input { margin-top: 2px; flex: none; }
.opt.correct { border-color: var(--good); background: var(--good-bg); }
.opt.wrong { border-color: var(--bad); background: var(--bad-bg); }
.timer { position: sticky; top: 52px; z-index: 10; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; font-weight: 600; }
.timer.low { background: var(--bad-bg); color: var(--bad); }

/* print slips */
.slips { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0; }
.slip { border: 1px dashed #999; padding: 10px 12px; font-size: 12.5px; page-break-inside: avoid; break-inside: avoid; }
.slip h4 { margin: 0 0 4px; font-size: 13.5px; }
.slip .k { display: grid; grid-template-columns: 105px 1fr; gap: 2px 6px; }
.slip .v { font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 700; font-size: 13.5px; }
.slip .note { margin-top: 5px; color: #555; font-size: 11px; }
@media print {
  .topbar, .foot, .noprint, .flash { display: none !important; }
  body { background: #fff; }
  .main { padding: 0; max-width: none; }
  .card { border: 0; padding: 0; }
  .tablewrap { border: 0; overflow: visible; }
  .recap { font-size: 10px; }
}
@media (max-width: 640px) {
  h1 { font-size: 1.2rem; }
  .card { padding: 13px; }
  .hide-sm { display: none !important; }
  th, td { padding: 7px 8px; }
}
td .badge { white-space: normal; line-height: 1.35; }
@media (max-width: 640px) {
  .savebar .small { display: none; }
  .savebar.row { justify-content: flex-end; }
}

/* tabel isian berlebar kolom tetap: isi yang berubah tidak menggeser kolom lain */
table.fixed { table-layout: fixed; min-width: 560px; }
table.fixed td { overflow-wrap: break-word; }
.score-table col.c-no { width: 44px; }
.score-table col.c-tog { width: 96px; }
.score-table col.c-score { width: 100px; }
.score-table col.c-note { width: 26%; }
.score-table col.c-st { width: 132px; }
.score-table .st { display: inline-block; width: 18px; text-align: center; font-weight: 700; color: var(--muted); }
.score-table tr.saved .st { color: var(--good); }
.score-table tr.err .st { color: var(--bad); cursor: help; }
.score-table .fb .badge { font-size: .72rem; }
.toast { position: fixed; left: 50%; bottom: 76px; transform: translate(-50%, 20px); background: #1c2421; color: #fff; padding: 9px 16px; border-radius: 10px; font-size: .9rem; opacity: 0; pointer-events: none; transition: .2s; z-index: 50; max-width: 90vw; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--bad); }
@media (max-width: 640px) {
  table.fixed { min-width: 0; }
  .score-table .c-no, .score-table .c-note { display: none; }
  .score-table col.c-no, .score-table col.c-note { width: 0; }
  .score-table col.c-tog { width: 64px; }
  .score-table col.c-score { width: 84px; }
  .score-table col.c-st { width: 40px; }
  .score-table .fb { display: none; }
}
.stw { display: flex; align-items: center; gap: 4px; }
table.fixed th { white-space: normal; }
#mark-all { text-transform: none; font-weight: 400; }

/* absensi */
.att-table col.c-no { width: 44px; }
.att-table col.c-att { width: 200px; }
.att-table col.c-note { width: 28%; }
.att-table col.c-st { width: 34px; }
.att-table .st { font-weight: 700; color: var(--muted); }
.att-table tr.saved .st { color: var(--good); }
.att-table tr.err .st { color: var(--bad); }
.seg { display: inline-flex; border: 1px solid #cfd8d3; border-radius: 9px; overflow: hidden; }
.seg label { margin: 0; cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 36px; font-weight: 700; color: var(--ink-2); border-left: 1px solid #e2e8e4; background: #fff; }
.seg label:first-child span { border-left: 0; }
.seg-H input:checked + span { background: var(--good); color: #fff; }
.seg-S input:checked + span { background: var(--great); color: #fff; }
.seg-I input:checked + span { background: #c98a12; color: #fff; }
.seg-A input:checked + span { background: var(--bad); color: #fff; }
.seg input:focus-visible + span { outline: 2px solid var(--green); outline-offset: -2px; }
@media (max-width: 640px) {
  .att-table .c-no, .att-table .c-note { display: none; }
  .att-table col.c-no, .att-table col.c-note { width: 0; }
  .att-table col.c-att { width: 172px; }
  .seg span { width: 40px; height: 38px; }
}
.ann.unread { border-color: #f0c2bd; box-shadow: inset 4px 0 0 var(--bad); }
.nav a .count { background: #fff; color: var(--bad); border-radius: 99px; padding: 0 6px; font-size: .75rem; margin-left: 4px; }

/* jangan pernah memotong label di tengah kata */
.badge, .btn, .sc, .tabs a, .nav a, th { word-break: keep-all; overflow-wrap: normal; hyphens: none; }
.stw .fb, .stw .st { flex: none; }
.stw .badge { white-space: nowrap; }

/* panduan */
.guide section { scroll-margin-top: 110px; }
.guide ul { padding-left: 20px; margin: 0 0 .75rem; }
.guide li { margin-bottom: 4px; }
.formula { background: var(--green-l); border-radius: 10px; padding: 12px 14px; font-weight: 650; color: var(--green-d); margin: 0 0 .75rem; text-align: center; }
.toc { line-height: 2; font-size: .9rem; }
.guide details { border-top: 1px solid var(--line); padding: 8px 0; }
.guide details p { margin: 6px 0 0; }
.code { white-space: nowrap; }

/* ---------- panel pencapaian ---------- */
.achv { position: relative; overflow: hidden; color: #fff; border-radius: 18px; padding: 18px; margin-bottom: 16px;
  background: radial-gradient(120% 140% at 0% 0%, #2f9a68 0%, #1f6f4a 45%, #123f2c 100%); box-shadow: 0 10px 30px -12px rgba(18,63,44,.6); }
.achv::after { content: ""; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.14), transparent 70%); pointer-events: none; }
.achv-top { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; }
.achv-rank { display: flex; align-items: center; gap: 12px; }
.achv-rank .trophy { flex: none; filter: drop-shadow(0 4px 10px rgba(0,0,0,.35)); }
.tone-gold .trophy { animation: shine 3.2s ease-in-out infinite; }
@keyframes shine { 0%,100% { transform: rotate(-4deg) scale(1); } 50% { transform: rotate(4deg) scale(1.05); } }
.achv-label { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; opacity: .8; }
.achv-big { font-size: 2.6rem; font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.achv-big small { font-size: 1rem; font-weight: 600; opacity: .85; }
.achv-tier { font-weight: 650; font-size: .92rem; margin-top: 3px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stars { letter-spacing: 1px; font-size: 1rem; }
.stars span { color: rgba(255,255,255,.25); }
.stars span.on { color: #ffd54a; text-shadow: 0 0 8px rgba(255,213,74,.6); }
.achv-ring { --p: 0; --h: 140; width: 104px; height: 104px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: conic-gradient(hsl(var(--h) 70% 58%) calc(var(--p) * 1%), rgba(255,255,255,.14) 0); }
.achv-ring > div { width: 84px; height: 84px; border-radius: 50%; background: #164e36; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.achv-ring b { font-size: 1.55rem; line-height: 1; }
.achv-ring span { font-size: .6rem; line-height: 1.15; text-transform: uppercase; letter-spacing: .04em; opacity: .8; margin-top: 4px; }
.achv-meters { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-top: 16px; }
.meter-head { display: flex; justify-content: space-between; font-size: .85rem; margin-bottom: 5px; }
.meter-head span { opacity: .9; }
.gbar { position: relative; height: 10px; }
.gtrack { position: relative; height: 100%; border-radius: 99px; overflow: hidden;
  background: linear-gradient(90deg, #e2483d 0%, #f0a33a 35%, #f3d23c 55%, #8fd16a 75%, #2fb36c 100%); }
.gtrack::before { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 35%; z-index: 1;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent);
  transform: translateX(-120%); animation: sweep 4.5s ease-in-out infinite; }
.meter:nth-child(2) .gtrack::before { animation-delay: 1.2s; }
.meter:nth-child(3) .gtrack::before { animation-delay: 2.4s; }
.gtrack .rest { position: absolute; right: 0; top: 0; bottom: 0; z-index: 2; background: rgba(9,38,26,.74); }
@keyframes sweep { 0% { transform: translateX(-120%); } 60%, 100% { transform: translateX(320%); } }
.spark { position: absolute; top: 50%; width: 0; height: 0; z-index: 3; pointer-events: none; }
.spark b { position: absolute; left: -2px; top: -2px; width: 4px; height: 4px; border-radius: 50%; background: #fff7c2; opacity: 0;
  box-shadow: 0 0 6px 2px rgba(255,236,150,.85); animation: glit 2.4s ease-out infinite; }
.spark b:nth-child(2) { --dx: 7px; width: 3px; height: 3px; animation-delay: .8s; background: #fff; }
.spark b:nth-child(3) { --dx: -6px; animation-delay: 1.6s; }
@keyframes glit { 0% { transform: translate(0, 0) scale(.4); opacity: 0; } 20% { opacity: 1; } 100% { transform: translate(var(--dx, 2px), -18px) scale(1); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .gtrack::before, .spark b { animation: none; } .spark { display: none; } }
.achv-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.achv-badges span { background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22); padding: 4px 10px; border-radius: 99px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.podium { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; margin-top: 14px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.15); font-size: .85rem; }
.podium-t { opacity: .7; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; width: 100%; }
.pd { white-space: nowrap; }
.pd.me { font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }
.achv-help { display: inline-block; margin-top: 12px; color: #c9f2db; font-size: .82rem; }
@media (max-width: 640px) {
  .achv { padding: 15px; border-radius: 16px; }
  .achv-big { font-size: 2.2rem; }
  .achv-ring { width: 92px; height: 92px; }
  .achv-ring > div { width: 74px; height: 74px; }
  .achv-rank .trophy { width: 52px; height: 52px; }
  .achv-top { flex-wrap: nowrap; }
  .achv-tier { flex-direction: column; align-items: flex-start; gap: 2px; }
}
@media (prefers-reduced-motion: reduce) { .tone-gold .trophy { animation: none; } }

/* ---------- permata karakter (guru) ---------- */
.gem { vertical-align: middle; filter: drop-shadow(0 1px 1px rgba(0,0,0,.15)); }
.gempick { position: relative; display: inline-block; }
.gempick > summary { list-style: none; cursor: pointer; padding: 2px; border-radius: 6px; display: inline-flex; }
.gempick > summary::-webkit-details-marker { display: none; }
.gempick > summary:hover { background: #eef3f0; }
.gempick-menu { position: fixed; z-index: 60; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 24px rgba(0,0,0,.12); padding: 6px; min-width: 210px; }
.gempick-menu button { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: none; padding: 7px 8px; border-radius: 7px; font: inherit; font-size: .88rem; cursor: pointer; text-align: left; }
.gempick-menu button:hover, .gempick-menu button.on { background: #f0f5f2; }
.gempick-menu button.on span { font-weight: 700; }
.trait-panel { border: 1px dashed #c9b6e8; background: #fbf8ff; }
.trait-levels { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 10px; }
.trait-levels label { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 99px; padding: 5px 11px 5px 7px; font-weight: 500; cursor: pointer; background: #fff; margin: 0; }
.trait-levels input { position: absolute; opacity: 0; pointer-events: none; }
.trait-levels label:has(input:checked) { border-color: #8b44d6; box-shadow: 0 0 0 2px #e6d5fa; font-weight: 700; }

/* ---------- navigasi & PWA ---------- */
.nav .ni { display: none; }
.nav .count { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 5px; border-radius: 99px; background: #e2483d; color: #fff; font-size: .72rem; font-weight: 700; line-height: 18px; text-align: center; }
.pwa-card { border-color: #bfe3cd; background: linear-gradient(90deg, #f1faf5, #fff); }
.pwa-card[hidden] { display: none; }
@media (max-width: 640px) {
  body.role-student .nav, body.role-parent .nav, body.role-observer .nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; max-width: none; margin: 0;
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 0; overflow: visible;
    background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(0,0,0,.06);
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
  }
  body.role-student .nav a, body.role-parent .nav a, body.role-observer .nav a {
    position: relative; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 2px; border-radius: 12px;
    color: var(--ink-2); font-size: .7rem; background: none;
  }
  body.role-student .nav a.on, body.role-parent .nav a.on, body.role-observer .nav a.on { color: var(--green-d); background: var(--green-l); font-weight: 700; }
  body.role-student .nav .ni, body.role-parent .nav .ni, body.role-observer .nav .ni { display: block; font-size: 1.25rem; line-height: 1.2; }
  body.role-student .nav .nl, body.role-parent .nav .nl, body.role-observer .nav .nl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  body.role-student .nav .count, body.role-parent .nav .count, body.role-observer .nav .count { position: absolute; top: 2px; left: calc(50% + 6px); margin: 0; }
  body.role-student, body.role-parent, body.role-observer { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
  body.role-student .savebar, body.role-parent .savebar { bottom: calc(64px + env(safe-area-inset-bottom)); }
  body.role-student .toast, body.role-parent .toast, body.role-observer .toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
  body.role-student .foot, body.role-parent .foot, body.role-observer .foot { display: none; }
}
.achv small { color: inherit; }

/* label keterangan panjang yang terbungkus ke beberapa baris: sudut membulat sedang, bukan pil */
td .badge { border-radius: 8px; padding: 3px 8px; text-align: left; }
.badge { max-width: 100%; }

/* permata siswa: halus, dengan kilau sesekali */
.achv-gem { display: inline-flex; align-items: center; gap: 6px; }
.achv-gem .gem { animation: gemglint 5s ease-in-out infinite; transform-origin: 50% 60%; }
@keyframes gemglint { 0%, 86%, 100% { filter: drop-shadow(0 0 0 rgba(255,255,255,0)); transform: rotate(0); } 92% { filter: drop-shadow(0 0 6px rgba(255,255,255,.9)); transform: rotate(-8deg) scale(1.12); } }
@media (prefers-reduced-motion: reduce) { .achv-gem .gem { animation: none; } }
.achv-big, .achv-label { white-space: nowrap; }
.achv-tier { white-space: nowrap; }
@media (max-width: 380px) {
  .achv-big { font-size: 1.9rem; }
  .achv-label { font-size: .7rem; }
  .achv-ring { width: 80px; height: 80px; }
  .achv-ring > div { width: 64px; height: 64px; }
  .achv-ring b { font-size: 1.25rem; }
  .achv-ring span { font-size: .52rem; }
  .achv-rank { gap: 8px; }
  .achv-rank .trophy { width: 44px; height: 44px; }
}

/* teks soal kaya: tabel, gambar, sub/superskrip */
.qbody.rich { white-space: normal; }
.qbody.rich p { margin: 0 0 .6rem; }
.qbody.rich p:last-child { margin-bottom: 0; }
.qtable { overflow-x: auto; margin: 0 0 .6rem; }
.qtable table { width: auto; min-width: 60%; border: 1px solid #cfd8d3; border-radius: 0; }
.qtable th, .qtable td { border: 1px solid #cfd8d3; padding: 6px 10px; text-transform: none; letter-spacing: 0; font-size: .92rem; color: var(--ink); }
.qtable th { background: #eef4f0; font-weight: 700; }
img.qimg { display: block; max-width: 100%; height: auto; border-radius: 8px; margin: 6px 0 10px; }
.opt img.qimg { max-height: 160px; margin: 4px 0; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin-top: 12px; }
.gal { border: 1px solid var(--line); border-radius: 10px; padding: 8px; background: #fafcfb; }
.gal img { width: 100%; height: 120px; object-fit: contain; background: #fff; border-radius: 6px; }

.achv.mini { padding: 14px; margin: 0; border-radius: 16px; }
.achv.mini::after { width: 140px; height: 140px; right: -40px; top: -40px; }
.achv.mini .podium { font-size: .8rem; }

/* pemilih TP per bab */
.tp-group { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin-bottom: 8px; background: #fbfcfb; }
.tp-group-h { margin-bottom: 4px; font-size: .9rem; }
.tp-item { align-items: flex-start; padding: 4px 0; }
.tp-item input { margin-top: 3px; flex: none; }

.rapor-split { display: grid; grid-template-columns: 1fr auto; gap: 12px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.rapor-split > div > span { display: block; font-size: .78rem; color: var(--ink-2); }
.rapor-split > div > b { display: block; font-size: 1.15rem; margin: 1px 0 4px; }
.rapor-split .bar { height: 6px; }

.recap tr.desc-row td.desc { white-space: normal; background: #f7faf8; font-size: .85rem; color: var(--ink-2); max-width: 0; }
.desc-btn { font-size: 1.05rem; text-decoration: none; }

.tp-tag select { width: auto; padding: 1px 6px; font-size: .78rem; border-radius: 6px; margin-left: 6px; color: var(--ink-2); }
.tp-tag select.set { border-color: var(--good); background: var(--good-bg); color: var(--good); font-weight: 700; }
