/* 煩悩診断：方眼ノートにシールを貼っていく見た目（シール帳 × 平成レトロ）。色・文字・余白はここに集める */
:root {
  --paper: #ffffff;
  --grid: #e3eaff;
  --ink: #1a1f4b; /* 紺のボールペン */
  --ink-soft: #565c8c;
  --pink: #ff5c9e;
  --sky: #4da8ff;
  --lemon: #ffe23d;
  --mikan: #ff9a3d;
  --mint: #3fd9a8;
  --grape: #9b7bff;
  --pale: #f3f6ff;
  --font-display: "Mochiy Pop One", "Hiragino Maru Gothic ProN", "Yu Gothic", sans-serif;
  --font-note: "Hachi Maru Pop", "Hiragino Maru Gothic ProN", sans-serif;
  --font-body: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Yu Gothic", sans-serif;
  --line: 3px solid var(--ink);
  --shadow: 4px 4px 0 var(--ink);
  --radius: 18px;
  --space-1: 6px;
  --space-2: 12px;
  --space-3: 20px;
  --space-4: 32px;
  --space-5: 56px;
  --kon: var(--pink);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 16px;
  line-height: 1.85;
  color: var(--ink);
  background-color: var(--paper);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 22px 22px;
  min-height: 100vh;
  overflow-wrap: anywhere;
}
a { color: inherit; text-decoration-thickness: 2px; text-underline-offset: 4px; }
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 4px solid var(--sky); outline-offset: 3px; border-radius: 6px; }
rt { font-family: var(--font-body); font-weight: 700; font-size: 0.42em; letter-spacing: 0; }
[hidden] { display: none !important; }

.color-pink { --kon: var(--pink); }
.color-sky { --kon: var(--sky); }
.color-lemon { --kon: var(--lemon); }
.color-mikan { --kon: var(--mikan); }
.color-mint { --kon: var(--mint); }
.color-grape { --kon: var(--grape); }

/* 枠 */
.page { max-width: 560px; margin: 0 auto; padding: var(--space-2) 18px var(--space-5); }
.site-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); padding: var(--space-1) 0 var(--space-3); }
.site-head__logo { font-family: var(--font-display); font-size: 17px; text-decoration: none; background: var(--lemon); border: var(--line); border-radius: 10px; padding: 2px 12px; transform: rotate(-2deg); }
.site-head__nav { display: flex; gap: var(--space-2); font-size: 13px; font-weight: 700; }
.site-foot { margin-top: var(--space-5); padding-top: var(--space-3); border-top: 3px dashed var(--ink); font-size: 12.5px; color: var(--ink-soft); line-height: 1.8; }
.site-foot a { font-weight: 700; }
.section { margin-top: var(--space-5); }
.stack > * + * { margin-top: var(--space-2); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 14px; }
.mt-3 { margin-top: 22px; }
.mt-4 { margin-top: 36px; }
.mb-2 { margin-bottom: 18px; }
.plain-list { list-style: none; }
.plain-list li { padding-left: 1.2em; text-indent: -1.2em; }
.plain-list li::before { content: "● "; font-size: 0.6em; vertical-align: middle; }
.plain-list li + li { margin-top: 6px; }

/* 文字 */
.title { font-family: var(--font-display); font-weight: 400; font-size: clamp(34px, 10.5vw, 54px); line-height: 1.28; letter-spacing: 0.01em; }
.heading { font-family: var(--font-display); font-weight: 400; font-size: clamp(22px, 6.4vw, 28px); line-height: 1.45; }
.lead { font-size: 16.5px; font-weight: 700; }
.small { font-size: 13px; color: var(--ink-soft); line-height: 1.75; }
.note { font-family: var(--font-note); font-size: 14px; line-height: 1.7; color: var(--ink); }
.note--tilt { display: inline-block; transform: rotate(-3deg); }

/* マスキングテープの見出し */
.tape { display: inline-block; font-family: var(--font-display); font-size: 15px; line-height: 1.5; padding: 3px 22px; background: var(--kon); transform: rotate(-1.5deg); margin-bottom: var(--space-2);
  clip-path: polygon(0 0, 100% 0, calc(100% - 7px) 25%, 100% 50%, calc(100% - 7px) 75%, 100% 100%, 0 100%, 7px 75%, 0 50%, 7px 25%); }
.tape--lemon { background: var(--lemon); }
.tape--mint { background: var(--mint); }
.tape--sky { background: var(--sky); }
.tape--pink { background: var(--pink); }
.tape--grape { background: var(--grape); }
.tape--mikan { background: var(--mikan); }

/* シール（箱） */
.sticker { background: var(--paper); border: var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: var(--space-3); }
.sticker--pale { background: var(--pale); box-shadow: none; }
.sticker--tilt-l { transform: rotate(-1.2deg); }
.sticker--tilt-r { transform: rotate(1deg); }

/* ボタン */
.btn { display: block; width: 100%; font-family: var(--font-display); font-size: 18px; line-height: 1.4; text-align: center; text-decoration: none; cursor: pointer;
  padding: 16px 18px; color: var(--ink); background: var(--lemon); border: var(--line); border-radius: 999px; box-shadow: 0 6px 0 var(--ink); transition: transform 0.08s, box-shadow 0.08s; }
.btn:active { transform: translateY(5px); box-shadow: 0 1px 0 var(--ink); }
.btn--pink { background: var(--pink); }
.btn--mint { background: var(--mint); }
.btn--plain { background: var(--paper); font-size: 15px; padding: 11px 16px; box-shadow: 0 4px 0 var(--ink); }
.btn--plain:active { transform: translateY(3px); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn-row { display: grid; grid-template-columns: 1fr 2fr; gap: var(--space-2); align-items: start; }
.field { display: block; width: 100%; padding: 14px 16px; font-size: 18px; font-weight: 700; background: var(--paper); border: var(--line); border-radius: 14px; }
.field--code { font-size: 15px; letter-spacing: 0.04em; }
.field-label { display: block; font-weight: 700; font-size: 14px; margin-bottom: var(--space-1); }
.message { font-weight: 700; font-size: 14px; padding: 10px 14px; border: var(--line); border-radius: 12px; background: var(--lemon); }
.message--ok { background: var(--mint); }

/* 108マスの台紙 */
.sheet { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 12px; }
.sheet__block { border: var(--line); border-radius: 14px; background: var(--paper); padding: 8px 8px 9px; }
.sheet__name { display: flex; align-items: baseline; gap: 6px; font-family: var(--font-display); font-size: 13px; line-height: 1.3; margin-bottom: 6px; }
.sheet__name span { font-family: var(--font-body); font-weight: 700; font-size: 10.5px; color: var(--ink-soft); }
.sheet__grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.sheet__grid > :nth-child(6n + 4) { margin-left: 3px; }
.dot { display: block; aspect-ratio: 1; border-radius: 50%; background: var(--pale); border: 2px dotted #b9c3ee; }
.dot[data-level="1"] { background: var(--kon); border: 2px solid var(--ink); }
.dot[data-level="2"] { background: var(--kon); border: 2px solid var(--ink); box-shadow: inset 0 0 0 3px var(--paper), 2px 2px 0 var(--ink); }
.dot[data-level="f"] { background: radial-gradient(circle, var(--ink) 0 28%, var(--paper) 30%); border: 2px dashed var(--ink); }
.sheet--pop .dot[data-level="1"], .sheet--pop .dot[data-level="2"] { animation: pop 0.34s cubic-bezier(0.2, 1.5, 0.4, 1) both; animation-delay: calc(var(--i) * 14ms + 200ms); }
@keyframes pop { from { transform: scale(0) rotate(-40deg); } to { transform: scale(1) rotate(0); } }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; font-weight: 700; margin-top: var(--space-2); }
.legend__item { display: inline-flex; align-items: center; gap: 6px; }
.legend .dot { width: 16px; --kon: var(--pink); }

/* 妖怪のシール */
.yokai { display: block; width: 100%; max-width: 220px; filter: drop-shadow(3px 0 0 #fff) drop-shadow(-3px 0 0 #fff) drop-shadow(0 3px 0 #fff) drop-shadow(0 -3px 0 #fff) drop-shadow(3px 4px 0 rgba(26, 31, 75, 0.9)); }
.yokai svg { display: block; width: 100%; height: auto; overflow: visible; }
.yokai--empty { filter: none; opacity: 0.9; }
.yokai-card { display: grid; grid-template-columns: 112px 1fr; gap: var(--space-2) var(--space-3); align-items: center; }
.yokai-card__name { font-family: var(--font-display); font-size: 22px; line-height: 1.3; }
.yokai-card__line { font-family: var(--font-note); font-size: 15px; line-height: 1.6; }
.yokai-card__story { grid-column: 1 / -1; }
.yokai-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-2); align-items: end; text-align: center; }
.yokai-row__name { font-family: var(--font-display); font-size: 14px; margin-top: 6px; }
.yokai-row > :nth-child(1) { transform: rotate(-4deg); }
.yokai-row > :nth-child(2) { transform: translateY(-10px) rotate(2deg); }
.yokai-row > :nth-child(3) { transform: rotate(5deg); }

/* トップページ */
.hero__sheet { position: relative; margin: var(--space-3) 0; }
.formula { display: grid; gap: 10px; }
.formula__row { display: grid; grid-template-columns: 54px 1fr; gap: var(--space-2); align-items: center; }
.formula__num { font-family: var(--font-display); font-size: 30px; line-height: 1; text-align: center; background: var(--kon); border: var(--line); border-radius: 14px; padding: 8px 0 10px; }
.formula__what { font-weight: 700; line-height: 1.5; }
.formula__what small { display: block; font-weight: 500; font-size: 13px; color: var(--ink-soft); }
.formula__total { font-family: var(--font-display); font-size: 22px; text-align: center; margin-top: var(--space-2); }
.steps { list-style: none; counter-reset: step; display: grid; gap: var(--space-2); }
.steps li { counter-increment: step; display: grid; grid-template-columns: 40px 1fr; gap: var(--space-2); align-items: start; font-weight: 700; line-height: 1.6; }
.steps li::before { content: counter(step); font-family: var(--font-display); font-size: 20px; line-height: 36px; text-align: center; width: 40px; height: 40px; background: var(--mint); border: var(--line); border-radius: 50%; }
.steps small { display: block; font-weight: 500; font-size: 13px; color: var(--ink-soft); }

/* 診断 */
.progress { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-bottom: var(--space-2); }
.progress__group { display: grid; grid-template-columns: repeat(6, 1fr); gap: 2px; }
.progress__pip { height: 8px; border-radius: 4px; background: var(--paper); border: 1.5px solid var(--ink); }
.progress__pip[data-state="done"] { background: var(--kon); }
.progress__pip[data-state="now"] { background: var(--ink); }
.quiz-meta { display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 13.5px; margin-bottom: var(--space-2); }
.quiz-mode { font-weight: 900; font-size: 12.5px; border: 2px solid var(--ink); border-radius: 999px; padding: 0 12px; background: var(--paper); }
.quiz-title { font-family: var(--font-display); font-size: clamp(24px, 7.2vw, 32px); line-height: 1.4; padding: var(--space-2) var(--space-3); background: var(--kon); border: var(--line); border-radius: var(--radius); box-shadow: var(--shadow); transform: rotate(-1deg); margin-bottom: var(--space-3); }
.quiz-row { border: 0; padding: var(--space-2) 0 var(--space-3); border-bottom: 3px dotted #b9c3ee; min-width: 0; }
.quiz-row:last-of-type { border-bottom: 0; }
.quiz-row__when { font-weight: 900; font-size: 13px; line-height: 1.5; padding: 1px 12px; border: 2px solid var(--ink); border-radius: 999px; background: var(--paper); }
.quiz-row__text { font-weight: 700; font-size: 16.5px; line-height: 1.6; margin: 2px 0 10px; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); border: var(--line); border-radius: 14px; overflow: hidden; background: var(--paper); }
.seg--four { grid-template-columns: repeat(2, 1fr); }
.seg label { position: relative; display: block; text-align: center; font-weight: 700; font-size: 15px; padding: 11px 4px; cursor: pointer; border-left: 2px solid var(--ink); }
.seg label:first-child { border-left: 0; }
.seg input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.seg label:has(input:checked) { background: var(--kon); font-family: var(--font-display); font-weight: 400; }
.seg label:has(input[value="0"]:checked) { background: var(--pale); }
.seg label:has(input:focus-visible) { outline: 4px solid var(--sky); outline-offset: -4px; }
.choices { display: grid; gap: 10px; }
.choice { display: block; width: 100%; font-weight: 700; font-size: 16.5px; text-align: left; cursor: pointer; padding: 13px 18px; background: var(--paper); border: var(--line); border-radius: 14px; box-shadow: 0 4px 0 var(--ink); transition: transform 0.08s, box-shadow 0.08s; }
.choice:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.choice[aria-pressed="true"] { background: var(--kon); }

/* 結果 */
.count { text-align: center; }
.count__who { font-weight: 700; }
.count__num { font-family: var(--font-display); font-size: clamp(88px, 30vw, 150px); line-height: 1; letter-spacing: -0.02em; }
.count__of { font-family: var(--font-display); font-size: 20px; }
.count__split { display: inline-block; font-weight: 700; font-size: 14px; margin-top: var(--space-2); padding: 4px 14px; border: 2px dashed var(--ink); border-radius: 999px; background: var(--paper); }
.bars { display: grid; gap: 14px; }
.bar__head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-2); font-weight: 700; line-height: 1.5; }
.bar__term { font-family: var(--font-display); font-size: 22px; margin-right: 8px; }
.bar__track { height: 18px; border: var(--line); border-radius: 999px; background: var(--paper); overflow: hidden; margin-top: 4px; }
.bar__fill { height: 100%; background: var(--kon); border-right: var(--line); }
.bar__fill[data-zero="true"] { border-right: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: baseline; gap: 6px; font-weight: 700; font-size: 14px; padding: 3px 12px; border: 2px solid var(--ink); border-radius: 999px; background: var(--kon); }
.chip b { font-family: var(--font-display); font-weight: 400; font-size: 17px; }
.chip--off { background: var(--paper); }
.rank { list-style: none; display: grid; gap: var(--space-3); }
.rank__item { display: grid; grid-template-columns: 46px 1fr; gap: var(--space-2); align-items: start; }
.rank__no { font-family: var(--font-display); font-size: 22px; line-height: 42px; text-align: center; width: 46px; height: 46px; background: var(--kon); border: var(--line); border-radius: 50%; }
.rank__item:nth-child(odd) .rank__no { transform: rotate(-6deg); }
.rank__item:nth-child(even) .rank__no { transform: rotate(5deg); }
.rank__term { font-family: var(--font-display); font-size: 17px; line-height: 2; }
.rank__text { font-weight: 700; font-size: 17px; line-height: 1.6; }
.rank__plain { font-size: 12.5px; color: var(--ink-soft); }
.rank__badge { display: inline-block; font-family: var(--font-note); font-size: 12px; padding: 0 9px; border: 2px dashed var(--ink); border-radius: 999px; background: var(--paper); margin-left: 6px; }
details { margin-top: 6px; }
summary { cursor: pointer; font-weight: 700; font-size: 13.5px; }
details p { font-size: 14.5px; margin-top: 4px; }
.windows { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); align-items: start; }
.window { border: var(--line); border-radius: 14px; background: var(--paper); padding: 12px; }
.window__name { font-family: var(--font-display); font-size: 15.5px; line-height: 1.4; }
.window__sub { font-size: 11.5px; font-weight: 700; color: var(--ink-soft); }
.window ul { list-style: none; margin-top: 8px; font-size: 13.5px; font-weight: 700; line-height: 1.6; }
.window li + li { margin-top: 3px; }
.window--blind { background: var(--lemon); }
.friend-status { display: flex; gap: 10px; align-items: center; font-weight: 700; }
.friend-status__slot { width: 44px; height: 44px; border-radius: 50%; border: 3px dashed var(--ink); background: var(--paper); display: grid; place-items: center; font-family: var(--font-display); }
.friend-status__slot[data-filled="true"] { border-style: solid; background: var(--mint); }
.share-text { width: 100%; min-height: 108px; font-size: 14px; line-height: 1.7; padding: 12px 14px; border: var(--line); border-radius: 14px; background: var(--pale); resize: vertical; }

/* 結果の画像 */
.share-card__canvas { display: block; width: 100%; max-width: 320px; height: auto; margin: 0 auto; border: var(--line); border-radius: 14px; box-shadow: var(--shadow); background: var(--paper); }

/* 図鑑 */
.zukan { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.zukan__cell { text-align: center; cursor: pointer; padding: 8px 6px 6px; background: var(--paper); border: 2px solid var(--ink); border-radius: 14px; font-size: 11.5px; font-weight: 700; line-height: 1.4; }
.zukan__cell[data-held="true"] { background: var(--kon); }
.zukan__cell[aria-pressed="true"] { box-shadow: var(--shadow); }
.zukan__no { font-family: var(--font-display); font-size: 12px; }
.zukan__art { width: 72%; margin: 2px auto 4px; }
.zukan-detail { position: sticky; bottom: 12px; z-index: 2; margin-top: var(--space-3); }

/* くわしく */
.prose > * + * { margin-top: var(--space-2); }
.prose h2 { font-family: var(--font-display); font-weight: 400; font-size: 23px; line-height: 1.5; margin-top: var(--space-5); }
.prose h3 { font-size: 17px; font-weight: 900; margin-top: var(--space-4); }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: 6px; }
.prose table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 1.6; background: var(--paper); }
.prose th, .prose td { border: 2px solid var(--ink); padding: 8px 10px; text-align: left; vertical-align: top; }
.prose th { background: var(--pale); font-weight: 900; }
.prose td:first-child, .prose tbody th { min-width: 7.5em; }
.prose .caution { border: var(--line); border-radius: 14px; background: var(--lemon); padding: var(--space-2) var(--space-3); font-weight: 700; }
.table-wrap { overflow-x: auto; }

@media (max-width: 380px) {
  .page { padding-left: 14px; padding-right: 14px; }
  .yokai-card { grid-template-columns: 92px 1fr; }
  .windows { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
