/* ============================================================
   俺も住宅ローン返済シミュレーター - スタイル
   カラーコンセプト：さくら（二階調）
   ベース #FDEEF2 / アクセント #D46A8C / 警告 #8C3A52
   ============================================================ */

:root {
  --sakura-bg: #FDEEF2;
  --sakura-bg-soft: #FFF7F9;
  --sakura-main: #D46A8C;
  --sakura-main-dark: #B85272;
  --sakura-light: #F2AFC3;
  --sakura-deep: #8C3A52;
  --series-gold: #C9A227;
  --text-main: #3A2E33;
  --text-sub: #7A6670;
  --border-soft: #F0D3DC;
  --white: #FFFFFF;
  --success: #6FA98C;
  --shadow-soft: 0 4px 20px rgba(140, 58, 82, 0.08);
  --shadow-card: 0 2px 12px rgba(140, 58, 82, 0.10);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; }

body.mortgage-sim {
  margin: 0;
  font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, 'Hiragino Kaku Gothic ProN', sans-serif;
  background: linear-gradient(180deg, var(--sakura-bg) 0%, var(--sakura-bg-soft) 320px, #FAFAFA 100%);
  color: var(--text-main);
  line-height: 1.7;
}

.sim-container {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 16px 60px;
}

/* ---------- ヘッダー ---------- */

.sim-header {
  text-align: center;
  padding: 28px 16px 20px;
}

.sim-header .series-badge {
  display: inline-block;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--series-gold);
  border: 1px solid var(--series-gold);
  border-radius: 999px;
  padding: 3px 14px;
  margin-bottom: 14px;
  text-decoration: none;
  cursor: pointer;
}
.sim-header .series-badge:hover {
  background: var(--series-gold);
  color: var(--white);
}

.sim-header h1 {
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--text-main);
}

.sim-header p {
  font-size: 14px;
  color: var(--text-sub);
  margin: 0;
}

/* ---------- カード共通 ---------- */

.sim-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-soft);
}

.sim-card h2 {
  font-size: 17px;
  font-weight: 700;
  margin: 0 0 18px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--sakura-bg);
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.sim-card h2::before {
  content: '';
  width: 5px;
  height: 16px;
  background: var(--sakura-main);
  border-radius: 3px;
  display: inline-block;
}

/* ---------- フォーム要素 ---------- */

.field-group { margin-bottom: 20px; }
.field-group:last-child { margin-bottom: 0; }

.field-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
}

.field-label .optional-tag {
  font-weight: 400;
  font-size: 11px;
  color: var(--text-sub);
  margin-left: 4px;
}

.field-hint {
  font-size: 12px;
  color: var(--text-sub);
  margin-top: 6px;
}

.slider-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  height: 6px;
  border-radius: 3px;
  background: var(--sakura-bg);
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--sakura-main);
  border: 3px solid var(--white);
  box-shadow: 0 1px 4px rgba(140, 58, 82, 0.4);
  cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--sakura-main);
  border: 3px solid var(--white);
  box-shadow: 0 1px 4px rgba(140, 58, 82, 0.4);
  cursor: pointer;
}

.num-input-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

input[type="number"], input[type="text"], select {
  font-family: inherit;
  font-size: 15px;
  padding: 9px 12px;
  border: 1.5px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--sakura-bg-soft);
  color: var(--text-main);
  width: 100px;
  transition: border-color 0.15s;
}

input[type="number"]:focus, input[type="text"]:focus, select:focus {
  outline: none;
  border-color: var(--sakura-main);
}

select { width: 100%; cursor: pointer; }

.unit-label { font-size: 13px; color: var(--text-sub); }

/* ラジオボタン群（セグメントコントロール風） */

.segment-control {
  display: flex;
  background: var(--sakura-bg);
  border-radius: var(--radius-sm);
  padding: 4px;
  gap: 4px;
}

.segment-control input { display: none; }

.segment-control label {
  flex: 1;
  text-align: center;
  padding: 10px 8px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-sub);
  cursor: pointer;
  transition: all 0.15s;
}

.segment-control input:checked + label {
  background: var(--white);
  color: var(--sakura-deep);
  box-shadow: 0 1px 4px rgba(140, 58, 82, 0.15);
}

.radio-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.radio-list input { display: none; }

.radio-list label {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1.5px solid var(--border-soft);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-sub);
  cursor: pointer;
  transition: all 0.15s;
}

.radio-list input:checked + label {
  background: var(--sakura-main);
  border-color: var(--sakura-main);
  color: var(--white);
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--sakura-bg-soft);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-top: 12px;
}

.toggle-row .toggle-label {
  font-size: 13px;
  font-weight: 600;
  flex: 1;
}

.toggle-row .toggle-sub {
  font-size: 11px;
  color: var(--text-sub);
  font-weight: 400;
  display: block;
  margin-top: 2px;
}

.switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.switch input { opacity: 0; width: 0; height: 0; }

.switch-track {
  position: absolute;
  inset: 0;
  background: var(--border-soft);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s;
}

.switch-track::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: var(--white);
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.switch input:checked + .switch-track { background: var(--sakura-main); }
.switch input:checked + .switch-track::before { transform: translateX(20px); }

.is-hidden { display: none !important; }

/* ---------- 計算ボタン ---------- */

.calc-btn {
  display: block;
  width: 100%;
  padding: 16px;
  margin-top: 8px;
  background: linear-gradient(135deg, var(--sakura-main), var(--sakura-main-dark));
  color: var(--white);
  font-size: 16px;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(212, 106, 140, 0.35);
  transition: transform 0.15s, box-shadow 0.15s;
}

.calc-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(212, 106, 140, 0.45); }
.calc-btn:active { transform: translateY(0); }

/* ---------- 結果セクション ---------- */

#resultSection { animation: fadeUp 0.5s ease; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.summary-item {
  background: var(--sakura-bg-soft);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
}

.summary-item.is-hero {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, var(--sakura-main), var(--sakura-main-dark));
  color: var(--white);
  padding: 22px 16px;
}

.summary-item .label {
  font-size: 12px;
  color: var(--text-sub);
  margin-bottom: 6px;
}

.summary-item.is-hero .label { color: rgba(255,255,255,0.85); }

.summary-item .value {
  font-size: 22px;
  font-weight: 700;
  color: var(--sakura-deep);
}

.summary-item.is-hero .value { font-size: 30px; color: var(--white); }

.summary-item .note {
  font-size: 11px;
  color: var(--text-sub);
  margin-top: 6px;
  line-height: 1.5;
}

.summary-item.is-hero .note { color: rgba(255,255,255,0.85); }

.bonus-note {
  font-size: 12px;
  color: var(--text-sub);
  background: var(--sakura-bg-soft);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-top: 14px;
}

/* ---------- 未払利息警告 ---------- */

.unpaid-warning {
  margin-top: 16px;
  background: #FBEAEE;
  border: 1.5px solid var(--sakura-deep);
  border-radius: var(--radius-md);
  padding: 16px;
}

.unpaid-warning .warn-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  color: var(--sakura-deep);
  font-size: 14px;
  margin-bottom: 8px;
}

.unpaid-warning p {
  font-size: 13px;
  color: var(--text-main);
  margin: 4px 0;
}

.unpaid-warning strong { color: var(--sakura-deep); }

/* ---------- ランクボックス ---------- */

.rank-box {
  margin-top: 20px;
  text-align: center;
  background: linear-gradient(180deg, var(--sakura-bg-soft), var(--white));
  border: 1.5px solid var(--sakura-light);
  border-radius: var(--radius-lg);
  padding: 24px 16px;
}

.rank-box .rank-emoji {
  font-size: 52px;
  line-height: 1;
  display: block;
  margin-bottom: 10px;
}

.rank-box.rank-animate .rank-emoji {
  animation: rankPop 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes rankPop {
  0% { transform: scale(0.3); opacity: 0; }
  60% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); }
}

.rank-box .rank-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--sakura-deep);
  margin-bottom: 4px;
}

.rank-box .rank-burden {
  font-size: 12px;
  color: var(--series-gold);
  font-weight: 700;
  margin-bottom: 10px;
}

.rank-box .rank-desc {
  font-size: 13px;
  color: var(--text-sub);
  max-width: 460px;
  margin: 0 auto;
}

/* ---------- チャート ---------- */

.chart-wrap {
  position: relative;
  height: 260px;
  margin-top: 8px;
}

.chart-wrap.is-donut { height: 220px; }

/* ---------- ネイティブ広告枠 ---------- */

.native-ad-slot {
  margin: 20px 0;
  padding: 14px;
  background: #FAFAFA;
  border: 1px dashed var(--border-soft);
  border-radius: var(--radius-md);
  text-align: center;
  font-size: 11px;
  color: var(--text-sub);
}

/* ---------- 次のアクション導線 ---------- */

.next-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.next-action-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--sakura-bg-soft);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-main);
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--border-soft);
  transition: background 0.15s;
}

.next-action-link:hover { background: var(--sakura-bg); }
.next-action-link .arrow { color: var(--sakura-main); font-size: 16px; }

/* ---------- フッター注記 ---------- */

.sim-disclaimer {
  font-size: 11px;
  color: var(--text-sub);
  text-align: center;
  margin-top: 24px;
  line-height: 1.8;
  padding: 0 12px;
}

/* ---------- レスポンシブ ---------- */

@media (max-width: 480px) {
  .sim-header h1 { font-size: 20px; }
  .sim-card { padding: 18px 14px; border-radius: var(--radius-md); }
  .summary-item .value { font-size: 18px; }
  .summary-item.is-hero .value { font-size: 24px; }
  .chart-wrap { height: 220px; }
  input[type="number"] { width: 80px; }
}

/* ---------- アクセシビリティ ---------- */

:focus-visible {
  outline: 2px solid var(--sakura-main);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ============================================================
   Phase3固有: 複数シナリオ比較テーブル・ベスト/ワースト表示
   ============================================================ */

.scenario-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.scenario-table th, .scenario-table td {
  padding: 10px 6px;
  text-align: center;
  border-bottom: 1px solid var(--border-soft);
}

.scenario-table th {
  font-size: 11px;
  color: var(--text-sub);
  font-weight: 700;
  background: var(--sakura-bg-soft);
}

.scenario-table td.label-cell {
  text-align: left;
  font-weight: 700;
  color: var(--text-main);
  font-size: 12px;
}

.scenario-table tr.is-best td.label-cell {
  color: var(--success);
}

.scenario-table tr.is-worst td.label-cell {
  color: var(--sakura-deep);
}

.scenario-table .badge-best, .scenario-table .badge-worst {
  display: inline-block;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  margin-left: 4px;
  font-weight: 700;
}

.scenario-table .badge-best { background: #E4F1EA; color: var(--success); }
.scenario-table .badge-worst { background: #FBEAEE; color: var(--sakura-deep); }

.scenario-table .warn-icon {
  color: var(--sakura-deep);
  font-size: 11px;
  margin-left: 3px;
}

.scenario-table tr:last-child td { border-bottom: none; }

/* ============================================================
   共通追加: ヘッダー画像・広告カード・フッターリンク・
   コピーライト・シェアボタン
   ============================================================ */

/* ---------- ヘッダー画像エリア ---------- */

.page-header-image-wrap {
  text-align: center;
  max-width: 760px;
  margin: 0 auto;
  padding: 16px 16px 0;
}

.page-header-image {
  width: 100%;
  max-width: 720px;
  height: auto;
  border-radius: var(--radius-lg);
  display: block;
  margin: 0 auto;
  box-shadow: var(--shadow-soft);
}

/* ---------- ネイティブ広告カード ---------- */

.native-ad-slot {
  text-align: left;
  padding: 16px;
  background: var(--sakura-bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  margin: 20px 0;
  font-size: 12px;
  color: var(--text-main);
}

.ad-label {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-sub);
  background: var(--sakura-bg);
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 10px;
  letter-spacing: 0.05em;
}

.ad-content {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.ad-icon {
  font-size: 30px;
  flex-shrink: 0;
  line-height: 1;
}

.ad-text { flex: 1; }

.ad-headline {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
  line-height: 1.5;
}

.ad-description {
  font-size: 12px;
  color: var(--text-sub);
  line-height: 1.6;
  margin: 0;
}

.ad-cta {
  display: inline-block;
  margin-top: 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--sakura-deep);
  text-decoration: none;
}

.ad-cta:hover { text-decoration: underline; }

/* ---------- シェアボタン ---------- */

.share-buttons {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.share-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border: 1.5px solid var(--border-soft);
  background: var(--white);
  color: var(--text-main);
  transition: all 0.15s;
  font-family: inherit;
}

.share-btn:hover { background: var(--sakura-bg-soft); }

.share-btn.is-x {
  background: #000;
  color: #fff;
  border-color: #000;
}

.share-btn.is-x:hover { background: #222; }

.share-btn.is-copy.is-copied {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}

/* ---------- フッターリンク・コピーライト ---------- */

.footer-links {
  display: flex;
  justify-content: center;
  gap: 28px;
  margin: 28px 0 14px;
}

.footer-links a {
  font-size: 12px;
  color: var(--text-sub);
  text-decoration: underline;
}

.site-copyright {
  text-align: center;
  font-size: 11px;
  color: var(--text-sub);
  margin-top: 20px;
  padding-bottom: 4px;
}
