/* Image API docs. Translucent chrome is a web approximation of Apple materials, not official Liquid Glass. */

:root {
  --bg: #0e0f12;
  --bg-elev: #16171c;
  --bg-chrome: rgba(14, 15, 18, 0.72);
  --bg-hover: rgba(255, 255, 255, 0.05);
  --bg-press: rgba(255, 255, 255, 0.08);
  --text: #f5f5f7;
  --text-2: #a1a1a6;
  --text-3: #6e6e73;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --accent: #2997ff;
  --accent-soft: rgba(41, 151, 255, 0.14);
  --accent-ink: #0a84ff;
  --ok: #30d158;
  --ok-soft: rgba(48, 209, 88, 0.14);
  --warn: #ffd60a;
  --warn-soft: rgba(255, 214, 10, 0.12);
  --err: #ff453a;
  --err-soft: rgba(255, 69, 58, 0.14);
  --code: #1c1d22;
  --code-ink: #e6e6ea;
  --string: #8fd19e;
  --keyword: #c7b0ea;
  --num: #e0c184;
  --comment: #6b6b74;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.38);
  --radius: 12px;
  --radius-sm: 8px;
  --nav-h: 52px;
  --side-w: 252px;
  --toc-w: 196px;
  --font: system-ui, -apple-system, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, "Cascadia Code", Consolas, monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] {
  --bg: #f5f5f7;
  --bg-elev: #ffffff;
  --bg-chrome: rgba(245, 245, 247, 0.72);
  --bg-hover: rgba(0, 0, 0, 0.04);
  --bg-press: rgba(0, 0, 0, 0.07);
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #86868b;
  --line: rgba(0, 0, 0, 0.08);
  --line-strong: rgba(0, 0, 0, 0.14);
  --accent: #0071e3;
  --accent-soft: rgba(0, 113, 227, 0.1);
  --accent-ink: #0077ed;
  --ok: #248a3d;
  --ok-soft: rgba(36, 138, 61, 0.1);
  --warn: #9a7300;
  --warn-soft: rgba(154, 115, 0, 0.1);
  --err: #d70015;
  --err-soft: rgba(215, 0, 21, 0.1);
  --code: #f0f0f2;
  --code-ink: #1d1d1f;
  --string: #1f7a3a;
  --keyword: #6b4aa8;
  --num: #9a6700;
  --comment: #8e8e93;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.12);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
  scroll-padding-top: calc(var(--nav-h) + 20px);
}

[data-theme="light"] {
  color-scheme: light;
}

html,
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 16.5px/1.75 var(--font);
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  overflow: hidden;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
  border: 0;
  background: none;
  color: inherit;
  touch-action: manipulation;
}

button:active {
  transform: scale(0.97);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.skip {
  position: absolute;
  left: 12px;
  top: -40px;
  z-index: 80;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--bg-elev);
  color: var(--text);
}

.skip:focus {
  top: 12px;
}

/* Top chrome: translucent, content scrolls under */
.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 40;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px 0 18px;
  background: var(--bg-chrome);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--line);
}

.topbar::after {
  content: "";
  pointer-events: none;
  position: absolute;
  inset: auto 0 0 0;
  height: 12px;
  transform: translateY(100%);
  background: linear-gradient(to bottom, var(--bg), transparent);
  opacity: 0.55;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.brand:hover {
  text-decoration: none;
}

.mark {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.22), transparent 42%),
    var(--accent-ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.38);
  color: #fff;
}

.mark i {
  font-size: 15px;
}

.brand-name {
  font-size: 15px;
}

.brand-sub {
  display: none;
  color: var(--text-3);
  font-weight: 500;
  font-size: 13px;
}

.menu-btn,
.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: var(--text);
}

.menu-btn:hover,
.icon-btn:hover,
.search-open:hover {
  background: var(--bg-hover);
}

.menu-btn {
  display: grid;
}

.search-open {
  margin-left: auto;
  height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-2);
  background: var(--bg-hover);
  border: 1px solid var(--line);
}

.search-open kbd {
  font: 11px/1 var(--mono);
  padding: 3px 5px;
  border-radius: 5px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  color: var(--text-3);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.shell {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  height: 100dvh;
  padding-top: var(--nav-h);
}

.sidebar {
  position: relative;
  z-index: 20;
  overflow: auto;
  padding: 18px 12px 32px;
  background: var(--bg-chrome);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  border-right: 1px solid var(--line);
}

.nav-search {
  width: 100%;
  margin: 0 0 14px;
  padding: 8px 10px 8px 32px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-hover) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%236e6e73' stroke-width='1.8'><circle cx='6' cy='6' r='4.5'/><path d='M9.5 9.5 L12 12'/></svg>") 10px 50% no-repeat;
  color: var(--text);
}

.nav-search::placeholder {
  color: var(--text-3);
}

.nav-group {
  margin: 16px 0 6px;
  padding: 0 10px;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.nav-group:first-of-type {
  margin-top: 4px;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 9px;
  color: var(--text-2);
  text-decoration: none;
  font-size: 13.5px;
  line-height: 1.3;
  white-space: nowrap;
}

.nav a:hover {
  background: var(--bg-hover);
  color: var(--text);
  text-decoration: none;
}

.nav a.is-active {
  background: var(--accent-soft);
  color: var(--text);
  font-weight: 600;
}

.nav a.is-active::before {
  content: "";
  width: 3px;
  height: 14px;
  margin-left: -10px;
  margin-right: 7px;
  border-radius: 99px;
  background: var(--accent);
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 99px;
  background: var(--text-3);
}

.dot.gpt { background: #2997ff; }
.dot.gem { background: #30d158; }

.main-wrap {
  position: relative;
  overflow: auto;
  min-width: 0;
}

.page {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--toc-w);
  gap: 28px;
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 36px 80px;
}

.prose {
  min-width: 0;
  max-width: 760px;
}

.toc {
  position: sticky;
  top: 20px;
  align-self: start;
  padding-top: 8px;
}

.toc h4 {
  margin: 0 0 10px;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.toc a {
  display: block;
  padding: 4px 0 4px 10px;
  border-left: 1px solid var(--line);
  color: var(--text-3);
  font-size: 12.5px;
  line-height: 1.45;
  text-decoration: none;
}

.toc a:hover,
.toc a.is-active {
  color: var(--text);
  border-left-color: var(--accent);
}

.toc a.sub {
  padding-left: 18px;
  font-size: 12px;
}

h1, h2, h3, h4 {
  color: var(--text);
  font-weight: 700;
  letter-spacing: -0.022em;
}

h1 {
  margin: 0 0 10px;
  font-size: clamp(1.7rem, 1.4vw + 1.2rem, 2.15rem);
  line-height: 1.15;
}

h2 {
  margin: 2.1em 0 0.7em;
  padding-bottom: 0.35em;
  border-bottom: 1px solid var(--line);
  font-size: 1.28rem;
  line-height: 1.3;
}

h3 {
  margin: 1.6em 0 0.55em;
  font-size: 1.05rem;
  letter-spacing: -0.015em;
}

h1 + .lede,
.lede {
  margin: 0 0 1.4em;
  color: var(--text-2);
  font-size: 1.02rem;
  line-height: 1.7;
  max-width: 62ch;
}

.page-foot {
  margin-top: 3.2em;
  padding-top: 1.2em;
  border-top: 1px solid var(--line);
  color: var(--text-3);
  font-size: 13px;
}

p {
  margin: 0.85em 0;
  color: var(--text);
}

.prose li {
  margin: 0.35em 0;
  color: var(--text);
}

.prose ul,
.prose ol {
  padding-left: 1.2em;
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 600;
}

.endpoint {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 1.4em;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
}

.method {
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font: 700 11px/1.4 var(--mono);
  letter-spacing: 0.04em;
}

.method.edit {
  background: var(--ok-soft);
  color: var(--ok);
}

.path {
  font: 13px/1.4 var(--mono);
  color: var(--text);
  overflow-wrap: anywhere;
}

.copy-path {
  margin-left: auto;
  height: 28px;
  padding: 0 10px;
  border-radius: 8px;
  color: var(--text-2);
  font-size: 12px;
}

.copy-path:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.note,
.warn,
.danger {
  margin: 1.1em 0;
  padding: 12px 14px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  border-left: 3px solid var(--text-3);
  background: var(--bg-hover);
  color: var(--text-2);
}

.note { border-left-color: var(--accent); }
.warn { border-left-color: var(--warn); background: var(--warn-soft); }
.danger { border-left-color: var(--err); background: var(--err-soft); }

.note p,
.warn p,
.danger p {
  margin: 0.2em 0;
  color: inherit;
}

.table-wrap {
  overflow: auto;
  margin: 1em 0 1.3em;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th, td {
  padding: 10px 14px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

th {
  background: var(--bg-hover);
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
}

td {
  color: var(--text-2);
}

tr:last-child th,
tr:last-child td {
  border-bottom: 0;
}

code, kbd {
  font-family: var(--mono);
}

p code,
li code,
td code {
  font-size: 0.86em;
  padding: 0.12em 0.38em;
  border-radius: 5px;
  background: var(--bg-press);
  color: var(--text);
}

.req {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--err-soft);
  color: var(--err);
  font-size: 11px;
  font-weight: 600;
}

.opt {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--bg-press);
  color: var(--text-3);
  font-size: 11px;
  font-weight: 600;
}

.cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 1.1em 0 1.5em;
}

.card {
  padding: 16px 16px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
}

.card h3 {
  margin: 0 0 6px;
  font-size: 15px;
}

.card p {
  margin: 0;
  color: var(--text-2);
  font-size: 13.5px;
}

.card a {
  display: inline-block;
  margin-top: 10px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.card a:hover {
  text-decoration: underline;
}

.code-panel {
  margin: 1em 0 1.4em;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--code);
  overflow: hidden;
}

.code-tabs {
  display: flex;
  gap: 2px;
  padding: 6px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-elev);
  overflow-x: auto;
}

.code-tabs button {
  height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 600;
}

.code-tabs button.is-on {
  background: var(--bg-press);
  color: var(--text);
}

.code-frame {
  position: relative;
}

.code-frame[hidden] {
  display: none;
}

pre {
  margin: 0;
  padding: 16px 18px 18px;
  overflow: auto;
  color: var(--code-ink);
  font: 13px/1.65 var(--mono);
}

.copy-code {
  position: absolute;
  top: 10px;
  right: 10px;
  height: 28px;
  padding: 0 10px;
  border-radius: 8px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  color: var(--text-2);
  font-size: 12px;
}

.copy-code:hover {
  color: var(--text);
}

.tok-s { color: var(--string); }
.tok-k { color: var(--keyword); }
.tok-n { color: var(--num); }
.tok-c { color: var(--comment); }
.tok-p { color: var(--text-3); }

.scrim,
.search-modal {
  position: fixed;
  inset: 0;
}

.scrim {
  z-index: 44;
}

.scrim.is-search {
  z-index: 51;
}

.search-modal {
  z-index: 52;
}

.scrim {
  background: rgba(0, 0, 0, 0.42);
  opacity: 0;
  pointer-events: none;
}

.scrim.is-on {
  opacity: 1;
  pointer-events: auto;
}

.search-modal {
  display: none;
  place-items: start center;
  padding: 12vh 16px 16px;
}

.search-modal.is-on {
  display: grid;
}

.search-box {
  width: min(560px, 100%);
  border-radius: 16px;
  background: var(--bg-elev);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.search-box input {
  width: 100%;
  height: 52px;
  padding: 0 16px;
  border: 0;
  background: transparent;
  color: var(--text);
  outline: none;
}

.search-hits {
  max-height: 360px;
  overflow: auto;
  border-top: 1px solid var(--line);
}

.search-hits a {
  display: block;
  padding: 10px 16px;
  color: var(--text);
  text-decoration: none;
}

.search-hits a:hover,
.search-hits a.is-active {
  background: var(--bg-hover);
}

.search-hits small {
  display: block;
  color: var(--text-3);
  font-size: 12px;
}

.toast {
  position: fixed;
  z-index: 70;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(12px);
  opacity: 0;
  pointer-events: none;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.toast.is-on {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.hidden { display: none !important; }

@media (min-width: 720px) {
  .brand-sub { display: inline; }
  .menu-btn { display: none; }
}

@media (max-width: 1080px) {
  .page { grid-template-columns: minmax(0, 1fr); padding: 24px 22px 72px; }
  .toc { display: none; }
}

@media (max-width: 719px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: var(--nav-h);
    bottom: 0;
    left: 0;
    width: min(86vw, 300px);
    transform: translateX(-105%);
    z-index: 48;
    box-shadow: var(--shadow);
  }
  .sidebar.is-open { transform: translateX(0); }
  .search-open span { display: none; }
  .cards { grid-template-columns: 1fr; }
  .page { padding: 20px 16px 64px; }
}

@media (prefers-reduced-transparency: reduce) {
  .topbar,
  .sidebar {
    background: var(--bg);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }

  button:active {
    transform: none;
  }
}

@media (prefers-contrast: more) {
  :root {
    --line: rgba(255, 255, 255, 0.35);
    --bg-chrome: #000;
  }
  [data-theme="light"] {
    --line: rgba(0, 0, 0, 0.4);
    --bg-chrome: #fff;
  }
}

.topbar,
.sidebar,
.toast,
.scrim,
.search-box,
.sidebar.is-open {
  transition: transform 0.4s var(--ease), opacity 0.3s var(--ease), background 0.35s ease;
}

@media (min-width: 720px) {
  .sidebar { transform: none; }
}

/* ============ OPONE 增加的部分 ============ */
/* 顶部品牌标：直接用 ONE logo（fill=currentColor，跟随主题明暗） */
.mark {
  width: auto;
  height: 26px;
  background: none;
  box-shadow: none;
  color: var(--text);
}
.mark svg { width: auto; height: 26px; display: block; }
[data-theme="light"] .mark { color: var(--text); }

/* 正文页脚 */
.opone-foot {
  margin-top: 3em;
  padding-top: 1.1em;
  border-top: 1px solid var(--line);
  color: var(--text-3);
  font-size: 12.5px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.opone-foot a { color: var(--text-2); text-decoration: none; }
.opone-foot a:hover { color: var(--text); text-decoration: underline; }

/* 公告横幅 */
.opone-notice { margin-top: 0; }

/* 接口分组标题（http 代码块里的 # 注释行） */
.ep-group {
  margin: 0 0 10px;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.ep-group:not(:first-child) { margin-top: 18px; }

/* 接口卡片右侧的说明文字 */
.ep-note {
  color: var(--text-3);
  font-size: 12.5px;
}

/* http 代码块拆出来的头部说明行 */
.ep-meta {
  margin: -0.9em 0 1.4em;
  padding: 0 2px;
  color: var(--text-3);
  font: 12.5px/1.7 var(--mono);
  overflow-wrap: anywhere;
}

/* 表格首列更醒目 */
.table-wrap td:first-child { color: var(--text); white-space: nowrap; }

/* 内容里的图片 */
.prose img {
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin: 1em 0;
}

/* 代码块里的内容允许横向滚动、不被挤压 */
.code-frame pre { max-height: 520px; }

/* 页内目录跳转后的定位补偿 */
#doc h2, #doc h3 { scroll-margin-top: calc(var(--nav-h) + 12px); }

/* ===== 目录三层字级：大标题 > 中标题 > 页面 ===== */
/* 第一层：大标题（图片模型 / 视频模型 / 开始） */
.nav-title {
  margin: 26px 0 8px;
  padding: 0 10px;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.nav-title:first-of-type { margin-top: 6px; }
/* 除第一个大标题外，上方加一条分隔线，层级更清楚 */
.nav-title:not(:first-of-type) {
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

/* 第二层：中标题（GPT-Image 系列 / 香蕉系列 / Seedance 系列） */
.nav .nav-group {
  margin: 14px 0 4px;
  padding: 0 10px 0 14px;
  color: var(--text-3);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* 第三层：页面链接，比中标题再缩进一级 */
.nav-section > a { padding-left: 22px; }
.nav-section > a.is-active::before { margin-left: -12px; }

/* 正文顶部的层级面包屑 */
.prose .kicker { text-transform: none; }
.prose .kicker span { color: var(--text-3); font-weight: 400; }

/* 侧栏空状态 */
.nav-empty { padding: 6px 10px; color: var(--text-3); font-size: 12.5px; }

/* 移动端侧栏滚动条细一点 */
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 4px; }
