/*
 * 显影 AI 创作台 · 参考创作台新版的自适应视觉层
 * 只负责布局和视觉，不替换现有 app.js 的真实接口与交互契约。
 */

:root {
  --studio-navy: #081b31;
  --studio-navy-2: #123f74;
  --studio-blue: #2768ee;
  --studio-violet: #7358ee;
  --studio-gold: #f3c75b;
  --studio-copy: #536983;
  --studio-line: #d7e3f0;
  --studio-soft: #f5f8fc;
}

body {
  background:
    radial-gradient(circle at 9% 13%, rgba(42,112,244,.085), transparent 28%),
    radial-gradient(circle at 94% 18%, rgba(112,80,236,.07), transparent 26%),
    linear-gradient(180deg, #f6f9fd 0, #eef3f9 100%);
}

.topbar {
  position: relative;
  width: calc(100% - 36px);
  max-width: 1440px;
  min-height: 78px;
  margin: 18px auto 0;
  padding: 0 28px;
  color: #fff;
  border: 1px solid #173a66;
  border-radius: 18px;
  background:
    radial-gradient(circle at 82% -90%, rgba(82,140,251,.3), transparent 38%),
    linear-gradient(112deg, var(--studio-navy) 0, #0d2d52 57%, var(--studio-navy-2) 100%);
  box-shadow: 0 14px 32px rgba(9,32,58,.19);
  overflow: visible;
}
.topbar::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 3px;
  border-radius: 0 0 18px 18px;
  background: linear-gradient(90deg, #2d7bff, var(--studio-violet) 58%, var(--studio-gold));
}
.brand-mark {
  width: 46px;
  height: 46px;
  border-color: rgba(255,224,142,.72);
  border-radius: 14px;
  color: #10243e;
  background: linear-gradient(145deg, #ffe38d, #efbd47);
  box-shadow: 0 10px 28px rgba(243,199,91,.27);
}
.brand-mark svg { width: 24px; height: 24px; }
.brand-text strong { color: #fff; font-size: 19px; }
.brand-text small { color: #9eb5d0; }
.safelight { background: #3ae1a7; box-shadow: 0 0 0 4px rgba(58,225,167,.14); }
.topbar-right { gap: 9px; }
.btn-top-action,
.mp-btn,
.conn {
  color: #d4e1f0;
  border-color: rgba(164,191,224,.22);
  background: rgba(255,255,255,.075);
}
.btn-top-action:hover,
.mp-btn:hover,
.mp-btn[aria-expanded="true"] {
  color: #fff;
  border-color: rgba(168,201,245,.47);
  background: rgba(255,255,255,.12);
}
.top-task-badge { color: #17345c; background: #ffd66f; }
.mp-icon { color: #a8c7ff; }
.mp-name { color: #fff; }
.mp-tag,
.conn { color: #93aac5; }
.mp-caret { color: #bcd2ef; }
.conn-dot { background: #3ae1a7; box-shadow: 0 0 0 4px rgba(58,225,167,.14); }
.conn.is-error .conn-dot { background: #ff8191; box-shadow: 0 0 0 4px rgba(255,129,145,.14); }
.mp-panel { background: #f7faff; }

.studio-nav {
  width: calc(100% - 36px);
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 18px;
  min-height: 62px;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 1px solid #d8e3ef;
  border-top: 0;
  background: rgba(255,255,255,.96);
  box-shadow: 0 7px 18px rgba(25,55,95,.045);
}
.studio-nav-btn {
  min-height: 62px;
  padding: 0 18px;
  border: 0;
  border-radius: 0;
  color: #53667e;
  background: transparent;
  position: relative;
}
.studio-nav-btn::after {
  content: "";
  position: absolute;
  right: 16px;
  bottom: 0;
  left: 16px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: transparent;
}
.studio-nav-btn:hover { color: #1f5dc8; background: #f7faff; }
.studio-nav-btn.is-active { color: #1f5dc8; border: 0; background: linear-gradient(180deg, #fff, #f2f6ff); }
.studio-nav-btn.is-active::after { background: var(--studio-blue); }
.studio-nav-btn svg { width: 16px; height: 16px; }

.workbench {
  width: calc(100% - 36px);
  max-width: 1440px;
  margin: 0 auto;
  grid-template-columns: minmax(330px, 372px) minmax(0, 1fr);
  gap: 16px;
}

.studio-welcome {
  grid-column: 1 / -1;
  min-height: 210px;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: 34px 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  color: #fff;
  border: 1px solid #16447e;
  border-radius: 24px;
  background:
    radial-gradient(circle at 88% 18%, rgba(99,166,255,.31), transparent 22%),
    radial-gradient(circle at 72% 108%, rgba(118,81,238,.32), transparent 36%),
    linear-gradient(130deg, #071d37 0, #103967 55%, #174f90 100%);
  box-shadow: 0 24px 55px rgba(15,50,91,.2);
}
.studio-welcome::before {
  content: "";
  width: 310px;
  height: 310px;
  position: absolute;
  z-index: -1;
  right: -80px;
  top: -190px;
  border: 1px solid rgba(197,220,255,.16);
  border-radius: 50%;
  box-shadow: inset 0 0 0 43px rgba(255,255,255,.018), 0 0 0 55px rgba(145,186,249,.035);
}
.studio-welcome::after {
  content: "AI · MODEL · SKILL · API";
  position: absolute;
  right: 38px;
  bottom: 23px;
  color: rgba(203,222,248,.52);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 2px;
}
.studio-welcome .section-kicker {
  min-height: 27px;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(133,179,244,.28);
  border-radius: 8px;
  color: #8fc0ff;
  background: rgba(80,137,228,.13);
}
.studio-welcome h1 { max-width: 650px; margin-top: 11px; color: #fff; font-size: 38px; letter-spacing: -1.3px; line-height: 1.2; }
.studio-welcome p { max-width: 620px; color: #c0d1e5; }
.welcome-pills {
  min-width: 360px;
  padding: 15px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border: 1px solid rgba(168,198,238,.2);
  border-radius: 17px;
  background: rgba(3,22,43,.28);
  backdrop-filter: blur(10px);
}
.welcome-pills span {
  min-height: 67px;
  padding: 10px 13px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 5px;
  color: #a9bed8;
  border: 0;
  border-right: 1px solid rgba(176,203,237,.16);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  text-align: center;
}
.welcome-pills span:last-child { border-right: 0; }
.welcome-pills b { color: #fff; font-size: 19px; }

.workbench-subnav {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}
.workbench-subnav-title { display: none; }
.workbench-subnav .mode-switch { display: contents; }
.mode-thumb { display: none; }
.mode-btn {
  min-height: 88px;
  display: grid;
  grid-template-columns: 48px 1fr;
  align-content: center;
  gap: 13px;
  padding: 15px 16px;
  text-align: left;
  border: 1px solid #d4e1ef;
  border-radius: 17px;
  color: #536983;
  background: linear-gradient(160deg, #fff, #f8fbff);
  box-shadow: 0 8px 20px rgba(25,60,105,.045);
  transition: transform .2s, border-color .2s, box-shadow .2s, color .2s;
}
.mode-btn:hover { color: #1f5dc8; border-color: #a9c5f5; box-shadow: 0 12px 24px rgba(36,88,168,.08); transform: translateY(-2px); }
.mode-btn.is-active { color: #174fbf; border-color: #77a3f1; background: linear-gradient(145deg, #fff, #eef4ff); box-shadow: 0 0 0 3px rgba(39,104,238,.07), 0 13px 26px rgba(39,104,238,.1); }
.mode-btn.is-active::before { content: ""; width: 5px; position: absolute; left: -1px; top: 17px; bottom: 17px; border-radius: 0 5px 5px 0; background: linear-gradient(180deg, #2f77f5, #7058ee); }
.mode-btn svg { width: 48px; height: 48px; padding: 13px; border-radius: 14px; color: #2768ee; background: #eaf2ff; }
.mode-btn.is-active svg { color: #fff; background: linear-gradient(145deg, #347bf8, #1f5ad8); }

.studio-flow-strip {
  grid-column: 1 / -1;
  padding: 11px 17px;
  display: grid;
  grid-template-columns: 1fr 28px 1fr 28px 1fr 28px 1fr;
  align-items: center;
  gap: 10px;
  border: 1px solid #d7e3f0;
  border-radius: 15px;
  background: rgba(255,255,255,.86);
  box-shadow: 0 9px 24px rgba(26,62,108,.055);
}
.studio-flow-strip > span { display: grid; grid-template-columns: 34px 1fr; grid-template-rows: auto auto; gap: 2px 10px; align-items: center; }
.studio-flow-strip b { grid-row: 1 / 3; display: grid; width: 34px; height: 34px; place-items: center; border-radius: 10px; color: #2768ee; background: #eaf2ff; font-size: 10px; }
.studio-flow-strip strong { font-size: 11px; }
.studio-flow-strip small { color: #8493a6; font-size: 9px; }
.studio-flow-strip > i { height: 1px; background: linear-gradient(90deg, #bfd2eb, #91b4ec); }

.controls { top: 94px; gap: 16px; }
.stagecol { gap: 16px; }
.hl-aigen-card,
.tool-catalog,
.tool-editor,
.scene-list,
.scene-editor,
.canvas-palette,
.canvas-board,
.canvas-inspector,
.template-card,
.library-card,
.project-library-card,
.task-row,
.task-stat {
  border-color: #d6e1ee;
  box-shadow: 0 16px 40px rgba(22,52,92,.08);
}
.hl-aigen-card { border-radius: 20px; background: linear-gradient(180deg, #fff 0, #fbfdff 100%); }
.hl-aigen-stage-card { overflow: hidden; }
.hl-aigen-stage-card::before { content: ""; display: block; height: 4px; margin: -16px -16px 16px; background: linear-gradient(90deg, #2e76f5, #7258ed); }
.stage { min-height: 370px; border-radius: 17px; border-color: #c9d9ec; background: radial-gradient(circle at 50% 42%, rgba(39,104,238,.12), transparent 28%), linear-gradient(145deg, #f8faff, #eef3fa); }
.stage-empty svg { color: #2768ee; }
.stage-meta { justify-content: center; }
.stage-meta span { color: #536c88; border: 1px solid #dce6f1; background: #fff; }
.studio-panel { width: calc(100% - 36px); max-width: 1440px; margin: 0 auto 28px; padding: 26px; border: 1px solid #d5e1ee; border-radius: 20px; background: rgba(255,255,255,.96); box-shadow: 0 16px 40px rgba(22,52,92,.08); }
.studio-panel-head { padding-bottom: 18px; border-bottom: 1px solid #dce6f1; }
.studio-panel-head::after { content: ""; display: block; width: 40px; height: 3px; position: absolute; bottom: -2px; left: 0; border-radius: 3px; background: linear-gradient(90deg, #2e76f5, #7159ed); }
.studio-panel-head { position: relative; }

body.is-dim {
  background: radial-gradient(circle at 9% 13%, rgba(42,112,244,.16), transparent 28%), linear-gradient(180deg, #0d1526 0, #0b111d 100%);
}
body.is-dim .studio-welcome { border-color: #315b8c; }
body.is-dim .studio-nav { background: rgba(24,40,63,.96); border-color: #3b5575; }
body.is-dim .studio-nav-btn { color: #b4c3d8; }
body.is-dim .studio-nav-btn.is-active { color: #cfe0ff; background: rgba(111,157,255,.12); }
body.is-dim .studio-flow-strip { border-color: #3b5575; background: rgba(24,40,63,.9); }
body.is-dim .studio-flow-strip strong { color: #eef5ff; }

@media (max-width: 1100px) {
  .topbar { padding: 0 20px; }
  .studio-nav { justify-content: flex-start; overflow-x: auto; }
  .studio-welcome { align-items: flex-start; flex-direction: column; }
  .welcome-pills { min-width: 0; width: 100%; }
  .studio-welcome::after { display: none; }
}

@media (max-width: 980px) {
  .workbench { padding-right: 18px; padding-left: 18px; }
  .workbench-subnav, .studio-flow-strip { margin-right: 0; margin-left: 0; }
  .studio-nav, .topbar, .studio-panel, .workbench { width: calc(100% - 24px); }
}

@media (max-width: 780px) {
  .topbar { margin-top: 10px; min-height: 70px; padding: 10px 14px; border-radius: 16px; }
  .topbar::after { border-radius: 0 0 16px 16px; }
  .brand-mark { width: 40px; height: 40px; border-radius: 12px; }
  .brand-text strong { font-size: 16px; }
  .brand-text small { font-size: 8px; }
  .topbar-right { width: 100%; justify-content: flex-start; overflow-x: auto; }
  .mp-btn { min-width: 160px; }
  .studio-nav { min-height: 54px; padding: 0 8px; }
  .studio-nav-btn { min-height: 54px; padding: 0 13px; }
  .workbench { padding: 20px 12px 34px; }
  .studio-welcome { min-height: 0; padding: 28px 25px 45px; border-radius: 20px; }
  .studio-welcome h1 { font-size: 31px; }
  .workbench-subnav { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .mode-btn { min-height: 78px; grid-template-columns: 38px 1fr; gap: 9px; padding: 12px; font-size: 12px; }
  .mode-btn svg { width: 38px; height: 38px; padding: 10px; border-radius: 11px; }
  .mode-btn.is-active::before { top: 13px; bottom: 13px; }
  .studio-flow-strip { grid-template-columns: 1fr 1fr; gap: 8px; padding: 8px; }
  .studio-flow-strip > i { display: none; }
  .studio-flow-strip > span { min-height: 50px; padding: 7px; border: 1px solid #e0e9f3; border-radius: 10px; }
  .studio-panel { padding: 20px 16px; }
}

@media (max-width: 560px) {
  .studio-welcome { padding: 24px 18px 37px; border-radius: 17px; text-align: center; }
  .studio-welcome > div:first-child { width: 100%; }
  .studio-welcome .section-kicker { justify-content: center; }
  .studio-welcome h1 { margin-right: auto; margin-left: auto; font-size: 26px; letter-spacing: -.6px; }
  .studio-welcome p { font-size: 11px; }
  .welcome-pills { padding: 9px; }
  .welcome-pills span { min-height: 57px; padding: 8px 6px; font-size: 8px; }
  .welcome-pills b { font-size: 15px; }
  .studio-flow-strip > span { grid-template-columns: 28px 1fr; }
  .studio-flow-strip b { width: 28px; height: 28px; }
  .studio-flow-strip strong { font-size: 10px; }
  .studio-flow-strip small { font-size: 8px; }
  .stage { min-height: 300px; }
}
