/* ============================================================
   宫位转换速查 /gongwei/  组件样式
   规则：选择器一律 gw- 前缀；颜色一律取主站 :root 变量，不自定义色值
   ============================================================ */

.gw { background: var(--paper); color: var(--ink); font-family: var(--sans); padding: 0 0 64px;
  max-width: 100%; overflow-x: hidden; }
.gw-wrap { max-width: 1060px; margin: 0 auto; padding: 0 20px; box-sizing: border-box; width: 100%; }

.gw-crumb { font-size: 13px; color: var(--muted); padding: 18px 0 0; }
.gw-crumb a { color: var(--muted); text-decoration: none; }
.gw-crumb a:hover { color: var(--accent); }
.gw-crumb i { font-style: normal; padding: 0 6px; opacity: .5; }

.gw-hero { padding: 14px 0 18px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.gw-kicker { font-size: 12px; letter-spacing: .22em; color: var(--accent); margin: 0 0 8px; font-weight: 600; }
.gw-hero h1 { font-family: var(--serif); font-size: 32px; line-height: 1.25; margin: 0 0 8px; letter-spacing: .04em; font-weight: 700; }
.gw-hero h1 small { font-size: 14px; font-weight: 400; color: var(--muted); letter-spacing: 0; margin-left: 10px; font-family: var(--sans); }
.gw-sub { font-size: 14px; color: var(--ink2); margin: 0; line-height: 1.85; }

/* 控制区 */
.gw-ctrl { margin: 0 0 18px; }
.gw-tabs { display: inline-flex; gap: 4px; background: var(--line); padding: 4px; border-radius: 10px; margin-bottom: 14px; }
.gw-tab { appearance: none; border: 0; background: transparent; color: var(--ink2); font: inherit; font-size: 14px; padding: 7px 18px; border-radius: 8px; cursor: pointer; }
.gw-tab[aria-selected="true"] { background: var(--paper); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.gw-tabdesc { font-size: 13px; color: var(--muted); margin: 0 0 12px; line-height: 1.7; }

.gw-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.gw-chip { appearance: none; font: inherit; font-size: 14px; padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--paper); color: var(--ink2); cursor: pointer; transition: .15s; }
.gw-chip:hover { border-color: var(--accent); color: var(--accent); }
.gw-chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.gw-chip b { font-weight: 600; }

/* 结果表 */
.gw-res { margin: 4px 0 0; }
.gw-title { font-size: 15px; font-weight: 600; margin: 22px 0 10px; color: var(--ink); }
.gw-title em { font-style: normal; color: var(--accent); }
.gw-table { width: 100%; border-collapse: collapse; font-size: 14px; background: var(--paper); }
.gw-table th { text-align: left; font-weight: 600; font-size: 12.5px; letter-spacing: .06em; color: var(--muted);
  border-bottom: 1px solid var(--line); padding: 9px 10px; white-space: nowrap; }
.gw-table td { border-bottom: 1px solid var(--line); padding: 11px 10px; vertical-align: top; line-height: 1.75; }
.gw-table tr:last-child td { border-bottom: 0; }
.gw-table .gw-k { white-space: nowrap; font-weight: 600; }
.gw-table .gw-p { white-space: nowrap; color: var(--accent); font-weight: 600; }
.gw-table .gw-t { color: var(--ink2); }
.gw-add { display: block; margin-top: 6px; font-size: 12.5px; color: #8a5a12; background: #fdf6e6;
  border: 1px solid #f0e0bb; border-radius: 6px; padding: 4px 8px; line-height: 1.6; }
.gw-add i { font-style: normal; color: #a88a4a; display: block; font-size: 11.5px; margin-top: 2px; }

/* 矩阵 */
.gw-matrix { margin: 30px 0 0; border-top: 1px solid var(--line); padding-top: 8px; }
.gw-matrix summary { cursor: pointer; font-size: 15px; font-weight: 600; padding: 12px 0; list-style: none; }
.gw-matrix summary::-webkit-details-marker { display: none; }
.gw-matrix summary::before { content: "＋"; color: var(--accent); margin-right: 8px; font-weight: 400; }
.gw-matrix[open] summary::before { content: "－"; }
.gw-matrix .gw-note { font-size: 13px; color: var(--muted); margin: 0 0 12px; line-height: 1.75; }
.gw-mini { font-size: 12.5px; }
.gw-mini th, .gw-mini td { padding: 6px 5px; text-align: center; white-space: nowrap; }
.gw-mini th:first-child, .gw-mini td:first-child { text-align: left; font-weight: 600; }
.gw-mini tbody tr:hover td { background: #f7f8fa; }

/* 说明 */
.gw-notes { margin: 34px 0 0; border-top: 1px solid var(--line); padding-top: 18px; }
.gw-notes h3 { font-size: 14px; margin: 0 0 10px; letter-spacing: .04em; }
.gw-notes ul { margin: 0 0 14px; padding-left: 20px; font-size: 13.5px; color: var(--ink2); line-height: 1.9; }
.gw-notes li b { color: var(--ink); }
.gw-src { font-size: 12.5px; color: var(--muted); line-height: 1.8; }
.gw-src a { color: var(--muted); }

/* 移动端：宫名网格化 + 表格转两行卡片 */
@media (max-width: 720px) {
  .gw-wrap { padding: 0 14px; }
  .gw-hero { padding: 10px 0 14px; margin-bottom: 16px; }
  .gw-hero h1 { font-size: 25px; }
  .gw-hero h1 small { display: block; margin: 6px 0 0; }
  .gw-sub { font-size: 13.5px; line-height: 1.8; }

  /* 12 宫一次全见，不横滑 */
  .gw-tabs { margin-bottom: 12px; }
  .gw-tabdesc { font-size: 12.5px; margin-bottom: 10px; }
  .gw-chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .gw-chip { padding: 9px 2px; font-size: 13.5px; text-align: center; border-radius: 8px; }

  /* 一行「主体 → 宫职／落位」，一行释义 */
  .gw-table thead { display: none; }
  .gw-table, .gw-table tbody { display: block; width: 100%; }
  .gw-table tr { display: flex; flex-wrap: wrap; align-items: baseline;
    column-gap: 8px; border-bottom: 1px solid var(--line); padding: 12px 0; }
  .gw-table td { display: block; border: 0; padding: 0; width: auto; }
  .gw-table .gw-k { flex: 0 0 auto; white-space: nowrap; font-size: 14px; font-weight: 600; color: var(--ink); }
  .gw-table .gw-p { flex: 0 1 auto; text-align: left; white-space: nowrap; font-size: 14px; }
  .gw-table .gw-p::before { content: "→"; color: var(--muted); font-weight: 400; padding-right: 6px; }
  .gw-table .gw-same .gw-p::before { content: "＝"; }
  .gw-table .gw-t { flex: 1 1 100%; margin-top: 5px; font-size: 14px; line-height: 1.8; }
  .gw-add { margin-top: 5px; }

  .gw-mini { display: none; }
  .gw-matrix::after { content: "（矩阵在手机上过宽，已隐藏；请用上方正查／反查）"; display: block; font-size: 12.5px; color: var(--muted); }
  .gw-matrix[open] .gw-scroll { display: none; }
}
