/* 画面の見た目（トップ・種類のページ・印刷ページのまわり）。紙の中は print.css */

@font-face {
  font-family: "UD Num";
  src: local("BIZ UDGothic"), local("BIZ UDゴシック"), local("BIZUDGothic-Regular");
  font-weight: 400;
}

:root {
  --desk: #E9EDF0;
  --paper: #FFFFFF;
  --ink: #1F262D;
  --sub: #5A6570;
  --navy: #23436B;
  --rule: #B9C2CA;
  --line: #7D8893;
  --focus: #23436B;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--desk);
  color: var(--ink);
  font-family: "BIZ UDPゴシック", "BIZ UDPGothic", sans-serif;
  font-size: 18px;
  line-height: 1.8;
}

a { color: var(--navy); text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

h1, h2, h3 { line-height: 1.4; margin: 0; }
h1 { font-size: 28px; }
h2 { font-size: 22px; }

/* 外枠 */
.wrap {
  max-width: 940px;
  margin: 0 auto;
  padding: 0 16px;
}
.bar {
  border-bottom: 1px solid var(--rule);
}
.bar .wrap,
.bar > .logo {
  display: block;
  max-width: 940px;
  margin: 0 auto;
  padding: 14px 16px;
}
.logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
}
.logo:hover { text-decoration: underline; }

.foot {
  margin-top: 72px;
  border-top: 1px solid var(--rule);
  padding: 24px 0 40px;
  color: var(--sub);
  font-size: 16px;
}
.foot ul {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 28px;
  margin: 0 0 8px;
  padding: 0;
  list-style: none;
}

/* 読みもの */
.prose { max-width: 40em; }
.prose p { margin: 0 0 1em; }
.prose h2 { margin: 48px 0 12px; }
.lead {
  max-width: 34em;
  margin: 12px 0 0;
}

/* トップ */
.top-head { padding: 48px 0 32px; }
.top-head h1 { font-size: 30px; }

.kinds {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--rule);
}
.kinds li { border-bottom: 1px solid var(--rule); }
.kind {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px 32px;
  padding: 24px 4px;
  color: var(--ink);
  text-decoration: none;
}
.kind h2 {
  color: var(--navy);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.25em;
}
.kind:hover h2 { text-decoration-thickness: 3px; }
.kind p { margin: 4px 0 0; color: var(--sub); }

/* 種類ごとの見本の問題（本物の数字の形で見せる） */
.sample {
  font-family: "UD Num", "BIZ UDGothic", monospace;
  font-size: 30px;
  line-height: 1.2;
  white-space: nowrap;
}
.sample .op { margin: 0 0.2em; }
.sample .box {
  display: inline-block;
  width: 1.3em;
  height: 1.15em;
  border: 2px solid var(--ink);
  vertical-align: -0.2em;
}
.mini { justify-self: end; }
.mini .row {
  display: flex;
  justify-content: center;
}
.mini .cell {
  width: 1.7em;
  height: 1.25em;
  margin: 0 0 -1px -1px;
  border: 1px solid var(--line);
  font-size: 22px;
  line-height: 1.2em;
  text-align: center;
}

.steps {
  max-width: 40em;
  margin: 0;
  padding-left: 1.6em;
}
.steps li { margin-bottom: 6px; }

/* 種類のページ：設定 */
.setup {
  margin-top: 28px;
  padding: 28px 24px 32px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 4px;
}
.top-head + .setup { margin-top: 0; }
.opts {
  margin: 0 0 28px;
  padding: 0;
  border: 0;
  min-width: 0;
}
.opts legend {
  padding: 0;
  margin-bottom: 10px;
  font-size: 20px;
  font-weight: 700;
}
.opts .note {
  margin: -6px 0 10px;
  color: var(--sub);
  font-size: 16px;
}
.choice {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.choice label { position: relative; }
.choice input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}
.choice span {
  display: flex;
  align-items: center;
  min-height: 56px;
  padding: 6px 22px;
  border: 2px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  font-size: 19px;
  line-height: 1.4;
}
.choice label:hover span { border-color: var(--navy); }
.choice input:checked + span {
  border-color: var(--navy);
  background: var(--navy);
  color: #fff;
  font-weight: 700;
}
.choice input:focus-visible + span {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

/* 前と同じ問題を作る（番号） */
.again { margin: 0 0 28px; }
.again summary {
  display: list-item;
  padding: 8px 0;
  color: var(--navy);
  font-weight: 700;
  cursor: pointer;
}
.again .note { margin: 4px 0 10px; color: var(--sub); font-size: 16px; }
.seed { font-weight: 700; }
.seed input {
  width: 8em;
  min-height: 52px;
  margin-left: 8px;
  padding: 4px 12px;
  border: 2px solid var(--line);
  border-radius: 6px;
  font-family: "UD Num", "BIZ UDGothic", monospace;
  font-size: 22px;
}

.prose .mini { display: inline-block; margin: 4px 0 16px; }
.prose ul { margin: 0 0 1em; padding-left: 1.4em; }
.prose li { margin-bottom: 6px; }

/* ボタン */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 8px 28px;
  border: 2px solid var(--navy);
  border-radius: 6px;
  background: var(--paper);
  color: var(--navy);
  font: inherit;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: #F2F5F8; }
.btn.main {
  background: var(--navy);
  color: #fff;
}
.btn.main:hover { background: #1A3456; }
.setup .btn.main { min-width: 15em; }

/* 印刷ページ：机の上に紙 */
.desk {
  max-width: 940px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}
.tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
}
.back { margin-left: 8px; }
.hint {
  margin: 12px 0 24px;
  color: var(--sub);
}
.sheets {
  max-width: 760px;
}
.sheets .sheet {
  margin-bottom: 36px;
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(31, 38, 45, 0.14), 0 10px 28px rgba(31, 38, 45, 0.10);
}
.msg {
  max-width: 34em;
  padding: 24px;
  background: var(--paper);
  border: 1px solid var(--rule);
}

/* スマホ */
@media (max-width: 600px) {
  .top-head { padding: 32px 0 24px; }
  .top-head h1 { font-size: 26px; }
  .kind { grid-template-columns: 1fr; padding: 20px 4px; }
  .sample { font-size: 26px; }
  .mini { justify-self: start; }
  .setup { padding: 20px 14px 24px; margin-left: -4px; margin-right: -4px; }
  .choice span { padding: 6px 16px; }
  .setup .btn.main, .tools .btn { width: 100%; }
  .back { margin-left: 0; }
}

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

@media print {
  body { background: #fff; }
  .desk { max-width: none; padding: 0; margin: 0; }
  .sheets { max-width: none; }
  .sheets .sheet { margin: 0; border-radius: 0; box-shadow: none; }
}
