/* 通玄 TONGXUAN · 太乙盘面补全层（2026-11-12）：就地步进条 / 盘面标注 / 命法十二宫 / 时空与起局卡
   配 assets/js/taiyi-extra.js。标注件恒在 DOM，由 #ssBoard.ty-mark-on 控显隐（缺省关，盘面与此前同）。 */

/* —— 工具条：步进 + 标注开关 —— */
.ty-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; margin: 0 0 2px; }
.ty-step { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.ty-bar-cap { font-size: 12.5px; letter-spacing: 0.12em; color: var(--paper-ink-soft); }
.ty-bar .select-line.ty-step-unit { width: auto; min-width: 108px; min-height: 36px; padding-top: 4px; padding-bottom: 4px; }
.ty-bar .ss-chip { min-height: 36px; padding: 6px 14px; font-size: 13px; cursor: pointer; color: var(--paper-ink); font-family: inherit; }
.ty-bar .ss-chip:hover { transform: none; }
.ty-mark-toggle { margin-left: auto; }

/* —— 盘面标注：缺省全隐 —— */
.ty-fy, .ty-marks, .ty-links, .ty-after { display: none; }
.ty-life .ty-marks { display: flex; }
.ty-grid { position: relative; }
.ty-mark-on .ty-fy { display: block; margin-top: 4px; font-style: normal; font-size: 11px; letter-spacing: 0; line-height: 1.5; color: var(--paper-ink-soft); }
.ty-mark-on .ty-marks { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 5px; }
.ty-mark-on .ty-after { display: block; }
.ty-mark-on .ty-links { display: block; position: absolute; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.ty-mk {
  display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%;
  font-style: normal; font-size: 11px; line-height: 1; color: #fff8e6; background: #6a4e17;
}
.ty-mk-zhu { background: #7a5c1e; }
.ty-mk-ke { background: #2f5d86; }
.ty-mk-mid { background: #5f574b; }
.ty-mk-soft { background: #7a7062; }
.ty-mk-bad { background: #8f2a1f; }
/* 八正宫按气淡染（叠在纸底之上，极淡不压字） */
.ty-mark-on .ss-t16-cell.ty-qi-jueyang { background-image: linear-gradient(rgba(160, 58, 44, 0.09), rgba(160, 58, 44, 0.09)); }
.ty-mark-on .ss-t16-cell.ty-qi-jueyin { background-image: linear-gradient(rgba(47, 93, 134, 0.1), rgba(47, 93, 134, 0.1)); }
.ty-mark-on .ss-t16-cell.ty-qi-jueqi { background-image: linear-gradient(rgba(95, 87, 75, 0.1), rgba(95, 87, 75, 0.1)); }
.ty-mark-on .ss-t16-cell.ty-qi-yiqi { background-image: linear-gradient(rgba(184, 145, 75, 0.14), rgba(184, 145, 75, 0.14)); }
.ty-mark-on .ss-t16-cell.ty-qi-he { background-image: linear-gradient(rgba(47, 107, 58, 0.09), rgba(47, 107, 58, 0.09)); }
.ty-mark-on .ss-t16-cell[data-pos] { cursor: pointer; }
.ty-mark-on .ss-t16-cell[data-pos]:focus-visible { outline: 2px solid #b8914b; outline-offset: 1px; }
.ty-mark-on .ss-t16-cell.ty-picked { border-color: #7a5c1e; box-shadow: inset 0 0 0 2px rgba(184, 145, 75, 0.55); }
.ty-mark-on .ss-t16-cell.ty-geju-ring { outline: 2px dashed #a03a2c; outline-offset: -4px; }
/* 对宫成格的长线要穿过中宫：让中宫压在连线之上，线只在两端格位与格缝间露出，不划过中宫文字 */
.ty-mark-on .ty-links { z-index: 1; }
.ty-mark-on .ty-grid > .ss-t16-center { position: relative; z-index: 2; }
.ty-link { stroke: #a03a2c; stroke-width: 2; stroke-dasharray: 4 3; opacity: 0.75; fill: none; }
.ty-link.dui { stroke-dasharray: 9 5; }

/* 图例 + 信息条 */
.ty-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin: 0; font-size: 12px; letter-spacing: 0.06em; color: var(--paper-ink-soft); }
.ty-legend-item { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.ty-legend-line { display: inline-block; width: 22px; height: 0; border-top: 2px dashed #a03a2c; }
.ty-legend-hint { margin-left: auto; font-size: 11.5px; }
.ty-info {
  margin-top: 8px; padding: 12px 14px; border-radius: 10px;
  background: rgba(255, 250, 236, 0.96); border: 1px solid rgba(184, 145, 75, 0.6);
}
.ty-info-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 0 0 6px; }
.ty-info-head b { font-family: var(--font-serif); font-size: 15px; letter-spacing: 0.08em; color: #7a5c1e; }
.ty-info-role { font-style: normal; font-size: 11px; line-height: 1.7; padding: 0 7px; border-radius: 999px; background: #634814; color: #fff8e6; }
.ty-info-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; margin: 0 0 4px; font-size: 13px; line-height: 1.7; color: var(--paper-ink); }
.ty-info-row b { flex: none; min-width: 64px; font-weight: 500; font-size: 12.5px; letter-spacing: 0.06em; color: var(--paper-ink-soft); }
.ty-info-row span { flex: 1 1 180px; min-width: 0; word-break: break-word; }

/* —— 圆盘（同一份十六宫布的同心环画法；缺省方盘） —— */
.ty-round { display: none; }
.ty-round-on .ty-round { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 4px 0 8px; }
.ty-round-on .ty-grid, .ty-round-on .ty-after, .ty-round-on .ty-mark-toggle { display: none !important; }
.ty-round-toggle { margin-left: auto; }
.ty-round-toggle + .ty-mark-toggle { margin-left: 0; }
.ty-round-svg { display: block; width: 100%; max-width: 720px; min-width: 620px; height: auto; margin: 0 auto; font-family: var(--font-serif); }
.ty-r-bg { fill: #fffcf3; stroke: none; }
.ty-r-at { fill: #a03a2c; fill-opacity: 0.09; stroke: none; }
.ty-r-line { fill: none; stroke: #b8914b; stroke-opacity: 0.6; stroke-width: 1.2; }
.ty-r-line.strong { stroke-opacity: 0.9; stroke-width: 2; }
.ty-r-t { fill: #2c2a24; stroke: none; }
.ty-r-num { fill: #806024; }
.ty-r-pos { fill: #6b6455; }
.ty-r-pos.zheng { fill: #2c2a24; font-weight: 600; }
.ty-r-fixed { fill: #6b6455; }
.ty-r-item.key { fill: #6a4e17; font-weight: 600; }
.ty-r-item.taiyi { fill: #a03a2c; font-weight: 700; }

/* —— 命法十二宫 —— */
.ty-life { display: flex; flex-direction: column; gap: 8px; }
.ty-life-cell { display: flex; flex-direction: column; }
.ty-life-cell .ss-cell-head { flex-wrap: wrap; justify-content: space-between; }
.ty-life-cell .ss-cell-head span { white-space: nowrap; }
.ty-life-cell.mark-ming .ss-cell-head span, .ty-life-cell.ty-life-shen .ss-cell-head span { color: #7a5c1e; font-weight: 600; }
.ty-life-cell.ty-life-shen:not(.mark-ming) { border-color: rgba(184, 145, 75, 0.7); background: rgba(255, 250, 236, 0.92); }
.ty-life-items { display: flex; flex-wrap: wrap; gap: 3px; margin: 0; }
.ty-life-marks { justify-content: flex-end; gap: 3px; margin-top: auto; padding-top: 5px; }
.ty-life-legend .ty-legend-item { color: var(--paper-ink-soft); }

/* —— 概览卡：与断法卡同形，占整行 —— */
.ty-ov-card { grid-column: 1 / -1; }
.ty-ov-card { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 24px; }
.ty-ov-card > i { grid-column: 1 / -1; }

@media (max-width: 720px) {
  .ty-bar { gap: 8px; }
  .ty-step { width: 100%; flex-wrap: nowrap; gap: 6px; }
  .ty-bar-cap { display: none; }                       /* 下拉自述「每步一时辰」，手机省掉题签 */
  .ty-bar .select-line.ty-step-unit { flex: 1 1 0; min-width: 0; }
  .ty-step .ss-chip { flex: none; padding-left: 10px; padding-right: 10px; white-space: nowrap; }
  .ty-mark-toggle { margin-left: 0; }
  .ty-round-toggle { margin-left: 0; }
  .ty-mark-on .ty-fy { display: none; }              /* 手机格窄：门州气只在信息条里出 */
  .ty-mk { width: 17px; height: 17px; }
  .ty-legend-hint { margin-left: 0; width: 100%; }
  .ty-ov-card { grid-template-columns: minmax(0, 1fr); }
  .ty-life-grid { gap: 4px; }
  .ty-life-cell { min-height: 74px; padding: 6px 5px 5px; }
  .ty-life-cell .ss-cell-head { gap: 2px 4px; margin-bottom: 4px; }
  .ty-life-cell .ss-cell-head b { font-size: 13px; letter-spacing: 0.02em; }
  .ty-life-cell .ss-cell-head span { font-size: 11px; letter-spacing: 0; }
  .ty-life-center .ss-c-wide { display: none; }
}

/* —— 太乙断法五卡（2026-11-13 ui-c）：两列五卡末行孤卡（风游）横跨两列，免右下大空 —— */
.ss-duan-grid > .ss-duan-card:last-child:nth-child(odd) { grid-column: 1 / -1; }

/* —— 手机首屏起式（2026-11-13 ui-c）：太乙档起式钮曾在 870px ——
   只收太乙专属件与「太乙在显」时的问事帖（以 #ssTaiyiMode 显隐为准，别的数术不受波及）：
   两式 chip 并排一行（各自两行字）、帖头眉题收字距免折行、问事框收成两行高。 */
@media (max-width: 720px) {
  #ssTaiyiMode:not([hidden]) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
  #ssTaiyiMode .ss-chip { min-width: 0; padding: 6px 8px; font-size: 13px; line-height: 1.4; letter-spacing: 0.04em; white-space: normal; text-align: center; }
  body:has(#ssTaiyiMode:not([hidden])) .ss-form .geng-head-tag { letter-spacing: 0.22em; text-indent: 0.22em; gap: 10px; }
  body:has(#ssTaiyiMode:not([hidden])) .ss-form .geng-head-tag::before,
  body:has(#ssTaiyiMode:not([hidden])) .ss-form .geng-head-tag::after { width: 22px; }
  body:has(#ssTaiyiMode:not([hidden])) #ssQuestion { min-height: 64px; height: 64px; }
}

/* —— 袖中天（xiu）皮：金褐转紫 —— */
html[data-theme="xiu"] .ty-info { border-color: rgba(88, 74, 133, 0.45); background: rgba(250, 248, 255, 0.96); }
html[data-theme="xiu"] .ty-info-head b,
html[data-theme="xiu"] .ty-life-cell.mark-ming .ss-cell-head span, html[data-theme="xiu"] .ty-life-cell.ty-life-shen .ss-cell-head span { color: var(--zi-700, #584a85); }
html[data-theme="xiu"] .ty-info-role { background: rgba(88, 74, 133, 0.88); color: #fff8e6; }
html[data-theme="xiu"] .ty-mk-zhu { background: var(--zi-700, #584a85); }
html[data-theme="xiu"] .ty-mark-on .ss-t16-cell.ty-picked { border-color: var(--zi-700, #584a85); box-shadow: inset 0 0 0 2px rgba(122, 104, 176, 0.5); }
html[data-theme="xiu"] .ty-mark-on .ss-t16-cell[data-pos]:focus-visible { outline-color: var(--zi-500, #7f6fae); }
html[data-theme="xiu"] .ty-mark-on .ss-t16-cell.ty-qi-yiqi { background-image: linear-gradient(rgba(122, 104, 176, 0.12), rgba(122, 104, 176, 0.12)); }
html[data-theme="xiu"] .ty-life-cell.ty-life-shen:not(.mark-ming) { border-color: rgba(122, 104, 176, 0.6); background: rgba(250, 248, 255, 0.92); }

html[data-theme="xiu"] .ty-r-bg { fill: #fbfaff; }
html[data-theme="xiu"] .ty-r-line { stroke: #7f6fae; }
html[data-theme="xiu"] .ty-r-num, html[data-theme="xiu"] .ty-r-item.key { fill: #584a85; }

@media print {
  .ty-bar, .ty-legend-hint { display: none !important; }
  .ty-round-on .ty-round { overflow: visible; break-inside: avoid; }
  .ty-round-svg { min-width: 0; max-width: 560px; }
  .ty-r-bg { fill: #fff; }
  .ty-info, .ty-life-cell { break-inside: avoid; background: #fff !important; box-shadow: none; }
  .ty-mk { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* 触屏块须居文末（同优先级后源反杀，G18h） */
@media (pointer: coarse) {
  .ty-bar .ss-chip { min-height: 44px; }
  .ty-bar .select-line.ty-step-unit { min-height: 44px; font-size: 16px; }
}
