/* OMEGA//UNIFY-BRIDGE：版式与颜色由共享主题提供（三栏实验室 .app.lab 不改）；这里只放本页自己的东西：舞台的尺寸容器、
   舞台指针、琥珀手柄、右栏的理论按钮、双透镜开关与按卡显示的旋钮组、巡览条里的时钟与镜像透镜按钮、读数与舞台标签的
   颜色角色、无公理的 LEAN ✓ 小标、抽屉里克隆的依据框，以及用短横画出的卦符。
   颜色只来自令牌（var(--cyan) …），不写色值。琥珀只留给当前选择：激活的卡片、透镜的激活半段、按下的旋钮与可拖手柄；
   文字强调改用青色，舞台标题用 sigma。OPEN 的颜色只在依据栏里，LEAN ✓ 的颜色只给依据框，
   无公理令牌（--tr-axiom-free）只标锁文件里不依赖任何公理的 LEAN ✓。 */

/* 舞台是尺寸容器：舞台上的标题、按钮与图例按舞台自己的宽和高收紧，不随页面 */
#stage { container-type: size; container-name: stage; }
/* 只有活舞台接管指针；静态图（封面、引用图）让触摸直接滚过 */
.stage:not(.still) #cv { cursor: grab; touch-action: none; }
.stage:not(.still) #cv:active { cursor: grabbing; }
.stage.still #cv { cursor: default; touch-action: auto; }

.logo span { color: var(--cyan); font-weight: 700; }
.tagline em, .sheet li b { color: var(--cyan); }
.hud-tl .big { color: var(--sigma); }
.hud-tl .big, .hud-tl .sub, .strip .head h2, .strip .head span, .tau, .preset .code { text-transform: none; }
.hud-tl .sub { line-height: 1.4; }
/* 舞台标题里的读数、右栏读数里的“关系号 + 数”留在同一行 */
.hud-tl .nb, #readouts .nb { white-space: nowrap; }
/* ‖、𝔸 与 ℤ 在正文字体里落到后备字形，用数据字体写 */
.nm { font-family: var(--font-data); font-weight: 400; }

/* 卦符：三条横线自上而下，阳爻是一整条，阴爻是中间断开的两段；颜色跟随文字 */
.tri { display: inline-flex; flex-direction: column; justify-content: space-between; width: 0.95em; height: 0.78em; margin: 0 0.24em 0 0.04em; vertical-align: -0.02em; }
.tri > span { display: flex; gap: 0.2em; height: 0.15em; }
.tri > span::before { content: ""; flex: 1; background: currentColor; }
.tri > span.n::after { content: ""; flex: 1; background: currentColor; }

/* 舞台右上角的动作按钮（下一站、下一个 m、下一拍、下一道门）：普通按钮，不是当前选择 */
.hud-tr .chip { text-transform: none; }
.hud-tr .chip[hidden] { display: none; }
.stage.still .hud-tr { display: none; }

/* 右栏：理论按钮在最上面，然后是双透镜与本卡的旋钮、读数与依据 */
.side > #infoBtn { flex: none; align-self: stretch; text-align: center; padding: 7px 9px; }
#ctlPanel .grp[hidden] { display: none; }
.ctl { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin: 0 0 8px; }
.ctl .lab { flex: 1 0 100%; font-size: 12px; color: var(--dim); }
.ctl .chips { margin: 0; flex-wrap: wrap; gap: 4px; }
.ctl .chip { text-transform: none; letter-spacing: 0; padding: 4px 7px; line-height: 1.3; }
.ctl .tri-chips .chip { display: inline-flex; align-items: center; }
/* 按下的旋钮是当前选择：琥珀 */
.ctl .chip[aria-pressed="true"] { background: var(--amber); border-color: var(--amber); color: var(--on-accent); box-shadow: var(--glow-amber); }

/* 双透镜开关：上段是 OmegaMath 零公理几何与整除门，下段是跨账本投影与统一红线（MODEL）；当前选中的一段用琥珀。
   右栏较窄，两段上下排列 */
.lens-toggle { display: flex; flex-direction: column; width: 100%; margin: 0 0 10px; padding: 0; border: 1px solid var(--line-hot);
  background: none; cursor: pointer; font: inherit; color: var(--ink); }
.lens-toggle .seg { flex: 1 1 auto; min-width: 0; padding: 7px 8px; font-size: 11.5px; line-height: 1.35; text-align: left; color: var(--dim); overflow-wrap: anywhere; }
.lens-toggle .seg.on { border-top: 1px solid var(--line-hot); }
.lens-toggle[aria-pressed="false"] .seg.off, .lens-toggle[aria-pressed="true"] .seg.on { background: var(--amber); color: var(--on-accent); font-weight: 600; }
.lens-toggle:hover { border-color: var(--cyan); }
.lens-toggle:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

/* 舞台上的手柄：当前的量；它是按钮，所以拖它不会转动相机。淡琥珀填充是一层不透明度 12%（拖动时 28%）的纯琥珀 */
.handle { position: absolute; z-index: 3; width: 30px; height: 30px; padding: 0; margin: 0; border: 2px solid var(--amber); border-radius: 50%;
  background: none; transform: translate(-50%, -50%); cursor: grab; touch-action: none;
  user-select: none; -webkit-user-select: none; box-shadow: var(--glow-amber); }
.handle::before { content: ""; position: absolute; inset: 0; border-radius: inherit; background: var(--amber); opacity: 0.12; pointer-events: none; }
.handle:active, .handle.dragging { cursor: grabbing; }
.handle:active::before, .handle.dragging::before { opacity: 0.28; }
.handle:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }
.handle[hidden] { display: none; }
.stage.still .handle { pointer-events: none; }
:root[data-thumb-mode] .handle, :root[data-shot] .handle { display: none; }

/* 巡览条：◀ 与（引用图里）⏮ ▷ 在左，卡名居中，▶ 在右。时钟按钮只在被引用的图里出现，那里时间轴不再重复它们 */
.tour .tour-l { grid-column: 1; grid-row: 1; display: flex; gap: 4px; }
.tour .tour-clock { display: none; }
:root[data-embed][data-figure] .tour .tour-clock { display: inline-grid; }
:root[data-embed][data-figure] footer.rail #rew, :root[data-embed][data-figure] footer.rail #play { display: none; }
/* 手机与窄窗口的整页、以及正文里嵌入的完整实验室：双透镜开关所在的右栏排在舞台之后很远，所以巡览条里放一个
   镜像的透镜按钮。桌面整页、被引用的图（[data-figure]）、封面与截图都不显示它 */
.tour .tour-lens { display: none; }
@media (max-width: 1080px) {
  :root:not([data-figure]):not([data-thumb-mode]):not([data-shot]) .tour .tour-lens { display: inline-grid; place-items: center; padding: 0 8px; white-space: nowrap; }
}
:root[data-embed]:not([data-figure]):not([data-thumb-mode]):not([data-shot]) .tour .tour-lens { display: inline-grid; place-items: center; padding: 0 8px; white-space: nowrap; }
/* 窄的引用图（手机上的正文）：卡名需要整行宽度，时钟按钮回到时间轴 */
@media (max-width: 480px) {
  :root[data-embed][data-figure] .tour .tour-clock { display: none; }
  :root[data-embed][data-figure] footer.rail #rew, :root[data-embed][data-figure] footer.rail #play { display: inline-grid; }
}

/* 时间轴右侧：一行提示、一行公式 */
.keys #hint, .keys #formula { display: block; }
.keys #formula { font-family: var(--font-data); color: var(--ink); font-size: 10.5px; margin-top: 2px; }

/* 读数按角色着色：青 = 一倍的测地量与整数落点，品红 = 放大的误差、分母税与被挡住的门，紫 = 旋子、壳与证书，墨 = 账本；
   主读数用 sigma。琥珀只给当前选择与可拖手柄 */
dl.ro .v dd { color: var(--violet); }
dl.ro .c dd { color: var(--cyan); }
dl.ro .m dd { color: var(--magenta); }
dl.ro .i dd { color: var(--ink); }
dl.ro .key dd output { color: var(--sigma); }
dl.ro dd output { font: inherit; color: inherit; overflow-wrap: anywhere; }
dl.ro dt { text-transform: none; }

/* 依据栏：前六条 LEAN ✓ 在锁文件里不依赖任何公理，整枚徽章与框线改用无公理令牌，徽章写作“LEAN ✓ · 无公理”。
   窄的右栏里“无公理”另起一行；抽屉里宽，排在同一行 */
.lean .ok:has(.af) { color: var(--tr-axiom-free, var(--ok)); }
.lean:has(.ok .af) { border-color: color-mix(in srgb, var(--tr-axiom-free, var(--ok)) 45%, var(--void)); }
#basis .lean .ok .af { display: block; }
#basis .lean .ok .af .sep { display: none; }
/* 依据栏的 MODEL 框：共享主题给它琥珀色，本页的琥珀只留给当前选择，所以 MODEL 改用中性的墨色
   （徽章用墨色，边框用主题的 --line-hot 线色）；类名照旧是标准的 .lean.model */
.lean.model { border-color: var(--line-hot); }
.lean.model .ok { color: var(--ink); }

/* 抽屉：说明之后附上依据栏的全部依据框（启动时克隆） */
.drawer-evidence { margin-top: 14px; display: flex; flex-direction: column; gap: 6px; max-width: 68ch; }
.drawer-evidence:empty { display: none; }

/* 舞台标签保留大小写（κ、ψ、q₁）；颜色只用这几种角色 */
.stage .tag.raw { text-transform: none; text-align: center; }
.stage .tag.c-vi { color: var(--violet); }
.stage .tag.c-cy { color: var(--cyan); }
.stage .tag.c-mg { color: var(--magenta); }
.stage .tag.c-ik { color: var(--ink); }
.stage .tag.c-am { color: var(--amber); }

/* 宽舞台：标题块给右上角的动作按钮留出位置 */
@container stage (min-width: 621px) { .hud-tl { max-width: calc(100% - 190px); } }

@container stage (max-width: 620px) {
  .hud-tl { left: 12px; max-width: calc(100% - 24px); }
  .hud-tr { right: 12px; }
  .hud-tl .big { font-size: 12px; }
  .hud-tl .sub { font-size: 10.5px; line-height: 1.35; }
  .hud-bl { left: 12px; right: 12px; bottom: 9px; gap: 2px 10px; font-size: 10px; }
  .stage .tag.raw { font-size: 10.5px; }
  .handle { width: 26px; height: 26px; }
}
/* 矮舞台（书里的引用图、短屏）：标题一行一句，图例更紧，舞台中间留给画面 */
@container stage (max-height: 420px) {
  .hud-tl { top: 9px; }
  .hud-tl .big { font-size: 11.5px; }
  .hud-tl .sub { font-size: 10px; line-height: 1.3; }
  .hud-tr { top: 8px; }
  .hud-bl { bottom: 7px; gap: 1px 9px; font-size: 9.5px; }
}

/* 正文里嵌入的完整实验室（?embed=1，不带 preset）：条带随内容长高，它排在舞台与巡览条之后，第一屏不受影响 */
:root[data-embed]:not([data-figure]) .lab .strip { height: auto; }

/* 桌面整页与宽于 1080px 的完整实验室嵌入：条带随标题长高，小图的画布至少留 132px */
@media (min-width: 1081px) {
  :root:not([data-embed]):not([data-thumb-mode]):not([data-shot]) .lab .strip { height: auto; }
  :root:not([data-embed]):not([data-thumb-mode]):not([data-shot]) .lab .strip canvas,
  :root[data-embed]:not([data-figure]) .lab .strip canvas { flex: 1 0 132px; min-height: 132px; }
}

/* 单栏的整页（窄窗口、短屏）：给舞台一个更高的高度，页面照常向下滚动 */
@media (max-width: 1080px) {
  :root:not([data-embed]):not([data-thumb-mode]):not([data-shot]) .lab .center { grid-template-rows: minmax(min-content, max(460px, 66vh)) auto auto; }
}
/* 手机：舞台仍至少 440px，整条巡览条（连同镜像的透镜按钮与一句话说明）留在 390 × 844 的第一屏里 */
@media (max-width: 520px) {
  :root:not([data-embed]):not([data-thumb-mode]):not([data-shot]) .lab .center { grid-template-rows: minmax(min-content, max(440px, 56vh)) auto auto; }
  /* 顶栏药丸里的名字可以折行，不把页面撑宽 */
  .status .pill { white-space: normal; }
  /* 手机上依据框的徽章浮在正文左侧，正文占满整行 */
  #basis .lean { display: block; }
  #basis .lean .ok { float: left; margin-right: 8px; }
}

/* 共轭的横线：q̄、h̄ 的组合横线在多数字体里落错位置，用贴着字母顶的细边框代替；行高取 1，横线不漂进上一行 */
.ob { display: inline-block; line-height: 1; vertical-align: baseline; border-top: 1px solid currentColor; padding-top: 0.04em; }
