/* ============================================================
   梦境 AI 复刻站 —— 基础样式 / 设计系统
   浅色主题
   ============================================================ */

:root {
  --brand: #5b5bf6;
  --brand-600: #4a49e8;
  --brand-700: #3b39cf;
  --brand-2: #8b5cf6;
  --brand-soft: #eef0ff;
  --brand-soft-2: #f4f2ff;

  --accent: #ff6b4a;
  --accent-soft: #fff1ec;
  --success: #16a34a;
  --success-soft: #e9f9ef;
  --warn: #f59e0b;
  --warn-soft: #fff7e6;
  --danger: #e5484d;
  --danger-soft: #fdecec;

  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #fafbff;
  --text: #171a2b;
  --text-2: #4a5068;
  --muted: #7c8399;
  --border: #e7e9f2;
  --border-2: #dfe2ee;

  --radius: 14px;
  --radius-lg: 20px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(23, 26, 43, 0.05);
  --shadow: 0 4px 18px rgba(23, 26, 43, 0.07);
  --shadow-lg: 0 18px 48px rgba(23, 26, 43, 0.13);
  --shadow-brand: 0 10px 28px rgba(91, 91, 246, 0.28);

  --grad: linear-gradient(120deg, #5b5bf6 0%, #8b5cf6 55%, #a855f7 100%);
  --grad-soft: linear-gradient(120deg, #eef0ff 0%, #f6f0ff 100%);
  --max: 1220px;
  --nav-h: 68px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Hiragino Sans GB",
    system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4, h5 { margin: 0; font-weight: 700; line-height: 1.28; letter-spacing: -0.01em; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }

::selection { background: #dcdcff; }

/* 滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d3d7e6; border-radius: 20px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #b9bfd4; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------------------------------------------------- 布局 */

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 24px; }
.wrap-wide { max-width: 1440px; }
.section { padding: 84px 0; }
.section-sm { padding: 56px 0; }
.center { text-align: center; }
.row { display: flex; align-items: center; }
.row-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-24 { gap: 24px; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; } .mt-48 { margin-top: 48px; }
.hidden { display: none !important; }
.grow { flex: 1; }
.nowrap { white-space: nowrap; }

/* ---------------------------------------------------------- 标题 */

.eyebrow {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 600; letter-spacing: 0.06em;
  color: var(--brand); background: var(--brand-soft);
  padding: 6px 14px; border-radius: 999px;
}
.section-title { font-size: 34px; margin-top: 18px; }
.section-sub { color: var(--muted); font-size: 15.5px; margin-top: 12px; max-width: 660px; }
.center .section-sub { margin-left: auto; margin-right: auto; }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------------------------------------------------------- 按钮 */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 18px; border-radius: 10px;
  border: 1px solid var(--border-2); background: var(--surface);
  color: var(--text); font-size: 14px; font-weight: 600; cursor: pointer;
  transition: all 0.18s ease; white-space: nowrap; user-select: none;
}
.btn:hover { border-color: #c9cde0; background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--grad); border-color: transparent; color: #fff; box-shadow: var(--shadow-brand); }
.btn-primary:hover { background: var(--grad); filter: brightness(1.06); border-color: transparent; }
.btn-dark { background: var(--text); border-color: var(--text); color: #fff; }
.btn-dark:hover { background: #2a2f47; border-color: #2a2f47; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.btn-outline-brand { border-color: var(--brand); color: var(--brand); background: #fff; }
.btn-outline-brand:hover { background: var(--brand-soft); border-color: var(--brand); }
.btn-danger { border-color: #f3c7c9; color: var(--danger); background: #fff; }
.btn-danger:hover { background: var(--danger-soft); border-color: #eab0b3; }

.btn-lg { height: 48px; padding: 0 26px; font-size: 15px; border-radius: 12px; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn-xs { height: 26px; padding: 0 9px; font-size: 12px; border-radius: 7px; font-weight: 600; }
.btn-block { width: 100%; }

/* ---------------------------------------------------------- 卡片 */

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.card-pad { padding: 22px; }
.card-hover { transition: all 0.22s ease; }
.card-hover:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: #d9dcf0; }

/* ---------------------------------------------------------- 表单 */

.field { display: block; margin-bottom: 16px; }
.field > label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 7px; }
.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 13px;
  border: 1px solid var(--border-2); border-radius: 10px;
  background: #fff; outline: none; transition: all 0.16s ease;
}
.textarea { height: auto; padding: 11px 13px; resize: vertical; min-height: 100px; line-height: 1.7; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(91, 91, 246, 0.13); }
.input::placeholder, .textarea::placeholder { color: #a7adc0; }
.select { appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M2 4.5L6 8.5L10 4.5' stroke='%237c8399' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; cursor: pointer; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 6px; }

.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text-2); cursor: pointer; }
.checkbox-row input { width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; }

/* 开关 */
.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #ccd1e0; border-radius: 999px; transition: 0.2s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::before { transform: translateX(18px); }

/* ---------------------------------------------------------- 徽标 / 标签 */

.tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand); white-space: nowrap;
}
.tag-grey { background: #f0f1f6; color: var(--muted); }
.tag-accent { background: var(--accent-soft); color: var(--accent); }
.tag-success { background: var(--success-soft); color: var(--success); }
.tag-warn { background: var(--warn-soft); color: #b26a00; }
.tag-danger { background: var(--danger-soft); color: var(--danger); }
.tag-vip { background: linear-gradient(120deg, #2b2f4a, #4b3f7a); color: #f6d67a; }
.tag-hot { background: linear-gradient(120deg, #ff6b4a, #ff3d7f); color: #fff; }
.tag-line { background: #fff; border: 1px solid var(--border-2); color: var(--text-2); font-weight: 500; }

/* ---------------------------------------------------------- 顶部导航 */

.nav {
  position: sticky; top: 0; z-index: 90; height: var(--nav-h);
  background: rgba(255, 255, 255, 0.86); backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.nav-inner { height: var(--nav-h); display: flex; align-items: center; gap: 30px; }
.logo { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 19px; letter-spacing: -0.02em; flex: none; }
.logo-mark {
  width: 32px; height: 32px; border-radius: 9px; display: block; object-fit: cover;
  box-shadow: 0 4px 12px rgba(91, 91, 246, 0.34);
}
/* flex: 1 让链接区吃掉剩余宽度；min-width: 0 是必须的，否则 flex 子项无法收缩，
   会把「数字人库」这类四字标签逐字折成竖排 —— 这正是窄屏下排版崩掉的原因。 */
.nav-links { display: flex; align-items: center; gap: 4px; flex: 1; min-width: 0; flex-wrap: nowrap; }
.nav-links a {
  padding: 8px 13px; border-radius: 9px; font-size: 14.5px; font-weight: 500;
  color: var(--text-2); transition: all 0.16s; position: relative;
  /* 标签一律不折行；宽度不够时由下面的断点收窄间距，而不是让文字断开 */
  white-space: nowrap;
}
.nav-links a:hover { color: var(--brand); background: var(--brand-soft); }
.nav-links a.active { color: var(--brand); font-weight: 700; }
.nav-links a.active::after {
  content: ""; position: absolute; left: 13px; right: 13px; bottom: 1px; height: 2px;
  background: var(--grad); border-radius: 2px;
}
.nav-actions { display: flex; align-items: center; gap: 10px; flex: none; flex-wrap: nowrap; }
.nav-actions .btn { white-space: nowrap; }
.nav-toggle { display: none; }

/* 公告条 */
.topbar {
  background: var(--grad-soft); border-bottom: 1px solid var(--border);
  font-size: 13px; color: var(--text-2); text-align: center; padding: 8px 16px;
}
.topbar b { color: var(--brand); }

/* 滚动公告：无缝横向跑马灯。track 复制两份内容，位移 -50% 后瞬间归位，视觉上无限循环 */
.topbar-scroll { overflow: hidden; text-align: left; padding: 8px 0; }
.topbar-scroll .topbar-track {
  display: inline-flex; white-space: nowrap; will-change: transform;
  animation: topbar-marquee var(--marquee-dur, 16s) linear infinite;
}
.topbar-scroll .topbar-group { display: inline-flex; padding-right: 64px; gap: 64px; }
.topbar:hover .topbar-track { animation-play-state: paused; }
@keyframes topbar-marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) {
  .topbar-scroll .topbar-track { animation: none; }
}

/* ------------------------------------------------- 全站顶部横幅图片 */
.site-banner { display: block; line-height: 0; border-bottom: 1px solid var(--border); overflow: hidden; }
.site-banner img { width: 100%; height: auto; max-height: var(--banner-h, 90px); object-fit: cover; display: block; }

/* ------------------------------------------------- 首页轮播图 */
.carousel { position: relative; overflow: hidden; background: #0f1222; }
.carousel-viewport { position: relative; }
.carousel-slide {
  display: none; position: relative; text-decoration: none; color: #fff;
}
.carousel-slide.active { display: block; }
.carousel-slide img { width: 100%; height: var(--carousel-h, 320px); object-fit: cover; display: block; }
.carousel-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center;
  padding: 0 max(24px, calc((100% - 1120px) / 2));
  background: linear-gradient(90deg, rgba(10, 12, 30, .58) 0%, rgba(10, 12, 30, .28) 46%, rgba(10, 12, 30, 0) 72%);
}
.carousel-title { font-size: clamp(22px, 3.4vw, 34px); font-weight: 800; letter-spacing: .01em; text-shadow: 0 2px 14px rgba(0,0,0,.35); }
.carousel-sub { margin-top: 8px; font-size: clamp(13px, 1.6vw, 16px); color: rgba(255,255,255,.88); text-shadow: 0 1px 8px rgba(0,0,0,.35); }
.carousel-cta {
  margin-top: 18px; align-self: flex-start; padding: 10px 22px; border-radius: 999px;
  background: var(--grad); color: #fff; font-size: 14px; font-weight: 600;
  box-shadow: 0 6px 20px rgba(91, 91, 246, .45);
}
/* 单帧（无轮播）时不显示文案遮罩之外的任何控件 */
.carousel-arrow {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 3;
  width: 38px; height: 38px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(255,255,255,.16); color: #fff; backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  transition: background .18s ease; opacity: 0;
}
.carousel:hover .carousel-arrow { opacity: 1; }
.carousel-arrow:hover { background: rgba(255,255,255,.32); }
.carousel-arrow.prev { left: 14px; }
.carousel-arrow.next { right: 14px; }
.carousel-dots {
  position: absolute; left: 0; right: 0; bottom: 12px; z-index: 3;
  display: flex; justify-content: center; gap: 8px;
}
.carousel-dot {
  width: 22px; height: 4px; border-radius: 2px; border: none; cursor: pointer;
  background: rgba(255,255,255,.4); transition: background .18s ease; padding: 0;
}
.carousel-dot.active { background: #fff; }
@media (max-width: 760px) {
  .carousel-slide img { height: 180px; }
  .carousel-arrow { display: none; }
  .carousel-overlay { background: linear-gradient(90deg, rgba(10,12,30,.52), rgba(10,12,30,.12)); }
}

/* ---------------------------------------------------------- 页脚 */

.footer { background: #fff; border-top: 1px solid var(--border); padding: 56px 0 28px; margin-top: 40px; }
.footer-grid { display: grid; grid-template-columns: 1.6fr repeat(4, 1fr); gap: 34px; }
.footer h5 { font-size: 14px; margin-bottom: 14px; }
.footer li a { display: block; color: var(--muted); font-size: 13.5px; padding: 5px 0; transition: color 0.15s; }
.footer li a:hover { color: var(--brand); }
.footer-bottom {
  margin-top: 40px; padding-top: 22px; border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  font-size: 13px; color: var(--muted);
}

/* ---------------------------------------------------------- 提示 / 空态 */

.toast-host { position: fixed; top: 84px; right: 24px; z-index: 999; display: flex; flex-direction: column; gap: 10px; }
.toast {
  min-width: 240px; max-width: 380px; padding: 13px 16px; border-radius: 12px;
  background: #fff; box-shadow: var(--shadow-lg); border: 1px solid var(--border);
  display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px;
  animation: toastIn 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.toast.out { animation: toastOut 0.2s forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(24px) scale(0.96); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(24px) scale(0.96); } }
.toast-icon { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.toast.ok .toast-icon { color: var(--success); }
.toast.err .toast-icon { color: var(--danger); }
.toast.info .toast-icon { color: var(--brand); }

.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty svg { margin: 0 auto 14px; opacity: 0.5; }

/* ---------------------------------------------------------- 骨架 / 加载 */

.skeleton { background: linear-gradient(90deg, #eef0f6 25%, #f7f8fc 37%, #eef0f6 63%); background-size: 400% 100%; animation: sk 1.3s ease infinite; border-radius: 8px; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.spinner {
  width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.4); border-top-color: #fff;
  border-radius: 50%; animation: spin 0.7s linear infinite;
}
.spinner-dark { border-color: rgba(91,91,246,0.25); border-top-color: var(--brand); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------- 弹窗 */

.modal-mask {
  position: fixed; inset: 0; background: rgba(20, 22, 38, 0.5); backdrop-filter: blur(3px);
  z-index: 800; display: flex; align-items: center; justify-content: center; padding: 24px;
  animation: fade 0.18s ease;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 560px; max-height: 88vh; overflow: auto;
  animation: pop 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.modal-lg { max-width: 900px; }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(0.98); } }
.modal-head { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal-head h3 { font-size: 17px; }
.modal-head .close { border: none; background: transparent; cursor: pointer; color: var(--muted); font-size: 22px; line-height: 1; padding: 4px 8px; border-radius: 8px; }
.modal-head .close:hover { background: #f1f2f8; color: var(--text); }
.modal-body { padding: 22px 24px; }
.modal-foot { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; background: var(--surface-2); }

/* ---------------------------------------------------------- 表格 */

.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; font-weight: 600; color: var(--muted); font-size: 12.5px;
  padding: 11px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border);
  white-space: nowrap; position: sticky; top: 0; z-index: 2;
}
.table td { padding: 12px 14px; border-bottom: 1px solid #f1f2f8; vertical-align: middle; }
.table tbody tr:hover { background: #fafbff; }
.table-wrap { overflow: auto; border-radius: var(--radius); border: 1px solid var(--border); background: #fff; }

/* 分页 */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 4px; flex-wrap: wrap; }
.pager .info { font-size: 13px; color: var(--muted); }
.pager .pages { display: flex; gap: 6px; }
.pager .pages button {
  min-width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--border-2);
  background: #fff; cursor: pointer; font-size: 13.5px; color: var(--text-2); padding: 0 9px;
}
.pager .pages button:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.pager .pages button.active { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.pager .pages button:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---------------------------------------------------------- 响应式 */

/* 顶部导航挤压顺序：先收昵称 → 再收与「创作工作台」重复的 CTA → 再收链接间距 → 最后折叠。
   这样 1024~1440 这段最常见的桌面宽度下，七个导航项始终能排成一行不折字。 */
@media (max-width: 1360px) {
  .nav-user-name { display: none; } /* 昵称在 title 悬浮提示里仍可见 */
  .nav-inner { gap: 20px; }
}
@media (max-width: 1240px) {
  .nav-logged .nav-cta { display: none; } /* 已登录时「开始创作」与导航里的「创作工作台」重复 */
  .nav-links a { padding: 8px 9px; }
}
@media (max-width: 1080px) {
  .footer-grid { grid-template-columns: 1fr 1fr 1fr; }
}
@media (max-width: 860px) {
  .nav-links { display: none; }
  .nav-toggle { display: inline-flex; }
  .section { padding: 56px 0; }
  .section-title { font-size: 26px; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .wrap { padding: 0 16px; }
  .toast-host { right: 16px; left: 16px; top: 76px; }
}
@media (max-width: 560px) {
  .footer-grid { grid-template-columns: 1fr; }
  .section-title { font-size: 23px; }
}
