/* 別班か公安か — 共通スタイル
   黒地に赤。意図的にダーク一本のデザイン。 */
:root {
  --paper: #0a0a0b;
  --sheet: #121214;
  --ink: #ecebe7;
  --muted: #8f8d89;
  --rule: #2d2c2f;
  --koan: #aab9cb;
  --koan-soft: #1a2027;
  --beppan: #e1352b;
  --beppan-soft: #2b1413;
  --stamp: #e1352b;
  --f-display: "Shippori Mincho B1", "Hiragino Mincho ProN", "Yu Mincho", serif;
  --f-body: "Zen Kaku Gothic New", "Hiragino Sans", "Yu Gothic", system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper); color: var(--ink);
  font-family: var(--f-body); font-size: 16px; line-height: 1.8;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 24px 48px;
}
a { color: var(--ink); text-underline-offset: 3px; }
a:hover { color: var(--beppan); }
img { max-width: 100%; }
[hidden] { display: none !important; }

/* サイトヘッダー・フッター */
.site-head, .site-foot, .sheet { max-width: 680px; margin-left: auto; margin-right: auto; }
.site-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.brand { font-family: var(--f-display); font-weight: 800; font-size: 20px; text-decoration: none; letter-spacing: .04em; }
.brand .b { color: var(--beppan); }
.site-head nav { display: flex; gap: 16px; font-size: 13px; }
.site-head nav a { text-decoration: none; color: var(--muted); }
.site-head nav a:hover { color: var(--ink); }
.site-foot { margin-top: 32px; display: grid; gap: 10px; font-size: 13px; color: var(--muted); }
.site-foot nav { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.site-foot a { color: var(--muted); }

.sheet {
  background: var(--sheet);
  border: 1px solid var(--rule); border-top: 4px solid var(--stamp);
  padding: clamp(20px, 5vw, 40px);
  display: grid; gap: 28px;
}
.form-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap;
  font-family: var(--f-mono); font-size: 12px; letter-spacing: .08em; color: var(--muted);
  border-bottom: 2px solid var(--ink); padding-bottom: 8px;
}
h1, h2, h3 { font-family: var(--f-display); font-weight: 800; text-wrap: balance; margin: 0; line-height: 1.35; }
h1 { font-size: clamp(34px, 9vw, 52px); letter-spacing: .02em; }
h1 .k { color: var(--koan); } h1 .b { color: var(--beppan); }
h2 { font-size: 22px; }
p { margin: 0; }
.latin { font-family: var(--f-mono); font-size: 13px; letter-spacing: .32em; color: var(--beppan); }
.lead { color: var(--muted); max-width: 34em; }
.label { font-size: 12px; letter-spacing: .12em; color: var(--muted); font-weight: 700; }
.note { font-size: 12px; color: var(--muted); }

/* 4象限 */
.grid4 { display: grid; grid-template-columns: auto 1fr 1fr; border: 1px solid var(--ink); }
.grid4 > div { padding: 12px; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); min-width: 0; }
.grid4 .ax { font-size: 12px; font-weight: 700; color: var(--muted); display: flex; align-items: center; justify-content: center; text-align: center; }
.cell { font-size: 13px; line-height: 1.5; text-decoration: none; display: block; }
.cell strong { display: block; font-family: var(--f-display); font-size: 16px; margin-bottom: 2px; }
.cell.k { background: var(--koan-soft); } .cell.k strong { color: var(--koan); }
.cell.b { background: var(--beppan-soft); } .cell.b strong { color: var(--beppan); }
.cell.mix strong { color: var(--ink); }
.cell.you { outline: 3px solid var(--stamp); outline-offset: -3px; }
a.cell:hover { color: var(--ink); background-image: linear-gradient(rgba(255,255,255,.04), rgba(255,255,255,.04)); }

/* ボタン */
button, .btn {
  font: inherit; font-weight: 700; cursor: pointer; border-radius: 2px;
  border: 2px solid var(--stamp); background: var(--stamp); color: #fff;
  padding: 12px 22px; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:hover { color: #fff; }
button.ghost, .btn.ghost { background: transparent; color: var(--ink); border-color: var(--ink); }
button:focus-visible, .btn:focus-visible, .opt:focus-visible, a:focus-visible { outline: 3px solid var(--stamp); outline-offset: 2px; }
button:disabled { opacity: .35; cursor: default; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

/* 質問 */
.progress { display: flex; justify-content: space-between; gap: 12px; font-family: var(--f-mono); font-size: 12px; color: var(--muted); }
.bar { height: 4px; background: var(--rule); }
.bar i { display: block; height: 100%; background: var(--ink); transition: width .25s; }
.qno { font-family: var(--f-mono); font-size: 13px; color: var(--muted); }
.qtext { font-family: var(--f-display); font-weight: 600; font-size: clamp(20px, 5.4vw, 26px); line-height: 1.55; min-height: 3.2em; }
.scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.opt {
  font: inherit; cursor: pointer; background: transparent; color: var(--ink);
  border: 1px solid var(--rule); border-radius: 2px; padding: 12px 4px;
  display: grid; justify-items: center; gap: 8px; font-size: 12px; line-height: 1.3; text-align: center; font-weight: 500;
}
.opt .dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--muted); }
.opt[data-v="2"] .dot, .opt[data-v="-2"] .dot { width: 30px; height: 30px; }
.opt:hover { border-color: var(--ink); }
.opt.sel { border-color: var(--ink); background: var(--ink); color: var(--sheet); }
.opt.sel .dot { background: var(--sheet); border-color: var(--sheet); }

/* 結果 */
.verdict { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: start; }
.verdict h2, .verdict h1 { font-size: clamp(28px, 7.6vw, 40px); }
.verdict .sub { color: var(--muted); font-size: 14px; }
.stamp {
  width: 104px; height: 104px; border-radius: 50%; border: 4px solid var(--stamp); color: var(--stamp);
  display: grid; place-items: center; font-family: var(--f-display); font-weight: 800; font-size: 26px; line-height: 1.05;
  writing-mode: vertical-rl; letter-spacing: .05em; transform: rotate(-12deg); opacity: .92;
  animation: press .45s cubic-bezier(.3,1.6,.5,1) both;
}
@keyframes press { from { transform: rotate(-12deg) scale(1.6); opacity: 0; } to { transform: rotate(-12deg) scale(1); opacity: .92; } }
.meters { display: grid; gap: 14px; }
.meter { display: grid; gap: 4px; }
.meter .ends { display: flex; justify-content: space-between; font-size: 13px; font-weight: 700; }
.meter .ends .k { color: var(--koan); } .meter .ends .b { color: var(--beppan); }
.track { position: relative; height: 12px; background: linear-gradient(90deg, var(--koan-soft) 50%, var(--beppan-soft) 50%); border: 1px solid var(--rule); }
.track::after { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--muted); }
.track i { position: absolute; top: -5px; width: 4px; height: 20px; background: var(--ink); transform: translateX(-2px); transition: left .5s; }
.meter .val { font-family: var(--f-mono); font-size: 12px; color: var(--muted); }
dl { margin: 0; display: grid; gap: 16px; }
dt { font-size: 12px; letter-spacing: .12em; font-weight: 700; color: var(--muted); border-bottom: 1px solid var(--rule); padding-bottom: 4px; margin-bottom: 6px; }
dd { margin: 0; }
dd ul { margin: 0; padding-left: 1.2em; }
.toast { font-size: 13px; color: var(--muted); min-height: 1.2em; }
#sharetext { width: 100%; font: inherit; font-size: 13px; background: var(--sheet); color: var(--ink); border: 1px solid var(--rule); padding: 8px; }

/* 記事ページ */
.article { display: grid; gap: 18px; }
.article h2 { font-size: 21px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--rule); }
.article h3 { font-size: 17px; }
.article ul, .article ol { margin: 0; padding-left: 1.3em; display: grid; gap: 4px; }
.article p { max-width: 38em; }
.table-wrap { overflow-x: auto; }
.article table { border-collapse: collapse; width: 100%; font-size: 14px; }
.article th, .article td { border: 1px solid var(--rule); padding: 8px 10px; text-align: left; vertical-align: top; }
.article th { background: var(--paper); font-weight: 700; }
.breadcrumb { font-size: 12px; color: var(--muted); }
.breadcrumb a { color: var(--muted); }
.cta { display: grid; gap: 10px; padding: 18px; border: 1px solid var(--rule); background: var(--paper); }
.typelist { display: grid; gap: 10px; }
.typelist a { display: grid; gap: 2px; padding: 12px 14px; border: 1px solid var(--rule); text-decoration: none; }
.typelist a strong { font-family: var(--f-display); font-size: 17px; }
.typelist a span { font-size: 13px; color: var(--muted); }
.typelist a:hover { border-color: var(--stamp); color: var(--ink); }

@media (max-width: 420px) {
  .opt { padding: 10px 2px; font-size: 11px; }
  .verdict { grid-template-columns: 1fr; }
  .stamp { justify-self: end; margin-top: -8px; width: 88px; height: 88px; font-size: 22px; }
  .grid4 > div { padding: 8px; }
}
@media (prefers-reduced-motion: reduce) { .stamp { animation: none; } .bar i, .track i { transition: none; } }
