/* ============================================================
   星宸工作台壳 · 顶部导航布局（对照原型 XCStudio 深空金）
   header：品牌 + 横向导航 + 右侧操作簇；下方满屏 iframe 舞台
   ============================================================ */

:root {
  --xc-bg: #f4f1e9;
  --xc-stage: #f4f1e9;
  --xc-header-bg: rgba(255, 255, 255, 0.8);
  --xc-line: rgba(28, 26, 23, 0.16);
  --xc-line-soft: rgba(28, 26, 23, 0.1);
  --xc-line-strong: rgba(28, 26, 23, 0.26);
  --xc-panel: rgba(255, 255, 255, 0.72);
  --xc-text: #26211a;
  --xc-muted: #6b6456;
  --xc-gold: #8a6d1f;
  --xc-gold-3: #9a854e;
  --xc-gold-soft-bg: rgba(138, 109, 31, 0.09);
  --xc-gold-soft-line: rgba(138, 109, 31, 0.38);
  --xc-gold-grad: linear-gradient(135deg, #ecd9a0, #d3ba82);
  --xc-on-gold: #14100a;
  --xc-hover: rgba(28, 26, 23, 0.05);
  --xc-danger: #d46a6a;
  --xc-header-h: 62px;
  --xc-topbar-h: 62px;
  --xc-font: "Space Grotesk", "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  --xc-sidebar-w: 0px;
}

html.theme-dark,
html.studio-theme-dark {
  --xc-bg: #070708;
  --xc-stage: #070708;
  --xc-header-bg: rgba(13, 13, 17, 0.72);
  --xc-line: rgba(255, 255, 255, 0.11);
  --xc-line-soft: rgba(255, 255, 255, 0.075);
  --xc-line-strong: rgba(255, 255, 255, 0.2);
  --xc-panel: rgba(255, 255, 255, 0.04);
  --xc-text: rgba(242, 241, 234, 0.92);
  --xc-muted: rgba(242, 241, 234, 0.6);
  --xc-gold: #f2e3ad;
  --xc-gold-3: #c9b88f;
  --xc-gold-soft-bg: rgba(242, 227, 173, 0.1);
  --xc-gold-soft-line: rgba(242, 227, 173, 0.35);
  --xc-gold-grad: linear-gradient(135deg, #f2e3ad, #dcc899);
  --xc-hover: rgba(255, 255, 255, 0.075);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--xc-bg);
  color: var(--xc-text);
  font-family: var(--xc-font);
  -webkit-font-smoothing: antialiased;
}

html.auth-non-admin .admin-only { display: none !important; }

.xc-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
}

/* ---------- 顶部导航条 ---------- */
.xc-shell {
  padding: 12px 20px 0;
}
.xc-header {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--xc-line);
  border-radius: 16px;
  background: var(--xc-header-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
  position: relative;
  z-index: 30;
  flex-shrink: 0;
  box-sizing: border-box;
}
html.theme-dark .xc-header,
html.studio-theme-dark .xc-header {
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
}

.xc-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
}

.xc-brand-logo-svg { display: block; flex-shrink: 0; }

/* 品牌字标 v2（对照原型：垂直渐变金字；浅色金棕 / 深色奶金） */
.xc-brand-word {
  display: inline-block;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.16em;
  padding-right: 0.18em;
  line-height: 1.1;
  font-family: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: linear-gradient(180deg, #6d5416 10%, #8a6d1f 55%, #a3863e 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
html.theme-dark .xc-brand-word,
html.studio-theme-dark .xc-brand-word {
  background: linear-gradient(180deg, #fbf3dd 10%, #e6cf94 50%, #c9a45e 90%);
  -webkit-background-clip: text;
  background-clip: text;
}

.xc-starlet {
  font-size: 10px;
  color: #8a6d1f;
  margin-left: 1px;
  align-self: flex-start;
  margin-top: 2px;
  filter: drop-shadow(0 0 5px rgba(255, 227, 173, 0.9));
  animation: xcStarTw 2.6s ease-in-out infinite;
}
html.theme-dark .xc-starlet,
html.studio-theme-dark .xc-starlet { color: #fff3cd; }
@keyframes xcStarTw {
  0%, 100% { opacity: 0.55; transform: scale(0.92); }
  50% { opacity: 1; transform: scale(1.06); }
}

.xc-brand-badge {
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--xc-muted);
  border-left: 1px solid var(--xc-line-strong);
  padding-left: 12px;
  margin-left: 2px;
  text-transform: uppercase;
  font-weight: 600;
}

.xc-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 26px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.xc-nav::-webkit-scrollbar { display: none; }

.xc-nav-item {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 0;
  background: transparent;
  color: var(--xc-muted);
  padding: 7px 17px;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-size: 13.5px;
  white-space: nowrap;
  transition: color 0.25s cubic-bezier(0.22, 0.61, 0.36, 1), background 0.25s cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* 原型导航为纯文字 pill，图标保留在 DOM 但隐藏 */
.xc-nav-item svg { display: none; }

.xc-nav-item:hover {
  color: var(--xc-text);
  background: var(--xc-line-soft);
}

.xc-nav-item.is-active {
  color: var(--xc-on-gold);
  background: var(--xc-gold-grad);
  font-weight: 800;
  box-shadow: 0 5px 16px var(--xc-gold-soft-bg);
}
.xc-nav-item.is-active:hover {
  filter: brightness(1.07);
  box-shadow: 0 6px 20px var(--xc-gold-soft-line);
}

/* ---------- 右侧操作簇 ---------- */
.xc-header-actions,
.xc-topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
}

.xc-top-btn {
  border: 1px solid var(--xc-line-soft);
  background: transparent;
  color: var(--xc-muted);
  border-radius: 999px;
  padding: 7px 13px;
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.xc-top-btn:hover {
  color: var(--xc-gold);
  border-color: var(--xc-line);
  background: var(--xc-hover);
}

/* 智能助手 / 黑白模式 · 对照原型 xc-tool：无边框纯文字 pill */
#topbar-agent-btn.xc-tool-agent,
.xc-tool-agent,
#theme-toggle-btn.xc-tool-theme,
#theme-toggle-btn {
  border: 0;
  background: transparent;
  color: var(--xc-muted);
  font-weight: 400;
  padding: 7px 13px;
  border-radius: 999px;
}
.xc-tool-agent:hover,
#theme-toggle-btn:hover {
  border: 0;
  color: var(--xc-text);
  background: var(--xc-line-soft);
}
/* 助手面板展开时的状态反馈（金色文字，无边框） */
#topbar-agent-btn.active,
#topbar-agent-btn.agent-toggle-active {
  background: var(--xc-line-soft);
  color: var(--xc-gold);
  font-weight: 700;
  box-shadow: none;
}

/* 30px 圆形金渐变头像（对照原型：昵称首字 + 深色字） */
#accountBtn.xc-avatar {
  width: 30px;
  height: 30px;
  min-width: 30px;
  padding: 0;
  margin-left: 2px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6b5d3f, var(--xc-gold-3));
  border: 1px solid var(--xc-gold-soft-line);
  color: #0c0b08;
  font-size: 12px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}
#accountBtn.xc-avatar:hover { border-color: var(--xc-gold-3); filter: brightness(1.06); }
#accountBtn.xc-avatar [data-user-name],
#accountBtn.xc-avatar .xc-user-caret { display: none; }
#accountBtn.xc-avatar .xc-user-av {
  background: transparent !important;
  border: 0 !important;
  color: inherit !important;
  font-size: inherit !important;
  font-weight: inherit !important;
  padding: 0 !important;
  width: auto !important;
  height: auto !important;
}

.xc-logout-mini {
  border-color: transparent;
  font-size: 11.5px;
  padding: 7px 9px;
}
.xc-logout-mini:hover { color: var(--xc-danger); }

/* 积分（无边框直排）+ 充值 xc-cta · 对照原型右侧簇 */
.xc-credits {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 4px;
  border: 0;
  background: transparent;
  cursor: pointer;
  color: var(--xc-muted);
  font-size: 12.5px;
  flex-shrink: 0;
}

.xc-credits:hover { color: var(--xc-text); }

.xc-credits strong {
  color: var(--xc-gold);
  font-size: 14px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.xc-credits-team {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
  padding-left: 8px;
  border-left: 1px solid var(--xc-line-soft, rgba(138, 109, 31, 0.22));
}
.xc-credits-team[hidden] {
  display: none !important;
}

.xc-credits-recharge {
  background: var(--xc-gold-grad);
  color: var(--xc-on-gold);
  font-weight: 800;
  padding: 7px 17px;
  margin-left: 4px;
  border-radius: 999px;
  font-size: 12.5px;
  box-shadow: 0 6px 16px var(--xc-gold-soft-bg);
  transition: filter 0.2s;
}
.xc-credits-recharge:hover { filter: brightness(1.05); }

/* ---------- 满屏舞台 ---------- */
.xc-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  background: var(--xc-stage);
}

.xc-stage iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
  display: none;
}

.xc-stage iframe.is-active { display: block; }

#studioAgentPanel { z-index: 200; }

.agent-orb {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 35;
}

.xc-header .wb-bell,
.xc-topbar .wb-bell {
  border-color: var(--xc-line-soft);
  background: transparent;
  color: var(--xc-muted);
}

.xc-header .wb-bell:hover,
.xc-topbar .wb-bell:hover { color: var(--xc-gold); }

/* 覆盖 agent-panel 默认左下角 */
.xc-shell-host .agent-orb {
  left: auto !important;
  right: 22px;
  bottom: 22px;
  z-index: 35;
}

html, body.xc-shell-host {
  width: 100%;
  max-width: 100%;
}

/* 智能助手 deck 继承壳主题色 */
body.xc-shell-host {
  --panel: var(--xc-panel, #ffffff);
  --text: var(--xc-text, #1a2330);
  --studio-topbar-h: var(--xc-topbar-h, 58px);
}
html.theme-dark body.xc-shell-host,
html.studio-theme-dark body.xc-shell-host {
  --panel: rgba(20, 20, 24, 0.96);
  --text: var(--xc-text, #e8eef4);
}

/* 进入画布编辑：收起壳顶栏，只留积分 */
body.xc-canvas-immersive .xc-shell { padding-top: 0; }
body.xc-canvas-immersive .xc-header {
  position: absolute;
  top: 10px;
  right: 168px;
  left: auto;
  width: auto;
  gap: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  z-index: 40;
}
body.xc-canvas-immersive.xc-agent-open .xc-header {
  right: 408px;
}
body.xc-canvas-immersive .xc-brand,
body.xc-canvas-immersive .xc-nav,
body.xc-canvas-immersive #topbar-feedback-btn,
body.xc-canvas-immersive #topbar-agent-btn,
body.xc-canvas-immersive #theme-toggle-btn,
body.xc-canvas-immersive #topbar-api-btn,
body.xc-canvas-immersive #topbar-membership-btn,
body.xc-canvas-immersive #userMenu,
body.xc-canvas-immersive .xc-credits-recharge,
body.xc-canvas-immersive #memberLine,
body.xc-canvas-immersive .wb-bell {
  display: none !important;
}
body.xc-canvas-immersive .xc-header-actions { margin-left: 0; }
body.xc-canvas-immersive .xc-credits {
  display: inline-flex !important;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--xc-header-bg);
  border: 1px solid var(--xc-line-soft);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

/* 窄屏：导航可横滚，操作簇收紧 */
@media (max-width: 1100px) {
  .xc-header { gap: 10px; padding: 0 12px; }
  .xc-brand-badge { display: none; }
  .xc-nav-item { padding: 8px 11px; font-size: 12.5px; }
  .xc-top-btn { padding: 7px 10px; font-size: 12px; }
}


/* ---------- 智能助手面板/悬浮球·深空金统一 ---------- */
body.xc-shell-host {
  --agent-teal: #8a6d1f;
  --agent-teal-d: #6d5416;
  --agent-teal-hi: #c9b88f;
  --agent-teal-soft: rgba(138, 109, 31, 0.12);
}
html.theme-dark body.xc-shell-host,
html.studio-theme-dark body.xc-shell-host {
  --agent-teal: #c9b88f;
  --agent-teal-d: #8a6d1f;
  --agent-teal-hi: #f2e3ad;
  --agent-teal-soft: rgba(242, 227, 173, 0.12);
  --agent-ink: rgba(242, 241, 234, 0.92);
  --agent-ink2: rgba(242, 241, 234, 0.6);
  --agent-ink3: rgba(242, 241, 234, 0.38);
  --agent-line: rgba(255, 255, 255, 0.11);
  --agent-line2: rgba(255, 255, 255, 0.07);
  --agent-drawer-bg: #0d0d10;
}
.xc-shell-host .agent-orb-core {
  background: radial-gradient(circle at 34% 30%, #f2e3ad, #d3ba82 55%, #8a6d1f);
  border-color: rgba(242, 227, 173, 0.7);
  box-shadow: 0 0 24px rgba(242, 227, 173, 0.35);
  color: #14100a;
}
.xc-shell-host .agent-orb-ring { border-color: rgba(242, 227, 173, 0.45); }

/* ---------- 通知中心·深空金统一 ---------- */
.xc-header .wb-bell {
  border: 1px solid var(--xc-line-soft);
  background: transparent;
  color: var(--xc-muted);
  border-radius: 999px;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.xc-header .wb-bell:hover { color: var(--xc-gold); border-color: var(--xc-gold-3); }
.xc-header .wb-bell .rd {
  background: var(--xc-gold-grad);
  color: #14100a;
  font-size: 9px;
  font-weight: 800;
  min-width: 15px;
  height: 15px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.xc-header .wb-notice-pop {
  background: #fffdf8;
  border: 1px solid rgba(28, 26, 23, 0.12);
  border-radius: 16px;
  box-shadow: 0 18px 48px rgba(80, 60, 20, 0.14);
  color: #26211a;
}
.xc-header .wb-notice-pop .np-head h4 { color: #26211a; }
.xc-header .wb-notice-pop .np-tab { color: #6b6456; }
.xc-header .wb-notice-pop .np-tab.on { color: #8a6d1f; border-color: #8a6d1f; }
html.theme-dark .xc-header .wb-notice-pop,
html.studio-theme-dark .xc-header .wb-notice-pop {
  background: rgba(12, 12, 15, 0.96);
  border: 1px solid rgba(242, 227, 173, 0.2);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  color: rgba(242, 241, 234, 0.92);
}
html.theme-dark .xc-header .wb-notice-pop .np-head h4,
html.studio-theme-dark .xc-header .wb-notice-pop .np-head h4 { color: #f2e3ad; }
html.theme-dark .xc-header .wb-notice-pop .np-tab.on,
html.studio-theme-dark .xc-header .wb-notice-pop .np-tab.on { color: #f2e3ad; border-color: #f2e3ad; }
