:root {
  --bg: #0b0d12;
  --bg-soft: #10131b;
  --panel: #141824;
  --panel-2: #1a1f2d;
  --border: #232a3a;
  --border-soft: #1c2230;
  --text: #e8eaf0;
  --text-dim: #98a1b3;
  --accent: #f0a92e;
  --accent-deep: #d98e17;
  --accent-soft: rgba(240, 169, 46, 0.12);
  --danger: #e5534b;
  --ok: #3fb950;
  --radius: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
img, video { max-width: 100%; }

.hidden { display: none !important; }

/* ---------- 顶部导航 ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 28px;
  background: rgba(11, 13, 18, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-soft);
}
.nav-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; letter-spacing: .3px; }
.nav-brand svg { width: 28px; height: 28px; }
.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-links a { padding: 7px 14px; border-radius: 8px; font-size: 14px; color: var(--text-dim); transition: all .15s; }
.nav-links a:hover, .nav-links a.active { color: var(--text); background: var(--panel-2); }
.nav-user { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 18px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--panel); color: var(--text); font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all .15s;
}
.btn:hover { border-color: var(--accent); }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-deep)); border: none; color: #191103; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text-dim); }
.btn-ghost:hover { color: var(--text); }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn-danger { border-color: rgba(229,83,75,.4); color: var(--danger); background: rgba(229,83,75,.06); }
.btn-danger:hover { background: rgba(229,83,75,.14); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

/* ---------- 首页 Hero ---------- */
.hero {
  position: relative;
  padding: 96px 28px 80px;
  text-align: center;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(600px 300px at 20% 10%, rgba(240,169,46,.14), transparent 60%),
    radial-gradient(700px 320px at 80% 20%, rgba(240,169,46,.08), transparent 60%);
  pointer-events: none;
}
.hero h1 { font-size: clamp(30px, 5vw, 52px); font-weight: 800; letter-spacing: .5px; line-height: 1.25; }
.hero h1 em { color: var(--accent); font-style: normal; }
.hero p { margin: 18px auto 30px; max-width: 640px; color: var(--text-dim); font-size: 16px; line-height: 1.8; }
.hero .cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero .badges { margin-top: 26px; display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; color: var(--text-dim); font-size: 13px; }
.hero .badges span { padding: 5px 12px; border: 1px solid var(--border-soft); border-radius: 999px; background: var(--bg-soft); }

/* ---------- 区块 ---------- */
.section { padding: 64px 28px; }
.section-head { text-align: center; margin-bottom: 36px; }
.section-head h2 { font-size: 26px; font-weight: 800; }
.section-head p { color: var(--text-dim); margin-top: 10px; font-size: 14.5px; }

.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 18px; max-width: 1080px; margin: 0 auto; }
.feature { background: var(--panel); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 24px; }
.feature .icon { width: 44px; height: 44px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; margin-bottom: 14px; }
.feature h3 { font-size: 16px; margin-bottom: 8px; }
.feature p { color: var(--text-dim); font-size: 13.5px; line-height: 1.7; }

/* ---------- 作品网格 ---------- */
.works-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; max-width: 1200px; margin: 0 auto; }
.work-card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform .18s, border-color .18s;
}
.work-card:hover { transform: translateY(-3px); border-color: var(--accent); }
.work-card .cover { aspect-ratio: 1 / 1; background: #000; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.work-card .cover img, .work-card .cover video { width: 100%; height: 100%; object-fit: cover; }
.work-card .meta { padding: 10px 12px; font-size: 12.5px; color: var(--text-dim); display: flex; justify-content: space-between; gap: 8px; }
.work-card .meta .type { color: var(--accent); }
.work-card .play-mark {
  position: absolute; right: 10px; bottom: 44px;
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(0,0,0,.55); color: #fff;
  display: flex; align-items: center; justify-content: center;
}
.work-card .private-badge { position: absolute; left: 10px; top: 10px; font-size: 11px; padding: 3px 9px; border-radius: 999px; background: rgba(0,0,0,.6); color: var(--text-dim); }

.gallery-empty { text-align: center; color: var(--text-dim); padding: 60px 0; }

/* ---------- 表单 ---------- */
.auth-wrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: 50px 20px; }
.auth-card { width: 100%; max-width: 400px; background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 34px 30px; }
.auth-card h1 { font-size: 22px; margin-bottom: 6px; }
.auth-card .sub { color: var(--text-dim); font-size: 13.5px; margin-bottom: 24px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 7px; }
.field input {
  width: 100%; padding: 11px 13px;
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text); font-size: 14px; outline: none;
}
.field input:focus { border-color: var(--accent); }
.auth-card .btn { width: 100%; margin-top: 6px; }
.auth-alt { text-align: center; margin-top: 18px; font-size: 13.5px; color: var(--text-dim); }
.auth-alt a { color: var(--accent); }
.form-error { color: var(--danger); font-size: 13px; margin-bottom: 12px; min-height: 18px; }

/* ---------- 创作台 ---------- */
.studio-wrap { flex: 1; display: flex; flex-direction: column; padding: 18px 24px 16px; gap: 12px; max-width: 960px; margin: 0 auto; width: 100%; }
.studio-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.studio-head h1 { font-size: 20px; }
.studio-head .hint { color: var(--text-dim); font-size: 13px; }
.banner {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px;
  font-size: 13px; background: rgba(240,169,46,.08);
  border: 1px solid rgba(240,169,46,.25); border-radius: 10px; color: #f4c56a;
}
.banner code { background: rgba(255,255,255,.08); padding: 1px 6px; border-radius: 4px; font-size: 12px; }

.chat { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; padding: 6px 2px; max-height: calc(100vh - 300px); min-height: 320px; }
.chat::-webkit-scrollbar { width: 8px; }
.chat::-webkit-scrollbar-thumb { background: #2c3444; border-radius: 4px; }

.chat-empty { margin: auto; text-align: center; color: var(--text-dim); max-width: 560px; }
.chat-empty .icon { color: #3a4356; margin-bottom: 12px; }
.chat-empty h2 { font-size: 19px; color: var(--text); margin-bottom: 10px; }
.chat-empty p { font-size: 13.5px; line-height: 1.9; }

.msg { display: flex; gap: 10px; animation: fadeUp .25s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.msg .avatar { width: 30px; height: 30px; border-radius: 8px; flex: 0 0 30px; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.msg.user { flex-direction: row-reverse; }
.msg.user .avatar { background: linear-gradient(135deg, var(--accent), var(--accent-deep)); color: #1a1205; }
.msg.assistant .avatar { background: #2a3242; color: var(--accent); }
.bubble { max-width: 76%; padding: 10px 14px; border-radius: 12px; font-size: 14px; line-height: 1.7; word-break: break-word; white-space: pre-wrap; }
.msg.user .bubble { background: #2b2413; border: 1px solid #3d341a; }
.msg.assistant .bubble { background: var(--panel-2); border: 1px solid var(--border); }
.media-box { margin-top: 8px; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); background: #000; }
.media-box img, .media-box video { display: block; max-width: 100%; max-height: 380px; }
.media-links { display: flex; gap: 10px; margin-top: 6px; font-size: 12.5px; }
.media-links a { color: var(--accent); }
.media-links a:hover { text-decoration: underline; }
.saved-tag { display: inline-block; margin-top: 6px; font-size: 12px; color: var(--ok); }

.typing { display: inline-flex; gap: 4px; align-items: center; padding: 4px 2px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--text-dim); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; }
.typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.composer { padding: 12px; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; }
.refs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.ref-chip { display: flex; align-items: center; gap: 6px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 4px 8px; font-size: 12px; color: var(--text-dim); max-width: 220px; }
.ref-chip img, .ref-chip video { width: 34px; height: 34px; object-fit: cover; border-radius: 5px; }
.ref-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ref-chip button { background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 14px; padding: 0 2px; }
.ref-chip button:hover { color: var(--danger); }
.composer-row { display: flex; align-items: flex-end; gap: 10px; }
.upload-btn { display: flex; align-items: center; gap: 6px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-soft); color: var(--text-dim); font-size: 13px; cursor: pointer; white-space: nowrap; }
.upload-btn:hover { border-color: var(--accent); color: var(--text); }
textarea#prompt { flex: 1; min-height: 52px; max-height: 160px; resize: vertical; background: var(--bg-soft); border: 1px solid var(--border); border-radius: 10px; color: var(--text); font-family: inherit; font-size: 14px; line-height: 1.6; padding: 10px 12px; outline: none; }
textarea#prompt:focus { border-color: var(--accent); }
textarea#prompt::placeholder { color: #5d6677; }
.send-btn { display: flex; align-items: center; gap: 7px; padding: 12px 18px; border: none; border-radius: 10px; background: linear-gradient(135deg, var(--accent), var(--accent-deep)); color: #1a1205; font-size: 14px; font-weight: 700; cursor: pointer; transition: filter .15s, opacity .15s; }
.send-btn:hover:not(:disabled) { filter: brightness(1.1); }
.send-btn:disabled { opacity: .45; cursor: not-allowed; }
.send-btn.loading { pointer-events: none; }
.composer-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 12px; color: var(--text-dim); }
.link-btn { background: none; border: none; color: var(--text-dim); font-size: 12px; cursor: pointer; text-decoration: underline; }
.link-btn:hover { color: var(--accent); }

/* ---------- 作品详情弹层 ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.72); z-index: 60; display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal { position: relative; background: var(--panel); border: 1px solid var(--border); border-radius: 16px; max-width: 860px; width: 100%; max-height: 88vh; overflow-y: auto; padding: 20px; }
.modal video, .modal img { width: 100%; border-radius: 10px; background: #000; }
.modal .p { margin-top: 14px; font-size: 14px; line-height: 1.7; white-space: pre-wrap; }
.modal .m { margin-top: 10px; display: flex; justify-content: space-between; align-items: center; color: var(--text-dim); font-size: 12.5px; }
.modal .close { position: absolute; right: 14px; top: 12px; background: var(--panel-2); border: 1px solid var(--border); color: var(--text-dim); width: 32px; height: 32px; border-radius: 8px; cursor: pointer; font-size: 15px; }
.modal .close:hover { color: var(--text); }

/* ---------- 个人中心 ---------- */
.me-wrap { flex: 1; max-width: 1080px; width: 100%; margin: 0 auto; padding: 28px 24px; }
.me-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px; margin-bottom: 22px; }
.me-head h1 { font-size: 22px; }
.me-head .email { color: var(--text-dim); font-size: 14px; margin-top: 4px; }
.me-toolbar { display: flex; gap: 8px; }
.works-grid.mine .work-card .cover { aspect-ratio: 16 / 10; }
.empty-tip { text-align: center; color: var(--text-dim); padding: 50px 0; }
.empty-tip a { color: var(--accent); }

/* ---------- 分页 ---------- */
.pager { display: flex; gap: 8px; justify-content: center; margin-top: 28px; }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%); background: #232a38; border: 1px solid #333c50; color: var(--text); padding: 10px 18px; border-radius: 10px; font-size: 13px; z-index: 80; box-shadow: 0 8px 24px rgba(0,0,0,.4); max-width: 80%; }

/* ---------- 页脚 ---------- */
.footer { margin-top: auto; border-top: 1px solid var(--border-soft); padding: 22px 28px; text-align: center; color: var(--text-dim); font-size: 12.5px; }
.footer a { color: var(--text-dim); }
.footer a:hover { color: var(--accent); }

@media (max-width: 640px) {
  .nav { padding: 10px 14px; flex-wrap: wrap; }
  .nav-links { order: 3; width: 100%; justify-content: center; }
  .hero { padding: 64px 18px 56px; }
  .section { padding: 44px 16px; }
  .bubble { max-width: 88%; }
  .composer-row { flex-wrap: wrap; }
  textarea#prompt { min-width: 100%; order: -1; }
  .send-btn { flex: 1 1 auto; justify-content: center; }
  .studio-wrap { padding: 12px; }
}
