@font-face {
  font-family: "Hannari";
  src: url("fonts/HannariMincho-Regular.otf") format("opentype");
  font-display: swap;
}

:root {
  color-scheme: light;
  /* メロンソーダ：ソーダの緑・バニラアイスのクリーム・さくらんぼの赤 */
  --desk: #7fd3ad;
  --desk-2: #5cc196;
  --paper: #fbf5e2;
  --paper-2: #f2ead0;
  --ink: #1f3d36;
  --ink-dim: #56736a;
  --rule: #86bfa6;
  --shu: #e0384f;
  --shu-dark: #9c2436;
  --soda: #3fae7e;
  --link: #1d6386;
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.12 0 0 0 0 0.2 0 0 0 0 0.16 0 0 0 .45 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --fiber: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='600'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.012 .35' numOctaves='2' seed='7'/%3E%3CfeColorMatrix values='0 0 0 0 0.45 0 0 0 0 0.4 0 0 0 0 0.25 0 0 0 1.2 -.75'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)'/%3E%3C/svg%3E");
  /* 炭酸の泡 */
  --bubbles:
    radial-gradient(circle at 12% 18%, rgba(255,255,255,.55) 0 3px, transparent 4px),
    radial-gradient(circle at 78% 9%, rgba(255,255,255,.45) 0 5px, transparent 6px),
    radial-gradient(circle at 42% 62%, rgba(255,255,255,.5) 0 2px, transparent 3px),
    radial-gradient(circle at 88% 74%, rgba(255,255,255,.4) 0 7px, transparent 8px),
    radial-gradient(circle at 24% 88%, rgba(255,255,255,.45) 0 4px, transparent 5px),
    radial-gradient(circle at 60% 30%, rgba(255,255,255,.35) 0 3px, transparent 4px);
}

* { box-sizing: border-box; border-radius: 0 !important; }
html { -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  padding: 40px 16px 32px;
  font-family: "Hannari", "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", serif;
  color: var(--ink);
  background: var(--grain), var(--bubbles), linear-gradient(180deg, var(--desk), var(--desk-2));
  background-size: auto, 260px 260px, auto;
  background-attachment: scroll, fixed, fixed;
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: var(--grain);
  opacity: .25;
  mix-blend-mode: multiply;
  z-index: 10;
}

/* ---------- 藁半紙 ---------- */
.sheet {
  position: relative;
  max-width: 560px;
  margin: 0 auto;
  padding: 48px 32px 36px;
  text-align: center;
  background: var(--fiber), var(--grain), linear-gradient(175deg, var(--paper), var(--paper-2));
  box-shadow: 0 1px 0 rgba(0,0,0,.06), 0 8px 18px rgba(20,70,50,.25);
  border-top: 6px solid var(--shu); /* さくらんぼ */
}
.sheet::before {
  content: "";
  position: absolute;
  inset: 12px;
  border: 1px solid var(--rule);
  outline: 3px double var(--rule);
  outline-offset: -7px;
  pointer-events: none;
  opacity: .7;
}
.screen { text-shadow: 0 0 .5px rgba(31,61,54,.5); }

/* ---------- 確信度 ---------- */
.conf {
  display: grid;
  grid-template-columns: auto 1fr 3.2em;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  font-size: 14px;
}
.conf-lab { letter-spacing: .1em; }
.meter {
  height: 14px;
  border: 2px solid var(--ink);
  background: rgba(255,255,255,.5);
}
.meter i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--grain), var(--soda);
  transition: width .35s ease-out;
}
.conf.high .meter i { background: var(--grain), var(--shu); }
.conf-pct { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- もしかして ---------- */
.probe {
  margin: 0;
  font-size: clamp(16px, 4.4vw, 19px);
  color: var(--shu);
  letter-spacing: .06em;
}
.probe-suf { margin: -18px 0 22px; }
.work.with-probe { min-height: 2.6em; margin-bottom: 20px; }

/* ---------- タイプ ---------- */
.r-types { margin: 4px 0 24px; }
.r-types .r-label { margin-bottom: 10px; }
.r-types ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.r-types li {
  width: 100%;
  max-width: 400px;
  padding: 10px 14px 9px;
  border: 2px solid var(--shu);
  outline: 1px solid var(--shu);
  outline-offset: -6px;
  background: rgba(224,56,79,.06);
}
.r-types li:nth-child(odd) { transform: rotate(-1deg); }
.r-types li:nth-child(even) { transform: rotate(.8deg); }
.r-types b { display: block; font-weight: normal; font-size: clamp(19px, 5.2vw, 23px); color: var(--shu); letter-spacing: .06em; }
.r-types span { display: block; margin-top: 3px; font-size: 13px; color: var(--ink-dim); }

/* ---------- オタク人口ピラミッド ---------- */
.pyramid { margin: 6px 0 26px; text-align: left; }
.pyramid h2 {
  margin: 0 0 8px;
  padding-bottom: 4px;
  font-size: 15px;
  font-weight: normal;
  border-bottom: 1px solid var(--rule);
}
.py-pos { margin: 0 0 12px; font-size: 14px; line-height: 1.8; text-align: center; }
.py-pos b { font-weight: normal; font-size: 1.25em; color: var(--shu); }
.py-head, .py-row {
  display: grid;
  grid-template-columns: 1fr 4.2em 1fr;
  align-items: center;
  gap: 6px;
}
.py-head { margin-bottom: 4px; font-size: 12px; color: var(--ink-dim); }
.py-head span:first-child { text-align: right; }
.py-row { height: 17px; font-size: 11px; }
.py-row .lab { text-align: center; color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.py-row .l, .py-row .r { height: 12px; display: flex; }
.py-row .l { justify-content: flex-end; }
.py-row i { display: block; height: 100%; min-width: 1px; }
.py-row .l i { background: var(--grain), var(--rule); }
.py-row .r i { background: var(--grain), var(--soda); }
.py-row .l.me i, .py-row .r.me i { background: var(--grain), var(--shu); }
.py-row .lab.me { color: var(--shu); font-weight: bold; }
.py-n { margin: 8px 0 0; font-size: 12px; color: var(--ink-dim); text-align: center; }

/* ---------- 当てる ---------- */
.g-ask { margin: 6px 0 22px; font-size: clamp(17px, 4.6vw, 20px); }
.g-buttons { display: flex; justify-content: center; align-items: center; gap: 18px; flex-wrap: wrap; }
.g-real { margin-top: 8px; }
#g-age { animation: reveal .5s ease-out; }
@keyframes reveal {
  0% { opacity: 0; transform: scale(.6); }
  70% { transform: scale(1.08); }
  100% { opacity: 1; transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) { #g-age { animation: none; } }

.form-no {
  display: inline-block;
  margin: 0 0 22px;
  padding: 2px 14px;
  font-size: 14px;
  letter-spacing: .3em;
  border: 1px solid var(--ink);
}

.desc {
  margin: 0 0 30px;
  font-size: clamp(16px, 4.2vw, 18px);
  line-height: 1.9;
}
.desc small {
  display: block;
  margin-top: 4px;
  font-size: .82em;
  color: var(--ink-dim);
}

/* ---------- 入力 ---------- */
.field {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 16px;
  font-size: 17px;
}
.field label small { font-size: 13px; color: var(--ink-dim); }
.box {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  font-size: clamp(26px, 6.5vw, 32px);
}
.box input {
  width: 4.2em;
  font: inherit;
  text-align: center;
  color: var(--ink);
  background: rgba(255,255,255,.18);
  border: 2px solid var(--ink);
  padding: 2px 6px;
  box-shadow: inset 2px 2px 0 rgba(0,0,0,.08);
}
.box input::placeholder { color: rgba(44,42,48,.28); }
.box input:focus { outline: 2px solid var(--shu); outline-offset: 3px; }
.box input[aria-invalid="true"] { border-color: var(--shu); }
.note { min-height: 1.6em; margin: 12px 0 26px; font-size: 14px; color: var(--ink-dim); }
.note.err { color: var(--shu); }

/* ---------- ボタン ---------- */
.primary {
  display: inline-block;
  font: inherit;
  font-size: clamp(18px, 4.8vw, 21px);
  letter-spacing: .16em;
  color: #fffaf0;
  text-decoration: none;
  background: var(--grain), var(--shu);
  border: 2px solid var(--ink);
  padding: 13px 38px 13px 42px;
  cursor: pointer;
  box-shadow: 4px 4px 0 var(--ink);
  transition: transform .05s, box-shadow .05s;
}
.primary:hover { background: var(--grain), #ea4d62; }
.primary:active { transform: translate(4px, 4px); box-shadow: 0 0 0 var(--ink); }
.primary:focus-visible, .answers button:focus-visible, .sub:focus-visible, .back:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 4px;
}
.primary:disabled { opacity: .5; cursor: default; transform: none; box-shadow: 4px 4px 0 var(--ink); }

/* ---------- 設問 ---------- */
.count { margin: 0 0 20px; font-size: 14px; color: var(--ink-dim); letter-spacing: .1em; }
.meta { margin: 0 0 6px; font-size: 14px; color: var(--ink-dim); letter-spacing: .08em; }
.work {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 3.2em;
  margin: 0 0 26px;
  font-size: clamp(22px, 6vw, 30px);
  font-weight: normal;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.answers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.answers button {
  font: inherit;
  font-size: clamp(15px, 4.2vw, 17px);
  padding: 16px 6px;
  color: var(--ink);
  background: rgba(255,255,255,.2);
  border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  cursor: pointer;
  transition: transform .05s, box-shadow .05s;
}
.answers button:active, .answers button.picked {
  transform: translate(3px, 3px);
  box-shadow: 0 0 0 var(--ink);
}
.answers .a3 { color: #fffaf0; background: var(--grain), var(--shu); }
.answers .a2 { background: rgba(63,174,126,.22); }
.answers .a0 { color: var(--ink-dim); }
.back {
  margin-top: 22px;
  font: inherit;
  font-size: 13px;
  padding: 2px 12px;
  color: var(--ink-dim);
  background: transparent;
  border: 1px solid var(--ink-dim);
  cursor: pointer;
}
.back:disabled { visibility: hidden; }

/* ---------- みんなの回答 ---------- */
.everyone {
  margin: 26px 0 0;
  padding: 14px 14px 10px;
  text-align: left;
  border: 1px dashed var(--rule);
  background: rgba(255,255,255,.12);
}
.ev-title { margin: 0 0 8px; font-size: 13px; line-height: 1.6; color: var(--ink-dim); overflow-wrap: anywhere; }
.ev-n { margin-left: 6px; font-size: 12px; }
.everyone ul { margin: 0; padding: 0; list-style: none; }
.everyone li {
  display: grid;
  grid-template-columns: 8.5em 1fr 3em;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  font-size: 13px;
}
.everyone li.mine { font-weight: bold; }
.everyone li.mine .lab::before { content: "▶"; font-size: 10px; margin-right: 2px; color: var(--shu); }
.everyone .bar { height: 10px; border: 1px solid var(--ink); background: rgba(255,255,255,.15); }
.everyone .bar i { display: block; height: 100%; background: var(--grain), var(--ink-dim); }
.everyone li.a3 .bar i { background: var(--grain), var(--shu); }
.everyone .pct { text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 400px) {
  .everyone li { grid-template-columns: 7.5em 1fr 2.8em; font-size: 12px; }
}

/* ---------- 結果 ---------- */
.r-label { margin: 0; font-size: 17px; }
.r-age {
  margin: 4px 0 6px;
  font-size: clamp(64px, 20vw, 96px);
  line-height: 1.1;
  color: var(--shu);
}
.r-age small { font-size: .3em; color: var(--ink); margin-left: 4px; }
.r-diff { margin: 0 0 14px; font-size: 16px; }
.r-diff b { font-weight: normal; border-bottom: 1px solid var(--ink); }
.r-comment {
  display: inline-block;
  margin: 0 0 14px;
  padding: 6px 16px;
  font-size: clamp(17px, 4.6vw, 20px);
  border: 2px solid var(--ink);
  background: rgba(255,255,255,.18);
}
.r-peak { margin: 0 0 24px; font-size: 14px; line-height: 1.8; color: var(--ink-dim); }
.r-list { margin: 0 0 22px; text-align: left; }
.r-list h2 {
  margin: 0 0 6px;
  padding-bottom: 4px;
  font-size: 15px;
  font-weight: normal;
  border-bottom: 1px solid var(--rule);
}
.r-list ul { margin: 0; padding: 0; list-style: none; }
.r-list li {
  padding: 5px 0;
  line-height: 1.5;
  border-bottom: 1px dotted var(--rule);
  overflow-wrap: anywhere;
}
.r-list li a { color: var(--link); text-decoration: none; }
.r-list li a:hover { text-decoration: underline; }
.r-list li span { margin-left: 8px; font-size: 12px; color: var(--ink-dim); }
.r-actions { display: flex; flex-direction: column; align-items: center; gap: 16px; margin-top: 8px; }
.sub {
  font: inherit;
  font-size: 14px;
  padding: 6px 16px;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--ink);
  cursor: pointer;
}

/* ---------- フッター ---------- */
.foot {
  max-width: 560px;
  margin: 28px auto 0;
  text-align: center;
  font-size: 12px;
  line-height: 1.9;
  color: #1f3d36;
}
.foot p { margin: 0; }
.foot a { color: var(--link); }

@media (max-width: 480px) {
  body { padding-top: 24px; }
  .sheet { padding: 40px 20px 30px; }
  .answers { gap: 10px; }
}
