/* ============================================================
   Sun-BD 策略回測排行榜共用樣式（到達頁 hero 與 stocks 首頁共用）— 由 build_pages.py 自 scripts/ranking.css 輸出
   Shared strategy-ranking styles (landing-page hero + stocks homepage) — emitted by build_pages.py from scripts/ranking.css
   ============================================================ */

/* ── 策略回測排行榜（hero 內，2026-09-07 r12）/ strategy backtest ranking inside the hero ── */
.lp-rank {
  width: 100%;
  max-width: 1080px;
  margin: 8px auto 0;
  text-align: left;
  animation: fadeUp 0.8s 0.3s ease both;
}
.lp-rank-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 12px;
}
.lp-rank-head h2 {
  /* 中文：三語首頁共用，各頁只載入自己的字型家族，故列出 TC／SC／EN 後援。English: shared by the three localized homepages; each loads only its own family, so TC/SC/EN fallbacks are listed. */
  font-family: 'Noto Serif TC', 'Noto Serif SC', 'Playfair Display', serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}
.lp-rank-head h2 .lp-rank-mode {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.25em;
  color: var(--accent-cyan);
  margin-left: 12px;
  text-transform: uppercase;
}
.lp-rank-meta {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}
.lp-rank-scroll {
  border: 1px solid var(--border);
  background: rgba(13,21,37,0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  max-height: 420px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.lp-rank table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  font-size: 13px;
  line-height: 1.5;
}
.lp-rank thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #0b1222;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-bright);
  white-space: nowrap;
}
.lp-rank tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: top;
  white-space: nowrap;
}
.lp-rank tbody tr:nth-child(even) td { background: rgba(255,255,255,0.015); }
.lp-rank tbody tr:hover td { background: rgba(200,168,75,0.06); }
.lp-rank .num { text-align: right; font-family: 'Space Mono', monospace; font-size: 12.5px; }
.lp-rank .rank { color: var(--accent-gold); font-family: 'Space Mono', monospace; font-weight: 700; text-align: center; }
.lp-rank .cat { color: var(--accent-cyan); font-size: 12px; }
.lp-rank .recipe { white-space: normal; min-width: 220px; color: var(--text-primary); }
.lp-rank td small { display: block; color: var(--text-muted); font-size: 11px; font-family: 'Noto Sans TC', 'Noto Sans SC', 'Inter', sans-serif; font-weight: 300; margin-top: 2px; letter-spacing: 0; }
.lp-rank .pos { color: #3fd98a; }
.lp-rank .dd { color: var(--accent-amber); }
/* 中文：最右欄「回測推估報酬率(月)」是操作者指定的關鍵數據，金色加粗並固定在右側。English: the rightmost monthly-return column is the key figure per operator; gold, bold, sticky right. */
.lp-rank .ret { color: var(--accent-gold); font-weight: 700; font-size: 14px; position: sticky; right: 0; background: #0b1222; box-shadow: -8px 0 12px -8px rgba(0,0,0,0.6); }
.lp-rank thead th.ret { color: var(--accent-gold); z-index: 2; }
.lp-rank tbody tr:nth-child(even) td.ret { background: #0c1425; }
.lp-rank tbody tr:hover td.ret { background: #16192a; }
.lp-rank-foot {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.7;
}
@media (max-width: 768px) {
  .lp-rank-scroll { max-height: 360px; }
  .lp-rank table { font-size: 12px; }
  .lp-rank thead th, .lp-rank tbody td { padding: 8px 10px; }
  .lp-rank-head h2 { font-size: 17px; }
}

/* ── 排行榜分類頁籤與即時狀態（r15）/ ranking category tabs + live states ── */
.lp-rank-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.lp-rank-tabs button {
  font: inherit; font-size: 12px; letter-spacing: 0.04em; line-height: 1.4;
  padding: 6px 12px; border: 1px solid var(--border); background: transparent; color: var(--text-secondary); cursor: pointer;
  transition: all 0.2s;
}
.lp-rank-tabs button:hover { color: var(--text-primary); border-color: var(--border-bright); }
.lp-rank-tabs button.on { color: var(--accent-gold); border-color: var(--accent-gold); background: rgba(200,168,75,0.08); }
.lp-rank .lp-rank-msg { text-align: center; color: var(--text-muted); padding: 28px 12px; white-space: normal; }
@media (max-width: 768px) {
  .lp-rank-tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
  .lp-rank-tabs button { white-space: nowrap; padding: 6px 10px; }
}

/* ── 更新時間欄（r16）/ updated-date column ── */
.lp-rank .date { font-family: 'Space Mono', monospace; font-size: 12px; color: var(--text-muted); text-align: center; }

/* ── 手機直式版面（r17）：右側固定的報酬率欄縮窄、表頭改短字，讓名次／分類與報酬率同時可見，中間欄位橫向捲動。
   Phone portrait (r17): narrow the sticky return column and use a short header so rank/category and the return stay visible; middle columns scroll. ── */
.lp-rank th.ret .short { display: none; }
@media (max-width: 768px) {
  .lp-rank thead th, .lp-rank tbody td { padding: 7px 8px; }
  .lp-rank table { min-width: 560px; font-size: 12px; }
  .lp-rank .recipe { min-width: 150px; }
  .lp-rank .num { font-size: 12px; }
  .lp-rank .date { font-size: 11px; padding-left: 6px; padding-right: 6px; }
  .lp-rank .ret { font-size: 12.5px; min-width: 72px; padding-left: 6px; padding-right: 8px; white-space: nowrap; }
  .lp-rank th.ret .full { display: none; }
  .lp-rank th.ret .short { display: inline; }
}

/* ── 市場頁籤與台股個股佔位表（2026-09-09 雙核心）/ market tabs + Taiwan-stock placeholder (2026-09-09 dual core) ── */
/* 中文：作者樣式的 display 會蓋掉 HTML hidden 屬性，切換市場時分類頁籤與 data-mk 文字要靠這條才會真的隱藏。
   English: author display rules beat the HTML hidden attribute; this rule makes the market switch actually hide things. */
.lp-rank [hidden] { display: none !important; }
.lp-rank-markets { display: flex; gap: 8px; margin: 0 0 12px; }
.lp-rank-markets button {
  font: inherit; font-size: 13px; letter-spacing: 0.04em; line-height: 1.4;
  padding: 8px 18px; border: 1px solid var(--border); background: transparent; color: var(--text-secondary); cursor: pointer;
  transition: all 0.2s; font-weight: 500;
}
.lp-rank-markets button:hover { color: var(--text-primary); border-color: var(--border-bright); }
.lp-rank-markets button.on { color: #05070f; border-color: var(--accent-gold); background: var(--accent-gold); font-weight: 700; }
/* 中文：佔位表整體壓暗，讓訪客一眼看出這張還沒有資料（2026-09-11 起台股已有真實資料，此樣式保留給日後新市場）。
   English: dims a placeholder table; unused since the stock ranking went live on 2026-09-11, kept for a future market. */
.lp-rank-pending { margin-top: 28px; opacity: 0.82; }
.lp-rank-pending .lp-rank-scroll { background: rgba(13,21,37,0.45); border-style: dashed; }
.lp-rank-pending .lp-rank-head h2 .lp-rank-mode { color: var(--accent-amber); }
.lp-rank-pending .lp-rank-msg { padding: 40px 12px; }

/* ── 台股個股合併排行（2026-09-11）：第二張表與上方留白，並多一個「來源」欄區分關係係數側／個股數據側。
   Merged Taiwan-stock ranking (2026-09-11): the second table keeps its top margin and adds a Source column. ── */
.lp-rank-stocks { margin-top: 28px; }

/* ── ［回測報告］欄與展開面板（2026-09-11）：點擊該列的按鈕就地展開逐筆完整交易循環。
   Backtest-report column and its expanded panel (2026-09-11): each row's button opens its complete trade cycles in place. ── */
.lp-rank .rep { padding-left: 6px; padding-right: 6px; }
.lp-rank-report {
  font: inherit; font-size: 11.5px; line-height: 1.2; letter-spacing: 0.04em;
  padding: 4px 10px; border: 1px solid var(--border); background: transparent; color: var(--text-secondary);
  cursor: pointer; white-space: nowrap; transition: all 0.2s;
}
.lp-rank-report:hover { color: var(--accent-gold); border-color: var(--accent-gold); }
.lp-rank-report.on { color: #05070f; background: var(--accent-gold); border-color: var(--accent-gold); font-weight: 700; }
.lp-rank-report-row > td { background: rgba(8,13,24,0.92); padding: 12px 14px; white-space: normal; }
.lp-rank-report-head {
  font-family: 'Space Mono', monospace; font-size: 11px; letter-spacing: 0.14em;
  color: var(--accent-cyan); text-transform: uppercase; margin-bottom: 8px;
}
/* 中文：逐筆表可能上百列，自己捲動，不撐開排行表。English: a report may hold hundreds of rows, so it scrolls on its own. */
.lp-rank-report-scroll { max-height: 260px; overflow: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--border); }
.lp-rank-report-scroll table { width: 100%; min-width: 520px; border-collapse: collapse; font-size: 12px; }
.lp-rank-report-scroll th {
  position: sticky; top: 0; z-index: 1; background: #0b1222; color: var(--text-muted);
  font-weight: 500; font-size: 10.5px; letter-spacing: 0.06em; text-align: left; padding: 6px 8px;
  border-bottom: 1px solid var(--border-bright); white-space: nowrap;
}
.lp-rank-report-scroll td { padding: 5px 8px; border-bottom: 1px solid var(--border); color: var(--text-secondary); white-space: nowrap; }
.lp-rank-report-scroll td.num { text-align: right; font-family: 'Space Mono', monospace; }
.lp-rank-report-scroll td.reason { color: var(--text-muted); }
.lp-rank-report-scroll .pos { color: #3fd98a; }
.lp-rank-report-scroll .neg { color: #e06c75; }
/* 中文：成交腿（加碼／分次減碼）單行呈現，與 C# 逐筆證據的最後一段對應。
   English: the fill-leg cell stays on one line, mirroring the tail of the C# per-trade evidence. */
.lp-rank-report td.legs { white-space: nowrap; color: var(--text-muted); }
.lp-rank-report-note { margin: 8px 0 0; font-size: 11px; color: var(--text-muted); line-height: 1.6; }
.lp-rank-report-msg { padding: 18px 8px; text-align: center; color: var(--text-muted); font-size: 12px; }
@media (max-width: 768px) {
  .lp-rank-report { font-size: 11px; padding: 4px 8px; }
  .lp-rank-report-scroll { max-height: 220px; }
}
.lp-rank .src { color: var(--text-primary); font-size: 12.5px; min-width: 104px; }
.lp-rank .src small { color: var(--text-muted); }
/* 中文：台股的報酬率欄下方掛回測天數小字，右側固定欄要放寬一點才不會擠成兩行。English: the stock return column carries the span beneath it. */
.lp-rank-stocks .ret small { color: var(--text-muted); font-weight: 400; }
@media (max-width: 768px) {
  .lp-rank .src { min-width: 88px; font-size: 11.5px; }
  .lp-rank-stocks .ret { min-width: 84px; }
}
@media (max-width: 768px) {
  .lp-rank-markets button { padding: 7px 14px; font-size: 12px; }
}

/* ── hero 主題卡（行銷頁與三語首頁共用，2026-09-10）/ hero theme cards shared by the landing page and the homepages ── */
.lp-theme-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto 30px;
  text-align: left;
  animation: fadeUp 0.8s 0.25s ease both;
}
.lp-theme-card {
  display: flex; flex-direction: column; gap: 6px;
  padding: 18px 20px 16px;
  border: 1px solid var(--border);
  background: rgba(13,21,37,0.72);
  color: inherit; text-decoration: none;
  transition: border-color 0.25s, transform 0.25s;
}
.lp-theme-card:hover { border-color: var(--accent-gold); transform: translateY(-3px); }
.lp-theme-card-num { font-family: 'Space Mono', monospace; font-size: 11px; color: var(--accent-gold); letter-spacing: 0.2em; }
.lp-theme-card-tag { font-family: 'Space Mono', monospace; font-size: 10px; letter-spacing: 0.22em; color: var(--accent-cyan); text-transform: uppercase; }
.lp-theme-card h3 { font-family: 'Noto Serif TC', serif; font-size: 20px; font-weight: 700; line-height: 1.35; margin: 4px 0 2px; color: var(--text-primary); }
.lp-theme-card h3 .gold { color: var(--accent-gold); }
.lp-theme-card h3 br { display: none; }
.lp-theme-card h3 .gold::before { content: "｜"; color: var(--text-muted); font-weight: 300; }
.lp-theme-card p { font-size: 13px; color: var(--text-secondary); line-height: 1.7; margin: 0; }
.lp-theme-card-more { margin-top: auto; padding-top: 8px; font-size: 12px; color: var(--accent-gold); letter-spacing: 0.06em; }
@media (max-width: 900px) {
  .lp-theme-strip { grid-template-columns: 1fr; gap: 10px; }
  .lp-theme-card { padding: 14px 16px 12px; }
  .lp-theme-card h3 { font-size: 18px; }
}
/* 中文：上面這個 @media 原本缺少結尾大括號（瀏覽器在檔尾自動補上），2026-09-14 補上；否則後面的規則全被包進窄螢幕條件。
   English: the @media block above was missing its closing brace; without it every rule below only applied under 900px. */

/* ── 投資風險警語與免責聲明（2026-09-14 自 marketing.css 移入，首頁與到達頁共用）/ disclaimer, shared by the homepage and the landing page ── */
.lp-disclaimer { padding: 16px 24px 56px; }

.lp-disclaimer-box {
  max-width: 1000px;
  margin: 0 auto;
  padding: 28px 32px;
  border: 2px solid var(--accent-amber);
  background: rgba(255,159,67,0.06);
}

.lp-disclaimer-box h2 {
  font-family: 'Noto Serif TC', serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--accent-amber);
  margin-bottom: 12px;
}

.lp-disclaimer-box p {
  font-size: 14px;
  line-height: 1.95;
  color: var(--text-primary);
  font-weight: 400;
}

/* 中文：2026-09-14 改為五段式，每段小標獨立一行並拉開段距。English: five-part layout, heading on its own line with paragraph spacing. */
.lp-disclaimer-box p + p { margin-top: 14px; }

.lp-disclaimer-box p strong {
  display: block;
  font-weight: 700;
  color: var(--accent-amber);
  margin-bottom: 2px;
}
@media (max-width: 768px) {
  .lp-disclaimer-box { padding: 22px 18px; }
}
