/* Persistent application frame. Domain styles remain page-owned. */
#forge-app{min-height:100dvh;min-width:0}
#forge-app>.site-header{display:flex;align-items:center;height:52px;min-height:52px;position:relative;z-index:25;border-bottom:1px solid var(--ui-line-strong)}
.forge-route-content,[data-router-page]{min-width:0}
.forge-route-content>[data-router-page]{min-height:calc(100dvh - var(--ui-shell-header-h,52px))}
[data-router-page][aria-busy="true"]{cursor:progress}
[data-route-error]{padding:24px;white-space:pre-wrap;color:var(--ui-danger);max-width:960px}
/* Shared fallback for any 3D viewport whose WebGL context could not be created or was lost.
   Reused across pages via site/webgl-support.ts's showWebglNotice and room-editor-canvas.tsx. */
.webgl-unavailable-notice{position:absolute;inset:12px;width:fit-content;height:fit-content;max-width:calc(100% - 24px);margin:auto;padding:12px;background:var(--ui-bg-menu);color:var(--ui-fg-1);border:1px solid var(--ui-line-strong);border-radius:var(--ui-radius-control);box-shadow:var(--ui-shadow-e2);line-height:1.5;font-size:var(--ui-text-ui-sm);text-align:center;z-index:2}
.site-mobile-brand{display:none}
body[data-page="map"] #map-app{height:calc(100dvh - var(--ui-shell-header-h,52px))}
body[data-page="map"] #forge-app>.site-header{display:flex}
[data-router-page="library"] .workbench{height:calc(100dvh - var(--ui-shell-header-h,52px))}
.library-toolbar{display:none}
@media(max-width:760px){
 #forge-app>.site-header{height:auto;min-height:92px}
 .site-mobile-brand{display:inline-flex}
 .library-toolbar{display:block;position:absolute;right:12px;top:calc(52px + 4px);z-index:26}
 [data-router-page="library"][data-browse-open="true"] #catalogue{display:flex;position:fixed;inset:var(--ui-shell-header-h,92px) 0 0;z-index:23;background:var(--ui-bg-panel)}
 [data-router-page="library"] .workbench{height:auto;min-height:calc(100dvh - var(--ui-shell-header-h,92px))}
 body[data-page="map"] #map-app{height:calc(100dvh - var(--ui-shell-header-h,92px))}
}

/* Phase 5 P0：全站按钮/链接的悬停上浮（transform:translateY(-1px)）与亮度滤镜
   （filter:brightness(1.07)）已删除（.local/p5/design-system.md §7、§14）。悬停只换底色，
   由组件自己的状态样式负责。The global hover lift and brightness filter are gone; hover is a
   background change a component draws for itself. */

/* Shared shell controls previously loaded from the compatibility sheet. */
[hidden] { display:none !important; }
html { font-family:var(--ui-font-sans); }

.settings-content { min-height:calc(100dvh - var(--ui-shell-header-h, 52px)); }
html[data-reduced-motion="true"] *,html[data-reduced-motion="true"] *::before,html[data-reduced-motion="true"] *::after { animation-duration:0.01ms !important; animation-iteration-count:1 !important; transition-duration:0.01ms !important; scroll-behavior:auto !important; }


/* ============================================================================
   共享组件层 — 分组标题 / 面板头 / 字段标签 / 成组卡片 / 悬停放大预览
   全是新增类名，不与既有页面样式冲突；页面逐步改用它们。
   ========================================================================= */

/* 分组标题：13px / 600 / 主文本色 + 2px 琥珀前导条。扫视时先看到组，再看到项。 */
.forge-group-title {
  display:flex; align-items:center; gap:7px;
  font-size:var(--ui-text-ui-sm); font-weight:600; color:var(--ui-fg-1); letter-spacing:.01em;
  margin:16px 0 8px;
}
.forge-group-title::before { content:''; flex:none; width:2px; height:13px; border-radius:2px; background:var(--ui-accent-ink); }
.forge-group-title .forge-group-count { margin-left:auto; font-family:var(--ui-font-mono); font-size:var(--ui-text-eyebrow); font-weight:400; color:var(--ui-fg-3); font-variant-numeric:tabular-nums; }
.forge-group-rule { height:1px; background:var(--ui-line-strong); margin:0 0 12px; }

/* 面板骨架：标题行固定在滚动区域之外，滚动只发生在主体里。
   关闭按钮是标题行里的一格，所以标题、徽标、滚动条与按钮在任何宽度下都不会重叠。 */
.forge-pane { display:flex; flex-direction:column; min-height:0; min-width:0; }
.forge-pane > .forge-pane-head { flex:none; }
.forge-pane > .forge-pane-body { flex:1 1 auto; min-height:0; overflow-y:auto; overflow-x:hidden; overscroll-behavior:contain; }
.forge-pane-head .forge-pane-close { flex:none; display:grid; place-items:center; }
.forge-pane-head > .forge-pane-close { margin-left:auto; }
.forge-pane-head > .forge-pane-meta + .forge-pane-close { margin-left:4px; }

/* 面板头：全站同一形态 —— 固定高度、组标题、右侧元信息 */
.forge-pane-head {
  display:flex; align-items:center; gap:8px;
  height:var(--ui-control-h); flex:none; padding:0 12px 0 13px;
  border-bottom:1px solid var(--ui-line-strong); background:var(--ui-bg-raised);
  font-size:var(--ui-text-ui-sm); font-weight:600; color:var(--ui-fg-1); position:relative;
}
.forge-pane-head::before { content:''; position:absolute; left:0; top:8px; bottom:8px; width:2px; border-radius:0 2px 2px 0; background:var(--ui-accent-ink); }
.forge-pane-head .forge-pane-meta { margin-left:auto; font-family:var(--ui-font-mono); font-size:var(--ui-text-eyebrow); font-weight:400; color:var(--ui-fg-3); font-variant-numeric:tabular-nums; }

/* 字段标签：12px / 500 / --ui-fg-2。11px 等宽大写只留给机器标识。 */
.forge-field-label { display:block; font-size:var(--ui-text-label); font-weight:500; color:var(--ui-fg-2); margin-bottom:5px; }
.forge-code-label { font-family:var(--ui-font-mono); font-size:var(--ui-text-eyebrow); letter-spacing:.08em; text-transform:uppercase; color:var(--ui-fg-3); }

/* 成组卡片：用形状表达"这几项是一组" */
.forge-group-box { border:1px solid var(--ui-line-strong); border-radius:var(--ui-radius-control); background:var(--ui-bg-raised); box-shadow:inset 0 1px 0 var(--ui-edge-hair); overflow:hidden; }
.forge-group-box > .forge-group-title { margin:0; padding:8px 12px; border-bottom:1px solid var(--ui-line-strong); }
.forge-group-box > .forge-group-body { padding:12px; display:grid; gap:12px; }
