/* ============================================================
   v3 创作台外壳：侧栏 + 顶栏 + 内容区（深色）
   依赖 static/v2/tokens.css
   ============================================================ */

html, body { background: var(--bg); }
body { margin: 0; color: var(--text); font-family: var(--font-ui); }

.sd-shell {
  display: block;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

/* ---------- 侧栏 ---------- */
.sd-side {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px 14px 16px;
  background: linear-gradient(180deg, #0A0C11 0%, #07090D 100%);
  border-right: 1px solid var(--line);
  z-index: 40;
  overflow-y: auto;
}

#app .sd-side .sd-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 16px;
  text-decoration: none;
  color: var(--text);
}
.sd-brandmark { display: inline-flex; width: 34px; height: 34px; flex-shrink: 0; }
.sd-brandmark .sd-seal { width: 34px; height: 34px; display: block; }
.sd-brandtext { display: flex; flex-direction: column; line-height: 1.1; }
.sd-side .sd-brandtext b { font-size: 16px; font-weight: 700; letter-spacing: .08em; }
.sd-brandtext small { font-size: 10.5px; color: var(--text-3); letter-spacing: .22em; margin-top: 3px; }

.sd-nav { display: flex; flex-direction: column; gap: 2px; }
.sd-grouplabel {
  font-size: 10.5px;
  letter-spacing: .2em;
  color: var(--text-3);
  padding: 14px 10px 6px;
  text-transform: uppercase;
}
#app .sd-side .sd-navitem {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 10px;
  color: var(--text-2);
  text-decoration: none;
  font-size: 14px;
  transition: color .2s var(--ease), background .2s var(--ease);
}
#app .sd-side .sd-navitem:hover { color: var(--text); background: rgba(255, 255, 255, .05); }
.sd-ico { width: 18px; height: 18px; display: inline-flex; flex-shrink: 0; opacity: .9; }
.sd-ico svg { width: 18px; height: 18px; display: block; }
#app .sd-side .sd-navitem.is-active {
  color: var(--text);
  background: linear-gradient(90deg, rgba(255, 122, 92, .16), rgba(255, 122, 92, .04) 65%, transparent);
}
#app .sd-side .sd-navitem.is-active::before {
  content: "";
  position: absolute;
  left: 0; top: 8px; bottom: 8px;
  width: 2px;
  border-radius: 2px;
  background: var(--accent);
}
#app .sd-side .sd-navitem.is-active .sd-ico { color: var(--amber); opacity: 1; }

/* 侧栏底部 */
.sd-sidefoot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding-top: 16px; }
.sd-credit {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 12px;
  padding: 11px 12px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.sd-creditlabel { font-size: 11.5px; color: var(--text-3); }
#app .sd-side .sd-creditnum {
  font-size: 18px;
  font-weight: 700;
  background: var(--accent);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-variant-numeric: tabular-nums;
}
.sd-user { display: flex; align-items: center; gap: 9px; padding: 4px 2px; }
.sd-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-soft);
  color: var(--amber);
  font-size: 13px; font-weight: 700;
  border: 1px solid var(--line-strong);
  flex-shrink: 0;
}
.sd-usermeta { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.sd-usermeta b { font-size: 12.5px; font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sd-usermeta span { font-size: 10.5px; color: var(--text-3); }
.sd-logout {
  margin-left: auto;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text-3);
  font-size: 11.5px;
  padding: 5px 9px;
  border-radius: 8px;
  cursor: pointer;
  transition: all .2s;
}
.sd-logout:hover { color: var(--text); border-color: var(--line-strong); }
#app .sd-side .sd-back {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 11px;
  border-top: 1px solid var(--line);
  color: var(--text-3);
  text-decoration: none;
  font-size: 12.5px;
  transition: color .2s;
}
#app .sd-side .sd-back:hover { color: var(--text); }
.sd-backarrow { font-size: 12px; }

/* ---------- 主区 ---------- */
.sd-main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.sd-top {
  position: sticky; top: 0; z-index: 30;
  height: 62px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 clamp(16px, 2.4vw, 30px);
  background: rgba(6, 7, 10, .72);
  backdrop-filter: blur(16px) saturate(1.1);
  border-bottom: 1px solid var(--line);
}
.sd-topleft { display: flex; align-items: center; gap: 12px; min-width: 0; }
.sd-crumb { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-3); }
.sd-crumb i { font-style: normal; opacity: .5; }
#app .sd-top .sd-crumb b { color: var(--text); font-weight: 500; }
.sd-topright { display: flex; align-items: center; gap: 8px; }
#app .sd-topright .sd-chip {
  display: inline-flex; align-items: center;
  padding: 6px 13px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  color: var(--text-2);
  text-decoration: none;
  font-size: 12.5px;
  transition: all .2s var(--ease);
}
#app .sd-topright .sd-chip:hover { color: var(--text); border-color: var(--line-strong); background: var(--surface); }

.sd-burger { display: none; }

.sd-content {
  flex: 1;
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: clamp(18px, 2.4vw, 30px) clamp(16px, 2.6vw, 34px) calc(var(--player-h) + 46px);
}
.sd-screen { display: none; }

/* ---------- 移动端：侧栏变抽屉 ---------- */
.sd-veil { display: none; }
@media (max-width: 940px) {
  .sd-side {
    transform: translateX(-104%);
    transition: transform .28s var(--ease);
    box-shadow: var(--shadow-pop);
    width: min(82vw, 300px);
  }
  .sd-shell.is-drawer-open .sd-side { transform: none; }
  .sd-shell.is-drawer-open .sd-veil,
  .sd-veil {
    display: block;
    position: fixed; inset: 0; z-index: 35;
    background: rgba(0, 0, 0, .55);
    opacity: 0; pointer-events: none;
    transition: opacity .25s;
  }
  .sd-shell.is-drawer-open .sd-veil { opacity: 1; pointer-events: auto; }
  .sd-main { margin-left: 0; }
  .sd-top { height: 56px; }
  .sd-burger {
    display: inline-flex; flex-direction: column; justify-content: center; gap: 4px;
    width: 34px; height: 34px; padding: 0 8px;
    border: 1px solid var(--line); border-radius: 9px;
    background: transparent; cursor: pointer;
  }
  .sd-burger span { display: block; height: 1px; background: var(--text-2); }
  .sd-content { padding-bottom: calc(var(--player-h) + 30px); }
}


/* 兜底：旧 theme.css 里 `#app :where(a)` 的 id 级选择器会盖掉单类，这里再兜一层 */
#app .sd-shell { color: var(--text); background: var(--bg); }
#app .sd-side a, #app .sd-side a:link, #app .sd-side a:visited { color: var(--text-2); }
#app .sd-top a, #app .sd-top a:link, #app .sd-top a:visited { color: var(--text-2); }
#app .sd-logout { color: var(--text-3); }
#app .sd-brandtext b { color: var(--text); }


/* 额度卡（可点进会员中心）+ 会员档位 */
#app .sd-side .sd-credit {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 8px;
  text-decoration: none;
  color: inherit;
  transition: border-color .2s, background .2s;
}
#app .sd-side .sd-credit:hover { border-color: var(--line-strong); background: var(--surface-2); }
#app .sd-side .sd-creditnum { justify-self: end; }
#app .sd-side .sd-plan { grid-column: 1 / -1; font-size: 11px; color: var(--text-3); }
