/* ============================================================
   くらしの計算機 - style.css
   共通CSS（ライト/ダークモード、レスポンシブ、コンポーネント）
   ============================================================ */

/* Fonts loaded via /css/fonts.css (self-hosted + CDN fallback) */

/* ============================================================
   CSS変数: ライトモード（デフォルト）
   ============================================================ */
:root {
  /* 背景 */
  --bg-primary: #FFFFFF;
  --bg-secondary: #F8FAFC;
  --bg-card: #FFFFFF;

  /* テキスト */
  --text-primary: #020617;
  --text-secondary: #475569;

  /* アクセント */
  --accent: #1E3A8A;
  --accent-hover: #1E40AF;
  --accent-light: #DBEAFE;
  --accent-gold: #CA8A04;
  --accent-gold-hover: #A16207;

  /* セマンティックカラー */
  --success: #059669;
  --success-bg: #ECFDF5;
  --warning: #D97706;
  --warning-bg: #FFFBEB;
  --danger: #DC2626;
  --danger-bg: #FEF2F2;

  /* ボーダー・シャドウ */
  --border: #E5E7EB;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);

  /* レイアウト */
  --max-width: 1200px;
  --sidebar-width: 300px;
  --gap: 32px;
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-full: 999px;

  /* タイポグラフィ */
  --font-family: 'Lexend', 'Lexend Fallback', 'Noto Sans JP', 'Noto Sans JP Fallback', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-family-body: 'Noto Sans JP', 'Noto Sans JP Fallback', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-size-base: 16px;
  --line-height: 1.8;

  /* ネイビー */
  --navy: #1E3A8A;

  /* トランジション */
  --transition: 0.2s ease-out;
}

/* ============================================================
   CSS変数: ダークモード
   ============================================================ */
[data-theme="dark"] {
  --bg-primary: #0F172A;
  --bg-secondary: #1E293B;
  --bg-card: #1E293B;

  --text-primary: #F1F5F9;
  --text-secondary: #94A3B8;

  --accent: #60A5FA;
  --accent-hover: #93C5FD;
  --accent-light: #1E3A5F;
  --accent-gold: #EAB308;
  --accent-gold-hover: #CA8A04;

  --success: #34D399;
  --success-bg: #064E3B;
  --warning: #FBBF24;
  --warning-bg: #78350F;
  --danger: #F87171;
  --danger-bg: #7F1D1D;

  --border: #334155;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.3);

  --navy: #93C5FD;
}

/* ============================================================
   リセット & ベース
   ============================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

a, button, input, select, textarea { touch-action: manipulation; }

/* アクセシビリティ: 視覚的に隠すがスクリーンリーダーには読ませる */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html {
  font-size: var(--font-size-base);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-family-body);
  line-height: var(--line-height);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  transition: background-color var(--transition), color var(--transition);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* テキスト選択スタイル */
::selection { background: var(--accent-light, #DBEAFE); color: var(--accent); }
[data-theme="dark"] ::selection { background: rgba(59,130,246,0.3); color: #fff; }

body.has-cookie-banner {
  padding-bottom: 80px;
}
.needs-cookie-banner body {
  padding-bottom: 80px;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
}

/* ============================================================
   タイポグラフィ
   ============================================================ */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-family);
  font-weight: 700;
  line-height: 1.4;
  color: var(--text-primary);
}

h1 { font-size: 1.875rem; margin-bottom: 1rem; }
h2 { font-size: 1.5rem; margin-bottom: 0.75rem; letter-spacing: 0.01em; }
h3 { font-size: 1.25rem; margin-bottom: 0.5rem; }
h4 { font-size: 1.125rem; margin-bottom: 0.5rem; }

p {
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

/* 金額表示 */
.amount {
  font-variant-numeric: tabular-nums;
  font-size: 2rem;
  font-weight: 700;
}

.amount--positive,
.amount--income {
  color: var(--success);
}

.amount--negative,
.amount--tax {
  color: var(--danger);
}

.amount--warning {
  color: var(--warning);
}

/* ============================================================
   ヘッダー
   ============================================================ */
.site-header {
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.site-header__logo {
  font-family: var(--font-family);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.site-header__logo:hover {
  text-decoration: none;
}

.site-header__logo-sub {
  font-size: 0.6875rem;
  font-weight: 400;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

@media (max-width: 480px) {
  .site-header__logo-sub {
    display: none;
  }
}

.site-header__nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.site-header__nav a {
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  transition: color var(--transition);
}

.site-header__nav a:hover {
  color: var(--accent);
  text-decoration: none;
}

.site-header__nav a.is-active {
  color: var(--accent);
  font-weight: 700;
}
[data-theme="dark"] .site-header__nav a.is-active {
  color: #93C5FD;
}

/* ダークモード切替ボタン */
.dark-mode-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--transition), color var(--transition);
}

.dark-mode-toggle:hover {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
}

/* ============================================================
   パンくずリスト
   ============================================================ */
.breadcrumb {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.75rem 1rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.breadcrumb ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.breadcrumb li::after {
  content: '>';
  margin-left: 0.25rem;
  color: var(--text-secondary);
}

.breadcrumb li:last-child::after {
  content: '';
}

.breadcrumb a {
  color: var(--text-secondary);
  font-size: 0.8125rem;
}

.breadcrumb a:hover {
  color: var(--accent);
}

/* ============================================================
   メインレイアウト: 2カラム (PC) / 1カラム (タブレット・スマホ)
   ============================================================ */
.page-wrapper {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem 1rem;
  display: grid;
  grid-template-columns: 1fr var(--sidebar-width);
  gap: var(--gap);
  flex: 1;
}

.main-content {
  min-width: 0;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* タブレット（768-1024px）: サイドバー幅縮小 */
@media (max-width: 1024px) and (min-width: 769px) {
  .page-wrapper {
    --sidebar-width: 220px;
    gap: 1.5rem;
  }
}

/* サイドバーsticky（PC only） */
@media (min-width: 769px) {
  .sidebar {
    position: sticky;
    top: 80px; /* ヘッダー60px + margin 20px */
    align-self: start;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
  }
  /* スクロールバー最小化 */
  .sidebar::-webkit-scrollbar {
    width: 4px;
  }
  .sidebar::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
  }
}

/* サイドバーsticky（内部ラッパー用、後方互換） */
.sidebar__sticky {
  position: sticky;
  top: 80px;
}

/* ============================================================
   フォーム入力
   ============================================================ */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 0.375rem;
}

.form-group .form-hint {
  display: block;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.form-control {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: 1rem;
  font-family: var(--font-family);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none;
  -webkit-appearance: none;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.form-control::placeholder {
  color: var(--text-secondary);
  opacity: 0.6;
}

/* selectのカスタム矢印 */
select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236B7280' d='M1.41 0L6 4.58 10.59 0 12 1.41l-6 6-6-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.5rem;
}

/* チェックボックス・ラジオ */
.form-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
  width: 1.125rem;
  height: 1.125rem;
  accent-color: var(--accent);
}

/* 横並びフォーム */
.form-row {
  display: flex;
  gap: 1rem;
}

.form-row .form-group {
  flex: 1;
}

/* 入力の接尾辞（円、%など） */
.input-with-suffix {
  position: relative;
}

.input-with-suffix .form-control {
  padding-right: 2.5rem;
}

.input-with-suffix .suffix {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  font-size: 0.875rem;
  pointer-events: none;
}

/* ============================================================
   結果カード
   ============================================================ */
.result-card {
  background-color: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border);
}

.result-card__title {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.result-card__amount {
  font-variant-numeric: tabular-nums;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
}

.result-card--highlight {
  border-left: 4px solid var(--accent);
}

.result-card--success {
  border-left: 4px solid var(--success);
}

.result-card--danger {
  border-left: 4px solid var(--danger);
}

/* 結果フェードインアニメーション */
.result-section {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.result-section.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* No-JS fallback: show result sections when scripting is unavailable */
@media (scripting: none) {
  .result-section {
    opacity: 1;
    transform: none;
  }
}

/* ============================================================
   内訳テーブル
   ============================================================ */
.breakdown-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
  margin-bottom: 1.5rem;
}

.breakdown-table th,
.breakdown-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 0.9375rem;
}

.breakdown-table th {
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.breakdown-table td:last-child {
  text-align: right;
  font-weight: 500;
}

.breakdown-table tbody tr:nth-child(even) {
  background-color: var(--bg-secondary);
}

.breakdown-table tbody tr:hover {
  background-color: var(--accent-light);
}

.breakdown-table tfoot td {
  font-weight: 700;
  border-top: 2px solid var(--border);
  font-size: 1rem;
}

/* ============================================================
   グラフエリア
   ============================================================ */
.chart-area {
  max-width: 600px;
  margin: 0 auto 1.5rem;
  padding: 1rem;
  background-color: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.chart-area canvas {
  width: 100% !important;
  height: auto !important;
}

/* 結果チャートコンテナ */
.result-chart {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin: 1.5rem 0;
}
.result-chart__title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}
.result-chart canvas {
  max-height: 280px;
}

/* ============================================================
   広告スロットプレースホルダー
   ============================================================ */
.ad-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-secondary);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 0.75rem;
  min-height: 90px;
  margin-bottom: 1.5rem;
  text-align: center;
}

.ad-slot--leaderboard {
  min-height: 90px;
}

.ad-slot--rectangle {
  min-height: 250px;
  max-width: 100%;
}

.ad-slot--sidebar {
  min-height: 250px;
  width: 100%;
  position: sticky;
  top: 80px;
}

/* ============================================================
   ボタン
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-size: 0.9375rem;
  font-weight: 500;
  font-family: var(--font-family);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color var(--transition), box-shadow var(--transition);
  line-height: 1.4;
}

.btn--primary {
  background-color: var(--accent);
  color: #FFFFFF;
}

.btn--primary:hover {
  background-color: var(--accent-hover);
  box-shadow: var(--shadow-md);
}

.btn:active, .btn--primary:active, .btn--cta:active {
  transform: scale(0.97);
}

.btn--outline {
  background-color: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.btn--outline:hover {
  background-color: var(--accent-light);
}

.btn--sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
}

.btn--twitter {
  background-color: #1DA1F2;
  color: #FFFFFF;
}

.btn--twitter:hover {
  background-color: #0d8bd9;
}

.btn--line {
  background-color: #06C755;
  color: #FFFFFF;
}

.btn--line:hover {
  background-color: #05b04c;
}

.btn--copy {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn--copy:hover {
  background-color: var(--border);
}

/* ============================================================
   トースト通知
   ============================================================ */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background-color: var(--text-primary);
  color: var(--bg-primary);
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}

.toast.is-active {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============================================================
   FAQ セクション
   ============================================================ */
.faq-section {
  margin-bottom: 2rem;
}

.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
  overflow: hidden;
}
.faq-item summary {
  padding: 1rem 1.25rem;
  font-weight: 700;
  font-size: 0.9375rem;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-primary);
  transition: background var(--transition);
}
.faq-item summary:hover {
  background: var(--bg-secondary);
}
.faq-item summary::before {
  content: 'Q.';
  color: var(--accent);
  font-weight: 700;
  flex-shrink: 0;
}
.faq-item summary::after {
  content: '';
  margin-left: auto;
  width: 0.5rem;
  height: 0.5rem;
  border-right: 2px solid var(--text-secondary);
  border-bottom: 2px solid var(--text-secondary);
  transform: rotate(-45deg);
  transition: transform var(--transition);
  flex-shrink: 0;
}
.faq-item[open] summary::after {
  transform: rotate(45deg);
}
.faq-item .faq-answer {
  padding: 0 1.25rem 1rem;
  font-size: 0.9375rem;
  line-height: 1.7;
  color: var(--text-secondary);
}

/* ============================================================
   免責事項
   ============================================================ */
.disclaimer {
  background-color: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 1.25rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 1.5rem;
}

.disclaimer strong {
  color: var(--text-primary);
}

.disclaimer ul {
  margin-top: 0.5rem;
  padding-left: 1.25rem;
}

.disclaimer li {
  margin-bottom: 0.25rem;
}

/* ============================================================
   フッター
   ============================================================ */
.site-footer {
  background-color: #0F172A;
  color: #CBD5E1;
  padding: 3rem 1rem 1.5rem;
  margin-top: auto;
}

[data-theme="dark"] .site-footer {
  background-color: #0B1120;
  color: #CBD5E1;
  border-top: 1px solid #475569;
}

[data-theme="dark"] .site-footer a,
[data-theme="dark"] .site-footer__links a {
  color: #93C5FD;
}

[data-theme="dark"] .site-footer__links a:hover {
  color: #BFDBFE;
}

[data-theme="dark"] .site-footer__tagline {
  color: #94A3B8;
}

[data-theme="dark"] .site-footer__heading {
  color: #F1F5F9;
}

[data-theme="dark"] .site-footer__bottom {
  border-top-color: #334155;
}

[data-theme="dark"] .site-footer__disclaimer,
[data-theme="dark"] .site-footer__copy {
  color: #94A3B8;
}

.site-footer__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.5fr repeat(4, 1fr);
  gap: 2rem 1.5rem;
}

.site-footer__brand {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.site-footer__logo {
  font-family: var(--font-family);
  font-size: 1.25rem;
  font-weight: 700;
  color: #FFFFFF;
}

.site-footer__logo-gold {
  color: var(--accent-gold);
}

.site-footer__tagline {
  font-size: 0.875rem;
  color: #94A3B8;
  line-height: 1.6;
}

.site-footer__heading {
  font-family: var(--font-family);
  font-size: 0.8125rem;
  font-weight: 700;
  color: #FFFFFF;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

.site-footer__links {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.site-footer__links a {
  color: #94A3B8;
  font-size: 0.875rem;
  transition: color var(--transition);
}

.site-footer__links a:hover {
  color: #FFFFFF;
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

.site-footer__bottom {
  max-width: var(--max-width);
  margin: 2rem auto 0;
  padding-top: 1.5rem;
  border-top: 1px solid #1E293B;
}

.site-footer__disclaimer {
  font-size: 0.75rem;
  color: #7A899E;
  line-height: 1.6;
  margin-bottom: 1rem;
}

.site-footer__copy {
  font-size: 0.75rem;
  color: #7A899E;
  text-align: center;
}

@media (max-width: 1024px) {
  .site-footer__inner {
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
  }
  .site-footer__brand {
    grid-column: 1 / -1;
  }
}

@media (max-width: 480px) {
  .site-footer__inner {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .site-footer__brand {
    grid-column: 1 / -1;
  }
}

/* ============================================================
   関連ツールリスト（サイドバー用）
   ============================================================ */
.related-tools {
  background-color: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 1.25rem;
}

.related-tools__title {
  font-size: 0.875rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}

.related-tools__list {
  list-style: none;
}

.related-tools__list li {
  margin-bottom: 0.5rem;
}

.related-tools__list a {
  display: block;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.875rem;
  transition: background-color var(--transition);
}

.related-tools__list a:hover {
  background-color: var(--bg-secondary);
  text-decoration: none;
}

/* ============================================================
   解説記事
   ============================================================ */
.article-section {
  margin-bottom: 2rem;
  line-height: var(--line-height);
}

.article-section h2 {
  border-bottom: 2px solid var(--accent);
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
}

.article-section h3 {
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}

.article-section ul,
.article-section ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

.article-section li {
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
}

/* ============================================================
   ハンバーガーメニュー
   ============================================================ */
.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--text-primary);
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
}

.hamburger svg {
  display: block;
}

/* ============================================================
   レスポンシブ: タブレット (768px以下)
   ============================================================ */
@media (max-width: 768px) {
  .hamburger {
    display: inline-flex;
  }

  .site-header__nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    flex-direction: column;
    padding: 0.5rem 0;
    z-index: 99;
  }

  .site-header__nav.is-open {
    display: flex;
  }

  .site-header__nav a {
    padding: 0.75rem 1.5rem;
    font-size: 0.9375rem;
    border-bottom: 1px solid var(--border);
  }

  .site-header__nav a:last-child {
    border-bottom: none;
  }

  .site-header {
    position: sticky;
    top: 0;
    z-index: 100;
  }

  .page-wrapper {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .sidebar {
    order: 1;
  }

  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.25rem; }

  .form-row {
    flex-direction: column;
    gap: 0;
  }

  .result-card__amount {
    font-size: 1.5rem;
  }

  .amount {
    font-size: 1.5rem;
  }

  .ad-slot--rectangle {
    max-width: 100%;
  }

  .hero {
    padding: 2rem 1rem 3rem;
  }

  .hero-title {
    font-size: 1.75rem;
  }

  .tool-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   レスポンシブ: スマホ (480px以下)
   ============================================================ */
@media (max-width: 480px) {
  :root {
    --font-size-base: 15px;
  }

  .site-header__inner {
    height: 50px;
    padding: 0 0.75rem;
  }

  .page-wrapper {
    padding: 1rem 0.75rem;
  }

  .result-card {
    padding: 1rem;
  }

  .breakdown-table th,
  .breakdown-table td {
    padding: 0.5rem 0.5rem;
    font-size: 0.8125rem;
  }

  .share-buttons {
    flex-wrap: wrap;
  }
}

/* ============================================================
   @media print: 広告・ナビ非表示、結果エリアのみ
   ============================================================ */
@media print {
  .site-header, .hamburger, .dark-mode-toggle, .breadcrumb,
  .site-footer, .ad-slot, .ad-placeholder, #dynamicCTA,
  #shareArea, .share-buttons, .share-section,
  .sidebar, .skip-link, .seasonal-banner,
  #pdfArea { display: none !important; }

  .cookie-consent,
  .result-share-mini,
  .share-buttons,
  .dark-mode-toggle,
  #stickySummary { display: none !important; }

  body { background: #fff !important; color: #000 !important; font-size: 12pt; }
  .container { max-width: 100% !important; padding: 0 !important; }
  .main-content, .page-wrapper { width: 100% !important; max-width: 100% !important; }

  .page-wrapper {
    grid-template-columns: 1fr;
    display: block;
  }

  .result-card {
    box-shadow: none;
    border: 1px solid #ccc !important;
    break-inside: avoid;
  }

  .breakdown-table {
    break-inside: avoid;
  }

  table { border-collapse: collapse; }
  th, td { border: 1px solid #ccc !important; padding: 4px 8px !important; }

  a { color: #000 !important; text-decoration: none !important; }
  a[href]::after { content: " (" attr(href) ")"; font-size: 9pt; color: #666; }
  a[href^="#"]::after, a[href^="javascript"]::after { content: ""; }

  canvas { max-width: 400px !important; max-height: 300px !important; }

  .amount--positive,
  .amount--income {
    color: #059669;
  }

  .amount--negative,
  .amount--tax {
    color: #DC2626;
  }

  .print-disclaimer { display: block !important; font-size: 8pt; color: #666; margin-top: 2rem; border-top: 1px solid #ccc; padding-top: 0.5rem; }

  @page { margin: 1.5cm; }
}

/* ============================================================
   汎用コンテナ
   ============================================================ */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1rem;
}

/* ============================================================
   ヒーローセクション（トップページ）
   ============================================================ */
.hero {
  background:
    radial-gradient(circle, rgba(255,255,255,0.05) 1px, transparent 1px),
    linear-gradient(135deg, #0F172A 0%, #1E3A8A 100%);
  background-size: 20px 20px, 100% 100%;
  color: #FFFFFF;
  padding: 3.5rem 1rem 4rem;
  text-align: center;
  position: relative;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 48px;
  background: var(--bg-primary);
  clip-path: ellipse(55% 100% at 50% 100%);
}

.hero-title {
  font-size: 2.5rem;
  font-weight: 800;
  color: #FFFFFF;
  margin-bottom: 0.75rem;
}

.hero-catch {
  font-size: 1.25rem;
  font-weight: 500;
  color: rgba(255,255,255,0.9);
  margin-bottom: 0.5rem;
}

.hero-desc {
  font-size: 0.9375rem;
  color: rgba(255,255,255,0.8);
  max-width: 720px;
  margin: 0 auto;
  line-height: var(--line-height);
}

.hero-catch__accent {
  color: #EAB308;
  font-weight: 700;
}

.hero-cta {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.hero-cta .btn--cta {
  padding: 0.75rem 2rem;
  font-size: 1.0625rem;
  border-radius: var(--radius-lg);
}

.hero-cta .btn--outline-white {
  padding: 0.75rem 2rem;
  font-size: 1.0625rem;
  border-radius: var(--radius-lg);
  background: transparent;
  color: #FFFFFF;
  border: 2px solid rgba(255,255,255,0.5);
  cursor: pointer;
  font-family: var(--font-family);
  font-weight: 500;
  transition: background-color var(--transition), border-color var(--transition);
}

.hero-cta .btn--outline-white:hover {
  background: rgba(255,255,255,0.1);
  border-color: #FFFFFF;
}

.hero-trust {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin: 1.25rem 0;
}
.hero-trust__badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255,255,255,0.2);
}

/* ============================================================
   ツール一覧グリッド（トップページ）
   ============================================================ */
.tools-section {
  padding: 3rem 0;
}

.tool-category {
  margin-bottom: 2.5rem;
}

.category-title {
  font-size: 1.375rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  letter-spacing: 0.02em;
}

.category-icon {
  font-size: 1.25rem;
  color: var(--accent-gold);
}

.category-icon svg {
  stroke: var(--accent-gold);
}

.category-desc {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  margin-bottom: 1rem;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.tool-card {
  display: block;
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  text-decoration: none;
  transition: box-shadow var(--transition), transform var(--transition);
  position: relative;
  box-shadow: var(--shadow);
}

@media (hover: hover) {
  .tool-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
    text-decoration: none;
  }
}

.tool-card--featured {
  border-color: var(--accent-gold);
  background: linear-gradient(135deg, rgba(202, 138, 4, 0.03) 0%, rgba(202, 138, 4, 0) 100%);
}

.tool-card-badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--accent-gold) 0%, #D97706 100%);
  color: #422006;
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-full);
  margin-bottom: 0.5rem;
  letter-spacing: 0.02em;
}
.tool-card-badge--popular {
  background: linear-gradient(135deg, #3B82F6, #1D4ED8);
  color: #FFFFFF;
}

.tool-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background-color: var(--accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.75rem;
  color: var(--accent);
  transition: background-color var(--transition);
}

@media (hover: hover) {
  .tool-card:hover .tool-card-icon {
    background-color: var(--accent);
    color: #FFFFFF;
  }

  .tool-card:hover .tool-card-icon svg {
    stroke: #FFFFFF;
  }
}

.tool-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.375rem;
}

.tool-card-desc {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: 0;
  line-height: 1.6;
}

.tool-category:nth-child(1) .tool-card {
  border-top: 3px solid var(--accent);
}

.tool-category:nth-child(2) .tool-card {
  border-top: 3px solid var(--accent-gold);
}

.tool-category:nth-child(3) .tool-card {
  border-top: 3px solid var(--success);
}

.tool-category:nth-child(4) .tool-card {
  border-top: 3px solid #6366F1;
}

/* ============================================================
   サイト説明セクション（トップページ）
   ============================================================ */
.about-section {
  background-color: var(--bg-secondary);
  padding: 3rem 1rem;
  content-visibility: auto;
  contain-intrinsic-size: auto 500px;
}

.about-section h2 {
  font-size: 1.375rem;
  margin-bottom: 1rem;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 0.5rem;
}

.about-section h3 {
  font-size: 1.125rem;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.about-content p {
  color: var(--text-secondary);
  line-height: var(--line-height);
  margin-bottom: 1rem;
}

.about-content ul {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

.about-content li {
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

/* ============================================================
   目次カード (TOC)
   ============================================================ */
.toc-card { border-left: 4px solid var(--accent); }
.toc-card__title { font-size: 1.1rem; margin-bottom: 0.75rem; }
.toc-card__list { padding-left: 1.25rem; line-height: 2.2; font-size: 0.9375rem; }
.toc-card__list a { color: var(--text-primary); text-decoration: none; border-bottom: 1px dashed var(--border); transition: color var(--transition); }
.toc-card__list a:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* ============================================================
   ユーティリティ
   ============================================================ */
.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;
}

.text-center { text-align: center; }
.text-right { text-align: right; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

/* ============================================================
   アクセシビリティ: スキップリンク
   ============================================================ */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  background-color: var(--accent);
  color: #FFFFFF;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  z-index: 200;
  font-size: 0.875rem;
}
.skip-link:focus {
  top: 0.5rem;
}

/* ============================================================
   アクセシビリティ: フォーカス表示
   ============================================================ */
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* ============================================================
   カーソルポインター
   ============================================================ */
.tool-card,
.btn,
.dark-mode-toggle,
.faq-item summary,
.related-tools__list a {
  cursor: pointer;
}

/* ============================================================
   アクセシビリティ: モーション軽減
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================================
   Gold CTAボタン
   ============================================================ */
.btn--cta {
  background-color: var(--accent-gold);
  color: #422006;
  font-weight: 700;
}
.btn--cta:hover {
  background-color: var(--accent-gold-hover);
  color: #422006;
  box-shadow: var(--shadow-md);
}

/* ============================================================
   アフィリエイトCTA
   ============================================================ */
.affiliate-cta {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin: 2rem 0;
}

.affiliate-cta__title {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.affiliate-cta__cards {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.affiliate-card {
  flex: 1 1 250px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  text-decoration: none;
  color: var(--text-primary);
  background: var(--bg-card);
  transition: border-color var(--transition), box-shadow var(--transition);
  cursor: pointer;
}

@media (hover: hover) {
  .affiliate-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
  }
}

.affiliate-card__name {
  display: block;
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.affiliate-card__desc {
  display: block;
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

.affiliate-card__btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  padding: 0.375rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 600;
}

.affiliate-cta__note {
  margin-top: 1rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* ダークモード対応 */
[data-theme="dark"] .affiliate-card {
  background: var(--bg-card);
  border-color: var(--border);
}

@media (hover: hover) {
  [data-theme="dark"] .affiliate-card:hover {
    border-color: var(--accent);
  }
}

/* ============================================================
   コンテキストCTA（複数カテゴリ対応）
   ============================================================ */
.context-cta { margin: 2rem 0; }
.context-cta__title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1rem;
}
.context-cta__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}
.context-cta__card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}
.context-cta__name {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}
.context-cta__desc {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1rem;
}
.context-cta__btn {
  display: inline-block;
  padding: 0.5rem 1.25rem;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 700;
  text-decoration: none;
  transition: background var(--transition);
}
.context-cta__btn:hover {
  background: var(--accent-hover);
  color: #fff;
}
.context-cta__note {
  font-size: 0.6875rem;
  color: var(--text-secondary);
  margin-top: 0.75rem;
}

[data-theme="dark"] .context-cta__card {
  background: var(--bg-card);
  border-color: var(--border);
}

/* ============================================================
   人気ツール カルーセル: ナビゲーション矢印 & スクロールヒント
   ============================================================ */
.popular-carousel-wrapper {
  position: relative;
}

.popular-tools-scroll {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.popular-tools-scroll::-webkit-scrollbar {
  display: none;                  /* Chrome/Safari */
}

.carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  transition: opacity var(--transition), background var(--transition);
}
.carousel-arrow--left { left: -12px; }
.carousel-arrow--right { right: -12px; }
.carousel-arrow:hover { background: var(--accent-light); }
.carousel-arrow:disabled { opacity: 0.3; cursor: default; pointer-events: none; }

@media (max-width: 768px) {
  .carousel-arrow { display: none; }
}

.scroll-hint {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
  display: none;
}
@media (max-width: 768px) {
  .scroll-hint { display: block; }
}

/* ============================================================
   次のステップ導線カード
   ============================================================ */
.next-step-card {
  background: linear-gradient(135deg, var(--accent-light) 0%, var(--bg-secondary) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 12px);
  padding: 1.25rem 1.5rem;
  margin: 2rem 0;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.next-step-card__icon {
  width: 40px;
  height: 40px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.25rem;
}
.next-step-card__body { flex: 1; }
.next-step-card__title {
  font-weight: 700;
  font-size: 0.9375rem;
  margin-bottom: 0.25rem;
  color: var(--text-primary);
}
.next-step-card__desc {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}
.next-step-card__link {
  display: inline-block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}
.next-step-card__link:hover { text-decoration: underline; }
@media (max-width: 480px) {
  .next-step-card { flex-direction: column; text-align: center; }
}

/* ============================================================
   監修者バッジ（E-E-A-T強化）
   ============================================================ */
.supervision-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--success-bg);
  border: 1px solid var(--success);
  border-radius: var(--radius);
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
  color: var(--text-primary);
  margin: 1rem 0;
}
.supervision-badge__icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}
.supervision-badge__text {
  line-height: 1.4;
}
.supervision-badge__role {
  font-weight: 700;
  color: var(--success);
}

/* ============================================================
   最終更新日バッジ（E-E-A-T強化）
   ============================================================ */
.last-updated {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 0.25rem 0.875rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin: 0.5rem 0;
  line-height: 1.4;
}
.last-updated__icon {
  flex-shrink: 0;
  opacity: 0.7;
}

/* ============================================================
   計算の前提条件（E-E-A-T強化）
   ============================================================ */
.calc-basis {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 0.75rem 0 1rem;
  font-size: 0.8125rem;
  background: var(--bg-card);
}
.calc-basis__summary {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.625rem 1rem;
  cursor: pointer;
  color: var(--text-secondary);
  font-weight: 600;
  user-select: none;
  list-style: none;
}
.calc-basis__summary::-webkit-details-marker { display: none; }
.calc-basis__summary::after {
  content: '';
  margin-left: auto;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--text-secondary);
  transition: transform var(--transition);
}
.calc-basis[open] .calc-basis__summary::after {
  transform: rotate(180deg);
}
.calc-basis__body {
  padding: 0 1rem 0.75rem;
  border-top: 1px solid var(--border);
}
.calc-basis__label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin: 0.75rem 0 0.375rem;
}
.calc-basis__list {
  margin: 0;
  padding-left: 1.25rem;
}
.calc-basis__list li {
  color: var(--text-primary);
  font-size: 0.8125rem;
  line-height: 1.6;
  margin-bottom: 0.125rem;
}
.calc-basis__note {
  font-size: 0.6875rem;
  color: var(--text-secondary);
  margin: 0.5rem 0 0;
  line-height: 1.5;
}

/* ============================================================
   モバイル カテゴリ折りたたみ
   ============================================================ */
@media (max-width: 768px) {
  .tool-grid--collapsed .tool-card:nth-child(n+5) {
    display: none;
  }
  .tool-grid-toggle {
    display: block;
    width: 100%;
    padding: 0.625rem;
    margin-top: 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--accent);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: background-color var(--transition);
  }
  .tool-grid-toggle:hover {
    background: var(--accent-light);
  }
}
@media (min-width: 769px) {
  .tool-grid-toggle { display: none !important; }
}

/* ============================================================
   トップへ戻るボタン
   ============================================================ */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
  z-index: 50;
}
.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}
.back-to-top:hover {
  background: var(--accent-hover);
}
@media (max-width: 480px) {
  .back-to-top { bottom: 1rem; right: 1rem; }
}
@media print {
  .back-to-top { display: none !important; }
}

/* ============================================================
   Featured Snippet 直接回答ブロック
   ============================================================ */
.direct-answer {
  background: var(--bg-secondary);
  border-left: 4px solid var(--accent);
  padding: 1rem 1.25rem;
  margin: 1rem 0 1.5rem;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text-primary);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.direct-answer strong {
  color: var(--accent);
}

/* ============================================================
   SNSシェアボタン
   ============================================================ */
.share-buttons {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 1.5rem 0;
}
.share-buttons__label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-right: 0.25rem;
}
.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.share-btn:hover {
  border-color: var(--accent);
  background: var(--bg-secondary);
}
.share-btn--x:hover { color: #000; }
.share-btn--line:hover { color: #06C755; }
.share-btn--copy:hover { color: var(--accent); }

/* ============================================================
   Progressive Disclosure (詳細設定)
   ============================================================ */
.calc-advanced {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin: 1rem 0;
  background: var(--bg-card);
}
.calc-advanced__toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.875rem 1.25rem;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--accent);
  user-select: none;
}
.calc-advanced__toggle::before {
  content: '';
  display: inline-block;
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 6px solid var(--accent);
  transition: transform var(--transition);
}
.calc-advanced.is-open .calc-advanced__toggle::before {
  transform: rotate(90deg);
}
.calc-advanced__body {
  display: none;
  padding: 0 1.25rem 1.25rem;
  border-top: 1px solid var(--border);
}
.calc-advanced.is-open .calc-advanced__body {
  display: block;
}
.calc-advanced__hint {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-left: auto;
}

/* ============================================================
   クロスツール レコメンデーションカード
   ============================================================ */
/* ============================================================
   計算履歴カード
   ============================================================ */
.calc-history {
  margin: 1rem 0 1.5rem;
}
.calc-history__title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}
.calc-history__list {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
  -webkit-overflow-scrolling: touch;
}
.calc-history__item {
  flex-shrink: 0;
  min-width: 200px;
  max-width: 280px;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color var(--transition);
}
.calc-history__item:hover {
  border-color: var(--accent);
}
.calc-history__summary {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.calc-history__time {
  font-size: 0.6875rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}
.calc-history__restore {
  font-size: 0.75rem;
  color: var(--accent);
  margin-top: 0.375rem;
  font-weight: 600;
}

.next-tools { margin: 2rem 0; }
.next-tools__title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1rem;
}
.next-tools__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.75rem;
}
.next-tools__card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
  cursor: pointer;
}
@media (hover: hover) {
  .next-tools__card:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 8px rgba(30,58,138,0.1);
  }
}
.next-tools__icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  color: var(--accent);
}
.next-tools__text { flex: 1; min-width: 0; }
.next-tools__name {
  font-weight: 700;
  font-size: 0.9375rem;
  color: var(--text-primary);
}
.next-tools__desc {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-top: 0.125rem;
}
.next-tools__arrow {
  flex-shrink: 0;
  color: var(--accent);
  font-size: 1.25rem;
}

/* ============================================================
   PWA Install Banner
   ============================================================ */
.pwa-install-banner {
  position: fixed;
  bottom: -80px;
  left: 1rem;
  right: 1rem;
  z-index: 1000;
  transition: bottom 0.3s ease;
}
.pwa-install-banner.is-visible {
  bottom: 1rem;
}
.pwa-install-banner__inner {
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}
.pwa-install-banner__text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}
.pwa-install-banner__text strong {
  font-size: 0.875rem;
  color: var(--text-primary);
}
.pwa-install-banner__text span {
  font-size: 0.75rem;
  color: var(--text-secondary);
}
.pwa-install-banner__btn {
  flex-shrink: 0;
  padding: 0.5rem 1.25rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 0.875rem;
  cursor: pointer;
}
.pwa-install-banner__close {
  flex-shrink: 0;
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.25rem;
}

/* ============================================================
   Seasonal Tools
   ============================================================ */
.seasonal-tools {
  background: linear-gradient(135deg, rgba(30,58,138,0.05) 0%, rgba(202,138,4,0.05) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin: 2rem 0;
}
.seasonal-tools__header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.seasonal-tools__icon { font-size: 1.25rem; }
.seasonal-tools__title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}
.seasonal-tools__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.625rem;
}
.seasonal-tools__item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.875rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  position: relative;
}
@media (hover: hover) {
  .seasonal-tools__item:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 8px rgba(30,58,138,0.1);
  }
}
.seasonal-tools__badge {
  position: absolute;
  top: -8px;
  right: 8px;
  background: var(--accent-gold);
  color: #422006;
  font-size: 0.625rem;
  font-weight: 700;
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius-full);
}
.seasonal-tools__name { flex: 1; }
.seasonal-tools__arrow { color: var(--accent); flex-shrink: 0; }

/* ============================================================
   News Banner
   ============================================================ */
.news-banner {
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-size: 0.8125rem;
  font-weight: 600;
  text-align: center;
  margin-bottom: 1rem;
}
.news-banner--info {
  background: rgba(30,58,138,0.08);
  color: var(--accent);
  border: 1px solid rgba(30,58,138,0.15);
}
.news-banner--warning {
  background: rgba(202,138,4,0.08);
  color: #92400E;
  border: 1px solid rgba(202,138,4,0.2);
}

/* ============================================================
   Tool Progress (Gamification)
   ============================================================ */
.tool-progress {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin: 1.5rem 0;
}
.tool-progress__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.tool-progress__title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}
.tool-progress__total {
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 600;
  background: rgba(30,58,138,0.08);
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
}
.tool-progress__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}
.tool-progress__category {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}
.tool-progress__cat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.tool-progress__cat-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}
.tool-progress__cat-count {
  font-size: 0.75rem;
  color: var(--text-secondary);
}
.tool-progress__bar {
  height: 6px;
  background: var(--bg-secondary);
  border-radius: 3px;
  overflow: hidden;
}
.tool-progress__fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.5s ease;
}
.tool-progress__fill.tool-progress__badge--complete {
  background: var(--success, #22C55E);
}

/* 手取り率バッジ */
.rate-badge {
  display: inline-block;
  background: rgba(34, 197, 94, 0.1);
  color: #22C55E;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.875rem;
  margin-top: 8px;
}
[data-theme="dark"] .rate-badge {
  background: rgba(34, 197, 94, 0.15);
  color: #4ADE80;
}
.tool-progress__fill.tool-progress__badge--half {
  background: var(--accent-gold);
}
.tool-progress__complete-label {
  font-size: 0.6875rem;
  color: var(--success, #22C55E);
  font-weight: 700;
}

/* ============================================================
   CLS Prevention for dynamically inserted content
   ============================================================ */
#news-banner:empty,
#seasonal-tools:empty,
#tool-progress:empty,
#seasonal-banner-slot:empty {
  display: none;
}
#news-banner:not(:empty) { min-height: 48px; contain: content; }
#seasonal-tools:not(:empty) { min-height: 200px; contain: content; }
#tool-progress:not(:empty) { min-height: 100px; contain: content; }
#seasonal-banner-slot:not(:empty) { min-height: 48px; contain: content; }

/* ============================================================
   Reading Progress Indicator
   ============================================================ */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: transparent;
  z-index: 9999;
  pointer-events: none;
}
.reading-progress__fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-gold));
  transition: width 0.1s linear;
}
@media (prefers-reduced-motion: reduce) {
  .reading-progress__fill { transition: none; }
}

/* ============================================================
   フォームバリデーション
   ============================================================ */
.form-help { display: block; font-size: 0.75rem; color: var(--text-secondary); margin-top: 4px; }
.form-error { display: none; font-size: 0.75rem; color: #EF4444; margin-top: 4px; }
.form-error.show { display: block; }
input:user-invalid, input.is-invalid { border-color: #EF4444; }
input:user-valid, input.is-valid { border-color: #22C55E; }

/* ============================================================
   Sidebar TOC (scroll-tracking navigation for guide pages)
   ============================================================ */
.sidebar-toc { margin-bottom: 1.5rem; }
.sidebar-toc__title { font-size: 0.9375rem; font-weight: 700; margin-bottom: 0.5rem; }
.sidebar-toc ol { padding-left: 1rem; line-height: 2; font-size: 0.8125rem; }
.sidebar-toc a { color: var(--text-secondary); text-decoration: none; transition: color var(--transition), border-left var(--transition); display: block; padding-left: 8px; border-left: 2px solid transparent; }
.sidebar-toc a:hover { color: var(--accent); }
.sidebar-toc a.active { color: var(--accent); font-weight: 600; border-left-color: var(--accent); }

/* ============================================================
   結果シェアミニバー
   ============================================================ */
.result-share-mini { display: flex; align-items: center; gap: 8px; margin: 12px 0 20px; font-size: 0.8125rem; color: var(--text-secondary); }
.share-icon-btn { background: none; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px 10px; cursor: pointer; color: var(--text-primary); font-size: 0.75rem; transition: all var(--transition); font-family: inherit; }
.share-icon-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ============================================================
   Cookie同意バナー
   ============================================================ */
.cookie-consent {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 1rem;
  z-index: 9998;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
}
.cookie-consent__inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.8125rem;
}
.cookie-consent__inner p { margin: 0; }
.cookie-consent__inner a { color: var(--accent); }
@media (max-width: 768px) {
  .cookie-consent__inner { flex-direction: column; text-align: center; }
}

/* ============================================================
   Dark Mode: Search Bar Contrast Fix
   ============================================================ */
[data-theme="dark"] .hero-search__input,
[data-theme="dark"] .hero input[type="text"] {
  border-color: rgba(255,255,255,0.35);
  background: rgba(255,255,255,0.12);
}

/* ============================================================
   Dark Mode: Banner Link Visibility Fix
   ============================================================ */
[data-theme="dark"] .seasonal-banner a,
[data-theme="dark"] .news-banner a {
  color: #93C5FD;
}

/* ============================================================
   Tap Target Fix: Annual Income Pills (mobile touch)
   ============================================================ */
@media (pointer: coarse) {
  .annual-pills a,
  .link-pill {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
  }
}

/* ============================================================
   Empty state hint for calc history
   ============================================================ */
#calc-history:empty::after {
  content: 'まだ履歴がありません';
  display: block;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
  padding: 1rem;
}

/* ============================================================
   Dark Mode: tool-card description text contrast
   ============================================================ */
[data-theme="dark"] .tool-card-desc {
  color: #CBD5E1;
}

/* ============================================================
   Link Pills (年収別・ガイドリンク)
   ============================================================ */
.link-pills {
  margin-top: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.link-pill {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--accent);
  padding: 0.375rem 0.75rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius-full);
  text-decoration: none;
  background: var(--accent-light);
  transition: background-color var(--transition), color var(--transition);
}
.link-pill:hover {
  background: var(--accent);
  color: #fff;
  text-decoration: none;
}
[data-theme="dark"] .link-pill {
  background: rgba(96, 165, 250, 0.1);
  border-color: var(--accent);
}
[data-theme="dark"] .link-pill:hover {
  background: var(--accent);
  color: #fff;
}

/* ============================================================
   Sub-label (カテゴリ内のサブ見出し)
   ============================================================ */
.sub-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
}

/* ============================================================
   Popular Carousel Cards
   ============================================================ */
.popular-section {
  padding: 2rem 0 0;
}
.popular-card {
  min-width: 180px;
  flex-shrink: 0;
  padding: 1rem;
  text-align: center;
}
.popular-card__icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.5rem;
  color: #fff;
}
.popular-card--blue .popular-card__icon { background-color: var(--accent); }
.popular-card--gold .popular-card__icon { background-color: var(--accent-gold); }
.popular-card--green .popular-card__icon { background-color: var(--success); }
.popular-card--purple .popular-card__icon { background-color: #7C3AED; }
.popular-card--orange .popular-card__icon { background-color: var(--warning); }
.popular-card--blue { border-top: 3px solid var(--accent); }
.popular-card--gold { border-top: 3px solid var(--accent-gold); }
.popular-card--green { border-top: 3px solid var(--success); }
.popular-card--purple { border-top: 3px solid #7C3AED; }
.popular-card--orange { border-top: 3px solid var(--warning); }
.popular-card__title {
  font-weight: 700;
  font-size: 0.9rem;
}
.popular-card__desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

/* ============================================================
   Hero Search
   ============================================================ */
.hero-search {
  margin-top: 1.5rem;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
  position: relative;
}
.hero-search__input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.5rem;
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.15);
  color: #fff;
  font-size: 1rem;
  backdrop-filter: blur(4px);
  transition: border 0.2s;
}
.hero-search__input:focus {
  border-color: #CA8A04;
  outline: 3px solid rgba(202, 138, 4, 0.5);
  outline-offset: 2px;
}
.hero-search__input::placeholder {
  color: rgba(255,255,255,0.7);
}
.hero-search__icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.7;
}

/* ============================================================
   Section heading (inline section titles)
   ============================================================ */
.section-heading {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

/* ============================================================
   Guide Articles Section
   ============================================================ */
.guide-articles {
  max-width: 900px;
  margin: 2rem auto;
  padding: 0 1rem;
  content-visibility: auto;
  contain-intrinsic-size: auto 400px;
}
.guide-articles--wide {
  max-width: var(--max-width);
}
.guide-articles__heading {
  font-size: 1.5rem;
  margin-bottom: 1rem;
}
.guide-articles__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

/* ============================================================
   プロフィールバナー
   ============================================================ */
.profile-banner {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.profile-banner--welcome {
  background: linear-gradient(135deg, rgba(37,99,235,0.08), rgba(202,138,4,0.08));
  border: 1px solid var(--border);
}
.profile-banner--returning {
  background: rgba(202,138,4,0.06);
  border: 1px solid rgba(202,138,4,0.2);
}

/* ============================================================
   最近使ったツール (homepage)
   ============================================================ */
.recent-tools {
  margin: 1.5rem auto;
  max-width: 900px;
  padding: 0 1rem;
}
.recent-tools__heading {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}
.recent-tools__grid {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.recent-tools__grid::-webkit-scrollbar { height: 4px; }
.recent-tools__grid::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.recent-tools__card {
  flex-shrink: 0;
  min-width: 160px;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text-primary);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.recent-tools__card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
  text-decoration: none;
}
.recent-tools__name {
  font-weight: 600;
  font-size: 0.875rem;
}
.recent-tools__date {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

/* ============================================================
   Homepage banners (moved below hero)
   ============================================================ */
.homepage-banners {
  padding-top: 1rem;
}
.homepage-banners:empty,
.homepage-banners:has(> :empty:only-child) {
  display: none;
}

/* ============================================================
   Ad slot: hero below
   ============================================================ */
.ad-slot--hero-below {
  margin: 2rem auto;
  text-align: center;
}

/* ============================================================
   Sidebar card (guide pages)
   ============================================================ */
.sidebar-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.sidebar-card h3 {
  font-size: 0.9375rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}
.sidebar-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.sidebar-card li {
  margin-bottom: 0.375rem;
}
.sidebar-card a {
  display: block;
  padding: 0.375rem 0.5rem;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.8125rem;
  transition: background-color var(--transition);
}
.sidebar-card a:hover {
  background-color: var(--bg-secondary);
  text-decoration: none;
}

/* ============================================================
   Disclaimer box (guide pages)
   ============================================================ */
.disclaimer-box {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin: 1.5rem 0;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.7;
}
.disclaimer-box h4 {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}
.disclaimer-box ul {
  padding-left: 1.25rem;
  margin: 0;
}
.disclaimer-box li {
  margin-bottom: 0.25rem;
}

/* ============================================================
   Paint optimization for below-fold sections
   ============================================================ */
.faq-section, .article-section, .disclaimer, #tool-recommendations {
  content-visibility: auto;
  contain-intrinsic-size: auto 500px;
}
