:root {
  --bg: #070a12;
  --panel: #0e1422;
  --panel-strong: #111a2c;
  --line: #26334f;
  --line-soft: rgba(255,255,255,.09);
  --text: #edf4ff;
  --muted: #91a0ba;
  --cyan: #40e0ff;
  --violet: #986cff;
  --green: #4de7a8;
  --red: #ff6e8a;
  --shadow: 0 22px 65px rgba(0,0,0,.47);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 0, #13284a 0, transparent 31%),
    radial-gradient(circle at 90% 10%, #2a164e 0, transparent 32%),
    var(--bg);
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(rgba(0,0,0,.72), transparent 80%);
}

a { color: inherit; }
button, input, textarea { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }
.wrap { width: min(1460px, calc(100% - 32px)); margin: auto; }

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(7,10,18,.86);
  border-bottom: 1px solid rgba(255,255,255,.07);
  backdrop-filter: blur(18px);
}
.navin { height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; font-weight: 900; white-space: nowrap; }
.logo {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #07101c;
  font-weight: 950;
  background: linear-gradient(135deg, var(--cyan), var(--violet));
}
.links { display: flex; gap: 8px; }
.links a { padding: 10px 13px; border-radius: 10px; color: var(--muted); text-decoration: none; font-size: 14px; }
.links a:hover, .links a.active { color: #fff; background: rgba(255,255,255,.055); }
.status {
  padding: 8px 11px;
  border: 1px solid rgba(77,231,168,.27);
  border-radius: 999px;
  color: #82ffca;
  background: rgba(77,231,168,.05);
  font-size: 12px;
  white-space: nowrap;
}
.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 12px var(--green);
}
.mobile {
  display: none;
  padding: 9px 12px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 10px;
  background: #111827;
  cursor: pointer;
}

.pagehead { padding: 58px 0 26px; }
.eyebrow { color: #80eaff; font-size: 12px; font-weight: 800; letter-spacing: 2px; }
.pagehead h1 { margin: 12px 0; font-size: clamp(38px, 6vw, 62px); }
.pagehead p { max-width: 800px; margin: 0; color: var(--muted); font-size: 17px; line-height: 1.8; }

.card {
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 19px;
  background: rgba(14,20,34,.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}
.playground {
  position: relative;
  display: grid;
  grid-template-columns: 260px 300px minmax(0,1fr);
  min-height: 680px;
  margin: 18px 0 70px;
}
.history-panel {
  min-width: 0;
  padding: 18px 14px;
  border-right: 1px solid var(--line-soft);
  background: rgba(7,12,22,.72);
}
.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 5px 14px;
}
.history-close, .history-toggle { display: none; }
.new-conversation, .history-more {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #0b1424;
  cursor: pointer;
}
.new-conversation:hover, .history-more:hover,
.history-close:hover, .conversation-actions button:hover,
.message-edit:hover { border-color: var(--cyan); color: var(--text); }
.conversation-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 13px;
}
.conversation-item {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 4px;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 11px;
  color: var(--muted);
  background: transparent;
}
.conversation-item.is-active {
  border-color: rgba(64,224,255,.28);
  color: var(--text);
  background: rgba(64,224,255,.07);
}
.conversation-open {
  min-width: 0;
  border: 0;
  color: inherit;
  background: transparent;
  cursor: pointer;
  text-align: left;
}
.conversation-title, .conversation-preview {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.conversation-preview { margin-top: 4px; color: #687894; font-size: 10px; }
.conversation-actions { display: flex; align-items: start; gap: 2px; }
.conversation-actions button, .history-close {
  min-height: 30px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 11px;
}
.history-more { margin-top: 13px; }
.side { position: relative; z-index: 4; padding: 22px; border-right: 1px solid var(--line-soft); }
.field { margin-bottom: 20px; }
.field > label { display: block; margin-bottom: 8px; color: var(--muted); font-size: 12px; }
.optional { margin-left: 5px; color: #66758f; }
.field-help { min-height: 18px; margin: 7px 2px 0; color: #7787a2; font-size: 11px; line-height: 1.55; }
.field input[type="range"] { width: 100%; accent-color: var(--cyan); }
.field input[type="range"]:disabled { cursor: not-allowed; opacity: .38; }
.range-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; color: var(--muted); font-size: 11px; }
.range-line strong { min-width: 32px; color: var(--cyan); text-align: center; font-size: 13px; }
.preference-input {
  width: 100%;
  min-height: 112px;
  resize: vertical;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: none;
  color: #fff;
  background: #080d18;
  line-height: 1.55;
}
.preference-input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(64,224,255,.08); }
.field-counter { display: flex; justify-content: space-between; gap: 10px; margin-top: 6px; color: #687894; font-size: 10px; }
.notice {
  padding: 12px;
  border: 1px solid rgba(255,213,109,.16);
  border-radius: 11px;
  color: #d7c394;
  background: rgba(255,213,109,.045);
  font-size: 12px;
  line-height: 1.7;
}

.model-select { position: relative; }
.model-select-trigger {
  width: 100%;
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: none;
  background: #080d18;
  cursor: pointer;
  text-align: left;
}
.model-select-trigger:hover, .model-select-trigger:focus-visible, .model-select.is-open .model-select-trigger {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(64,224,255,.08);
}
.model-select-trigger:disabled { cursor: not-allowed; opacity: .55; }
.model-select-value, #model-current { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-current-badge, .model-option b, .reasoning-badge {
  flex: 0 0 auto;
  padding: 3px 7px;
  border: 1px solid rgba(152,108,255,.5);
  border-radius: 999px;
  color: #d7c8ff;
  background: rgba(152,108,255,.12);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .06em;
}
.model-chevron { color: #7787a2; font-size: 17px; transition: transform .18s ease; }
.model-select.is-open .model-chevron { transform: rotate(180deg); }
.model-menu {
  position: absolute;
  z-index: 80;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  max-height: min(520px, 68vh);
  overflow: auto;
  padding: 8px;
  border: 1px solid rgba(64,224,255,.24);
  border-radius: 14px;
  background: rgba(8,13,24,.98);
  box-shadow: 0 24px 55px rgba(0,0,0,.72);
  backdrop-filter: blur(22px);
}
.model-group + .model-group { margin-top: 7px; padding-top: 7px; border-top: 1px solid rgba(255,255,255,.07); }
.model-group-title { padding: 6px 9px 5px; color: #64748d; font-size: 9px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.model-option, .iq-option {
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 0;
  border-radius: 9px;
  outline: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
}
.model-option:hover, .model-option:focus-visible, .iq-option:hover, .iq-option:focus-visible { background: rgba(64,224,255,.09); }
.model-option[aria-selected="true"], .iq-option[aria-selected="true"] { color: #fff; background: linear-gradient(90deg, rgba(64,224,255,.18), rgba(152,108,255,.11)); }
.model-option[aria-selected="true"] span::before, .iq-option[aria-selected="true"] span::before { content: "✓"; margin-right: 8px; color: var(--cyan); font-weight: 900; }
.iq-option small { color: #7787a2; font-size: 11px; font-weight: 700; }
.iq-option[aria-selected="true"] small { color: #b9c9e5; }
.intelligence-menu { max-height: none; }

.chat { min-width: 0; display: flex; flex-direction: column; overflow: hidden; border-radius: 0 19px 19px 0; }
.messages {
  min-height: 0;
  max-height: 650px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 17px;
  overflow: auto;
  padding: 26px;
}
.msg {
  max-width: min(78%, 760px);
  padding: 14px 16px;
  border-radius: 16px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.68;
}
.msg.ai { align-self: flex-start; border: 1px solid #263a5c; background: #111d32; }
.msg.user { align-self: flex-end; background: linear-gradient(135deg, #126b92, #5b43bd); }
.message-actions { margin-top: 8px; text-align: right; }
.message-edit {
  border: 0;
  color: rgba(255,255,255,.76);
  background: transparent;
  cursor: pointer;
  font-size: 11px;
}
.message-more {
  align-self: center;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: #0b1424;
  cursor: pointer;
  font-size: 11px;
}
.msg.response { width: min(86%, 820px); max-width: min(86%, 820px); }
.msg.is-error { border-color: rgba(255,110,138,.48); background: rgba(71,22,42,.44); }
.assistant-meta { margin-bottom: 10px; color: #8da0c1; font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.assistant-performance { margin-top: 10px; color: #7beac1; font-size: 11px; font-variant-numeric: tabular-nums; }
.answer-text:empty::after { content: "等待模型输出…"; color: #64748d; }
.reasoning-panel {
  margin: 2px 0 14px;
  border: 1px solid rgba(152,108,255,.25);
  border-radius: 12px;
  background: rgba(5,8,17,.5);
}
.reasoning-panel summary { padding: 10px 12px; color: #b8a8e6; cursor: pointer; font-size: 12px; font-weight: 750; }
.reasoning-text { max-height: 290px; overflow: auto; padding: 0 12px 12px; color: #93a2ba; font-size: 12px; line-height: 1.7; white-space: pre-wrap; }
.stream-status {
  min-height: 34px;
  padding: 8px 19px;
  border-top: 1px solid rgba(255,255,255,.055);
  color: #7beac1;
  background: rgba(5,8,17,.38);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.composer { display: flex; gap: 10px; padding: 18px; border-top: 1px solid var(--line-soft); }
.composer textarea {
  min-height: 54px;
  max-height: 170px;
  flex: 1;
  resize: vertical;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  outline: none;
  color: #fff;
  background: #080d18;
}
.composer textarea:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(64,224,255,.08); }
.send {
  width: 56px;
  flex: 0 0 56px;
  border: 0;
  border-radius: 13px;
  color: #07101c;
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  cursor: pointer;
  font-size: 22px;
  font-weight: 900;
}
.send:hover { filter: brightness(1.1); }
.send:disabled { cursor: wait; opacity: .55; }

.modelgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; padding-bottom: 70px; }
.model { position: relative; overflow: hidden; padding: 22px; }
.model::after { content: ""; position: absolute; width: 130px; height: 130px; right: -70px; top: -75px; border-radius: 50%; background: var(--violet); filter: blur(52px); opacity: .25; }
.modeltop { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.model h2 { margin: 0; font-size: 20px; }
.pill { padding: 5px 8px; border: 1px solid rgba(83,223,255,.23); border-radius: 999px; color: #aeefff; background: rgba(83,223,255,.045); font-size: 11px; white-space: nowrap; }
.pill.reasoning { border-color: rgba(152,108,255,.44); color: #d7c8ff; background: rgba(152,108,255,.1); }
.model .use { margin: 18px 0 8px; color: #d9e7fa; }
.model p { margin: 0; color: var(--muted); line-height: 1.65; }
.model code { display: block; margin-top: 17px; color: #71e8bd; font-size: 12px; }

.doclayout { display: grid; grid-template-columns: 250px 1fr; gap: 18px; padding-bottom: 70px; }
.toc { position: sticky; top: 92px; height: max-content; padding: 18px; }
.toc a { display: block; padding: 9px 10px; border-radius: 9px; color: var(--muted); text-decoration: none; }
.toc a:hover { color: #fff; background: rgba(255,255,255,.05); }
.doc { padding: 28px; line-height: 1.8; }
.doc h2 { margin-top: 42px; padding-top: 8px; border-top: 1px solid var(--line-soft); }
.doc h2:first-child { margin-top: 0; border: 0; }
.doc p, .doc li { color: #aab8ce; }
.code { overflow: auto; padding: 17px; border: 1px solid var(--line-soft); border-radius: 13px; color: #c6d8eb; background: #050811; font-family: Consolas, monospace; white-space: pre; }
.warn { padding: 12px 14px; border-left: 3px solid #ffcc70; color: #ddc999; background: rgba(255,204,112,.045); }

.footer { padding: 35px 16px; color: #6f7f98; text-align: center; font-size: 13px; }
.relay-records { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 10px 18px; margin-top: 14px; }
.relay-records a { display: inline-flex; align-items: center; gap: 6px; color: #8292aa; text-decoration: none; }
.relay-records a:hover { color: var(--text); }
.relay-records img { width: 18px; height: 20px; object-fit: contain; }
.service-policy {
  width: min(920px, 100%);
  margin: 18px auto 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  text-align: left;
}
.service-policy summary {
  padding: 16px 0 8px;
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
  list-style-position: inside;
}
.service-policy-body { padding-bottom: 10px; font-size: 13px; line-height: 1.75; }
.service-policy-body p { margin: 8px 0; }
.service-policy-body code { color: var(--cyan); }
.toast {
  position: fixed;
  z-index: 100;
  right: 24px;
  bottom: 24px;
  max-width: min(340px, calc(100vw - 32px));
  padding: 13px 16px;
  border: 1px solid rgba(80,221,255,.33);
  border-radius: 12px;
  opacity: 0;
  transform: translateY(80px);
  color: #eafcff;
  background: #13233a;
  box-shadow: var(--shadow);
  transition: .25s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: none; }

@media (max-width: 900px) {
  .status { display: none; }
  .playground {
    grid-template-columns: 280px minmax(0,1fr);
    backdrop-filter: none;
  }
  .history-toggle {
    display: block;
    position: absolute;
    z-index: 8;
    top: -48px;
    left: 0;
  }
  .history-panel {
    position: fixed;
    z-index: 120;
    inset: 0 auto 0 0;
    width: min(330px, 88vw);
    overflow-y: auto;
    transform: translateX(-105%);
    transition: transform .2s ease;
    box-shadow: var(--shadow);
  }
  .history-panel.is-open { transform: translateX(0); }
  .history-close { display: inline-grid; place-items: center; }
  .history-backdrop {
    position: fixed;
    z-index: 110;
    inset: 0;
    background: rgba(0,0,0,.62);
  }
  .side { border-right: 1px solid var(--line-soft); border-bottom: 0; }
  .chat { min-height: 610px; border-radius: 0 19px 19px 0; }
  .model-menu { max-height: 480px; }
  .modelgrid { grid-template-columns: 1fr 1fr; }
  .doclayout { grid-template-columns: 1fr; }
  .toc { position: static; }
}

@media (max-width: 650px) {
  .wrap { width: min(100% - 22px, 1460px); }
  .navin { height: 64px; }
  .brand { font-size: 14px; }
  .logo { width: 34px; height: 34px; }
  .links {
    position: absolute;
    top: 60px;
    left: 11px;
    right: 11px;
    display: none;
    flex-direction: column;
    padding: 10px;
    border: 1px solid rgba(255,255,255,.09);
    border-radius: 14px;
    background: rgba(11,16,28,.98);
    box-shadow: var(--shadow);
  }
  .links.open { display: flex; }
  .mobile { display: block; }
  .pagehead { padding-top: 40px; }
  .pagehead p { font-size: 15px; }
  .side { padding: 17px; }
  .playground { grid-template-columns: 1fr; }
  .side { border-right: 0; border-bottom: 1px solid var(--line-soft); }
  .model-menu { position: fixed; top: 76px; left: 11px; right: 11px; max-height: calc(100dvh - 96px); }
  .chat { min-height: 560px; border-radius: 0 0 19px 19px; }
  .messages { padding: 17px 14px; }
  .msg, .msg.response { width: auto; max-width: 92%; }
  .composer { padding: 13px; }
  .send { width: 52px; flex-basis: 52px; }
  .modelgrid { grid-template-columns: 1fr; }
  .doc { padding: 20px; }
  .toast { right: 16px; bottom: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
