/**
 * 相場・統計データのレガシー表（table.htmd / table.datbl）
 * 元 style.css 内の長いブロックを分離。動作は同じです。
 * 今後: HTML に修飾クラス（sangyo-stat-tbl--2head 等）を付け、:has(bgcolor) 判定を廃止していく方針。
 */
:root {
  --sangyo-stat-header-grad: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  --sangyo-stat-header-fg: #f8fafc;
  --sangyo-stat-accent: #e11d48;
}


/*
 * 世界粗鋼生産 table.htmd（HTML そのまま）— soko_seisan_w_y.php（年次）・soko_seisan_w.php（月次ほか）。
 * trade_korea 系に近い見た目。datbl 同様、.headline5 / .entry-content / .content-wrapper 直下の table.htmd にも適用（page-template 必須にしない）。
 */
/* 横スクロールはレガシー表（htmd / datbl）専用。全 headline5 に overflow を付けない
 *（soko-seisan 系は .soko-seisan-table-wrap 内で処理し、最下部の二重バーを防ぐ） */
.headline5:has(table.htmd),
.headline5:has(table.datbl:not(.soko-seisan-table)) {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* 記事本文：soko ラッパ外の headline5 のみ保険（従来の .entry-content .headline5 相当） */
.entry-content .headline5:not(:has(.soko-seisan-table-wrap)) {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.htmd:not(:is(:has(> tr:first-child td[bgcolor="#D0FF42" i]), :has(tbody > tr:first-child td[bgcolor="#D0FF42" i]))) {
  width: 100%;
  min-width: max(100%, max-content);
  border-collapse: collapse;
  font-size: var(--fs-xs);
  color: var(--dp-text-main);
  background: #fff;
  border: 1px solid var(--dp-border);
  box-shadow: var(--dp-shadow);
  margin-bottom: 0.5rem;
}

:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.htmd:not(:is(:has(> tr:first-child td[bgcolor="#D0FF42" i]), :has(tbody > tr:first-child td[bgcolor="#D0FF42" i]))) td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--dp-border);
  vertical-align: middle;
}

:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.htmd:not(:is(:has(> tr:first-child td[bgcolor="#D0FF42" i]), :has(tbody > tr:first-child td[bgcolor="#D0FF42" i]))) td + td {
  border-left: 1px solid #e2e8f0;
}

/* 1 行目＝列ヘッダ（従来の黄背景を上書き） */
:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.htmd:not(:is(:has(> tr:first-child td[bgcolor="#D0FF42" i]), :has(tbody > tr:first-child td[bgcolor="#D0FF42" i]))) tr:first-child td {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--sangyo-stat-header-grad) !important;
  color: #f8fafc !important;
  font-weight: 700;
  text-align: center !important;
  border-bottom: 3px solid #e11d48;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.15);
  white-space: nowrap;
}

:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.htmd:not(:is(:has(> tr:first-child td[bgcolor="#D0FF42" i]), :has(tbody > tr:first-child td[bgcolor="#D0FF42" i]))) tr:first-child td:first-child {
  z-index: 4;
  text-align: center !important;
}

/* 左端ラベル列：横スクロール時に固定（国名は 1 行・折り返しなし） */
:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.htmd:not(:is(:has(> tr:first-child td[bgcolor="#D0FF42" i]), :has(tbody > tr:first-child td[bgcolor="#D0FF42" i]))) tr:not(:first-child) td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  text-align: left !important;
  font-weight: 600;
  white-space: nowrap;
  background: #f1f5f9 !important;
  box-shadow: 2px 0 6px rgba(15, 23, 42, 0.08);
  border-right: 1px solid var(--dp-border);
}

/* 中間行（ヘッダ・最終行以外） */
:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.htmd:not(:is(:has(> tr:first-child td[bgcolor="#D0FF42" i]), :has(tbody > tr:first-child td[bgcolor="#D0FF42" i]))) tr:not(:first-child):not(:last-child) td {
  background: #fff !important;
}

:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.htmd:not(:is(:has(> tr:first-child td[bgcolor="#D0FF42" i]), :has(tbody > tr:first-child td[bgcolor="#D0FF42" i]))) tr:not(:first-child):not(:last-child):nth-child(even) td {
  background: #f8fafc !important;
}

:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.htmd:not(:is(:has(> tr:first-child td[bgcolor="#D0FF42" i]), :has(tbody > tr:first-child td[bgcolor="#D0FF42" i]))) tr:not(:first-child):not(:last-child):nth-child(even) td:first-child {
  background: #e2e8f0 !important;
}

:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.htmd:not(:is(:has(> tr:first-child td[bgcolor="#D0FF42" i]), :has(tbody > tr:first-child td[bgcolor="#D0FF42" i]))) tr:not(:first-child):not(:last-child) td:not(:first-child) {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
}

/* ホバー（ヘッダ・合計行以外） */
:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.htmd:not(:is(:has(> tr:first-child td[bgcolor="#D0FF42" i]), :has(tbody > tr:first-child td[bgcolor="#D0FF42" i]))) tr:not(:first-child):not(:last-child):hover td {
  background: rgba(254, 226, 226, 0.75) !important;
}

:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.htmd:not(:is(:has(> tr:first-child td[bgcolor="#D0FF42" i]), :has(tbody > tr:first-child td[bgcolor="#D0FF42" i]))) tr:not(:first-child):not(:last-child):hover td:first-child {
  background: rgba(251, 113, 133, 0.35) !important;
}

/* 最終行＝合計行など（1 行だけの表ではヘッダと二重にならないよう :not(:first-child)） */
:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.htmd:not(:is(:has(> tr:first-child td[bgcolor="#D0FF42" i]), :has(tbody > tr:first-child td[bgcolor="#D0FF42" i]))) tr:last-child:not(:first-child) td {
  background: #fef9c3 !important;
  color: var(--dp-text-main) !important;
  font-weight: 700;
  border-top: 2px solid #ca8a04;
  border-bottom: none;
}

:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.htmd:not(:is(:has(> tr:first-child td[bgcolor="#D0FF42" i]), :has(tbody > tr:first-child td[bgcolor="#D0FF42" i]))) tr:last-child:not(:first-child) td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  text-align: left !important;
  white-space: nowrap;
  background: #fde047 !important;
  box-shadow: 2px 0 6px rgba(15, 23, 42, 0.08);
}

:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.htmd:not(:is(:has(> tr:first-child td[bgcolor="#D0FF42" i]), :has(tbody > tr:first-child td[bgcolor="#D0FF42" i]))) tr:last-child:not(:first-child) td:not(:first-child) {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
}

/*
 * レガシー table.datbl（1 行目が <tr class="datbl"> のランキング等）
 * soko-seisan 系に近い見た目。:has() 非対応ブラウザでは従来の bgcolor のまま。
 * .soko-seisan-table 付きの表は除外。
 * 親は .dp-fullwidth / .entry-content / .headline5 のいずれか配下で有効。
 */
:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.datbl:not(.soko-seisan-table):is(:has(> tr:first-child.datbl), :has(tbody > tr:first-child.datbl)) {
  width: 100%;
  min-width: max(100%, max-content);
  max-width: none;
  border-collapse: collapse;
  font-size: var(--fs-xs);
  color: var(--dp-text-main);
  background: #fff;
  border: 1px solid var(--dp-border);
  box-shadow: var(--dp-shadow);
  margin: 0.5rem 0 1rem;
}

:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.datbl:not(.soko-seisan-table):is(:has(> tr:first-child.datbl), :has(tbody > tr:first-child.datbl)) td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--dp-border);
  vertical-align: middle;
}

:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.datbl:not(.soko-seisan-table):is(:has(> tr:first-child.datbl), :has(tbody > tr:first-child.datbl)) td + td {
  border-left: 1px solid #e2e8f0;
}

/* 見出し行（旧 #B5CDFF 等を上書き） */
:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.datbl:not(.soko-seisan-table):has(> tr:first-child.datbl) > tr:first-child.datbl td,
:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.datbl:not(.soko-seisan-table):has(tbody > tr:first-child.datbl) tbody > tr:first-child.datbl td {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--sangyo-stat-header-grad) !important;
  color: #f8fafc !important;
  font-weight: 700;
  text-align: center !important;
  border-bottom: 3px solid #e11d48;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.15);
  white-space: nowrap;
}

/* データ行（1列目：順位表は数字／銑鉄などは国名。nowrap のため幅は内容に合わせ列を伸長） */
:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.datbl:not(.soko-seisan-table):has(> tr:first-child.datbl) > tr:not(:first-child) td:first-child,
:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.datbl:not(.soko-seisan-table):has(tbody > tr:first-child.datbl) tbody > tr:not(:first-child) td:first-child {
  text-align: center !important;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  min-width: 3.25rem;
  background: #f1f5f9 !important;
}

:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.datbl:not(.soko-seisan-table):has(> tr:first-child.datbl) > tr:not(:first-child) td:nth-child(2),
:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.datbl:not(.soko-seisan-table):has(tbody > tr:first-child.datbl) tbody > tr:not(:first-child) td:nth-child(2) {
  text-align: left !important;
  overflow-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
}

:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.datbl:not(.soko-seisan-table):has(> tr:first-child.datbl) > tr:not(:first-child) td:nth-child(3),
:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.datbl:not(.soko-seisan-table):has(tbody > tr:first-child.datbl) tbody > tr:not(:first-child) td:nth-child(3) {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ゼブラ（#DFEAFF 系を上書き） */
:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.datbl:not(.soko-seisan-table):has(> tr:first-child.datbl) > tr:nth-child(even):not(:first-child) td,
:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.datbl:not(.soko-seisan-table):has(tbody > tr:first-child.datbl) tbody > tr:nth-child(even):not(:first-child) td {
  background: #f8fafc !important;
}

:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.datbl:not(.soko-seisan-table):has(> tr:first-child.datbl) > tr:nth-child(odd):not(:first-child) td,
:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.datbl:not(.soko-seisan-table):has(tbody > tr:first-child.datbl) tbody > tr:nth-child(odd):not(:first-child) td {
  background: #fff !important;
}

:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.datbl:not(.soko-seisan-table):has(> tr:first-child.datbl) > tr:nth-child(even):not(:first-child) td:first-child,
:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.datbl:not(.soko-seisan-table):has(tbody > tr:first-child.datbl) tbody > tr:nth-child(even):not(:first-child) td:first-child {
  background: #e2e8f0 !important;
}

:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.datbl:not(.soko-seisan-table):has(> tr:first-child.datbl) > tr:nth-child(odd):not(:first-child) td:first-child,
:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.datbl:not(.soko-seisan-table):has(tbody > tr:first-child.datbl) tbody > tr:nth-child(odd):not(:first-child) td:first-child {
  background: #f1f5f9 !important;
}

:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.datbl:not(.soko-seisan-table):has(> tr:first-child.datbl) > tr:not(:first-child):hover td,
:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.datbl:not(.soko-seisan-table):has(tbody > tr:first-child.datbl) tbody > tr:not(:first-child):hover td {
  background: rgba(254, 226, 226, 0.75) !important;
}

:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.datbl:not(.soko-seisan-table):has(> tr:first-child.datbl) > tr:not(:first-child):hover td:first-child,
:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.datbl:not(.soko-seisan-table):has(tbody > tr:first-child.datbl) tbody > tr:not(:first-child):hover td:first-child {
  background: rgba(251, 113, 133, 0.35) !important;
}

/*
 * 世界鉄スクラップ貿易等: 1 行目付近に #F8EDFA（輸出/輸入・年行の 2 行ヘッダ）table.htmd / table.datbl。
 * 汎用 htmd は 2 行目をデータ行扱いするが、:nth-child(2) は偶数行ゼブラのため本ブロックで上書き。
 * tr.class="datbl" かつ F8EDFA の表も 5 列形式はこちら（ランキング用 datbl 列定義の上に優先）。合計行 #CCCCE6 は色を保持。
 * 重複 <table> タグ（誤入稿）は HTML 側の修正推奨。
 */
:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.datbl:not(.soko-seisan-table):is(
    :has(> tr:first-child td[bgcolor="#F8EDFA" i]),
    :has(tbody > tr:first-child td[bgcolor="#F8EDFA" i])
  ) {
  width: 100%;
  min-width: max(100%, max-content);
  max-width: none;
  border-collapse: collapse;
  font-size: var(--fs-xs);
  color: var(--dp-text-main);
  background: #fff;
  border: 1px solid var(--dp-border);
  box-shadow: var(--dp-shadow);
  margin: 0.5rem 0 1rem;
}

:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.datbl:not(.soko-seisan-table):is(
    :has(> tr:first-child td[bgcolor="#F8EDFA" i]),
    :has(tbody > tr:first-child td[bgcolor="#F8EDFA" i])
  ) td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--dp-border);
  vertical-align: middle;
}

:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.datbl:not(.soko-seisan-table):is(
    :has(> tr:first-child td[bgcolor="#F8EDFA" i]),
    :has(tbody > tr:first-child td[bgcolor="#F8EDFA" i])
  ) td
  + td {
  border-left: 1px solid #e2e8f0;
}

/* 1〜2 行目＝列ヘッダ（sticky 2 段） */
:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) :is(
    table.htmd:not(:is(:has(> tr:first-child td[bgcolor="#D0FF42" i]), :has(tbody > tr:first-child td[bgcolor="#D0FF42" i]))):is(
      :has(> tr:first-child td[bgcolor="#F8EDFA" i]),
      :has(tbody > tr:first-child td[bgcolor="#F8EDFA" i])
    ),
    table.datbl:not(.soko-seisan-table):is(:has(> tr:first-child td[bgcolor="#F8EDFA" i]), :has(tbody > tr:first-child td[bgcolor="#F8EDFA" i]))
  )
  tbody
  > tr:nth-child(1)
  td,
:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) :is(
    table.htmd:not(:is(:has(> tr:first-child td[bgcolor="#D0FF42" i]), :has(tbody > tr:first-child td[bgcolor="#D0FF42" i]))):is(
      :has(> tr:first-child td[bgcolor="#F8EDFA" i]),
      :has(tbody > tr:first-child td[bgcolor="#F8EDFA" i])
    ),
    table.datbl:not(.soko-seisan-table):is(:has(> tr:first-child td[bgcolor="#F8EDFA" i]), :has(tbody > tr:first-child td[bgcolor="#F8EDFA" i]))
  )
  tbody
  > tr:nth-child(2)
  td {
  position: sticky;
  z-index: 4;
  background: var(--sangyo-stat-header-grad) !important;
  color: #f8fafc !important;
  font-weight: 700;
  text-align: center !important;
  border-bottom: 2px solid #334155;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.12);
  white-space: nowrap;
}

:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) :is(
    table.htmd:not(:is(:has(> tr:first-child td[bgcolor="#D0FF42" i]), :has(tbody > tr:first-child td[bgcolor="#D0FF42" i]))):is(
      :has(> tr:first-child td[bgcolor="#F8EDFA" i]),
      :has(tbody > tr:first-child td[bgcolor="#F8EDFA" i])
    ),
    table.datbl:not(.soko-seisan-table):is(:has(> tr:first-child td[bgcolor="#F8EDFA" i]), :has(tbody > tr:first-child td[bgcolor="#F8EDFA" i]))
  )
  tbody
  > tr:nth-child(1)
  td {
  top: 0;
  z-index: 5;
  border-bottom: 3px solid #e11d48;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.15);
}

:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) :is(
    table.htmd:not(:is(:has(> tr:first-child td[bgcolor="#D0FF42" i]), :has(tbody > tr:first-child td[bgcolor="#D0FF42" i]))):is(
      :has(> tr:first-child td[bgcolor="#F8EDFA" i]),
      :has(tbody > tr:first-child td[bgcolor="#F8EDFA" i])
    ),
    table.datbl:not(.soko-seisan-table):is(:has(> tr:first-child td[bgcolor="#F8EDFA" i]), :has(tbody > tr:first-child td[bgcolor="#F8EDFA" i]))
  )
  tbody
  > tr:nth-child(2)
  td {
  top: 2.75rem;
  z-index: 4;
}

/* 角セル: 行ヘッダと左端の交差 */
:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) :is(
    table.htmd:not(:is(:has(> tr:first-child td[bgcolor="#D0FF42" i]), :has(tbody > tr:first-child td[bgcolor="#D0FF42" i]))):is(
      :has(> tr:first-child td[bgcolor="#F8EDFA" i]),
      :has(tbody > tr:first-child td[bgcolor="#F8EDFA" i])
    ),
    table.datbl:not(.soko-seisan-table):is(:has(> tr:first-child td[bgcolor="#F8EDFA" i]), :has(tbody > tr:first-child td[bgcolor="#F8EDFA" i]))
  )
  tbody
  > tr:nth-child(1)
  td:first-child,
:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) :is(
    table.htmd:not(:is(:has(> tr:first-child td[bgcolor="#D0FF42" i]), :has(tbody > tr:first-child td[bgcolor="#D0FF42" i]))):is(
      :has(> tr:first-child td[bgcolor="#F8EDFA" i]),
      :has(tbody > tr:first-child td[bgcolor="#F8EDFA" i])
    ),
    table.datbl:not(.soko-seisan-table):is(:has(> tr:first-child td[bgcolor="#F8EDFA" i]), :has(tbody > tr:first-child td[bgcolor="#F8EDFA" i]))
  )
  tbody
  > tr:nth-child(2)
  td:first-child {
  position: sticky;
  left: 0;
  z-index: 6;
  text-align: center !important;
  background: var(--sangyo-stat-header-grad) !important;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.12);
  border-right: 1px solid #475569;
}

:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) :is(
    table.htmd:not(:is(:has(> tr:first-child td[bgcolor="#D0FF42" i]), :has(tbody > tr:first-child td[bgcolor="#D0FF42" i]))):is(
      :has(> tr:first-child td[bgcolor="#F8EDFA" i]),
      :has(tbody > tr:first-child td[bgcolor="#F8EDFA" i])
    ),
    table.datbl:not(.soko-seisan-table):is(:has(> tr:first-child td[bgcolor="#F8EDFA" i]), :has(tbody > tr:first-child td[bgcolor="#F8EDFA" i]))
  )
  tbody
  > tr:nth-child(2)
  td:first-child {
  top: 2.75rem;
}

/* 3 行目以降: 国名列 + 数値 */
:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) :is(
    table.htmd:not(:is(:has(> tr:first-child td[bgcolor="#D0FF42" i]), :has(tbody > tr:first-child td[bgcolor="#D0FF42" i]))):is(
      :has(> tr:first-child td[bgcolor="#F8EDFA" i]),
      :has(tbody > tr:first-child td[bgcolor="#F8EDFA" i])
    ),
    table.datbl:not(.soko-seisan-table):is(:has(> tr:first-child td[bgcolor="#F8EDFA" i]), :has(tbody > tr:first-child td[bgcolor="#F8EDFA" i]))
  )
  tbody
  > tr:nth-child(n + 3)
  td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  text-align: left !important;
  font-weight: 600;
  white-space: nowrap;
  min-width: 3.25rem;
  background: #f1f5f9 !important;
  box-shadow: 2px 0 6px rgba(15, 23, 42, 0.08);
  border-right: 1px solid var(--dp-border);
}

:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) :is(
    table.htmd:not(:is(:has(> tr:first-child td[bgcolor="#D0FF42" i]), :has(tbody > tr:first-child td[bgcolor="#D0FF42" i]))):is(
      :has(> tr:first-child td[bgcolor="#F8EDFA" i]),
      :has(tbody > tr:first-child td[bgcolor="#F8EDFA" i])
    ),
    table.datbl:not(.soko-seisan-table):is(:has(> tr:first-child td[bgcolor="#F8EDFA" i]), :has(tbody > tr:first-child td[bgcolor="#F8EDFA" i]))
  )
  tbody
  > tr:nth-child(n + 3):not(:last-child):nth-child(odd)
  td:first-child {
  background: #f1f5f9 !important;
}

:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) :is(
    table.htmd:not(:is(:has(> tr:first-child td[bgcolor="#D0FF42" i]), :has(tbody > tr:first-child td[bgcolor="#D0FF42" i]))):is(
      :has(> tr:first-child td[bgcolor="#F8EDFA" i]),
      :has(tbody > tr:first-child td[bgcolor="#F8EDFA" i])
    ),
    table.datbl:not(.soko-seisan-table):is(:has(> tr:first-child td[bgcolor="#F8EDFA" i]), :has(tbody > tr:first-child td[bgcolor="#F8EDFA" i]))
  )
  tbody
  > tr:nth-child(n + 3):not(:last-child):nth-child(even)
  td:first-child {
  background: #e2e8f0 !important;
}

:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) :is(
    table.htmd:not(:is(:has(> tr:first-child td[bgcolor="#D0FF42" i]), :has(tbody > tr:first-child td[bgcolor="#D0FF42" i]))):is(
      :has(> tr:first-child td[bgcolor="#F8EDFA" i]),
      :has(tbody > tr:first-child td[bgcolor="#F8EDFA" i])
    ),
    table.datbl:not(.soko-seisan-table):is(:has(> tr:first-child td[bgcolor="#F8EDFA" i]), :has(tbody > tr:first-child td[bgcolor="#F8EDFA" i]))
  )
  tbody
  > tr:nth-child(n + 3):not(:last-child)
  td {
  background: #fff !important;
}

:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) :is(
    table.htmd:not(:is(:has(> tr:first-child td[bgcolor="#D0FF42" i]), :has(tbody > tr:first-child td[bgcolor="#D0FF42" i]))):is(
      :has(> tr:first-child td[bgcolor="#F8EDFA" i]),
      :has(tbody > tr:first-child td[bgcolor="#F8EDFA" i])
    ),
    table.datbl:not(.soko-seisan-table):is(:has(> tr:first-child td[bgcolor="#F8EDFA" i]), :has(tbody > tr:first-child td[bgcolor="#F8EDFA" i]))
  )
  tbody
  > tr:nth-child(n + 3):not(:last-child):nth-child(even)
  td {
  background: #f8fafc !important;
}

:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) :is(
    table.htmd:not(:is(:has(> tr:first-child td[bgcolor="#D0FF42" i]), :has(tbody > tr:first-child td[bgcolor="#D0FF42" i]))):is(
      :has(> tr:first-child td[bgcolor="#F8EDFA" i]),
      :has(tbody > tr:first-child td[bgcolor="#F8EDFA" i])
    ),
    table.datbl:not(.soko-seisan-table):is(:has(> tr:first-child td[bgcolor="#F8EDFA" i]), :has(tbody > tr:first-child td[bgcolor="#F8EDFA" i]))
  )
  tbody
  > tr:nth-child(n + 3):not(:last-child)
  td:not(:first-child) {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
}

/* 当該年列の薄い色（bgcolor）をデータ行で維持 */
:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) :is(
    table.htmd:not(:is(:has(> tr:first-child td[bgcolor="#D0FF42" i]), :has(tbody > tr:first-child td[bgcolor="#D0FF42" i]))):is(
      :has(> tr:first-child td[bgcolor="#F8EDFA" i]),
      :has(tbody > tr:first-child td[bgcolor="#F8EDFA" i])
    ),
    table.datbl:not(.soko-seisan-table):is(:has(> tr:first-child td[bgcolor="#F8EDFA" i]), :has(tbody > tr:first-child td[bgcolor="#F8EDFA" i]))
  )
  tbody
  > tr:nth-child(n + 3)
  td[bgcolor="#F8EDFA" i]:not(:first-child) {
  background: #f8edfa !important;
}

:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) :is(
    table.htmd:not(:is(:has(> tr:first-child td[bgcolor="#D0FF42" i]), :has(tbody > tr:first-child td[bgcolor="#D0FF42" i]))):is(
      :has(> tr:first-child td[bgcolor="#F8EDFA" i]),
      :has(tbody > tr:first-child td[bgcolor="#F8EDFA" i])
    ),
    table.datbl:not(.soko-seisan-table):is(:has(> tr:first-child td[bgcolor="#F8EDFA" i]), :has(tbody > tr:first-child td[bgcolor="#F8EDFA" i]))
  )
  tbody
  > tr:nth-child(n + 3):not(:last-child):hover
  td {
  background: rgba(254, 226, 226, 0.75) !important;
}

:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) :is(
    table.htmd:not(:is(:has(> tr:first-child td[bgcolor="#D0FF42" i]), :has(tbody > tr:first-child td[bgcolor="#D0FF42" i]))):is(
      :has(> tr:first-child td[bgcolor="#F8EDFA" i]),
      :has(tbody > tr:first-child td[bgcolor="#F8EDFA" i])
    ),
    table.datbl:not(.soko-seisan-table):is(:has(> tr:first-child td[bgcolor="#F8EDFA" i]), :has(tbody > tr:first-child td[bgcolor="#F8EDFA" i]))
  )
  tbody
  > tr:nth-child(n + 3):not(:last-child):hover
  td:first-child {
  background: rgba(251, 113, 133, 0.35) !important;
}

:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) :is(
    table.htmd:not(:is(:has(> tr:first-child td[bgcolor="#D0FF42" i]), :has(tbody > tr:first-child td[bgcolor="#D0FF42" i]))):is(
      :has(> tr:first-child td[bgcolor="#F8EDFA" i]),
      :has(tbody > tr:first-child td[bgcolor="#F8EDFA" i])
    ),
    table.datbl:not(.soko-seisan-table):is(:has(> tr:first-child td[bgcolor="#F8EDFA" i]), :has(tbody > tr:first-child td[bgcolor="#F8EDFA" i]))
  )
  tbody
  > tr:nth-child(n + 3):not(:last-child):hover
  td[bgcolor="#F8EDFA" i] {
  background: rgba(254, 220, 230, 0.95) !important;
}

/* 最終行: #CCCCE6 の合計行（出稿どおり） */
:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) :is(
    table.htmd:not(:is(:has(> tr:first-child td[bgcolor="#D0FF42" i]), :has(tbody > tr:first-child td[bgcolor="#D0FF42" i]))):is(
      :has(> tr:first-child td[bgcolor="#F8EDFA" i]),
      :has(tbody > tr:first-child td[bgcolor="#F8EDFA" i])
    ),
    table.datbl:not(.soko-seisan-table):is(:has(> tr:first-child td[bgcolor="#F8EDFA" i]), :has(tbody > tr:first-child td[bgcolor="#F8EDFA" i]))
  )
  tbody
  > tr:last-child:not(:first-child)
  td[bgcolor="#CCCCE6" i] {
  position: static;
  background: #cccce6 !important;
  color: var(--dp-text-main) !important;
  font-weight: 700;
  border-top: 2px solid #64748b;
  text-align: right !important;
  font-variant-numeric: tabular-nums;
}

:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) :is(
    table.htmd:not(:is(:has(> tr:first-child td[bgcolor="#D0FF42" i]), :has(tbody > tr:first-child td[bgcolor="#D0FF42" i]))):is(
      :has(> tr:first-child td[bgcolor="#F8EDFA" i]),
      :has(tbody > tr:first-child td[bgcolor="#F8EDFA" i])
    ),
    table.datbl:not(.soko-seisan-table):is(:has(> tr:first-child td[bgcolor="#F8EDFA" i]), :has(tbody > tr:first-child td[bgcolor="#F8EDFA" i]))
  )
  tbody
  > tr:last-child:not(:first-child)
  td[bgcolor="#CCCCE6" i]:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  text-align: left !important;
  white-space: nowrap;
  background: #b8b8d4 !important;
  box-shadow: 2px 0 6px rgba(15, 23, 42, 0.08);
  border-right: 1px solid var(--dp-border);
}

/* 最終行: #CCCCE6 以外（旧ルールの黄） */
:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) :is(
    table.htmd:not(:is(:has(> tr:first-child td[bgcolor="#D0FF42" i]), :has(tbody > tr:first-child td[bgcolor="#D0FF42" i]))):is(
      :has(> tr:first-child td[bgcolor="#F8EDFA" i]),
      :has(tbody > tr:first-child td[bgcolor="#F8EDFA" i])
    ),
    table.datbl:not(.soko-seisan-table):is(:has(> tr:first-child td[bgcolor="#F8EDFA" i]), :has(tbody > tr:first-child td[bgcolor="#F8EDFA" i]))
  )
  tbody
  > tr:last-child:not(:first-child)
  td:not([bgcolor="#CCCCE6" i]) {
  background: #fef9c3 !important;
  color: var(--dp-text-main) !important;
  font-weight: 700;
  border-top: 2px solid #ca8a04;
  border-bottom: none;
  text-align: right !important;
  font-variant-numeric: tabular-nums;
}

:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) :is(
    table.htmd:not(:is(:has(> tr:first-child td[bgcolor="#D0FF42" i]), :has(tbody > tr:first-child td[bgcolor="#D0FF42" i]))):is(
      :has(> tr:first-child td[bgcolor="#F8EDFA" i]),
      :has(tbody > tr:first-child td[bgcolor="#F8EDFA" i])
    ),
    table.datbl:not(.soko-seisan-table):is(:has(> tr:first-child td[bgcolor="#F8EDFA" i]), :has(tbody > tr:first-child td[bgcolor="#F8EDFA" i]))
  )
  tbody
  > tr:last-child:not(:first-child)
  td:not([bgcolor="#CCCCE6" i]):first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  text-align: left !important;
  white-space: nowrap;
  background: #fde047 !important;
  box-shadow: 2px 0 6px rgba(15, 23, 42, 0.08);
}

/*
 * table.htmd：1 行目が #D0FF42（暦年・年列）の地域別・年次表など
 * #FCD936 の世界粗鋼表（soko_seisan_w_y）とは別系統。小計 #E1FEC2 / 最終行 世界合計。
 */
:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.htmd:is(:has(> tr:first-child td[bgcolor="#D0FF42" i]), :has(tbody > tr:first-child td[bgcolor="#D0FF42" i])) {
  width: 100%;
  min-width: max(100%, max-content);
  border-collapse: collapse;
  font-size: var(--fs-xs);
  color: var(--dp-text-main);
  background: #fff;
  border: 1px solid var(--dp-border);
  box-shadow: var(--dp-shadow);
  margin: 0.5rem 0 1rem;
}

:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.htmd:is(:has(> tr:first-child td[bgcolor="#D0FF42" i]), :has(tbody > tr:first-child td[bgcolor="#D0FF42" i])) td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--dp-border);
  vertical-align: middle;
}

:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.htmd:is(:has(> tr:first-child td[bgcolor="#D0FF42" i]), :has(tbody > tr:first-child td[bgcolor="#D0FF42" i])) td + td {
  border-left: 1px solid #e2e8f0;
}

/* 年列ヘッダ（#D0FF42 を上書き） */
:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.htmd:has(> tr:first-child td[bgcolor="#D0FF42" i]) > tr:first-child td,
:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.htmd:has(tbody > tr:first-child td[bgcolor="#D0FF42" i]) tbody > tr:first-child td {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--sangyo-stat-header-grad) !important;
  color: #f8fafc !important;
  font-weight: 700;
  text-align: center !important;
  border-bottom: 3px solid #e11d48;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.15);
  white-space: nowrap;
}

:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.htmd:has(> tr:first-child td[bgcolor="#D0FF42" i]) > tr:first-child td:first-child,
:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.htmd:has(tbody > tr:first-child td[bgcolor="#D0FF42" i]) tbody > tr:first-child td:first-child {
  z-index: 4;
}

/* 左端（国・地域名）：横スクロール時に固定（折り返しなし・親の overflow-x で横スクロール） */
:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.htmd:has(> tr:first-child td[bgcolor="#D0FF42" i]) > tr:not(:first-child) td:first-child,
:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.htmd:has(tbody > tr:first-child td[bgcolor="#D0FF42" i]) tbody > tr:not(:first-child) td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  text-align: left !important;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.25;
  min-width: 7rem;
  background: #f1f5f9 !important;
  box-shadow: 2px 0 6px rgba(15, 23, 42, 0.08);
  border-right: 1px solid var(--dp-border);
}

:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.htmd:has(> tr:first-child td[bgcolor="#D0FF42" i]) > tr:not(:first-child) td:not(:first-child),
:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.htmd:has(tbody > tr:first-child td[bgcolor="#D0FF42" i]) tbody > tr:not(:first-child) td:not(:first-child) {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
}

/* 通常行のゼブラ（小計・最終行以外） */
:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.htmd:has(> tr:first-child td[bgcolor="#D0FF42" i]) > tr:not(:first-child):not(:last-child):not(:has(td[bgcolor="#E1FEC2" i])):nth-child(even) td,
:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.htmd:has(tbody > tr:first-child td[bgcolor="#D0FF42" i]) tbody > tr:not(:first-child):not(:last-child):not(:has(td[bgcolor="#E1FEC2" i])):nth-child(even) td {
  background: #f8fafc !important;
}

:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.htmd:has(> tr:first-child td[bgcolor="#D0FF42" i]) > tr:not(:first-child):not(:last-child):not(:has(td[bgcolor="#E1FEC2" i])):nth-child(odd) td,
:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.htmd:has(tbody > tr:first-child td[bgcolor="#D0FF42" i]) tbody > tr:not(:first-child):not(:last-child):not(:has(td[bgcolor="#E1FEC2" i])):nth-child(odd) td {
  background: #fff !important;
}

:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.htmd:has(> tr:first-child td[bgcolor="#D0FF42" i]) > tr:not(:first-child):not(:last-child):not(:has(td[bgcolor="#E1FEC2" i])):nth-child(even) td:first-child,
:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.htmd:has(tbody > tr:first-child td[bgcolor="#D0FF42" i]) tbody > tr:not(:first-child):not(:last-child):not(:has(td[bgcolor="#E1FEC2" i])):nth-child(even) td:first-child {
  background: #e2e8f0 !important;
}

:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.htmd:has(> tr:first-child td[bgcolor="#D0FF42" i]) > tr:not(:first-child):not(:last-child):not(:has(td[bgcolor="#E1FEC2" i])):nth-child(odd) td:first-child,
:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.htmd:has(tbody > tr:first-child td[bgcolor="#D0FF42" i]) tbody > tr:not(:first-child):not(:last-child):not(:has(td[bgcolor="#E1FEC2" i])):nth-child(odd) td:first-child {
  background: #f1f5f9 !important;
}

/* 小計行 #E1FEC2 */
:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.htmd:has(> tr:first-child td[bgcolor="#D0FF42" i]) > tr:not(:first-child):not(:last-child):has(td[bgcolor="#E1FEC2" i]) td,
:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.htmd:has(tbody > tr:first-child td[bgcolor="#D0FF42" i]) tbody > tr:not(:first-child):not(:last-child):has(td[bgcolor="#E1FEC2" i]) td {
  background: #d9f99d !important;
  color: var(--dp-text-main) !important;
  font-weight: 700;
  border-top: 1px solid #84cc16;
  border-bottom: 1px solid #84cc16;
}

:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.htmd:has(> tr:first-child td[bgcolor="#D0FF42" i]) > tr:not(:first-child):not(:last-child):has(td[bgcolor="#E1FEC2" i]) td:first-child,
:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.htmd:has(tbody > tr:first-child td[bgcolor="#D0FF42" i]) tbody > tr:not(:first-child):not(:last-child):has(td[bgcolor="#E1FEC2" i]) td:first-child {
  background: #bef264 !important;
  box-shadow: 2px 0 6px rgba(15, 23, 42, 0.08);
}

/* 最終行・世界合計 */
:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.htmd:has(> tr:first-child td[bgcolor="#D0FF42" i]) > tr:last-child:not(:first-child) td,
:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.htmd:has(tbody > tr:first-child td[bgcolor="#D0FF42" i]) tbody > tr:last-child:not(:first-child) td {
  background: #fef9c3 !important;
  color: var(--dp-text-main) !important;
  font-weight: 700;
  border-top: 2px solid #ca8a04;
  border-bottom: none;
}

:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.htmd:has(> tr:first-child td[bgcolor="#D0FF42" i]) > tr:last-child:not(:first-child) td:first-child,
:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.htmd:has(tbody > tr:first-child td[bgcolor="#D0FF42" i]) tbody > tr:last-child:not(:first-child) td:first-child {
  background: #fde047 !important;
  z-index: 2;
}

/* ホバー（通常行のみ） */
:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.htmd:has(> tr:first-child td[bgcolor="#D0FF42" i]) > tr:not(:first-child):not(:last-child):not(:has(td[bgcolor="#E1FEC2" i])):hover td,
:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.htmd:has(tbody > tr:first-child td[bgcolor="#D0FF42" i]) tbody > tr:not(:first-child):not(:last-child):not(:has(td[bgcolor="#E1FEC2" i])):hover td {
  background: rgba(254, 226, 226, 0.75) !important;
}

:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.htmd:has(> tr:first-child td[bgcolor="#D0FF42" i]) > tr:not(:first-child):not(:last-child):not(:has(td[bgcolor="#E1FEC2" i])):hover td:first-child,
:is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.htmd:has(tbody > tr:first-child td[bgcolor="#D0FF42" i]) tbody > tr:not(:first-child):not(:last-child):not(:has(td[bgcolor="#E1FEC2" i])):hover td:first-child {
  background: rgba(251, 113, 133, 0.35) !important;
}

/* スマホ：レガシー htmd / datbl のセル余白（本ファイルのルールの後段で上書き） */
@media (max-width: 768px) {
  :is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.datbl:not(.soko-seisan-table):is(
      :has(> tr:first-child.datbl),
      :has(tbody > tr:first-child.datbl)
    )
    td {
    padding: 6px 4px;
  }

  :is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.datbl:not(.soko-seisan-table):is(
      :has(> tr:first-child td[bgcolor="#F8EDFA" i]),
      :has(tbody > tr:first-child td[bgcolor="#F8EDFA" i])
    )
    td {
    padding: 6px 4px;
  }

  :is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.htmd:not(:is(:has(> tr:first-child td[bgcolor="#D0FF42" i]), :has(tbody > tr:first-child td[bgcolor="#D0FF42" i]))) td {
    padding: 6px 4px;
  }
}

@media (max-width: 480px) {
  :is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.datbl:not(.soko-seisan-table):is(
      :has(> tr:first-child.datbl),
      :has(tbody > tr:first-child.datbl)
    )
    td {
    padding: 5px 2px;
  }

  :is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.datbl:not(.soko-seisan-table):is(
      :has(> tr:first-child td[bgcolor="#F8EDFA" i]),
      :has(tbody > tr:first-child td[bgcolor="#F8EDFA" i])
    )
    td {
    padding: 5px 2px;
  }

  :is(.content-wrapper.dp-fullwidth, .entry-content, .headline5) table.htmd:not(:is(:has(> tr:first-child td[bgcolor="#D0FF42" i]), :has(tbody > tr:first-child td[bgcolor="#D0FF42" i]))) td {
    padding: 5px 2px;
  }
}

/*
 * 外為 TTS（price_tts.php）クロスハイライト
 * style.css より後に読み込まれる本ファイルで、列方向の背景を !important 固定。
 * （列は JS が soko-seisan-table__col--hover を付与。JS が親テーマの古いファイルのままだと列は付かない）
 */
.price-tts-table.soko-seisan-table--cross-hover tbody tr.soko-seisan-table__row--hover > td {
  background: rgba(254, 226, 226, 0.88) !important;
}

.price-tts-table.soko-seisan-table--cross-hover tbody td.soko-seisan-table__col--hover {
  background: rgba(254, 226, 226, 0.88) !important;
}

.price-tts-table.soko-seisan-table--cross-hover tbody tr.soko-seisan-table__row--hover > td.soko-seisan-table__col--hover {
  background: rgba(251, 113, 133, 0.62) !important;
}

.price-tts-table.soko-seisan-table--cross-hover tbody tr.soko-seisan-table__row--hover > td.price-tts-avg-col,
.price-tts-table.soko-seisan-table--cross-hover tbody td.price-tts-avg-col.soko-seisan-table__col--hover {
  color: #0f172a !important;
}