/* ============================================================
   Shang的AI · 客户端样式
   深色 · 蓝主色 · 移动/平板自适应
   ============================================================ */

:root {
  --bg: #0a0e15;
  --bg2: #0e131c;
  --panel: #111827;
  --panel2: #151c28;
  --line: #1f2a3a;
  --line2: #26334a;
  --txt: #e8eefc;
  --txt2: #9fb0c9;
  --txt3: #66799a;
  --pri: #4d9fff;
  --pri2: #2f7fe6;
  --ok: #34d399;
  --bad: #f87171;
  --warn: #fbbf24;
  --r: 12px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--txt);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(900px 500px at 15% -8%, rgba(77, 159, 255, .10), transparent 60%),
    radial-gradient(700px 400px at 88% 4%, rgba(120, 90, 255, .07), transparent 62%),
    var(--bg);
  display: flex;
  flex-direction: column;
}

a { color: var(--pri); text-decoration: none; }
a:hover { color: #7db6ff; }
code { font-family: "SF Mono", Consolas, "Cascadia Code", Menlo, monospace; }

.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 22px; }

/* ---------------- 顶栏 ---------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10, 14, 21, .86);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-in { display: flex; align-items: center; gap: 22px; height: 62px; }

.brand { display: flex; align-items: center; gap: 10px; color: var(--txt); }
.logo {
  width: 34px; height: 34px; border-radius: 9px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--pri), #6f5bff);
  color: #fff; font-weight: 800; font-size: 14px; letter-spacing: .5px;
  box-shadow: 0 4px 14px rgba(77, 159, 255, .35);
}
.brand-txt { display: flex; flex-direction: column; line-height: 1.25; }
.brand-txt strong { font-size: 15px; font-weight: 650; }
.brand-txt em { font-style: normal; font-size: 11.5px; color: var(--txt3); }

.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a {
  padding: 7px 13px; border-radius: 8px; color: var(--txt2);
  font-size: 14px; transition: .15s;
}
.nav a:hover { background: var(--panel2); color: var(--txt); }
.nav a.active { background: rgba(77, 159, 255, .14); color: var(--pri); }

.actions { display: flex; align-items: center; gap: 8px; }
.bal {
  font-size: 13px; color: var(--txt2);
  background: var(--panel2); border: 1px solid var(--line);
  padding: 5px 11px; border-radius: 8px;
}
.bal b { color: var(--ok); font-weight: 650; }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: 9px;
  padding: 9px 17px; font-size: 14px; font-weight: 550;
  cursor: pointer; transition: .16s; font-family: inherit;
  white-space: nowrap;
}
.btn.sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn.primary {
  background: linear-gradient(135deg, var(--pri), var(--pri2));
  color: #fff; box-shadow: 0 4px 14px rgba(77, 159, 255, .28);
}
.btn.primary:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn.ghost {
  background: var(--panel2); border-color: var(--line2); color: var(--txt2);
}
.btn.ghost:hover { border-color: var(--pri); color: var(--pri); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none !important; }

/* ---------------- Hero ---------------- */
.hero {
  position: relative; text-align: center;
  padding: 76px 0 54px; overflow: hidden;
}
.hero-glow {
  position: absolute; inset: -120px 0 auto 0; height: 380px;
  background: radial-gradient(560px 240px at 50% 0%, rgba(77, 159, 255, .16), transparent 70%);
  pointer-events: none;
}
.hero h1 {
  position: relative; margin: 0 0 14px;
  font-size: 40px; font-weight: 780; letter-spacing: -.5px;
  background: linear-gradient(180deg, #fff, #a9c6ea);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lead { position: relative; margin: 0 auto 28px; max-width: 620px; color: var(--txt2); font-size: 16px; }
.hero-btns { position: relative; display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.gift { position: relative; margin: 20px 0 0; color: var(--txt3); font-size: 13.5px; }
.gift b { color: var(--ok); }

/* ---------------- 特性 ---------------- */
.feats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px;
  margin-bottom: 46px;
}
.feat {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r); padding: 20px 18px; transition: .18s;
}
.feat:hover { border-color: var(--line2); transform: translateY(-2px); }
.feat i { font-style: normal; font-size: 21px; }
.feat h3 { margin: 8px 0 6px; font-size: 15px; font-weight: 620; }
.feat p { margin: 0; color: var(--txt3); font-size: 13px; line-height: 1.55; }

/* ---------------- 区块 ---------------- */
.sec { margin-bottom: 46px; }
.sec-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin-bottom: 14px;
}
.sec-head h2 { margin: 0; font-size: 19px; font-weight: 680; }
.sec-head a { font-size: 13.5px; }

/* ---------------- 表格 ---------------- */
.table-wrap {
  border: 1px solid var(--line); border-radius: var(--r);
  overflow: auto; background: var(--panel);
}
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th {
  text-align: left; padding: 12px 16px; color: var(--txt3);
  font-weight: 550; font-size: 12.5px; letter-spacing: .3px;
  border-bottom: 1px solid var(--line); background: var(--panel2);
  white-space: nowrap;
}
.tbl td { padding: 13px 16px; border-bottom: 1px solid rgba(31, 42, 58, .6); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr:hover td { background: rgba(77, 159, 255, .035); }
.tbl code { color: #9dc6ff; font-size: 13px; }
.tbl code.mini { font-size: 12px; color: var(--txt2); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sub { color: var(--txt3); font-size: 12px; margin-top: 2px; }
.muted { color: var(--txt3); }
.small { font-size: 12.5px; }

/* ---------------- 代码块 ---------------- */
.code {
  background: #070b12; border: 1px solid var(--line);
  border-radius: var(--r); padding: 18px 20px; overflow: auto;
  font-size: 12.8px; line-height: 1.75; color: #b8cce8;
  margin: 0;
}
.code code { color: inherit; }

/* ---------------- 控制台 ---------------- */
.cards {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px;
  margin-bottom: 22px;
}
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r); padding: 18px;
  display: flex; flex-direction: column; gap: 5px;
}
.card .k { color: var(--txt3); font-size: 12.5px; }
.card .v { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.card .v.sm2 { font-size: 17px; font-weight: 600; }
.card .s { font-size: 12px; color: var(--txt3); }
.bal-card {
  background: linear-gradient(150deg, rgba(77, 159, 255, .16), rgba(17, 24, 39, .9));
  border-color: rgba(77, 159, 255, .32);
  grid-column: span 1;
}
.bal-card .v { color: var(--ok); font-size: 27px; }

.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r); padding: 20px 22px; margin-bottom: 18px;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px;
}
.panel-head h2 { margin: 0; font-size: 16px; font-weight: 650; }

.keyrow {
  display: flex; align-items: center; gap: 10px;
  background: #070b12; border: 1px solid var(--line2);
  border-radius: 9px; padding: 11px 14px;
}
.keyrow code { flex: 1; color: #9dc6ff; font-size: 13px; word-break: break-all; }

/* ---------------- 标签 ---------------- */
.tag {
  display: inline-block; padding: 2px 9px; border-radius: 20px;
  font-size: 11.5px; font-weight: 550; white-space: nowrap;
}
.tag.ok { background: rgba(52, 211, 153, .13); color: var(--ok); }
.tag.bad { background: rgba(248, 113, 113, .13); color: var(--bad); }
.tag.warn { background: rgba(251, 191, 36, .13); color: var(--warn); }

/* ---------------- 空态 ---------------- */
.empty { padding: 26px; text-align: center; color: var(--txt3); }
.empty.bad { color: var(--bad); }
.empty-panel {
  text-align: center; padding: 74px 22px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
}
.empty-panel h2 { margin: 0 0 8px; font-size: 20px; }
.empty-panel p { margin: 0 0 22px; }

.notice {
  background: rgba(77, 159, 255, .09); border: 1px solid rgba(77, 159, 255, .25);
  border-radius: 10px; padding: 12px 16px; margin: 18px 0 0;
  color: #a8c8f0; font-size: 13.5px;
}

/* ---------------- 弹窗 ---------------- */
.modal {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(4, 7, 12, .72); backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: 20px;
}
.modal[hidden] { display: none; }
.modal-card {
  position: relative; width: 100%; max-width: 396px;
  background: var(--panel); border: 1px solid var(--line2);
  border-radius: 16px; padding: 26px; box-shadow: var(--shadow);
  animation: pop .18s ease-out;
}
@keyframes pop {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to { opacity: 1; transform: none; }
}
.modal-x {
  position: absolute; top: 12px; right: 14px;
  background: none; border: 0; color: var(--txt3);
  font-size: 22px; line-height: 1; cursor: pointer; padding: 4px;
}
.modal-x:hover { color: var(--txt); }

.tabs { display: flex; gap: 6px; margin-bottom: 20px; }
.tab {
  flex: 1; padding: 9px; border-radius: 9px; cursor: pointer;
  background: var(--panel2); border: 1px solid var(--line);
  color: var(--txt2); font-size: 14px; font-family: inherit; transition: .15s;
}
.tab.active {
  background: rgba(77, 159, 255, .14);
  border-color: rgba(77, 159, 255, .4); color: var(--pri);
}

.form { display: flex; flex-direction: column; gap: 15px; }
.form[hidden] { display: none; }
.form label {
  display: flex; flex-direction: column; gap: 7px;
  font-size: 13px; color: var(--txt2);
}
.form small { color: var(--txt3); font-size: 11.5px; }
.form input {
  background: #070b12; border: 1px solid var(--line2);
  border-radius: 9px; padding: 11px 13px;
  color: var(--txt); font-size: 14.5px; font-family: inherit;
  outline: none; transition: .15s;
}
.form input:focus { border-color: var(--pri); box-shadow: 0 0 0 3px rgba(77, 159, 255, .13); }
.form input::placeholder { color: #4a5b76; }
.code-row { display: flex; gap: 9px; }
.code-row input { flex: 1; min-width: 0; }

.hint { margin: 0; min-height: 18px; font-size: 12.5px; color: var(--txt3); }
.hint.bad { color: var(--bad); }

/* ---------------- Toast ---------------- */
.toast {
  position: fixed; left: 50%; bottom: 34px; transform: translateX(-50%);
  z-index: 200; padding: 11px 20px; border-radius: 10px;
  background: #1b2434; border: 1px solid var(--line2);
  color: var(--txt); font-size: 13.5px; box-shadow: var(--shadow);
  animation: up .2s ease-out;
}
.toast[hidden] { display: none; }
.toast.bad { border-color: rgba(248, 113, 113, .45); color: #fca5a5; }
@keyframes up {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ---------------- 页脚 ---------------- */
.foot {
  margin-top: auto; padding: 26px 0;
  border-top: 1px solid var(--line);
  color: var(--txt3); font-size: 12.5px;
}
.foot .wrap { display: flex; gap: 8px; justify-content: center; align-items: center; }
.dot { opacity: .5; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 900px) {
  .feats { grid-template-columns: repeat(2, 1fr); }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .hero h1 { font-size: 32px; }
}

@media (max-width: 640px) {
  .wrap { padding: 0 15px; }
  .topbar-in { height: 56px; gap: 12px; }
  .brand-txt em { display: none; }
  .nav { margin-left: 0; gap: 0; }
  .nav a { padding: 6px 9px; font-size: 13px; }
  .nav a[data-view="console"] { display: none; }
  .hero { padding: 46px 0 34px; }
  .hero h1 { font-size: 25px; }
  .lead { font-size: 14px; }
  .feats { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr 1fr; }
  .card .v { font-size: 20px; }
  .bal-card .v { font-size: 22px; }
  .sec-head h2 { font-size: 17px; }
  .tbl th, .tbl td { padding: 10px 12px; }
  .code { font-size: 11.5px; padding: 14px; }
  .panel { padding: 16px; }
  .bal { padding: 4px 9px; font-size: 12px; }
}

/* ============================================================
   模型卡片
   ============================================================ */
.mgrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 13px;
}
.mcard {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 16px 17px;
  transition: .18s;
  min-width: 0;
}
.mcard:hover { border-color: var(--line2); transform: translateY(-2px); }
.mcard-top {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px; margin-bottom: 6px;
}
.mname {
  font-size: 14.5px; font-weight: 620; color: var(--txt);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mprice {
  flex-shrink: 0; font-size: 12px; color: var(--pri);
  background: rgba(77,159,255,.12); border-radius: 20px;
  padding: 2px 9px; white-space: nowrap;
}
.mid {
  display: block; font-size: 11.5px; color: var(--txt3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  margin-bottom: 10px;
}
.mmeta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 9px; }
.ftag, .chip {
  font-size: 11px; padding: 2px 8px; border-radius: 20px;
  border: 1px solid var(--line2); color: var(--txt2);
  background: rgba(255,255,255,.02);
}
.ftag { color: #7fb3ff; border-color: rgba(77,159,255,.3); background: rgba(77,159,255,.08); }
.mdesc {
  margin: 0; font-size: 12.5px; line-height: 1.6; color: var(--txt3);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ============================================================
   在线体验
   ============================================================ */
.chatwrap {
  display: flex; flex-direction: column;
  padding-top: 18px;
}
.chatbar {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 12px;
}
.chatbar select {
  flex: 1; min-width: 0;
  background: var(--panel); border: 1px solid var(--line2);
  border-radius: 9px; padding: 10px 13px;
  color: var(--txt); font-size: 13.5px; font-family: inherit;
  outline: none; cursor: pointer;
}
.chatbar select:focus { border-color: var(--pri); }

.chatbox {
  flex: 1;
  height: 54vh;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 18px;
  display: flex; flex-direction: column; gap: 14px;
  scroll-behavior: smooth;
}
.chat-empty {
  margin: auto; text-align: center; color: var(--txt3);
}
.chat-empty p { margin: 0 0 6px; font-size: 14px; }
.chat-empty .small { font-size: 12px; }

.msg { display: flex; }
.msg.user { justify-content: flex-end; }
.bubble {
  max-width: 78%;
  padding: 11px 15px;
  border-radius: 13px;
  font-size: 14px; line-height: 1.72;
  white-space: pre-wrap; word-break: break-word;
}
.msg.user .bubble {
  background: linear-gradient(135deg, rgba(77,159,255,.9), rgba(47,127,230,.9));
  color: #fff;
  border-bottom-right-radius: 4px;
}
.msg.assistant .bubble {
  background: var(--panel2);
  border: 1px solid var(--line);
  color: var(--txt);
  border-bottom-left-radius: 4px;
}
.bubble.typing::after {
  content: '';
  display: inline-block;
  width: 7px; height: 15px;
  background: var(--pri);
  margin-left: 3px;
  vertical-align: -2px;
  animation: blink .9s steps(2) infinite;
}
.bubble.err { color: var(--bad); border-color: rgba(248,113,113,.4); }
@keyframes blink { 0%,50% { opacity: 1 } 51%,100% { opacity: 0 } }

.chatinput {
  display: flex; gap: 10px; margin-top: 12px;
  align-items: flex-end;
}
.chatinput textarea {
  flex: 1; min-width: 0;
  background: var(--panel); border: 1px solid var(--line2);
  border-radius: 11px; padding: 12px 14px;
  color: var(--txt); font-size: 14px; font-family: inherit;
  line-height: 1.6; resize: none; outline: none;
}
.chatinput textarea:focus { border-color: var(--pri); box-shadow: 0 0 0 3px rgba(77,159,255,.12); }
.chatinput .btn { height: 44px; padding: 0 22px; }
#chatTip { margin: 8px 2px 0; min-height: 16px; }

@media (max-width: 900px) {
  .mgrid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .mgrid { grid-template-columns: 1fr; }
  .chatbox { height: 48vh; padding: 13px; }
  .bubble { max-width: 88%; font-size: 13.5px; }
  .chatbar { flex-wrap: wrap; }
}

/* ============================================================
   额度兑换
   ============================================================ */
.redeemrow {
  display: flex; gap: 10px; align-items: stretch;
}
.redeemrow input {
  flex: 1; min-width: 0;
  background: var(--bg2); border: 1px solid var(--line2);
  border-radius: 10px; padding: 11px 14px;
  color: var(--txt); font-size: 14px; outline: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .6px; text-transform: uppercase;
}
.redeemrow input::placeholder { text-transform: none; letter-spacing: 0; color: var(--txt3); }
.redeemrow input:focus { border-color: var(--pri); box-shadow: 0 0 0 3px rgba(77,159,255,.12); }
.redeemrow .btn { height: auto; padding: 0 22px; white-space: nowrap; }
@media (max-width: 560px) {
  .redeemrow { flex-direction: column; }
  .redeemrow .btn { height: 42px; }
}
