/* Misi Ulangkaji — reka bentuk ikut prototaip Google AI Studio (25 Nov 2026), ditulis semula tanpa Tailwind/CDN skrip. */
:root {
  --bg-a: #5861C7; --bg-b: #6872D6; --bg-c: #7D87E0;
  --panel: rgba(49,49,102,.96); --panel-2: #252452; --panel-3: #22224C;
  --row: rgba(75,74,134,.95); --row-done: rgba(60,70,125,.92);
  --plate: #4B4A86; --plate-shadow: rgba(42,41,89,.9);
  --line: rgba(255,255,255,.25); --line-2: rgba(255,255,255,.15);
  --text: #fff; --muted: rgba(255,255,255,.9); --soft: rgba(255,255,255,.8);
  --gold: #F7C948; --gold-hi: #FAD45A; --gold-lo: #F3B62C; --gold-edge: #B37B0B; --ink: #1E1A47; --gold-pale: #FDE68A;
  --good: #16A34A; --good-edge: #14532D; --good-lite: #4ADE80;
  --bad: #DC2626; --bad-edge: #7F1D1D; --bad-lite: #F87171;
  --fs: 16px; --fs-sm: 14px; --fs-h: 30px; --tap: 48px;
  --display: 'Anton', Impact, 'Arial Narrow Bold', sans-serif;
  color-scheme: dark;
}
html.tv { --fs: 22px; --fs-sm: 19px; --fs-h: 44px; --tap: 66px; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: #5F68CC; }
body {
  margin: 0; min-height: 100dvh; overflow-x: hidden; color: var(--text);
  font: 400 var(--fs)/1.5 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background:
    radial-gradient(circle at 88% 12%, rgba(255,255,255,.14) 0%, transparent 40%),
    radial-gradient(circle at 12% 88%, rgba(167,178,255,.16) 0%, transparent 42%),
    linear-gradient(135deg, var(--bg-a) 0%, var(--bg-b) 50%, var(--bg-c) 100%);
  background-attachment: fixed;
  font-variant-numeric: tabular-nums;
}
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image: linear-gradient(-32deg, transparent 22%, rgba(255,255,255,.055) 22%, rgba(255,255,255,.055) 31%, transparent 31%, transparent 56%, rgba(255,255,255,.04) 56%, rgba(255,255,255,.04) 63%, transparent 63%, transparent 82%, rgba(255,255,255,.05) 82%, rgba(255,255,255,.05) 88%, transparent 88%);
}
body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .22;
  background-image: radial-gradient(rgba(255,255,255,.45) 1.1px, transparent 1.1px); background-size: 14px 14px;
  -webkit-mask-image: linear-gradient(215deg, rgba(0,0,0,.85) 0%, rgba(0,0,0,.2) 45%, transparent 78%);
  mask-image: linear-gradient(215deg, rgba(0,0,0,.85) 0%, rgba(0,0,0,.2) 45%, transparent 78%);
}
body.has-nav { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
html.tv body.has-nav { padding-bottom: 110px; }
::selection { background: var(--gold); color: var(--ink); }
a { color: var(--gold-pale); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.ic { flex: none; }

.wrap { position: relative; z-index: 1; max-width: 1100px; margin: 0 auto; padding: 18px 16px 28px; }

/* ===== HUD atas ===== */
.topbar { position: sticky; top: 0; z-index: 30; }
.topbar-in { max-width: 1140px; margin: 0 auto; padding: 8px 8px 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.hud-bar { display: flex; align-items: center; gap: 6px; min-width: 0; overflow-x: auto; scrollbar-width: none;
  padding: 6px 28px 6px 8px; background: rgba(69,77,168,.9); border-bottom: 2px solid rgba(255,255,255,.3);
  box-shadow: 0 6px 16px rgba(25,27,76,.3); clip-path: polygon(0 0, 100% 0, calc(100% - 22px) 100%, 0 100%); }
.hud-bar::-webkit-scrollbar { display: none; }
.hud-chip { display: inline-flex; align-items: center; gap: 6px; flex: none; min-height: 38px; padding: 6px 14px;
  background: linear-gradient(90deg, #D5DCFD, #B0BBF7); color: var(--ink); font-size: var(--fs-sm); font-weight: 700;
  clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%); }
.hud-chip.gold { background: linear-gradient(90deg, #FCE282, var(--gold), var(--gold-lo)); font: 400 calc(var(--fs) + 2px)/1 var(--display); letter-spacing: .04em; padding: 6px 16px; }
.hud-chip .ic-flame { color: #C2410C; }
.sh-on { color: #1E3A8A; display: inline-flex; } .sh-on .ic { fill: #3B82F6; }
.sh-off { color: #475569; display: inline-flex; }
.hud-wide, .tb-wide { display: none; }
.hud-opt { display: none; }
@media (min-width: 520px) { .hud-opt { display: inline-flex; } }
.topbar-actions { display: flex; gap: 6px; flex: none; }
.tb-btn { min-height: 48px; min-width: 48px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 8px; border: 1px solid var(--line); background: rgba(60,62,130,.9); color: #fff; font: 700 13px/1 'Inter', sans-serif; cursor: pointer; text-decoration: none; }
.tb-btn:hover { background: #4B4D96; }
.tb-btn.on { background: var(--gold); color: var(--ink); border-color: var(--gold-edge); }
@media (min-width: 640px) { .tb-wide { display: inline; } .topbar-in { padding: 12px 16px 0; } }
@media (min-width: 900px) { .hud-wide { display: inline; font-size: 12px; font-weight: 600; } }

/* ===== Plat tajuk ===== */
.plate-wrap { display: inline-flex; flex-direction: column; align-items: flex-start; }
.plate { position: relative; display: inline-block; }
.plate::before { content: ""; position: absolute; inset: 0; transform: translate(8px, 6px); background: rgba(65,71,160,.55); }
.plate-title { position: relative; margin: 0; padding: 8px 24px; background: rgba(149,160,238,.4); border: 1px solid var(--line);
  font: 400 var(--fs-h)/1 var(--display); letter-spacing: .04em; text-transform: uppercase; color: var(--gold); text-shadow: 0 2px 0 rgba(30,26,71,.55); }
.plate-sub { margin: 10px 0 0; font-weight: 600; color: var(--muted); font-size: var(--fs-sm); }
@media (min-width: 640px) { :root:not(.tv) { --fs-h: 34px; } .plate-sub { font-size: var(--fs); } }
.page-head { display: flex; flex-direction: column; gap: 14px; margin-bottom: 18px; }
@media (min-width: 640px) { .page-head { flex-direction: row; align-items: flex-start; justify-content: space-between; } }

/* ===== Butang ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap); padding: 0 18px;
  border-radius: 8px; border: 1px solid var(--line); border-bottom: 3px solid #272654; background: #43427E; color: #fff;
  font: 700 var(--fs)/1.2 'Inter', sans-serif; text-decoration: none; cursor: pointer; transition: transform .12s, background-color .15s; }
.btn:hover { background: #504F90; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-primary { background: linear-gradient(180deg, var(--gold-hi), var(--gold-lo)); color: var(--ink); border: 0; border-bottom: 4px solid var(--gold-edge); box-shadow: 0 6px 14px rgba(25,27,76,.25); }
.btn-primary:hover { background: linear-gradient(180deg, #FFDE6E, var(--gold)); }
.btn-good { background: var(--good); border: 0; border-bottom: 4px solid var(--good-edge); color: #fff; }
.btn-good:hover { background: #18B451; }
.btn-bad { background: var(--bad); border: 0; border-bottom: 4px solid var(--bad-edge); color: #fff; }
.btn-bad:hover { background: #E53535; }
.btn-block { width: 100%; }
.btn-hero { min-height: calc(var(--tap) + 6px); font-size: calc(var(--fs) + 2px); }
.btn-sm { min-height: 40px; padding: 0 12px; font-size: var(--fs-sm); }
.grow { flex: 1; }
.link-btn { background: none; border: 0; color: var(--soft); font: 600 var(--fs-sm) 'Inter', sans-serif; min-height: 44px; cursor: pointer; }
.link-btn:hover { color: #fff; }

/* ===== Panel, teks, borang ===== */
h1, h2 { margin: 0; }
h2 { font-size: calc(var(--fs) + 2px); font-weight: 700; }
.panel { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px; box-shadow: 0 10px 24px rgba(25,27,76,.28); }
.panel + .panel { margin-top: 14px; }
.panel-gold { border: 2px solid var(--gold); }
.sub { color: var(--muted); margin: 0 0 14px; font-size: var(--fs-sm); }
.muted { color: var(--soft); }
.small { font-size: var(--fs-sm); }
.kicker { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--gold-pale); }
.display { font: 400 calc(var(--fs) + 10px)/1.1 var(--display); letter-spacing: .03em; text-transform: uppercase; }
.row { display: flex; gap: 12px; align-items: center; }
.row.wrap-ok { flex-wrap: wrap; }
.spread { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }
.section-gap { margin-top: 22px; }
label { display: block; font-size: var(--fs-sm); color: var(--muted); margin: 14px 0 6px; font-weight: 600; }
input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%; min-height: var(--tap); padding: 10px 12px; border-radius: 8px; border: 2px solid rgba(255,255,255,.3);
  background: var(--panel-2); color: #fff; font: inherit; }
textarea { min-height: 90px; resize: vertical; }
input::placeholder, textarea::placeholder { color: rgba(255,255,255,.55); }
input[type=file] { color: var(--muted); font: inherit; }
.flash { padding: 12px 14px; border-radius: 12px; margin: 0 0 14px; font-size: var(--fs-sm); border: 1px solid var(--line); background: rgba(50,51,107,.85); }
.flash-error { background: #7F1D1D; border-color: var(--bad-lite); }
.flash-ok { background: #14532D; border-color: var(--good-lite); }
.flash-info { background: rgba(50,51,107,.9); border-color: var(--line); }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 6px; font-size: 12px; font-weight: 800; border: 1px solid var(--line); background: var(--panel-2); color: #fff; }
.pill-good { background: #14532D; border-color: var(--good-lite); }
.pill-bad { background: #7F1D1D; border-color: var(--bad-lite); }
.pill-xp { background: var(--gold); color: var(--ink); border-color: var(--gold-edge); }
.pill-warn { background: #FEF3C7; color: #92400E; border-color: #D97706; }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.list > li:last-child { border-bottom: 0; }
.bar { height: 10px; background: #1B1A42; border-radius: 99px; overflow: hidden; margin-top: 8px; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #FCE17E, var(--gold-lo)); }
.bar.good > i { background: var(--good); }
.bar.bad > i { background: var(--bad); }
.edit-grid { display: grid; gap: 8px; }
.subj-grid { grid-template-columns: 1fr 1fr; align-items: end; margin-bottom: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--line-2); }
@media (min-width: 760px) { .subj-grid { grid-template-columns: 2fr 1.4fr .8fr .9fr; border-bottom: 0; padding-bottom: 0; } }
.thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }

/* ===== Kad level ===== */
.lvc { position: relative; display: block; padding: 10px 4px 8px; color: #fff; text-decoration: none; transition: transform .2s cubic-bezier(.2,.8,.2,1); }
.lvc-l { transform: rotate(-1.5deg); } .lvc-r { transform: rotate(1.2deg); }
.lvc-link { cursor: pointer; }
.lvc-link:hover, .lvc-link:focus-visible { transform: rotate(0) translateY(-6px); }
.lvc .px { position: absolute; z-index: 3; pointer-events: none; }
.px1 { top: 0; left: 12px; width: 10px; height: 10px; background: #93C5FD; }
.px2 { top: 10px; left: 24px; width: 6px; height: 6px; background: #FDE68A; }
.px3 { top: 2px; right: 14px; width: 10px; height: 10px; background: #D8B4FE; }
.px4 { top: 16px; right: 6px; width: 6px; height: 6px; background: #93C5FD; }
.lvc-art { position: relative; aspect-ratio: 3 / 4; overflow: hidden; background: #3B3B75; border: 2.5px solid rgba(255,255,255,.9); box-shadow: 0 12px 24px rgba(27,28,82,.38); }
.lvc-art > img, .lvc-art > .art-img, .lvc-art > svg.char-svg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center top; }
.lvc-locked .lvc-art > img, .lvc-locked .lvc-art > svg { filter: grayscale(1) brightness(.65); }
.lvc-ready .lvc-art { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(247,201,72,.8), 0 10px 24px rgba(247,201,72,.34); }
.lvc-badge { position: absolute; top: 10px; right: 10px; z-index: 2; display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 4px;
  font-size: 12px; font-weight: 800; text-transform: uppercase; background: var(--gold); color: var(--ink); border: 1px solid #9E6B06; }
.lvc-badge.lock { background: rgba(37,36,80,.95); color: #fff; border-color: rgba(255,255,255,.3); }
.lvc-plate { position: relative; margin: -40px -4px 0; z-index: 2; }
.lvc-plate-shadow { position: absolute; inset: 0; transform: translate(4px, 6px); background: var(--plate-shadow); clip-path: polygon(1% 12%, 100% 4%, 99% 100%, 3% 100%); }
.lvc-plate-body { position: relative; padding: 16px 14px 12px; background: var(--plate); border-top: 1px solid var(--line); clip-path: polygon(0 8%, 100% 0, 98% 100%, 2% 100%); }
.lvc-title { font: 400 calc(var(--fs) + 2px)/1.15 var(--display); letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lvc-sub { margin-top: 2px; font-size: 12px; font-weight: 600; color: var(--muted); }
.lvc-bar { margin-top: 8px; height: 6px; border-radius: 99px; background: #24234F; overflow: hidden; }
.lvc-bar > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #FCE17E, var(--gold-lo)); }
.lvc-bar > i.done { background: #22C55E; }
@media (min-width: 640px) { .lvc-title { font-size: calc(var(--fs) + 4px); } .lvc-sub { font-size: var(--fs-sm); } }

.lv-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 16px; margin-top: 22px; }
@media (min-width: 760px) { .lv-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px 24px; } }
@media (min-width: 1024px) { .lv-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* ===== Utama ===== */
.home { display: grid; gap: 24px; margin: 20px auto 0; align-items: center; max-width: 1100px; width: 100%; }
.home-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; max-width: 540px; width: 100%; margin: 0 auto; }
.home-side { display: flex; flex-direction: column; gap: 16px; max-width: 520px; width: 100%; margin: 0 auto; }
@media (min-width: 1024px) { .home { grid-template-columns: 7fr 5fr; gap: 48px; } .home-cards { gap: 28px; max-width: min(600px, calc(1.5 * (100dvh - 380px) + 28px)); }
  .home-stage { min-height: calc(100dvh - 200px); display: flex; flex-direction: column; justify-content: center; max-width: 1100px; margin: 0 auto; }
  .home-stage > .plate-wrap { margin-left: 8px; } .home-side { max-width: none; } }
.boss-banner { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 12px; background: rgba(56,55,114,.95); border: 2px solid var(--gold); color: #fff; text-decoration: none; font-weight: 700; }
.boss-banner:hover { background: #434285; }
.boss-banner .bb-ic { width: 44px; height: 44px; border-radius: 8px; background: var(--gold); color: var(--ink); border-bottom: 3px solid var(--gold-edge); display: flex; align-items: center; justify-content: center; flex: none; }
.boss-banner .grow { font-size: var(--fs-sm); min-width: 0; }
.boss-banner.is-locked { border: 1px solid var(--line); background: rgba(56,57,120,.9); }
.boss-banner.is-locked .bb-ic { background: #23224E; color: var(--gold-pale); border-bottom: 3px solid #17163A; }
.bb-title { display: block; }
.bb-bar { display: block; margin: 8px 0 6px; }
.bb-sub { display: block; font-size: 12px; font-weight: 600; color: var(--gold-pale); }
.reward { padding: 14px 16px; border-radius: 12px; background: rgba(56,57,120,.9); border: 1px solid var(--line); }
.reward-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: var(--fs-sm); font-weight: 700; }
.reward-head .left { display: inline-flex; align-items: center; gap: 8px; } .reward-head .left .ic { color: var(--gold); }
.reward-left { font-size: 12px; color: var(--gold-pale); }
.reward-steps { display: grid; gap: 6px; margin-top: 10px; }
.reward-steps i { height: 10px; border-radius: 2px; background: #23224E; border: 1px solid var(--line-2); }
.reward-steps i.on { background: linear-gradient(90deg, #FCE17E, var(--gold-lo)); border: 0; }
.mini-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ===== Misi: senarai subjek ===== */
.subj-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.srow { position: relative; display: block; color: #fff; text-decoration: none; }
.srow::before { content: ""; position: absolute; inset: 0; transform: translate(6px, 6px); background: rgba(42,41,89,.65); clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%); }
.srow-in { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 24px; background: var(--row); border: 1px solid var(--line);
  clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%); }
.srow.done .srow-in { background: var(--row-done); }
a.srow:hover .srow-in { background: #57569A; }
.srow-name { font: 400 calc(var(--fs) + 8px)/1.1 var(--display); letter-spacing: .04em; text-transform: uppercase; }
.srow-meta { font-size: var(--fs-sm); color: var(--muted); }
.srow .btn { min-width: 110px; pointer-events: none; }
.note { margin-top: 22px; padding: 14px 16px; border-radius: 12px; background: rgba(50,51,107,.85); border: 1px solid var(--line-2); font-size: var(--fs-sm); }
.together { display: inline-flex; align-items: center; gap: 10px; padding: 8px 10px 8px 14px; border-radius: 12px; background: rgba(43,43,92,.95); border: 2px solid var(--good-lite); font-weight: 700; font-size: var(--fs-sm); }
.together .btn { background: var(--bad); border: 0; border-bottom: 3px solid var(--bad-edge); }

/* ===== Soalan ===== */
.q-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.q-meta { font-size: 16px; font-weight: 800; line-height: 1.35; } /* D-319: lebih besar (arahan Coach) */
@media (min-width: 640px) { .q-meta { font-size: 19px; } }
.q-exit { min-height: 48px; min-width: 48px; border-radius: 12px; background: #34346E; border: 1px solid var(--line); color: #fff; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.progress-dots { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.progress-dots i { width: 10px; height: 10px; border-radius: 99px; background: rgba(255,255,255,.3); }
.progress-dots i.ok { background: #22C55E; }
.progress-dots i.now { width: 28px; background: var(--gold); }
.qcard { position: relative; margin-top: 18px; padding: 24px; border-radius: 16px; background: var(--panel); border: 2px solid var(--line); box-shadow: 0 12px 26px rgba(25,27,76,.3); }
.qtext { margin-top: 10px; font-size: calc(var(--fs) + 4px); line-height: 1.5; font-weight: 700; }
.ans-box { margin-top: 22px; padding: 18px; border-radius: 12px; background: var(--panel-3); border: 2px solid rgba(247,201,72,.8); }
.ans-box .ans { margin-top: 6px; font-size: calc(var(--fs) + 2px); font-weight: 700; white-space: pre-wrap; }
.answer-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 18px; }
.choices { display: grid; gap: 12px; margin-top: 20px; }
.choice { min-height: 56px; width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 12px; border: 2px solid var(--line);
  background: #444382; color: #fff; font: 600 var(--fs) 'Inter', sans-serif; text-align: left; cursor: pointer; }
.choice:hover:not([disabled]) { background: #525196; }
.choice .letter { width: 32px; height: 32px; flex: none; border-radius: 8px; background: #242352; color: var(--gold); font-weight: 800; font-size: var(--fs-sm); display: flex; align-items: center; justify-content: center; }
.choice.is-right { background: #166534; border-color: var(--good-lite); }
.choice.is-wrong { background: #991B1B; border-color: var(--bad-lite); }
.choice[disabled] { cursor: default; }
.xp-pop { position: absolute; top: 8px; left: 50%; z-index: 5; padding: 6px 16px; border-radius: 8px; background: var(--gold); color: var(--ink);
  border: 2px solid var(--gold-edge); font: 400 26px/1 var(--display); pointer-events: none; animation: xpPop 600ms cubic-bezier(.16,1,.3,1) forwards; }
@keyframes xpPop { 0% { opacity: 0; transform: translate(-50%, 10px) scale(.82); } 25% { opacity: 1; transform: translate(-50%, -6px) scale(1.08); } 80% { opacity: 1; transform: translate(-50%, -26px) scale(1); } 100% { opacity: 0; transform: translate(-50%, -38px) scale(.96); } }
.done-card { margin-top: 20px; padding: 28px; border-radius: 16px; background: rgba(51,51,106,.95); border: 2px solid var(--gold); text-align: center; }
.done-ic { width: 64px; height: 64px; margin: 0 auto; border-radius: 16px; background: var(--good); border-bottom: 4px solid var(--good-edge); display: flex; align-items: center; justify-content: center; }
.lvup { margin-bottom: 18px; padding: 12px 18px; border-radius: 12px; background: linear-gradient(90deg, #FCE17E, var(--gold), var(--gold-lo)); color: var(--ink); border-bottom: 4px solid var(--gold-edge); text-align: left; }
.streak-box { padding: 18px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line-2); text-align: left; }

/* ===== Papan Coach ===== */
.coach-grid { display: grid; gap: 22px; margin-top: 22px; }
@media (min-width: 1024px) { .coach-grid { grid-template-columns: 7fr 5fr; } }
.metric { padding: 16px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line-2); }
.metric + .metric { margin-top: 14px; }
.metric-bars { position: relative; display: grid; gap: 8px; }
.metric-target { position: absolute; top: 0; bottom: 0; border-left: 2px dashed var(--good-lite); pointer-events: none; }
.mbar-label { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 4px; }
.mbar { height: 14px; border-radius: 4px; background: #1B1A42; overflow: hidden; }
.mbar > i { display: block; height: 100%; border-radius: 4px; }
.mbar.solo > i { background: #A5B4FC; } .mbar.with > i { background: var(--gold); } .mbar.all > i { background: #22C55E; }
.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.days i { aspect-ratio: 1; border-radius: 8px; border: 2px solid var(--line-2); background: #22214A; display: flex; align-items: center; justify-content: center; }
.days i.done { background: #166534; border-color: var(--good-lite); }
.days i.shield { background: #B45309; border-color: var(--gold); }
.days i.miss { background: #22214A; border-color: rgba(255,255,255,.2); }

/* ===== Modal ===== */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(24,24,58,.85); }
.modal[hidden] { display: none; }
.modal-box { width: 100%; max-width: 440px; border-radius: 16px; background: #34346C; border: 2px solid var(--gold); padding: 24px; box-shadow: 0 24px 48px rgba(0,0,0,.4); }
.modal-title { margin-top: 12px; font: 400 30px/1.1 var(--display); letter-spacing: .03em; }
.modal-body { margin: 10px 0 0; color: var(--muted); line-height: 1.6; }
.pin-box { max-width: 380px; margin: 8vh auto 0; }
.pin-input { text-align: center; font-size: 24px !important; letter-spacing: .5em; font-weight: 700; }

/* ===== Navigasi bawah (3 tab) ===== */
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: rgba(50,51,107,.95); border-top: 2px solid rgba(255,255,255,.2); padding-bottom: env(safe-area-inset-bottom); }
.nav-in { max-width: 640px; margin: 0 auto; display: grid; grid-template-columns: repeat(3, 1fr); height: 64px; padding: 0 8px; }
.nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 48px; color: rgba(255,255,255,.8); text-decoration: none; font-size: 12px; font-weight: 700; }
.nav a[aria-current=page] { color: var(--gold); }
html.tv .nav-in { height: 88px; } html.tv .nav a { font-size: 17px; }

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

/* telefon: sorok butang TV supaya cip perisai muat */
.tb-btn.hud-opt { display: none; }
@media (min-width: 520px) { .tb-btn.hud-opt { display: inline-flex; } }
@media (max-width: 519px) { .hud-chip { padding: 6px 10px; } .hud-chip.gold { padding: 6px 12px; } .hud-bar { gap: 4px; } }

/* D-307: soalan berstruktur (UASA) + Latih Bab */
.stem { margin: 10px 0 4px; font-size: var(--fs); line-height: 1.6; white-space: pre-line; color: #fff; }
.part { margin-top: 16px; }
.part-q { display: flex; gap: 8px; align-items: baseline; font-weight: 600; line-height: 1.5; }
.part-q .grow { flex: 1; min-width: 0; }
.part-label { color: var(--gold); font-weight: 800; flex: none; }
.part-mk { flex: none; font-size: 12px; color: var(--gold-pale); font-weight: 600; }
.part-ans { width: 100%; margin-top: 8px; min-height: 76px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line-2);
  background: #23224E; color: #fff; font: 500 15px/1.5 'Inter', sans-serif; resize: vertical; }
.part-ans:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.part-ans[readonly] { opacity: .85; }
.mark-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.mark-btn { min-width: 48px; min-height: 44px; border-radius: 8px; border: 1px solid var(--line-2); background: #2C2B5E; color: #fff;
  font: 800 16px/1 'Inter', sans-serif; cursor: pointer; }
.mark-btn[aria-pressed="true"] { background: var(--gold); color: var(--ink); border-color: var(--gold-edge); }
.lv-item { display: flex; flex-direction: column; gap: 6px; }
.lv-latih { justify-content: center; }
.lv-grid { align-items: stretch; } .lv-item .lv-latih { margin-top: auto; }
.ans-mine { background: rgba(35,34,78,.7); border-color: var(--line-2); }
.ans-mine .kicker { color: #C7D2FE; }
@media (min-width: 1024px) and (max-height: 700px) { .home-stage .home { margin-top: 10px; } .home-side { gap: 10px; } .home-side .btn-hero { min-height: 52px; } .home-stage .plate-title { font-size: 30px; } }
/* D-315: gambar rajah dalam soalan */
.rajah { margin: 12px 0 4px; padding: 12px; background: #fff; border-radius: 10px; text-align: center; }
.rajah img { display: block; max-width: 100%; max-height: 340px; margin: 0 auto; height: auto; }
/* D-315: gambar rajah dalam soalan */
.rajah { margin: 12px 0 4px; padding: 12px; background: #fff; border-radius: 10px; text-align: center; }
.rajah img { display: block; max-width: 100%; max-height: 340px; margin: 0 auto; height: auto; }
/* D-319: kad bab papar nama bab penuh (2 baris) */
.lv-grid .lv-item .lvc-title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: calc(var(--fs) - 1px); line-height: 1.2; }
@media (min-width: 640px) { .lv-grid .lv-item .lvc-title { font-size: var(--fs); } }
html.tv .q-meta { font-size: 24px; }
.btn-latih { min-height: 48px; }
@media (min-width: 1024px) and (max-height: 700px) { .btn-latih { min-height: 42px; } }
@media (min-width: 1024px) and (max-height: 700px) { .home-stage .home-cards { max-width: min(600px, calc(1.5 * (100dvh - 430px) + 28px)); } .home-side .boss-banner, .home-side .reward { padding-top: 10px; padding-bottom: 10px; } }
@media (min-width: 1024px) and (max-height: 640px) { .wrap { padding-top: 4px; padding-bottom: 8px; } .home-stage { min-height: calc(100dvh - 170px); } }
/* D-322: warna butang Latih ikut subjek (teal) */
.btn.btn-latih { background: linear-gradient(180deg, #34d3c0, #14b8a6); color: #053b35; border: 0; border-bottom: 4px solid #0f766e; font-weight: 800; }
.btn.btn-latih:hover { background: linear-gradient(180deg, #5eead4, #2dd4bf); }
.btn.btn-latih .ic { color: #053b35; }
/* D-323: jam undur Lawan Boss */
.boss-timer { position: sticky; top: 70px; z-index: 30; display: flex; align-items: center; justify-content: center; gap: 8px; width: max-content; margin: 14px auto 0;
  padding: 8px 18px; border-radius: 999px; background: #1E1A47; color: #fff; border: 2px solid var(--gold); font: 800 20px/1 'Inter', sans-serif; box-shadow: 0 6px 16px rgba(0,0,0,.25); }
.boss-timer .ic { color: var(--gold); }
.boss-timer.is-low { background: #b91c1c; border-color: #fecaca; }
/* D-325: Latihan Penulisan */
.essay-ans { min-height: 260px; font-size: 16px; line-height: 1.6; }
.essay-count { margin-top: 6px; font-size: 13px; font-weight: 700; color: var(--gold-pale); }
.essay-count.ok { color: #86efac; }
.isi-list { margin: 10px 0 0; padding: 12px 12px 12px 30px; background: rgba(35,34,78,.6); border-radius: 10px; font-size: 14px; line-height: 1.6; }
.essay-body { white-space: pre-wrap; background: #fff; color: #111; padding: 14px; border-radius: 10px; font: 15px/1.7 Georgia, serif; max-height: 420px; overflow: auto; }
.essay-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 6px 0 10px; }
