/* GRAM//CONSENSUS：版式与颜色由共享主题提供；这里只放本页自己的东西：舞台指针、琥珀色候选态手柄、读数的颜色角色、
   侧栏的格拉姆热图与控制面板的小标题。颜色只来自令牌（var(--cyan) …），不写色值。 */
#stageWrap { container-type: inline-size; }
/* 只有活舞台接管指针；静态图（封面、引用图）让触摸直接滚过 */
.stage:not(.still) #stage { cursor: grab; touch-action: none; }
.stage:not(.still) #stage:active { cursor: grabbing; }
.stage.still #stage { 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, #plotTitle, #plotMeta, #schurTitle, #schurMeta, .tau, .gram-head, #gramCaption { text-transform: none; }
.hud-tl .sub { line-height: 1.4; }

/* 候选态 x 的手柄：舞台上 x 投影处的琥珀圆环；它是按钮，所以拖它不会转动相机 */
.handle { position: absolute; z-index: 3; width: 30px; height: 30px; padding: 0; margin: 0; border: 2px solid var(--amber); border-radius: 50%;
  background: color-mix(in srgb, var(--amber) 12%, transparent); transform: translate(-50%, -50%); cursor: grab; touch-action: none;
  user-select: none; -webkit-user-select: none; box-shadow: 0 0 10px color-mix(in srgb, var(--amber) 55%, transparent); }
.handle:active, .handle.dragging { cursor: grabbing; background: color-mix(in srgb, var(--amber) 28%, transparent); }
.handle[hidden] { display: none; }
.stage.still .handle { pointer-events: none; }
:root[data-thumb-mode] .handle { display: none; }

/* 控制面板：小标题、按钮组与遗忘按钮 */
#ctlPanel .ctl-label { font-size: 12.5px; color: var(--ink); margin: 10px 0 5px; }
#ctlPanel .chips { gap: 5px; }
#ctlPanel .forget { display: block; width: 100%; margin: 10px 0 2px; text-align: center; }
#ctlPanel .forget:not(:disabled) { border-color: var(--magenta); color: var(--magenta); }
#ctlPanel .forget:not(:disabled):hover { background: color-mix(in srgb, var(--magenta) 16%, transparent); }

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

/* 读数按角色着色：青 = 走廊与内积，品红 = 遗忘的重开，紫 = 共识，琥珀 = 当前的候选态 */
dl.ro .v dd { color: var(--violet); }
dl.ro .key dd output { color: var(--cyan); }
dl.ro dd output { font: inherit; color: inherit; }

/* 侧栏的格拉姆热图：点一个格子读出那一对记录的内积 */
.gram { margin-top: 10px; }
.gram-head { font-family: var(--font-data); font-size: 11px; color: var(--dim); margin-bottom: 4px; }
#gramMap { display: block; width: 100%; height: 196px; cursor: crosshair; }
#gramCaption { min-height: 2.6em; margin-top: 4px; }

/* 图例色块 */
.sw.ring { width: 10px; height: 10px; border-radius: 50%; background: transparent; border: 2px solid var(--amber); }

/* 舞台标签保留大小写（v₁、x、Ω、δ） */
.stage .tag.raw { text-transform: none; }
.stage .tag.c-vi { color: var(--violet); }
.stage .tag.c-am { color: var(--amber); }
.stage .tag.c-cy { color: var(--cyan); }
.stage .tag.c-mg { color: var(--magenta); }

@container (max-width: 620px) {
  .hud-tr { gap: 3px; }
  .hud-tr .chip { padding: 3px 6px; font-size: 9.5px; letter-spacing: 0.03em; }
  .hud-tl { left: 12px; max-width: calc(100% - 24px); }
  .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; }
}

/* 单栏的整页（窄窗口、短屏）：给球面一个更高的舞台，页面照常向下滚动 */
@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; }
}
/* 手机：同上 */
@media (max-width: 520px) {
  :root:not([data-embed]):not([data-thumb-mode]):not([data-shot]) .lab .center { grid-template-rows: minmax(min-content, max(480px, 66vh)) auto auto; }
}
