/* ===== Qiang AI · 悬浮玻璃主题（参考 Viora 视觉语言） ===== */

:root {
  --bg: #070A12;
  --ink: #EDEFF4;
  --ink-2: #C6D0E2;
  --ink-3: #8C92A1;
  --muted: #6E7C93;

  --glass: rgba(255, 255, 255, .085);
  --glass-2: rgba(255, 255, 255, .13);
  --gline: rgba(255, 255, 255, .16);
  --gline-2: rgba(255, 255, 255, .26);

  --brand: #5E6BF0;
  --brand-2: #7FA6FF;
  --brand-ink: #A9C4FF;
  --brand-soft: rgba(110, 118, 255, .14);
  --brand-line: rgba(110, 118, 255, .34);

  --r-sm: 10px;
  --r: 14px;
  --r-lg: 18px;
  --r-xl: 24px;

  --sh-1: 0 4px 16px rgba(0, 0, 0, .26);
  --sh-2: 0 12px 34px rgba(0, 0, 0, .38);
  --sh-3: 0 30px 80px rgba(0, 0, 0, .52);
  --sheen: inset 0 1px 0 rgba(255, 255, 255, .17);

  --ease: cubic-bezier(.16, 1, .3, 1);

  /* 覆盖原有变量，让基础样式跟随新主题 */
  --green: #7FA6FF;
  --line: rgba(255, 255, 255, .12);
  --surface: rgba(255, 255, 255, .085);
}

/* ===== 底色与三层光晕 ===== */
html, body {
  background-color: var(--bg) !important;
  color: var(--ink);
}
body {
  background-image:
    radial-gradient(58vw 48vh at 12% -6%, rgba(96, 148, 255, .30), transparent 62%),
    radial-gradient(50vw 44vh at 92% 2%, rgba(140, 96, 255, .20), transparent 64%),
    radial-gradient(56vw 42vh at 46% 104%, rgba(52, 220, 214, .13), transparent 62%),
    linear-gradient(180deg, #080B14, #06080F 60%, #070A12) !important;
  background-attachment: fixed !important;
  font-family: Bahnschrift, "DIN Alternate", "Helvetica Neue", "PingFang SC",
    "HarmonyOS Sans SC", "Source Han Sans SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  letter-spacing: .1px;
}

/* 颗粒质感 */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  opacity: .03;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/></filter><rect width='160' height='160' filter='url(%23n)'/></svg>");
}

::selection { background: rgba(110, 118, 255, .32); color: #fff; }
:focus-visible { outline: 2px solid var(--brand-2); outline-offset: 3px; }

h1, h2, h3 { letter-spacing: -.4px; color: var(--ink); }
h1 { font-weight: 640 !important; }

button, a, input, textarea, select, .nav-item, .status-tag, .card-badge {
  transition: background-color .22s var(--ease), border-color .22s var(--ease),
              color .22s var(--ease), box-shadow .22s var(--ease), transform .22s var(--ease);
}

/* ===== 侧栏：玻璃导轨 ===== */
.sidebar {
  background: linear-gradient(180deg, rgba(12, 16, 28, .92), rgba(8, 10, 18, .96)) !important;
  border-right: 1px solid var(--gline);
  backdrop-filter: blur(18px) saturate(140%);
  box-shadow: 24px 0 60px -50px #000;
}
.brand { letter-spacing: -.5px; color: var(--ink) !important; }
.brand small { letter-spacing: 2.6px; text-transform: uppercase; color: var(--muted) !important; }
.nav-label { text-transform: uppercase; letter-spacing: 1.6px; font-size: 10px !important; color: var(--muted) !important; }
.workspace-label { color: var(--ink-3) !important; }

.nav-item {
  border-radius: var(--r);
  color: var(--ink-2) !important;
  border: 1px solid transparent;
}
.nav-item:hover {
  background: var(--glass) !important;
  border-color: var(--gline) !important;
  color: #fff !important;
}
.nav-item.active {
  background: linear-gradient(90deg, rgba(94, 107, 240, .30), rgba(94, 107, 240, .10)) !important;
  border-color: var(--brand-line) !important;
  color: #E8EDFF !important;
  box-shadow: inset 2px 0 0 var(--brand-2), 0 10px 26px -18px rgba(94, 107, 240, .95);
}
.nav-count {
  background: rgba(127, 166, 255, .20) !important;
  color: #CFE0FF !important;
  border-radius: 999px;
  font-weight: 640;
}

/* ===== 玻璃卡片 ===== */
[class$="-card"], .settings-section, .auth-panel, .detail-panel,
.task-item, .asset-item, .muse-account-row {
  background: linear-gradient(180deg, var(--glass-2), var(--glass)) !important;
  border: 1px solid var(--gline) !important;
  border-radius: var(--r-lg) !important;
  box-shadow: var(--sh-2), var(--sheen) !important;
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
}
[class$="-card"]:hover {
  border-color: var(--gline-2) !important;
  transform: translateY(-2px);
  box-shadow: var(--sh-3), var(--sheen) !important;
}

/* ===== 按钮 ===== */
.primary-button {
  background: linear-gradient(180deg, #7C8CFF 0%, var(--brand) 55%, #4B55D8 100%) !important;
  color: #fff !important;
  border: 1px solid rgba(255, 255, 255, .22) !important;
  border-radius: var(--r) !important;
  font-weight: 620 !important;
  letter-spacing: .3px;
  text-shadow: 0 1px 2px rgba(30, 34, 80, .45);
  box-shadow: 0 0 0 1px rgba(110, 118, 255, .28), 0 10px 28px -10px rgba(94, 107, 240, .75),
              inset 0 1px 0 rgba(255, 255, 255, .28) !important;
}
.primary-button:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 0 0 1px rgba(127, 166, 255, .45), 0 16px 38px -12px rgba(94, 107, 240, .9),
              inset 0 1px 0 rgba(255, 255, 255, .34) !important;
}
.primary-button:active:not(:disabled) { transform: translateY(0); filter: brightness(.96); }

.secondary-button {
  background: var(--glass) !important;
  border: 1px solid var(--gline) !important;
  border-radius: var(--r) !important;
  color: var(--ink) !important;
  box-shadow: var(--sheen);
  backdrop-filter: blur(12px);
}
.secondary-button:hover:not(:disabled) {
  background: var(--glass-2) !important;
  border-color: var(--gline-2) !important;
}

.icon-button { border-radius: var(--r-sm); color: var(--ink-2) !important; }
.icon-button:hover { background: var(--glass-2) !important; color: #fff !important; }

.text-button, button.text-button {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  box-shadow: none !important;
  color: var(--brand-ink) !important;
  font-size: 12.5px;
}
.text-button:hover { color: #CFE0FF !important; text-decoration: underline; text-underline-offset: 3px; }

button:not([class]) {
  background: var(--glass) !important;
  border: 1px solid var(--gline) !important;
  color: var(--ink) !important;
  border-radius: var(--r-sm);
}

/* ===== 表单 ===== */
input, textarea, select {
  background: rgba(8, 11, 20, .72) !important;
  border: 1px solid var(--gline) !important;
  border-radius: var(--r-sm) !important;
  color: var(--ink) !important;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .5);
  backdrop-filter: blur(8px);
}
input:hover, textarea:hover, select:hover { border-color: var(--gline-2) !important; }
input:focus, textarea:focus, select:focus {
  border-color: var(--brand-2) !important;
  box-shadow: 0 0 0 3px rgba(110, 118, 255, .20), inset 0 1px 3px rgba(0, 0, 0, .5) !important;
  outline: none !important;
}
::placeholder { color: #5D6A82 !important; }
.field-label { color: var(--ink-2) !important; font-weight: 560; }
.field-hint { color: var(--muted) !important; }

/* ===== 状态胶囊 ===== */
.status-tag, .card-badge {
  border-radius: 999px !important;
  padding: 2px 11px !important;
  font-size: 11.5px !important;
  font-weight: 620;
  letter-spacing: .2px;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  backdrop-filter: blur(6px);
}
.status-tag.queued, .card-badge.queued { background: rgba(255, 200, 120, .13) !important; color: #FFD79A !important; border-color: rgba(255, 200, 120, .26) !important; }
.status-tag.running, .card-badge.running { background: rgba(127, 166, 255, .16) !important; color: #B9D0FF !important; border-color: rgba(127, 166, 255, .34) !important; }
.status-tag.completed, .card-badge.completed { background: rgba(94, 226, 176, .13) !important; color: #9BF0CD !important; border-color: rgba(94, 226, 176, .28) !important; }
.status-tag.failed, .card-badge.failed { background: rgba(255, 130, 140, .13) !important; color: #FFADB4 !important; border-color: rgba(255, 130, 140, .3) !important; }
.status-tag.cancelled, .card-badge.cancelled { background: rgba(160, 170, 190, .12) !important; color: #AEB6C6 !important; border-color: rgba(160, 170, 190, .22) !important; }

/* ===== 媒体 ===== */
video, img, .detail-media { border-radius: var(--r-lg); background: #05070C; }
.detail-media { box-shadow: var(--sh-3), 0 0 0 1px var(--gline); }
.video-error-tip { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; padding: 10px 12px; border-radius: 12px;
  background: rgba(255, 130, 140, .1); border: 1px solid rgba(255, 130, 140, .26); color: #FFADB4; font-size: 13px; }
.video-error-tip .secondary-button, .video-error-tip .primary-button { padding: 6px 12px; font-size: 13px; text-decoration: none; }
@media (max-width: 640px) { .video-error-tip { font-size: 12px; } }

/* ===== 筛选 / 搜索 ===== */
.filter-tabs {
  background: var(--glass) !important;
  border: 1px solid var(--gline) !important;
  border-radius: var(--r) !important;
  padding: 3px !important;
  backdrop-filter: blur(12px);
}
.filter-tabs button { border-radius: 11px !important; color: var(--ink-2) !important; }
.filter-tabs button[aria-selected="true"], .filter-tabs button.selected {
  background: rgba(110, 118, 255, .22) !important;
  color: #DCE6FF !important;
  box-shadow: inset 0 0 0 1px var(--brand-line);
}

/* ===== 弹层 ===== */
.modal, [class$="-modal"], [role="dialog"], dialog {
  background: linear-gradient(180deg, rgba(18, 22, 36, .96), rgba(10, 13, 22, .98)) !important;
  border: 1px solid var(--gline-2) !important;
  border-radius: var(--r-xl) !important;
  box-shadow: 0 40px 110px -40px #000, var(--sheen) !important;
  backdrop-filter: blur(28px) saturate(160%);
}

/* ===== 滚动条 ===== */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .12); border: 3px solid var(--bg); border-radius: 9px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, .2); border: 3px solid var(--bg); }

/* ===== 细节 ===== */
.status-dot {
  background: #6FE3B4 !important;
  box-shadow: 0 0 0 3px rgba(111, 227, 180, .18), 0 0 12px rgba(111, 227, 180, .7);
  animation: q-pulse 2.8s var(--ease) infinite;
}
@keyframes q-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }

.spin { animation: q-spin 1s linear infinite; }
@keyframes q-spin { to { transform: rotate(360deg); } }

.section-heading, .settings-title { letter-spacing: -.3px; font-weight: 650; color: var(--ink) !important; }
.muted { color: var(--ink-3) !important; }
.small { color: var(--muted); }
.member-role { border-radius: 999px !important; background: var(--glass) !important; border-color: var(--gline) !important; color: var(--ink-3) !important; }
.avatar { background: linear-gradient(135deg, rgba(127, 166, 255, .38), rgba(140, 96, 255, .32)) !important; color: #fff !important; }
.form-error:empty { display: none !important; }
.form-error { color: #FFADB4 !important; }

/* ===== 登录页修复 ===== */
.auth-screen { background: transparent !important; }
.auth-brand { color: var(--ink) !important; letter-spacing: -.5px; }
.auth-brand img { filter: drop-shadow(0 4px 12px rgba(110, 118, 255, .5)); }
.auth-eyebrow { color: var(--brand-ink) !important; letter-spacing: 1.6px; text-transform: uppercase; }
.auth-panel .intro, .auth-panel p { color: var(--ink-3) !important; }
.auth-foot { color: var(--muted) !important; letter-spacing: .3px; }
#auth-switch { margin-top: 18px; display: inline-block; }
#auth-switch::after { content: ' →'; }

/* 主标题渐变字 */
.auth-panel h1 {
  background: linear-gradient(92deg, #FFFFFF 0%, #C9D6FF 42%, #8FA8FF 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent !important;
}

/* 光晕更明显一点 */
body {
  background-image:
    radial-gradient(62vw 52vh at 10% -8%, rgba(96, 148, 255, .42), transparent 62%),
    radial-gradient(54vw 48vh at 94% 0%, rgba(148, 96, 255, .30), transparent 64%),
    radial-gradient(60vw 46vh at 44% 106%, rgba(52, 220, 214, .18), transparent 62%),
    linear-gradient(180deg, #0A0E1A, #06080F 62%, #070A12) !important;
}

/* Logo 跟随主题色（原绿色 → 靛蓝） */
.brand-logo, .auth-brand img, .brand-mark svg {
  filter: hue-rotate(95deg) saturate(1.15) brightness(1.05)
          drop-shadow(0 4px 14px rgba(110, 118, 255, .55));
}
.favicon, link[rel="icon"] { filter: none; }

/* ===== 空状态 ===== */
.empty-projects {
  min-height: 260px !important;
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px !important;
  text-align: center;
  padding: 48px 24px;
  border: 1px dashed var(--gline-2) !important;
  border-radius: var(--r-xl) !important;
  background: linear-gradient(180deg, rgba(255, 255, 255, .055), rgba(255, 255, 255, .012)) !important;
  backdrop-filter: blur(10px);
}
.empty-glyph {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  background: radial-gradient(circle at 32% 26%, rgba(127, 166, 255, .38), rgba(94, 107, 240, .10));
  border: 1px solid var(--gline-2);
  color: #D9E4FF;
  box-shadow: 0 14px 34px -18px rgba(94, 107, 240, .95), var(--sheen);
}
.empty-glyph svg { width: 27px !important; height: 27px !important; stroke-width: 1.5; }
.empty-projects strong {
  display: block;
  font-size: 15.5px !important;
  font-weight: 600 !important;
  color: var(--ink) !important;
  letter-spacing: -.2px;
}
.empty-projects p {
  font-size: 12.5px !important;
  margin-top: 6px !important;
  color: var(--muted) !important;
  max-width: 340px;
  margin-inline: auto;
  line-height: 1.7;
}
.empty-action { margin-top: 18px; }
.empty-action .primary-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 18px !important;
}
.empty-action .primary-button svg { width: 15px; height: 15px; }

/* ===== 细节打磨 ===== */
.auth-panel { padding-top: 26px !important; }
.auth-brand { margin-bottom: 22px !important; }
.auth-panel h1 {
  background: linear-gradient(96deg, #FFFFFF 0%, #C9D6FF 38%, #8FA8FF 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent !important;
  margin-bottom: 6px;
}
#auth-switch {
  margin-top: 20px !important;
  font-size: 12px !important;
  font-weight: 400 !important;
  color: rgba(169, 196, 255, .78) !important;
}
#auth-switch:hover { color: #DCE6FF !important; }

/* 环境标识 */
.env-badge {
  position: fixed;
  right: 18px;
  bottom: 14px;
  z-index: 70;
  font-size: 10.5px;
  letter-spacing: .6px;
  color: rgba(140, 146, 161, .55);
  pointer-events: none;
  font-family: Bahnschrift, "DIN Alternate", Consolas, monospace;
}

/* ===== 登录页 Hero（电影感全屏背景） ===== */
.auth-screen {
  background-image:
    linear-gradient(180deg, rgba(6, 9, 16, .58) 0%, rgba(6, 9, 16, .74) 52%, rgba(6, 9, 16, .93) 100%),
    radial-gradient(70vw 50vh at 50% 34%, rgba(94, 107, 240, .10), transparent 72%),
    url('/hero.jpg') !important;
  background-size: cover, cover, cover !important;
  background-position: center, center, center !important;
  background-repeat: no-repeat !important;
  background-attachment: fixed !important;
}

.auth-panel {
  width: 428px !important;
  padding: 38px 34px 30px !important;
  background: linear-gradient(180deg, rgba(19, 23, 38, .74), rgba(9, 12, 21, .88)) !important;
  border: 1px solid var(--gline-2) !important;
  border-radius: 26px !important;
  box-shadow: 0 40px 120px -40px #000, inset 0 1px 0 rgba(255, 255, 255, .14) !important;
  backdrop-filter: blur(24px) saturate(150%) !important;
  -webkit-backdrop-filter: blur(24px) saturate(150%) !important;
}

.auth-panel h1 {
  font-size: clamp(30px, 3.4vw, 40px) !important;
  line-height: 1.14 !important;
  letter-spacing: -1.3px !important;
  font-weight: 700 !important;
  margin: 2px 0 8px !important;
}

.auth-brand {
  font-size: 26px !important;
  font-weight: 620 !important;
  margin-bottom: 24px !important;
}
.auth-eyebrow {
  font-size: 10.5px !important;
  letter-spacing: 2px !important;
  margin-bottom: 8px !important;
}
.auth-panel .intro {
  font-size: 13px !important;
  line-height: 1.75 !important;
  margin-bottom: 22px !important;
}
.auth-panel input { height: 42px; }
.auth-panel .primary-button { height: 44px; font-size: 14.5px !important; }

@media (max-width: 560px) {
  .auth-panel { width: 100% !important; padding: 26px 20px 22px !important; border-radius: 20px !important; }
  .auth-panel h1 { font-size: 27px !important; }
}

/* ===== 分栏 Hero 登录（自有版式） ===== */
.auth-screen {
  position: relative;
  overflow: hidden;
  display: flex !important;
  align-items: center;
  justify-content: center;
  padding: 40px clamp(20px, 4vw, 56px);
  background: #05070D !important;
  background-image: none !important;
}

/* 背景用伪元素，做慢推镜头（模拟视频感） */
.auth-screen::before {
  content: '';
  position: fixed;
  inset: -6%;
  z-index: 0;
  background: url('/hero.jpg') center/cover no-repeat;
  filter: saturate(1.08) brightness(.62) contrast(1.05);
  animation: q-kenburns 32s ease-in-out infinite alternate;
  will-change: transform;
}
@keyframes q-kenburns {
  0%   { transform: scale(1.02) translate3d(0, 0, 0); }
  100% { transform: scale(1.14) translate3d(-1.5%, -1%, 0); }
}

/* 遮罩：左深右浅，突出左栏文字 */
.auth-screen::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(100deg, rgba(5, 7, 13, .92) 0%, rgba(5, 7, 13, .74) 42%, rgba(5, 7, 13, .52) 100%),
    radial-gradient(60vw 50vh at 78% 30%, rgba(94, 107, 240, .14), transparent 70%);
  pointer-events: none;
}

.auth-stage {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: clamp(36px, 6vw, 92px);
  width: 100%;
  max-width: 1180px;
}

/* 左栏 */
.auth-lead { flex: 1; max-width: 560px; }

.lead-mark {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 34px;
  color: var(--ink);
  font-size: 20px;
  font-weight: 620;
  letter-spacing: -.3px;
}
.lead-mark img {
  filter: hue-rotate(95deg) saturate(1.15) drop-shadow(0 6px 18px rgba(110, 118, 255, .55));
}
.lead-mark small {
  display: block;
  font-size: 9.5px;
  letter-spacing: 3px;
  color: rgba(140, 146, 161, .8);
  font-weight: 400;
  margin-top: 2px;
}

.lead-title {
  font-size: clamp(34px, 4.4vw, 54px) !important;
  line-height: 1.12 !important;
  letter-spacing: -2px !important;
  font-weight: 700 !important;
  color: #fff !important;
  margin: 0 0 22px !important;
}
.lead-title span {
  background: linear-gradient(96deg, #FFFFFF 8%, #B9CBFF 46%, #7F9BFF 96%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lead-sub {
  font-size: 14.5px !important;
  line-height: 1.85 !important;
  color: rgba(198, 208, 226, .82) !important;
  max-width: 460px;
  margin: 0 0 26px !important;
}

.lead-points {
  list-style: none;
  margin: 0 0 30px;
  padding: 0;
  display: grid;
  gap: 11px;
}
.lead-points li {
  position: relative;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.6;
  color: rgba(198, 208, 226, .7);
}
.lead-points li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7FA6FF, #5E6BF0);
  box-shadow: 0 0 10px rgba(127, 166, 255, .8);
}
.lead-points b {
  color: #E4EBFF;
  font-weight: 620;
  margin-right: 6px;
}

.lead-foot {
  font-size: 11px;
  letter-spacing: 1.2px;
  color: rgba(140, 146, 161, .65);
  border-top: 1px solid rgba(255, 255, 255, .10);
  padding-top: 16px;
  max-width: 360px;
}

/* 右栏卡片更收敛 */
.auth-stage .auth-panel {
  width: 400px !important;
  flex-shrink: 0;
  background: linear-gradient(180deg, rgba(16, 20, 33, .82), rgba(8, 11, 19, .92)) !important;
  border-radius: 22px !important;
  padding: 30px 28px 24px !important;
}

@media (max-width: 1024px) {
  .auth-stage { flex-direction: column; gap: 28px; max-width: 440px; }
  .auth-lead { display: none; }
  .auth-stage .auth-panel { width: 100% !important; }
}

/* ===== 视频背景 ===== */
.auth-video {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  pointer-events: none;
  filter: brightness(.66) saturate(1.06) contrast(1.03);
}

/* 关键修复：hidden 必须能隐藏登录层（覆盖 display:flex） */
#auth[hidden], .auth-screen[hidden] { display: none !important; }
#app[hidden] { display: none !important; }

/* 视频只在登录层里生效 */
#auth .auth-video { display: block; }
#app { position: relative; z-index: 1; }

/* ===== 全局背景视频 ===== */
.bg-video {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  pointer-events: none;
  opacity: .38;
  filter: blur(1.5px) saturate(1.05) brightness(.75);
  transform: scale(1.03);
}

/* 应用层浮在视频之上 */
.app-layout { position: relative; z-index: 1; }
#app { background: transparent !important; }
#auth { position: relative; z-index: 2; }
.auth-screen { background: rgba(5, 7, 13, .55) !important; background-image: none !important; }

/* 应用内各区域半透明，让背景透出来 */
.main-area, .main-content, .workspace, .content-area, main {
  background: transparent !important;
}

/* 卡片稍微加厚，保证文字清晰 */
[class$="-card"], .settings-section, .detail-panel,
.task-item, .asset-item, .muse-account-row, .auth-panel {
  background: linear-gradient(180deg, rgba(16, 20, 32, .88), rgba(9, 12, 20, .94)) !important;
  backdrop-filter: blur(24px) saturate(140%);
}

/* 登录页左栏文字不需要额外遮罩了 */
.auth-screen::before { display: none !important; }

/* 主壳层透出背景视频 */
.main-shell, .main-shell > main, #main, .workspace-main, .view, .page {
  background: transparent !important;
}
/* 内容块加一层薄底，避免文字压在视频上 */
#main > * { position: relative; }

/* 背景遮罩：视频之上、内容之下 */
.bg-scrim {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(6, 9, 16, .50) 0%, rgba(6, 9, 16, .62) 55%, rgba(6, 9, 16, .74) 100%),
    radial-gradient(60vw 40vh at 30% 0%, rgba(94, 107, 240, .10), transparent 70%);
}
.bg-video { opacity: .30 !important; filter: blur(2.5px) saturate(1.05) brightness(.72) !important; }

/* 页面标题在视频上要有对比 */
#main h1, #main h2, #main h3, #main .page-title, #main .section-title {
  color: #F2F6FF !important;
  text-shadow: 0 1px 16px rgba(0, 0, 0, .75);
}

/* ===== 登录页保留强视频感，应用内保持克制 ===== */
body:has(#auth:not([hidden])) .bg-video {
  opacity: .92 !important;
  filter: blur(.4px) saturate(1.12) brightness(.98) !important;
}
body:has(#auth:not([hidden])) .bg-scrim {
  background:
    linear-gradient(100deg, rgba(6, 9, 16, .46) 0%, rgba(6, 9, 16, .22) 46%, rgba(6, 9, 16, .08) 100%),
    radial-gradient(60vw 45vh at 78% 28%, rgba(94, 107, 240, .16), transparent 70%) !important;
}
#auth .auth-screen {
  background: rgba(5, 7, 13, .10) !important;
}

/* ===== 清晰度增强 ===== */
:root {
  --ink: #F2F5FA;
  --ink-2: #D3DBE8;
  --ink-3: #A3AEC2;
  --muted: #8593A8;
}

/* 背景视频：清楚优先 */
.bg-video {
  opacity: .58 !important;
  filter: blur(.5px) saturate(1.08) brightness(.94) !important;
}
body:has(#auth:not([hidden])) .bg-video {
  opacity: 1 !important;
  filter: blur(0) saturate(1.12) brightness(1.02) contrast(1.02) !important;
}

/* 内容底更实，文字更锐 */
[class$="-card"], .settings-section, .detail-panel,
.task-item, .asset-item, .muse-account-row, .auth-panel {
  background: linear-gradient(180deg, rgba(14, 18, 29, .93), rgba(8, 11, 18, .96)) !important;
  backdrop-filter: blur(18px) saturate(130%) !important;
}

/* 正文与次要文字提亮 */
body, .field-label, label, td, th, li, p, span { -webkit-font-smoothing: antialiased; }
.muted, .small, .field-hint, .auth-foot, small { color: var(--ink-3) !important; }
#main p, #main li, #main td, #main th { color: var(--ink-2) !important; }

/* 标题不再依赖阴影，直接给足对比 */
#main h1, #main h2, #main h3 {
  color: #FFFFFF !important;
  text-shadow: 0 1px 10px rgba(0, 0, 0, .55) !important;
}

/* 输入框文字更实 */
input, textarea, select { color: #F4F7FC !important; }
input::placeholder, textarea::placeholder { color: #7F8CA1 !important; }

/* ===== 全屏观看 ===== */
.detail-media-wrap { width: 100%; }
.fs-caption { display: none; }

.detail-media-wrap:fullscreen {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  background: #000;
}
.detail-media-wrap:fullscreen .detail-media {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  height: auto;
  max-height: none !important;
  max-width: none !important;
  object-fit: contain;
  border-radius: 0;
  background: #000;
}
.detail-media-wrap:fullscreen .fs-caption {
  display: block;
  flex: 0 0 auto;
  padding: 12px 22px 14px;
  color: #e9eef4;
  font-size: 13px;
  line-height: 1.65;
  background: rgba(8, 10, 14, .92);
  border-top: 1px solid rgba(255, 255, 255, .10);
  max-height: 24vh;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.detail-media-wrap:fullscreen video::-webkit-media-controls-panel { background: linear-gradient(transparent, rgba(0,0,0,.75)); }

/* ===== 弹窗：内容滚动、底部按钮始终可见 ===== */
#modal {
  display: flex;
  flex-direction: column;
  max-height: 92vh;
  overflow: hidden;
  padding: 0;
}
#modal .dialog-head {
  flex: 0 0 auto;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
#modal .dialog-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 20px;
  overscroll-behavior: contain;
}
#modal .dialog-actions {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  padding: 12px 20px 14px;
  border-top: 1px solid rgba(255, 255, 255, .10);
  background: rgba(10, 13, 18, .96);
  backdrop-filter: blur(12px);
}
#modal .dialog-actions .secondary-button,
#modal .dialog-actions .primary-button,
#modal .dialog-actions .danger-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
/* 弹窗里的媒体不要撑破高度 */
#modal .dialog-body .detail-media { max-height: 52vh; }
@media (max-height: 760px) {
  #modal .dialog-body .detail-media { max-height: 42vh; }
}

/* ===== 作品预览面板：画面自适应，底部操作栏永远可见 ===== */
.studio-grid { align-items: stretch; }
.preview-panel {
  min-height: 0;
  overflow: hidden;
}
.preview-canvas {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  max-height: calc(100vh - 320px);
}
.preview-canvas img,
.preview-canvas video {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}
.preview-actions {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  row-gap: 6px;
}
.preview-actions .preview-note { margin-right: auto; }
@media (max-height: 780px) {
  .preview-canvas { max-height: calc(100vh - 260px); }
}


/* 覆盖 .studio-page .preview-canvas 的 max-height:none（ID 提权 + 预留工具栏空间） */
#preview.preview-canvas {
  max-height: calc(100vh - 330px) !important;
  min-height: 180px !important;
  flex: 1 1 auto !important;
}
#preview.preview-canvas > img,
#preview.preview-canvas > video {
  max-height: 100% !important;
  max-width: 100% !important;
  object-fit: contain !important;
}
@media (max-height: 700px) {
  #preview.preview-canvas { max-height: calc(100vh - 290px) !important; min-height: 150px !important; }
}

/* 预览面板按钮文字配色（此前被批量换色误改成近黑色，导致看不见） */
#preview-actions .secondary-button,
#preview-actions a.secondary-button,
.preview-actions .secondary-button {
  color: #d7dee5 !important;
  border-color: #414b54 !important;
  background: rgba(255, 255, 255, .07) !important;
}
#preview-actions .secondary-button:hover,
.preview-actions .secondary-button:hover {
  color: #ffffff !important;
  border-color: #5b6873 !important;
  background: rgba(255, 255, 255, .12) !important;
}
#preview-actions .secondary-button svg,
.preview-actions .secondary-button svg {
  stroke: currentColor !important;
  width: 13px; height: 13px;
}
#preview-actions .preview-note { color: #9aa6b2 !important; }

/* 预览面板整体高度受屏幕约束，画布自动收缩，按钮永不裁切 */
.studio-page .preview-panel,
.preview-panel {
  max-height: calc(100vh - 190px) !important;
  min-height: 0 !important;
  overflow: hidden !important;
}
.preview-panel .preview-heading { flex: 0 0 auto !important; }
#preview.preview-canvas {
  flex: 1 1 0 !important;
  min-height: 140px !important;
  max-height: none !important;
}
#preview.preview-canvas > img,
#preview.preview-canvas > video {
  max-height: 100% !important;
  max-width: 100% !important;
  object-fit: contain !important;
}
.preview-panel .preview-actions {
  flex: 0 0 auto !important;
  margin-top: 10px !important;
}

/* 全屏容器内的媒体（含预览面板里没有 .detail-media 类的 img/video） */
.detail-media-wrap:fullscreen > img,
.detail-media-wrap:fullscreen > video,
.detail-media-wrap:fullscreen .detail-media {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  width: auto !important;
  height: auto !important;
  max-width: 100% !important;
  max-height: 100% !important;
  margin: 0 auto !important;
  object-fit: contain !important;
  border-radius: 0 !important;
  background: #000 !important;
  display: block !important;
}
.detail-media-wrap:fullscreen {
  display: flex !important;
  flex-direction: column !important;
  align-items: center;
  justify-content: center;
  width: 100% !important;
  height: 100% !important;
  background: #000 !important;
}

/* 非全屏状态下的容器不参与布局（保险，正常情况下容器会被移除） */
.detail-media-wrap:not(:fullscreen) { display: contents; }
.detail-media-wrap:not(:fullscreen) .fs-caption { display: none; }

/* 关键：dialog 未打开时必须彻底隐藏（否则 #modal{display:flex} 会让它留在页面上） */
#modal:not([open]) { display: none !important; }
dialog#modal:not([open]) { display: none !important; }

/* ===== 手机端适配 ===== */
@media (max-width: 820px) {
  /* iOS 输入框小于 16px 会触发整页放大且不还原 */
  input, textarea, select, .search-input, .field-label + input {
    font-size: 16px !important;
  }
  input::placeholder, textarea::placeholder { font-size: 16px !important; }

  /* 弹窗按动态视口高度，键盘弹出/收起都能自适应 */
  #modal {
    max-height: 92dvh !important;
    width: calc(100vw - 24px) !important;
    max-width: calc(100vw - 24px) !important;
  }
  #modal .dialog-body { padding: 12px 14px !important; }
  #modal .dialog-actions { padding: 10px 14px 12px !important; }
  #modal .dialog-actions .secondary-button,
  #modal .dialog-actions .primary-button,
  #modal .dialog-actions .danger-button { font-size: 13px !important; padding: 8px 12px !important; }

  /* 视频在手机上按宽度铺满，高度不超过视口 */
  #modal .dialog-body .detail-media {
    max-height: 58dvh !important;
    width: 100% !important;
    height: auto !important;
  }
  video.detail-media { background: #000; }

  /* 预览面板在手机上不限制高度，避免挤压 */
  .preview-panel { max-height: none !important; }
  #preview.preview-canvas { max-height: 56dvh !important; min-height: 160px !important; }
}

/* 防止 iOS 双击缩放干扰双击全屏 */
@media (max-width: 820px) {
  #modal .detail-media, #preview > img, #preview > video { touch-action: manipulation; }
}

/* ===== Muse 实时对话 ===== */
.muse-chat { display: flex; flex-direction: column; gap: 12px; }
.muse-chat-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 12px;
  border-radius: 14px; background: var(--glass); border: 1px solid var(--gline); }
.muse-chat-window { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-2); }
.muse-chat-window i { width: 16px; height: 16px; }
.muse-auto { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.muse-auto input { width: 15px; height: 15px; accent-color: #5EE2B0; }
.muse-scope { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-2); }
.muse-scope select { min-width: 150px; padding: 5px 9px; border-radius: 9px; border: 1px solid var(--gline);
  background: rgba(255,255,255,.06); color: var(--ink); font-size: 13px; }
.muse-chat-bar .secondary-button { margin-left: auto; }
.muse-chat-log { max-height: 52vh; min-height: 260px; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px;
  border-radius: 14px; background: rgba(6, 9, 16, .55); border: 1px solid var(--gline); }
.muse-msg { flex: 0 0 auto; max-width: 82%; padding: 9px 12px; border-radius: 12px; font-size: 14px; line-height: 1.65;
  white-space: pre-wrap; word-break: break-word; }
.muse-msg.mine { align-self: flex-end; background: rgba(94, 226, 176, .16); border: 1px solid rgba(94, 226, 176, .28); color: #D8F5E8; }
.muse-msg.theirs { align-self: flex-start; background: rgba(255, 255, 255, .07); border: 1px solid var(--gline); color: var(--ink); }
.muse-msg .txt { display: block; }
.muse-msg.clamped .txt { display: -webkit-box; -webkit-line-clamp: 8; -webkit-box-orient: vertical; overflow: hidden; }
.muse-msg .more { display: block; margin-top: 4px; background: none; border: 0; padding: 0; font-size: 12px;
  color: #5EE2B0; cursor: pointer; font-family: inherit; }
.muse-msg .meta { display: block; margin-top: 6px; font-size: 12px; color: var(--ink-3); }
.muse-chat-input { display: flex; gap: 10px; align-items: flex-end; }
.muse-chat-input textarea { flex: 1; resize: vertical; min-height: 46px; padding: 10px 12px; border-radius: 12px;
  background: rgba(6, 9, 16, .55); border: 1px solid var(--gline); color: var(--ink); font: inherit; font-size: 15px; }
.muse-chat-input textarea:focus { outline: none; border-color: rgba(94, 226, 176, .45); }
@media (max-width: 640px) {
  .muse-chat-bar { gap: 8px; }
  .muse-chat-bar .secondary-button { margin-left: 0; width: 100%; justify-content: center; }
  .muse-msg { max-width: 92%; font-size: 14px; }
  .muse-chat-log { max-height: 46vh; }
}

/* 素材库：与「任务中心」作品卡同款竖版卡（9:16，每行 4 个） */
.library-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.library-grid .card-media { aspect-ratio: 9 / 16; background: #0e1116; }
.library-grid .card-media > img,
.library-grid .card-media > video { width: 100%; height: 100%; object-fit: contain; background: #0e1116; }
.library-grid .card-body { padding: 12px 13px 11px; }
@media (max-width: 1100px) { .library-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 850px) { .library-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .library-grid { gap: 12px; } }
