:root {
  --bg: #0a0a0c;
  --bg-2: #121216;
  --bg-3: #191920;
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.14);
  --text: #f2f3f5;
  --text-2: #a7a9b4;
  --text-3: #6b6d78;
  --accent: #ff4d67;
  --accent-2: #ff8a5c;
  --ok: #3ddc97;
  --warn: #ffb020;
  --radius: 14px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
}

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

html, body { height: 100%; }

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

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; font-size: 14px; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------- 布局 ---------------- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px;
  flex: 0 0 232px;
  border-right: 1px solid var(--line);
  background: var(--bg-2);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 18px; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid; place-items: center; font-size: 16px; font-weight: 700;
}
.brand-name { font-size: 16px; font-weight: 600; letter-spacing: .3px; }
.brand-sub { font-size: 11px; color: var(--text-3); }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 10px;
  color: var(--text-2); font-size: 13.5px;
  transition: .16s;
}
.nav-item:hover { background: var(--bg-3); color: var(--text); }
.nav-item.active { background: rgba(255, 77, 103, 0.12); color: var(--text); }
.nav-item.active .ico { color: var(--accent); }
.ico { width: 18px; text-align: center; font-size: 15px; }

.sidebar-footer { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, #4b6cff, #a855f7);
  display: grid; place-items: center; font-size: 12px; font-weight: 600;
}
.user-meta { font-size: 12px; overflow: hidden; }
.user-meta strong { display: block; font-size: 13px; font-weight: 500; }
.user-meta span { color: var(--text-3); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 60px; flex: 0 0 60px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; gap: 16px;
  position: sticky; top: 0; z-index: 20;
  background: rgba(10, 10, 12, 0.82);
  backdrop-filter: blur(14px);
}
.topbar h1 { font-size: 15px; font-weight: 600; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.content { padding: 22px 24px 60px; max-width: 1280px; width: 100%; }

/* ---------------- 通用组件 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 16px; border-radius: 10px;
  font-size: 13.5px; font-weight: 500;
  background: var(--bg-3); border: 1px solid var(--line-2);
  transition: .16s; white-space: nowrap;
}
.btn:hover { border-color: rgba(255, 255, 255, 0.28); background: #202029; }
.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent; color: #fff;
}
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.sm { height: 30px; padding: 0 12px; font-size: 12.5px; border-radius: 8px; }

.card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}

.field { display: flex; flex-direction: column; gap: 7px; }
.field label { font-size: 12.5px; color: var(--text-2); }
.input {
  height: 38px; padding: 0 12px; border-radius: 10px;
  background: var(--bg); border: 1px solid var(--line-2);
  color: var(--text); outline: none; transition: .16s;
}
.input:focus { border-color: var(--accent); }
textarea.input { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.6; }

.tag {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px;
  border-radius: 6px; font-size: 11.5px;
  background: rgba(255, 255, 255, 0.06); color: var(--text-2);
}
.tag.hot { background: rgba(255, 77, 103, 0.15); color: #ff8fa0; }
.tag.ok { background: rgba(61, 220, 151, 0.14); color: var(--ok); }
.tag.warn { background: rgba(255, 176, 32, 0.14); color: var(--warn); }

.grid { display: grid; gap: 14px; }
.notice {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-radius: 12px;
  background: rgba(255, 176, 32, 0.08);
  border: 1px solid rgba(255, 176, 32, 0.2);
  color: #ffd591; font-size: 12.5px;
}

.section-title { font-size: 14px; font-weight: 600; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.muted { color: var(--text-3); font-size: 12.5px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

/* ---------------- 登录页 ---------------- */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center;
  background:
    radial-gradient(900px 500px at 20% 0%, rgba(255, 77, 103, 0.16), transparent 60%),
    radial-gradient(700px 500px at 90% 100%, rgba(75, 108, 255, 0.14), transparent 60%),
    var(--bg);
  padding: 24px;
}
.login-card { width: 100%; max-width: 420px; background: rgba(18, 18, 22, 0.9); border: 1px solid var(--line-2); border-radius: 20px; padding: 32px; box-shadow: var(--shadow); }
.login-card h2 { font-size: 22px; margin-bottom: 6px; }
.login-card .desc { color: var(--text-2); font-size: 13px; margin-bottom: 22px; }

/* ---------------- 创作画布 ---------------- */
.canvas-layout { display: grid; grid-template-columns: 1fr 300px; gap: 16px; align-items: start; }
@media (max-width: 1080px) { .canvas-layout { grid-template-columns: 1fr; } }

.prompt-box { background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 16px; padding: 14px; }
.prompt-box textarea {
  width: 100%; min-height: 96px; background: transparent; border: none; outline: none;
  color: var(--text); font-size: 14.5px; line-height: 1.7; resize: none;
}
.prompt-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  height: 30px; padding: 0 12px; border-radius: 999px; font-size: 12.5px;
  border: 1px solid var(--line-2); color: var(--text-2); transition: .16s;
}
.chip:hover { color: var(--text); border-color: rgba(255, 255, 255, .3); }
.chip.on { background: rgba(255, 77, 103, .16); border-color: rgba(255, 77, 103, .5); color: #ff9bab; }

/* 参数区 */
.params { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin-top: 14px; }
.param { display: flex; flex-direction: column; gap: 6px; }
.param > label { font-size: 11.5px; color: var(--text-3); letter-spacing: .2px; }
.param select, .param input.input { height: 34px; font-size: 13px; }
.param.hide { display: none; }

/* 参考图上传 */
.ref-drop {
  border: 1px dashed var(--line-2); border-radius: 10px; height: 34px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 12px; color: var(--text-3); cursor: pointer; transition: .16s; overflow: hidden;
}
.ref-drop:hover { border-color: var(--accent); color: var(--text-2); }
.ref-drop img { height: 100%; object-fit: cover; }

/* 结果区 */
.result-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-top: 16px; }
.result-card {
  aspect-ratio: 9 / 12; border-radius: 14px; border: 1px solid var(--line);
  background: linear-gradient(160deg, #1b1b23, #101015);
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 12px; position: relative; overflow: hidden;
}
.result-card.wide { grid-column: 1 / -1; aspect-ratio: 16 / 9; }
.result-card .ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-3); font-size: 28px; }
.result-card .meta { position: relative; font-size: 11.5px; color: var(--text-2); background: linear-gradient(transparent, rgba(0,0,0,.75)); margin: -12px; padding: 28px 12px 10px; }
.result-card img, .result-card video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.result-actions { position: absolute; top: 8px; right: 8px; display: flex; gap: 6px; z-index: 2; }
.result-actions a, .result-actions button {
  height: 26px; padding: 0 9px; border-radius: 7px; font-size: 11.5px;
  background: rgba(0,0,0,.62); border: 1px solid var(--line-2); color: #fff;
  display: inline-flex; align-items: center; backdrop-filter: blur(6px);
}

/* 加载动画 */
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 2px solid rgba(255,255,255,.14); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.skill-list { display: flex; flex-direction: column; gap: 8px; }
.skill-item { display: flex; gap: 10px; padding: 10px; border-radius: 10px; border: 1px solid var(--line); transition: .16s; }
.skill-item:hover { background: var(--bg-3); border-color: var(--line-2); }
.skill-emoji { width: 32px; height: 32px; border-radius: 9px; background: var(--bg-3); display: grid; place-items: center; font-size: 16px; flex: 0 0 32px; }
.skill-item strong { font-size: 13px; font-weight: 500; display: block; }
.skill-item span { font-size: 11.5px; color: var(--text-3); }

/* ---------------- 作品库 ---------------- */
.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.asset-card { border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--bg-2); }
.asset-card .thumb { aspect-ratio: 3/4; background: linear-gradient(150deg, #22222c, #14141a); display: grid; place-items: center; color: var(--text-3); }
.asset-card .body { padding: 10px 12px; font-size: 12px; }

/* ---------------- 灵感广场 ---------------- */
.feed-grid { columns: 4 220px; column-gap: 14px; }
.feed-item { break-inside: avoid; margin-bottom: 14px; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: var(--bg-2); position: relative; }
.feed-thumb { background: linear-gradient(160deg, #242430, #121218); display: grid; place-items: center; color: var(--text-3); }
.feed-body { padding: 10px 12px; }
.feed-title { font-size: 13px; font-weight: 500; margin-bottom: 2px; }
.feed-sub { font-size: 11.5px; color: var(--text-3); display: flex; justify-content: space-between; }

/* ---------------- 会员 ---------------- */
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.plan { border: 1px solid var(--line-2); border-radius: 16px; padding: 20px; background: var(--bg-2); position: relative; }
.plan.featured { border-color: rgba(255, 77, 103, .55); background: linear-gradient(180deg, rgba(255, 77, 103, .1), var(--bg-2)); }
.plan .price { font-size: 26px; font-weight: 600; margin: 8px 0 14px; }
.plan .price small { font-size: 12px; color: var(--text-3); font-weight: 400; }
.plan ul { list-style: none; display: flex; flex-direction: column; gap: 7px; font-size: 12.5px; color: var(--text-2); margin-bottom: 16px; }
.plan li::before { content: "✓"; color: var(--ok); margin-right: 7px; }

/* ---------------- 接口文档 ---------------- */
.api-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.api-table th, .api-table td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.api-table th { color: var(--text-2); font-weight: 500; font-size: 12px; }
.api-table code { font-family: ui-monospace, Menlo, monospace; font-size: 12px; color: #8ec5ff; }
.method { display: inline-block; min-width: 44px; text-align: center; padding: 1px 6px; border-radius: 5px; font-size: 11px; font-weight: 600; }
.method.get { background: rgba(61, 220, 151, .15); color: var(--ok); }
.method.post { background: rgba(75, 108, 255, .18); color: #8ea8ff; }

.toast-host { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 999; }
.toast { padding: 10px 16px; border-radius: 10px; background: #22222b; border: 1px solid var(--line-2); font-size: 13px; box-shadow: var(--shadow); animation: slideUp .25s ease; }
@keyframes slideUp { from { opacity: 0; transform: translateY(8px); } }

.page { display: none; }
.page.active { display: block; }
