/* ============================================================
   AI 创作社区 · 设计系统（对齐 xuayo.com）
   ============================================================ */
:root {
  --primary: #2E6CEC;
  --primary-dark: #174FC7;
  --primary-light: #EDF3FF;
  --primary-gradient: linear-gradient(135deg, #4A82F0 0%, #5A8EF2 50%, #0A48E6 100%);
  --page: #F8F8FC;
  --card: #FFFFFF;
  --text: #18181B;
  --muted: #6B7280;
  --line: #E8E8F0;
  --soft: #F4F4F8;
  --radius: 16px;
  --shadow: 0 12px 32px rgba(36, 53, 88, 0.08);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; min-width: 980px; height: 100%; }
body {
  overflow: hidden;
  color: var(--text);
  background: var(--page);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, textarea, input, select { font: inherit; outline: none; border: 0; background: none; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }
i[class^="ri-"], i[class*=" ri-"] { font-style: normal; }

.workspace { height: 100%; display: flex; flex-direction: column; background: var(--page); }

/* ===== 顶栏 ===== */
.topbar {
  position: relative; z-index: 100;
  height: 68px; flex: 0 0 68px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 34px;
  border-bottom: 1px solid rgba(232,232,240,.86);
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(18px);
}
.h-left, .h-right, .h-nav { display: flex; align-items: center; }
.h-left { gap: 12px; }
.h-logo {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 10px; color: #fff;
  background: var(--primary-gradient);
  box-shadow: 0 7px 20px rgba(46,108,236,.24);
  font-size: 18px;
}
.h-name { font-size: 17px; font-weight: 760; letter-spacing: -.02em; }
.h-nav { gap: 4px; margin-left: 28px; }
.h-nav button {
  padding: 9px 13px; border-radius: 9px;
  color: #70737B; font-size: 13px; font-weight: 560;
}
.h-nav button:hover { color: var(--text); background: var(--soft); }
.h-nav button.active { color: var(--primary); background: var(--primary-light); }
.h-right { gap: 9px; }
.h-points, .history-btn {
  height: 36px;
  display: flex; align-items: center; gap: 6px;
  padding: 0 12px;
  border: 1px solid var(--line); border-radius: 10px;
  color: #555962; background: #fff; font-size: 12px;
}
.h-points:hover, .history-btn:hover { border-color: #CBD4E6; color: var(--primary); }
.h-points i { color: #F2A20C; font-size: 15px; }
.h-user {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  margin-left: 3px; border-radius: 50%;
  color: #fff; background: #20232A;
  font-size: 13px; font-weight: 700; cursor: pointer;
}

/* ===== 应用壳 + 侧栏 ===== */
.app-shell { flex: 1; min-height: 0; display: flex; }
.side-rail {
  width: 84px; flex: 0 0 84px;
  display: flex; flex-direction: column; align-items: center;
  padding: 14px 0 12px;
  border-right: 1px solid var(--line);
  background: #fff;
}
.rail-models {
  flex: 1; width: 100%; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 4px 8px;
  scrollbar-width: none;
}
.rail-models::-webkit-scrollbar { display: none; }
.rail-item {
  width: 68px; padding: 10px 4px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  border-radius: 12px; border: 1px solid transparent;
  color: #555962; cursor: pointer; transition: .16s ease;
}
.rail-item .ic {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 11px;
  color: var(--primary); background: var(--primary-light);
  font-size: 18px;
}
.rail-item span {
  max-width: 64px; overflow: hidden;
  font-size: 11px; font-weight: 600; white-space: nowrap; text-overflow: ellipsis;
}
.rail-item:hover { background: var(--soft); }
.rail-item.active {
  background: var(--primary-light);
  border-color: #C8D8FA;
}
.rail-item.active span { color: var(--primary); }
.rail-bottom { padding: 8px 0 2px; }
.rail-action {
  width: 68px; padding: 10px 4px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  border-radius: 12px; color: #555962; cursor: pointer;
}
.rail-action:hover { background: var(--soft); color: var(--primary); }
.rail-action .ic, .rail-action i { font-size: 18px; }
.rail-action span { font-size: 11px; font-weight: 600; }

/* ===== 主区 ===== */
.page-shell {
  flex: 1; position: relative;
  min-width: 0; min-height: 0; overflow: hidden;
  background-color: #F8FAFF;
  background-image:
    linear-gradient(rgba(46,108,236,.105) 1px, transparent 1px),
    linear-gradient(90deg, rgba(46,108,236,.105) 1px, transparent 1px);
  background-size: 32px 32px;
  background-position: -1px -1px;
}
.ai-home-body { position: absolute; inset: 0; overflow: hidden; }
.home-view { height: 100%; overflow-y: auto; background: transparent; }
.home-view::-webkit-scrollbar { width: 7px; }
.home-view::-webkit-scrollbar-thumb { border-radius: 8px; background: #DCDDE4; }
.page-content {
  width: min(calc(100% - 56px), 1520px);
  margin: 0 auto;
  padding: 34px 0 80px;
}

/* ===== Hero ===== */
.creation-hero { padding-bottom: 26px; }
.hero-copy { margin-bottom: 22px; }
.hero-copy h1 {
  font-size: 38px; line-height: 1.15;
  font-weight: 800; letter-spacing: -.03em;
  min-height: 2.4em;
}
.hero-copy h1 .ht-line { display: block; }
.hero-copy h1 .ht-line2 { margin-top: 8px; color: var(--primary); }
.hero-copy h1 .ht-char { display: inline-block; }
.hero-copy h1 .ht-cursor {
  display: inline-block; width: 3px; height: 1em; margin-left: 2px;
  vertical-align: -2px; background: var(--primary);
  animation: ht-blink 1s step-end infinite;
}
@keyframes ht-blink { 0%,100% { opacity: 1; } 50% { opacity: 0; } }
.hero-copy p { margin-top: 13px; color: #8B8E97; font-size: 14px; }

/* ===== 五入口视觉卡 ===== */
.quick-start-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}
.quick-card-visual {
  position: relative; isolation: isolate;
  display: flex; align-items: flex-end;
  min-height: 210px; padding: 18px;
  overflow: hidden;
  border: 1px solid rgba(218,228,244,.9);
  border-radius: 18px;
  color: #fff; background: #293a59;
  box-shadow: 0 12px 28px rgba(48,72,114,.10);
  cursor: pointer;
  transition: transform .28s cubic-bezier(.4,0,.2,1), box-shadow .28s ease;
}
.quick-card-visual:hover {
  transform: translateY(-4px);
  border-color: rgba(183,205,241,.95);
  box-shadow: 0 18px 36px rgba(48,72,114,.18);
}
.quick-card-cover {
  position: absolute; z-index: -2; inset: 0;
  background-position: center; background-size: cover;
  transform: scale(1.01); transition: transform .35s ease;
}
.quick-card-visual:hover .quick-card-cover { transform: scale(1.07); }
.quick-card-shade {
  position: absolute; z-index: -1; inset: 0;
  background: linear-gradient(180deg, rgba(10,21,45,.04) 24%, rgba(10,21,45,.82) 100%);
}
.quick-card-copy { display: flex; flex-direction: column; gap: 5px; padding-right: 24px; }
.quick-card-copy strong {
  color: #fff; font-size: 17px; font-weight: 750;
  letter-spacing: -.02em; line-height: 1.25;
}
.quick-card-copy small {
  color: rgba(255,255,255,.84); font-size: 11px; line-height: 1.5;
}
.quick-card-arrow {
  position: absolute; right: 11px; top: 11px;
  color: rgba(255,255,255,.9); font-size: 18px;
}
.quick-card-primary { border-color: rgba(208,222,247,.98); }

/* ===== 创作框 Composer ===== */
.composer-wrap { width: 100%; margin: 22px 0 0; }
.composer {
  overflow: hidden;
  border: 1px solid #DDDDE5;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(49,79,139,.08);
  transition: .2s ease;
}
.composer:focus-within {
  border-color: #AFC5F5;
  box-shadow: 0 0 0 3px rgba(46,108,236,.07);
}
.composer-model {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 18px 3px;
}
.composer-model .m-ic {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 10px;
  color: var(--primary); background: var(--primary-light);
  font-size: 17px;
}
.model-switch {
  display: flex; gap: 4px; margin-left: auto;
  padding: 3px; border-radius: 999px; background: #F2F3F7;
}
.ms-item {
  display: flex; align-items: center; gap: 5px;
  padding: 6px 14px; border-radius: 999px;
  color: #7A7D86; font-size: 12px; font-weight: 600; cursor: pointer;
}
.ms-item.active {
  color: #fff; background: var(--primary-gradient);
  box-shadow: 0 4px 12px rgba(46,108,236,.28);
}
.model-info { flex: 1; min-width: 0; }
.model-info strong { display: block; font-size: 13px; font-weight: 700; }
.model-info span { display: block; margin-top: 2px; color: #9296A0; font-size: 11px; }

.ref-row { display: flex; gap: 7px; flex-wrap: wrap; padding: 0 16px; }
.ref-row:not(:empty) { padding-top: 8px; }
.ref-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 8px 3px 3px;
  border: 1px solid var(--line); border-radius: 8px;
  color: #626771; background: var(--soft); font-size: 11px;
}
.ref-pill img { width: 26px; height: 26px; border-radius: 6px; object-fit: cover; }
.ref-pill .x {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px;
  border-radius: 50%; background: #E9ECF2; color: #8A90A0;
  font-size: 13px; cursor: pointer;
}
.ref-pill .x:hover { background: #FF5A5A; color: #fff; }

.input-row {
  display: flex; align-items: flex-end; gap: 10px;
  padding: 8px 16px 12px;
}
.plus {
  width: 50px; height: 68px; flex: 0 0 50px;
  display: grid; place-items: center;
  border-radius: 12px;
  color: #626771; background: #F6F7FA;
  font-size: 21px;
}
.plus:hover { color: var(--primary); background: var(--primary-light); }
.composer textarea {
  flex: 1; min-height: 60px; max-height: 120px;
  padding: 10px 2px; resize: none;
  color: var(--text); background: transparent;
  font-size: 15px; line-height: 1.65;
}
.composer textarea::placeholder { color: #A1A5AE; }
.send {
  min-width: 108px; height: 44px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 0 16px; border-radius: 12px;
  color: #fff; background: var(--primary-gradient);
  box-shadow: 0 9px 22px rgba(46,108,236,.24);
  font-size: 13px; font-weight: 700;
}
.send:hover { filter: brightness(.97); transform: translateY(-1px); }
.send:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.setting-row {
  min-height: 46px;
  display: flex; align-items: center; gap: 7px;
  padding: 6px 16px;
  border-top: 1px solid #F0F1F5;
  background: #FAFAFC;
  flex-wrap: wrap;
}
.set-label { margin-right: 2px; color: #8B8F98; font-size: 11px; font-weight: 650; }
.count-label { margin-left: 10px; }
.model-chips {
  display: flex; align-items: center; gap: 6px;
  flex: 1; min-width: 0; overflow-x: auto;
  scrollbar-width: none;
}
.model-chips::-webkit-scrollbar { display: none; }
.model-chip {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 5px;
  height: 27px; padding: 0 11px;
  border-radius: 999px;
  border: 1px solid #E6E9F0; background: #fff;
  color: #5E6B82; font-size: 11px; white-space: nowrap;
}
.model-chip:hover { border-color: #C9D9F8; background: #F5F9FF; color: var(--primary); }
.model-chip.active {
  color: #fff; border-color: transparent;
  background: linear-gradient(135deg, #4A82F0, #0A48E6);
  box-shadow: 0 3px 10px rgba(46,108,236,.28); font-weight: 600;
}
.model-more {
  flex: 0 0 auto;
  width: 27px; height: 27px;
  display: grid; place-items: center;
  border-radius: 8px; border: 1px solid #E6E9F0;
  background: #fff; color: #5E6B82; font-size: 14px;
}
.model-more:hover { border-color: #C9D9F8; color: var(--primary); background: #F5F9FF; }
.model-panel {
  position: fixed; z-index: 99999;
  min-width: 380px; max-width: 460px; max-height: 58vh;
  overflow-y: auto;
  background: #fff; border: 1px solid #EEF0F5; border-radius: 18px;
  box-shadow: 0 20px 60px rgba(15,23,42,.16);
  padding: 8px; display: none;
}
.model-panel.active { display: block; }
.model-card {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 12px; cursor: pointer;
  border: 1.5px solid transparent;
}
.model-card:hover { background: #F7F9FC; }
.model-card.active { background: #F1F6FF; border-color: #CFDFFB; }
.model-card-icon {
  width: 40px; height: 40px; border-radius: 11px; flex-shrink: 0;
  display: grid; place-items: center; color: #fff; font-size: 19px;
  background: linear-gradient(135deg, #5A8EF2, #0A48E6);
}
.model-card-body { flex: 1; min-width: 0; }
.model-card-name { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.model-card-points {
  font-size: 11px; color: #f59e0b; font-weight: 600;
  background: #FFF6E8; padding: 1px 7px; border-radius: 999px;
}
.model-card-desc {
  font-size: 12px; color: #8a93a3; margin-top: 4px;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.model-card-check { color: var(--primary); font-size: 20px; opacity: 0; }
.model-card.active .model-card-check { opacity: 1; }

.ratio-group, .count-group { display: flex; gap: 4px; }
.ratio-item, .count-item {
  height: 29px; display: grid; place-items: center;
  padding: 0 9px; border: 1px solid transparent; border-radius: 7px;
  color: #666A73; font-size: 11px; cursor: pointer;
}
.count-item { width: 30px; padding: 0; }
.ratio-item:hover, .count-item:hover { background: #ECEEF3; }
.ratio-item.active, .count-item.active {
  color: var(--primary); border-color: #CDDBF8;
  background: var(--primary-light); font-weight: 700;
}

.chat-feature-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 9px 16px;
  border-top: 1px solid #F0F1F5; background: #FBFBFE;
}
.chat-feature-item {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 12px;
  border: 1px solid #E8EBF2; border-radius: 999px;
  color: #5c6470; font-size: 11px; background: #fff;
}
.chat-feature-item:hover, .chat-feature-item.on {
  border-color: #CDDBF8; color: var(--primary); background: var(--primary-light);
}
.chat-feature-item.recording {
  border-color: #f65b5b; color: #e5484d; background: #fff0f0;
}
.chat-attach-preview { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 16px 8px; }
.chat-attach-preview:not(:empty) { padding-top: 8px; }
.chat-attach-item {
  position: relative; width: 56px; height: 56px;
  border-radius: 10px; overflow: hidden;
  border: 1px solid #e4e7ee;
}
.chat-attach-item img { width: 100%; height: 100%; object-fit: cover; }
.chat-attach-item .x {
  position: absolute; top: 2px; right: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: rgba(0,0,0,.6); color: #fff;
  font-size: 12px; line-height: 18px; text-align: center; cursor: pointer;
}
.composer-hint {
  display: flex; align-items: center; gap: 12px;
  margin-top: 8px; padding: 0 2px;
  color: #B0B3BC; font-size: 11px;
}
.composer-hint span { display: inline-flex; align-items: center; gap: 4px; }
.composer-hint span::before {
  content: ""; width: 5px; height: 5px;
  border-radius: 50%; background: #D5D8DE;
}

/* ===== 大家都在做 ===== */
.inspiration-strip {
  display: flex; align-items: center; gap: 14px;
  margin-top: 18px; padding: 12px 16px;
  border: 1px solid rgba(207,219,239,.9);
  border-radius: 14px;
  background: rgba(255,255,255,.76);
  box-shadow: 0 12px 34px rgba(72,101,151,.075);
  backdrop-filter: blur(14px);
}
.inspiration-label {
  display: inline-flex; align-items: center; gap: 6px;
  flex-shrink: 0;
  color: var(--primary); font-size: 12px; font-weight: 700;
}
.inspiration-list {
  display: flex; gap: 8px; overflow-x: auto;
  scrollbar-width: none;
}
.inspiration-list::-webkit-scrollbar { display: none; }
.insp-chip {
  flex: 0 0 auto;
  padding: 7px 12px;
  border: 1px solid var(--line); border-radius: 999px;
  color: #454B57; background: #fff;
  font-size: 12px; cursor: pointer;
}
.insp-chip:hover {
  border-color: #C9D9F8; color: var(--primary); background: var(--primary-light);
}

/* ===== 创作灵感 ===== */
.discover-section { margin-top: 28px; }
.discover-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 20px; margin-bottom: 13px;
}
.discover-head h2 { font-size: 21px; font-weight: 750; }
.discover-head p { margin-top: 6px; color: #9699A2; font-size: 12px; }
.gallery-more {
  height: 32px;
  display: flex; align-items: center; gap: 4px;
  padding: 0 12px;
  border: 1px solid #ECECF2; border-radius: 999px;
  color: #7A7D86; background: #fff; font-size: 12px;
}
.gallery-more:hover { color: var(--primary); border-color: #C6D6F8; }
.gallery-tabs {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
}
.gallery-tabs-right { display: flex; align-items: center; gap: 12px; }
.upload-tpl-btn {
  height: 34px;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0 12px;
  border: 1px solid var(--line); border-radius: 999px;
  color: #555962; background: #fff; font-size: 12px;
}
.upload-tpl-btn:hover { color: var(--primary); background: var(--primary-light); }
.gallery-sort {
  display: inline-flex; align-items: center; gap: 4px;
  color: #7A7D86; font-size: 12px; cursor: pointer;
}
.gallery-tags {
  display: flex; gap: 24px;
  overflow-x: auto; padding: 5px 0 13px;
  border-bottom: 1px solid #EFEFF3;
  scrollbar-width: none;
}
.gallery-tags::-webkit-scrollbar { display: none; }
.gallery-tag {
  position: relative; flex: 0 0 auto;
  padding: 3px 0 10px;
  color: #686B73; font-size: 13px; cursor: pointer;
}
.gallery-tag.active { color: var(--primary); font-weight: 700; }
.gallery-tag.active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px;
  height: 2px; border-radius: 2px; background: var(--primary);
}
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 8px; padding-top: 14px;
  align-items: start;
}
.gallery-item {
  position: relative; overflow: hidden;
  min-height: 280px;
  border-radius: 10px;
  background: #eef1f6;
  cursor: pointer;
  transition: transform .28s cubic-bezier(.4,0,.2,1), box-shadow .28s ease;
}
.gallery-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 32px rgba(31,41,66,.16), 0 0 0 1px rgba(46,108,236,.22);
  z-index: 6;
}
.gallery-item:nth-child(8n+1), .gallery-item:nth-child(8n+4) { min-height: 350px; }
.gallery-item:nth-child(8n+3), .gallery-item:nth-child(8n+6) { min-height: 315px; }
.gallery-item img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .35s ease;
}
.gallery-item:hover img { transform: scale(1.035); }
.gallery-overlay {
  position: absolute; inset: auto 0 0; z-index: 3;
  padding: 42px 13px 12px;
  color: #fff;
  background: linear-gradient(transparent, rgba(0,0,0,.66));
}
.gallery-title {
  overflow: hidden;
  font-size: 13px; font-weight: 650;
  white-space: nowrap; text-overflow: ellipsis;
}
.gallery-meta {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 6px; font-size: 10px; opacity: .82;
}
.gallery-empty {
  grid-column: 1/-1;
  padding: 70px 20px;
  color: #9A9DA5; text-align: center; font-size: 12px;
}

/* ===== 生成中视图 ===== */
.creator-view {
  display: none; height: 100%;
  grid-template-rows: 58px minmax(0,1fr);
}
body.creating .creator-view { display: grid; }
body.creating .home-view { display: none; }
body.creating .chat-view { display: none; }
.main-top {
  display: flex; align-items: center; gap: 16px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.back-home {
  height: 34px;
  display: flex; align-items: center; gap: 6px;
  padding: 0 11px;
  border: 1px solid var(--line); border-radius: 9px;
  color: #555962; background: #fff; font-size: 11px;
}
.back-home:hover { color: var(--primary); border-color: #BFD0F7; }
.creator-title { font-size: 13px; font-weight: 700; }
.chat-scroll {
  height: 100%; overflow-y: auto;
  padding: 32px 5vw 120px;
  background: var(--page);
}
#chatList { width: min(100%, 920px); margin: 0 auto; }
.gen-card {
  margin-bottom: 24px;
  padding: 16px;
  border: 1px solid var(--line); border-radius: 16px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(36,53,88,.06);
}
.gen-card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.gen-card-head strong { font-size: 13px; }
.gen-status { font-size: 12px; }
.gen-status.queued, .gen-status.running { color: #E6A23C; }
.gen-status.completed { color: #22A06B; }
.gen-status.failed { color: #E45D5D; }
.gen-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}
.gen-grid img {
  width: 100%; aspect-ratio: 1; object-fit: cover;
  border-radius: 12px; background: var(--soft);
}
.gen-loading {
  display: flex; align-items: center; gap: 8px;
  color: var(--muted); font-size: 12px; padding: 20px 0;
}
.spinner {
  width: 16px; height: 16px;
  border: 2px solid #d6dbe3; border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== AI 对话视图 ===== */
.chat-view {
  display: none; height: 100%;
  grid-template-columns: 260px minmax(0,1fr);
  background: #fff;
}
body.chatting .chat-view { display: grid; }
body.chatting .home-view { display: none; }
body.chatting .creator-view { display: none; }
.chat-sidebar {
  display: flex; flex-direction: column;
  border-right: 1px solid var(--line);
  background: #fafbfc;
  min-height: 0; overflow: hidden;
}
.chat-sidebar-head { padding: 20px 16px 14px; }
.cs-new {
  width: 100%; height: 42px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 12px;
  background: linear-gradient(135deg,#4A82F0,#0A48E6);
  color: #fff; font-size: 14px; font-weight: 600;
  box-shadow: 0 6px 16px rgba(46,108,236,.25);
}
.cs-new:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(46,108,236,.32);
}
.chat-sidebar-list {
  flex: 1; overflow-y: auto;
  padding: 4px 12px 12px; min-height: 0;
}
.cs-group-title {
  padding: 10px 10px 8px;
  color: #9aa3b0; font-size: 12px; font-weight: 600; letter-spacing: .5px;
}
.cs-item {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 12px; border-radius: 12px;
  color: #3a4048; font-size: 13px;
  cursor: pointer; position: relative;
}
.cs-item > i { color: #b0b7c0; font-size: 16px; flex-shrink: 0; }
.cs-item:hover { background: #eef1f6; }
.cs-item.active { background: #e9effb; color: var(--primary); font-weight: 600; }
.cs-item.active > i { color: var(--primary); }
.cs-item .cs-title {
  flex: 1; overflow: hidden;
  white-space: nowrap; text-overflow: ellipsis;
}
.cs-item .cs-del {
  opacity: 0; color: #9aa3b0; font-size: 15px; flex-shrink: 0;
}
.cs-item:hover .cs-del { opacity: 1; }
.cs-item .cs-del:hover { color: #e5484d; }
.chat-sidebar-foot { padding: 12px 16px; border-top: 1px solid var(--line); }
.cs-back {
  width: 100%; height: 38px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); border-radius: 12px;
  background: #fff; color: #5a6472; font-size: 13px;
}
.cs-back:hover { color: var(--primary); border-color: #BFD0F7; }

.chat-main {
  display: flex; flex-direction: column;
  min-width: 0; height: 100%; min-height: 0; overflow: hidden;
}
.chat-top {
  display: flex; align-items: center; gap: 14px;
  padding: 0 28px; height: 58px;
  border-bottom: 1px solid var(--line); background: #fff;
}
.chat-top-title {
  flex: 1;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 15px; font-weight: 650;
}
.chat-top-title i { color: var(--primary); font-size: 18px; }
.chat-clear {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 8px; color: #9aa3b2; font-size: 18px;
}
.chat-clear:hover { background: #f1f3f7; color: #ef4444; }

#aiChatScroll {
  flex: 1; height: auto; min-height: 0; overflow-y: auto;
  padding: 32px 5vw 24px;
  background: #f8f8fc;
}
#aiChatList {
  width: min(100%, 860px); margin: 0 auto;
  display: flex; flex-direction: column; gap: 20px;
}
.ai-chat-empty { text-align: center; padding-top: 10vh; }
.ai-chat-logo {
  position: relative;
  width: 64px; height: 64px; margin: 0 auto 20px;
  border-radius: 20px;
  display: grid; place-items: center;
  background: linear-gradient(135deg,#4A82F0,#7C5CF0,#0A48E6);
  box-shadow: 0 14px 34px rgba(46,108,236,.32);
}
.ai-chat-logo i { font-size: 30px; color: #fff; }
.ai-chat-hello {
  font-size: 20px; font-weight: 700; margin-bottom: 8px;
}
.ai-chat-sub { color: #8a93a3; font-size: 14px; }
.ai-chat-templates {
  display: flex; flex-wrap: wrap; gap: 10px;
  justify-content: center; margin-top: 26px;
}
.ai-template-card {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: 12px;
  background: #fff; border: 1px solid #EAECF2;
  color: #454B57; font-size: 13px;
}
.ai-template-card:hover {
  border-color: #C9D9F8; background: #F5F9FF; color: var(--primary);
  transform: translateY(-1px);
}
.ai-template-card i { font-size: 17px; color: var(--primary); }

.aic-msg { display: flex; gap: 12px; }
.aic-msg.user { flex-direction: row-reverse; }
.aic-body { max-width: 72%; display: flex; flex-direction: column; }
.aic-msg.user .aic-body { align-items: flex-end; }
.aic-avatar {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  display: grid; place-items: center;
  color: #fff; font-size: 17px;
}
.aic-msg.ai .aic-avatar {
  background: linear-gradient(135deg,#4A82F0,#0A48E6);
}
.aic-msg.user .aic-avatar { background: #1f2329; }
.aic-bubble {
  padding: 12px 16px; border-radius: 14px;
  font-size: 14px; line-height: 1.7;
  white-space: pre-wrap; word-break: break-word;
}
.aic-msg.ai .aic-bubble {
  background: #fff; color: #1f2329;
  border: 1px solid #eceef3; border-top-left-radius: 4px;
}
.aic-msg.user .aic-bubble {
  background: #f2f3f5; color: #1f2329;
  border-top-right-radius: 4px;
}
.aic-actions {
  display: flex; align-items: center; gap: 4px; margin-top: 8px;
}
.aic-actions button {
  color: #9aa3b0; font-size: 15px;
  padding: 4px 6px; border-radius: 6px;
}
.aic-actions button:hover { color: #5a6472; background: #eef1f6; }
.aic-img {
  display: block; max-width: 220px; max-height: 220px;
  border-radius: 10px; margin-bottom: 8px;
}
.aic-route-btn {
  display: inline-flex; align-items: center; gap: 7px;
  margin-top: 10px; padding: 8px 12px;
  border: 1px solid #cbdcf8; border-radius: 9px;
  background: #f4f8ff; color: #2e6cec;
  font-size: 13px; font-weight: 650;
}
.aic-route-btn:hover {
  border-color: #2e6cec; background: #2e6cec; color: #fff;
}

.chat-input-wrap {
  padding: 0 min(6vw, 90px) 28px;
  margin-top: auto;
}
.chat-inputbar {
  display: flex; align-items: flex-end; gap: 10px;
  padding: 12px 14px;
  background: #fff;
  border: 1.5px solid #e6e9ef; border-radius: 18px;
  box-shadow: 0 8px 30px rgba(24,24,27,.08);
  flex-wrap: wrap;
}
.chat-inputbar textarea {
  flex: 1; min-width: 200px; min-height: 44px; max-height: 140px;
  resize: none; padding: 10px 4px;
  font-size: 14px; line-height: 1.5;
  font-family: inherit; background: transparent;
}
.chat-upload {
  width: 40px; height: 40px; flex-shrink: 0;
  display: grid; place-items: center;
  border: 1px solid #e4e7ee; border-radius: 12px;
  background: #f8f8fc; color: #6b7480; font-size: 20px;
}
.chat-upload:hover {
  border-color: var(--primary); color: var(--primary); background: var(--primary-light);
}
.chat-send {
  width: 40px; height: 40px; flex-shrink: 0;
  display: grid; place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg,#4A82F0,#0A48E6);
  color: #fff; font-size: 20px;
  box-shadow: 0 6px 16px rgba(46,108,236,.3);
}
.chat-send:disabled { opacity: .5; cursor: not-allowed; }
.chat-send:hover:not(:disabled) { transform: translateY(-1px); }

/* ===== Toast ===== */
#toast {
  position: fixed; z-index: 9999;
  left: 50%; top: 50%;
  display: flex; align-items: center; gap: 7px;
  padding: 11px 17px; border-radius: 10px;
  color: #fff; background: #20232A;
  box-shadow: 0 14px 40px rgba(24,24,27,.2);
  font-size: 12px;
  opacity: 0; pointer-events: none;
  transform: translate(-50%,-50%) scale(.96);
  transition: .2s;
}
#toast.show {
  opacity: 1;
  transform: translate(-50%,-50%) scale(1);
}
#toast i { color: #73DEA1; }
#toast.error i { color: #FF8E8E; }

/* ===== 用户菜单 ===== */
#aiUserMenu {
  position: fixed; z-index: 10000;
  width: 220px;
  display: none;
  border: 1px solid var(--line); border-radius: 14px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(15,23,42,.14);
  overflow: hidden;
}
#aiUserMenu.show { display: block; }
.ai-um-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 14px 10px;
}
.ai-um-avatar {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: #fff; background: #20232A;
  font-size: 13px; font-weight: 700;
}
.ai-um-name { font-size: 13px; font-weight: 700; }
.ai-um-link { color: var(--primary); font-size: 11px; cursor: pointer; margin-top: 2px; }
.ai-um-body, .ai-um-foot { padding: 4px 8px 8px; }
.ai-um-foot { border-top: 1px solid var(--line); }
.ai-um-item {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 10px; border-radius: 9px;
  color: #1f2329; font-size: 13px; cursor: pointer;
}
.ai-um-item:hover { background: var(--soft); }
.ai-um-item.danger { color: #d92d20; }
.ai-um-arrow { margin-left: auto; color: #b0b7c0; }

/* ===== 登录弹窗 ===== */
.ai-auth-overlay {
  position: fixed; inset: 0; z-index: 10050;
  display: none; align-items: center; justify-content: center;
  background: rgba(15,23,42,.5);
  backdrop-filter: blur(2px);
}
.ai-auth-overlay.active { display: flex; }
.ai-auth-modal {
  width: min(860px, 92vw); max-height: 92vh;
  display: grid; grid-template-columns: 320px 1fr;
  overflow: hidden;
  border-radius: 20px; background: #fff;
  box-shadow: 0 28px 80px rgba(0,0,0,.28);
}
.ai-auth-side {
  position: relative; min-height: 520px;
  background:
    linear-gradient(160deg, rgba(46,108,236,.72), rgba(10,72,230,.88)),
    radial-gradient(circle at 30% 20%, rgba(255,255,255,.28), transparent 45%);
}
.ai-auth-side::after {
  content: "AI 创作 · 让想法成片";
  position: absolute; left: 28px; right: 28px; bottom: 28px;
  color: #fff; font-size: 20px; font-weight: 750; line-height: 1.35;
}
.ai-auth-body {
  position: relative;
  padding: 32px 34px 28px;
  overflow-y: auto;
}
.ai-auth-close {
  position: absolute; top: 14px; right: 14px;
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 8px; color: #9aa3b2; font-size: 18px;
}
.ai-auth-close:hover { background: var(--soft); color: var(--text); }
.ai-auth-head { text-align: center; margin-bottom: 18px; }
.ai-auth-logo {
  width: 52px; height: 52px; margin: 0 auto 12px;
  display: grid; place-items: center;
  border-radius: 16px;
  color: #fff;
  background: linear-gradient(135deg,#4A82F0,#7C5CF0,#0A48E6);
  font-size: 24px;
}
.ai-auth-title { font-size: 22px; font-weight: 750; }
.ai-auth-desc { margin-top: 6px; color: var(--muted); font-size: 13px; }
.ai-auth-tabs {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 8px; margin-bottom: 18px;
}
.ai-auth-tab {
  height: 38px;
  border-radius: 10px;
  color: #5c6470; background: var(--soft);
  font-size: 13px; font-weight: 600;
}
.ai-auth-tab.active {
  color: #fff;
  background: var(--primary-gradient);
}
.ai-auth-panel { display: none; }
.ai-auth-panel.active { display: block; }
.ai-auth-field { margin-bottom: 14px; }
.ai-auth-label {
  display: block; margin-bottom: 6px;
  color: #555962; font-size: 12px; font-weight: 650;
}
.ai-auth-input {
  display: flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 11px;
  background: #fff;
}
.ai-auth-input:focus-within { border-color: #AFC5F5; box-shadow: 0 0 0 3px rgba(46,108,236,.08); }
.ai-auth-input i { color: #9aa3b2; }
.ai-auth-input input {
  flex: 1; min-width: 0;
  border: 0; background: transparent;
  font-size: 14px;
}
.ai-auth-row { display: flex; gap: 8px; }
.ai-auth-row .ai-auth-input { flex: 1; }
.ai-auth-code-btn {
  flex-shrink: 0;
  padding: 0 12px;
  border: 1px solid var(--line); border-radius: 11px;
  color: var(--primary); background: var(--primary-light);
  font-size: 12px; font-weight: 650;
}
.ai-auth-code-btn:disabled { opacity: .55; cursor: not-allowed; }
.ai-auth-captcha {
  width: 110px; height: 44px;
  border: 1px solid var(--line); border-radius: 11px;
  overflow: hidden; cursor: pointer;
  background: linear-gradient(135deg,#eef3ff,#f7f9fd);
  display: grid; place-items: center;
  font-size: 16px; font-weight: 700; letter-spacing: 3px;
  color: var(--primary); user-select: none;
}
.ai-auth-submit {
  width: 100%; height: 46px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 6px;
  border-radius: 12px;
  color: #fff; background: var(--primary-gradient);
  box-shadow: 0 10px 24px rgba(46,108,236,.28);
  font-size: 14px; font-weight: 700;
}
.ai-auth-submit:hover { filter: brightness(.97); }
.ai-auth-agree-check {
  display: flex; align-items: flex-start; gap: 8px;
  margin-top: 14px;
  color: #8B8F98; font-size: 11px; line-height: 1.5;
}
.ai-auth-agree-check a { color: var(--primary); }
.ai-auth-wxbox { text-align: center; padding: 12px 0 8px; }
.ai-auth-qrcode {
  width: 180px; height: 180px; margin: 0 auto 12px;
  display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 14px;
  background: #fff;
}
.ai-auth-wxstatus { color: var(--muted); font-size: 12px; }
.ai-auth-bind-tip {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px; margin-bottom: 16px;
  border-radius: 12px;
  background: var(--primary-light); color: var(--primary);
}
.ai-auth-bind-tip strong { display: block; font-size: 13px; }
.ai-auth-bind-tip span { display: block; margin-top: 3px; font-size: 11px; color: #5c7bb8; }
.ai-auth-mode-link { margin-top: 10px; text-align: center; font-size: 12px; color: var(--muted); }
.ai-auth-mode-link a { color: var(--primary); }
.ai-auth-subtabs {
  display: inline-flex; gap: 4px;
  padding: 3px; margin: 0 auto 14px;
  border-radius: 999px; background: var(--soft);
}
.ai-auth-subtab {
  padding: 7px 16px; border-radius: 999px;
  color: #666A73; font-size: 12px; font-weight: 650;
}
.ai-auth-subtab.active {
  color: var(--primary); background: #fff;
  box-shadow: 0 2px 8px rgba(36,53,88,.08);
}

/* ===== 分享模板弹窗 ===== */
.upload-tpl-overlay {
  position: fixed; inset: 0; z-index: 10050;
  display: none; align-items: center; justify-content: center;
  background: rgba(15,23,42,.5);
  backdrop-filter: blur(2px);
}
.upload-tpl-overlay.active { display: flex; }
.upload-tpl-panel {
  width: min(640px, 92vw); max-height: 90vh;
  display: flex; flex-direction: column;
  border-radius: 20px; background: #fff;
  box-shadow: 0 28px 80px rgba(0,0,0,.28);
  overflow: hidden;
}
.upload-tpl-head {
  position: relative;
  padding: 22px 24px 18px;
  color: #fff;
  background: var(--primary-gradient);
}
.upload-tpl-head-icon {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: rgba(255,255,255,.2);
  font-size: 18px;
}
.upload-tpl-head-title { margin-top: 10px; font-size: 18px; font-weight: 700; }
.upload-tpl-head-sub { margin-top: 3px; font-size: 12px; opacity: .85; }
.upload-tpl-close {
  position: absolute; top: 14px; right: 14px;
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 8px;
  color: #fff; background: rgba(255,255,255,.18);
  font-size: 18px;
}
.upload-tpl-body {
  flex: 1; overflow-y: auto;
  padding: 20px 24px 8px;
}
.upload-tpl-field { margin-bottom: 18px; }
.upload-tpl-label {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 8px;
  color: #303746; font-size: 13px; font-weight: 650;
}
.upload-tpl-label em {
  font-style: normal;
  padding: 1px 6px; border-radius: 6px;
  color: #fff; background: #F04A3D;
  font-size: 10px;
}
.upload-tpl-label em.opt {
  color: #94A3B8; background: #F1F5F9;
}
.upload-tpl-input, .upload-tpl-textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line); border-radius: 11px;
  background: #fff; font-size: 13px;
}
.upload-tpl-input:focus, .upload-tpl-textarea:focus {
  border-color: #AFC5F5;
  box-shadow: 0 0 0 3px rgba(46,108,236,.08);
}
.upload-tpl-textarea {
  min-height: 96px; resize: vertical; line-height: 1.6;
  font-family: inherit;
}
.upload-tpl-hint {
  margin-top: 6px;
  color: #9AA6B5; font-size: 11px; line-height: 1.5;
}
.upload-tpl-count {
  margin-top: 5px;
  color: #B6C0CD; font-size: 11px; text-align: right;
}
.upload-tpl-upload {
  min-height: 120px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px;
  border: 1px dashed #C9D2E2; border-radius: 14px;
  background: #F8FAFF;
  cursor: pointer;
}
.upload-tpl-upload:hover { border-color: var(--primary); background: var(--primary-light); }
.upload-tpl-placeholder-icon { font-size: 28px; color: var(--primary); }
.upload-tpl-placeholder-text { color: #1E293B; font-size: 13px; font-weight: 600; }
.upload-tpl-placeholder-sub { color: #94A3B8; font-size: 11px; }
.upload-tpl-preview { position: relative; overflow: hidden; border-radius: 14px; }
.upload-tpl-preview img, .upload-tpl-preview video {
  width: 100%; max-height: 220px; object-fit: cover;
}
.upload-tpl-preview-actions {
  position: absolute; right: 10px; bottom: 10px;
  display: flex; gap: 8px;
}
.upload-tpl-pbtn {
  padding: 6px 10px; border-radius: 8px;
  color: #fff; background: rgba(0,0,0,.5);
  font-size: 11px;
}
.upload-tpl-pbtn:hover { background: var(--primary); }
.upload-tpl-pbtn-del:hover { background: #ef4444; }
.upload-tpl-tips {
  display: flex; gap: 8px;
  padding: 12px;
  border-radius: 12px;
  background: var(--primary-light);
  color: #4a6494; font-size: 11px; line-height: 1.6;
}
.upload-tpl-tips i { color: var(--primary); font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.upload-tpl-footer {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 16px 24px 20px;
  border-top: 1px solid var(--line);
}
.upload-tpl-submit {
  min-width: 140px; height: 42px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border-radius: 11px;
  color: #fff; background: var(--primary-gradient);
  box-shadow: 0 10px 24px rgba(46,108,236,.3);
  font-size: 13px; font-weight: 700;
}
.upload-tpl-submit:hover { transform: translateY(-1px); }
.upload-tpl-submit:disabled { opacity: .65; cursor: not-allowed; }

/* ===== 底栏备案 ===== */
.icp-bar {
  position: fixed; left: 84px; right: 0; bottom: 0; z-index: 1000;
  height: 32px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 20px;
  background: #F8FAFF;
  border-top: 1px solid #EBEDF2;
}
.icp-bar-text {
  color: #9096A1; font-size: 12px; letter-spacing: .02em;
  text-align: center;
}
.icp-bar-text a { color: #808691; }
.icp-bar-text a:hover { color: var(--primary); }

/* ===== 响应式 ===== */
@media (max-width: 1240px) {
  .page-content { width: calc(100% - 42px); }
  .gallery-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .quick-start-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
}
@media (max-width: 1080px) {
  .quick-start-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .chat-view { grid-template-columns: 220px minmax(0,1fr); }
}
