:root {
  color-scheme: light;
  --navy: #100060;
  --navy-strong: #171345;
  --blue: #0080c0;
  --cyan-soft: #e8f7fb;
  --yellow: #ffff00;
  --ink: #17233d;
  --muted: #66758f;
  --border: #dbe6f0;
  --surface: rgba(255, 255, 255, 0.94);
  --background: #eef5fb;
  --danger: #b42318;
  --success: #137a54;
  --shadow: 0 18px 48px rgba(16, 0, 96, 0.11);
  --radius-lg: 24px;
  --radius-md: 16px;
  font-family: Inter, "Plus Jakarta Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--background); }
body {
  min-width: 320px;
  min-height: 100dvh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 5%, rgba(0, 128, 192, 0.18), transparent 28rem),
    linear-gradient(155deg, #f8fbff 0%, #edf4fb 54%, #eef0ff 100%);
}
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.skip-link { position: fixed; top: -80px; left: 16px; z-index: 100; padding: 10px 14px; color: white; background: var(--navy); }
.skip-link:focus { top: 12px; }
.app-shell { width: min(100%, 620px); min-height: 100dvh; margin: 0 auto; }
.screen { min-height: 100dvh; padding: max(20px, env(safe-area-inset-top)) 20px max(22px, env(safe-area-inset-bottom)); }
.screen[hidden] { display: none; }
.screen.is-active { animation: screen-in 180ms ease-out; }

.brand-header, .topbar, .test-header { display: flex; align-items: center; gap: 12px; min-height: 56px; }
.brand-header { padding-bottom: 24px; }
.brand-mark { display: grid; flex: 0 0 48px; width: 48px; height: 48px; place-items: center; border-radius: 14px; color: white; background: var(--navy); font-size: 13px; font-weight: 900; letter-spacing: .05em; }
.brand-name, .brand-product, .topbar-kicker, .topbar-title { margin: 0; }
.brand-name { font-weight: 800; }
.brand-product, .topbar-kicker { margin-top: 2px; color: var(--muted); font-size: 13px; }
.topbar > div, .test-header > div:nth-child(2) { min-width: 0; flex: 1; }
.topbar-title { overflow: hidden; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.topbar-kicker { text-transform: uppercase; letter-spacing: .08em; font-weight: 800; }
.status-chip, .timer { padding: 9px 12px; border-radius: 999px; color: var(--navy); background: var(--cyan-soft); font-size: 14px; font-weight: 850; font-variant-numeric: tabular-nums; white-space: nowrap; }

.access-layout { display: grid; gap: 24px; align-content: center; min-height: calc(100dvh - 120px); padding-bottom: 8vh; }
.access-copy h1, .intro-card h1, .completion-card h1 { margin: 7px 0 12px; font-size: clamp(30px, 8vw, 46px); line-height: 1.07; letter-spacing: -.035em; }
.access-copy > p:last-child, .intro-card > p:last-child, .completion-card > p { margin: 0; color: var(--muted); font-size: 16px; line-height: 1.65; }
.eyebrow { margin: 0; color: var(--blue); font-size: 13px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.access-card, .intro-card, .example-card, .notice, .completion-card { border: 1px solid rgba(255,255,255,.9); background: var(--surface); box-shadow: var(--shadow); }
.access-card { display: grid; gap: 18px; padding: 24px; border-radius: var(--radius-lg); }
.field { display: grid; gap: 8px; }
.field label { font-size: 14px; font-weight: 800; }
.field input { width: 100%; min-height: 52px; padding: 13px 15px; border: 1px solid var(--border); border-radius: 12px; color: var(--ink); background: white; }
.field input:focus { outline: 3px solid rgba(0,128,192,.17); border-color: var(--blue); }
.form-message { min-height: 22px; margin: -4px 0 0; color: var(--danger); font-size: 14px; line-height: 1.45; }

.content-stack { display: grid; gap: 16px; margin: 24px 0 118px; }
.intro-card { padding: 26px; border-radius: var(--radius-lg); }
.instruction-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.instruction-grid div { display: grid; gap: 3px; padding: 16px 8px; border: 1px solid var(--border); border-radius: 14px; text-align: center; background: rgba(255,255,255,.7); }
.instruction-grid strong { color: var(--navy); font-size: 23px; }
.instruction-grid span { color: var(--muted); font-size: 12px; line-height: 1.25; }
.example-card { display: grid; grid-template-columns: 82px 1fr; gap: 20px; align-items: center; padding: 20px; border-radius: var(--radius-md); }
.example-numbers { display: grid; gap: 7px; }
.example-numbers span { display: grid; min-height: 44px; place-items: center; border: 1px solid var(--border); border-radius: 10px; background: white; font-size: 22px; font-weight: 900; }
.example-card p, .example-card small { margin: 0; color: var(--muted); }
.example-card strong { display: block; margin: 4px 0; font-size: 20px; }
.notice { padding: 16px 18px; border-radius: var(--radius-md); color: #48566e; font-size: 14px; line-height: 1.55; }

.bottom-actions { position: fixed; right: max(20px, calc((100vw - 580px) / 2)); bottom: 0; left: max(20px, calc((100vw - 580px) / 2)); z-index: 10; padding: 22px 0 max(18px, env(safe-area-inset-bottom)); background: linear-gradient(180deg, rgba(238,245,251,0), rgba(238,245,251,.98) 30%); }
.two-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.button { display: inline-flex; min-height: 54px; align-items: center; justify-content: center; padding: 13px 16px; border: 1px solid transparent; border-radius: 14px; font-weight: 850; cursor: pointer; }
.button-primary { color: var(--navy); background: var(--yellow); box-shadow: 0 12px 26px rgba(100,92,0,.14); }
.button-primary:hover { background: #fff83a; }
.button-secondary { border-color: #b9c8d8; color: var(--ink); background: rgba(255,255,255,.75); }
.button-full { width: 100%; }
.button:focus-visible, .icon-button:focus-visible, .text-button:focus-visible, .keypad button:focus-visible { outline: 3px solid rgba(0,128,192,.3); outline-offset: 2px; }
.button:disabled { cursor: wait; opacity: .6; }
.text-button { min-height: 48px; border: 0; color: var(--navy); background: transparent; font-weight: 800; cursor: pointer; }
.icon-button { display: grid; flex: 0 0 48px; width: 48px; height: 48px; place-items: center; border: 1px solid var(--border); border-radius: 14px; color: var(--ink); background: white; font-size: 24px; cursor: pointer; }

.test-screen { display: grid; grid-template-rows: auto auto minmax(0,1fr) auto; }
.test-header h1, .topbar h1 { margin: 2px 0 0; font-size: 21px; }
.progress-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 13px; margin: 18px 0 8px; }
.progress-row p { margin: 0; color: var(--muted); font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; }
.progress-track { height: 7px; overflow: hidden; border-radius: 99px; background: rgba(255,255,255,.85); }
.progress-track span { display: block; width: 2%; height: 100%; border-radius: inherit; background: var(--blue); transition: width 180ms ease; }
.test-stage { display: grid; align-content: center; gap: 14px; min-height: 0; padding: 20px 0 12px; }
.main-stage { align-content: stretch; grid-template-rows: auto minmax(320px,1fr) auto; }
.stage-help { margin: 0; color: var(--muted); text-align: center; font-size: 14px; }
.number-stack { display: grid; min-height: 330px; align-content: center; gap: 7px; padding: 10px 8px; border-radius: var(--radius-lg); }
.number-row, .answer-row { display: grid; min-height: 52px; place-items: center; border: 1px solid rgba(255,255,255,.9); border-radius: 15px; background: rgba(255,255,255,.88); box-shadow: 0 7px 18px rgba(39,43,82,.055); font-size: 25px; font-weight: 900; font-variant-numeric: tabular-nums; }
.number-row.is-pair { border-color: rgba(0,128,192,.45); background: white; }
.answer-row { border: 2px solid rgba(16,0,96,.32); color: var(--navy); background: #eff1ff; }
.answer-row::after { content: "Pilih jawaban"; color: #6b7190; font-size: 13px; font-weight: 750; }
.answer-row.has-value::after { content: attr(data-value); color: var(--navy); font-size: 24px; }
.feedback { min-height: 27px; margin: 0; text-align: center; font-weight: 800; }
.feedback.is-correct { color: var(--success); }
.feedback.is-wrong { color: var(--danger); }
.column-actions { display: grid; grid-template-columns: .9fr 1.1fr; gap: 10px; }
.keypad { display: grid; grid-template-columns: repeat(5, 1fr); gap: 9px; padding: 9px 0 max(6px, env(safe-area-inset-bottom)); }
.keypad button { min-height: 57px; border: 1px solid var(--border); border-radius: 14px; color: var(--ink); background: rgba(255,255,255,.92); box-shadow: 0 5px 14px rgba(35,38,74,.06); font-size: 20px; font-weight: 900; cursor: pointer; touch-action: manipulation; }
.keypad button:active { transform: scale(.96); background: var(--cyan-soft); }

.completion-card { display: grid; width: min(100%, 480px); margin: max(11vh, 60px) auto 0; padding: 34px 28px; border-radius: var(--radius-lg); text-align: center; }
.completion-icon { display: grid; width: 68px; height: 68px; margin: 0 auto 22px; place-items: center; border-radius: 50%; color: white; background: var(--success); font-size: 30px; font-weight: 900; }
.spinner { width: 54px; height: 54px; margin: 0 auto 24px; border: 5px solid #dfe9f3; border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; }
.reference-code { margin-top: 18px !important; color: var(--navy) !important; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-weight: 800; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes screen-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@media (min-width: 720px) {
  body { padding: 24px 0; }
  .app-shell { min-height: calc(100dvh - 48px); overflow: hidden; border: 1px solid rgba(255,255,255,.8); border-radius: 30px; box-shadow: 0 25px 80px rgba(31,38,84,.15); }
  .screen { min-height: calc(100dvh - 48px); }
  .bottom-actions { bottom: 24px; }
}
@media (max-width: 420px) {
  .instruction-grid { grid-template-columns: 1fr; }
  .instruction-grid div { grid-template-columns: auto 1fr; align-items: center; text-align: left; gap: 12px; }
  .two-columns, .column-actions { grid-template-columns: 1fr; }
  .content-stack { margin-bottom: 180px; }
}
@media (max-height: 720px) {
  .main-stage { grid-template-rows: auto minmax(245px,1fr) auto; }
  .number-stack { min-height: 245px; gap: 4px; }
  .number-row, .answer-row { min-height: 42px; }
  .keypad button { min-height: 48px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
