/* ============================================================================
 * 星穹 · 门户大厅布局 v2
 * 变更：装饰层收进 .sky（取消 body overflow，修复 sticky 顶栏消失）
 *       移除侧栏/右栏 sticky（修复卡片重叠）；入口卡片前置到首屏
 * ==========================================================================*/

/* 背景装饰统一容器：内部绝对定位，不产生滚动条 */
.sky { position: fixed; inset: 0; overflow: hidden; z-index: 0; pointer-events: none; }
.sky > * { position: absolute; }

.shell {
  position: relative; z-index: 2;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 26px 56px;
}

/* ---------------- 顶栏 ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 70;
  height: 62px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(5, 8, 19, 0.94), rgba(5, 8, 19, 0.82));
  backdrop-filter: blur(22px) saturate(150%);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  box-shadow: 0 12px 30px -22px rgba(0, 0, 0, .9);
}
.bar-inner {
  max-width: var(--maxw); height: 100%;
  margin: 0 auto; padding: 0 26px;
  display: flex; align-items: center; gap: 14px;
}
.topbar .brand-lock { gap: 10px; flex: none; }
.topbar .brand-lock .name { font-family: var(--font-display); font-size: 16px; letter-spacing: 0.2em; }
.topbar .brand-lock .sub { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.2em; color: var(--text-4); }

.nav-tabs { display: flex; gap: 4px; }
.nav-tabs a {
  display: inline-flex; align-items: center; gap: 7px;
  height: 32px; padding: 0 13px; border-radius: 999px;
  font-size: 12.5px; color: var(--text-3); letter-spacing: 0.04em;
  border: 1px solid transparent;
  transition: all .24s var(--ease);
}
.nav-tabs a:hover { color: var(--text); background: rgba(255,255,255,.05); }
.nav-tabs a.on { color: var(--gold-bright); border-color: rgba(230,197,136,.32); background: rgba(230,197,136,.09); }

.search-trigger {
  display: flex; align-items: center; gap: 9px;
  width: 250px; height: 34px; padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(4, 7, 16, 0.55);
  color: var(--text-4); font-size: 12.5px;
  transition: all .24s var(--ease); flex: none;
}
.search-trigger:hover { border-color: rgba(230,197,136,.4); color: var(--text-3); }
.search-trigger kbd {
  margin-left: auto;
  font-family: var(--font-mono); font-size: 10px;
  padding: 2px 6px; border-radius: 5px;
  border: 1px solid var(--line); color: var(--text-4);
}

.user-badge {
  display: flex; align-items: center; gap: 9px;
  padding: 4px 11px 4px 4px; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(255,255,255,.035);
  transition: all .24s var(--ease); cursor: pointer; flex: none;
}
.user-badge:hover { border-color: rgba(230,197,136,.45); }
.user-badge .n { font-size: 12.5px; }
.user-badge .r { font-family: var(--font-mono); font-size: 9.5px; color: var(--gold); letter-spacing: .06em; }

.bell { position: relative; flex: none; }
.bell .tip {
  position: absolute; top: 3px; right: 3px;
  min-width: 15px; height: 15px; padding: 0 4px;
  border-radius: 999px; background: var(--risk); color: #fff;
  font-size: 9.5px; font-family: var(--font-mono); display: grid; place-items: center;
  box-shadow: 0 0 0 2px rgba(5,8,19,.95);
}

/* ---------------- 顶部信息条（紧凑） ---------------- */
.masthead {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  padding: 14px 20px; margin: 18px 0 0;
}
.masthead .greet { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.masthead .greet h1 {
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(19px, 1.5vw, 24px); letter-spacing: .04em; white-space: nowrap;
}
.masthead .greet h1 em { font-style: normal; color: var(--gold-bright); }
.masthead .greet .tag { font-size: 12px; color: var(--text-3); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.masthead .metrics { display: flex; gap: 22px; margin-left: auto; flex-wrap: wrap; }
.mm { display: flex; align-items: baseline; gap: 6px; }
.mm b { font-family: var(--font-display); font-size: 19px; font-weight: 600; letter-spacing: .02em; }
.mm span { font-size: 11.5px; color: var(--text-3); }
.mm.gold b { color: var(--gold-bright) } .mm.cyan b { color: #86ecec }
.mm.violet b { color: #bcb4ff } .mm.risk b { color: #ff9fae }
.mast-tip {
  flex-basis: 100%; order: 3;
  font-size: 10.5px; color: var(--text-4); letter-spacing: .05em;
  padding-top: 10px; border-top: 1px dashed rgba(158,178,255,.12);
}

/* ---------------- 主栅格 ---------------- */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 312px; gap: 22px; align-items: start; margin-top: 16px; }
.col-main { min-width: 0; }

/* ---------------- 工具条（吸顶） ---------------- */
.toolbar {
  position: sticky; top: 62px; z-index: 50;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px; margin-bottom: 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: rgba(5, 8, 19, 0.9);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}
.pills { display: flex; gap: 5px; overflow-x: auto; scrollbar-width: none; min-width: 0; flex: 1; }
.pills::-webkit-scrollbar { display: none; }
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  height: 30px; padding: 0 12px; flex: none;
  border-radius: 999px; border: 1px solid var(--line);
  background: rgba(255,255,255,.03);
  font-size: 12.5px; color: var(--text-2); letter-spacing: .03em;
  transition: all .22s var(--ease); white-space: nowrap;
}
.pill:hover { color: #fff; border-color: rgba(230,197,136,.4); background: rgba(230,197,136,.07); }
.pill.on { color: #0c0c14; font-weight: 600; border-color: transparent; background: linear-gradient(120deg, var(--gold-bright), var(--gold)); }
.pill .glyph { width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; flex: none; }
.pill .cnt { font-family: var(--font-mono); font-size: 10px; opacity: .72; }

.toolbar .input { height: 32px; width: 210px; flex: none; font-size: 12.5px; }
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 999px; border: 1px solid var(--line); background: rgba(0,0,0,.3); flex: none; }
.seg button { padding: 0 11px; height: 24px; border-radius: 999px; font-size: 11.5px; color: var(--text-3); transition: all .22s var(--ease); display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.seg button:hover { color: var(--text); }
.seg button.on { background: rgba(255,255,255,.1); color: var(--gold-bright); box-shadow: inset 0 0 0 1px rgba(230,197,136,.28); }
.seg.scroll { overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.seg.scroll::-webkit-scrollbar { display: none; }

/* ---------------- 星轨条：全部入口一览 ---------------- */
.strip { display: flex; align-items: center; gap: 14px; padding: 9px 16px 7px; margin-bottom: 14px; }
.strip .lbl { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .2em; color: var(--text-4); text-transform: uppercase; flex: none; line-height: 1.3; }
.strip .lbl b { display: block; font-family: var(--font-sans); font-size: 11px; letter-spacing: .04em; color: var(--text-3); font-weight: 500; text-transform: none; }
.strip-nodes {
  position: relative; flex: 1; min-width: 0;
  display: flex; align-items: flex-start; overflow-x: auto;
  scrollbar-width: none; padding-top: 8px;
}
.strip-nodes::-webkit-scrollbar { display: none; }
.strip-nodes::before {
  content: ''; position: absolute; left: 2px; right: 2px; top: 12px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(158,178,255,.3) 6%, rgba(230,197,136,.4) 50%, rgba(158,178,255,.3) 94%, transparent);
}
.s-node {
  position: relative; flex: 1 0 auto; min-width: 48px;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 0 2px; cursor: pointer;
}
.s-node .dot {
  width: 7px; height: 7px; border-radius: 50%; flex: none;
  transition: transform .24s var(--ease), box-shadow .24s var(--ease);
}
.s-node .t {
  font-family: var(--font-mono); font-size: 9px; color: var(--text-4);
  max-width: 62px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: color .24s var(--ease);
}
.s-node:hover .dot, .s-node.hot .dot { transform: scale(1.45); }
.s-node:hover .t, .s-node.hot .t { color: var(--gold-bright); }
.s-node.locked .dot { opacity: .55 }
.s-node.locked .t { opacity: .7 }
.strip .btn { flex: none; align-self: center; }

/* ---------------- 系统卡片 ---------------- */
.sys-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.sys-card {
  position: relative; overflow: hidden; z-index: 0;
  padding: 18px 18px 15px;
  border-radius: var(--r-lg);
  cursor: pointer;
  transition: transform .38s var(--ease), border-color .38s var(--ease), box-shadow .38s var(--ease);
}
.sys-card::after {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(260px 180px at var(--mx, 50%) var(--my, 0%), rgba(230,197,136,.13), transparent 62%);
  opacity: 0; transition: opacity .4s var(--ease);
}
.sys-card:hover { transform: translateY(-4px); border-color: rgba(230,197,136,.4); box-shadow: var(--shadow-deep), 0 0 44px -18px rgba(230,197,136,.42); }
.sys-card:hover::after { opacity: 1; }
.sys-card .orbit-deco {
  position: absolute; right: -46px; top: -46px; width: 150px; height: 150px; border-radius: 50%;
  border: 1px dashed rgba(158,178,255,.16); opacity: .6; transition: all .6s var(--ease); pointer-events: none;
}
.sys-card:hover .orbit-deco { transform: rotate(40deg) scale(1.08); border-color: rgba(230,197,136,.34); }

.sys-head { display: flex; align-items: flex-start; gap: 12px; }
.sys-sigil {
  width: 42px; height: 42px; flex: none; border-radius: 14px;
  display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 700; letter-spacing: .04em; color: #fff;
  border: 1px solid rgba(255,255,255,.2);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 10px 26px -14px rgba(0,0,0,.9);
  position: relative;
}
.sys-sigil::after { content: ''; position: absolute; inset: -5px; border-radius: 18px; border: 1px solid rgba(255,255,255,.09); }
.sys-name { font-size: 15px; font-weight: 600; letter-spacing: .02em; line-height: 1.4; }
.sys-host { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-4); margin-top: 3px; }
.sys-note { font-size: 12px; color: var(--text-3); line-height: 1.7; margin: 11px 0; min-height: 20px; }
.sys-foot { display: flex; align-items: center; gap: 8px; padding-top: 12px; margin-top: 4px; border-top: 1px solid rgba(158,178,255,.09); }
.sys-foot .meta-mini { font-family: var(--font-mono); font-size: 10px; color: var(--text-4); }
.star-btn { margin-left: auto; }
.star-btn.on { color: var(--gold-bright); }
.star-btn.on svg { fill: var(--gold); }

.sys-card.locked { opacity: .78; }
.sys-card.locked .sys-sigil { filter: grayscale(.75) brightness(.72); }
.sys-card.locked:hover { border-color: rgba(255,107,129,.34); }
.lock-flag {
  position: absolute; right: 14px; top: 14px;
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .1em;
  color: var(--text-4);
}
.scopes { display: flex; gap: 4px; }

/* 列表视图 */
.sys-grid.list { grid-template-columns: 1fr; }
.sys-grid.list .sys-card { display: grid; grid-template-columns: auto minmax(0,1.4fr) minmax(0,1fr) auto; align-items: center; gap: 16px; padding: 13px 18px; }
.sys-grid.list .sys-note { margin: 0; }
.sys-grid.list .sys-head .grow { min-width: 0; }
.sys-grid.list .orbit-deco { display: none; }
.sys-grid.list .sys-foot { border-top: 0; padding-top: 0; margin-top: 0; }

/* ---------------- 星图：就地展开（收起时 0 高度，页面不滚动） ---------------- */
.map-slot {
  max-height: 0; opacity: 0; overflow: hidden; margin: 0;
  transition: max-height .5s var(--ease), opacity .35s var(--ease), margin .5s var(--ease);
}
.map-slot.open { max-height: 660px; opacity: 1; margin-bottom: 16px; }
.map-inner { padding: 0 22px 12px; }
/* 入场只做淡入位移、不做缩放：缩放会让 SVG 文字发虚，也会改变 fixed 后代的包含块 */
.map-slot.open .map-inner { animation: mapRise .5s var(--ease) both; }
.map-head { display: flex; align-items: center; gap: 14px; padding: 16px 0 10px; flex-wrap: wrap; }
.map-head h3 { font-family: var(--font-display); font-size: 18px; letter-spacing: .06em; }
.map-head .hint { font-size: 11.5px; color: var(--text-4); }
.map-head .btn { margin-left: auto; }
@keyframes mapRise { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none } }
#star-map { display: block; width: 100%; height: auto; }
#star-map .orbit { fill: none; stroke: rgba(158,178,255,.16); stroke-width: .7; }
#star-map .spoke { stroke: rgba(158,178,255,.12); stroke-width: .6; transition: stroke .3s; }
#star-map .beam { transform-origin: 400px 210px; animation: sweep 24s linear infinite; }
@keyframes sweep { to { transform: rotate(360deg) } }
#star-map .node { cursor: pointer; }
#star-map .node .halo { transition: opacity .3s; opacity: .5; }
#star-map .node text { font-size: 9.5px; font-family: var(--font-sans); fill: var(--text-3); opacity: .5; transition: opacity .25s, fill .25s; }
#star-map .node:hover text, #star-map .node.hot text { opacity: 1; fill: var(--gold-bright); }
#star-map .node:hover .halo, #star-map .node.hot .halo { opacity: 1; }
#star-map .node.locked .core { fill: rgba(234,240,255,.24) }
#star-map .node.locked .halo { opacity: .18 }
#star-map .pulse { animation: pulse 3.4s var(--ease) infinite; }
@keyframes pulse { 0%,100% { opacity: .35 } 50% { opacity: 1 } }
.map-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; padding: 0 0 14px; font-size: 11px; color: var(--text-3); }

/* ---------------- 右栏（不再 sticky） ---------------- */
.rail { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.rail-block { padding: 16px 18px; }
.rail-block h4 { font-size: 13px; font-weight: 600; letter-spacing: .06em; display: flex; align-items: center; gap: 8px; }
.rail-block h4 .ico { color: var(--gold); }
.todo-item { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px dashed rgba(158,178,255,.12); }
.todo-item:last-child { border-bottom: 0; }
.todo-item .tt { font-size: 12.5px; line-height: 1.6; }
.todo-item .tm { font-family: var(--font-mono); font-size: 10px; color: var(--text-4); margin-top: 3px; }
.notice-item { padding: 10px 12px; border-radius: var(--r-md); background: rgba(255,255,255,.03); border-left: 2px solid var(--gold); margin-bottom: 8px; font-size: 12.5px; line-height: 1.7; }
.notice-item.cyan { border-left-color: var(--cyan); } .notice-item.violet { border-left-color: var(--violet); }
.notice-item .tm { font-family: var(--font-mono); font-size: 10px; color: var(--text-4); margin-top: 5px; }
.access-ring { display: grid; place-items: center; padding: 2px 0 6px; }
.mini-tile { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 12px; border: 1px solid transparent; transition: all .22s var(--ease); }
.mini-tile:hover { border-color: rgba(230,197,136,.35); background: rgba(230,197,136,.06); }
.mini-tile .dot { width: 6px; height: 6px; border-radius: 50%; flex: none; }

/* ---------------- 命令面板 / 抽屉 ---------------- */
#palette {
  position: fixed; inset: 0; z-index: 110;
  background: rgba(3, 5, 13, .74);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  display: grid; align-items: start; justify-items: center;
  padding-top: 11vh;
  animation: fadeIn .2s var(--ease);
}
.pal { width: min(680px, 100%); overflow: hidden; animation: rise .34s var(--ease); }
.pal-input { display: flex; align-items: center; gap: 12px; padding: 15px 20px; border-bottom: 1px solid var(--line); }
.pal-input input { flex: 1; background: none; border: 0; outline: none; font-size: 16px; color: var(--text); }
.pal-list { max-height: 52vh; overflow: auto; padding: 8px; }
.pal-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 13px; border-radius: 12px; text-align: left; transition: background .18s; }
.pal-item .sig { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-family: var(--font-mono); font-size: 9.5px; color: #fff; flex: none; }
.pal-item.on, .pal-item:hover { background: rgba(115,103,240,.18); }
.pal-item .t { font-size: 13.5px; }
.pal-item .s { font-family: var(--font-mono); font-size: 10px; color: var(--text-4); }
.pal-foot { display: flex; gap: 18px; padding: 11px 20px; border-top: 1px solid var(--line); font-family: var(--font-mono); font-size: 10px; color: var(--text-4); }

.drawer-meta { display: grid; grid-template-columns: 92px 1fr; gap: 10px 14px; font-size: 12.5px; }
.drawer-meta dt { color: var(--text-4); font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .06em; padding-top: 2px; }
.drawer-meta dd { color: var(--text-2); word-break: break-all; }
.drawer-meta a { color: var(--gold); border-bottom: 1px dashed rgba(230,197,136,.35); }

.empty { padding: 48px 20px; text-align: center; color: var(--text-4); }
.empty .big { font-size: 34px; color: rgba(230,197,136,.35); margin-bottom: 10px; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1180px) {
  .search-trigger { width: 34px; justify-content: center; }
  .search-trigger span:nth-of-type(2), .search-trigger kbd { display: none; }
}
@media (max-width: 1240px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .rail { display: grid; grid-template-columns: repeat(auto-fit, minmax(272px, 1fr)); align-items: start; }
}
@media (max-width: 860px) {
  .shell { padding: 0 14px 40px; }
  .bar-inner { padding: 0 14px; gap: 10px; }
  .nav-tabs, .search-trigger kbd, .search-trigger span:nth-child(2) { display: none; }
  .search-trigger { width: 34px; justify-content: center; }
  .masthead { padding: 12px 14px; }
  .masthead .metrics { width: 100%; margin-left: 0; justify-content: space-between; gap: 12px; }
  .mm b { font-size: 17px }
  .toolbar { top: 62px; }
  .sys-grid { grid-template-columns: 1fr; }
  .strip { padding: 8px 12px; }
  .strip .lbl { display: none; }
}
