/* ============================================================
   ai3d · Apple 风格设计系统
   ============================================================ */
:root {
  --bg: #ffffff;
  --bg-soft: #f5f5f7;
  --bg-elev: #ffffff;
  --ink: #1d1d1f;
  --ink-2: #6e6e73;
  --ink-3: #86868b;
  --line: #d2d2d7;
  --line-soft: #e8e8ed;
  --blue: #0071e3;
  --blue-hover: #0077ed;
  --green: #1d9e4b;
  --red: #e30000;
  --amber: #b25000;
  --r-s: 10px;
  --r-m: 16px;
  --r-l: 22px;
  --r-xl: 28px;
  --shadow-s: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 14px rgba(0, 0, 0, .05);
  --shadow-m: 0 2px 6px rgba(0, 0, 0, .05), 0 18px 44px rgba(0, 0, 0, .08);
  --shadow-l: 0 30px 80px rgba(0, 0, 0, .16);
  --nav-h: 48px;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.005em;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* ---------------- nav ---------------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  background: rgba(251, 251, 253, .82);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(0, 0, 0, .08);
}
.nav-in {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 22px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 28px;
}
.brand {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand:hover { text-decoration: none; }
.brand .dot {
  width: 16px; height: 16px; border-radius: 5px;
  background: linear-gradient(145deg, #0a84ff, #7b61ff 55%, #ff375f);
  box-shadow: 0 0 0 1px rgba(0,0,0,.05) inset;
}
.nav-links { display: flex; gap: 4px; margin-left: auto; align-items: center; }
.nav-links a {
  font-size: 13px;
  color: #424245;
  padding: 6px 12px;
  border-radius: 999px;
  transition: color .2s var(--ease), background .2s var(--ease);
}
.nav-links a:hover { color: var(--ink); background: rgba(0, 0, 0, .05); text-decoration: none; }
.nav-links a.on { color: var(--ink); font-weight: 500; background: rgba(0, 0, 0, .06); }

/* ---------------- layout ---------------- */
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 22px; }
.wrap-wide { max-width: 1320px; }
section.band { padding: 92px 0; }
.band-soft { background: var(--bg-soft); }
.band-tight { padding: 56px 0; }

.eyebrow {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .01em;
  color: var(--blue);
  margin: 0 0 12px;
}
.eyebrow.grey { color: var(--ink-3); }

h1.display {
  font-size: clamp(38px, 5.4vw, 68px);
  line-height: 1.05;
  letter-spacing: -0.028em;
  font-weight: 600;
  margin: 0 0 18px;
}
h1.display em {
  font-style: normal;
  background: linear-gradient(92deg, #0a84ff, #7b61ff 48%, #ff375f);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
h2.title {
  font-size: clamp(26px, 3.1vw, 40px);
  line-height: 1.1;
  letter-spacing: -0.022em;
  font-weight: 600;
  margin: 0 0 14px;
}
h3.sub { font-size: 19px; font-weight: 600; letter-spacing: -0.01em; margin: 0 0 8px; }
p.lead {
  font-size: clamp(16px, 1.6vw, 21px);
  line-height: 1.45;
  color: var(--ink-2);
  margin: 0 0 26px;
  max-width: 44em;
}
p.muted { color: var(--ink-2); font-size: 14px; }

/* ---------------- buttons ---------------- */
.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 11px 22px;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: transform .16s var(--ease), background .2s, box-shadow .2s, opacity .2s;
  white-space: nowrap;
}
.btn:active { transform: scale(.975); }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-hover); text-decoration: none; }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: #000; text-decoration: none; }
.btn-ghost { background: transparent; color: var(--blue); padding-left: 6px; padding-right: 6px; }
.btn-ghost:hover { text-decoration: underline; }
.btn-grey { background: #e8e8ed; color: var(--ink); }
.btn-grey:hover { background: #dededf; }
.btn-line { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-line:hover { border-color: var(--ink); text-decoration: none; }
.btn-sm { padding: 7px 15px; font-size: 13px; }
.btn-lg { padding: 14px 30px; font-size: 17px; }
.btn[disabled] { opacity: .42; cursor: not-allowed; transform: none; }

/* ---------------- cards ---------------- */
.card {
  background: var(--bg-elev);
  border-radius: var(--r-l);
  box-shadow: var(--shadow-s);
  padding: 26px;
}
.card-flat { box-shadow: none; border: 1px solid var(--line-soft); }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

.stage {
  position: relative;
  background: #000;
  border-radius: var(--r-xl);
  overflow: hidden;
  box-shadow: var(--shadow-m);
}
.stage iframe { display: block; width: 100%; height: 100%; border: 0; background: #000; }
.stage-cover {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: rgba(255, 255, 255, .6); font-size: 14px; pointer-events: none;
}
.stage-badge {
  position: absolute; top: 18px; left: 20px; z-index: 2;
  font-size: 11px; letter-spacing: .02em; text-transform: uppercase;
  color: rgba(255, 255, 255, .82); background: rgba(255, 255, 255, .13);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  padding: 5px 10px; border-radius: 999px;
}

/* ---------------- chips / pills ---------------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-size: 13px; color: var(--ink);
  background: #fff; border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 13px; cursor: pointer;
  transition: border-color .2s, background .2s, transform .16s var(--ease);
}
.chip:hover { border-color: var(--ink-3); }
.chip.on { border-color: var(--ink); color: var(--ink); font-weight: 500; background: #fff; box-shadow: 0 0 0 1px var(--ink) inset; }
.chip:active { transform: scale(.97); }
/* 创作台里的灵感行：单列整行，长提示词一行截断而不是挤成小胶囊 */
.chips-rows { flex-direction: column; gap: 6px; }
.chips-rows .chip {
  display: block; width: 100%; text-align: left;
  border-radius: 10px; font-size: 12.5px; line-height: 1.35;
  padding: 8px 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; color: var(--ink-2);
  background: rgba(0, 0, 0, .045); border-radius: 999px; padding: 4px 10px;
}
.pill.ok { color: var(--green); background: rgba(29, 158, 75, .1); }
.pill.bad { color: var(--red); background: rgba(227, 0, 0, .09); }
.pill.blue { color: var(--blue); background: rgba(0, 113, 227, .1); }

/* ---------------- forms ---------------- */
label.fld { display: block; margin-bottom: 16px; }
label.fld > span.lb {
  display: block; font-size: 12px; font-weight: 600; letter-spacing: .01em;
  color: var(--ink-2); margin-bottom: 6px;
}
input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%;
  font: inherit; font-size: 15px;
  color: var(--ink);
  background: #f5f5f7;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 11px 14px;
  transition: border-color .2s, background .2s, box-shadow .2s;
}
textarea { resize: vertical; min-height: 96px; line-height: 1.55; }
input:focus, select:focus, textarea:focus {
  outline: none; background: #fff;
  border-color: var(--blue);
  box-shadow: 0 0 0 3.5px rgba(0, 113, 227, .18);
}
select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8'><path d='M1 1l5 5 5-5' stroke='%236e6e73' stroke-width='1.6' fill='none' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 13px center;
  padding-right: 34px;
}
input[type=range] { width: 100%; accent-color: var(--blue); }

/* ---------------- table ---------------- */
table.tb { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tb th {
  text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .02em;
  text-transform: uppercase; color: var(--ink-3);
  padding: 0 10px 8px; border-bottom: 1px solid var(--line-soft);
}
table.tb td { padding: 9px 10px; border-bottom: 1px solid var(--line-soft); }
table.tb tr:last-child td { border-bottom: 0; }
table.tb td.num, table.tb th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------------- studio ---------------- */
/* 固定视口的工具页：三栏各自内部滚动，舞台永不被顶走 */
.studio {
  max-width: 1440px; margin: 0 auto; padding: 18px 22px 22px;
  display: grid; grid-template-columns: 336px minmax(0, 1fr) 336px;
  gap: 18px; height: calc(100vh - var(--nav-h) - 1px); align-items: stretch;
}
.panel {
  background: #fff; border-radius: var(--r-l); box-shadow: var(--shadow-s);
  padding: 20px; display: flex; flex-direction: column; gap: 14px;
  min-height: 0; overflow: auto; scrollbar-width: thin;
}
.panel::-webkit-scrollbar { width: 8px; }
.panel::-webkit-scrollbar-thumb { background: #d8d8dd; border-radius: 8px; border: 2px solid #fff; }
.panel::-webkit-scrollbar-thumb:hover { background: #c2c2c8; }
.panel::-webkit-scrollbar-track { background: transparent; }
/* 三栏首行同一高度 → 共基线 */
.panel > h4:first-child { height: 30px; display: flex; align-items: center; margin: 0; }
.panel h4 {
  margin: 0; font-size: 13px; font-weight: 600; letter-spacing: .02em;
  text-transform: uppercase; color: var(--ink-3);
}
.stage-panel { overflow: hidden; }
.stage-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: nowrap;
  height: 30px; overflow-x: auto; scrollbar-width: none;
}
.stage-bar::-webkit-scrollbar { display: none; }
.stage-bar > * { flex: 0 0 auto; }
.stage-bar .spacer { margin-left: auto; }
.stage-main { height: auto; flex: 1 1 auto; min-height: 260px; }

.log {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11.5px; line-height: 1.65; color: #4a4a4f;
  background: var(--bg-soft); border-radius: var(--r-s);
  padding: 12px; height: 168px; flex: 0 0 auto; overflow: auto; white-space: pre-wrap;
  word-break: break-word;
}
.log .t { color: var(--ink-3); }
.log .err { color: var(--red); }
.log .ok { color: var(--green); }

.bill { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 13px; }
.bill dt { color: var(--ink-2); }
.bill dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.bill dd.big { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }

/* ---------------- gallery ---------------- */
.gal { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.gal-card {
  background: #fff; border-radius: var(--r-l); box-shadow: var(--shadow-s);
  overflow: hidden; transition: transform .28s var(--ease), box-shadow .28s var(--ease);
  display: flex; flex-direction: column;
}
.gal-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-m); }
.gal-stage { position: relative; height: 208px; background: #0b0b0e; overflow: hidden; }
.gal-stage iframe { width: 100%; height: 100%; border: 0; pointer-events: none; }
.gal-body { padding: 15px 17px 17px; display: flex; flex-direction: column; gap: 9px; flex: 1; }
.gal-prompt {
  font-size: 13.5px; line-height: 1.45; color: var(--ink);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  margin: 0; min-height: 38px;
}
.gal-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.gal-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 4px; }

/* ---------------- modal ---------------- */
.modal {
  position: fixed; inset: 0; z-index: 200; display: none;
  align-items: center; justify-content: center; padding: 24px;
  background: rgba(0, 0, 0, .42);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.modal.on { display: flex; }
.modal-card {
  background: #fff; border-radius: var(--r-xl); box-shadow: var(--shadow-l);
  width: min(760px, 100%); max-height: calc(100vh - 48px); overflow: auto;
  padding: 28px;
}
.modal-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.modal-head h3 { margin: 0; font-size: 22px; letter-spacing: -0.02em; }
.modal-head .x {
  margin-left: auto; border: 0; background: #f5f5f7; color: var(--ink-2);
  width: 30px; height: 30px; border-radius: 50%; cursor: pointer; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
}

/* ---------------- toast ---------------- */
.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translate(-50%, 16px);
  background: rgba(29, 29, 31, .94); color: #fff; font-size: 14px;
  padding: 11px 20px; border-radius: 999px; z-index: 300;
  opacity: 0; pointer-events: none; transition: opacity .22s, transform .22s var(--ease);
  box-shadow: 0 12px 34px rgba(0, 0, 0, .28);
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- footer ---------------- */
footer.site {
  border-top: 1px solid var(--line-soft); background: var(--bg-soft);
  padding: 30px 0; font-size: 12px; color: var(--ink-3);
}
footer.site .wrap { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }
footer.site a { color: var(--ink-2); }

/* ---------------- misc ---------------- */
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.hr { height: 1px; background: var(--line-soft); margin: 4px 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.hide { display: none !important; }

/* 矮屏（笔记本 720–800 高）压缩留白，避免左栏按钮被面板内滚动藏起来 */
@media (max-height: 820px) {
  .studio { padding: 14px 22px 16px; }
  .panel { padding: 16px 18px; gap: 11px; }
  /* 灵感行改成横向一条，矮屏也别把「开始生成」挤到折叠线外 */
  .chips-rows { flex-direction: row; overflow-x: auto; padding-bottom: 2px; }
  .chips-rows .chip { width: auto; flex: 0 0 auto; max-width: 210px; }
  #prompt { min-height: 92px; }
  .log { height: 132px; }
  .bill { gap: 4px 12px; font-size: 12.5px; }
  .bill dd.big { font-size: 16px; }
}
@media (max-width: 1180px) {
  .studio { grid-template-columns: 300px minmax(0, 1fr); height: auto; align-items: start; }
  .studio > .panel.right { grid-column: 1 / -1; }
  .panel { overflow: visible; }
  .stage-panel { min-height: 68vh; }
  .gal { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .studio { grid-template-columns: 1fr; }
  .stage-main { height: 56vh; min-height: 300px; }
  .grid3, .grid2 { grid-template-columns: 1fr; }
  .gal { grid-template-columns: 1fr; }
  section.band { padding: 64px 0; }
  .nav-links a { padding: 6px 9px; }
}
