:root {
  --primary-color: #007cba;
  --secondary-color: #0d47a1;
  --accent-color: #10b981;
  --text-color: #333333;
  --light-bg: #f5f5f5;
  --white: #ffffff;
  --gray: #e0e0e0;
  --gray-light: #f8f8f8;
  --border-color: #dddddd;
  --link-color: #0066cc;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue",
    Arial, sans-serif;
  color: var(--text-color);
  background-color: #f5f5f5;
  line-height: 1.6;
}

/* メインコンテナ - 2カラムレイアウト */
.article-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px;
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 40px;
}

/* メインコンテンツエリア */
.main-content {
  background-color: var(--white);
  padding: 30px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* ナビゲーション */
.column-navigation {
  margin-bottom: 30px;
}

.back-link {
  color: var(--link-color);
  text-decoration: none;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  transition: opacity 0.3s;
}

.back-link:hover {
  opacity: 0.7;
}

/* 記事ヘッダー */
.article-header {
  margin-bottom: 30px;
}

.article-meta-top {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 15px;
}

.post-date {
  background-color: #f0f0f0;
  padding: 10px 15px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: bold;
  text-align: center;
  line-height: 1.2;
  min-width: 60px;
  flex-shrink: 0; /* 日付ボックスが縮まないように */
}

.article-title {
  font-size: 24px;
  font-weight: bold;
  line-height: 1.4;
  color: var(--text-color);
  flex: 1;
  word-break: break-word; /* 長いタイトルの改行 */
}

.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  font-size: 14px;
}

.tag-item {
  background-color: #f0f0f0;
  padding: 5px 15px;
  border-radius: 20px;
  display: inline-block;
  transition: all 0.3s;
}

.tag-item:hover {
  background-color: #e0e0e0;
}

.tag-pr {
  background-color: #ff4757;
  color: white;
  font-weight: bold;
}

.last-updated {
  color: #666;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* アイキャッチ画像 */
.featured-image {
  margin-bottom: 40px;
  border-radius: 8px;
  overflow: hidden;
  max-width: 100%;
}

.featured-image img {
  width: 100%;
  height: auto;
  display: block;
  max-width: 100%;
}

/* 記事内のすべての画像を制限 */
.article-content img {
  max-width: 100% !important;
  height: auto !important;
}

/* 記事内のテーブルの幅を制御 */
.article-content table {
  max-width: 100% !important;
}

/* width属性が設定されているテーブルの制御 */
.article-content table[width] {
  width: 100% !important;
  max-width: 100% !important;
}

/* responsive-table内のテーブルは例外 */
.article-content .responsive-table table {
  width: 100%;
  max-width: none;
}

/* 記事内のすべての要素に最大幅を設定 */
.article-content > * {
  max-width: 100%;
}

/* 記事内のdivやpタグのオーバーフローを防ぐ */
.article-content div,
.article-content p {
  max-width: 100%;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

/* 記事本文 */
.article-content {
  font-size: 16px;
  line-height: 1.8;
  color: var(--text-color);
  max-width: 100%;
  overflow-wrap: break-word; /* 長い単語を自動改行 */
  word-wrap: break-word; /* 旧ブラウザ対応 */
}

.article-content h2 {
  font-size: 18px;
  margin: 40px 0 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border-color);
}

.article-content h3 {
  font-size: 16px;
  margin: 30px 0 15px;
}

.article-content p {
  margin-bottom: 20px;
}

.article-content strong {
  color: #ff4757;
  font-weight: bold;
}

.article-content ul,
.article-content ol {
  margin: 20px 0;
  padding-left: 30px;
}

.article-content li {
  margin-bottom: 10px;
}

.article-content blockquote {
  margin: 20px 0;
  padding: 20px;
  background-color: var(--gray-light);
  border-left: 4px solid var(--primary-color);
}

.article-content img {
  max-width: 100%;
  height: auto;
  margin: 20px 0;
  border-radius: 8px;
}

.article-content a {
  color: var(--link-color);
  text-decoration: underline;
}

.article-content a:hover {
  opacity: 0.7;
}

/* 比較表 */
.comparison-table-wrapper {
  margin: 40px 0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.table-title {
  background-color: #1a1a2e;
  color: white;
  padding: 15px 20px;
  text-align: center;
  font-size: 18px;
  margin: 0;
  font-weight: bold;
}

.table-scroll {
  overflow-x: auto;
}

.comparison-table {
  width: 100%;
  border-collapse: collapse;
  background-color: white;
}

.comparison-table th {
  background-color: #0066cc;
  color: white;
  padding: 15px;
  text-align: left;
  font-weight: normal;
  white-space: nowrap;
}

.comparison-table td {
  padding: 15px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.comparison-table tbody tr:hover {
  background-color: #f8f8f8;
}

.broker-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.broker-logo {
  width: 120px;
  height: auto;
  max-height: 50px;
  object-fit: contain;
}

.broker-name {
  font-weight: bold;
  color: var(--text-color);
}

.feature-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.feature-list li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 8px;
  font-size: 14px;
  line-height: 1.5;
}

.feature-list li:before {
  content: "•";
  position: absolute;
  left: 0;
  color: #ff4757;
  font-weight: bold;
}

.cta-button {
  display: inline-block;
  background-color: #4caf50;
  color: white;
  padding: 12px 30px;
  text-decoration: none;
  border-radius: 25px;
  font-weight: bold;
  font-size: 14px;
  transition: all 0.3s;
  text-align: center;
  white-space: nowrap;
}

.cta-button:hover {
  background-color: #45a049;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.table-footer {
  text-align: right;
  padding: 15px;
  background-color: #f8f8f8;
}

.more-link {
  color: var(--link-color);
  text-decoration: none;
  font-weight: bold;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.more-link:hover {
  text-decoration: underline;
}

/* 目次 */
.toc-container {
  background-color: #f8f9fa;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 20px;
  margin: 30px 0;
}

.toc-header {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 15px;
  font-size: 16px;
  font-weight: bold;
  color: #333;
}

.toc-header::before,
.toc-header::after {
  content: "";
  flex: 1;
  height: 1px;
  background-color: #e0e0e0;
}

.toc-header::before {
  margin-right: 15px;
}

.toc-header::after {
  margin-left: 15px;
}

.toc-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toc-title::before {
  content: "📑";
  font-size: 18px;
}

.toc-content {
  margin-top: 15px;
}

.toc-list {
  list-style: none;
  counter-reset: toc-counter;
  padding: 0;
  margin: 0;
}

.toc-item-h2 {
  counter-increment: toc-counter;
  margin-bottom: 10px;
}

.toc-item-h2 > a {
  display: flex;
  align-items: baseline;
  text-decoration: none;
  color: #333;
  font-size: 15px;
  line-height: 1.6;
  padding: 5px 10px;
  border-radius: 4px;
  transition: all 0.3s;
}

.toc-item-h2 > a:hover {
  background-color: #e8f4f8;
  color: #0066cc;
}

.toc-item-h2 > a::before {
  content: counter(toc-counter);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  margin-right: 10px;
  background-color: #333;
  color: white;
  font-size: 12px;
  font-weight: bold;
  border-radius: 50%;
  flex-shrink: 0;
}

.toc-sublist {
  list-style: none;
  padding: 0;
  margin: 5px 0 0 34px;
  counter-reset: toc-subcounter;
}

.toc-item-h3 {
  counter-increment: toc-subcounter;
  margin-bottom: 5px;
}

.toc-item-h3 > a {
  display: flex;
  align-items: baseline;
  text-decoration: none;
  color: #666;
  font-size: 14px;
  line-height: 1.5;
  padding: 3px 10px;
  border-radius: 4px;
  transition: all 0.3s;
}

.toc-item-h3 > a:hover {
  background-color: #f0f0f0;
  color: #0066cc;
}

.toc-item-h3 > a::before {
  content: counter(toc-counter) "-" counter(toc-subcounter);
  display: inline-block;
  min-width: 30px;
  margin-right: 8px;
  font-size: 13px;
  color: #999;
}

/* サイドバー */
.sidebar {
  position: sticky;
  top: 100px; /* ヘッダーの高さを考慮して調整 */
  height: fit-content;
}

.sidebar-section {
  background-color: white;
  padding: 25px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  margin-bottom: 20px;
}

.sidebar-title {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border-color);
}

.category-list {
  list-style: none;
  padding: 0;
}

.category-list li {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f0f0f0;
}

.category-list li:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.category-list a {
  color: var(--text-color);
  text-decoration: none;
  font-size: 15px;
  display: flex;
  align-items: center;
  transition: color 0.3s;
}

.category-list a:before {
  content: "▶";
  font-size: 10px;
  margin-right: 8px;
  color: #999;
}

.category-list a:hover {
  color: var(--link-color);
}

.category-list a:hover:before {
  color: var(--link-color);
}

/* 記事内テーブルのスタイル */
.article-content .responsive-table {
  width: 100%;
  overflow-x: auto;
  margin: 25px 0;
  -webkit-overflow-scrolling: touch;
  position: relative;
}

/* 記事内のstyleタグを上書き */
.article-content style + .responsive-table {
  margin-top: 0;
}

.article-content .responsive-table table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 600px;
  background-color: #ffffff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  overflow: hidden;
}

/* テーブルヘッダー */
.article-content .responsive-table th {
  background-color: #2c3e50;
  color: #ffffff;
  padding: 15px 20px;
  text-align: left;
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  letter-spacing: 0.5px;
}

/* テーブルセル */
.article-content .responsive-table td {
  padding: 15px 20px;
  border-bottom: 1px solid #e9ecef;
  text-align: left;
  font-size: 14px;
  color: #333;
  vertical-align: middle;
  line-height: 1.6;
}

/* 最後の行のボーダーを削除 */
.article-content .responsive-table tr:last-child td {
  border-bottom: none;
}

/* 行のホバー効果 */
.article-content .responsive-table tbody tr {
  transition: background-color 0.2s ease;
}

.article-content .responsive-table tbody tr:hover {
  background-color: #f8f9fa;
}

/* 強調行（Bi-Winning用） */
.article-content .responsive-table tr[style*="background-color: #fff3cd"] {
  background-color: #fff3cd !important;
}

.article-content .responsive-table tr[style*="background-color: #fff3cd"] td {
  font-weight: 600;
}

/* テーブル内のリンク */
.article-content .responsive-table a {
  color: #3498db;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.article-content .responsive-table a:hover {
  color: #2980b9;
  text-decoration: underline;
}

/* テーブル内の強調テキスト */
.article-content .responsive-table strong {
  color: #e74c3c;
  font-weight: 700;
}

/* 数値の中央揃え（ペイアウト率など） */
.article-content .responsive-table td:nth-child(3),
.article-content .responsive-table td:nth-child(4) {
  text-align: center;
}

/* ステップ番号の装飾 */
.article-content .responsive-table td:first-child {
  font-weight: 600;
  color: #3498db;
}

/* 手数料テーブルの特別スタイル */
.article-content .fee-table th {
  background-color: #34495e;
}

.article-content .fee-table td:first-child {
  font-weight: 500;
  color: #2c3e50;
  background-color: #f8f9fa;
}

/* 比較表の特別スタイル */
.article-content .comparison-table th {
  background-color: #1a252f;
  font-size: 13px;
}

.article-content .comparison-table td:first-child {
  font-weight: 600;
  background-color: #f8f9fa;
}

/* 無料表示の色分け */
.article-content .responsive-table td:contains("無料") {
  color: #27ae60;
  font-weight: 600;
}

/* highlight-boxのスタイル改善 */
.article-content .highlight-box {
  background-color: #f8f9fa;
  border: 2px solid #0066cc;
  border-radius: 8px;
  padding: 25px;
  margin: 30px 0;
  position: relative;
}

.article-content .highlight-box::before {
  content: "📌";
  position: absolute;
  top: -15px;
  left: 20px;
  background-color: white;
  padding: 0 10px;
  font-size: 24px;
}

.article-content .highlight-box h2 {
  margin-top: 0;
  color: #0066cc;
  font-size: 22px;
  border-bottom: none;
  padding-bottom: 10px;
}

.article-content .highlight-box p {
  margin-bottom: 10px;
  line-height: 1.8;
}

/* レスポンシブ対応 - テーブル */
@media (max-width: 768px) {
  .article-content .responsive-table {
    margin: 20px 0;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: inset -5px 0 5px -5px rgba(0,0,0,0.1);
  }
  
  .article-content .responsive-table table {
    font-size: 12px;
    /* min-widthを削除して、テーブルが縮小できるようにする */
  }
  
  .article-content .responsive-table th,
  .article-content .responsive-table td {
    padding: 10px 12px;
  }
  
  .article-content .highlight-box {
    margin: 20px 0;
    padding: 20px;
  }
}

/* レスポンシブデザイン */
@media (max-width: 1024px) {
  .article-container {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    margin-top: 40px;
  }
}

@media (max-width: 768px) {
  .article-container {
    padding: 10px;
    gap: 20px;
  }

  .main-content {
    padding: 15px;
    width: 100%;
    overflow: hidden;
  }

  .article-meta-top {
    flex-direction: column;
    gap: 15px;
  }

  .article-title {
    font-size: 20px;
  }
  
  .post-date {
    font-size: 14px;
    padding: 8px 12px;
    min-width: 50px;
  }

  .article-tags {
    flex-wrap: wrap;
    gap: 5px;
  }
  
  .tag-item {
    font-size: 12px;
    padding: 4px 10px;
  }

  .comparison-table {
    font-size: 14px;
  }

  .comparison-table th,
  .comparison-table td {
    padding: 10px;
  }

  .broker-logo {
    width: 80px;
  }

  .cta-button {
    padding: 10px 20px;
    font-size: 13px;
  }

  .sidebar-section {
    padding: 20px;
  }
}

@media (max-width: 480px) {
  .article-container {
    padding: 5px;
  }
  
  .main-content {
    padding: 10px;
  }

  .article-title {
    font-size: 18px;
  }

  .article-content {
    font-size: 15px;
  }
  
  .article-content h2 {
    font-size: 16px;
    margin: 30px 0 15px;
  }
  
  .article-content h3 {
    font-size: 15px;
    margin: 20px 0 10px;
  }

  .comparison-table {
    font-size: 11px;
  }
  
  .article-content .responsive-table th,
  .article-content .responsive-table td {
    padding: 8px 10px;
    font-size: 11px;
  }

  .feature-list li {
    font-size: 12px;
  }
  
  /* 記事ナビゲーション */
  .column-navigation {
    margin-bottom: 20px;
  }
  
  .back-link {
    font-size: 12px;
  }
}
