/* 四档统一门户外壳 · 档位条（tier-nav.css）
   橙果客物理实验室 | 卡片 t_6c47605a · 2026-10-01
   —— 唯一源：/data/workspace/physlab-cn/shell/tier-nav.css，四档目录下为同一份拷贝，勿分叉。
   令牌策略：优先复用宿主页面已定义的 CSS 变量（高中·初中档 = Vite 应用主题 --panel/--ink/...），
            宿主未定义时回落到应用「清新 cool」主题同名值，保证四档观感完全一致。 */

:root { --cg-shell-h: 44px; }

.cg-shell {
  position: relative; z-index: 70;
  display: flex; align-items: center; gap: 12px;
  height: var(--cg-shell-h); padding: 0 20px;
  background: var(--panel, #ffffff);
  border-bottom: 1px solid var(--line, #d7dde3);
  color: var(--ink, #1a1e23);
  font-family: var(--font, "HarmonyOS Sans SC", "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", "Hiragino Sans GB", sans-serif);
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}
.cg-shell * { box-sizing: border-box; }

.cg-shell__brand { display: inline-flex; align-items: center; gap: 8px; min-width: 0; color: inherit; text-decoration: none; }
.cg-shell__mark {
  flex: none; width: 22px; height: 22px; border-radius: 6px;
  background: var(--green, #2f8f56); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}
.cg-shell__name { font-size: 14px; font-weight: 650; letter-spacing: .2px; white-space: nowrap; }
.cg-shell__sub { font-size: 12px; color: var(--muted-ink, #6b757f); white-space: nowrap; }
.cg-shell__sub::before { content: "·"; margin-right: 6px; }

.cg-shell__tiers { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.cg-tier {
  display: inline-flex; align-items: center; justify-content: center;
  height: 28px; padding: 0 15px;
  border: 1px solid var(--line, #d7dde3); border-radius: var(--radius-sm, 6px);
  background: transparent; color: var(--muted-ink, #6b757f);
  font-size: 13px; line-height: 1; white-space: nowrap; text-decoration: none; cursor: pointer;
  transition: all .15s;
}
.cg-tier:hover { border-color: var(--green, #2f8f56); color: var(--green, #2f8f56); }
.cg-tier.is-active {
  background: var(--green-soft, #e6f3ea);
  border-color: var(--green, #2f8f56);
  color: var(--green, #2f8f56);
  font-weight: 600;
}
/* 未就绪档（大学 / 竞赛）：琥珀色小点 = 建设中，标题说明状态；仍指向真实占位页，不留空链接 */
.cg-tier[data-soon] { position: relative; }
.cg-tier[data-soon]::after {
  content: ""; position: absolute; top: -3px; right: -3px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--amber, #b8801f);
  box-shadow: 0 0 0 2px var(--panel, #ffffff);
}

/* —— 深色宿主顶栏适配（--cg-shell-bg 由脚本按宿主顶栏实测色注入）——
   竞档原型 /physlab-cn/ 自带 navy 渐变顶栏；此处让档位条取同一底色，避免"白条压深栏"的两截观感。 */
.cg-shell--dark {
  background: var(--cg-shell-bg, #24324a);
  border-bottom-color: rgba(255, 255, 255, .16);
  color: #fff;
}
.cg-shell--dark .cg-shell__sub { color: rgba(255, 255, 255, .62); }
.cg-shell--dark .cg-tier {
  border-color: rgba(255, 255, 255, .24); background: rgba(255, 255, 255, .06); color: rgba(255, 255, 255, .86);
}
.cg-shell--dark .cg-tier:hover { border-color: #fff; color: #fff; background: rgba(255, 255, 255, .16); }
.cg-shell--dark .cg-tier.is-active {
  background: rgba(255, 255, 255, .95); border-color: rgba(255, 255, 255, .95); color: #16202f;
}
.cg-shell--dark .cg-tier[data-soon]::after { box-shadow: 0 0 0 2px var(--cg-shell-bg, #24324a); }

/* —— 布局让位：档位条占据文档流 44px，宿主应用整体下移，避免遮挡其顶栏/侧栏品牌区 —— */
body.cg-shelled #root { height: calc(100% - var(--cg-shell-h)); }
body.cg-shelled #root > .app { height: 100%; }

/* 移动端：侧栏抽屉上边界让出档位条，避免抽屉品牌区被压住 */
@media (max-width: 720px) {
  body.cg-shelled #root > .app > .sidebar { top: var(--cg-shell-h); height: auto; }
}

/* 窄屏收缩：只保留四个档位药丸 + 徽标 */
@media (max-width: 720px) {
  .cg-shell { padding: 0 12px; gap: 8px; }
  .cg-shell__sub { display: none; }
  .cg-shell__name { font-size: 13px; }
  .cg-tier { height: 26px; padding: 0 10px; font-size: 12.5px; }
  .cg-shell__tiers { gap: 6px; }
}
@media (max-width: 430px) {
  .cg-shell__name { display: none; }
}
