/* Latihan UH Fisika - Pengukuran & Angka Penting
   Tampilan diadaptasi dari UI kuis LMS: tiga kolom, aksen sian, kartu putih. */

:root {
  --accent: #0b6ea8;
  --accent-soft: #e6f2f9;
  --accent-line: #b8d8ea;
  --ink: #1f2933;
  --ink-soft: #5c6873;
  --bg: #f4f6f9;
  --card: #ffffff;
  --line: #dfe4ea;
  --ok: #15803d;
  --ok-soft: #e8f5ec;
  --bad: #b91c1c;
  --bad-soft: #fdeaea;
  --warn: #b45309;
  --warn-soft: #fdf3e3;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 6px 18px rgba(16, 24, 40, .06);
  --tap: 44px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-optical-sizing: auto;
  padding-bottom: env(safe-area-inset-bottom);
}

h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }

/* ---------- Header ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: rgba(255, 255, 255, .82);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  backdrop-filter: blur(18px) saturate(180%);
  border-bottom: 1px solid var(--line);
}
.topbar .title { font-size: 15px; font-weight: 650; }
.topbar .sub { font-size: 12px; color: var(--ink-soft); }
.topbar .spacer { flex: 1; }
.who {
  display: flex; align-items: center; gap: 8px;
  min-height: var(--tap); padding: 6px 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  font-size: 14px; font-weight: 600;
}
.who .dot {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: #fff; display: grid; place-items: center;
  font-size: 12px; font-weight: 700;
}

/* ---------- Tata letak ---------- */
.wrap {
  display: grid; gap: 16px; padding: 16px;
  max-width: 1240px; margin: 0 auto;
  grid-template-columns: 1fr;
}
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.pad { padding: 16px; }

/* ---------- Peta soal ---------- */
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 52px)); justify-content: start; gap: 6px; }
.tile {
  aspect-ratio: 1; min-height: 34px; border-radius: 8px;
  border: 1px solid var(--line); background: #fff; color: var(--ink-soft);
  font: 600 13px/1 system-ui, sans-serif; cursor: pointer;
  display: grid; place-items: center; position: relative;
}
.tile.done { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.tile.now { outline: 2px solid var(--accent); outline-offset: 1px; color: var(--ink); }
.tile.flag::after { content: ""; position: absolute; top: 3px; right: 3px; width: 6px; height: 6px; border-radius: 50%; background: var(--warn); }
.tile.benar { background: var(--ok-soft); border-color: #bfe0c9; color: var(--ok); }
.tile.salah { background: var(--bad-soft); border-color: #f0c2c2; color: var(--bad); }

.legend { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; font-size: 12px; color: var(--ink-soft); }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; border: 1px solid var(--line); }

/* ---------- Timer ---------- */
.timer { display: flex; gap: 10px; justify-content: center; }
.dial { text-align: center; }
.dial svg { display: block; }
.dial .lab { font-size: 11px; letter-spacing: .06em; color: var(--ink-soft); margin-top: 4px; text-transform: uppercase; }

/* ---------- Soal ---------- */
.qhead { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.qno { font-size: 17px; font-weight: 700; }
.qstate { font-size: 12px; color: var(--ink-soft); }
.qstate.ok { color: var(--ok); font-weight: 600; }
.flagbtn {
  margin-left: auto; background: none; border: 0; color: var(--accent);
  font: 600 13px/1 system-ui, sans-serif; cursor: pointer; padding: 8px; min-height: var(--tap);
}
.flagbtn.on { color: var(--warn); }

.stem {
  background: #f2f7fb; border: 1px solid var(--accent-line);
  border-radius: 10px; padding: 14px; margin: 12px 0;
}
.stem p { margin: 0; }
.stem .figure { margin-top: 12px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.stem .figure svg, .stem .figure img { display: block; width: 100%; height: auto; }

.clue {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--warn-soft); border: 1px solid #f0d9ae; color: #6b4a10;
  border-radius: 10px; padding: 12px 14px; margin: 12px 0; font-size: 14px;
}
.clue b { font-weight: 700; }

.answer label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-soft); margin-bottom: 6px; }
.answer input {
  width: 100%; min-height: var(--tap);
  font: 500 17px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  padding: 10px 14px; color: var(--ink);
  border: 1.5px solid var(--line); border-radius: 10px; background: #fff;
}
.answer input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.answer .unit { font-size: 13px; color: var(--ink-soft); margin-top: 6px; }

/* ---------- Tombol ---------- */
.btnrow { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.btn {
  min-height: var(--tap); padding: 0 18px; border-radius: 10px;
  font: 600 15px/1 system-ui, sans-serif; cursor: pointer;
  border: 1.5px solid var(--line); background: #fff; color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { border-color: transparent; color: var(--accent); }
.btn.wide { width: 100%; }

/* ---------- Hasil ---------- */
.score { text-align: center; padding: 8px 0 4px; }
.score .big { font-size: 52px; font-weight: 750; letter-spacing: -.02em; line-height: 1; }
.score .of { font-size: 15px; color: var(--ink-soft); margin-top: 6px; }

.review { display: grid; gap: 10px; }
.item { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: #fff; }
.item.right { border-color: #bfe0c9; background: var(--ok-soft); }
.item.wrong { border-color: #f0c2c2; background: var(--bad-soft); }
.item .row { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.item .tag { font: 700 12px/1 system-ui, sans-serif; padding: 6px 9px; border-radius: 999px; background: #fff; border: 1px solid var(--line); }
.item.right .tag { color: var(--ok); }
.item.wrong .tag { color: var(--bad); }
.item .ans { font-family: ui-monospace, Menlo, monospace; font-size: 14px; }
.item .why { font-size: 13px; color: var(--ink-soft); margin-top: 8px; }

.note { font-size: 13px; background: #fff8e6; border: 1px solid #f0dca8; color: #6b4a10; border-radius: 8px; padding: 10px 12px; margin-top: 10px; }

/* ---------- Tablet & desktop ---------- */
@media (min-width: 760px) {
  .wrap { grid-template-columns: 200px minmax(0, 1fr); align-items: start; }
  .side-right { grid-column: 2; }
  .qmap { position: sticky; top: 84px; }
}
@media (min-width: 1120px) {
  .wrap { grid-template-columns: 220px minmax(0, 1fr) 300px; }
  .side-right { grid-column: 3; }
}
@media (max-width: 759px) {
  .topbar .sub { display: none; }
}

nav.kiri a {
  display: flex; align-items: center; gap: 10px; min-height: var(--tap);
  padding: 8px 12px; border-radius: 10px; color: var(--ink);
  text-decoration: none; font-size: 14px; font-weight: 550;
}
nav.kiri a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
nav.kiri a:hover { background: #f0f3f7; }

.hint { font-size: 12px; color: var(--ink-soft); }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

@media print {
  .topbar, nav.kiri, .qmap, .btnrow, .clue { display: none; }
  body { background: #fff; }
}