:root {
  color-scheme: light;
  --ink: #122027;
  --muted: #5c6c74;
  --line: #d7e1e6;
  --bg: #eef3f5;
  --card: #fff;
  --teal: #0c7490;
  --teal-soft: #e7f5f8;
  --green: #157a45;
  --green-soft: #e8f6ee;
  --danger: #9f2d45;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font: 16px/1.45 system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  padding-bottom: calc(4.6rem + env(safe-area-inset-bottom));
}
header, main { padding: 0.85rem 1rem; }
header { padding-bottom: 0.35rem; }
.head-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}
.images-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.65rem;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 650;
}
.images-toggle input {
  appearance: none;
  width: 2.75rem;
  height: 1.6rem;
  margin: 0;
  border-radius: 999px;
  background: #c5d0d6;
  position: relative;
  flex: none;
}
.images-toggle input::after {
  content: "";
  position: absolute;
  top: 0.16rem;
  left: 0.16rem;
  width: 1.28rem;
  height: 1.28rem;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s ease;
}
.images-toggle input:checked { background: var(--teal); }
.images-toggle input:checked::after { transform: translateX(1.15rem); }
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 0.28rem; }
.brand strong { letter-spacing: -0.02em; }
#pack-title { color: var(--muted); text-align: right; max-width: 46%; font-size: 0.92rem; }
.pill {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  padding: 0.16rem 0.55rem;
  border-radius: 999px;
}
.pill.exam { background: var(--teal-soft); color: var(--teal); }
.pill.learn { background: var(--green-soft); color: var(--green); }
h1 { font-size: 1.35rem; margin: 0 0 0.35rem; letter-spacing: -0.02em; }
h2 { font-size: 1rem; margin: 1rem 0 0.4rem; }
p { margin: 0.35rem 0; }
.lead { color: var(--muted); margin-top: 0; }
.card {
  background: var(--card);
  border-radius: 16px;
  padding: 1rem;
  margin: 0.75rem 0;
  box-shadow: 0 1px 0 rgba(18, 32, 39, 0.04);
}
button.action, button.ghost, a.action, a.ghost, button.danger {
  width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 0.9rem 1rem;
  font: inherit;
  text-align: left;
  margin-top: 0.7rem;
}
button.action, a.action { background: var(--teal); color: #fff; font-weight: 700; }
button.ghost, a.ghost { background: var(--card); color: var(--ink); }
a.action, a.ghost { display: block; text-align: center; text-decoration: none; }
button.danger {
  background: #fff;
  color: var(--danger);
  font-weight: 700;
  box-shadow: inset 0 0 0 1px #f0d0d6;
}
button.mode {
  width: 100%;
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  text-align: left;
  margin-top: 0.75rem;
  padding: 1rem;
  border: 0;
  border-radius: 16px;
  background: var(--card);
  font: inherit;
  color: var(--ink);
  box-shadow: 0 1px 0 rgba(18, 32, 39, 0.04);
}
button.mode strong { display: block; font-size: 1.05rem; }
.mode-icon {
  flex: none;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 12px;
  display: grid;
  place-items: center;
}
.mode-icon svg { width: 1.35rem; height: 1.35rem; }
.mode-icon.exam { background: var(--teal-soft); color: var(--teal); }
.mode-icon.learn { background: var(--green-soft); color: var(--green); }
.hint { display: block; font-weight: 450; font-size: 0.88rem; color: var(--muted); margin-top: 0.25rem; }
.resume { display: block; margin-top: 0.45rem; color: var(--teal); font-weight: 700; font-size: 0.88rem; }
.progress-top { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.progress-top p { margin: 0; font-weight: 700; color: var(--muted); font-size: 0.92rem; }
button.quiet {
  border: 0;
  background: transparent;
  color: var(--danger);
  font: inherit;
  font-weight: 700;
  padding: 0.35rem 0.15rem;
}
.track { height: 4px; margin-top: 0.55rem; background: #e1e8eb; border-radius: 99px; overflow: hidden; }
.track span { display: block; height: 100%; background: var(--teal); border-radius: 99px; }
.track.learn span { background: var(--green); }
.note { margin: 0.35rem 0 0; color: var(--green); font-size: 0.88rem; font-weight: 650; }
.opt {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  text-align: left;
  margin-top: 0.55rem;
  padding: 0.8rem 0.85rem;
  min-height: 3rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  font: inherit;
  color: var(--ink);
}
.badge {
  width: 1.3rem;
  height: 1.3rem;
  border-radius: 999px;
  border: 2px solid #c5d0d6;
  flex: none;
  display: grid;
  place-items: center;
  font-size: 0.78rem;
  line-height: 1;
}
.opt.on { border-color: var(--teal); background: var(--teal-soft); }
.opt.on .badge { border-color: var(--teal); box-shadow: inset 0 0 0 4px var(--teal); }
.opt.correct { border-color: var(--green); background: var(--green-soft); color: #145c32; font-weight: 650; }
.opt.correct .badge { border: 0; background: var(--green); color: #fff; }
.opt.idle { color: var(--muted); background: #f7f9fa; }
.opt:disabled { opacity: 1; }
.row { display: flex; gap: 0.55rem; margin-top: 0.85rem; }
.row button { flex: 1; margin-top: 0; text-align: center; font-weight: 700; }
.row button:disabled { opacity: 0.45; }
img.q { width: 100%; border-radius: 12px; margin: 0 0 0.75rem; background: #fff; }
.mark {
  margin: 0.85rem 0 0;
  text-align: right;
  font-size: 0.72rem;
  color: rgba(18, 32, 39, 0.28);
  pointer-events: none;
}
.score { font-size: 3rem; font-weight: 700; letter-spacing: -0.04em; margin: 0.2rem 0; color: var(--teal); }
.score-of { color: var(--muted); margin-top: 0; }
nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: flex;
  gap: 0.4rem;
  padding: 0.35rem 0.7rem calc(0.4rem + env(safe-area-inset-bottom));
  background: #fff;
  border-top: 1px solid #e2e8eb;
  z-index: 5;
}
nav button {
  flex: 1;
  border: 0;
  background: transparent;
  font: inherit;
  padding: 0.4rem 0.2rem 0.3rem;
  border-radius: 12px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  font-size: 0.75rem;
  font-weight: 650;
}
nav button svg { width: 1.3rem; height: 1.3rem; }
nav button.on { background: var(--teal-soft); color: var(--teal); }
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
td { padding: 0.4rem 0.2rem; border-bottom: 1px solid #e8eeef; vertical-align: top; }
.err { color: var(--danger); }
.sheet-back {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(18, 32, 39, 0.46);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0.8rem;
}
.sheet {
  width: min(100%, 28rem);
  background: #fff;
  border-radius: 20px;
  padding: 1.15rem 1rem calc(0.9rem + env(safe-area-inset-bottom));
}
.sheet h2 { margin-top: 0; font-size: 1.15rem; }
.sheet p { color: var(--muted); }
.sheet button { text-align: center; }
