/*
 * styles.css — インフレ家計耐性診断
 * signature = 「伸びるレシート」
 * palette: paper#FBF7EE / ink#2A2622 / receipt-line#C9BFA8 / price-tag#E23B2E / ok#2F8F5B / thermal#8A8276
 * サンセリフ＋等幅数字（感熱紙プリンタ風）・明朝禁止
 * AIデフォルト①（cream+セリフ+テラコッタ）に寄せない
 * 既存5本（ギガ漏れ/固定費/ポイ活/ちりつも/SubsDiet）のCSSから流用しない
 */

/* ===== CSS変数 ===== */
:root {
  --paper:        #FBF7EE;   /* レシート紙 */
  --paper-dark:   #F0E9DB;   /* やや濃いめの紙（カード背景） */
  --ink:          #2A2622;   /* 感熱インク */
  --receipt-line: #C9BFA8;   /* 感熱罫線 */
  --price-tag:    #E23B2E;   /* 赤い価格シール */
  --price-tag-dk: #B82E23;   /* 価格シール濃 */
  --ok:           #2F8F5B;   /* 防御グリーン */
  --ok-light:     #D4EDDF;   /* グリーン薄 */
  --thermal:      #8A8276;   /* サーマル注釈 */
  --muted:        #ABA49A;   /* ミュート文字 */
  --surface:      #FFFFFF;   /* 白カード */
  --border:       #D6CEC0;   /* ボーダー */

  /* タイポグラフィ */
  --font-body: "Hiragino Sans", "Yu Gothic", "Noto Sans JP", "Meiryo", sans-serif;
  --font-num:  "Courier New", "Menlo", "Consolas", "Lucida Console", monospace; /* 等幅数字（感熱紙風） */
}

/* ===== リセット ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  background-color: var(--paper);
  color: var(--ink);
  line-height: 1.6;
  font-size: 15px;
  /* 感熱紙の横スキャンライン背景 */
  background-image: repeating-linear-gradient(
    to bottom,
    transparent,
    transparent 7px,
    rgba(201,191,168,0.12) 7px,
    rgba(201,191,168,0.12) 8px
  );
}

.container {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 20px;
}

a {
  color: var(--price-tag);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* ===== ヘッダ ===== */
.site-header {
  background: var(--ink);
  padding: 16px 0 14px;
  /* ヘッダ下のギザギザ感熱縁 */
  border-bottom: 3px solid var(--price-tag);
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-logo {
  font-family: var(--font-body);
  font-size: 20px;
  font-weight: 700;
  color: var(--paper);
  letter-spacing: 0.02em;
}

.logo-icon {
  display: inline-block;
  width: 20px;
  height: 20px;
  background: var(--price-tag);
  border-radius: 2px;
  margin-right: 8px;
  vertical-align: -3px;
}

.site-tagline {
  font-size: 12px;
  color: var(--receipt-line);
  margin-top: 2px;
  font-family: var(--font-num);
  letter-spacing: 0.04em;
}

/* ===== ヒーロー ===== */
.hero {
  background: var(--ink);
  color: var(--paper);
  padding: 56px 0 48px;
  position: relative;
  overflow: hidden;
}

/* レシート感熱紙縞模様 */
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent,
    transparent 6px,
    rgba(201,191,168,0.05) 6px,
    rgba(201,191,168,0.05) 7px
  );
  pointer-events: none;
}

.hero-eyebrow {
  font-family: var(--font-num);
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--receipt-line);
  margin-bottom: 16px;
  text-transform: uppercase;
}

.hero-title {
  font-size: clamp(26px, 5vw, 40px);
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 20px;
  color: var(--paper);
}

.receipt-word {
  color: var(--price-tag);
  font-style: normal;
}

.hero-subtitle {
  font-size: 14px;
  color: var(--receipt-line);
  line-height: 1.7;
  margin-bottom: 32px;
  max-width: 500px;
}

/* ヒーロー：レシートプレビュー（signature） */
.hero-receipt-preview {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(201,191,168,0.25);
  border-radius: 4px;
  padding: 20px;
  margin-bottom: 32px;
  max-width: 320px;
  position: relative;
}

.hero-receipt-label {
  font-family: var(--font-num);
  font-size: 10px;
  letter-spacing: 0.15em;
  color: var(--receipt-line);
  margin-bottom: 12px;
  text-transform: uppercase;
}

/* レシートバー（縦）: 低スコア=長い */
.hero-receipt-bar-wrap {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 80px;
}

.hero-receipt-bar {
  width: 28px;
  background: rgba(201,191,168,0.15);
  border: 1px solid rgba(201,191,168,0.3);
  border-radius: 2px;
  position: relative;
  overflow: hidden;
}

.hero-receipt-bar::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--price-tag);
  opacity: 0.7;
}

.hero-receipt-bar.long::after  { height: 90%; }
.hero-receipt-bar.mid::after   { height: 55%; }
.hero-receipt-bar.short::after { height: 25%; }

.hero-receipt-note {
  font-size: 11px;
  color: var(--thermal);
  margin-top: 10px;
  font-family: var(--font-body);
}

.btn-hero {
  display: inline-block;
  background: var(--price-tag);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  padding: 14px 32px;
  border-radius: 3px;
  letter-spacing: 0.03em;
  transition: background 0.15s;
}
.btn-hero:hover {
  background: var(--price-tag-dk);
  text-decoration: none;
  color: #fff;
}

/* ===== 設問セクション ===== */
.input-section {
  padding: 40px 0;
}

.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  margin: 32px 0 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-title:first-child {
  margin-top: 0;
}

/* ===== カード ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 20px;
  margin-bottom: 12px;
  /* 感熱紙風の微かな影 */
  box-shadow: 2px 2px 0 var(--receipt-line);
}

/* ===== 設問ブロック ===== */
.q-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 18px 20px 16px;
  margin-bottom: 12px;
  box-shadow: 2px 2px 0 var(--receipt-line);
}

.q-text {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 12px;
  line-height: 1.5;
}

/* ===== チップ選択 ===== */
.choice-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.choice-chip {
  padding: 8px 16px;
  border: 1.5px solid var(--border);
  border-radius: 2px;
  background: var(--paper);
  color: var(--ink);
  font-size: 13px;
  font-family: var(--font-body);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
  line-height: 1.3;
}

.choice-chip:hover {
  border-color: var(--price-tag);
  background: #FEF0EF;
}

.choice-chip.is-active {
  border-color: var(--price-tag);
  background: var(--price-tag);
  color: #fff;
  font-weight: 600;
}

/* ===== 診断ボタン ===== */
.diagnose-wrap {
  margin-top: 28px;
  text-align: center;
}

#diagnose-btn {
  background: var(--price-tag);
  color: #fff;
  border: none;
  border-radius: 3px;
  padding: 16px 48px;
  font-size: 16px;
  font-weight: 700;
  font-family: var(--font-body);
  cursor: pointer;
  letter-spacing: 0.03em;
  transition: background 0.15s, opacity 0.15s;
}

#diagnose-btn:disabled {
  background: var(--receipt-line);
  cursor: not-allowed;
  opacity: 0.7;
}

#diagnose-btn:not(:disabled):hover {
  background: var(--price-tag-dk);
}

/* ===== 結果セクション ===== */
#result-section.hidden {
  display: none;
}

#result-section {
  padding: 36px 0 48px;
  border-top: 2px dashed var(--receipt-line);
  margin-top: 16px;
}

/* ===== 伸びるレシートメーター（signature）===== */
.receipt-meter-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 24px 20px 20px;
  margin-bottom: 16px;
  box-shadow: 2px 2px 0 var(--receipt-line);
  display: flex;
  align-items: flex-start;
  gap: 24px;
}

.receipt-meter-label {
  font-family: var(--font-num);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--thermal);
  margin-bottom: 10px;
  text-transform: uppercase;
}

/* スコア数字 */
.resistance-number {
  font-family: var(--font-num);
  font-size: 80px;
  font-weight: bold;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.resistance-number.score-high { color: var(--ok); }
.resistance-number.score-mid  { color: var(--ink); }
.resistance-number.score-low  { color: var(--price-tag); }

.resistance-suffix {
  font-family: var(--font-num);
  font-size: 22px;
  color: var(--thermal);
  margin-left: 4px;
  vertical-align: middle;
}

.receipt-score-note {
  font-size: 11px;
  color: var(--thermal);
  margin-top: 6px;
  line-height: 1.5;
}

/* レシートバー（縦）: 低スコア=高い（レシートが長い） */
.receipt-bar-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 48px;
}

.receipt-bar-wrap {
  width: 36px;
  height: 120px;
  background: var(--paper-dark);
  border: 1px solid var(--border);
  border-radius: 2px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column-reverse;
}

/* 感熱罫線（レシート本体） */
.receipt-bar-wrap::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent,
    transparent 6px,
    rgba(201,191,168,0.35) 6px,
    rgba(201,191,168,0.35) 7px
  );
  pointer-events: none;
  z-index: 1;
}

#receipt-fill {
  width: 100%;
  background: var(--price-tag);
  opacity: 0.75;
  transition: height 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 0;
}

#receipt-ok-fill {
  width: 100%;
  background: var(--ok);
  opacity: 0.5;
  transition: height 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 0;
}

.receipt-bar-label {
  font-family: var(--font-num);
  font-size: 9px;
  color: var(--thermal);
  text-align: center;
  letter-spacing: 0.04em;
}

/* ===== 値上げ影響タイプ ===== */
.type-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 2px 2px 0 var(--receipt-line);
}

.type-label {
  font-family: var(--font-num);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--thermal);
  text-transform: uppercase;
  margin-bottom: 10px;
}

/* 価格シール風ボックス */
.result-type-tag {
  display: inline-block;
  background: var(--price-tag);
  color: #fff;
  font-size: 12px;
  padding: 2px 10px;
  border-radius: 2px;
  margin-bottom: 10px;
  font-family: var(--font-body);
}

.result-type-name {
  font-size: 26px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 6px;
  line-height: 1.3;
}
.result-type-name.type-high { color: var(--ok); }
.result-type-name.type-mid  { color: var(--ink); }
.result-type-name.type-low  { color: var(--price-tag); }

.result-preamble {
  font-size: 13px;
  color: var(--thermal);
  font-family: var(--font-body);
}

/* ===== 弱点上位3 ===== */
.weak-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 2px 2px 0 var(--receipt-line);
}

.weak-heading {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--receipt-line);
}

.weak-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--receipt-line);
}
.weak-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.weak-rank {
  font-family: var(--font-num);
  font-size: 11px;
  color: var(--thermal);
  min-width: 24px;
  text-align: center;
  background: var(--paper-dark);
  border-radius: 2px;
  padding: 2px 4px;
}

.weak-cat {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  flex: 1;
}

.weak-severity {
  font-size: 11px;
  color: var(--thermal);
  text-align: right;
}

.weak-sev-2 .weak-cat {
  color: var(--price-tag);
}

.weak-none-msg {
  font-size: 14px;
  color: var(--ok);
  line-height: 1.6;
}

/* ===== 次に見るべき診断 ===== */
.recommended-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 2px 2px 0 var(--receipt-line);
}

#recommended-heading {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--receipt-line);
}

#recommended-apps {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rec-app-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
  transition: border-color 0.12s, background 0.12s;
  box-shadow: 1px 1px 0 var(--receipt-line);
}
.rec-app-card:hover {
  border-color: var(--price-tag);
  background: #FEF0EF;
  text-decoration: none;
  color: var(--ink);
}

.rec-app-card.rec-app-primary {
  border: 2px solid var(--price-tag);
  background: #FEF4F3;
}

.rec-app-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}
.rec-app-card.rec-app-primary .rec-app-title {
  color: var(--price-tag);
}

.rec-app-blurb {
  font-size: 11px;
  color: var(--thermal);
}

/* ===== 注記（§7-5）===== */
.disclaimer-card {
  background: var(--paper-dark);
  border: 1px dashed var(--border);
  border-radius: 4px;
  padding: 14px 16px;
  margin-bottom: 16px;
}

#disclaimer-body {
  font-size: 11px;
  color: var(--thermal);
  line-height: 1.7;
}

/* ===== シェアカード ===== */
#share-card-preview {
  max-width: 100%;
  border-radius: 4px;
  border: 1px solid var(--border);
  margin-bottom: 12px;
}

.share-preview-wrap {
  margin-bottom: 12px;
}

.share-preview-label {
  font-size: 12px;
  color: var(--thermal);
  margin-bottom: 6px;
}

.share-variant-chooser {
  margin-bottom: 12px;
}

.share-variant-label {
  font-size: 12px;
  color: var(--thermal);
  margin-bottom: 6px;
}

.share-variant-preview {
  background: var(--paper-dark);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 10px 12px;
  font-size: 12px;
  color: var(--ink);
  white-space: pre-wrap;
  margin-top: 8px;
  line-height: 1.6;
}

.share-btn {
  display: inline-block;
  margin: 4px 4px 4px 0;
  padding: 10px 18px;
  border: none;
  border-radius: 3px;
  font-size: 13px;
  font-family: var(--font-body);
  cursor: pointer;
  font-weight: 600;
}

.share-btn.btn-primary  { background: var(--price-tag); color: #fff; }
.share-btn.btn-secondary { background: var(--ink); color: var(--paper); }
.share-btn.btn-x        { background: #000; color: #fff; }
.share-btn.btn-line     { background: #06C755; color: #fff; }
.share-btn.btn-variant  { background: var(--paper-dark); color: var(--ink); border: 1px solid var(--border); }
.share-btn.btn-variant.is-active { border-color: var(--price-tag); color: var(--price-tag); }

.share-image-hint {
  font-size: 11px;
  color: var(--thermal);
  margin-top: 8px;
  line-height: 1.5;
}

.share-image-notice {
  font-size: 12px;
  color: var(--thermal);
}

#share-panel.hidden {
  display: none;
}

/* ===== CTA（アフィリエイト／レシート明細テーブル）===== */
.cta-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 18px 20px;
  margin-bottom: 16px;
  box-shadow: 2px 2px 0 var(--receipt-line);
}

.receipt-offer-heading {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 8px;
  font-family: var(--font-num);
  letter-spacing: 0.04em;
  border-bottom: 1px dashed var(--receipt-line);
  padding-bottom: 6px;
}

/* レシート明細テーブル */
.receipt-offer-table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0 0;
  font-family: var(--font-num);
}

.receipt-offer-row {
  border-bottom: 1px dashed var(--receipt-line);
}
.receipt-offer-row:last-child {
  border-bottom: none;
}

.receipt-offer-name {
  padding: 9px 8px 9px 0;
  vertical-align: middle;
  width: 100%;
}

.receipt-offer-action {
  padding: 9px 0 9px 8px;
  vertical-align: middle;
  white-space: nowrap;
}

.ad-badge {
  font-size: 9px;
  background: var(--thermal);
  color: #fff;
  border-radius: 2px;
  padding: 1px 5px;
  line-height: 1.4;
  margin-right: 6px;
  font-family: var(--font-body);
  display: inline-block;
  vertical-align: middle;
}

.receipt-offer-label {
  font-size: 13px;
  color: var(--ink);
  font-family: var(--font-body);
  vertical-align: middle;
}

.receipt-offer-link {
  font-size: 12px;
  color: var(--surface);
  background: var(--price-tag);
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 2px;
  text-decoration: none;
  display: inline-block;
  font-family: var(--font-body);
  transition: background 0.12s;
}
.receipt-offer-link:hover {
  background: var(--price-tag-dk);
  text-decoration: none;
  color: #fff;
}

/* レシート合計行 */
.receipt-offer-total {
  margin-top: 10px;
  font-family: var(--font-num);
  font-size: 11px;
  color: var(--thermal);
  text-align: right;
  letter-spacing: 0.04em;
  border-top: 2px solid var(--receipt-line);
  padding-top: 6px;
}

/* ===== crosspromo（promo-receipt）===== */
#crosspromo {
  padding: 32px 0;
  border-top: 2px dashed var(--receipt-line);
}

#crosspromo.hidden {
  display: none;
}

.crosspromo-heading {
  font-size: 13px;
  font-weight: 700;
  color: var(--thermal);
  margin-bottom: 12px;
  font-family: var(--font-num);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.promo-receipt-row {
  margin-bottom: 8px;
}

.promo-receipt-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  text-decoration: none;
  color: var(--ink);
  box-shadow: 1px 1px 0 var(--receipt-line);
  transition: border-color 0.12s, background 0.12s;
}
.promo-receipt-link:hover {
  border-color: var(--price-tag);
  background: #FEF0EF;
  text-decoration: none;
  color: var(--ink);
}

.promo-receipt-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  flex: 0 0 auto;
}

.promo-receipt-blurb {
  font-size: 12px;
  color: var(--thermal);
}

/* ===== リトライ ===== */
#retry-btn {
  display: block;
  width: 100%;
  padding: 12px;
  background: var(--paper-dark);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--thermal);
  font-size: 13px;
  font-family: var(--font-body);
  cursor: pointer;
  margin-top: 20px;
  transition: background 0.12s;
}
#retry-btn:hover {
  background: var(--border);
  color: var(--ink);
}

/* ===== フッタ ===== */
.site-footer {
  background: var(--ink);
  color: var(--receipt-line);
  padding: 32px 0 24px;
  margin-top: 48px;
  border-top: 3px solid var(--price-tag);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 20px;
}

@media (max-width: 500px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }
}

.site-footer h3 {
  font-size: 12px;
  font-weight: 700;
  color: var(--paper);
  margin-bottom: 8px;
}

.site-footer p {
  font-size: 11px;
  line-height: 1.7;
  color: var(--thermal);
}

.site-footer a {
  color: var(--receipt-line);
}

.footer-disclaimer {
  border-top: 1px dashed var(--thermal);
  padding-top: 16px;
  font-size: 11px;
  color: var(--thermal);
  line-height: 1.7;
}

/* ===== ユーティリティ ===== */
.hidden {
  display: none !important;
}

/* ===== レスポンシブ ===== */
@media (max-width: 480px) {
  .receipt-meter-card {
    flex-direction: column;
  }
  .resistance-number {
    font-size: 60px;
  }
  #diagnose-btn {
    width: 100%;
    padding: 16px 24px;
  }
  .btn-hero {
    width: 100%;
    text-align: center;
  }
}
