/* ============================================================
   Review test paper. Mobile-first, printable, and readable in a
   screen share. Palette comes from the page's theme file.
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  font-family: 'Jost', 'Inter', sans-serif;
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  width: 100%; max-width: 760px; margin: 0 auto;
  padding: calc(18px + env(safe-area-inset-top)) 18px calc(120px + env(safe-area-inset-bottom));
}

.back { display: inline-block; margin-bottom: 14px; font-size: 14px;
  color: var(--ink-soft); text-decoration: none; }
.back:hover { color: var(--ink); }

.head { text-align: center; margin-bottom: 22px; }
.head h1 {
  font-family: 'EB Garamond', serif;
  font-size: clamp(27px, 6vw, 38px); font-weight: 600; line-height: 1.1;
}
.head p { margin-top: 8px; font-size: 14.5px; color: var(--ink-soft); }

/* Sticky status bar */
.bar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 14px; margin-bottom: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md, 10px);
  box-shadow: 0 4px 14px rgba(0,0,0,0.05);
  font-size: 14px;
}
.bar b { font-weight: 600; }
.bar .saved { color: var(--known, #3A7D5C); font-size: 12.5px; }

.part-head { margin: 34px 0 16px; padding-bottom: 10px; border-bottom: 2px solid var(--ink); }
.part-head h2 {
  font-family: 'EB Garamond', serif; font-size: 23px; font-weight: 600;
}
.part-head p { margin-top: 3px; font-size: 14px; color: var(--ink-soft); }

/* Question */
.q {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid transparent;
  border-radius: var(--r-md, 10px);
  padding: 16px 16px 14px;
  margin-bottom: 12px;
}
.q-head { display: flex; gap: 12px; align-items: flex-start; }
.q-n {
  flex: 0 0 auto; min-width: 26px;
  font-family: 'EB Garamond', serif; font-size: 19px; font-weight: 600;
  color: var(--ink-soft); opacity: 0.7; line-height: 1.35;
}
.q-prompt { flex: 1 1 auto; min-width: 0; }
.q-def { font-size: 16px; line-height: 1.45; }
.q-img {
  display: block; width: min(60%, 170px); aspect-ratio: 1/1; object-fit: contain;
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  padding: 8px; margin-bottom: 8px;
}
.q-type {
  display: inline-block; margin-top: 7px;
  font-size: 11px; letter-spacing: 0.6px; text-transform: uppercase;
  color: var(--ink-soft); border: 1px solid var(--line);
  border-radius: 5px; padding: 2px 7px;
}

.q-input {
  width: 100%; margin-top: 12px; padding: 12px 13px;
  font-family: inherit; font-size: 16px;   /* 16px stops iOS zooming */
  color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px;
}
.q-input:focus { outline: none; border-color: var(--accent); background: var(--surface); }

.q-opts { margin-top: 12px; display: flex; flex-direction: column; gap: 7px; }
.q-opt {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 13px; font-size: 15px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  cursor: pointer;
}
.q-opt:hover { border-color: var(--ink-soft); }
.q-opt input { accent-color: var(--accent); width: 17px; height: 17px; flex: 0 0 auto; }

/* Marked up after submitting */
.q.right { border-left-color: var(--known, #3A7D5C); }
.q.wrong { border-left-color: var(--learn, #A66A2C); }
.q-mark { margin-top: 10px; font-size: 13.5px; font-weight: 600; }
.q.right .q-mark { color: var(--known, #3A7D5C); }
.q.wrong .q-mark { color: var(--learn, #A66A2C); }

.result {
  display: none;
  margin-bottom: 18px; padding: 15px 16px;
  font-size: 16px; font-weight: 600;
  background: var(--surface); border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-md, 10px);
}
.result.show { display: block; }

/* Actions pinned to the bottom so Submit is always reachable */
.actions {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 12;
  display: flex; gap: 10px; justify-content: center;
  padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
.btn {
  font-family: inherit; font-size: 15px; font-weight: 600; letter-spacing: 0.2px;
  padding: 13px 22px; border-radius: 8px; border: 1px solid transparent; cursor: pointer;
}
.btn-main { background: var(--accent); color: var(--on-front); flex: 1 1 auto; max-width: 320px; }
.btn-main:disabled { opacity: 0.6; cursor: default; }
.btn-ghost { background: transparent; color: var(--ink-soft); border-color: var(--line); }
.btn-ghost:hover { color: var(--ink); border-color: var(--ink-soft); }

@media print {
  .bar, .actions, .back { display: none; }
  .q { break-inside: avoid; }
}
