/* ==========================================================================
   1. 共通ベーススタイル (Apple / SF Pro 準拠)
   ========================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', sans-serif;
  background: #f2f2f7;
  color: #1c1c1e;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  background: #f2f2f7;
  padding: 16px 0 48px;
  max-width: 600px;
  margin: 0 auto;
  position: relative;
}

/* ==========================================================================
   追加：ヘッダー画像のレスポンシブ・中央揃えスタイル
   ========================================================================== */
.header-container {
  width: 100%;
  padding: 0 16px;
  margin-bottom: 16px;
  display: block;
  text-align: center;
}

.header-link {
  display: block;
  width: 100%;
  text-decoration: none;
  line-height: 0;
  overflow: hidden;
  border-radius: 18px; /* アプリのカードデザインに合わせた角丸 */
}

.header-img {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}

/* ==========================================================================
   2. 入力画面（INPUT AREA）のスタイル
   ========================================================================== */
.nav {
  padding: 6px 20px 12px;
}

.nav-sub {
  font-size: 13px;
  color: #8e8e93;
  font-weight: 400;
  margin-top: 2px;
}

.nav-title {
  font-size: 28px;
  font-weight: 700;
  color: #1c1c1e;
  letter-spacing: -0.5px;
}

/* ヒーローバッジ */
.hero-badge {
  margin: 4px 16px 20px;
}

.badge-inner {
  background: #fff;
  border-radius: 18px;
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.badge-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: #f0faf4;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.badge-text-title {
  font-size: 14px;
  font-weight: 600;
  color: #1c1c1e;
  line-height: 1.3;
}

.badge-text-sub {
  font-size: 12px;
  color: #34c759;
  font-weight: 600;
  margin-top: 3px;
}

/* 基本カード構造 */
.card {
  background: #fff;
  border-radius: 18px;
  margin: 0 16px 12px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.card-label {
  font-size: 13px;
  font-weight: 600;
  color: #8e8e93;
  margin-bottom: 8px;
  letter-spacing: -0.1px;
}

/* 数値入力行：右寄せ配置 */
.input-row {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  border-bottom: 1px solid #e5e5ea;
  padding-bottom: 6px;
  margin-bottom: 12px;
}

.num-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 32px;
  font-weight: 700;
  color: #1c1c1e;
  padding: 0;
  font-family: inherit;
  text-align: right;
  padding-right: 4px;
}

.unit {
  font-size: 18px;
  font-weight: 600;
  color: #1c1c1e;
  margin-left: 2px;
  flex-shrink: 0;
}

/* トグル（金額/利回り切り替え） */
.toggle-container {
  display: flex;
  background: #7676801f;
  border-radius: 8px;
  padding: 2px;
  margin-bottom: 14px;
}

.toggle-btn {
  flex: 1;
  background: none;
  border: none;
  padding: 6px 0;
  font-size: 13px;
  font-weight: 600;
  color: #1c1c1e;
  cursor: pointer;
  border-radius: 6px;
  font-family: inherit;
  transition: background 0.15s, box-shadow 0.15s;
}

.toggle-btn.active {
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* チップ選択コンテナ */
.chip-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip-btn {
  background: #f2f2f7;
  border: none;
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 500;
  color: #1c1c1e;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.1s ease;
}

.chip-btn.active {
  background: #1c1c1e;
  color: #fff;
  font-weight: 600;
}

/* ==========================================================================
   広告エリア（PR / ネイティブアド）
   ========================================================================== */
.ad-card {
  background: #fff;
  border-radius: 18px;
  margin: 4px 16px 16px;
  padding: 14px 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
  border: 1px solid #f0f0f2;
}

.ad-card-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.ad-label {
  font-size: 10px;
  font-weight: 700;
  color: #8e8e93;
  background: #f2f2f7;
  display: inline-block;
  padding: 3px 7px;
  border-radius: 5px;
  letter-spacing: 0.5px;
}

.ad-context {
  font-size: 11px;
  color: #8e8e93;
  font-weight: 500;
}

.ad-link-block {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  border-radius: 12px;
  transition: background 0.15s ease;
}

.ad-link-block:active {
  background: #f9f9fb;
}

.ad-icon {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  background: linear-gradient(135deg, #34c759 0%, #11998e 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
  font-size: 19px;
  box-shadow: 0 3px 8px rgba(52,199,89,0.25);
}

.ad-content {
  flex: 1;
  min-width: 0;
}

.ad-title {
  font-size: 15px;
  font-weight: 700;
  color: #1c1c1e;
  margin-bottom: 3px;
  letter-spacing: -0.2px;
}

.ad-desc {
  font-size: 12px;
  color: #8e8e93;
  line-height: 1.5;
}

.ad-cta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  color: #34c759;
  margin-top: 6px;
}

.ad-arrow {
  color: #c7c7cc;
  font-size: 14px;
  flex-shrink: 0;
}

/* 簡易プレビューカード */
.preview-card {
  background: #fff;
  border: 1px solid #e5e5ea;
}

.preview-grid {
  display: flex;
  justify-content: space-between;
}

.p-item {
  flex: 1;
}

.p-lbl {
  font-size: 11px;
  color: #8e8e93;
  font-weight: 500;
  margin-bottom: 2px;
}

.p-val {
  font-size: 20px;
  font-weight: 700;
  color: #1c1c1e;
}

.p-val.blue { color: #007aff; }
.p-val.orange { font-size: 22px; color: #ff9500; }

.p-sub {
  font-size: 11px;
  color: #8e8e93;
  margin-top: 1px;
}

.preview-divider {
  height: 1px;
  background: #f2f2f7;
  margin: 12px 0;
}

.preview-note {
  font-size: 11px;
  color: #8e8e93;
  margin-top: 10px;
  text-align: center;
  white-space: pre-line;
}

/* 実行ボタンエリア */
.btn-wrap {
  padding: 12px 16px 24px;
}

.btn-sim {
  width: 100%;
  background: #007aff;
  color: #fff;
  border: none;
  border-radius: 14px;
  padding: 16px;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s;
  box-shadow: 0 4px 12px rgba(0,122,255,0.15);
}

.btn-sim:active {
  background: #0056b3;
}

.btn-sim.disabled {
  background: #d1d1d6;
  color: #aeaeae;
  cursor: not-allowed;
  box-shadow: none;
}

/* エラーカード */
.error-card {
  background: #ff3b3014;
  border: 1px solid #ff3b3033;
  border-radius: 14px;
  margin: 0 16px 12px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.error-icon {
  color: #ff3b30;
  font-size: 16px;
  flex-shrink: 0;
}

.error-text {
  font-size: 13px;
  color: #ff3b30;
  font-weight: 500;
  line-height: 1.4;
}

/* ==========================================================================
   3. 結果画面（RESULT AREA）のスタイル
   ========================================================================== */
#resultSection {
  border-top: 1px solid #d1d1d6;
  padding-top: 8px;
  margin-top: 8px;
}

.res-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 20px 16px;
}

.back-btn {
  font-size: 15px;
  color: #007aff;
  display: flex;
  align-items: center;
  gap: 2px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
}

.res-nav-title {
  font-size: 17px;
  font-weight: 600;
  color: #1c1c1e;
}

.nav-more {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0,0,0,0.06);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 15px;
}

/* ランクバナー */
.rank-banner {
  margin: 0 16px 14px;
  border-radius: 20px;
  padding: 20px 18px;
  position: relative;
  overflow: hidden;
  color: #fff;
}

.rank-lion { background: linear-gradient(135deg, #1d1d1f 0%, #434348 100%); }
.rank-cheetah { background: linear-gradient(135deg, #ff9500 0%, #ff5e00 100%); }
.rank-rabbit { background: linear-gradient(135deg, #34c759 0%, #11998e 100%); }
.rank-snail { background: linear-gradient(135deg, #007aff 0%, #0056b3 100%); }

.rank-top {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.rank-emoji {
  font-size: 40px;
  line-height: 1;
}

.rank-meta {
  display: flex;
  flex-direction: column;
}

.rank-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.2px;
}

.rank-subtitle {
  font-size: 13px;
  opacity: 0.9;
  font-weight: 600;
  margin-top: 1px;
}

.rank-desc {
  font-size: 13px;
  line-height: 1.45;
  opacity: 0.95;
  font-weight: 400;
}

/* 超巨大ヒーローカード */
.res-card-hero {
  background: #007aff0d;
  border: 1px solid #007aff1a;
  border-radius: 20px;
  margin: 0 16px 12px;
  padding: 24px 16px;
  text-align: center;
}

.rc-hero-label {
  font-size: 13px;
  font-weight: 600;
  color: #007aff;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}

.rc-hero-value {
  font-size: 52px;
  font-weight: 800;
  color: #1c1c1e;
  line-height: 1.1;
  letter-spacing: -1px;
}

.rc-hero-unit {
  font-size: 24px;
  font-weight: 700;
  margin-left: 2px;
  color: #1c1c1e;
}

.rc-hero-sub {
  font-size: 14px;
  font-weight: 600;
  color: #8e8e93;
  margin-top: 8px;
}

/* マイルストーン */
.milestone-card {
  background: #fff;
  border-radius: 20px;
  margin: 0 16px 12px;
  padding: 20px 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.milestone-title {
  font-size: 14px;
  font-weight: 700;
  color: #1c1c1e;
  margin-bottom: 18px;
  letter-spacing: -0.1px;
}

.milestone-timeline {
  position: relative;
  padding-left: 20px;
}

.milestone-timeline::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 8px;
  bottom: 24px;
  width: 2px;
  background: #e5e5ea;
}

.milestone-item {
  position: relative;
  padding-bottom: 22px;
}

.milestone-item:last-child {
  padding-bottom: 0;
}

.milestone-item.border-none {
  padding-bottom: 0;
}

.milestone-dot {
  position: absolute;
  left: -20px;
  top: 5px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #d1d1d6;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px #e5e5ea;
  z-index: 2;
}

.milestone-dot.dot-10y { background: #ff9500; }
.milestone-dot.dot-20y { background: #ff5e00; }
.milestone-dot.dot-30y { background: #ff3b30; }
.milestone-dot.dot-info { background: #007aff; }

.milestone-content {
  padding-left: 4px;
}

.ms-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ms-time {
  font-size: 13px;
  color: #1c1c1e;
  font-weight: 500;
}

.ms-val {
  font-size: 16px;
}

/* 共通フル幅カード */
.res-card-full {
  background: #fff;
  border-radius: 16px;
  margin: 0 16px 10px;
  padding: 14px 16px;
}

.rc-label {
  font-size: 11px;
  font-weight: 600;
  color: #8e8e93;
  margin-bottom: 4px;
}

/* チャートエリア */
.card-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.chart-legend {
  display: flex;
  align-items: center;
  font-size: 11px;
  color: #8e8e93;
  font-weight: 500;
}

.legend-dot {
  width: 8px;
  height: 8px;
  background: #007aff;
  border-radius: 50%;
  margin-right: 4px;
}

.chart-container {
  position: relative;
  width: 100%;
  height: 180px;
}

/* スライダー */
.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.slider-val-badge {
  background: #ff9500;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
}

.apple-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #e5e5ea;
  outline: none;
  margin: 10px 0 6px;
}

.apple-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  cursor: pointer;
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: #aeaeae;
  font-weight: 500;
  padding: 0 2px;
}

.slider-result-box {
  margin-top: 12px;
  background: #f2f2f7;
  border-radius: 10px;
  padding: 10px;
  text-align: center;
}

.s-res-lbl {
  font-size: 12px;
  color: #8e8e93;
  font-weight: 500;
}

.s-res-val {
  font-size: 14px;
  font-weight: 700;
  color: #007aff;
}

/* アクションボタン */
.action-btn-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 8px 16px;
}

.action-btn {
  border: none;
  border-radius: 12px;
  padding: 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: opacity 0.15s;
}

.action-btn:active { opacity: 0.8; }
.btn-x { background: #000; color: #fff; }
.btn-link { background: #fff; color: #007aff; border: 1px solid #e5e5ea; }

/* ポスト画面用ハーフシート */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 999;
  display: flex;
  align-items: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.overlay-sheet {
  background: #fff;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  padding-bottom: env(safe-area-inset-bottom, 20px);
  transform: translateY(100%);
  transition: transform 0.25s cubic-bezier(0.15, 1, 0.3, 1);
}

.overlay.show .overlay-sheet {
  transform: translateY(0);
}

.sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid #f2f2f7;
}

.sheet-cancel {
  background: none;
  border: none;
  color: #007aff;
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
}

.sheet-title {
  font-size: 15px;
  font-weight: 600;
}

.sheet-post {
  background: #007aff;
  color: #fff;
  border: none;
  border-radius: 16px;
  padding: 5px 14px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.sheet-body {
  padding: 16px;
}

.tweet-box-wrap {
  margin-bottom: 16px;
}

.tweet-textarea {
  width: 100%;
  min-height: 70px;
  border: none;
  outline: none;
  font-size: 15px;
  line-height: 1.4;
  color: #1c1c1e;
  resize: none;
  font-family: inherit;
}

/* OGPプレビュー */
.ogp-preview {
  border: 1px solid #e5e5ea;
  border-radius: 12px;
  overflow: hidden;
  background: #f8f9fa;
}

.ogp-header {
  background: #fff;
  padding: 10px 12px;
  border-bottom: 1px solid #f2f2f7;
  font-size: 13px;
  display: flex;
  align-items: center;
}

.ogp-main {
  display: flex;
  padding: 14px 12px;
  background: #fff;
}

.ogp-left {
  flex: 1.2;
  border-right: 1px solid #f2f2f7;
}

.ogp-right {
  flex: 1;
  padding-left: 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

.ogp-label {
  font-size: 10px;
  color: #8e8e93;
  font-weight: 600;
}

.ogp-big {
  font-size: 28px;
  font-weight: 800;
  color: #007aff;
  line-height: 1.1;
  margin: 2px 0;
}

.ogp-big span { font-size: 15px; font-weight: 600; }
.ogp-sub { font-size: 11px; color: #1c1c1e; font-weight: 500; }

.ogp-stat {
  font-size: 11px;
  color: #48484a;
  font-weight: 500;
}

.ogp-stat span { font-weight: 700; color: #1c1c1e; }

.ogp-footer {
  background: #f2f2f7;
  padding: 8px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ogp-rank-short {
  font-size: 11px;
  font-weight: 600;
  color: #48484a;
}

.ogp-domain {
  font-size: 10px;
  color: #8e8e93;
}

/* トースト */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(0,0,0,0.8);
  color: #fff;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  z-index: 1000;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   追加：フッター（関連リンク・免責事項・コピーライト）のスタイル
   ========================================================================== */
.footer-container {
  margin-top: 32px;
  padding: 0 16px;
  text-align: center;
}

.footer-container .related-links {
  display: table;
  width: 100%;
  table-layout: fixed;
  margin-bottom: 20px;
}

.footer-container .related-link-cell {
  display: table-cell;
  text-align: center;
}

.footer-container .related-link {
  font-size: 13px;
  color: #007aff;
  text-decoration: none;
  font-weight: 600;
}

.footer-container .related-link:hover {
  text-decoration: underline;
}

.footer-container .disclaimer {
  font-size: 11px;
  color: #8e8e93;
  line-height: 1.6;
  margin-bottom: 16px;
  text-align: justify;
}

.footer-container .copyright {
  font-size: 12px;
  color: #8e8e93;
  font-weight: 500;
}