/* hallmark-rules (rules applied by hand, not the skill; 2026-11-25) · shape: tool-first page, the measurement overlay is the signature · genre: editorial/consumer · palette: cool paper, ink navy, one rose accent on the primary action only · type: system Japanese gothic, two weights · job: try (upload a photo) */
/* critique: first screen = headline, one sentence, two actions, the diagram that becomes the user's photo; everything longer sits in tables or collapsed details */
/* waive 1: Japanese system gothic as display. A Japanese webfont adds 1MB+ and this page promises speed and privacy */

:root {
  --font-body: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", "Meiryo", sans-serif;
  --paper: oklch(98.4% 0.006 240);
  --surface: oklch(99.6% 0.003 240);
  --ink: oklch(24% 0.035 255);
  --muted: oklch(47% 0.025 255);
  --line: oklch(89% 0.012 250);
  --wash: oklch(95.5% 0.01 250);
  --accent: oklch(51% 0.17 358);
  --accent-hover: oklch(46% 0.17 358);
  --accent-ink: oklch(99% 0.006 358);
  --accent-soft: oklch(95% 0.025 358);
  --warn: oklch(48% 0.15 30);
  --focus: oklch(55% 0.19 255);
  --scrim: oklch(15% 0.02 255 / 0.88);
  /* 計測線の色（写真の上で読める明るさ） */
  --m-length: oklch(86% 0.16 90);
  --m-forehead: oklch(78% 0.14 60);
  --m-cheek: oklch(72% 0.12 185);
  --m-jaw: oklch(66% 0.18 28);
  --m-chin: oklch(66% 0.17 305);
  --m-outline: oklch(99% 0.005 240 / 0.8);

  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 24px; --space-6: 32px; --space-7: 48px; --space-8: 72px; --space-9: 120px;
  --radius-s: 8px; --radius-m: 14px;
  --text-small: 0.875rem; --text-body: 1rem; --text-title: 1.25rem;
  --text-section: clamp(1.6rem, 1.2rem + 1.6vw, 2.5rem);
  --text-display: clamp(2.1rem, 1.4rem + 3vw, 3.6rem);
  --measure: 65ch;
  --container: 1200px;
  --dur-micro: 120ms;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { overflow-x: clip; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 var(--text-body)/1.65 var(--font-body); }
a { color: var(--accent); text-underline-offset: 3px; }
a:focus-visible, button:focus-visible, summary:focus-visible, label.btn:focus-within, input:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
h1, h2, h3 { overflow-wrap: break-word; min-width: 0; line-height: 1.25; font-weight: 700; margin: 0; word-break: auto-phrase; text-wrap: balance; }
.lede, .privacy, .stat p, .intro, .one { word-break: auto-phrase; }
p { margin: 0; }
[hidden] { display: none !important; }

.wrap { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--space-5); }

/* 上部 */
.top { border-bottom: 1px solid var(--line); background: var(--surface); }
.top .wrap { display: flex; align-items: center; min-height: 56px; }
.brand { color: var(--ink); text-decoration: none; font-weight: 700; }

/* ヒーロー＝ツール */
.tool { padding-block: var(--space-7) 0; }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-7); align-items: center; }
.hero h1 { font-size: var(--text-display); }
.lede { margin-top: var(--space-4); font-size: 1.125rem; color: var(--muted); max-width: 36ch; }
.actions { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-6); }
.privacy { margin-top: var(--space-4); font-size: var(--text-small); color: var(--muted); }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 var(--space-5); border-radius: var(--radius-s); border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 700 var(--text-body)/1 var(--font-body); cursor: pointer; white-space: nowrap; text-decoration: none; transition: background-color var(--dur-micro) ease-out, border-color var(--dur-micro) ease-out; }
.btn:hover { border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.quiet { border-color: transparent; background: none; color: var(--accent); padding-inline: 0; min-height: 44px; font-weight: 400; text-decoration: underline; }

.stage { margin: 0; position: relative; }
.stage svg, .stage canvas { display: block; width: 100%; height: auto; border-radius: var(--radius-m); background: var(--wash); }
.stage svg { max-height: 460px; }
.stage figcaption { margin-top: var(--space-2); font-size: var(--text-small); color: var(--muted); }
.stage canvas.tapme { cursor: crosshair; }

#status { margin-top: var(--space-5); padding: var(--space-3) var(--space-4); border-radius: var(--radius-s); background: var(--wash); }
#status[data-kind=err] { background: var(--accent-soft); color: var(--warn); }

.ask { margin-top: var(--space-5); padding: var(--space-5); border-radius: var(--radius-m); background: var(--accent-soft); }
.ask .q { font-weight: 700; }
.ask .choices { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-4); }

/* 結果 */
.result { margin-top: var(--space-8); display: grid; gap: var(--space-8); }
.verdict { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-7); align-items: start; }
.verdict h2 { font-size: var(--text-section); }
.verdict h2 small { display: block; font-size: var(--text-body); font-weight: 400; color: var(--muted); margin-bottom: var(--space-2); }
.verdict .one { margin-top: var(--space-3); max-width: 40ch; }
.sex { display: flex; gap: var(--space-2); margin-top: var(--space-5); }
.sex .btn[aria-pressed=true] { border-color: var(--ink); }
.bars { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--space-2); }
.bars li { display: grid; grid-template-columns: 5.5em minmax(0, 1fr) 3em; align-items: center; gap: var(--space-3); font-size: var(--text-small); }
.bars i { display: block; height: 10px; border-radius: 5px; background: linear-gradient(90deg, var(--ink) var(--w), var(--line) var(--w)); }
.bars li:first-child i { background: linear-gradient(90deg, var(--accent) var(--w), var(--line) var(--w)); }
.bars b { text-align: right; font-weight: 400; font-variant-numeric: tabular-nums; }
.nums { width: 100%; border-collapse: collapse; margin-top: var(--space-5); font-size: var(--text-small); }
.nums td { padding: var(--space-2) 0; border-bottom: 1px solid var(--line); }
.nums td:last-child { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.key { display: inline-block; width: 18px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: var(--space-2); }
.k-length { background: var(--m-length); } .k-forehead { background: var(--m-forehead); } .k-cheek { background: var(--m-cheek); } .k-jaw { background: var(--m-jaw); } .k-chin { background: var(--m-chin); }
.notes { margin: var(--space-4) 0 0; padding-left: 1.2em; font-size: var(--text-small); color: var(--muted); }

.hairs h3, .cardblock h3 { font-size: var(--text-title); margin-bottom: var(--space-4); }
.grid2 { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: var(--space-7); align-items: start; }
table.plain { width: 100%; border-collapse: collapse; }
table.plain th, table.plain td { text-align: left; vertical-align: top; padding: var(--space-3) var(--space-3) var(--space-3) 0; border-bottom: 1px solid var(--line); }
table.plain th { width: 7em; font-weight: 700; }
table.plain thead th { font-weight: 400; color: var(--muted); font-size: var(--text-small); }
table.plain td.no { color: var(--warn); }
.cardblock img { display: block; width: 100%; max-width: 360px; border: 1px solid var(--line); border-radius: var(--radius-s); }
.cardblock .actions { margin-top: var(--space-4); }
.more { font-size: var(--text-small); margin-top: var(--space-4); }

/* 下のセクション */
.band { padding-block: var(--space-9) 0; }
.band h2 { font-size: var(--text-section); margin-bottom: var(--space-6); }
.band .intro { color: var(--muted); max-width: 46ch; margin: calc(var(--space-6) * -1 + var(--space-3)) 0 var(--space-6); }
.shapes { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--space-5); }
.shapes a, .shapes .s { display: grid; gap: var(--space-2); justify-items: center; color: var(--ink); text-decoration: none; text-align: center; padding-block: var(--space-4); border-radius: var(--radius-m); }
.shapes a:hover { background: var(--wash); }
.shapes svg { width: 72px; height: 88px; fill: var(--wash); stroke: var(--ink); stroke-width: 2.5; }
.shapes b { font-size: var(--text-title); }
.shapes small { font-size: var(--text-small); color: var(--muted); }
.stat { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--space-4) var(--space-7); align-items: baseline; max-width: 900px; }
.stat strong { font-size: var(--text-display); font-variant-numeric: tabular-nums; line-height: 1; }
.stat p { color: var(--muted); max-width: 46ch; }
.faq details { border-bottom: 1px solid var(--line); padding-block: var(--space-4); max-width: var(--measure); }
.faq summary { cursor: pointer; font-weight: 700; min-height: 28px; }
.faq details p, .faq details ul { margin-top: var(--space-3); color: var(--muted); }
.quotes { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--space-3); font-size: var(--text-title); }

.foot { margin-top: var(--space-9); border-top: 1px solid var(--line); padding-block: var(--space-6); font-size: var(--text-small); color: var(--muted); }
.foot ul { list-style: none; padding: 0; margin: 0 0 var(--space-3); display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); }

/* カメラ */
.cam { position: fixed; inset: 0; background: var(--scrim); display: flex; align-items: center; justify-content: center; z-index: 10; color: var(--accent-ink); }
.camBox { position: relative; width: min(92vw, 480px); text-align: center; }
.camBox video { width: 100%; border-radius: var(--radius-m); transform: scaleX(-1); }
.guide { position: absolute; left: 22%; right: 22%; top: 6%; height: 66%; border: 3px dashed var(--m-outline); border-radius: 50% / 45%; pointer-events: none; }
.camBox .actions { justify-content: center; margin-top: var(--space-4); }

.debug { font-size: 11px; background: var(--ink); color: var(--paper); padding: var(--space-3); overflow: auto; border-radius: var(--radius-s); }

@media (max-width: 760px) {
  .hero, .verdict, .grid2 { grid-template-columns: minmax(0, 1fr); gap: var(--space-6); }
  .tool { padding-top: var(--space-6); }
  .shapes { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat { grid-template-columns: minmax(0, 1fr); }
  .wrap { padding-inline: var(--space-4); }
  .band { padding-top: var(--space-8); }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
  .btn:active { transform: none; }
}

/* 計測の図（ヒーロー） */
.diagram .face { fill: var(--surface); stroke: var(--ink); stroke-width: 2.5; }
.diagram line { stroke-width: 4; stroke-linecap: round; }
.diagram .d-len { stroke: var(--m-length); stroke-dasharray: 10 8; }
.diagram .d-dot { fill: var(--m-length); }
.diagram .d-fore { stroke: var(--m-forehead); }
.diagram .d-cheek { stroke: var(--m-cheek); }
.diagram .d-jaw { stroke: var(--m-jaw); }
.diagram .d-chin { stroke: var(--m-chin); }
.diagram text { fill: var(--ink); font: 400 15px/1 var(--font-body); }
.stage canvas { width: auto; max-width: 100%; max-height: 560px; margin-inline: auto; }
@media (max-width: 760px) { .stage canvas { max-height: 70svh; } }
table.plain { table-layout: fixed; }
@media (max-width: 760px) { table.plain th { width: 5.5em; } table.plain th, table.plain td { font-size: var(--text-small); } }
@media (max-width: 520px) {
  table.cmp thead { display: none; }
  table.cmp tr { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-1); padding-block: var(--space-3); border-bottom: 1px solid var(--line); }
  table.cmp th, table.cmp td { border: 0; padding: 0; width: auto; }
  table.cmp td.no::before { content: "避けたい："; }
}

/* モデル準備中（準備前に使われたときだけ表示） */
.loading { margin-top: var(--space-4); padding: var(--space-4); border-radius: var(--radius-s); background: var(--accent-soft); }
.loading p { display: flex; justify-content: space-between; gap: var(--space-4); font-size: var(--text-small); }
.loading b { font-variant-numeric: tabular-nums; }
.lbar { margin-top: var(--space-2); height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.lbar i { display: block; height: 100%; background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform var(--dur-micro) linear; }
.brand span { margin-left: var(--space-2); font-weight: 400; font-size: var(--text-small); color: var(--muted); }
