/* INTP検定（極）— 上質な検定本・辞書の質感 */

:root {
  --page: #F6F1E7;
  --paper: #FBF8F1;
  --ink: #23201B;
  --ink-soft: #5A544A;
  --ink-faint: #8A8275;
  --rule: #D9CFBC;
  --rule-strong: #BFB297;
  --violet: #5C46A8;
  --violet-ink: #FFFFFF;
  --violet-tint: #E9E4F4;
  --gold: #B8923A;
  --track: #EAE3D4;
  --shadow: 0 1px 1px rgba(60, 45, 20, 0.05), 0 6px 18px -10px rgba(60, 45, 20, 0.18);

  --font-mincho: "Noto Sans JP", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", system-ui, sans-serif; /* 2026-11-22 明朝→動画の字幕と同じ太ゴシック */
  --font-gothic: system-ui, -apple-system, "Hiragino Sans", "Yu Gothic UI", sans-serif;

  --col: 40rem;
  --gutter: 1rem;
  --bar-h: 9rem; /* app.js が実際の高さで上書きする */
  --radius: 6px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #121830;
    --paper: #1A2140;
    --ink: #EDE6D6;
    --ink-soft: #C3BBA9;
    --ink-faint: #918A7C;
    --rule: #333C60;
    --rule-strong: #4A5378;
    --violet: #A595E6;
    --violet-ink: #14182C;
    --violet-tint: #2A2D58;
    --gold: #C9A85A;
    --track: #262E52;
    --shadow: 0 1px 1px rgba(0, 0, 0, 0.25), 0 8px 22px -12px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--page);
  color: var(--ink);
  font-family: var(--font-gothic);
  font-size: 1rem;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--violet);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ───── 柱（ページ上部） ───── */
.masthead {
  max-width: var(--col);
  margin: 0 auto;
  padding: 1rem var(--gutter) 0;
  display: flex;
  justify-content: center;
}
.masthead-title {
  font-family: var(--font-mincho);
  font-size: 0.8125rem;
  color: var(--ink-faint);
  letter-spacing: 0.08em;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--gold);
}
.kiwami { color: var(--ink-soft); }
body[data-screen="cover"] .masthead { visibility: hidden; }

main {
  max-width: var(--col);
  margin: 0 auto;
  padding: 1rem var(--gutter) 2rem;
  outline: none;
}
body[data-screen="question"] main { padding-bottom: 1rem; }

.colophon {
  max-width: var(--col);
  margin: 0 auto;
  padding: 0 var(--gutter) 2rem;
  text-align: center;
}
body[data-screen="question"] .colophon { padding-bottom: calc(var(--bar-h) + 1.25rem); }
.sample-note {
  margin: 0;
  font-size: 0.75rem;
  color: var(--ink-faint);
}

/* ───── 紙（カード） ───── */
.paper {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem 1.25rem 1.25rem;
}
/* 細い二重罫：外の罫の内側にもう1本 */
.paper::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid var(--rule);
  border-radius: calc(var(--radius) - 3px);
  pointer-events: none;
}
@media (min-width: 40rem) {
  .paper { padding: 2.25rem 2.5rem 1.75rem; }
}

/* ───── 表紙 ───── */
.cover {
  min-height: calc(100dvh - 7rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: 1rem;
}
.cover .paper { padding-top: 2.75rem; padding-bottom: 2rem; text-align: center; }
.cover-rule {
  width: 3rem;
  height: 0;
  border-top: 1px solid var(--gold);
  border-bottom: 1px solid var(--gold);
  padding-top: 2px;
  margin: 0 auto 1.75rem;
}
.cover-title {
  font-family: var(--font-mincho);
  font-weight: 600;
  font-size: clamp(2.25rem, 9vw, 3.25rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0;
}
.cover-title .kiwami { font-size: 0.6em; letter-spacing: 0; color: var(--violet); }
.cover-sub {
  font-family: var(--font-mincho);
  font-size: 1.125rem;
  margin: 0.9rem 0 0;
  color: var(--ink-soft);
}
.cover-count {
  display: inline-block;
  margin: 1.5rem 0 0;
  font-family: var(--font-mincho);
  font-size: 0.9375rem;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.9rem;
  border-top: 1px solid var(--rule-strong);
  border-bottom: 1px solid var(--rule-strong);
}
.cover-points {
  list-style: none;
  counter-reset: pt;
  margin: 2rem auto 0;
  padding: 0;
  max-width: 26rem;
  text-align: left;
}
.cover-points li {
  counter-increment: pt;
  position: relative;
  padding: 0.7rem 0 0.7rem 2.25rem;
  border-top: 1px solid var(--rule);
  font-size: 0.9375rem;
  line-height: 1.65;
}
.cover-points li:last-child { border-bottom: 1px solid var(--rule); }
.cover-points li::before {
  content: counter(pt);
  position: absolute;
  left: 0.2rem;
  top: 0.7rem;
  width: 1.4rem;
  height: 1.4rem;
  display: grid;
  place-items: center;
  font-family: var(--font-mincho);
  font-size: 0.8125rem;
  color: var(--violet);
  border: 1px solid var(--violet);
  border-radius: 50%;
  line-height: 1;
}
.cover-actions {
  display: grid;
  gap: 0.75rem;
  margin: 2rem auto 0;
  max-width: 22rem;
}
.cover-fine {
  margin: 1.75rem 0 0;
  font-size: 0.75rem;
  line-height: 1.7;
  color: var(--ink-faint);
}
.cover-fine p { margin: 0; }

/* ───── ボタン ───── */
.btn {
  appearance: none;
  min-height: 3.5rem;
  padding: 0 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--rule-strong);
  background: var(--paper);
  color: var(--ink);
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 120ms ease-out, background-color 120ms ease-out, border-color 120ms ease-out;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}
.btn:active { transform: scale(0.97); transition-duration: 60ms; }
.btn-primary {
  background: var(--violet);
  border-color: var(--violet);
  color: var(--violet-ink);
}
.btn-quiet {
  background: transparent;
  border-color: var(--rule);
  color: var(--ink-soft);
  font-weight: 500;
  font-size: 0.9375rem;
}
.btn-link {
  appearance: none;
  background: none;
  border: none;
  padding: 0.5rem 0.25rem;
  min-height: 2.75rem;
  color: var(--ink-soft);
  font-size: 0.875rem;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: var(--rule-strong);
  text-underline-offset: 0.25em;
  touch-action: manipulation;
  transition: transform 120ms ease-out;
}
.btn-link:active { transform: scale(0.96); }
.btn-link[disabled] { visibility: hidden; }
@media (hover: hover) {
  .btn:hover { border-color: var(--ink-faint); }
  .btn-primary:hover { border-color: var(--violet); filter: brightness(1.06); }
  .btn-link:hover { color: var(--ink); }
}

/* ───── 進み具合 ───── */
.progress {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  margin-bottom: 0.25rem;
}
.progress > .btn-link { justify-self: start; }
.progress-count {
  font-family: var(--font-mincho);
  font-size: 0.9375rem;
  text-align: center;
  white-space: nowrap;
}
.progress-count strong { font-size: 1.25rem; font-weight: 600; margin: 0 0.1em; }
.progress-yes {
  justify-self: end;
  font-size: 0.8125rem;
  color: var(--ink-soft);
  white-space: nowrap;
}
.progress-yes strong { color: var(--violet); font-size: 1rem; font-variant-numeric: tabular-nums; }
.progress-track {
  height: 3px;
  background: var(--track);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 1.25rem;
}
.progress-fill {
  height: 100%;
  background: var(--violet);
  transform-origin: left center;
  transition: transform 300ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* ───── 問題カード ───── */
.runninghead {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  font-family: var(--font-mincho);
  font-size: 0.8125rem;
  color: var(--ink-faint);
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--gold);
  margin-bottom: 1.25rem;
}
.tag {
  display: inline-block;
  font-family: var(--font-gothic);
  font-size: 0.75rem;
  line-height: 1.4;
  padding: 0.15rem 0.5rem;
  border: 1px solid var(--gold);
  color: var(--ink-soft);
  border-radius: 3px;
  white-space: nowrap;
}
.section-label {
  font-family: var(--font-mincho);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--violet);
  margin: 0 0 0.5rem;
  letter-spacing: 0.04em;
}
.question-text {
  font-family: var(--font-mincho);
  font-weight: 600;
  font-size: 1.375rem;
  line-height: 1.6;
  letter-spacing: -0.005em;
  margin: 0 0 1.75rem;
  text-wrap: pretty;
  word-break: normal;
  overflow-wrap: anywhere;
}
@media (min-width: 40rem) {
  .question-text { font-size: 1.625rem; }
}
.premises {
  margin: 0;
  padding: 0;
}
.entry {
  padding: 0.75rem 0;
  border-top: 1px dotted var(--rule-strong);
}
.entry dt {
  font-family: var(--font-mincho);
  font-weight: 700;
  font-size: 1.0625rem;
  line-height: 1.5;
}
.entry dd {
  margin: 0.2rem 0 0;
  font-size: 0.9375rem;
  line-height: 1.8;
  color: var(--ink-soft);
}
.notes {
  list-style: none;
  margin: 0;
  padding: 0.75rem 0 0;
  border-top: 1px dotted var(--rule-strong);
}
.notes li {
  position: relative;
  padding-left: 1.4em;
  font-size: 0.875rem;
  line-height: 1.8;
  color: var(--ink-soft);
}
.notes li::before {
  content: "※";
  position: absolute;
  left: 0;
  color: var(--gold);
}
.folio {
  margin: 1.25rem 0 0;
  text-align: center;
  font-family: var(--font-mincho);
  font-size: 0.75rem;
  color: var(--ink-faint);
  letter-spacing: 0.1em;
}

/* ───── みんなの回答 ───── */
.tally {
  margin-top: 1rem;
  padding: 1.25rem 1.25rem 0.75rem;
  border-radius: var(--radius);
  border: 1px solid var(--rule);
  background: var(--paper);
}
.tally-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.tally-title {
  font-family: var(--font-mincho);
  font-weight: 600;
  font-size: 0.9375rem;
  margin: 0;
}
.tally-title small { font-family: var(--font-gothic); font-weight: 400; font-size: 0.75rem; color: var(--ink-faint); margin-left: 0.4em; }
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.7rem; }
.bar-row {
  display: grid;
  grid-template-columns: 7.5rem 1fr 2.9rem;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.875rem;
}
.bar-label { line-height: 1.3; display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; }
.bar-track {
  height: 0.625rem;
  background: var(--track);
  border-radius: 2px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  width: 100%;
  background: var(--ink-faint);
  opacity: 0.55;
  transform-origin: left center;
  transform: scaleX(var(--p, 0));
}
.bar-pct { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-soft); }
.tally .bar-row {
  grid-template-columns: 1fr auto;
  row-gap: 0.3rem;
}
.tally .bar-row .bar-label { grid-column: 1; grid-row: 1; }
.tally .bar-row .bar-pct { grid-column: 2; grid-row: 1; }
.tally .bar-row .bar-track { grid-column: 1 / -1; grid-row: 2; }
.bar-row.is-mine .bar-label { font-weight: 700; color: var(--ink); }
.bar-row.is-mine .bar-fill { background: var(--violet); opacity: 1; }
.bar-row.is-mine .bar-pct { color: var(--ink); font-weight: 700; }
.mine-chip {
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1.3;
  padding: 0.05rem 0.35rem;
  border: 1px solid var(--violet);
  color: var(--violet);
  border-radius: 3px;
}
.tally-foot { display: flex; justify-content: flex-end; margin-top: 0.25rem; }

/* ───── 画面下の操作盤 ───── */
.actionbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--page) 88%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
  border-top: 1px solid var(--rule);
  padding: 0.75rem var(--gutter) calc(0.75rem + env(safe-area-inset-bottom));
}
.actionbar-inner {
  max-width: calc(var(--col) - 2 * var(--gutter));
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}
.actionbar-inner .span-2 { grid-column: 1 / -1; }
.btn-answer { font-family: var(--font-mincho); font-size: 1.1875rem; }
.btn-answer[aria-pressed="true"] { border-color: var(--violet); box-shadow: inset 0 0 0 1px var(--violet); }
.prev-mark { font-family: var(--font-gothic); font-size: 0.75rem; font-weight: 400; color: var(--ink-faint); }
.key-hint {
  display: none;
  font-family: var(--font-gothic);
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--ink-faint);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 0 0.3rem;
  line-height: 1.5;
}
.btn-primary .key-hint { color: inherit; border-color: color-mix(in srgb, var(--violet-ink) 45%, transparent); }
@media (hover: hover) and (pointer: fine) {
  .key-hint { display: inline-block; }
}

/* ───── 結果 ───── */
.result .paper { text-align: center; padding-top: 2.25rem; }
.result-label { font-family: var(--font-mincho); font-size: 1rem; color: var(--ink-soft); margin: 0; }
.result-score {
  font-family: var(--font-mincho);
  font-weight: 600;
  margin: 0.25rem 0 0;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.result-score .num { font-size: clamp(4.5rem, 22vw, 6.5rem); color: var(--violet); }
.result-score .denom { font-size: 1.5rem; color: var(--ink-soft); letter-spacing: 0; margin-left: 0.15em; }
.result-breakdown {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin: 1.25rem 0 0;
  padding: 0.75rem 0 0;
  border-top: 1px solid var(--gold);
  font-size: 0.9375rem;
  color: var(--ink-soft);
  flex-wrap: wrap;
}
.result-breakdown strong { color: var(--ink); font-size: 1.125rem; font-variant-numeric: tabular-nums; margin-left: 0.25em; }
.result-section { margin-top: 1.5rem; }
.result-section h2 {
  font-family: var(--font-mincho);
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 0.9rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--gold);
}
.genre-row { grid-template-columns: 7.5rem 1fr 3.4rem; }
.genre-row .bar-fill { background: var(--violet); opacity: 1; }
.genre-row .bar-pct { color: var(--ink); }
.genre-row .bar-label small { color: var(--ink-faint); font-size: 0.75rem; }
.compare-row .bar-fill { background: var(--ink-faint); opacity: 0.6; }
.compare-row.is-mine .bar-fill { background: var(--violet); opacity: 1; }
.compare-row { grid-template-columns: 6rem 1fr 3.4rem; }
.compare-note { font-size: 0.75rem; color: var(--ink-faint); margin: 0.6rem 0 0; }
details.neither {
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
details.neither summary {
  cursor: pointer;
  min-height: 3rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.9375rem;
  list-style: none;
}
details.neither summary::-webkit-details-marker { display: none; }
details.neither summary::after { content: "＋"; flex-shrink: 0; font-size: 1rem; color: var(--ink-faint); }
details.neither[open] summary::after { content: "−"; }
.neither-list { list-style: none; margin: 0; padding: 0 0 0.75rem; }
.neither-list li {
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  gap: 0.5rem;
  padding: 0.55rem 0;
  border-top: 1px dotted var(--rule-strong);
  font-size: 0.9375rem;
  line-height: 1.65;
}
.neither-list .no { white-space: nowrap; font-family: var(--font-mincho); color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.neither-list .q { font-family: var(--font-mincho); }
.empty { font-size: 0.875rem; color: var(--ink-faint); margin: 0; }
.result-actions { display: grid; gap: 0.75rem; margin-top: 1.75rem; }
@media (min-width: 40rem) { .result-actions { grid-template-columns: 1fr 1fr; } }
.result-ask {
  text-align: center;
  font-family: var(--font-mincho);
  font-size: 1rem;
  margin: 1.5rem 0 0;
}

/* ───── 知らせ ───── */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(1.5rem + env(safe-area-inset-bottom));
  transform: translate(-50%, 0.5rem);
  opacity: 0;
  pointer-events: none;
  background: var(--ink);
  color: var(--page);
  font-size: 0.875rem;
  padding: 0.55rem 1rem;
  border-radius: var(--radius);
  transition: opacity 160ms ease-out, transform 160ms ease-out;
  z-index: 20;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

@media (max-width: 22rem) {
  .bar-row, .genre-row { grid-template-columns: 6.25rem 1fr 2.9rem; }
}

@media (prefers-reduced-motion: reduce) {
  .btn, .btn-link, .progress-fill, .toast { transition: opacity 120ms linear, background-color 120ms linear; }
  .btn:active, .btn-link:active { transform: none; }
  .toast, .toast.is-on { transform: translate(-50%, 0); }
}

/* ───── 2026-11-22 字体を動画の字幕に合わせる（太いゴシック・やわらかめ） ───── */
.cover-title, .question-text, .result-score, .result-section h2, .tally-title, .masthead-title { font-weight: 900; letter-spacing: 0; }
.cover-sub, .cover-count, .progress-count, .runninghead, .result-label, .folio, .neither-list .q, .neither-list .no { font-weight: 700; }
.entry dt, .btn-answer, .section-label { font-weight: 800; }
.question-text { line-height: 1.5; }

/* 2026-11-24 スマホ（指で触る端末）ではキーボードの案内を出さない */
@media (hover: none), (pointer: coarse) { .key-hint { display: none; } }
