.tongxing-screen {
  --tongxing-frame: var(--page-frame);
  --tongxing-gold: var(--color-announcement-text);
  --tongxing-muted-frame: var(--color-announcement-border);
  /* 開始搜尋按鈕的黑金底層；金色光暈、星點與底光由 styles.css 的共用 CTA 規則提供。 */
  --tongxing-search-base: linear-gradient(105deg, rgb(79 50 5 / 20%), rgb(6 13 18 / 92%) 42%, rgb(103 67 8 / 20%)), #060d12;
  --tongxing-divider: color-mix(in srgb, var(--tongxing-gold) 38%, transparent);
  --tongxing-radius: var(--radius);
  --tongxing-gap: 14px;
  --tongxing-control-gap: 6px;
  --tongxing-control-height: 26px;
  --tongxing-header-height: 68px;
  --tongxing-row-height: 30px;
  --tongxing-inline: var(--page-inline);
  /* Tap areas grow past the 26px controls without moving them. Between the two rows and above the search button each
     side takes 3px of the 8px gap, leaving 2px untouched; the first row reaches 7px up into the form padding instead. */
  --tongxing-hit-up: 3px;
  --tongxing-hit-down: 3px;
  position: relative;
}
/* Before the first search the empty area under the settings card carries a faint brand mark; it never takes space
   or input, and it leaves as soon as the result body (loading, results or error) is shown. */
.tongxing-screen:has(> .tongxing-body[hidden])::after { position: absolute; inset: 0; background: url("./assets/lpa-orbital-logo-v1.png") center 66% / min(52%, 220px) auto no-repeat; opacity: .07; pointer-events: none; content: ""; }
/* The header is the shared page header (page-ui.mjs); only the floating settings card and the toggle are tongxing-specific. */
.tongxing-screen .page-brand-header[data-floating="true"] { height: var(--tongxing-header-height); }
.tongxing-screen .page-brand-header[data-floating="true"] .page-brand-card { position: absolute; top: 0; inset-inline: calc(var(--tongxing-inline) + var(--safe-inline-start)) calc(var(--tongxing-inline) + var(--safe-inline-end)); box-shadow: 0 12px 24px rgb(0 0 0 / 45%); }
/* The settings block keeps its own divider, so the shared settings slot draws none. */
.tongxing-screen .page-header-settings { border-top: 0; }
.tongxing-settings-toggle { display: inline-flex; width: var(--page-header-action-width); height: 24px; padding: 2px; align-items: center; justify-content: center; gap: 2px; position: relative; border: 0; border-radius: var(--radius-sm); background: transparent; color: #c9ac70; font-size: 12px; font-weight: 700; line-height: 1; white-space: nowrap; cursor: pointer; }
/* The 24px toggle takes taps from the header artwork above it, up to the 44px target; the header frame clips the rest. */
.tongxing-settings-toggle::after { position: absolute; inset: calc(24px - var(--target-size)) 0 0; content: ""; }
.tongxing-settings-toggle svg { width: 12px; height: 12px; flex: 0 0 12px; }
.tongxing-settings-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.tongxing-settings-toggle { transition: scale var(--control-press-duration) ease-out, color var(--motion-fast); }
.tongxing-settings-toggle:active { color: #ad915b; scale: var(--control-press-scale); }
.tongxing-settings-content { max-height: calc(100vh - var(--tongxing-header-height) - var(--nav-height) - env(safe-area-inset-bottom, 0px) - env(safe-area-inset-top, 0px) - 8px); max-height: calc(100dvh - var(--tongxing-header-height) - var(--nav-height) - env(safe-area-inset-bottom, 0px) - env(safe-area-inset-top, 0px) - 8px); overflow-x: hidden; overflow-y: auto; overscroll-behavior-y: contain; border-top: 1px solid var(--tongxing-divider); }
.tongxing-query { width: 100%; min-width: 0; margin: 0; padding: 8px; font-family: var(--font-ui-tc); }
.tongxing-query-selects { --tongxing-hit-up: 7px; display: grid; min-width: 0; margin-bottom: 8px; grid-template-columns: minmax(0, .85fr) minmax(0, 1.65fr); gap: var(--tongxing-control-gap); }
.tongxing-select { position: relative; display: flex; isolation: isolate; width: 100%; min-width: 0; height: var(--tongxing-control-height); padding: 0; align-items: center; border: 1px solid var(--tongxing-muted-frame); border-radius: var(--tongxing-radius); background: var(--color-background); }
.tongxing-select:focus-within { border-color: var(--tongxing-frame); }
.tongxing-select button { position: relative; z-index: 1; display: flex; width: 100%; min-width: 0; height: 100%; padding: 0 28px 0 10px; align-items: center; justify-content: center; border: 0; outline: 0; background: transparent; color: var(--color-secondary); font: inherit; font-size: clamp(9px, 3vw, 12px); font-weight: 600; text-align: center; cursor: pointer; }
/* The trigger sits inside the 1px frame, so each offset adds that pixel. */
.tongxing-select button::after { position: absolute; inset: calc(-1px - var(--tongxing-hit-up)) -1px calc(-1px - var(--tongxing-hit-down)); content: ""; }
.tongxing-select:has(button:focus-visible) { border-color: var(--tongxing-gold); outline: 1px solid rgb(212 162 56 / 45%); outline-offset: 1px; }
.tongxing-select-value { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tongxing-select svg { position: absolute; right: 12px; width: 18px; height: 18px; pointer-events: none; color: var(--tongxing-gold); }
.tongxing-select[data-field="numberOrder"] button { padding-inline: 8px 24px; }
.tongxing-select[data-field="futureOffset"] { min-width: 66px; }
.tongxing-select[data-field="futureOffset"] button { padding: 0 22px 0 6px; }
/* 選項清單共用設定視窗的元件，這裡只給同星頁的尺寸與黑金配色。 */
.tongxing-select-popup {
  --status-popup-border: var(--tongxing-muted-frame);
  --status-popup-surface: var(--color-background);
  --status-control-radius: var(--tongxing-radius);
  --status-popup-padding: 3px;
  --status-popup-row-gap: 2px;
  --status-popup-option-gap: 6px;
  --status-popup-indicator-size: 8px;
  --status-popup-option-height: var(--status-popup-trigger-height, var(--tongxing-control-height));
  --status-popup-font-size: clamp(11px, 3.2vw, 12px);
  --status-popup-line-height: 1.4;
  --status-text: var(--color-text);
  --status-muted: var(--color-secondary);
  --repeat-selected-text: var(--tongxing-gold);
  --repeat-selected-fill: color-mix(in srgb, var(--tongxing-gold) 8%, var(--color-background));
  --repeat-selected-border: color-mix(in srgb, var(--tongxing-gold) 55%, var(--color-background));
}
.tongxing-select[data-field="futureOffset"] svg { right: 5px; width: 14px; height: 14px; }
.tongxing-fields { display: grid; width: 100%; min-width: 0; margin: 0 0 8px; grid-template-columns: repeat(3, minmax(0, .8fr)) max-content minmax(66px, 1.15fr) max-content; gap: var(--tongxing-control-gap); align-items: center; }
.tongxing-fields > * { min-width: 0; }
/* Each number field sits in a label whose tap area extends above and below the field; the field keeps its size. */
.tongxing-number { position: relative; display: block; }
.tongxing-number::after { position: absolute; inset: calc(-1 * var(--tongxing-hit-up)) 0 calc(-1 * var(--tongxing-hit-down)); content: ""; }
.tongxing-number input { position: relative; z-index: 1; }
.tongxing-fields input { width: 100%; height: var(--tongxing-control-height); padding: 0 3px; border: 1px solid var(--tongxing-muted-frame); border-radius: var(--tongxing-radius); outline: none; background: var(--color-background); color: var(--color-text); font-family: inherit; font-size: clamp(15px, 4.5vw, 18px); font-weight: 600; line-height: var(--tongxing-control-height); font-variant-numeric: tabular-nums; text-align: center; }
.tongxing-fields input::placeholder { color: var(--color-secondary); opacity: 1; }
.tongxing-fields input:focus-visible { border-color: var(--tongxing-gold); outline: 1px solid rgb(212 162 56 / 45%); outline-offset: 1px; }
.tongxing-fields > span { color: #d5cec2; font-size: clamp(10px, 3.2vw, 13px); font-weight: 600; line-height: 20px; white-space: nowrap; }
.tongxing-search { display: flex; width: 100%; height: 36px; padding: 0 6px; align-items: center; justify-content: center; gap: 10px; background: var(--cta-glow), var(--tongxing-search-base); font-size: clamp(14px, 4.6vw, 18px); font-weight: 600; letter-spacing: 1px; cursor: pointer; }
.tongxing-search > svg { width: 20px; height: 20px; }
.tongxing-body { display: flex; min-width: 0; padding-inline: calc(var(--tongxing-inline) + var(--safe-inline-start)) calc(var(--tongxing-inline) + var(--safe-inline-end)); flex-direction: column; gap: var(--tongxing-gap); }
.tongxing-result-heading { display: flex; margin: 0; align-items: center; justify-content: center; gap: 13px; color: #ddd6ca; font-size: 18px; font-weight: 600; line-height: 24px; }
.tongxing-result-heading span { flex: 1; height: 1px; background: #6f5121; }
.tongxing-results { width: 100%; min-width: 0; scroll-margin-bottom: var(--tongxing-gap); }
.tongxing-status { margin: 1em 0; overflow-wrap: anywhere; }
.tongxing-error { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tongxing-retry { padding: 4px 12px; min-height: 32px; border: 1px solid var(--tongxing-muted-frame); border-radius: var(--tongxing-radius); background: var(--color-background); color: var(--tongxing-gold); cursor: pointer; }
.tongxing-table { --tongxing-columns: minmax(58px, 1.65fr) repeat(5, minmax(0, 1fr)); --tongxing-number-size: clamp(13px, calc(3.6vw + 2px), 17px); --tongxing-column-size: clamp(9px, 3.1vw, 12px); --tongxing-issue-size: clamp(11px, 3.2vw, 12.5px); display: flex; width: 100%; min-width: 0; flex-direction: column; font-variant-numeric: tabular-nums; }
.tongxing-table[data-columns="7"] { --tongxing-columns: minmax(clamp(56px, 17.5vw, 68px), 1.9fr) repeat(7, minmax(0, 1fr)); --tongxing-number-size: clamp(11.5px, calc(3vw + 2px), 15px); --tongxing-column-size: clamp(8px, 2.65vw, 10.5px); --tongxing-issue-size: clamp(10px, 3vw, 12px); }
.tongxing-table-row { display: grid; width: 100%; min-width: 0; grid-template-columns: var(--tongxing-columns); align-items: stretch; text-align: center; }
.tongxing-table-row > span { display: flex; min-width: 0; min-height: var(--tongxing-row-height); align-items: center; justify-content: center; border-left: 1px solid var(--tongxing-divider); color: #f2eee7; font-size: var(--tongxing-number-size); font-weight: 500; font-variant-numeric: tabular-nums; }
.tongxing-table-row > span:first-child { border-left: 0; }
.tongxing-table-head { min-height: 26px; overflow: hidden; border: 1px solid var(--tongxing-muted-frame); border-radius: var(--tongxing-radius); background: rgb(104 73 23 / 12%); }
.tongxing-table-head > span { min-height: 26px; color: #d8aa39; font-size: var(--tongxing-column-size); font-weight: 700; }
.tongxing-result-group { display: block; flex: 0 0 auto; margin-top: 6px; overflow: hidden; border: 1px solid var(--tongxing-muted-frame); border-radius: var(--tongxing-radius); background: #030b13; }
.tongxing-table-row[data-row-type="locked"] { background: rgb(126 83 15 / 32%); }
.tongxing-table-row[data-row-type="predicted"] { border-top: 1px solid var(--tongxing-divider); background: rgb(10 61 88 / 38%); }
.tongxing-table-row > .tongxing-period-cell { display: grid; min-height: var(--tongxing-row-height); padding: 1px 2px; grid-template-rows: auto auto; align-content: center; gap: 0; }
.tongxing-table[data-columns="7"] .tongxing-period-cell { padding-inline: 1px; }
.tongxing-period-cell strong { color: #e4c44e; font-size: var(--tongxing-issue-size); font-weight: 700; line-height: 14px; white-space: nowrap; }
.tongxing-period-cell time { color: #aaa49a; font-size: clamp(8.5px, 2.5vw, 9.5px); font-weight: 400; line-height: 11px; white-space: nowrap; }
.tongxing-table-row[data-row-type="predicted"] .tongxing-period-cell strong { color: #78bfe3; }
.tongxing-table-row > .locked-input-number { color: #ef5b58; font-size: clamp(14px, calc(3.6vw + 2px), 16px); font-weight: 700; }
.tongxing-table[data-columns="7"] .locked-input-number { font-size: var(--tongxing-number-size); }
@media (hover: hover) { .tongxing-settings-toggle:hover { color: var(--color-selected); } }
@media (forced-colors: active) {
  .tongxing-select, .tongxing-fields input, .tongxing-search, .tongxing-result-group, .tongxing-table-head, .tongxing-select-popup { border-color: ButtonText; }
  .tongxing-search::before, .tongxing-search::after { display: none; }
}

/* Raised controls and unified press feedback (2026-11-10): the settings card, selects and number fields get the shared
   top light and soft bottom shadow; the search button keeps its glow and presses firmer, like the dialogs' primary actions. */
.tongxing-screen .page-brand-card { box-shadow: var(--control-relief-shadow); }
.tongxing-select, .tongxing-fields input { box-shadow: var(--control-relief); }
.tongxing-search { transition: scale var(--control-press-duration) ease-out, filter var(--motion-fast); }
.tongxing-search:not(:disabled):active {
  border-top-width: var(--key-sink-primary);
  border-bottom-width: calc(var(--key-lip-primary) - var(--key-sink-primary));
  box-shadow: inset 0 0 0 1px var(--key-frame), var(--cta-shadow-inner), var(--key-primary-pressed-shadow);
  scale: var(--control-press-strong-scale);
  filter: brightness(.85);
}
.tongxing-screen .tongxing-search:disabled { border-bottom-color: transparent; box-shadow: inset 0 0 0 1px var(--key-frame), var(--cta-shadow-inner); }
@media (prefers-reduced-motion: reduce) {
  .tongxing-settings-toggle:active, .tongxing-search:not(:disabled):active { scale: 1; }
}

/* 同星版路依標題卡鋼藍色延伸：標題卡金框不動，設定控制項邊框改混色金、開始探索加藍色反光；結果表維持原本黑金。 */
.tongxing-screen .page-brand-card { background: var(--lpa-page-bg); }
.tongxing-screen .tongxing-settings-content { border-top-color: color-mix(in srgb, var(--tongxing-divider) 80%, var(--lpa-page-sheen)); }
.tongxing-screen :is(.tongxing-select, .tongxing-fields input) {
  border-color: var(--lpa-page-frame-muted);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--lpa-page-sheen) 5%, transparent), transparent 45%),
    var(--color-background);
}
/* 開始探索是主要按鍵（styles.css --key-*）：金框改畫成內側 1px 線，厚邊是下框，從原本 36px 高度扣出，按鈕外框不動。 */
.tongxing-screen .tongxing-search {
  --key-frame: var(--cta-border);
  border: 0 solid transparent;
  border-bottom: var(--key-lip-primary) solid var(--key-lip-color);
  border-radius: var(--key-primary-radius);
  background:
    radial-gradient(ellipse 70% 90% at 50% -30%, color-mix(in srgb, var(--lpa-page-sheen) 22%, transparent), transparent 70%),
    var(--cta-glow),
    var(--tongxing-search-base);
  background-clip: padding-box;
  box-shadow: inset 0 0 0 1px var(--key-frame), var(--cta-shadow-inner), inset 0 1px 0 var(--lpa-page-sheen-faint), var(--cta-shadow-outer), 0 0 14px var(--lpa-page-sheen-faint), var(--key-primary-shadow);
}
@media (forced-colors: active) { .tongxing-screen .tongxing-search { border: 1px solid ButtonText; } }

/* 清單選項改為兩欄：圓點固定在左緣，文字在剩餘欄位內置中，各列名稱中心對齊、不隨文字長短漂移。 */
.status-multiselect-popup.tongxing-select-popup button { display: grid; grid-template-columns: var(--status-popup-indicator-size) minmax(0, 1fr); column-gap: 10px; align-items: center; padding-inline: 8px 6px; }
.status-multiselect-popup.tongxing-select-popup .status-multiselect-label { text-align: center; }
/* 期數清單：圓點｜數字（置中）｜期（固定靠右），三欄上下對齊。 */
.status-multiselect-popup.tongxing-select-popup-futureOffset button { column-gap: 8px; }
.tongxing-select-popup-futureOffset .status-multiselect-label { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 2px; align-items: baseline; }
.tongxing-select-popup-futureOffset .tongxing-offset-value { text-align: center; font-variant-numeric: tabular-nums; }
.tongxing-select-popup-futureOffset .tongxing-offset-unit { text-align: left; }
