:root {
  --page: #EEF4F5;
  --sheet: #FFFFFF;
  --print: #2E7A8C;      /* マークシートの印刷色 */
  --print-dark: #246574;
  --print-soft: #D3E6EA;
  --ink: #1C2331;        /* 鉛筆で塗った色 */
  --muted: #566870;
  --ok: #2F7A3E;
  --ok-soft: #E8F3EA;
  --ng: #B8322A;
  --ng-soft: #F9E9E7;
  --font: "BIZ UDPGothic", "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.75;
  -webkit-text-size-adjust: 100%;
}

.bar {
  max-width: 44rem;
  margin: 0 auto;
  padding: 1rem 1.25rem 0.5rem;
}

.brand {
  font-weight: 700;
  font-size: 1.0625rem;
  color: var(--print);
  text-decoration: none;
  letter-spacing: 0.1em;
}

/* 用紙。左端にマークシートのタイミングマークを模した刻み */
.sheet {
  position: relative;
  max-width: 44rem;
  min-height: 60vh;
  margin: 0 auto 3rem;
  padding: 1.5rem 1.25rem 2rem 2rem;
  background: var(--sheet);
  border-top: 4px solid var(--print);
}
.sheet::before {
  content: "";
  position: absolute;
  left: 0.6rem;
  top: 1.5rem;
  bottom: 1.5rem;
  width: 6px;
  background: repeating-linear-gradient(to bottom, var(--ink) 0 3px, transparent 3px 20px);
  opacity: 0.35;
}
@media (min-width: 40rem) {
  .sheet { padding: 2rem 2.5rem 2.5rem 3rem; border-radius: 0 0 6px 6px; }
  .sheet::before { left: 1.1rem; }
}

h1 { font-size: 1.5rem; line-height: 1.4; margin: 0 0 1rem; }
h2 { font-size: 1.1875rem; line-height: 1.45; margin: 0; }

button { font: inherit; }
:focus-visible { outline: 3px solid var(--print); outline-offset: 2px; }

.primary, .secondary {
  min-height: 44px;
  padding: 0.6rem 1.25rem;
  border-radius: 4px;
  font-weight: 700;
  cursor: pointer;
}
.primary { background: var(--print); color: #fff; border: 1.5px solid var(--print); }
.primary:hover { background: var(--print-dark); }
.primary:disabled { background: #A9C6CD; border-color: #A9C6CD; cursor: not-allowed; }
.secondary { background: #fff; color: var(--print); border: 1.5px solid var(--print); }
.secondary:hover { background: #F2F8F9; }
.secondary:disabled { color: #9DB0B5; border-color: #CFDCDF; background: #fff; cursor: not-allowed; }
.link {
  background: none; border: 0; padding: 0.5rem 0;
  color: var(--muted); text-decoration: underline; cursor: pointer;
}

.actions {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 0.75rem; margin-top: 1.25rem;
}

/* ホーム */
.opt { display: flex; align-items: center; gap: 0.5rem; margin: 0 0 0.5rem; font-size: 0.9375rem; }
.opt input { width: 1.1rem; height: 1.1rem; accent-color: var(--print); }
.sets { list-style: none; margin: 0; padding: 0; border-top: 1px dashed var(--print-soft); }
.set { padding: 1.25rem 0; border-bottom: 1px dashed var(--print-soft); }
.stats { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.875rem; }
.errors { margin: 0.5rem 0 0; padding-left: 1.25rem; color: var(--ng); font-size: 0.875rem; }
.empty { color: var(--muted); }

/* 出題 */
.strip { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 1.25rem; }
.cell { width: 10px; height: 14px; border: 1.5px solid var(--print-soft); border-radius: 50%; }
.cell.now { border-color: var(--ink); }
.cell.ok { background: var(--ok); border-color: var(--ok); }
.cell.ng { background: var(--ng); border-color: var(--ng); }

.q-meta { display: flex; justify-content: space-between; gap: 1rem; font-size: 0.875rem; color: var(--muted); }
.q-text { font-size: 1.125rem; font-weight: 700; white-space: pre-wrap; margin: 0.25rem 0 0; }
.q-text:focus { outline: none; }
.instr { margin: 0.5rem 0 0; color: var(--print); font-size: 0.9375rem; font-weight: 700; }

.choices { list-style: none; margin: 1rem 0 0; padding: 0; border-top: 1px dashed var(--print-soft); }
.choices li { border-bottom: 1px dashed var(--print-soft); }
.choice {
  display: flex; align-items: flex-start; gap: 0.875rem;
  width: 100%; padding: 0.8rem 0.5rem;
  background: none; border: 0; border-left: 4px solid transparent;
  color: inherit; text-align: left; line-height: 1.6; cursor: pointer;
}
.choice:hover { background: #F5FAFB; }
.choice:focus-visible { outline-offset: -3px; }
.choice[aria-disabled="true"] { cursor: default; }
.choice[aria-disabled="true"]:hover { background: none; }

.bubble {
  flex: none;
  display: inline-grid; place-items: center;
  width: 2.25rem; height: 1.5rem; margin-top: 0.05rem;
  border: 1.5px solid var(--print); border-radius: 50%;
  color: var(--print); font-size: 0.8125rem; font-weight: 700; line-height: 1;
  transition: background-color 0.12s, color 0.12s;
}
.choices.multi .bubble { border-radius: 6px; }
.choice.is-selected .bubble { background: var(--ink); border-color: var(--ink); color: #fff; }
.choice-text { flex: 1; }

.choice.is-correct, .choice.is-correct:hover { border-left-color: var(--ok); background: var(--ok-soft); }
.choice.is-wrong, .choice.is-wrong:hover { border-left-color: var(--ng); background: var(--ng-soft); }
.tag {
  flex: none; align-self: center;
  padding: 0.1rem 0.5rem; border-radius: 3px;
  color: #fff; font-size: 0.75rem; font-weight: 700;
}
.tag.ok { background: var(--ok); }
.tag.ng { background: var(--ng); }

.feedback { margin-top: 1.25rem; padding: 0.9rem 1.1rem; border-left: 4px solid; }
.feedback.ok { border-color: var(--ok); background: var(--ok-soft); }
.feedback.ng { border-color: var(--ng); background: var(--ng-soft); }
.verdict { margin: 0; font-weight: 700; }
.explanation { margin: 0.4rem 0 0; white-space: pre-wrap; }

/* 結果 */
.score { margin: 0; font-size: 2.5rem; font-weight: 700; line-height: 1.2; }
.score small { margin-left: 0.5rem; font-size: 1rem; font-weight: 400; color: var(--muted); }
.review { list-style: none; margin: 1.5rem 0 0; padding: 0; border-top: 1px dashed var(--print-soft); }
.review li { padding: 1rem 0; border-bottom: 1px dashed var(--print-soft); }
.review .q { margin: 0; white-space: pre-wrap; }
.review .a { margin: 0.25rem 0 0; color: var(--ok); font-size: 0.9375rem; }

.message { color: var(--ng); white-space: pre-wrap; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

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