/* ==============================================================
   与信票 — デザインシステム
   方向性: 銀行の与信票。帳票・等幅数字・朱の印影。
   影やグラデーションではなく、罫線の"太細"と印影で権威を作る。
   ============================================================== */

:root {
  --bg: #f3f1e9;
  --paper: #fbfaf4;
  --ink: #1c231f;
  --ink-mute: #5c6660;
  --rule: #c8c2ab;
  --rule-strong: #2d5f5d;
  --accent: #2d5f5d;
  --accent-2: #8a6d1f;
  --seal: #a3352b;
  --accent-ink: #fbfaf4;
  --radius: 2px;
  --gutter: 16px;
  --max-width: 480px;
  --transition-fast: 120ms ease-out;
  --font-display:
    "Zen Old Mincho", "Hiragino Mincho ProN", "Noto Serif JP", serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14180f;
    --paper: #1b201a;
    --ink: #e9ece4;
    --ink-mute: #9aa398;
    --rule: #3a4238;
    --rule-strong: #6faaa5;
    --accent: #6faaa5;
    --accent-2: #c9a24a;
    --seal: #e0776a;
    --accent-ink: #14180f;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  overflow-x: hidden;
}

body {
  font-family:
    "Hiragino Sans",
    "Noto Sans JP",
    system-ui,
    -apple-system,
    sans-serif;
  font-size: 16px;
  line-height: 1.7;
  -webkit-text-size-adjust: 100%;
  /* 帳票用紙の背景テクスチャ（担当G納品・512pxシームレスタイル、
     薄緑罫線+複写伝票の耳）。淡い色味なので可読性への影響はない */
  background-image: url("img/bg-texture.webp");
  background-repeat: repeat;
  background-size: 512px 512px;
}

@media (prefers-color-scheme: dark) {
  body {
    /* ダークモードでは紙のテクスチャが浮くため外す */
    background-image: none;
  }
}

#app {
  max-width: var(--max-width);
  margin: 0 auto;
  min-height: 100vh;
  padding: 0 var(--gutter) 48px;
}

.noscript {
  padding: var(--gutter);
  text-align: center;
  color: var(--ink-mute);
}

.tnum,
.result-score,
.progress-count,
.sub-value,
.teaser-value {
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

button {
  font-family: inherit;
  cursor: pointer;
}

a {
  color: var(--accent);
}

.screen {
  padding-top: 32px;
}

@media (prefers-reduced-motion: no-preference) {
  .screen-enter {
    opacity: 0;
    transform: translateY(8px);
  }
  .screen-enter-active {
    opacity: 1;
    transform: translateY(0);
    transition:
      opacity var(--transition-fast),
      transform var(--transition-fast);
  }
}

.btn-primary {
  display: block;
  width: 100%;
  padding: 16px;
  margin-top: 24px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  transition: opacity var(--transition-fast);
}

.btn-primary:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-primary:not(:disabled):active {
  opacity: 0.82;
}

.btn-secondary {
  display: block;
  width: 100%;
  padding: 14px;
  margin-top: 16px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  font-size: 0.9375rem;
}

.btn-back {
  padding: 8px 4px;
  border: none;
  background: transparent;
  color: var(--ink-mute);
  font-size: 0.875rem;
  text-decoration: underline;
}

/* -------- イントロ：与信票の表紙 -------- */
.intro {
  border: 1px solid var(--rule-strong);
  padding: 24px 16px;
  background: var(--paper);
}

.intro-duration {
  display: inline-block;
  padding: 3px 10px;
  border: 1px solid var(--rule);
  color: var(--ink-mute);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

.intro-title {
  margin: 18px 0 10px;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.5;
  border-bottom: 2px solid var(--rule-strong);
  padding-bottom: 12px;
}

.intro-catch {
  margin: 0 0 4px;
  font-size: 1rem;
  color: var(--ink);
}

.intro-lead {
  margin: 0;
  color: var(--ink-mute);
  font-size: 0.8125rem;
}

/* -------- プログレス -------- */
.progress {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.progress-track {
  flex: 1;
  height: 3px;
  background: var(--rule);
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width var(--transition-fast);
}

.progress-count {
  color: var(--ink-mute);
  font-size: 0.8125rem;
  white-space: nowrap;
}

/* -------- 設問：審査票の一項目 -------- */
.question-label {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 1.1875rem;
  font-weight: 700;
  line-height: 1.6;
}

.question-help {
  margin: 0 0 20px;
  color: var(--ink-mute);
  font-size: 0.8125rem;
}

.question-body {
  margin-top: 24px;
}

.question-nav {
  min-height: 32px;
}

.choice-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.choice-btn {
  display: block;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--rule);
  border-left: 3px solid var(--rule-strong);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  font-size: 0.9375rem;
  text-align: left;
  transition:
    border-color var(--transition-fast),
    background var(--transition-fast);
}

.choice-btn:active {
  border-left-color: var(--seal);
  background: color-mix(in srgb, var(--accent) 8%, var(--paper));
}

.multi-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.multi-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--rule);
  background: var(--paper);
}

.multi-item input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.select-input,
.number-input-wrap input,
input[type="text"],
input[type="email"] {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--rule);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  font-size: 1rem;
  font-family: inherit;
}

.select-input:focus,
.number-input-wrap input:focus,
input[type="text"]:focus,
input[type="email"]:focus {
  outline: none;
  border-color: var(--accent);
}

.number-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.number-input-wrap input {
  flex: 1;
  font-feature-settings: "tnum";
}

.number-unit {
  margin-left: 10px;
  color: var(--ink-mute);
  font-size: 0.9375rem;
  white-space: nowrap;
}

/* -------- 計算中 -------- */
.calculating {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  color: var(--ink-mute);
  gap: 20px;
}

.calc-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--rule);
  border-top-color: var(--accent);
  border-radius: 50%;
}

@media (prefers-reduced-motion: no-preference) {
  .calc-spinner {
    animation: calc-spin 0.8s linear infinite;
  }
}

@keyframes calc-spin {
  to {
    transform: rotate(360deg);
  }
}

/* -------- 結果：審査票 -------- */
.result {
  text-align: center;
  border: 1px solid var(--rule-strong);
  padding: 20px 16px;
  background: var(--paper);
  position: relative;
}

/* 朱の印影（badgeの脇に置く決裁印のイメージ） */
.result::after {
  content: "審査目安";
  position: absolute;
  top: 16px;
  right: 16px;
  width: 46px;
  height: 46px;
  border: 2px solid var(--seal);
  border-radius: 50%;
  color: var(--seal);
  font-size: 0.625rem;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.3;
  transform: rotate(-8deg);
  opacity: 0.75;
}

.result-headline {
  margin: 0 0 4px;
  color: var(--ink-mute);
  font-size: 0.8125rem;
}

.result-score {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(3rem, 16vw, 5rem);
  font-weight: 700;
  line-height: 1.05;
  color: var(--accent);
  letter-spacing: 0.02em;
}

.result-unit {
  margin-left: 4px;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--ink-mute);
}

.result-badge {
  display: none; /* scoreValueにS/A/B/C/Dを表示しているため二重表示を避ける */
}

.result-percentile {
  margin: 10px 0 20px;
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* サイト固有可視化: 審査票フォーマットのレンジバー（result-view.jsが描画） */
.result-visual {
  margin: 0 0 24px;
  padding: 14px 8px 10px;
  border-top: 2px solid var(--rule-strong);
  border-bottom: 2px solid var(--rule-strong);
  background: var(--bg);
}

.result-visual svg {
  display: block;
  width: 100%;
  height: auto;
}

.gauge {
  display: none;
}

.sub-lines {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--rule);
  margin-bottom: 24px;
  text-align: left;
}

.sub-line {
  display: flex;
  justify-content: space-between;
  padding: 11px 2px;
  border-bottom: 1px solid var(--rule);
  font-size: 0.9375rem;
}

.sub-label {
  color: var(--ink-mute);
}

.sub-value {
  font-weight: 700;
}

.result-commentary {
  margin: 0 0 24px;
  text-align: left;
  color: var(--ink);
  font-size: 0.9375rem;
}

.teaser {
  margin-bottom: 24px;
  padding: 18px;
  border: 1px dashed var(--rule);
  background: var(--bg);
  text-align: left;
}

.teaser-value {
  margin: 0 0 6px;
  font-size: 1.625rem;
  font-weight: 700;
  color: var(--ink-mute);
  letter-spacing: 0.05em;
}

.teaser-note {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--ink-mute);
}

.cta-area {
  margin-bottom: 24px;
  text-align: left;
}

.lead-form {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--rule);
  background: var(--bg);
  text-align: left;
}

.lead-field {
  display: block;
  margin-bottom: 14px;
  font-size: 0.8125rem;
  color: var(--ink-mute);
}

.lead-field input {
  margin-top: 6px;
}

.consent-line {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 0.8125rem;
  color: var(--ink-mute);
}

.consent-line input {
  margin-top: 3px;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  accent-color: var(--accent);
}

.share-area {
  margin-bottom: 24px;
  text-align: left;
}

.ogp-preview {
  margin-bottom: 12px;
  border: 1px solid var(--rule);
  overflow: hidden;
}

.ogp-preview img {
  display: block;
  width: 100%;
  height: auto;
}

.share-buttons {
  display: flex;
  gap: 8px;
}

.share-btn {
  flex: 1;
  padding: 12px 6px;
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink);
  font-size: 0.8125rem;
  font-weight: 600;
}

.share-copy-msg {
  margin: 8px 0 0;
  color: var(--accent);
  font-size: 0.8125rem;
}

.sources {
  margin-bottom: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
  text-align: left;
}

.sources-title {
  margin: 0 0 6px;
  color: var(--ink-mute);
  font-size: 0.75rem;
  font-weight: 700;
}

.sources ul {
  margin: 0;
  padding-left: 18px;
  font-size: 0.75rem;
  color: var(--ink-mute);
}

.disclaimer {
  margin: 0 0 24px;
  text-align: left;
  color: var(--ink-mute);
  font-size: 0.6875rem;
  line-height: 1.6;
}

.operator-footer {
  padding-top: 16px;
  border-top: 1px solid var(--rule);
  text-align: left;
  color: var(--ink-mute);
  font-size: 0.75rem;
}

.operator-footer p {
  margin: 0;
}

.error-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: 16px;
  text-align: center;
  color: var(--ink-mute);
}
