:root {
  --bg: #0f1115;
  --panel: #181b22;
  --panel-2: #20242d;
  --line: #2a2f3a;
  --text: #e6e8ee;
  --muted: #9aa3b2;
  --brand: #6c8cff;
  --brand-2: #8a6cff;
  --ok: #2ecc71;
  --warn: #f5a623;
  --err: #ff5c5c;
  --accent: #ff7a18;
  --accent-2: #ff5e00;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}
a { color: var(--brand); text-decoration: none; }
button {
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 14px;
  background: var(--brand);
  color: #fff;
  transition: opacity .15s;
}
button:hover { opacity: .9; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.ghost { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); }
button.danger { background: var(--err); }
button.sm { padding: 5px 10px; font-size: 13px; }
input, textarea, select {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  padding: 9px 12px;
  font-size: 14px;
  outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--brand); }
label { display: block; margin: 12px 0 6px; color: var(--muted); font-size: 13px; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 20px; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; border-bottom: 1px solid var(--line); background: var(--panel);
}
.brand { font-weight: 700; font-size: 18px; background: linear-gradient(90deg,var(--brand),var(--brand-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.container { max-width: 1080px; margin: 0 auto; padding: 24px; }
.muted { color: var(--muted); }
.pill { display:inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; }
.pill.ok { background: rgba(46,204,113,.15); color: var(--ok); }
.pill.warn { background: rgba(245,166,35,.15); color: var(--warn); }
.pill.err { background: rgba(255,92,92,.15); color: var(--err); }
.balance { font-size: 15px; }
.balance b { color: var(--ok); font-size: 18px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 13px; }
th { color: var(--muted); font-weight: 600; }
.grid { display: grid; gap: 16px; }
.grid.cards { grid-template-columns: repeat(auto-fill,minmax(160px,1fr)); }
.stat { background: var(--panel); border:1px solid var(--line); border-radius: 12px; padding: 16px; }
.stat .n { font-size: 26px; font-weight: 700; }
.stat .l { color: var(--muted); font-size: 13px; margin-top: 4px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill,minmax(150px,1fr)); gap: 12px; }
.gallery .item { background: var(--panel-2); border:1px solid var(--line); border-radius: 10px; overflow: hidden; }
.gallery .item img { width: 100%; display: block; aspect-ratio: 1; object-fit: cover; }
.gallery .item .meta { padding: 8px; font-size: 12px; color: var(--muted); }
.tabs { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.tabs button { background: var(--panel-2); color: var(--muted); }
.tabs button.active { background: var(--brand); color: #fff; }
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: none; align-items: center; justify-content: center; z-index: 50; }
.modal-bg.show { display: flex; }
.modal { width: 420px; max-width: 92vw; }
.toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); background: var(--panel-2); border:1px solid var(--line); padding: 12px 20px; border-radius: 10px; z-index: 100; display:none; }
.toast.show { display: block; }
.center { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.auth-box { width: 380px; max-width: 92vw; }
.hidden { display: none !important; }
.spinner { width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--brand); border-radius: 50%; display:inline-block; animation: spin .8s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.thumb-row { display:flex; gap:8px; flex-wrap: wrap; margin-top: 8px; }
.thumb-row img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; border:1px solid var(--line); }

/* ================= 厨房式生成台 ================= */
.kitchen { display: grid; grid-template-columns: 360px 1fr 380px; gap: 16px; align-items: start; }
.kcol { min-width: 0; }
.kpanel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.ktitle { font-size: 12px; color: var(--muted); margin: 14px 0 8px; display: flex; justify-content: space-between; align-items: center; }
.ktitle:first-child { margin-top: 0; }

/* 模型卡片 */
.model-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mcard { position: relative; background: var(--panel-2); border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; transition: all .15s; }
.mcard:hover { border-color: var(--brand); }
.mcard.active { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: var(--accent); color: #fff; }
.mcard .mc-name { font-weight: 700; font-size: 14px; }
.mcard .mc-sub { font-size: 11px; opacity: .8; margin-top: 2px; }
.mcard .mc-badge { position: absolute; top: -8px; right: -6px; background: var(--ok); color: #fff; font-size: 10px; padding: 1px 6px; border-radius: 8px; }

/* 拖拽上传 */
.drop-zone { border: 1.5px dashed var(--line); border-radius: 10px; padding: 16px; text-align: center; color: var(--muted); cursor: pointer; transition: all .15s; }
.drop-zone:hover, .drop-zone.drag { border-color: var(--accent); color: var(--accent); background: rgba(255,122,24,.06); }

/* 分段按钮 */
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button { flex: 1; min-width: 44px; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); padding: 8px 6px; border-radius: 8px; font-weight: 600; }
.seg button.active { background: #fff; color: #111; border-color: #fff; }

/* 数量步进 + 下单 */
.order-row { display: flex; gap: 12px; align-items: stretch; margin-top: 14px; }
.stepper { display: flex; align-items: center; gap: 4px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 4px; }
.stepper button { width: 30px; padding: 4px 0; background: transparent; color: var(--text); font-size: 16px; }
.stepper input { width: 40px; text-align: center; border: none; background: transparent; }
.order-btn { flex: 1; background: linear-gradient(135deg, var(--accent), var(--accent-2)); font-size: 17px; font-weight: 800; border-radius: 12px; box-shadow: 0 6px 20px rgba(255,94,0,.35); display: flex; align-items: center; justify-content: center; gap: 8px; }
.order-btn:disabled { box-shadow: none; }
.cost-line { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 12px; }
.cost-line b { color: var(--ok); }

/* 灶台队列 */
.stoves { display: flex; flex-direction: column; gap: 12px; }
.stove { display: flex; align-items: stretch; min-height: 92px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--panel); }
.stove .burner { width: 150px; flex: 0 0 150px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; border-right: 1px dashed var(--line); color: var(--muted); font-size: 13px; }
.stove .stove-body { flex: 1; display: flex; align-items: center; padding: 12px 16px; color: var(--muted); gap: 14px; }
.stove.cooking { border-color: var(--accent); }
.stove.cooking .burner { color: var(--accent); }
.stove.cooking .stove-body { color: var(--text); }
.flame { font-size: 22px; animation: flicker 1s infinite alternate; }
@keyframes flicker { from { transform: scale(1); opacity: .8; } to { transform: scale(1.15); opacity: 1; } }
.cook-bar { flex: 1; height: 8px; background: var(--panel-2); border-radius: 6px; overflow: hidden; }
.cook-bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .4s; }
.people { background: var(--panel-2); border-radius: 10px; padding: 8px 12px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.people b { color: var(--accent); }

/* 成品三区 */
.bucket { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 14px; }
.bucket .bk-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.bucket .bk-head .bk-title { font-weight: 700; display: flex; align-items: center; gap: 6px; }
.bucket .bk-head .bk-title .cnt { color: var(--muted); font-weight: 400; font-size: 12px; }
.bucket .bk-empty { color: var(--muted); font-size: 12px; text-align: center; padding: 18px 0; border: 1px dashed var(--line); border-radius: 10px; }
.gallery2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 8px; }
.dish { position: relative; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--panel-2); aspect-ratio: 1; }
.dish img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }
.dish .dish-load { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.dish .dish-ops { position: absolute; inset: auto 0 0 0; display: flex; opacity: 0; transition: opacity .15s; background: linear-gradient(transparent, rgba(0,0,0,.75)); }
.dish:hover .dish-ops { opacity: 1; }
.dish .dish-ops button { flex: 1; background: transparent; color: #fff; font-size: 11px; padding: 5px 0; border-radius: 0; }
.dish .dish-ops button:hover { background: rgba(255,255,255,.15); }

@media (max-width: 1100px) {
  .kitchen { grid-template-columns: 1fr; }
}

/* ================= 开放 API 页 ================= */
.api-hero { background: linear-gradient(135deg, rgba(108,140,255,.15), rgba(138,108,255,.10)); border: 1px solid var(--line); border-radius: 16px; padding: 22px 24px; margin-bottom: 18px; }
.api-hero h2 { background: linear-gradient(90deg,var(--brand),var(--brand-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.api-keycard { margin-bottom: 18px; }
.key-row { display: flex; gap: 8px; }
.key-row input { flex: 1; font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: .5px; }
.key-meta { display: flex; justify-content: space-between; gap: 16px; margin-top: 10px; font-size: 12px; flex-wrap: wrap; }
.key-meta code { background: var(--panel-2); padding: 2px 8px; border-radius: 6px; }

.api-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.api-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.api-card-h { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.api-card p { margin: 4px 0 10px; font-size: 12.5px; }
.api-tag { font-size: 11px; padding: 2px 9px; border-radius: 999px; font-weight: 600; }
.api-tag.sky { background: rgba(108,140,255,.18); color: #9db4ff; }
.api-tag.green { background: rgba(46,204,113,.18); color: #57d98a; }
.api-tag.purple { background: rgba(138,108,255,.18); color: #b9a6ff; }
.api-tag.gray { background: var(--panel-2); color: var(--muted); }
.api-ep { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; color: var(--accent); background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; margin-bottom: 10px; word-break: break-all; }
.api-card pre { background: #0c0e13; border: 1px solid var(--line); border-radius: 8px; padding: 12px; overflow: auto; font-size: 12px; line-height: 1.55; margin: 0 0 8px; }
.api-card pre:last-child { margin-bottom: 0; }
@media (max-width: 900px) { .api-grid { grid-template-columns: 1fr; } }

/* ================= 管理端 · 用户产出卡片墙 ================= */
.gen-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.gen-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.gen-card .gc-thumb { aspect-ratio: 1; background: #0c0e13; display: flex; align-items: center; justify-content: center; }
.gen-card .gc-thumb img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }
.gen-card .gc-body { padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.gen-card .gc-prompt { font-size: 12.5px; line-height: 1.5; max-height: 3.2em; overflow: hidden; }
.gen-card .gc-meta { font-size: 11px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.gen-card .gc-meta .gc-email { color: var(--brand); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ================= 图片失效占位 ================= */
.img-expired { width: 100%; height: 100%; display: flex; flex-direction: column; gap: 2px; align-items: center; justify-content: center; background: repeating-linear-gradient(45deg, var(--panel-2), var(--panel-2) 8px, #1b1f27 8px, #1b1f27 16px); color: var(--muted); font-size: 11px; text-align: center; border-radius: 6px; line-height: 1.3; }
.img-expired.sm { width: 46px; height: 46px; font-size: 9px; }
.img-expired::before { content: "⌛"; font-size: 16px; }

/* 灶台进度条流动光泽 */
.cook-bar > i { background-size: 200% 100%; animation: barflow 1.6s linear infinite; }
@keyframes barflow { 0% { background-position: 0 0; } 100% { background-position: -200% 0; } }

/* ================= 开放 API 页 · 高大上 ================= */
.api-hero-pro {
  position: relative; overflow: hidden;
  border: 1px solid var(--line); border-radius: 22px;
  padding: 40px 36px; margin-bottom: 22px;
  background:
    radial-gradient(1200px 300px at 10% -20%, rgba(108,140,255,.20), transparent 60%),
    radial-gradient(900px 300px at 95% 0%, rgba(255,122,24,.16), transparent 55%),
    linear-gradient(180deg, #161922, #12141b);
}
.api-hero-glow { position: absolute; inset: -40% 40% auto -10%; height: 320px;
  background: radial-gradient(closest-side, rgba(138,108,255,.25), transparent); filter: blur(20px); pointer-events: none; }
.api-hero-badge { display: inline-block; font-size: 11px; letter-spacing: 2px; font-weight: 700;
  color: #9db4ff; background: rgba(108,140,255,.12); border: 1px solid rgba(108,140,255,.3);
  padding: 5px 12px; border-radius: 999px; }
.api-hero-title { font-size: 34px; line-height: 1.2; margin: 16px 0 10px; font-weight: 800; letter-spacing: -.5px; }
.api-hero-title .grad { background: linear-gradient(90deg, var(--brand), var(--brand-2) 60%, var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.api-hero-sub { color: var(--muted); font-size: 15px; max-width: 760px; margin: 0 0 20px; }
.api-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.api-chip { font-size: 13px; padding: 7px 14px; border-radius: 999px; color: var(--text);
  background: rgba(255,255,255,.04); border: 1px solid var(--line); backdrop-filter: blur(6px); }
.api-baserow { margin-top: 22px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.api-baserow code { background: #0c0e13; border: 1px solid var(--line); color: var(--accent);
  padding: 6px 12px; border-radius: 8px; font-size: 13px; }
.api-baserow-tip { color: var(--muted); }

/* 卡片升级 */
.api-grid .api-card {
  position: relative; border-radius: 16px; padding: 20px;
  background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.01));
  border: 1px solid var(--line); transition: transform .18s, border-color .18s, box-shadow .18s;
}
.api-grid .api-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 2px; border-radius: 16px 16px 0 0;
  background: linear-gradient(90deg, var(--brand), var(--brand-2), var(--accent)); opacity: .7; }
.api-grid .api-card:hover { transform: translateY(-3px); border-color: rgba(108,140,255,.4); box-shadow: 0 12px 30px rgba(0,0,0,.35); }
.api-card-top { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 10px; }
.api-ico { flex: 0 0 40px; width: 40px; height: 40px; border-radius: 11px; display: flex; align-items: center; justify-content: center; font-size: 18px; }
.api-ico.sky { background: rgba(108,140,255,.16); color: #9db4ff; }
.api-ico.green { background: rgba(46,204,113,.16); color: #57d98a; }
.api-ico.purple { background: rgba(138,108,255,.16); color: #b9a6ff; }
.api-ico.gray { background: var(--panel-2); color: var(--muted); }
.api-grid .api-card-h { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; margin: 2px 0 4px; }
.api-grid .api-ep { display: inline-block; }

/* 图片有效期提示条 */
.expire-tip { font-size: 11.5px; color: var(--warn); line-height: 1.5;
  background: rgba(245,166,35,.1); border: 1px solid rgba(245,166,35,.28);
  border-radius: 8px; padding: 7px 11px; margin-bottom: 10px; }
.expire-tip b { color: var(--warn); }

/* ================= 高大上顶栏 / 品牌 ================= */
.topbar-pro {
  position: sticky; top: 0; z-index: 40;
  padding: 12px 26px;
  background: linear-gradient(180deg, rgba(20,22,30,.92), rgba(15,17,23,.82));
  backdrop-filter: blur(14px) saturate(150%);
  border-bottom: 1px solid rgba(124,108,255,.18);
  box-shadow: 0 8px 30px rgba(0,0,0,.30);
}
.brand-logo { display: flex; align-items: center; gap: 12px; }
.brand-logo img {
  width: 42px; height: 42px; border-radius: 12px; object-fit: cover;
  animation: logoPulse 2.8s ease-in-out infinite;
}
@keyframes logoPulse {
  0%, 100% { box-shadow: 0 0 0 1px rgba(124,108,255,.4), 0 0 16px rgba(108,140,255,.40); }
  50%      { box-shadow: 0 0 0 1px rgba(124,108,255,.7), 0 0 28px rgba(138,108,255,.65); }
}
.brand-name {
  font-size: 23px; font-weight: 800; letter-spacing: 2px;
  background: linear-gradient(92deg, #7aa2ff, #b18cff 55%, #ff8aa0);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 0 22px rgba(124,108,255,.25);
}
.topbar-pro .tabs button { background: transparent; color: var(--muted); border: 1px solid transparent; padding: 8px 16px; font-weight: 600; }
.topbar-pro .tabs button:hover { color: var(--text); }
.topbar-pro .tabs button.active {
  color: #fff;
  background: linear-gradient(120deg, rgba(108,140,255,.22), rgba(138,108,255,.22));
  border-color: rgba(124,108,255,.45);
  box-shadow: 0 0 16px rgba(108,140,255,.25);
}
.balance-chip { font-size: 14px; padding: 7px 15px; border-radius: 999px;
  background: rgba(46,204,113,.1); border: 1px solid rgba(46,204,113,.28); white-space: nowrap; }
.balance-chip b { color: var(--ok); font-size: 15px; }
.who-chip { font-size: 13px; }
.auth-logo { width: 72px; height: 72px; border-radius: 18px; object-fit: cover;
  box-shadow: 0 0 0 1px rgba(124,108,255,.5), 0 0 34px rgba(108,140,255,.55); }

/* ================= 活动横幅 ================= */
#activityBanner { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.act-card { position: relative; overflow: hidden; border: 1px solid rgba(255,122,24,.35); border-radius: 14px; padding: 14px 18px;
  background: linear-gradient(110deg, rgba(255,122,24,.16), rgba(138,108,255,.12) 70%, transparent); }
.act-card .act-title { font-weight: 800; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.act-card .act-title::before { content: "🎉"; }
.act-card .act-body { color: var(--muted); font-size: 13px; margin-top: 5px; line-height: 1.6; white-space: pre-wrap; }
.act-card .act-end { font-size: 11px; color: var(--warn); margin-top: 6px; }
.act-card a.act-link { color: var(--accent); font-weight: 600; }

/* ================= 模型状态标签徽章 ================= */
.mtags { display: inline-flex; gap: 5px; flex-wrap: wrap; vertical-align: middle; margin-left: 6px; }
.mtag { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; line-height: 1.5; border: 1px solid transparent; }
.mtag-rec     { color: #ff7a18; background: rgba(255,122,24,.14); border-color: rgba(255,122,24,.4); }
.mtag-fast    { color: #2f9bff; background: rgba(47,155,255,.14); border-color: rgba(47,155,255,.4); }
.mtag-premium { color: #e3b341; background: rgba(227,179,65,.14); border-color: rgba(227,179,65,.4); }
.mtag-stable  { color: #2ecc71; background: rgba(46,204,113,.14); border-color: rgba(46,204,113,.4); }
.mtag-maint   { color: #999;    background: rgba(150,150,150,.16); border-color: rgba(150,150,150,.4); }
.mtag-custom  { color: #8a6cff; background: rgba(138,108,255,.14); border-color: rgba(138,108,255,.4); }
