:root {
  --bg: #0b0d10;
  --panel: #12161b;
  --panel-2: #161b22;
  --line: #232a33;
  --text: #e6edf3;
  --muted: #8b98a5;
  --accent: #4ade80;
  --accent-2: #38bdf8;
  --warn: #fbbf24;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 15% -10%, #12202b 0%, transparent 60%),
    radial-gradient(900px 500px at 110% 0%, #1a1430 0%, transparent 55%),
    var(--bg);
  color: var(--text);
  font: 15px/1.6 "Inter", "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  min-height: 100%;
}

a { color: var(--accent-2); }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }

/* ---------- top ---------- */
.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 5;
  background: rgba(11, 13, 16, .72);
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 15px; letter-spacing: .2px; }
.brand .sep { color: #3a4450; }
.dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(74, 222, 128, .15), 0 0 14px rgba(74, 222, 128, .7);
}
.pills { display: flex; gap: 8px; }
.pill {
  font-size: 12px; padding: 5px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel); color: var(--muted);
  white-space: nowrap;
}
.pill.live { color: var(--accent); border-color: rgba(74, 222, 128, .35); }

/* ---------- layout ---------- */
.wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 18px;
  padding: 20px 24px 8px;
  max-width: 1400px;
  margin: 0 auto;
  align-items: start;
}
@media (max-width: 1080px) {
  .wrap { grid-template-columns: 1fr; padding: 14px; }
}

.card {
  background: linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,0)) , var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------- chat ---------- */
.chat { display: flex; flex-direction: column; min-height: calc(100vh - 190px); overflow: hidden; }
.chat-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 18px 20px 12px; border-bottom: 1px solid var(--line);
}
.chat-head h1 { font-size: 17px; margin: 0 0 4px; font-weight: 650; }
.chat-head p { margin: 0; }
.tag {
  font-size: 11px; font-weight: 500; color: var(--accent-2);
  border: 1px solid rgba(56, 189, 248, .35); border-radius: 999px;
  padding: 2px 8px; margin-left: 8px; vertical-align: 2px;
}
.ghost {
  background: transparent; color: var(--muted); border: 1px solid var(--line);
  border-radius: 9px; padding: 6px 12px; cursor: pointer; font-size: 13px;
}
.ghost:hover { color: var(--text); border-color: #33404d; }

.log {
  flex: 1; overflow-y: auto; padding: 18px 20px;
  display: flex; flex-direction: column; gap: 14px;
  scrollbar-width: thin; scrollbar-color: #2a323c transparent;
}
.msg { display: flex; flex-direction: column; gap: 5px; max-width: 86%; }
.msg.user { align-self: flex-end; align-items: flex-end; }
.who { font-size: 11px; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.bubble {
  padding: 11px 14px; border-radius: 12px;
  background: var(--panel-2); border: 1px solid var(--line);
  white-space: pre-wrap; word-break: break-word;
}
.msg.user .bubble {
  background: linear-gradient(180deg, #17303f, #14303a);
  border-color: #24475a;
}
.bubble.thinking { color: var(--muted); font-size: 13px; border-style: dashed; }
.bubble .cursor {
  display: inline-block; width: 7px; height: 15px; margin-left: 2px;
  background: var(--accent); vertical-align: -2px; animation: blink 1s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.meta { font-size: 11px; color: var(--muted); }

/* ---------- composer ---------- */
.composer {
  display: flex; gap: 10px; padding: 14px 20px 6px;
  border-top: 1px solid var(--line); align-items: flex-end;
}
textarea {
  flex: 1; resize: none; background: #0e1216; color: var(--text);
  border: 1px solid var(--line); border-radius: 11px; padding: 11px 13px;
  font: inherit; line-height: 1.5; max-height: 180px; outline: none;
}
textarea:focus { border-color: #2f4453; box-shadow: 0 0 0 3px rgba(56, 189, 248, .08); }
button#send {
  background: linear-gradient(180deg, #4ade80, #22c55e);
  color: #06210f; border: 0; border-radius: 11px;
  padding: 11px 20px; font-weight: 650; cursor: pointer; font-size: 14px;
  transition: filter .15s, transform .05s;
}
button#send:hover { filter: brightness(1.06); }
button#send:active { transform: translateY(1px); }
button#send:disabled { opacity: .5; cursor: default; }
.hint { padding: 2px 20px 16px; display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.toggle { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; color: var(--muted); }
.toggle input { accent-color: #22c55e; }

/* ---------- side ---------- */
.side { display: flex; flex-direction: column; gap: 14px; }
.block { padding: 16px 18px; }
.block h2 {
  font-size: 12px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 12px; font-weight: 600;
}
.spec { margin: 0; display: grid; gap: 9px; }
.spec .row { display: grid; grid-template-columns: 74px 1fr; gap: 10px; font-size: 13px; }
.spec dt { color: var(--muted); }
.spec dd { margin: 0; }

.bars { display: grid; gap: 12px; }
.bar .top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.bar .top b { font-variant-numeric: tabular-nums; }
.bar .track { height: 7px; background: #0e1216; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.bar .fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #38bdf8, #4ade80); }

.gpu { display: grid; gap: 8px; margin-bottom: 12px; }
.gpu .g {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 10px; background: #0e1216;
}
.gpu .g .bar2 { flex: 1; margin: 0 10px; height: 5px; background: #1a2028; border-radius: 999px; overflow: hidden; }
.gpu .g .bar2 i { display: block; height: 100%; background: linear-gradient(90deg, #22c55e, #fbbf24); }

.live { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.live > div { background: #0e1216; border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; }
.metric { font-size: 19px; font-weight: 650; font-variant-numeric: tabular-nums; }
.unit { font-size: 11px; color: var(--muted); margin-left: 3px; }
.lbl { display: block; font-size: 11px; color: var(--muted); margin-top: 1px; }

#spark { width: 100%; display: block; }

.foot { text-align: center; padding: 14px 20px 26px; }
