/* ===================================================
   article.css
   記事ページ専用スタイル（本文・コード・表・QR/COBOL拡張）
   style.css から分割生成
   =================================================== */

/* ===================================================
   6. 記事コンポーネント
   =================================================== */

/* ゴールセクション */
.goal-section {
  background: linear-gradient(135deg, #fff8e1 0%, #fff3e0 100%);
  border-left: 6px solid #ff9800;
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 24px 28px;
  margin: 24px 0 32px;
  box-shadow: var(--shadow-sm);
}
.goal-section h2 {
  border-left: none !important;
  padding: 0 !important;
  margin-top: 0 !important;
  color: #e65100 !important;
  font-size: 1.35em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.goal-section h2 .icon { font-size: 1.2em; }
.goal-section p { margin-bottom: 12px; line-height: 1.8; }
.goal-section p:last-child { margin-bottom: 0; }

/* 注意・ヒント系ボックス（共通プロパティ） */
.xdemo-note-good,
.xdemo-note-warn,
.xdemo-note-danger,
.xdemo-note-info {
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 18px 0;
  line-height: 1.7;
  font-size: 0.95em;
  border-left: 5px solid;
  box-shadow: var(--shadow-sm);
}
.xdemo-note-good,
.xdemo-note-warn,
.xdemo-note-danger,
.xdemo-note-info {
  /* strong 共通：ブロック表示の見出し化 */
}
.xdemo-note-good strong,
.xdemo-note-warn strong,
.xdemo-note-danger strong,
.xdemo-note-info strong {
  display: block;
  margin-bottom: 6px;
  font-size: 1.05em;
}

.xdemo-note-good { background: #e8f5e9; border-color: #43a047; color: #1b5e20; }
.xdemo-note-good strong { color: #1b5e20; }

.xdemo-note-warn { background: #fff8e1; border-color: #f57c00; color: #5d4037; }
.xdemo-note-warn strong { color: #e65100; }
.xdemo-note-warn h3 {
  margin-top: 0 !important;
  margin-bottom: 10px !important;
  font-size: 1.05em !important;
  color: #e65100 !important;
}
.xdemo-note-warn h4 {
  margin: 18px 0 6px !important;
  font-size: 0.98em !important;
}

.xdemo-note-danger { background: #ffebee; border-color: #c62828; color: #5d1a1a; }
.xdemo-note-danger strong { color: #c62828; }

.xdemo-note-info { background: #e3f2fd; border-color: #1976d2; color: #0d47a1; }
.xdemo-note-info strong { color: #0d47a1; }

/* メソッド・Tipsセクション */
.method-section {
  background: #f9fbff;
  border: 1px solid #e3ecf5;
  border-radius: var(--radius);
  padding: 24px 28px;
  margin: 28px 0;
}
.method-section h2,
.tips-section h2 {
  position: relative;
  padding-left: 16px;
  border-left: 6px solid #1a237e;
  color: #1a237e;
  margin: 32px 0 24px;
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.method-section > h2 {
  border-left: 5px solid var(--color-accent) !important;
  padding: 4px 0 4px 14px !important;
  margin: 0 0 16px !important;
  font-size: 1.2em !important;
  color: var(--color-primary) !important;
}
.method-section h3 {
  font-size: 1.05em;
  color: #2a5f8f;
  margin: 22px 0 10px;
  padding-left: 10px;
  border-left: 3px solid #90caf9;
}

/* パイプライン3カラム */
.pipeline-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
  margin: 22px 0 28px;
}
.pipeline-card {
  position: relative;
  background: #ffffff;
  border: 2px solid;
  border-radius: 12px;
  padding: 20px 22px 22px;
  transition: transform var(--transition), box-shadow var(--transition);
  counter-increment: pipeline-step;
}
.pipeline-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.pipeline-card h4 { font-size: 1.05em; font-weight: 800; margin: 0 0 10px; padding: 0; }
.pipeline-card p { font-size: 0.88em; line-height: 1.7; color: #555; margin-bottom: 8px; }
.pipeline-card p:last-child { margin-bottom: 0; }
.pipeline-card.paste {
  border-color: #1976d2;
  background: linear-gradient(180deg, #e3f2fd 0%, #ffffff 30%);
}
.pipeline-card.paste h4 { color: #0d47a1; }
.pipeline-card.extract {
  border-color: #f57c00;
  background: linear-gradient(180deg, #fff3e0 0%, #ffffff 30%);
}
.pipeline-card.extract h4 { color: #e65100; }
.pipeline-card.output {
  border-color: #2e7d32;
  background: linear-gradient(180deg, #e8f5e9 0%, #ffffff 30%);
}
.pipeline-card.output h4 { color: #1b5e20; }

/* 目次 */
.toc-box {
  background: linear-gradient(135deg, #f5f8ff 0%, #e8f0fe 100%);
  border: 1px solid #bbdefb;
  border-left: 6px solid #1976d2;
  border-radius: var(--radius);
  padding: 20px 28px;
  margin: 24px 0 32px;
  box-shadow: var(--shadow-sm);
}
.toc-box h3 {
  margin: 0 0 12px;
  color: #0d47a1;
  font-size: 1.05em;
  display: flex;
  align-items: center;
  gap: 6px;
}
.toc-box h3::before { content: "📑"; }
.toc-box ol { margin: 0; padding-left: 22px; line-height: 2; }
.toc-box ol li { font-size: 0.92em; }
.toc-box a { color: #1565c0; text-decoration: none; transition: color var(--transition); }
.toc-box a:hover { color: #0d47a1; text-decoration: underline; }

/* 数式コピーUI */
.formula-copy-list {
  margin: 14px 0 22px;
  border: 1px solid #cfd8dc;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.formula-copy-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) auto;
  border-bottom: 1px solid #cfd8dc;
}
.formula-copy-row:last-child { border-bottom: none; }
.formula-copy-label {
  background: #f7f9fb;
  border-right: 1px solid #cfd8dc;
  padding: 10px 12px;
  font-weight: 700;
  color: #1f3b57;
  display: flex;
  align-items: center;
  font-size: 0.85rem;
}
.formula-copy-code {
  background: #263238;
  color: #f5f5f5;
  padding: 12px 14px;
  font-family: Consolas, monospace;
  font-size: 0.9rem;
  white-space: pre-wrap;
  line-height: 1.5;
}
.formula-copy-btn {
  border: none;
  border-left: 1px solid #cfd8dc;
  background: #1976d2;
  color: #fff;
  padding: 0 16px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}
.formula-copy-btn:hover { background: #0d47a1; }
.formula-copy-btn.copied { background: #2e7d32; }

/* コードブロック */
.code-block, .code-readonly {
  background: #263238;
  color: #f5f5f5;
  padding: 16px 20px;
  border-radius: var(--radius);
  font-family: Consolas, Monaco, monospace;
  font-size: 0.95rem;
  line-height: 1.6;
  margin: 16px 0 24px;
  position: relative;
  overflow-x: auto;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
  white-space: pre-wrap;
  word-break: break-all;
}
.code-block[data-label]::before {
  content: attr(data-label);
  display: block;
  background: #37474f;
  color: #cfd8dc;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 4px;
  margin-bottom: 12px;
  width: fit-content;
  font-family: var(--font-main);
}
.code-comment {
  font-size: 0.9em;
  color: var(--color-text-muted);
  margin: -16px 0 24px 8px;
  line-height: 1.6;
}
.code-block .copy-btn,
.code-readonly .copy-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font-main);
}
.code-block .copy-btn:hover,
.code-readonly .copy-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}
.code-block .copy-btn.copied,
.code-readonly .copy-btn.copied {
  background: #2e7d32;
  border-color: #2e7d32;
}
.code-block .code-line { display: block; white-space: pre; }

/* コードラベル */
.code-label,
.code-label-good {
  display: inline-block;
  font-size: 0.82em;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 4px 4px 0 0;
  margin: 12px 0 0;
  letter-spacing: 0.02em;
}
.code-label { background: #455a64; color: #fff; }
.code-label-good { background: #1976d2; color: #fff; }
.code-label + .code-block,
.code-label-good + .code-block {
  margin-top: 0;
  border-top-left-radius: 0;
}

/* インラインコード */
.article-body code {
  background: #f1f3f5;
  color: #d63384;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.92em;
  font-family: Consolas, "Courier New", monospace;
  border: 1px solid #e9ecef;
}
.code-block code,
.code-readonly code {
  background: transparent;
  color: inherit;
  padding: 0;
  border: none;
}

/* Formula Box（記事2などで使用するシンプルコードブロック） */
.formula-box {
  background: #263238;
  color: #eceff1;
  padding: 20px 16px 16px;
  border-radius: 8px;
  position: relative;
  margin: 1.5em 0;
  font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
.formula-box code {
  color: inherit;
  background: none !important;
  padding: 0 !important;
  white-space: pre-wrap;
  word-break: break-all;
  display: block;
  font-size: 0.9rem;
  line-height: 1.5;
}
.formula-box .copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 0.7rem;
  cursor: pointer;
  transition: all 0.2s;
  z-index: 5;
}
.formula-box .copy-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.4);
}
.formula-box .copy-btn.copied {
  background: #2e7d32;
  border-color: #2e7d32;
}

/* テーブル（基本） */
.table-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 16px 0 24px;
}
.table-wrapper:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: 8px;
}

.compare-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 2em 0;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}
.compare-table th {
  background: #f1f5f9;
  color: #1e293b;
  font-weight: 700;
  padding: 16px;
  border-bottom: 2px solid #e2e8f0;
  text-align: left;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.compare-table td {
  padding: 14px 16px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.92rem;
  color: #334155;
  line-height: 1.6;
}
.compare-table tr:last-child td { border-bottom: none; }
.compare-table tr:nth-child(even) { background: #f8fafc; }
.compare-table tr:hover { background: #f1f5f9; }
.compare-table .text-center { text-align: center; }

/* 記事内の compare-table は控えめ */
.article-body .compare-table {
  box-shadow: var(--shadow-sm);
  border-radius: 6px;
  overflow: hidden;
}
.article-body .compare-table th { font-weight: 700; letter-spacing: 0.02em; }
.article-body .compare-table tr:nth-child(even) td { background: #fafbfc; }
.article-body .compare-table tr:hover td { background: #f0f7ff; }

.vs-good { background: #e8f5e9 !important; color: #1b5e20; font-weight: 700; }
.vs-bad { background: #ffebee !important; color: #c62828; font-weight: 700; }

/* キーテーブル（プレミアム表示） */
.key-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 2em 0;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}
.key-table th {
  background: #f1f5f9;
  color: #1e293b;
  font-weight: 700;
  padding: 16px;
  border-bottom: 2px solid #e2e8f0;
  text-align: left;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.key-table td {
  padding: 14px 16px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.92rem;
  color: #334155;
  line-height: 1.6;
}
.key-table tr:last-child td { border-bottom: none; }
.key-table tr:nth-child(even) { background: #f8fafc; }
.key-table tr:hover { background: #f1f5f9; }
.key-table .text-center { text-align: center; }

.transfer-choice-table {
  margin-left: auto;
  margin-right: auto;
  table-layout: fixed;
}
.transfer-choice-table th:first-child,
.transfer-choice-table td:first-child {
  width: 52%;
}
.transfer-choice-table th:nth-child(2),
.transfer-choice-table td:nth-child(2) {
  width: 18%;
  text-align: center;
}
.transfer-choice-table th:nth-child(n+3),
.transfer-choice-table td:nth-child(n+3) {
  width: 15%;
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
}
.transfer-choice-table .choice-symbol {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1;
}
.transfer-choice-table .choice-ok { color: #2e7d32; }
.transfer-choice-table .choice-ng { color: #c62828; }

/* Excel画面再現テーブル */
.helper-display-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0 22px;
  border: 1px solid #cfd8dc;
  background: #fff;
  font-size: 0.92rem;
}
.helper-display-table caption {
  caption-side: top;
  text-align: left;
  font-weight: 700;
  margin-bottom: 8px;
  color: #333;
}
.helper-display-table th,
.helper-display-table td {
  border: 1px solid #cfd8dc;
  padding: 8px 10px;
  vertical-align: middle;
}
.helper-display-table th { background: #eef5fb; color: #1f3b57; text-align: center; }
.helper-display-table .helper-left {
  background: #fffde7;
  font-weight: 700;
  text-align: center;
  width: 40px;
}
.helper-display-table .source-col { background: #f7f9fb; }
.helper-display-table .result-col { background: #eef7ff; }
.helper-display-table .hit-row { background: #e8f5e9; }
.helper-display-table .data-hit { background: #dcedc8; font-weight: 700; }
.helper-display-table .helper-blank { background: #fafafa; color: #aaa; }
.helper-display-table tr:hover td { background: #fffde7; }

/* テーブルセル装飾 */
.diff-ng {
  display: inline-block;
  background: #ffebee;
  color: #c62828;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 3px;
  border: 1px solid #ef9a9a;
}
.diff-ok {
  display: inline-block;
  background: #e8f5e9;
  color: #2e7d32;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 3px;
  border: 1px solid #a5d6a7;
}
.col-item { background: #f5f5f5; font-weight: 700; color: #444; }

/* シナリオカード */
.scenario-card {
  background: #fff;
  border: 1px solid #e8eaf6;
  border-radius: 12px;
  padding: 24px;
  margin: 1.5em 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
  border-left: 6px solid #1a237e;
}
.scenario-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}
.scenario-card h4 {
  margin-top: 0;
  margin-bottom: 12px;
  color: #1a237e;
  font-size: 1.15rem;
  font-weight: 700;
}
.scenario-card p {
  margin: 0;
  font-size: 0.95rem;
  color: #444;
  line-height: 1.7;
}
.sc-label {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  background: #1976d2;
  margin-bottom: 12px;
  box-shadow: 0 2px 4px rgba(25, 118, 210, 0.3);
}
.sc-label-adv {
  background: #e65100;
  box-shadow: 0 2px 4px rgba(230, 81, 0, 0.3);
}
.scenario-box {
  background: #fff3e0;
  border-left: 6px solid #fb8c00;
  padding: 16px 20px;
  margin: 20px 0;
  border-radius: 0 8px 8px 0;
  font-size: 0.95rem;
  color: #4e342e;
}

/* 突破ボックス */
.breakthrough-box {
  background: #e8f5e9;
  border-left: 6px solid #43a047;
  padding: 24px;
  margin: 32px 0;
  border-radius: 4px;
}
.breakthrough-box h3 {
  margin-top: 0;
  color: #2e7d32;
  font-size: 1.2rem;
}

/* セットアップ手順 */
.setup-step {
  border: 1px solid #e0e6ed;
  border-radius: 12px;
  padding: 24px;
  margin: 32px 0;
  background: #fff;
  position: relative;
}
.setup-step-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  border-bottom: 1px solid #f0f4f8;
  padding-bottom: 12px;
  flex-wrap: wrap;
}
.step-number {
  background: #1a237e;
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
}
.step-title {
  font-weight: 700;
  color: #1a237e;
  font-size: 1.1rem;
  flex: 1;
}
.step-time {
  font-size: 0.75rem;
  color: #777;
  background: #f1f3f4;
  padding: 2px 8px;
  border-radius: 4px;
}
.step-ref {
  font-size: 0.75rem;
  color: #1976d2;
  border: 1px solid #1976d2;
  padding: 1px 6px;
  border-radius: 4px;
}
.level-badge {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 4px;
  color: #fff;
  font-weight: 700;
}
.level-excel { background: #43a047; }
.level-system { background: #fb8c00; }
.level-full { background: #e53935; }
.level-send { background: #1e88e5; }

/* チェックリスト */
.checklist {
  list-style: none;
  padding-left: 0;
  margin: 16px 0;
}
.checklist li {
  position: relative;
  padding-left: 28px;
  margin-bottom: 8px;
  font-size: 0.95rem;
}
.checklist li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 0;
}

/* メディアプレースホルダー */
.media-placeholder {
  background: #f0f4f8;
  border: 2px dashed #b0bec5;
  border-radius: 8px;
  padding: 40px 20px;
  text-align: center;
  margin: 32px 0;
  color: #546e7a;
}

/* ===================================================
   7-1. QR専用 / 文字パターン・ロードマップ・usecase
   =================================================== */
.charmap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  gap: 4px;
  margin: 1em 0;
  padding: 12px;
  background: #fafafa;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
}
.charmap-cell {
  text-align: center;
  padding: 6px 2px;
  border-radius: 4px;
  font-family: Consolas, monospace;
  font-size: 0.92rem;
  line-height: 1.3;
}
.charmap-cell .ch { display: block; font-size: 1.05rem; font-weight: bold; }
.charmap-cell .num { display: block; font-size: 0.7rem; color: #888; }
.cm-digit { background: #c8e6c9; }
.cm-upper { background: #bbdefb; }
.cm-lower { background: #d1c4e9; }
.cm-symbol { background: #fff9c4; }
.cm-space { background: #f5f5f5; border: 1px dashed #bbb; }

.char-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.2em 0;
  font-size: 0.9em;
}
.char-table th {
  background: #1a237e;
  color: #fff;
  padding: 9px 12px;
  text-align: left;
  font-size: 0.88rem;
}
.char-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #e0e0e0;
  vertical-align: top;
}
.char-table tr:nth-child(even) { background: #f5f7ff; }
.char-table tr:hover { background: #e8eaf6; }
.char-table .badge-safe,
.char-table .badge-adv,
.char-table .badge-exp {
  display: inline-block;
  color: #fff;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 10px;
}
.char-table .badge-safe { background: #43a047; }
.char-table .badge-adv { background: #f57c00; }
.char-table .badge-exp { background: #c62828; }

.roadmap {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin: 1.2em 0;
}
.roadmap-card {
  flex: 1;
  min-width: 260px;
  border-radius: 10px;
  padding: 20px;
}
.roadmap-basic {
  background: linear-gradient(135deg, #e3f2fd, #bbdefb);
  border: 2px solid #1976d2;
}
.roadmap-adv {
  background: linear-gradient(135deg, #fff3e0, #ffe0b2);
  border: 2px solid #e65100;
}
.roadmap-card h4 { margin: 0 0 8px; font-size: 1.05rem; }
.roadmap-card ul { margin: 0; padding-left: 1.4em; }
.roadmap-card li { margin-bottom: 4px; font-size: 0.92rem; }

.usecase-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin: 1em 0;
}
.usecase-card {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  transition: transform 0.2s, box-shadow 0.2s;
}
.usecase-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
.usecase-card .icon { font-size: 2rem; margin-bottom: 6px; }
.usecase-card h4 { margin: 4px 0; font-size: 0.95rem; }
.usecase-card p { font-size: 0.85rem; color: #555; margin: 0; }

/* 付録セクション */
.appendix-section {
  background: #f8f9fa;
  border-top: 3px solid #0d47a1;
  padding: 28px 24px;
  margin-top: 2.5em;
  border-radius: 0 0 8px 8px;
}
.appendix-section h3 {
  margin-top: 0;
  color: #0d47a1;
  font-size: 1.15rem;
}

/* ===================================================
   7-2. QR専用 / 方式選択テーブル・フロー・トリガー
   =================================================== */
.method-choice-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
  background: #fff;
  border: 1px solid #e0e0e0;
}
.method-choice-table th {
  background: #f5f7f9;
  padding: 12px;
  border: 1px solid #e0e0e0;
  font-size: 0.9rem;
}
.method-choice-table td {
  padding: 12px;
  border: 1px solid #e0e0e0;
  font-size: 0.9rem;
}
.method-choice-table .recommend {
  background: #e3f2fd;
  font-weight: 700;
}
.text-center-green-bold {
  color: #2e7d32;
  font-weight: 700;
  text-align: center;
}

/* フローボックス */
.flow-box {
  background: #f8f9fb;
  border: 1px solid #e1e8ed;
  border-radius: 12px;
  padding: 20px;
  margin: 1.5em 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.flow-step {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.step-item {
  background: #fff;
  border: 1px solid #1a237e;
  color: #1a237e;
}
.step-key {
  background: #e8eaf6;
  border: 1px solid #1a237e;
  color: #1a237e;
}
.step-enter {
  background: #1a237e;
  color: #fff;
  border: 1px solid #1a237e;
}
.step-arrow {
  color: #90a4ae;
  font-weight: 700;
  margin: 0 4px;
}
.flow-current {
  background: #1a237e;
  color: #fff;
  border-color: #1a237e;
}
.flow-arrow {
  color: #b0bec5;
  font-weight: 700;
}

.trigger-char {
  background: #f0f0f0;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-weight: 700;
  color: #c62828;
}

/* スペックテーブル */
.spec-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
  background: #fff;
  border: 1px solid #e0e0e0;
}
.spec-table th {
  background: #263238;
  color: #fff;
  padding: 12px 16px;
  border: 1px solid #37474f;
  font-size: 0.85rem;
}
.spec-table td {
  padding: 12px 16px;
  border: 1px solid #e0e0e0;
  font-size: 0.85rem;
}
.spec-table td.ok { color: #2e7d32; font-weight: 700; text-align: center; }
.spec-table td.ng { color: #c62828; font-weight: 700; text-align: center; }
.spec-table .note-small {
  font-size: 0.75rem;
  color: #777;
  display: block;
  margin-top: 4px;
}

/* チェックテーブル */
.check-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
}
.check-table th,
.check-table td {
  padding: 12px;
  border: 1px solid #eee;
  font-size: 0.9rem;
}
.check-table th { background: #f8f9fa; text-align: left; }

/* アーキテクチャ図 */
.arch-diagram {
  background: #f1f3f9;
  border-radius: 12px;
  padding: 24px;
  margin: 24px 0;
}
.arch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.arch-box {
  background: #fff;
  border: 1px solid #d1d9e6;
  border-radius: 8px;
  padding: 12px 16px;
  flex: 1;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}
.arch-box .arch-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 400;
  color: #666;
  margin-top: 4px;
}
.arch-arrow {
  font-size: 0.8rem;
  color: #999;
  white-space: nowrap;
}
.arch-send { border-top: 4px solid #1e88e5; background: #e3f2fd; }
.arch-paper { border-top: 4px solid #fbc02d; background: #fffde7; }
.arch-receive { border-top: 4px solid #43a047; background: #e8f5e9; }
.arch-qr { border-top: 4px solid #3949ab; background: #e8eaf6; color: #1a237e; }
.arch-reader { border-top: 4px solid #f4511e; background: #fbe9e7; color: #bf360c; }
.arch-pc { border-top: 4px solid #546e7a; background: #eceff1; color: #263238; }
.arch-app { border-top: 4px solid #8e24aa; background: #f3e5f5; color: #4a148c; }

/* ハードウェア比較カード */
.compare-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin: 24px 0;
}
.compare-card {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 20px;
  position: relative;
  box-shadow: var(--shadow-sm);
}
.compare-card h4 { margin-top: 24px; color: #333; }
.compare-card ul { padding-left: 18px; font-size: 0.85rem; }
.card-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: 0.65rem;
  padding: 2px 8px;
  border-radius: 4px;
  color: #fff;
  font-weight: 700;
}
.card-main { border-top: 5px solid #1e88e5; }
.card-main .card-badge { background: #1e88e5; }
.card-compat { border-top: 5px solid #43a047; }
.card-compat .card-badge { background: #43a047; }
.card-upper { border-top: 5px solid #fb8c00; }
.card-upper .card-badge { background: #fb8c00; }

/* ===================================================
   7-3. COBOL専用 / pattern-card・solution-grid
   =================================================== */
.cobol-selection-guide {
  background: #ffffff;
  border-radius: 16px;
  padding: 40px;
  margin: 32px 0 48px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
  border: 1px solid var(--color-border);
}
.guide-intro {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 40px;
  align-items: center;
  margin-bottom: 48px;
}
.guide-visual img,
.guide-visual video.demo-video {
  max-width: 600px;
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  transition: transform 0.4s ease;
}
.guide-visual img {
  cursor: zoom-in;
}
.demo-video {
  max-width: 100%;
  height: auto;
  display: block;
  background: #132534;
}
.article-demo-visual video.demo-video {
  width: 100%;
  border-radius: 12px;
  box-shadow: var(--shadow-md);
}
video::cue {
  color: #fff;
  background: rgba(8, 20, 32, 0.82);
  font-size: 1rem;
  line-height: 1.5;
}
.guide-visual img:hover {
  transform: scale(1.25);
  z-index: 10;
  position: relative;
}

.solution-patterns-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  margin-top: 8px;
}

.pattern-card {
  position: relative;
  background: #ffffff;
  border: 1px solid #e0e6ed;
  border-radius: 14px;
  padding: 28px 28px 26px 32px;
  transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.pattern-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 6px;
  border-radius: 14px 0 0 14px;
}
.pattern-card.formula::before {
  background: linear-gradient(180deg, #1976d2 0%, #0d47a1 100%);
}
.pattern-card.pq::before {
  background: linear-gradient(180deg, #43a047 0%, #1b5e20 100%);
}
.pattern-card.formula:hover {
  border-color: #1976d2;
  box-shadow: 0 12px 28px rgba(25, 118, 210, 0.18);
  transform: translateY(-4px);
}
.pattern-card.pq:hover {
  border-color: #43a047;
  box-shadow: 0 12px 28px rgba(67, 160, 71, 0.18);
  transform: translateY(-4px);
}
.pattern-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.72em;
  font-weight: 800;
  margin-bottom: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}
.pattern-card.formula .pattern-badge {
  background: linear-gradient(135deg, #1976d2, #0d47a1);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(25, 118, 210, 0.35);
}
.pattern-card.pq .pattern-badge {
  background: linear-gradient(135deg, #43a047, #2e7d32);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(67, 160, 71, 0.35);
}
.pattern-card.formula .pattern-badge::before {
  content: "📊";
  font-size: 1.1em;
}
.pattern-card.pq .pattern-badge::before {
  content: "🔄";
  font-size: 1.1em;
}
.pattern-card h4 {
  font-size: 1.35em;
  font-weight: 800;
  margin-bottom: 12px;
  line-height: 1.3;
  letter-spacing: 0.01em;
}
.pattern-card.formula h4 { color: #0d47a1; }
.pattern-card.pq h4 { color: #1b5e20; }

.pattern-desc {
  font-size: 0.92em;
  color: #555;
  line-height: 1.75;
  margin-bottom: 18px;
}
.pattern-features {
  list-style: none;
  padding: 0;
  margin: 0;
  border-top: 1px dashed #e0e6ed;
  padding-top: 16px;
}
.pattern-features li {
  font-size: 0.88em;
  color: #333;
  margin-bottom: 10px;
  padding-left: 28px;
  position: relative;
  line-height: 1.6;
  font-weight: 500;
}
.pattern-features li:last-child { margin-bottom: 0; }
.pattern-features li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 0.85em;
  color: #fff;
}
.pattern-card.formula .pattern-features li::before {
  background: #1976d2;
  box-shadow: 0 2px 4px rgba(25, 118, 210, 0.3);
}
.pattern-card.pq .pattern-features li::before {
  background: #43a047;
  box-shadow: 0 2px 4px rgba(67, 160, 71, 0.3);
}

/* シリーズナビ */
.series-nav {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 12px;
  padding: 20px;
  margin: 40px 0;
}
.series-nav ul,
.series-nav ol {
  list-style: none;
  padding: 0;
  margin: 0;
}
.series-nav li {
  margin-bottom: 8px;
  font-size: 0.9rem;
}
.series-nav li.current {
  font-weight: 700;
  color: var(--color-primary);
}
.lv-basic { color: #1e88e5; font-weight: 700; margin-right: 6px; }
.lv-adv { color: #f4511e; font-weight: 700; margin-right: 6px; }

/* ===================================================
   11. Visual Rhythm & Related Curation
   =================================================== */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0;
  height: 4px;
  background: linear-gradient(90deg, #00bcd4, #1e88e5);
  z-index: 500;
  pointer-events: none;
  transition: width 0.1s linear;
}

.article-category-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  border-radius: 12px;
  padding: 11px 14px;
  margin: 10px 0 20px;
  font-weight: 700;
  border: 1px solid transparent;
}
.article-category-banner .category-icon {
  font-size: 1.05rem;
  line-height: 1;
}
.article-category-banner .category-name {
  letter-spacing: 0.02em;
}
.article-category-banner .category-step {
  margin-left: auto;
  font-size: 0.83rem;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
}

.article-category-banner.category-functions {
  background: linear-gradient(135deg, #e8f5e9, #f1f8e9);
  color: #1b5e20;
  border-color: #c8e6c9;
}
.article-category-banner.category-powerquery {
  background: linear-gradient(135deg, #fff3e0, #fff8e1);
  color: #e65100;
  border-color: #ffe0b2;
}
.article-category-banner.category-cobol {
  background: linear-gradient(135deg, #ffebee, #fce4ec);
  color: #b71c1c;
  border-color: #ffcdd2;
}
.article-category-banner.category-qr {
  background: linear-gradient(135deg, #f3e5f5, #ede7f6);
  color: #6a1b9a;
  border-color: #e1bee7;
}
.article-category-banner.category-others {
  background: linear-gradient(135deg, #e3f2fd, #e8eaf6);
  color: #0d47a1;
  border-color: #bbdefb;
}

.reading-time,
.article-difficulty {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #274b67;
  background: #edf4fb;
  border: 1px solid #d5e3f1;
}
.article-difficulty {
  color: #6a1b9a;
  background: #f5ebff;
  border-color: #e3cffc;
}

.section-break {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 28px 0;
  padding: 9px 12px;
  border-radius: 999px;
  background: #eef4fa;
  color: #456;
  border: 1px dashed #c3d7ea;
  font-size: 0.86rem;
  font-weight: 700;
}
.section-break-icon {
  font-size: 0.95rem;
}

.related-articles-section {
  margin-top: 36px;
  border-top: 2px dashed #d1d9e3;
  padding-top: 18px;
}
.related-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 12px;
}
.related-card {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 14px 14px 12px;
  border-radius: 12px;
  text-decoration: none;
  border: 1px solid #d7e1ee;
  background: #f7fbff;
  box-shadow: 0 2px 8px rgba(18, 56, 98, 0.06);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.related-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(18, 56, 98, 0.12);
  border-color: #b4c9e2;
  text-decoration: none;
}
.related-card-label {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  font-size: 0.72rem;
  font-weight: 800;
  color: #39587a;
  background: #e6eef7;
  border-radius: 999px;
  padding: 2px 9px;
}
.related-card-title {
  color: #0f3253;
  font-weight: 800;
  font-size: 0.92rem;
  line-height: 1.45;
}
.related-card-desc {
  color: #4e6278;
  font-size: 0.82rem;
  line-height: 1.55;
}

@media (max-width: 900px) {
  .related-card-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .article-category-banner {
    gap: 8px;
    padding: 10px 12px;
  }
  .article-category-banner .category-step {
    margin-left: 0;
  }
  .related-card-grid {
    grid-template-columns: 1fr;
  }
  .section-break {
    margin: 22px 0;
    font-size: 0.8rem;
  }
}

/* ===================================================
   9. Power Query Custom Components
   =================================================== */
.badge-2016 { background: #5e35b1; }

.xdemo-note,
.tip-box,
.warning-box,
.caution {
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 18px 0;
  line-height: 1.75;
  box-shadow: var(--shadow-sm);
}
.xdemo-note {
  background: #f4f8fc;
  border-left: 5px solid #5c7ea3;
}
.tip-box,
.good {
  background: #ecf8ef;
  border-left: 5px solid #2e7d32;
}
.warning-box,
.caution {
  background: #fff7e8;
  border-left: 5px solid #ef6c00;
}
.warning-box strong,
.tip-box strong,
.xdemo-note strong,
.caution strong {
  display: inline-block;
  margin-bottom: 6px;
}

.method-section-spaced {
  margin-top: 34px;
}

.philosophy-list {
  margin: 14px 0 20px 20px;
  line-height: 1.9;
}

.nav-series,
.nav-link-box,
.next-page-link,
.prev-page-link {
  background: #f7fbff;
  border: 1px solid #d9e6f2;
  border-radius: 12px;
  padding: 14px 16px;
  margin: 18px 0;
}
.nav-link-item,
.mc-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.pq-card-grid,
.sample-grid,
.card-row,
.before-after {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin: 20px 0 24px;
}
.pq-card,
.ba-card,
.mc-header,
.mc-body {
  background: #fff;
  border: 1px solid #dce6f1;
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}
.pq-card-merit {
  border-top: 4px solid #2e7d32;
}
.pq-card-demerit {
  border-top: 4px solid #ef6c00;
}
.ba-header,
.ba-body {
  background: #fff;
  border: 1px solid #dce6f1;
  border-radius: 12px;
  padding: 14px 16px;
}

.pq-flow,
.pq-param-flow {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 10px;
  margin: 18px 0 24px;
}
.pq-flow-step,
.pq-param-step,
.pq-step-box {
  flex: 1 1 180px;
  background: linear-gradient(180deg, #eef5ff 0%, #ffffff 100%);
  border: 1px solid #cfe0f1;
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}
.pq-flow-arrow,
.pq-param-arrow,
.arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  color: var(--color-primary-light);
  font-weight: 700;
}
.step-num,
.proc-title,
.npl-label,
.ds-cat {
  display: inline-block;
  margin-bottom: 8px;
  padding: 3px 10px;
  border-radius: 999px;
  background: #e6eef8;
  color: #234566;
  font-size: 0.75rem;
  font-weight: 800;
}
.step-desc,
.npl-desc,
.ps-desc,
.tl-desc {
  color: var(--color-text-muted);
  font-size: 0.94rem;
}
.task-name,
.npl-title,
.nl-title,
.ps-title,
.tl-year,
.load-name {
  color: var(--color-primary);
  font-weight: 800;
}

.pq-matrix-wrap {
  width: 100%;
  margin: 0 auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.nl-desc,
.mc-tag,
.lv,
.lv-gui,
.lv-m,
.col-func,
.col-pq,
.col-vba,
.ex-title,
.icon-table {
  color: var(--color-text-muted);
}

.pq-proc,
.ui-mock,
.ui-tree,
.ui-body,
.pq-ui-area,
.img-placeholder,
.m-code-block {
  background: #f8fafc;
  border: 1px solid #d8e1eb;
  border-radius: 12px;
  padding: 16px 18px;
  margin: 14px 0 20px;
}
.m-comment {
  color: #6a7f95;
  font-size: 0.88rem;
  margin-top: -8px;
  margin-bottom: 16px;
}
.m-keyword,
.m-func,
.m-string,
.font-bold-700 {
  font-weight: 700;
}
.pq-note-danger {
  background: #ffeff0;
  border-left: 5px solid #c62828;
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 18px 0;
}
.pq-example {
  background: #f9fbff;
  border: 1px dashed #aac4de;
  border-radius: 12px;
  padding: 14px 16px;
  margin: 14px 0;
}
.ui-titlebar {
  margin: -16px -18px 12px;
  padding: 10px 14px;
  background: #dfe9f4;
  color: #234566;
  border-radius: 12px 12px 0 0;
  font-weight: 700;
}

.compare-table,
.pq-compare-table,
.pq-learn-table,
.pq-ver-table,
.pq-matrix-table,
.pq-ds-table,
.pq-load-table,
.pq-type-table,
.pq-area-table,
.diff-table,
.judge-table,
.pq-mini-table {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0 24px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  border-radius: 12px;
}
.compare-table th,
.compare-table td,
.pq-compare-table th,
.pq-compare-table td,
.pq-learn-table th,
.pq-learn-table td,
.pq-ver-table th,
.pq-ver-table td,
.pq-matrix-table th,
.pq-matrix-table td,
.pq-ds-table th,
.pq-ds-table td,
.pq-load-table th,
.pq-load-table td,
.pq-type-table th,
.pq-type-table td,
.pq-area-table th,
.pq-area-table td,
.diff-table th,
.diff-table td,
.judge-table th,
.judge-table td,
.pq-mini-table th,
.pq-mini-table td {
  border: 1px solid #d7e1eb;
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

.pq-matrix-wrap .pq-matrix-table {
  margin: 18px auto 24px;
}

.pq-matrix-table th:first-child,
.pq-matrix-table td:first-child {
  text-align: left;
}

.pq-matrix-table th:nth-child(n + 2),
.pq-matrix-table td:nth-child(n + 2) {
  text-align: center;
  vertical-align: middle;
}

.compare-table th,
.pq-compare-table th,
.pq-learn-table th,
.pq-ver-table th,
.pq-matrix-table th,
.pq-ds-table th,
.pq-load-table th,
.pq-type-table th,
.pq-area-table th,
.diff-table th,
.judge-table th,
.pq-mini-table th {
  background: #edf4fb;
  color: #1f4568;
  font-weight: 800;
}
.null-cell {
  background: #fff3f3;
  color: #b23b3b;
}
.filled-cell {
  background: #edf8ef;
  color: #1b5e20;
  font-weight: 700;
}
.winner,
.judge-yes,
.ver-yes,
.best {
  color: #1b5e20;
  font-weight: 800;
}
.judge-no,
.judge-fallback,
.ver-partial {
  color: #ad5a00;
  font-weight: 700;
}

.timeline {
  display: grid;
  gap: 12px;
  margin: 18px 0 24px;
}
.tl-item {
  background: #fff;
  border-left: 4px solid #64b5f6;
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
}

.pq-before-after {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  margin: 18px 0 24px;
}

.w-20 { width: 20%; }
.w-25 { width: 25%; }
.w-30 { width: 30%; }
.text-left { text-align: left; }
.text-center { text-align: center; }
.indent { padding-left: 1.2em; }
.row-num,
.helper-left {
  width: 56px;
  text-align: center;
  font-weight: 700;
}
.major,
.selected,
.new,
.old,
.folder,
.pdf,
.word,
.excel,
.before,
.after {
  font-weight: 700;
}
.color-2e7d32 {
  color: #2e7d32;
}

/* ===================================================
   10. Shared Article Components
   =================================================== */
.article-lead {
  font-size: 1.04rem;
  line-height: 1.95;
  color: #37474f;
  margin: 0 0 1.6em;
}

.badge-basic {
  background: #1565c0;
}

.badge-classic {
  background: #546e7a;
}

.comparison-section,
.legacy-section {
  margin: 28px 0;
  padding: 22px 24px;
  border-radius: 14px;
}

.comparison-section {
  background: #fbfcfe;
  border: 1px solid #dbe6f0;
}

.legacy-section {
  background: linear-gradient(180deg, #fffaf1 0%, #ffffff 100%);
  border: 1px solid #f0dfbc;
  border-left: 5px solid #d9982f;
}

.comparison-section > h3,
.legacy-section > h3 {
  margin-top: 0;
}

.comparison-section > :last-child,
.legacy-section > :last-child {
  margin-bottom: 0;
}

.comparison-section .table-wrapper:last-child {
  margin-bottom: 0;
}

.section-break-text {
  font-weight: 800;
  color: #1a237e;
  letter-spacing: 0.02em;
}

.speed-note {
  background: #eef6ff;
  border: 1px solid #cfe0f1;
  border-left: 5px solid #1976d2;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin: 18px 0;
  padding: 16px 20px;
  line-height: 1.8;
}

.xdemo-note-tip,
.xdemo-note-speed {
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 18px 0;
  line-height: 1.8;
  box-shadow: var(--shadow-sm);
}

.xdemo-note-tip {
  background: #f4fbf5;
  border-left: 5px solid #2e7d32;
}

.xdemo-note-speed {
  background: #f6f8fc;
  border-left: 5px solid #5c6bc0;
}

.xdemo-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25em 0;
  background: #fff;
  border: 1px solid #dce6f1;
}

.xdemo-table th,
.xdemo-table td {
  padding: 10px 12px;
  border: 1px solid #dce6f1;
  vertical-align: top;
}

.xdemo-table th {
  background: #f5f8fb;
  color: #1a3d5c;
  font-weight: 800;
}

.code-inline {
  display: inline-block;
  padding: 0.14em 0.5em;
  border-radius: 6px;
  background: #f5f7fa;
  border: 1px solid #dce4ec;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.92em;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.bad,
.fc-bad {
  background: #fff3e0;
  color: #9a4f00;
  font-weight: 700;
}

.neutral,
.fc-ok {
  background: #eef4fb;
  color: #315c84;
  font-weight: 700;
}

.fc-good {
  background: #e8f5e9;
  color: #1b5e20;
  font-weight: 700;
}

.fc-danger {
  background: #ffebee;
  color: #b71c1c;
  font-weight: 700;
}

.flow-diagram {
  background: #f8f9fb;
  border: 1px solid #e1e8ed;
  border-radius: 12px;
  padding: 16px 18px;
  margin: 1.25em 0 1.5em;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.flow-box-result {
  flex: 1 1 180px;
  min-width: min(100%, 220px);
  background: #f7fbff;
  border: 1px solid #cfe0f1;
  border-radius: 12px;
  padding: 14px 16px;
  color: #1a3d5c;
  font-weight: 700;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.flow-box-result span {
  font-weight: 400;
}

.xdemo-layout {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 14px;
  margin: 16px 0 22px;
}

.xdemo-block {
  flex: 1 1 220px;
  min-width: 0;
  background: #fff;
  border: 1px solid #dce6f1;
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}

.xdemo-block-title {
  margin: 0 0 12px;
  color: #1a237e;
  font-size: 0.98rem;
  font-weight: 800;
  line-height: 1.5;
}

.xdemo-arrow {
  align-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  color: #90a4ae;
  font-size: 1.4rem;
  font-weight: 800;
}

.speed-rank,
.step-badge,
.rarity-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 800;
  line-height: 1.35;
}

.speed-rank {
  padding: 0.2em 0.72em;
  background: #1976d2;
  color: #fff;
}

.rank-fast {
  background: #2e7d32;
}

.rank-rec {
  background: #1976d2;
}

.step-badge {
  padding: 0.2em 0.68em;
  background: #1a3d5c;
  color: #fff;
  border-radius: 6px;
}

.rarity-badge {
  padding: 0.24em 0.78em;
  background: #fff3e0;
  color: #b26a00;
  border: 1px solid #ffd180;
}

.antipattern-vs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin: 16px 0 20px;
}

.antipattern-box {
  background: #fff;
  border: 1px solid #dce6f1;
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  line-height: 1.8;
}

.antipattern-bad {
  background: #fff8f7;
  border-color: #f3c2bf;
}

.antipattern-good {
  background: #f4fbf5;
  border-color: #c8e6c9;
}

.antipattern-title-bad,
.antipattern-title-good {
  display: inline-flex;
  align-items: center;
  margin-bottom: 10px;
  padding: 0.28em 0.7em;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 800;
}

.antipattern-title-bad {
  background: #ffebee;
  color: #b71c1c;
}

.antipattern-title-good {
  background: #e8f5e9;
  color: #1b5e20;
}

.memory-bar {
  display: flex;
  align-items: stretch;
  overflow: hidden;
  border-radius: 999px;
  background: #eceff1;
  border: 1px solid #d7dfe5;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
  margin: 10px 0;
}

.memory-bar > * {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 8px 10px;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.4;
}

.method-card-title,
.limit-card-title,
.limit-card-good-title {
  margin: 0 0 10px;
  font-size: 0.98rem;
  font-weight: 800;
  line-height: 1.55;
}

.method-card-title {
  display: block;
  padding-left: 12px;
  border-left: 4px solid #5c7ea3;
  color: #1a3d5c;
}

.method-card-title-blue {
  border-left-color: #1976d2;
  color: #0d47a1;
}

.method-card-title-green {
  border-left-color: #2e7d32;
  color: #1b5e20;
}

.method-card-title-orange {
  border-left-color: #ef6c00;
  color: #b24b00;
}

.method-card-title-purple {
  border-left-color: #8e24aa;
  color: #6a1b9a;
}

.method-card-title-red {
  border-left-color: #c62828;
  color: #8e0000;
}

.method-card-title-teal {
  border-left-color: #00838f;
  color: #006064;
}

.limit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin: 16px 0 22px;
}

.limit-card,
.limit-card-good {
  background: #fff;
  border: 1px solid #dce6f1;
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}

.limit-card {
  border-top: 4px solid #ef6c00;
}

.limit-card-good {
  border-top: 4px solid #2e7d32;
}

.limit-card-title {
  color: #b24b00;
}

.limit-card-good-title {
  color: #1b5e20;
}

.circle,
.cross,
.triangle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  line-height: 1;
}

.circle {
  color: #2e7d32;
}

.cross {
  color: #c62828;
}

.triangle {
  color: #ef6c00;
}

.conv-visual {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0 18px;
}

.cv-from {
  display: inline-flex;
  align-items: center;
  padding: 0.45em 0.8em;
  border-radius: 999px;
  background: #f5f8fb;
  border: 1px solid #d7e3ee;
  color: #1a3d5c;
  font-weight: 700;
}

.difficulty {
  display: inline-flex;
  align-items: center;
  gap: 0.12em;
  margin: 8px 0 10px;
  font-size: 0.98rem;
  line-height: 1;
}

.star-on {
  color: #f9a825;
}

.star-off {
  color: #cfd8dc;
}

.pattern-divider {
  border: 0;
  border-top: 1px dashed #c6d4df;
  margin: 24px 0;
}

.pattern-number {
  display: inline-flex;
  align-items: center;
  margin-right: 8px;
  padding: 0.28em 0.72em;
  border-radius: 999px;
  background: #1a237e;
  color: #fff;
  font-size: 0.84rem;
  font-weight: 800;
}

.pattern-tag {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 0.24em 0.62em;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.35;
  white-space: nowrap;
}

.tag-advanced {
  background: #fff3e0;
  color: #b45309;
}

.tag-evidence {
  background: #e0f2f1;
  color: #00695c;
}

.tag-excel {
  background: #e8f5e9;
  color: #1b5e20;
}

.tag-expert {
  background: #ffebee;
  color: #b71c1c;
}

.tag-print {
  background: #ede7f6;
  color: #5e35b1;
}

.tag-system {
  background: #e3f2fd;
  color: #0d47a1;
}

.maker-card,
.timeline-box {
  background: #fff;
  border: 1px solid #dce6f1;
  border-radius: 12px;
  padding: 16px 18px;
  margin: 16px 0;
  box-shadow: var(--shadow-sm);
}

.maker-card > :last-child,
.timeline-box > :last-child {
  margin-bottom: 0;
}

.maker-name {
  display: inline-flex;
  align-items: center;
  margin-bottom: 10px;
  padding: 0.24em 0.68em;
  border-radius: 999px;
  background: #edf4fb;
  color: #1a3d5c;
  font-size: 0.78rem;
  font-weight: 800;
}

.timeline-item {
  background: #fff;
  border-left: 4px solid #64b5f6;
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
}

.timeline-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: max-content;
  margin: 10px 0;
}

.tl-label {
  flex: 0 0 78px;
  font-weight: 800;
  color: #455a64;
}

.tl-bar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.2;
  color: #fff;
}

.tl-gap {
  flex: 0 0 14px;
}

.tl-send {
  background: #1976d2;
}

.tl-proc {
  background: #2e7d32;
}

.tl-lost {
  background: #d32f2f;
}

.tl-wait {
  background: #ffb300;
  color: #5d4037;
}

.tl-time {
  margin-bottom: 4px;
  color: #1a237e;
  font-size: 0.84rem;
  font-weight: 800;
}

@media (max-width: 768px) {
  .comparison-section,
  .legacy-section,
  .maker-card,
  .timeline-box {
    padding: 18px 16px;
  }
  .flow-diagram {
    padding: 14px 16px;
  }
  .flow-diagram .flow-arrow,
  .xdemo-arrow {
    width: 100%;
    min-height: 20px;
    transform: rotate(90deg);
  }
  .antipattern-vs,
  .limit-grid {
    grid-template-columns: 1fr;
  }
  .pattern-tag {
    margin-top: 6px;
    margin-left: 0;
  }
  .timeline-row {
    gap: 4px;
  }
  .tl-label {
    flex-basis: 70px;
  }
  .pq-before-after {
    grid-template-columns: 1fr;
  }
  .pq-flow-arrow,
  .pq-param-arrow,
  .arrow {
    min-height: 20px;
    transform: rotate(90deg);
  }
}

/* ===================================================
   Publication polish: keep article text intact, improve readability.
   =================================================== */
.article-layout {
  width: min(100%, 1080px);
}

.article-body {
  overflow: hidden;
}

.article-body > * {
  max-width: 100%;
}

.article-body p,
.article-body li {
  text-wrap: pretty;
}

.article-body h2,
.article-body h3,
.article-body h4 {
  scroll-margin-top: calc(var(--header-height) + var(--tab-nav-height) + 20px);
}

.article-body h3.attack-title,
.article-body h3.pq-step-title,
.article-body .technique-card > h3 {
  padding: 8px 0 8px 14px;
  border-left: 4px solid #42a5f5;
  border-bottom: 1px solid #d7e7f7;
  color: #0d5d86;
}

.article-body .method-section,
.article-body .tips-section,
.article-body .goal-section,
.article-body .appendix-section,
.article-body .comparison-section,
.article-body .legacy-section,
.article-body .technique-card,
.article-body .content-card {
  max-width: 100%;
}

.article-body .technique-card {
  background: #fff;
  border: 1px solid #dfe8f2;
  border-radius: 14px;
  padding: 18px 22px;
  margin: 22px 0;
  box-shadow: 0 8px 22px rgba(26, 61, 92, 0.07);
}

.article-body .code-label,
.article-body .code-label-good,
.article-body p.code-label,
.article-body p.code-label-good {
  display: table;
  width: fit-content;
  max-width: 100%;
  margin: 18px 0 0;
  padding: 7px 14px;
  border-radius: 8px 8px 0 0;
  line-height: 1.4;
}

.article-body .code-label + .code-label,
.article-body .code-label + .code-label-good,
.article-body .code-label-good + .code-label,
.article-body .code-label-good + .code-label-good {
  margin-top: 10px;
}

.article-body .code-block,
.article-body .code-readonly,
.article-body .formula-box,
.article-body .code-block-large {
  max-width: 100%;
  border-radius: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-color: rgba(255,255,255,0.38) rgba(255,255,255,0.08);
  scrollbar-width: thin;
}

.article-body .code-block,
.article-body .code-readonly {
  padding: 20px 96px 20px 22px;
  word-break: normal;
  overflow-wrap: anywhere;
}

.article-body .code-block-large {
  display: block;
  background: #263238;
  color: #f5f7fa;
  padding: 18px 22px;
  margin: 16px 0 24px;
  font-family: Consolas, Monaco, "Courier New", monospace;
  font-size: 0.93rem;
  line-height: 1.7;
  box-shadow: inset 0 2px 5px rgba(0,0,0,0.2);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.article-body .code-block .code-line,
.article-body .code-readonly .code-line,
.article-body .code-block-large .code-line {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: normal;
}

.article-body .code-block .copy-btn,
.article-body .code-readonly .copy-btn,
.article-body .formula-box .copy-btn {
  top: 14px;
  right: 14px;
  min-width: 62px;
  text-align: center;
  backdrop-filter: blur(4px);
}

.article-body .formula-box {
  padding: 22px 96px 18px 20px;
}

.article-body .formula-box code {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: normal;
}

.article-body table {
  width: 100%;
  max-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 22px 0 30px;
  background: #fff;
  border: 1px solid #d8e3ef;
  border-radius: 14px;
  box-shadow: 0 10px 24px rgba(26, 61, 92, 0.07);
  overflow: hidden;
  font-size: 0.95rem;
}

.article-body table th,
.article-body table td {
  padding: 13px 16px;
  border: 0;
  border-right: 1px solid #e6edf5;
  border-bottom: 1px solid #e6edf5;
  line-height: 1.75;
  vertical-align: middle;
  text-align: left;
  overflow-wrap: anywhere;
  word-break: normal;
}

.article-body table th:last-child,
.article-body table td:last-child {
  border-right: 0;
}

.article-body table tr:last-child > th,
.article-body table tr:last-child > td {
  border-bottom: 0;
}

.article-body table th,
.article-body table thead td,
.article-body table tr:first-child > th {
  background: linear-gradient(180deg, #f4f8fc 0%, #eaf2fa 100%);
  color: #173d5f;
  font-weight: 800;
}

.article-body table tr:nth-child(even) td {
  background-color: #f8fbff;
}

.article-body table tr:hover td {
  background-color: #eef7ff;
}

.article-body table .text-center,
.article-body table .xd-row,
.article-body table .xd-hit,
.article-body table .xd-col,
.article-body table .ok,
.article-body table .ng {
  text-align: center;
}

.article-body .format-table,
.article-body .xdemo-table,
.article-body .ref-table,
.article-body .char-table,
.article-body .charmap-table,
.article-body .ba-table,
.article-body .excel-grid,
.article-body .formula-count-table,
.article-body .comparison-table,
.article-body .arg-table,
.article-body .sample-grid,
.article-body .vba-compare-table,
.article-body .mini-procon,
.article-body .form-tbl,
.article-body .vs-table,
.article-body .cmp-table,
.article-body .pattern-table,
.article-body .byte-table,
.article-body .layout-table,
.article-body .sample-table,
.article-body .func-table,
.article-body .demo-table {
  border-collapse: separate;
  border-spacing: 0;
}

.article-body .xdemo-table .xd-data,
.article-body .xdemo-table .xd-result,
.article-body .xdemo-table .xd-formula {
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.92rem;
}

.article-body .xdemo-table .xd-hit {
  background: #e8f5e9;
  color: #1b5e20;
  font-weight: 800;
}

.article-body .xdemo-table .xd-result {
  background: #f2f8ff;
}

.article-body .xdemo-note-good,
.article-body .xdemo-note-warn,
.article-body .xdemo-note-danger,
.article-body .xdemo-note-info,
.article-body .xdemo-note,
.article-body .speed-note {
  box-shadow: 0 8px 20px rgba(26, 61, 92, 0.06);
}

@media (max-width: 900px) {
  .article-layout {
    padding-left: 16px;
    padding-right: 16px;
  }

  .article-body {
    padding: 28px 24px;
  }
}

@media (max-width: 640px) {
  .article-layout {
    padding: 18px 10px 44px;
  }

  .article-body {
    padding: 22px 16px;
    border-radius: 12px;
  }

  .article-body .code-block,
  .article-body .code-readonly,
  .article-body .formula-box {
    padding: 54px 14px 16px;
    font-size: 0.86rem;
  }

  .article-body .code-block-large {
    padding: 16px 14px;
    font-size: 0.86rem;
  }

  .article-body .code-block .copy-btn,
  .article-body .code-readonly .copy-btn,
  .article-body .formula-box .copy-btn {
    top: 12px;
    right: 12px;
  }

  .article-body table {
    display: block;
    overflow-x: auto;
    border-radius: 12px;
    font-size: 0.88rem;
    -webkit-overflow-scrolling: touch;
  }

  .article-body table th,
  .article-body table td {
    min-width: 120px;
    padding: 11px 12px;
  }
}


/* ===================================================
   Excel Demo Table（Excel風テーブルによる視覚説明）
   =================================================== */
.excel-demo-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 20px 0;
  border: 1px solid #c8d8e8;
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(26,61,92,0.08);
  scrollbar-color: rgba(100,150,200,0.35) rgba(0,0,0,0.06);
  scrollbar-width: thin;
}

.excel-demo-title {
  margin: 0;
  padding: 10px 16px;
  background: linear-gradient(135deg, #1a3d5c 0%, #2a5a80 100%);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 800;
  border-radius: 9px 9px 0 0;
  letter-spacing: 0.02em;
}

.excel-demo-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  color: #1a3d5c;
  font-size: 0.88rem;
  line-height: 1.65;
  margin: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

.excel-demo-table th,
.excel-demo-table td {
  padding: 10px 14px;
  border: 1px solid #d8e3ef;
  vertical-align: middle;
  text-align: left;
  min-width: auto;
}

.excel-demo-table th {
  background: linear-gradient(180deg, #e8f0f8 0%, #dce8f4 100%) !important;
  color: #1a3d5c !important;
  font-weight: 800;
  font-size: 0.84rem;
  text-align: center;
}

.excel-demo-table .excel-corner {
  width: 40px;
  min-width: 40px;
  background: #e0eaf4 !important;
  border-right: 2px solid #b0c8dc;
}

.excel-demo-table .excel-col {
  text-align: center;
  color: #1a3d5c !important;
  font-weight: 800;
}

.excel-demo-table .excel-row {
  background: #edf3fa;
  color: #5c7ea3;
  text-align: center;
  font-weight: 700;
  font-size: 0.84rem;
  width: 40px;
  min-width: 40px;
  border-right: 2px solid #b0c8dc;
}

.excel-demo-table .excel-head {
  background: #f0f5fb;
  color: #1a3d5c;
  font-weight: 700;
  font-size: 0.86rem;
}

.excel-demo-table .excel-line1 {
  background: #f0faf0;
  color: #1b5e20;
  border-left: 4px solid #4caf50;
  font-weight: 500;
}

.excel-demo-table .excel-line2 {
  background: #fff8f0;
  color: #bf360c;
  border-left: 4px solid #ff9800;
  font-weight: 500;
}

.excel-demo-table .excel-formula {
  background: #f5f8ff;
  color: #0d47a1;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.84rem;
  line-height: 1.7;
}

.excel-demo-table .excel-formula-result {
  display: block;
  margin-top: 5px;
  padding-top: 5px;
  border-top: 1px dashed #b0c4d8;
  color: #1565c0;
  font-size: 0.78rem;
  font-weight: 700;
}

.excel-demo-table .excel-result {
  background: #e8f5e9;
  color: #1b5e20;
  font-weight: 800;
  text-align: center;
}

.excel-demo-table .excel-spill {
  background: #e3f2fd;
  border: 1px dashed #1976d2;
  color: #0d47a1;
}

.excel-demo-table .excel-empty {
  background: #f9fafb;
  color: #b0bec5;
  text-align: center;
  font-style: italic;
}

.excel-flow-arrow {
  text-align: center;
  padding: 16px 0;
  color: #1a3d5c;
  font-size: 1.08rem;
  font-weight: 800;
  line-height: 1.5;
}

.excel-demo-note {
  border-radius: 10px;
  padding: 16px 20px;
  margin: 16px 0;
  background: linear-gradient(135deg, #f0f6ff 0%, #e8f0fb 100%);
  border-left: 5px solid #1976d2;
  color: #1a3d5c;
  font-size: 0.93rem;
  line-height: 1.8;
  box-shadow: 0 2px 8px rgba(26,61,92,0.06);
}

.excel-demo-note strong {
  color: #0d47a1;
}

.excel-demo-note code {
  background: rgba(25,118,210,0.1);
  color: #1565c0;
  padding: 0.18em 0.5em;
  border-radius: 4px;
  font-size: 0.88em;
}

@media (max-width: 640px) {
  .excel-demo-table th,
  .excel-demo-table td {
    padding: 8px 10px;
    font-size: 0.82rem;
    min-width: 100px;
  }
  .excel-demo-table .excel-corner,
  .excel-demo-table .excel-row {
    min-width: 32px;
    width: 32px;
  }
  .excel-demo-title {
    font-size: 0.84rem;
  }
}

/* ===================================================
   Mobile viewport hardening
   =================================================== */
@media (max-width: 640px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .site-header,
  .main-content,
  .article-layout,
  .article-body,
  .site-footer {
    width: 100%;
    max-width: 100%;
  }

  .main-content {
    padding-left: 10px;
    padding-right: 10px;
  }

  .article-layout {
    padding: 14px 8px 40px;
    overflow-x: hidden;
  }

  .article-body {
    padding: 18px 12px;
    overflow-wrap: anywhere;
    word-break: normal;
  }

  .article-body > * {
    max-width: 100%;
  }

  .header-inner {
    padding-left: 14px;
    padding-right: 14px;
  }

  .site-title {
    font-size: clamp(1.18rem, 8vw, 1.7rem);
    line-height: 1.2;
    white-space: normal;
  }

  .site-subtitle {
    white-space: normal;
    line-height: 1.45;
  }

  .breadcrumb {
    font-size: 0.92rem;
    padding-bottom: 14px;
  }

  .article-title {
    font-size: 1.28rem;
  }

  .method-section > h1,
  .category-header h2 {
    font-size: 1.48rem;
    line-height: 1.35;
    overflow-wrap: break-word;
    word-break: normal;
  }

  .method-section > h2 {
    line-height: 1.4;
    overflow-wrap: break-word;
    word-break: normal;
  }

  .article-body p,
  .article-body li {
    font-size: 0.95rem;
    line-height: 1.85;
  }

  .goal-section,
  .method-section,
  .tips-section,
  .cobol-selection-guide,
  .xdemo-note-good,
  .xdemo-note-warn,
  .xdemo-note-danger,
  .xdemo-note-info,
  .xdemo-note,
  .speed-note,
  .qr-safety-note,
  .site-footer-trust {
    padding: 16px 14px;
    margin-left: 0;
    margin-right: 0;
  }

  .guide-intro,
  .solution-patterns-grid,
  .pipeline-grid,
  .usecase-grid,
  .compare-grid,
  .related-card-grid,
  .limit-grid,
  .pq-before-after {
    grid-template-columns: 1fr !important;
    gap: 18px;
  }

  .pattern-card,
  .pipeline-card,
  .usecase-card,
  .compare-card,
  .related-card {
    width: 100%;
    min-width: 0;
  }

  .pattern-card {
    padding: 22px 18px 20px 24px;
  }

  .pattern-card h4,
  .pattern-desc,
  .pattern-features li {
    white-space: normal;
    overflow-wrap: break-word;
    word-break: normal;
  }

  .pattern-badge {
    max-width: 100%;
    white-space: normal;
  }

  .table-wrapper,
  .table-responsive,
  .excel-demo-wrap,
  .excel-wrap,
  .a4-paper,
  .a4-grid,
  .helper-display-table,
  .formula-copy-list {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .table-wrapper,
  .table-responsive,
  .excel-demo-wrap,
  .excel-wrap {
    overflow-x: visible;
  }

  .article-body table,
  .article-body .format-table,
  .article-body .xdemo-table,
  .article-body .ref-table,
  .article-body .char-table,
  .article-body .charmap-table,
  .article-body .ba-table,
  .article-body .excel-grid,
  .article-body .formula-count-table,
  .article-body .comparison-table,
  .article-body .arg-table,
  .article-body .sample-grid,
  .article-body .vba-compare-table,
  .article-body .mini-procon,
  .article-body .form-tbl,
  .article-body .vs-table,
  .article-body .cmp-table,
  .article-body .pattern-table,
  .article-body .byte-table,
  .article-body .layout-table,
  .article-body .sample-table,
  .article-body .func-table,
  .article-body .demo-table,
  .article-body .excel-demo-table,
  .article-body .helper-display-table,
  .article-body .compare-table,
  .article-body .pq-compare-table,
  .article-body .pq-learn-table,
  .article-body .pq-ver-table,
  .article-body .pq-matrix-table,
  .article-body .pq-ds-table,
  .article-body .pq-load-table,
  .article-body .pq-type-table,
  .article-body .pq-area-table,
  .article-body .diff-table,
  .article-body .judge-table,
  .article-body .pq-mini-table {
    display: table;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    table-layout: fixed;
    overflow: visible;
    font-size: 0.78rem;
  }

  .article-body table th,
  .article-body table td,
  .article-body .excel-demo-table th,
  .article-body .excel-demo-table td,
  .article-body .helper-display-table th,
  .article-body .helper-display-table td {
    min-width: 0 !important;
    max-width: none !important;
    width: auto !important;
    padding: 7px 6px;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.55;
  }

  .article-body .format-table {
    display: block !important;
    width: 100% !important;
    table-layout: auto !important;
    border: 0;
    box-shadow: none;
    background: transparent;
  }

  .article-body .format-table tbody,
  .article-body .format-table thead,
  .article-body .format-table tr,
  .article-body .format-table th,
  .article-body .format-table td {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  .article-body .format-table tr {
    margin: 0 0 12px;
    border: 1px solid #d8e3ef;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 6px 18px rgba(26, 61, 92, 0.06);
  }

  .article-body .format-table th,
  .article-body .format-table td {
    border-right: 0;
    padding: 10px 12px;
  }

  .article-body .format-table th:not(:last-child),
  .article-body .format-table td:not(:last-child) {
    border-bottom: 1px solid #e6edf5;
  }

  .article-body [style*="display:flex"],
  .article-body [style*="display: flex"] {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  .article-body [style*="display:flex"] > *,
  .article-body [style*="display: flex"] > * {
    width: 100% !important;
    flex: 1 1 auto !important;
  }

  .article-body .excel-row-num,
  .article-body .excel-demo-table .excel-row,
  .article-body .excel-demo-table .excel-corner,
  .article-body table .xd-row {
    width: 2.4rem !important;
    min-width: 2.4rem !important;
    max-width: 2.4rem !important;
  }

  .article-body .excel-col-letter,
  .article-body .excel-line1,
  .article-body .excel-empty {
    width: 5.2rem !important;
  }

  .article-body .excel-data-cell,
  .article-body .excel-formula,
  .article-body .xd-formula,
  .article-body .xd-data,
  .article-body .xd-result {
    font-size: 0.76rem;
    line-height: 1.6;
  }

  .article-body .code-block,
  .article-body .code-readonly,
  .article-body .formula-box {
    max-width: 100%;
    overflow-x: hidden;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  .article-body .code-block .code-line,
  .article-body .code-readonly .code-line,
  .article-body .code-block span,
  .article-body .code-readonly span,
  .article-body .code-block-large,
  .article-body .code-block-large span,
  .article-body .formula-box code {
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  .article-body .code-block-large,
  .article-body .code-block-large span {
    white-space: normal !important;
    word-break: break-all;
    overflow-wrap: anywhere;
    line-break: anywhere;
  }

  .formula-copy-code {
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  .tag-impact,
  .tag-rare,
  .tag-prereq,
  .qr-badge,
  .cobol-badge,
  .sym,
  .ind,
  .site-footer-links a {
    white-space: normal;
  }

  .category-hero.hero-overlay.copy-center .hero-copy,
  body > section.main-content .hero-contact .hero-copy {
    left: 50% !important;
    right: auto !important;
    transform: translate(-50%, -50%) !important;
    max-width: 88% !important;
    text-align: center;
  }

  .pq-flow,
  .pq-param-flow {
    flex-direction: column;
    align-items: stretch;
  }

  .pq-flow-arrow,
  .pq-param-arrow,
  .arrow {
    width: 100%;
    min-width: 0;
    min-height: 20px;
    transform: rotate(90deg);
  }

  .ribbon-mock {
    flex-wrap: wrap;
    gap: 4px 6px;
    overflow-x: hidden;
    padding: 8px 8px 0;
  }

  .ribbon-tab {
    flex: 1 1 calc(33.333% - 6px);
    min-width: 0;
    padding: 6px 4px 8px;
    text-align: center;
    white-space: normal;
    font-size: 0.72rem;
  }

  .timeline-box {
    overflow: hidden;
  }

  .timeline-row {
    flex-wrap: wrap;
    align-items: flex-start;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    gap: 4px;
  }

  .tl-label {
    flex: 0 0 100%;
    margin-bottom: 2px;
  }

  .timeline-row .tl-bar {
    flex: 1 1 2.15rem;
    width: auto !important;
    min-width: 0;
    min-height: 28px;
    padding: 0 5px;
    font-size: 0.7rem;
  }

  .timeline-row .tl-gap {
    flex: 0 0 4px;
    width: 4px;
    min-width: 0;
  }
}

@media (max-width: 390px) {
  .main-content {
    padding-left: 8px;
    padding-right: 8px;
  }

  .article-body {
    padding: 16px 10px;
  }

  .article-body table,
  .article-body .excel-demo-table,
  .article-body .helper-display-table {
    font-size: 0.72rem;
  }

  .article-body table th,
  .article-body table td {
    padding: 6px 5px;
  }
}

/* ===================================================
   Mobile article readability improvement
   スマホ記事可読性改善
   =================================================== */
@media (max-width: 600px) {
  .article-layout {
    padding: 12px 0 40px;
  }

  .article-body {
    border-radius: 0;
    box-shadow: none;
    padding: 22px 18px;
    line-height: 1.95;
  }

  .article-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
  }

  .article-title {
    font-size: 1.32rem;
    line-height: 1.55;
    letter-spacing: 0.01em;
  }

  .article-meta {
    font-size: 0.8rem;
    gap: 6px;
  }

  .article-date {
    margin-left: 0;
  }

  .article-body h2 {
    font-size: 1.16rem;
    line-height: 1.55;
    margin: 34px 0 14px;
    padding: 4px 0 4px 12px;
  }

  .article-body h3 {
    font-size: 1.05rem;
    line-height: 1.6;
    margin: 26px 0 10px;
  }

  .article-body p,
  .article-body li {
    font-size: 1rem;
    line-height: 1.95;
  }

  .article-body ul,
  .article-body ol {
    padding-left: 1.3em;
  }

  .article-body li {
    margin-bottom: 0.45em;
  }

  .goal-section,
  .method-section,
  .tips-section,
  .toc-box,
  .xdemo-note-good,
  .xdemo-note-warn,
  .xdemo-note-danger,
  .xdemo-note-info,
  .xdemo-note,
  .speed-note,
  .qr-safety-note {
    padding: 17px 16px;
    margin: 18px 0 24px;
    border-radius: 10px;
  }

  .goal-section h2,
  .method-section h2,
  .toc-box h3 {
    font-size: 1.05rem;
    line-height: 1.55;
  }

  .toc-box ol {
    padding-left: 1.25em;
    line-height: 1.8;
  }

  .toc-box ol li {
    font-size: 0.92rem;
    margin-bottom: 0.35em;
  }

  .article-body .code-block,
  .article-body .code-readonly,
  .article-body .formula-box,
  .article-body .code-block-large,
  .article-body .m-code-block {
    max-width: 100%;
    overflow-x: auto !important;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    font-size: 0.84rem;
    line-height: 1.6;
    padding: 14px 14px;
    white-space: pre !important;
    word-break: normal !important;
    overflow-wrap: normal !important;
  }

  .article-body .code-block,
  .article-body .code-readonly,
  .article-body .formula-box code,
  .article-body .formula-copy-code,
  .article-body .code-block .code-line,
  .article-body .code-readonly .code-line,
  .article-body .code-block span,
  .article-body .code-readonly span,
  .article-body .code-block-large span,
  .article-body .m-code-block span {
    white-space: pre !important;
    word-break: normal !important;
    overflow-wrap: normal !important;
    line-break: auto !important;
  }

  .article-body .code-block .code-line,
  .article-body .code-readonly .code-line {
    display: block;
    width: max-content;
    min-width: 100%;
  }

  .formula-copy-list {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .formula-copy-row {
    grid-template-columns: 1fr;
  }

  .formula-copy-label {
    border-right: none;
    border-bottom: 1px solid #cfd8dc;
  }

  .formula-copy-code {
    display: block;
    overflow-x: auto;
  }

  .formula-copy-btn {
    border-left: none;
    border-top: 1px solid #cfd8dc;
    padding: 10px;
  }

  .table-wrapper,
  .table-responsive,
  .excel-demo-wrap,
  .excel-wrap {
    margin: 14px 0 22px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
  }

  .table-wrapper::before,
  .table-responsive::before,
  .excel-demo-wrap::before,
  .excel-wrap::before {
    content: "横にスクロールできます →";
    display: block;
    padding: 6px 10px;
    font-size: 0.75rem;
    line-height: 1.4;
    color: #666;
    background: #f8f9fa;
    border-bottom: 1px solid var(--color-border);
  }

  .table-wrapper > table,
  .table-responsive > table,
  .excel-demo-wrap > table,
  .excel-wrap > table {
    width: max-content !important;
    min-width: max(560px, 100%) !important;
    table-layout: auto !important;
    margin: 0;
  }

  .article-body table {
    font-size: 0.84rem;
  }

  .article-body table th,
  .article-body table td {
    padding: 9px 10px;
  }

  .article-body .format-table {
    font-size: 0.9rem;
  }

  .article-body .table-wrapper > table,
  .article-body .table-responsive > table,
  .article-body .excel-demo-wrap > table,
  .article-body .excel-wrap > table {
    display: table !important;
    width: max-content !important;
    min-width: max(560px, 100%) !important;
    table-layout: auto !important;
  }
}

/* ===================================================
   Mobile formula readability fix
   =================================================== */
@media (max-width: 600px) {
  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }

  .article-body,
  .article-body *,
  .main-content,
  .article-layout {
    max-width: 100%;
    min-width: 0;
  }

  .article-body .formula-box,
  .article-body .code-block,
  .article-body .code-readonly,
  .formula-copy-list,
  .formula-copy-row,
  .formula-copy-code {
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  .article-body .formula-box,
  .article-body .code-block,
  .article-body .code-readonly {
    padding: 14px;
    margin: 16px 0 22px;
    overflow-x: visible !important;
    overflow-y: visible;
    white-space: pre-wrap !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
    border-radius: 8px;
    font-size: 0.84rem;
    line-height: 1.7;
  }

  .article-body .formula-box code,
  .article-body .formula-copy-code,
  .article-body .code-block code,
  .article-body .code-readonly code,
  .article-body .code-block .code-line,
  .article-body .code-readonly .code-line,
  .article-body .code-block span,
  .article-body .code-readonly span,
  .article-body code {
    white-space: pre-wrap !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
    line-break: anywhere !important;
  }

  .article-body .formula-box code,
  .article-body .code-block code,
  .article-body .code-readonly code {
    display: block;
    width: 100%;
    font-size: 0.84rem;
    line-height: 1.7;
  }

  .article-body .code-block .code-line,
  .article-body .code-readonly .code-line {
    display: block;
    width: auto !important;
    min-width: 0 !important;
  }

  .article-body .formula-box .copy-btn,
  .article-body .code-block .copy-btn,
  .article-body .code-readonly .copy-btn {
    position: static !important;
    display: block;
    width: fit-content;
    max-width: 100%;
    margin: 0 0 10px auto;
    padding: 5px 12px;
    font-size: 0.75rem;
    line-height: 1.3;
  }

  .formula-copy-list {
    overflow-x: visible;
  }

  .formula-copy-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .formula-copy-label {
    border-right: none;
    border-bottom: 1px solid #cfd8dc;
    padding: 9px 11px;
    font-size: 0.8rem;
  }

  .formula-copy-code {
    display: block;
    padding: 12px;
    overflow-x: visible;
    font-size: 0.82rem;
    line-height: 1.7;
  }

  .formula-copy-btn {
    border-left: none;
    border-top: 1px solid #cfd8dc;
    padding: 10px;
    font-size: 0.82rem;
  }

  .article-body p code,
  .article-body li code {
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
    font-size: 0.88em;
  }

  .article-body .code-block.code-scroll,
  .article-body .code-readonly.code-scroll,
  .article-body .code-block-large,
  .article-body .m-code-block {
    overflow-x: auto !important;
    overflow-y: hidden;
    white-space: pre !important;
    overflow-wrap: normal !important;
    word-break: normal !important;
    -webkit-overflow-scrolling: touch;
  }

  .article-body .code-block.code-scroll code,
  .article-body .code-readonly.code-scroll code,
  .article-body .code-block.code-scroll .code-line,
  .article-body .code-readonly.code-scroll .code-line,
  .article-body .code-block.code-scroll span,
  .article-body .code-readonly.code-scroll span,
  .article-body .code-block-large code,
  .article-body .code-block-large .code-line,
  .article-body .code-block-large span,
  .article-body .m-code-block code,
  .article-body .m-code-block .code-line,
  .article-body .m-code-block span {
    width: max-content !important;
    min-width: 100% !important;
    white-space: pre !important;
    overflow-wrap: normal !important;
    word-break: normal !important;
    line-break: auto !important;
  }
}
