@import './lpa-core-source.css';
@font-face { font-family: 'LPA Core Roboto'; font-style: normal; font-weight: 500; font-display: swap; src: url('./assets/core/roboto-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'LPA Core Roboto'; font-style: normal; font-weight: 700; font-display: swap; src: url('./assets/core/roboto-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'LPA Core Roboto'; font-style: normal; font-weight: 900; font-display: swap; src: url('./assets/core/roboto-latin-900-normal.woff2') format('woff2'); }

/* LPA differences stay separate from the unchanged Lecai reference files. */
.lpa-core-screen {
  --layout-bottom-nav-clearance: 8px;
  --core-algorithm-switcher-height: 36px;
  --core-algorithm-label-gap: 3px;
  --page-header-subtitle-tracking: normal;
  /* The ported source carries its own 8px frame radius; here it follows the app token. */
  --home-frame-radius: var(--radius);
  /* Panel frames use the muted gold of unselected controls, so the bright gold stays reserved for selected states. */
  --core-panel-frame: var(--pwa-frame-tertiary);
  /* Tap height of the 21px option buttons; their painted box is untouched. Rows are at least 15px apart (320px
     screens, where the 版路類型 buttons drop under their label), so 6px on each side keeps neighbouring areas at
     least 3px apart, and a button that wraps to two lines simply stops extending. */
  --core-hit-height: 33px;
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top, 0px);
}
.lpa-core-screen .panel { border-color: var(--core-panel-frame); }
.lpa-core-screen .advanced-row { border-top-color: var(--core-panel-frame); }
/* 開始探索按鈕與同星、筆記本的金色按鈕同一個圓角（移植來源為 9px），並且是主要按鍵（styles.css --key-*）：金框改畫成
   內側 1px 線，厚邊是下框，從原高度扣出，按鈕外框與上下元件都不動。 */
.lpa-core-screen .branded-explore-action {
  --key-frame: var(--cta-border);
  padding-block: calc(.25rem - (var(--key-lip-primary) - 2px) / 2);
  border: 0 solid transparent;
  border-bottom: var(--key-lip-primary) solid var(--key-lip-color);
  border-radius: var(--key-primary-radius);
  background-clip: padding-box;
  box-shadow: inset 0 0 0 1px var(--key-frame), var(--cta-shadow-inner), var(--cta-shadow-outer), var(--key-primary-shadow);
}
/* 位置標籤比結果號碼低一階：結果號碼維持亮金，標籤用一般金。 */
.lpa-core-screen .road-results .tag { color: var(--color-gold); }
/* Compact option buttons take taps above and below their painted box; nothing moves and no two areas overlap.
   同碼 and 驗證篩選 keep the ported source's own 44px area (its ::before). The area stays centred on the whole key (face
   and lip): the pseudo-element is placed from the face, so the lip is added back below and the key's sink
   (--core-key-sink, while held or selected) back above. */
.lpa-core-screen .repeat-stats-heading button[data-action="same-code"]::before, .lpa-core-screen .result-title .consecutive-filter-button::before { top: calc(50% + var(--key-lip-option) / 2 - var(--core-key-sink, 0px)); }
.lpa-core-screen :is(.segmented button, .hit-options button)::after { position: absolute; inset: min(calc(-1 * var(--core-key-sink, 0px)), calc((100% + var(--key-lip-option) - var(--core-hit-height)) / 2 - var(--core-key-sink, 0px))) 0 min(calc(var(--core-key-sink, 0px) - var(--key-lip-option)), calc((100% - var(--key-lip-option) - var(--core-hit-height)) / 2 + var(--core-key-sink, 0px))); content: ""; }
/* The filter options only reach down, over the non-interactive column header, clear of 驗證篩選's area above them. */
.lpa-core-screen .explore-consecutive-filter-option { position: relative; }
.lpa-core-screen .explore-consecutive-filter-option::after { position: absolute; inset: 0 0 calc(-9px - var(--key-lip-option)); content: ""; }
/* Until a result list is shown (before the first query, while loading, on an error and when nothing matches) the
   empty area under the content carries a faint brand mark. The screen is a column and the mark is its last item,
   taking only the room left: it adds no height, takes no input and never sits under a message. It stays clear of the
   bottom edge by 8% of the screen (as before), shrinks to the room left and is not drawn at all below 96px. */
.lpa-core-screen:not(:has(.road-results-head))::after { --core-mark-inset: clamp(24px, (100dvh - var(--nav-height)) * .08, 64px); min-height: 0; flex: 1 1 0; background: url("./assets/lpa-orbital-logo-v1.png") center bottom var(--core-mark-inset) / auto clamp(0px, (100% - var(--core-mark-inset) - 96px) * 999, min(150px, 100% - var(--core-mark-inset))) no-repeat; opacity: .07; pointer-events: none; content: ""; }
.lpa-core-screen .core-algorithm-name { display: block; }
.lpa-core-screen .core-algorithm-code {
  display: block;
  font-family: 'LPA Core Roboto', sans-serif;
  font-size: .625em;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  letter-spacing: 0;
  word-spacing: -.075em;
  white-space: pre;
}
.lpa-core-screen > .feature-body { padding-inline: calc(var(--layout-page-inline) - 3px + var(--safe-inline-start)) calc(var(--layout-page-inline) - 3px + var(--safe-inline-end)); }
.lpa-core-screen .core-results-host { display: contents; }
/* Lecai 3a167e3: the 第N顆 gap is shared by every algorithm, 複驗 included; the pinned source still excludes it. */
.lpa-core-screen.matrix-tianyan-screen .explore-validation-formula-position { display: inline-flex; align-items: baseline; gap: 1px; }
.lpa-core-screen .core-results-host > :not(.result-panel) { width: auto; margin-inline: 3px; }
.lpa-core-screen .core-results-host > .result-panel { align-self: center; width: 100%; }
/* A filter change keeps the shown list in place while the next answer is fetched; only the list dims meanwhile. */
.lpa-core-screen .road-results[aria-busy="true"] { opacity: .5; transition: opacity var(--motion-fast) ease-out; }
.lpa-core-screen .core-availability { margin-block: 0; padding: 3px 6px; color: var(--color-secondary); font-size: 12px; line-height: 1.6; }
.lpa-core-screen .core-retry { margin: 0 0 8px; padding: 4px 12px; border: 1px solid var(--pwa-frame-tertiary); border-radius: var(--radius); background: var(--pwa-control-surface); color: var(--pwa-frame-secondary); }
.lpa-core-screen .primary-action:disabled { cursor: not-allowed; opacity: .55; }
.lpa-core-screen .primary-action:disabled::before,
.lpa-core-screen .primary-action:disabled::after { animation: none; }
/* Only tighten gaps when LPA's scrollbar leaves less space than five numbers need. */
.lpa-core-screen .explore-validation-numbers-card { container-type: inline-size; container-name: lpa-core-numbers; }
@container lpa-core-numbers (max-width: 132px) {
  .lpa-core-screen.matrix-tianyan-screen .explore-validation-group[data-wide-numbers="false"] .explore-validation-numbers {
    gap: clamp(0px, calc((100% - 5 * clamp(17px, 4.87vw, 19px) - 4px) / 4), clamp(4px, 1.5vw, 6px));
    padding-inline: 1px;
  }
}
.lpa-core-screen.matrix-tianyan-screen .explore-validation-group[data-wide-numbers="true"],
.lpa-core-screen.matrix-tianyan-screen .explore-validation-groups:has(> .explore-validation-group[data-wide-numbers="true"]) {
  --explore-validation-wide-formula-column: clamp(89px, calc(100vw - 231px), 112px);
}
.lpa-core-screen .explore-validation-formulas { grid-template-columns: minmax(0, 1fr); }
.lpa-core-screen .explore-validation-formula-content {
  display: inline-flex;
  flex: none;
  align-items: baseline;
  width: max-content;
  transform: scale(var(--validation-formula-scale, 1));
}

/* Result rows are graphite instead of the ported navy (#152A42 / #0E1D30), so LPA is told apart from Lecai at a
   glance (user decision 2026-11-17). The ported source sets the navy per screen; :is() outranks each of those rules. */
.lpa-core-screen { --core-result-row: #25282e; --core-result-row-alternate: #181a1f; }
:is(.matrix-status-screen, .matrix-tianyan-screen, .matrix-explore-main-screen:not(.matrix-tianyan-screen):not(.matrix-tiangong-screen))
  .explore-validation-group:nth-child(odd):is(.lpa-core-screen, .lpa-core-screen *) { --explore-validation-group-background: var(--core-result-row); }
:is(.matrix-status-screen, .matrix-tianyan-screen, .matrix-explore-main-screen:not(.matrix-tianyan-screen):not(.matrix-tiangong-screen))
  .explore-validation-group:nth-child(even):is(.lpa-core-screen, .lpa-core-screen *) { --explore-validation-group-background: var(--core-result-row-alternate); }
@media (prefers-reduced-motion: reduce) {
  /* styles.css already stops transitions and smooth scrolling everywhere; Core also stops its animations. */
  .lpa-core-screen *, .lpa-core-screen *::before, .lpa-core-screen *::after { animation: none !important; }
}

/* 演算法專屬配色：保留黑金主體，只用標題卡代表色加一層淡色調與金屬光澤。
   顏色全部由頁面根節點的變數決定，共用規則不重複寫三次。 */
.lpa-core-screen[data-algorithm="tianheng"] {
  /* 深海青金：標題卡青綠 #286573 */
  --lpa-algo-tint: #286573;
  --lpa-algo-sheen: #3fb8b0;
  --lpa-algo-frame: #867959;
  --lpa-algo-marker: linear-gradient(180deg, #ffd755 0%, #d9b24a 42%, #3fa89f 100%);
}
.lpa-core-screen[data-algorithm="tianshu"] {
  /* 曜石紫金：標題卡紫 #4b507b */
  --lpa-algo-tint: #5a4a8a;
  --lpa-algo-sheen: #a98ad8;
  --lpa-algo-frame: #85703e;
  --lpa-algo-marker: linear-gradient(180deg, #ffd755 0%, #d9b24a 42%, #a98ad8 100%);
}
.lpa-core-screen[data-algorithm="tianyan"] {
  /* 暗酒紅鎏金：標題卡酒紅 #744251 */
  --lpa-algo-tint: #8a2e3e;
  --lpa-algo-sheen: #c0414f;
  --lpa-algo-frame: #8a673d;
  --lpa-algo-marker: linear-gradient(180deg, #f6d98c 0%, #e2ab8e 55%, #c97b7f 100%);
}
.lpa-core-screen:is([data-algorithm="tianheng"], [data-algorithm="tianshu"], [data-algorithm="tianyan"]) {
  --lpa-algo-page-bg: color-mix(in srgb, var(--color-background) 91%, var(--lpa-algo-tint));
  --lpa-algo-sheen-soft: color-mix(in srgb, var(--lpa-algo-sheen) 22%, transparent);
  --lpa-algo-sheen-faint: color-mix(in srgb, var(--lpa-algo-sheen) 11%, transparent);
  /* 頁面底色改由 page-ui.css 的容器漸層提供（含固定標題列的頂端色）。 */
  background: transparent;
}
.lpa-core-screen:is([data-algorithm="tianheng"], [data-algorithm="tianshu"], [data-algorithm="tianyan"]) .explore-settings {
  border-color: var(--lpa-algo-frame);
  background:
    linear-gradient(145deg, color-mix(in srgb, rgb(8 16 22 / 96%) 90%, var(--lpa-algo-tint)), color-mix(in srgb, rgb(2 8 13 / 98%) 95%, var(--lpa-algo-tint)));
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, var(--lpa-algo-frame) 28%, transparent),
    inset 0 0 28px var(--lpa-algo-sheen-faint);
}
.lpa-core-screen:is([data-algorithm="tianheng"], [data-algorithm="tianshu"], [data-algorithm="tianyan"]) .section-title > span {
  background: var(--lpa-algo-marker);
  box-shadow: 0 0 6px var(--lpa-algo-sheen-faint);
}
.lpa-core-screen:is([data-algorithm="tianheng"], [data-algorithm="tianshu"], [data-algorithm="tianyan"]) .segmented .segmented-static[data-selected="true"],
.lpa-core-screen:is([data-algorithm="tianheng"], [data-algorithm="tianshu"], [data-algorithm="tianyan"]) .matrix-page-switcher button[aria-current="page"] {
  /* 選中按鈕底色維持原本黑金，專屬色只留在頂緣一條細高光與極淡的邊框色調，避免金字壓在彩色色塊上。 */
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--lpa-algo-sheen) 6%, transparent), transparent 40%),
    var(--pwa-control-selected);
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, var(--lpa-algo-sheen) 24%, transparent),
    inset 0 0 6px color-mix(in srgb, var(--lpa-algo-sheen) 5%, transparent);
}
.lpa-core-screen:is([data-algorithm="tianheng"], [data-algorithm="tianshu"], [data-algorithm="tianyan"]) .segmented .segmented-static[data-selected="true"] {
  border-color: color-mix(in srgb, var(--pwa-frame-secondary) 88%, var(--lpa-algo-sheen));
}
/* The selected option keys take the same tint inside their held-down face (see the option keys below). */
.lpa-core-screen:is([data-algorithm="tianheng"], [data-algorithm="tianshu"], [data-algorithm="tianyan"]) :is(.segmented, .hit-options) button[data-selected="true"] {
  --key-frame: color-mix(in srgb, var(--pwa-frame-secondary) 88%, var(--lpa-algo-sheen));
  background:
    var(--key-option-lip-selected),
    linear-gradient(180deg, color-mix(in srgb, var(--lpa-algo-sheen) 6%, transparent), transparent 40%) padding-box,
    var(--pwa-control-selected) padding-box;
  box-shadow:
    inset 0 0 0 1px var(--key-frame),
    var(--key-pressed-inset),
    inset 0 1px 0 color-mix(in srgb, var(--lpa-algo-sheen) 24%, transparent),
    inset 0 0 6px color-mix(in srgb, var(--lpa-algo-sheen) 5%, transparent);
}
.lpa-core-screen:is([data-algorithm="tianheng"], [data-algorithm="tianshu"], [data-algorithm="tianyan"]) .matrix-page-switcher button[aria-current="page"] {
  border-color: transparent;
}
.lpa-core-screen:is([data-algorithm="tianheng"], [data-algorithm="tianshu"], [data-algorithm="tianyan"]) .branded-explore-action {
  background-image:
    radial-gradient(ellipse 70% 90% at 50% -30%, var(--lpa-algo-sheen-soft), transparent 70%),
    var(--cta-glow),
    linear-gradient(180deg, #17130c 0%, #090805 100%);
  box-shadow:
    inset 0 0 0 1px var(--key-frame),
    var(--cta-shadow-inner),
    inset 0 1px 0 var(--lpa-algo-sheen-faint),
    var(--cta-shadow-outer),
    0 0 14px var(--lpa-algo-sheen-faint),
    var(--key-primary-shadow);
}

/* Raised buttons and unified press feedback (2026-11-10). */
.lpa-core-screen .advanced-row { box-shadow: var(--control-relief); }
/* Option keys (2026-11-12, styles.css --key-*): the setting options, the 驗證篩選 options, the repeat-number filters, 同碼
   and the 驗證篩選 toggle. The frame becomes an inset line, the lip the bottom border inside the existing height
   (painted underneath as well, styles.css --key-option-lip); a selected option is pressed down (a thin painted lip under
   a sunk face) with an inner top shadow. The 驗證篩選 toggle has no selected state: open or closed it stays raised and
   its arrow tells which. */
.lpa-core-screen :is(button[data-setting], [data-streak], [data-number], [data-action="same-code"], .consecutive-filter-button) {
  --key-frame: var(--pwa-frame-tertiary);
  border: 0 solid transparent;
  border-bottom: var(--key-lip-option) solid var(--key-lip-color);
  border-radius: var(--key-option-radius);
  background: var(--key-option-lip), var(--pwa-control-surface) padding-box;
  box-shadow: inset 0 0 0 1px var(--key-frame), var(--control-relief);
}
/* 同碼 and 驗證篩選 are as wide as their label, so the side padding (the ported source's .5rem) gives back the 1px frame
   now drawn inside. */
.lpa-core-screen .repeat-stats-heading button[data-action="same-code"], .lpa-core-screen .result-title .consecutive-filter-button { padding-inline: calc(.5rem + 1px); }
.lpa-core-screen :is(button[data-setting], [data-streak], [data-number], [data-action="same-code"], .consecutive-filter-button):is([data-selected="true"], [aria-pressed="true"]) {
  --key-frame: var(--pwa-frame-secondary);
  --core-key-sink: var(--key-option-selected-sink);
  border-bottom-color: transparent;
  background: var(--key-option-lip-selected), var(--pwa-control-selected) padding-box;
  translate: 0 var(--key-option-selected-sink);
  box-shadow: inset 0 0 0 1px var(--key-frame), var(--key-pressed-inset);
}
/* Unselected labels take the home page's dimmed grey (styles.css --key-raised-text), so the chosen option stands out the
   same way on both pages. The repeat-number keys set their own colours on the number and count, so those follow too. */
.lpa-core-screen .matrix-page-switcher button:not([aria-current="page"]),
.lpa-core-screen :is(button[data-setting], [data-streak], [data-number], [data-action="same-code"], .consecutive-filter-button):not([data-selected="true"], [aria-pressed="true"]),
.lpa-core-screen .result-summary > button:not([data-selected="true"]) :is(b, small) { color: var(--key-raised-text); }
/* A disabled key lies flat, also when it is the selected one. */
.lpa-core-screen :is(button[data-setting], [data-streak], [data-number], [data-action="same-code"], .consecutive-filter-button):disabled { --core-key-sink: 0px; border-bottom-color: transparent; background-size: 0 0, auto; translate: none; box-shadow: inset 0 0 0 1px var(--key-frame); }
/* Bottom borders (the option keys' lip) switch at once, so a sunk key never shows a fading line beneath it. */
.lpa-core-screen button { transition: scale var(--control-press-duration) ease-out, filter var(--motion-fast), background-color var(--motion-fast), border-top-color var(--motion-fast), border-inline-color var(--motion-fast), color var(--motion-fast); }
/* The ported source also scales pressed buttons with transform; only the shared scale applies here. */
.lpa-core-screen button:not(:disabled):active { scale: var(--control-press-scale); transform: none; opacity: 1; }
/* A raised key sinks into its painted lip while held (styles.css --key-option-lip), the same pressed-down look as a
   selected option; a selected option is already down. */
.lpa-core-screen :is(button[data-setting], [data-streak], [data-number], [data-action="same-code"], .consecutive-filter-button):not([data-selected="true"], [aria-pressed="true"], :disabled):active {
  --core-key-sink: var(--key-sink-option);
  border-bottom-color: transparent;
  background-position: left 0 bottom var(--key-sink-option);
  background-size: 100% calc(var(--key-lip-option) - var(--key-sink-option));
  translate: 0 var(--key-sink-option);
  box-shadow: inset 0 0 0 1px var(--key-frame);
}
.lpa-core-screen .branded-explore-action: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);
}
.lpa-core-screen .branded-explore-action:disabled { border-bottom-color: transparent; box-shadow: inset 0 0 0 1px var(--key-frame), var(--cta-shadow-inner); }
@media (forced-colors: active) {
  .lpa-core-screen :is(.branded-explore-action, button[data-setting], [data-streak], [data-number], [data-action="same-code"], .consecutive-filter-button) { border: 1px solid ButtonText; }
}
@media (prefers-reduced-motion: reduce) {
  .lpa-core-screen button:not(:disabled):active { scale: 1; }
}

/* 彩種切換鍵（2026-11-13）：取代設定區的「探勘設定」等字樣，用首頁同一顆彩種按鈕（金框、彩種圖示、3px 厚邊），
   寬度依按鈕圖的比例；按下的下沉與縮放沿用首頁的設定。
   2026-11-14：厚邊畫在按鈕下方，所以按鈕面扣掉厚邊、與分頁頂端對齊，按鈕面加厚邊的總高度才等於右邊的演算法分頁。 */
.lpa-core-screen .core-lottery-switch {
  --home-status-press-depth: var(--key-sink-primary);
  --home-status-press-scale: var(--control-press-scale);
  flex: 0 0 auto;
  align-self: flex-start;
  width: calc((var(--core-algorithm-switcher-height) - var(--key-lip-primary)) * var(--frame-width) / var(--frame-height));
  margin-inline: auto;
}
@media (prefers-reduced-motion: reduce) {
  .lpa-core-screen .core-lottery-switch { --home-status-press-scale: 1; }
}
/* 方案沒有的演算法分頁停用（2026-11-13）：變暗、不能按，滑過與按住不變色。 */
.lpa-core-screen .matrix-page-switcher button:disabled { opacity: .4; cursor: not-allowed; }
.lpa-core-screen .matrix-page-switcher button:disabled:is(:hover, :active) { background-color: transparent; }
