/* =========================================================
   创意工坊 · ComfyUI 双站门户
   视觉方向：青春阳光 / 多巴胺配色 / 二次元社区感
   标题 ZCOOL KuaiLe + 正文 Noto Sans SC（本地回退栈兜底）
   ========================================================= */

:root {
  --bg: #FFF7EC;
  --bg-soft: #FFFDF7;
  --card: #FFFFFF;
  --ink: #3A3347;
  --ink-soft: #8B8499;
  --line: #F1E7DA;

  --coral: #FF6B6B;
  --sunny: #FFC53D;
  --mint: #2EC4B6;
  --sky: #5B8CFF;
  --pink: #FF8FB1;
  --grape: #9B8AFB;

  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 10px 30px rgba(58, 51, 71, 0.10);
  --shadow-pop: 0 14px 40px rgba(255, 107, 107, 0.25);

  --font-display: 'ZCOOL KuaiLe', 'Noto Sans SC', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --font-body: 'Noto Sans SC', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  background-image:
    radial-gradient(circle at 12% 18%, rgba(255, 197, 61, .14), transparent 32%),
    radial-gradient(circle at 88% 12%, rgba(255, 143, 177, .13), transparent 30%),
    radial-gradient(circle at 82% 82%, rgba(46, 196, 182, .12), transparent 32%),
    radial-gradient(circle at 8% 88%, rgba(91, 140, 255, .10), transparent 30%);
}

/* ---------- 背景装饰 ---------- */
.deco { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.deco-blob, .deco-dot, .deco-ring { position: absolute; display: block; }
.deco-blob { border-radius: 46% 54% 58% 42% / 48% 42% 58% 52%; opacity: .5; filter: blur(2px); }
.blob-a { width: 340px; height: 300px; left: -120px; top: 8%;
  background: linear-gradient(135deg, rgba(255,197,61,.55), rgba(255,107,107,.45));
  animation: floaty 11s ease-in-out infinite; }
.blob-b { width: 300px; height: 300px; right: -110px; top: 30%;
  background: linear-gradient(135deg, rgba(46,196,182,.5), rgba(91,140,255,.4));
  animation: floaty 13s ease-in-out infinite reverse; }
.blob-c { width: 260px; height: 240px; left: 30%; bottom: -140px;
  background: linear-gradient(135deg, rgba(255,143,177,.5), rgba(155,138,251,.4));
  animation: floaty 15s ease-in-out infinite; }
.deco-dot { border-radius: 50%; }
.dot-a { width: 22px; height: 22px; left: 22%; top: 14%; background: var(--coral);
  animation: bob 5s ease-in-out infinite; }
.dot-b { width: 14px; height: 14px; right: 26%; top: 10%; background: var(--sky);
  animation: bob 6s ease-in-out infinite .8s; }
.dot-c { width: 18px; height: 18px; right: 18%; bottom: 18%; background: var(--sunny);
  animation: bob 7s ease-in-out infinite 1.6s; }
.deco-ring { border: 5px solid rgba(255,107,107,.4); border-radius: 50%; }
.ring-a { width: 90px; height: 90px; left: 6%; bottom: 24%; animation: spin 24s linear infinite; }
.ring-b { width: 56px; height: 56px; right: 8%; top: 56%; border-color: rgba(46,196,182,.45);
  animation: spin 18s linear infinite reverse; }

@keyframes floaty {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-26px) rotate(6deg); }
}
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-14px); }
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 入场动画 ---------- */
.rise { animation: rise .55s cubic-bezier(.22, 1.2, .36, 1) both; }
@keyframes rise {
  from { opacity: 0; transform: translateY(22px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.stagger > * { opacity: 0; animation: rise .55s cubic-bezier(.22, 1.2, .36, 1) forwards; }
.stagger > *:nth-child(1) { animation-delay: .04s; }
.stagger > *:nth-child(2) { animation-delay: .12s; }
.stagger > *:nth-child(3) { animation-delay: .20s; }
.stagger > *:nth-child(4) { animation-delay: .28s; }
.stagger > *:nth-child(5) { animation-delay: .36s; }
.stagger > *:nth-child(6) { animation-delay: .44s; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 14px; z-index: 20;
  margin: 14px auto 0;
  width: min(1120px, calc(100% - 32px));
  display: flex; align-items: center; gap: 18px;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: blur(14px);
  border: 2px solid var(--line);
  border-radius: 999px;
  padding: 10px 18px;
  box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-ball {
  width: 34px; height: 34px; border-radius: 50%;
  background:
    radial-gradient(circle at 32% 32%, #fff 0 12%, transparent 13%),
    conic-gradient(var(--coral), var(--sunny), var(--mint), var(--sky), var(--coral));
  box-shadow: 0 4px 12px rgba(255, 107, 107, .4);
  animation: bob 4s ease-in-out infinite;
}
.brand-name { font-family: var(--font-display); font-size: 22px; letter-spacing: 1px; }
.brand-sub { font-size: 12px; color: var(--ink-soft); border-left: 2px solid var(--line); padding-left: 10px; }

.nav { display: flex; gap: 4px; margin-left: auto; }
.nav-link {
  text-decoration: none; color: var(--ink); font-weight: 700; font-size: 14px;
  padding: 8px 14px; border-radius: 999px; transition: all .2s;
}
.nav-link:hover { background: var(--bg); transform: translateY(-2px); }
.nav-link.active { background: var(--ink); color: #fff; }
.nav-admin { color: var(--coral); }
.nav-admin.active { background: var(--coral); color: #fff; }

.user-chip { display: flex; align-items: center; gap: 8px; }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--sky), var(--grape));
  color: #fff; font-weight: 900; display: grid; place-items: center; font-size: 14px;
}
.user-name { font-weight: 700; font-size: 14px; }

/* ---------- 布局 ---------- */
.page {
  position: relative; z-index: 1;
  width: min(1120px, calc(100% - 32px));
  margin: 26px auto 40px;
  flex: 1;
}
.footer {
  position: relative; z-index: 1;
  text-align: center; color: var(--ink-soft); font-size: 12px;
  padding: 18px 0 26px; display: flex; gap: 10px; justify-content: center; align-items: center;
}

/* ---------- 通用元素 ---------- */
h1, h2, h3 { font-family: var(--font-display); font-weight: 400; margin: 0; }

.card {
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

.btn {
  font-family: var(--font-body);
  border: none; cursor: pointer; font-weight: 700; font-size: 15px;
  border-radius: 999px; padding: 12px 24px;
  transition: transform .15s, box-shadow .15s, filter .15s;
  text-decoration: none; display: inline-flex; align-items: center; gap: 8px;
  justify-content: center;
}
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary { background: linear-gradient(135deg, var(--coral), #FF8E53); color: #fff; box-shadow: var(--shadow-pop); }
.btn-primary:hover:not(:disabled) { transform: translateY(-2px); filter: brightness(1.05); }
.btn-mint { background: linear-gradient(135deg, var(--mint), #4AD8C8); color: #fff; box-shadow: 0 10px 26px rgba(46,196,182,.3); }
.btn-mint:hover:not(:disabled) { transform: translateY(-2px); }
.btn-sky { background: linear-gradient(135deg, var(--sky), #7FA8FF); color: #fff; }
.btn-ghost { background: transparent; color: var(--ink-soft); border: 2px solid var(--line); }
.btn-ghost:hover { color: var(--ink); border-color: var(--ink-soft); }
.btn-danger { background: linear-gradient(135deg, #FF4D4D, #C0392B); color: #fff; }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-xs { padding: 4px 10px; font-size: 12px; }

.tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px;
  background: var(--bg); color: var(--ink-soft);
}
.tag-admin { background: linear-gradient(135deg, var(--sunny), #FFD97B); color: #7A5B00; }
.tag-mint { background: rgba(46,196,182,.15); color: #0E8078; }
.tag-coral { background: rgba(255,107,107,.15); color: #C0392B; }
.tag-sky { background: rgba(91,140,255,.15); color: #2B57C9; }
.tag-gray { background: #EFEFEF; color: #777; }

.dot-status { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.dot-on { background: #2ECC71; box-shadow: 0 0 0 4px rgba(46,204,113,.2); animation: pulse 1.8s infinite; }
.dot-off { background: #C0C0C8; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(46,204,113,0); } }

/* ---------- 表单 ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 700; font-size: 14px; margin-bottom: 8px; }
.field .hint { font-weight: 400; color: var(--ink-soft); font-size: 12px; margin-left: 8px; }
.input, textarea.input, select.input {
  width: 100%; font-family: var(--font-body); font-size: 15px; color: var(--ink);
  background: var(--bg-soft); border: 2px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 14px; outline: none; transition: border-color .2s, box-shadow .2s;
}
.input:focus { border-color: var(--sunny); box-shadow: 0 0 0 4px rgba(255,197,61,.25); }

/* ---------- Toast ---------- */
.toast-box { position: fixed; top: 84px; left: 50%; transform: translateX(-50%); z-index: 99; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.toast {
  background: var(--ink); color: #fff; font-weight: 700; font-size: 14px;
  padding: 12px 22px; border-radius: 999px; box-shadow: var(--shadow);
  animation: toast-in .35s cubic-bezier(.22, 1.4, .36, 1);
  display: flex; gap: 8px; align-items: center; max-width: 80vw;
}
.toast.ok { background: linear-gradient(135deg, #2ECC71, #27AE60); }
.toast.err { background: linear-gradient(135deg, #FF6B6B, #E74C3C); }
.toast.out { animation: toast-out .3s forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-16px) scale(.9); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-12px) scale(.95); } }

/* ---------- 撒花 ---------- */
.confetti { position: fixed; top: -10px; z-index: 98; width: 10px; height: 14px; border-radius: 2px; pointer-events: none; animation: confetti-fall linear forwards; }
@keyframes confetti-fall {
  to { transform: translateY(105vh) rotate(720deg); opacity: .8; }
}

/* ---------- 加载旋转 ---------- */
.spin {
  width: 18px; height: 18px; border-radius: 50%; flex: none;
  border: 3px solid rgba(255,255,255,.4); border-top-color: #fff;
  animation: spin .8s linear infinite;
}

/* ---------- 表格 ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; color: var(--ink-soft); font-size: 12px; padding: 8px 10px; border-bottom: 2px solid var(--line); }
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:hover td { background: var(--bg-soft); }

/* ---------- 管理后台 ---------- */
.admin-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.admin-tab {
  border: 2px solid var(--line); background: #fff; border-radius: 999px;
  padding: 9px 18px; font-weight: 700; font-size: 14px; cursor: pointer; color: var(--ink-soft);
  transition: all .2s; font-family: var(--font-body);
}
.admin-tab:hover { transform: translateY(-2px); color: var(--ink); }
.admin-tab.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.admin-panel h2 { font-size: 24px; margin-bottom: 14px; display: flex; align-items: center; gap: 10px; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card { border-radius: var(--radius-sm); padding: 16px; color: #fff; }
.stat-card .num { font-family: var(--font-display); font-size: 34px; line-height: 1; }
.stat-card .lbl { font-size: 12px; opacity: .9; margin-top: 6px; }
.stat-coral { background: linear-gradient(135deg, var(--coral), #FF8E53); }
.stat-mint { background: linear-gradient(135deg, var(--mint), #4AD8C8); }
.stat-sky { background: linear-gradient(135deg, var(--sky), #7FA8FF); }
.stat-sunny { background: linear-gradient(135deg, var(--sunny), #FFD97B); color: #7A5B00; }

/* ---------- 空状态 ---------- */
.empty { text-align: center; color: var(--ink-soft); padding: 40px 0; }
.empty .empty-emoji { font-size: 42px; display: block; margin-bottom: 10px; }

/* ---------- 首页工作站卡片 ---------- */
.station-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; }
.station-card { position: relative; overflow: hidden; }
.station-card .station-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.station-emoji {
  width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center;
  font-size: 26px; background: linear-gradient(135deg, #FFE9A8, #FFD0B8);
  animation: bob 5s ease-in-out infinite;
}
.station-name { font-family: var(--font-display); font-size: 22px; }
.station-desc { color: var(--ink-soft); font-size: 13px; margin-bottom: 14px; min-height: 36px; }
.station-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }

/* ---------- 主机硬件监控（内存 / 显存 / 温度） ---------- */
.hw-box { display: grid; gap: 6px; margin: -6px 0 14px; }
.hw-item { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-soft); }
.hw-label { width: 30px; flex: none; }
.hw-track { flex: 1; height: 6px; border-radius: 3px; background: rgba(43,36,64,.08); overflow: hidden; }
.hw-fill { display: block; height: 100%; border-radius: 3px; transition: width .5s ease; }
.hw-fill.hw-ok { background: var(--mint); }
.hw-fill.hw-warn { background: #F2A93B; }
.hw-fill.hw-danger { background: var(--coral); }
.hw-val { width: 46px; flex: none; text-align: right; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---------- 认证页 ---------- */
.auth-wrap { min-height: calc(100vh - 60px); display: grid; place-items: center; padding: 20px 0; }
.auth-card { width: min(430px, 100%); padding: 34px 30px; position: relative; z-index: 1; }
.auth-title { font-size: 34px; text-align: center; margin-bottom: 4px; }
.auth-sub { text-align: center; color: var(--ink-soft); font-size: 13px; margin-bottom: 24px; }
.auth-switch { text-align: center; margin-top: 18px; font-size: 13px; color: var(--ink-soft); }
.auth-switch a { color: var(--coral); font-weight: 700; text-decoration: none; }
.auth-mascot { text-align: center; font-size: 44px; margin-bottom: 6px; animation: bob 3.5s ease-in-out infinite; }

.page-title { font-size: 32px; margin-bottom: 6px; display: flex; align-items: center; gap: 12px; }
.page-sub { color: var(--ink-soft); font-size: 14px; margin-bottom: 22px; }

.section-title { font-size: 20px; margin: 26px 0 14px; display: flex; align-items: center; gap: 8px; }

.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.grow { flex: 1; }

@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; border-radius: 24px; }
  .nav { order: 3; width: 100%; justify-content: center; }
  .brand-sub { display: none; }
}

/* ---------------- 提示词库 ---------------- */
.prompt-card { margin-bottom: 14px; }
.prompt-code {
  margin: 12px 0 0;
  padding: 14px 16px;
  background: #2B2440;
  color: #FFE9C9;
  border-radius: 14px;
  font-size: 12.5px;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 300px;
  overflow: auto;
  font-family: "Cascadia Code", Consolas, "Courier New", monospace;
}
.prompt-notes { margin-top: 10px; font-size: 13px; color: var(--ink-soft); }
.prompt-notes p { margin: 4px 0; }
.prompt-notes ul, .prompt-docs ul { margin: 4px 0 4px 18px; }
.prompt-notes li, .prompt-docs li { margin: 3px 0; }
.prompt-notes code, .prompt-docs code {
  background: rgba(91,140,255,.12); color: #2B57C9;
  padding: 1px 6px; border-radius: 6px; font-size: 12px;
}
.prompt-doc { margin-bottom: 14px; }
.prompt-doc h4 { margin: 10px 0 6px; font-size: 15px; color: var(--ink); }
.prompt-doc h5, .prompt-doc h6 { margin: 8px 0 4px; font-size: 13.5px; color: var(--ink); }
.prompt-doc p { margin: 5px 0; font-size: 13px; color: var(--ink-soft); line-height: 1.7; }
.prompt-doc blockquote {
  margin: 6px 0; padding: 8px 12px; border-left: 3px solid var(--sunny);
  background: rgba(255,197,61,.10); border-radius: 0 10px 10px 0; font-size: 13px;
}
.prompt-doc pre {
  margin: 8px 0; padding: 10px 12px; background: #2B2440; color: #FFE9C9;
  border-radius: 10px; font-size: 12px; overflow: auto; white-space: pre-wrap;
}
.prompt-doc table { border-collapse: collapse; margin: 8px 0; font-size: 12.5px; }
.prompt-doc th, .prompt-doc td {
  border: 1px solid rgba(43,36,64,.15); padding: 5px 10px; text-align: left;
}
.prompt-doc th { background: rgba(91,140,255,.10); }
.prompt-doc hr { border: none; border-top: 1px dashed rgba(43,36,64,.2); margin: 10px 0; }
.pill.active { pointer-events: none; }
