:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1d2330;
  --muted: #5f6878;
  --line: #d9dee6;
  --accent: #2557d6;
  --ok: #1a7f4b;
  --ng: #c0392b;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14171c; --surface: #1d2128; --text: #e7eaf0; --muted: #9aa3b2;
    --line: #333a45; --accent: #7aa2ff; --ok: #4cc38a; --ng: #ff7a6b;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  line-height: 1.7;
}
main, header.site, footer.site { max-width: 820px; margin: 0 auto; padding: 0 16px; }
header.site h1 { margin: 32px 0 4px; font-size: 1.6rem; }
.lead { margin: 0 0 24px; color: var(--muted); }
footer.site { margin: 48px auto 32px; color: var(--muted); font-size: .85rem; }
footer.site a { color: inherit; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 20px; }
.drop {
  display: grid; place-items: center; min-height: 180px; padding: 16px;
  border: 2px dashed var(--line); border-radius: 10px; cursor: pointer;
  text-align: center; color: var(--muted);
}
.drop.over { border-color: var(--accent); }
.drop img { max-width: 100%; max-height: 320px; border-radius: 6px; }

.options { display: flex; flex-wrap: wrap; gap: 12px 20px; margin: 16px 0; }
.options label { display: flex; flex-direction: column; font-size: .85rem; color: var(--muted); }
.options label.wide { flex: 1 1 260px; }
select, input[type="text"], input:not([type]) {
  font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px;
}

button {
  font: inherit; font-weight: 600; color: #fff; background: var(--accent);
  border: 0; border-radius: 8px; padding: 10px 20px; cursor: pointer;
}
button:disabled { opacity: .45; cursor: default; }
.status { min-height: 1.7em; margin: 12px 0 0; color: var(--muted); }
.status.error { color: var(--ng); }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin: 24px 0 12px; }

.sheet {
  background: #fff; color: #111; border: 1px solid var(--line); border-radius: 4px;
  padding: 32px 36px; margin-bottom: 24px;
}
.sheet-head { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 2px solid #111; margin-bottom: 20px; }
.sheet-head h2 { margin: 0 0 6px; font-size: 1.2rem; }
.name-box { font-size: .9rem; padding-bottom: 6px; }
.name-box span { display: inline-block; width: 160px; border-bottom: 1px solid #111; margin-left: 8px; }
.sheet ol { padding-left: 1.6em; margin: 0; }
.sheet li.group { margin-bottom: 28px; font-weight: 600; }
.sheet li.group > * { font-weight: 400; }
.instruction { margin: 0 0 12px; }
ol.sub { list-style: none; counter-reset: sub; padding-left: .4em; }
ol.sub > li { counter-increment: sub; position: relative; padding-left: 2.6em; }
ol.sub > li::before { content: "(" counter(sub) ")"; position: absolute; left: 0; }
.sheet ol.sub > li { margin-bottom: 28px; }
.sheet.answers ol.sub > li { margin-bottom: 8px; }
.sheet.answers li.group { margin-bottom: 16px; }
.sol { color: #444; font-size: .9rem; margin-top: 4px; }
li.excluded { opacity: .45; text-decoration: line-through; }

.badge { display: inline-block; font-size: .75rem; margin-top: 4px; padding: 1px 8px; border-radius: 999px; border: 1px solid currentColor; }
.badge.ok { color: var(--ok); }
.badge.ng { color: var(--ng); }
.badge.na { color: #777; }

@media (max-width: 600px) {
  .sheet { padding: 20px 16px; }
}

@media print {
  body { background: #fff; }
  .no-print { display: none !important; }
  main { max-width: none; padding: 0; }
  .sheet { border: 0; padding: 0; margin: 0; }
  .sheet.answers { break-before: page; }
  .sheet ol.sub > li { break-inside: avoid; margin-bottom: 48px; }
}

button.secondary { color: var(--accent); background: transparent; border: 1px solid var(--accent); }
button.link { color: var(--accent); background: none; border: 0; padding: 0; font-weight: 500; text-align: left; }
button.link.muted { color: var(--muted); font-size: .85rem; }
h2.small { font-size: 1rem; margin: 0 0 8px; }
#library { margin-bottom: 16px; }
.library { list-style: none; margin: 0; padding: 0; }
.library li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-top: 1px solid var(--line); }
.library li:first-child { border-top: 0; }
.beta { margin: -16px 0 24px; font-size: .85rem; color: var(--muted); }

.crumb { margin: 24px 0 0; font-size: .85rem; color: var(--muted); }
.crumb a, .others a, .cta a { color: var(--accent); }
.points { margin: 0 0 16px; padding-left: 1.2em; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
a.button { display: inline-block; font-weight: 600; text-decoration: none; border-radius: 8px; padding: 10px 20px; }
a.button.secondary { color: var(--accent); border: 1px solid var(--accent); }
.note { font-size: .8rem; color: var(--muted); margin: 12px 0 0; }
.others { columns: 2; padding-left: 1.2em; margin: 0 0 12px; }
@media (max-width: 600px) { .others { columns: 1; } }
