:root {
  --bg: #12141c;
  --bg2: #1a1e2b;
  --line: #2a3144;
  --txt: #e8ecf4;
  --muted: #8b93a7;
  --acc: #ff8a3d;
  --acc2: #3dd6c6;
  --err: #ff6b7a;
  --user: #243049;
  --bot: #1c2333;
}
* { box-sizing: border-box; }
html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}
body {
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--txt);
  height: 100dvh;
}
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 12px; }

.gate {
  min-height: 100%;
  display: grid;
  place-items: center;
  background:
    linear-gradient(90deg, #ff5a4f 0 14%, #ffb14a 14% 28%, #f6e05e 28% 42%, #3ddc84 42% 57%, #3db5ff 57% 72%, #9b6bff 72% 86%, #ff5a9b 86% 100%) top / 100% 6px no-repeat,
    var(--bg);
}
.card {
  width: min(420px, 92vw);
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px 28px 24px;
}
.brand-mark {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.2em;
  color: var(--acc);
}
.card h1 { margin: 6px 0 8px; font-size: 26px; }
.sub { color: var(--muted); margin: 0 0 18px; line-height: 1.5; font-size: 14px; }
.tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.tab {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
}
.tab.on { color: var(--txt); border-color: var(--acc); }
label { display: block; font-size: 13px; color: var(--muted); margin-top: 10px; }
input, textarea {
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #10131b;
  color: var(--txt);
  font: inherit;
}
button {
  font: inherit;
  cursor: pointer;
}
.card button[type="submit"], .composer button, .side-top button, .side-bot button {
  margin-top: 16px;
  width: 100%;
  padding: 10px;
  border: 0;
  border-radius: 10px;
  background: var(--acc);
  color: #1a120c;
  font-weight: 600;
}
.err { color: var(--err); min-height: 1.2em; font-size: 13px; }

.app {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  height: 100%;
  max-height: 100dvh;
  overflow: hidden;
}
.pc-dl-bar {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  padding: 12px 18px;
  background: linear-gradient(90deg, #c45a12, #e8892a);
  color: #1a1208;
  z-index: 5;
}
.pc-dl-bar.hidden { display: none !important; }
.pc-dl-copy {
  flex: 1;
  min-width: 200px;
}
.pc-dl-copy strong {
  display: block;
  font-size: 16px;
}
.pc-dl-copy span {
  font-size: 13px;
  opacity: 0.92;
}
.btn-pc-dl {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 10px 18px;
  border-radius: 10px;
  background: #1a1208;
  color: #ffe7c2 !important;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  border: 0;
}
.btn-pc-dl:hover { filter: brightness(1.08); }
.btn-pc-dl.huge {
  padding: 16px 28px;
  font-size: 18px;
}
.btn-pc-ghost {
  color: inherit;
  font-weight: 700;
  text-decoration: underline;
  white-space: nowrap;
}
.card .btn-pc-dl {
  width: 100%;
  margin-top: 16px;
  background: var(--acc);
  color: #1a1208 !important;
}
.dl-hint {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}
.side-dl {
  width: 100%;
  box-sizing: border-box;
  background: var(--acc);
  color: #1a1208 !important;
}
.pc-install h2 { color: var(--txt); margin: 6px 0 10px; }
.pc-install-kicker { color: var(--acc); font-weight: 700; margin: 0; }
.pc-install-actions { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin: 18px 0; }
.side {
  border-right: 1px solid var(--line);
  background: var(--bg2);
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
.side-top, .side-bot { padding: 14px; flex-shrink: 0; }
.side-top { display: flex; flex-direction: column; gap: 10px; border-bottom: 1px solid var(--line); }
.app-nav { display: flex; flex-wrap: wrap; gap: 6px; }
.nav-btn {
  margin: 0;
  width: auto;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}
.nav-btn.on { color: var(--txt); border-color: var(--acc); }
.view {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  flex: 1;
  overflow: hidden;
}
.view.hidden { display: none !important; }
.pane-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 20px;
  color: var(--muted);
  line-height: 1.55;
}
.pane-body p, .pane-body li { color: var(--muted); }
.pane-body pre {
  background: #10131b;
  padding: 10px 12px;
  border-radius: 8px;
  overflow: auto;
  color: var(--txt);
  font-size: 13px;
}
.shell-form label { display: block; font-size: 13px; margin-top: 10px; }
.shell-form input[type=number], .shell-form select {
  width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #10131b;
  color: var(--txt);
}
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.chk { margin-top: 14px; }
.shell-form button[type=submit] {
  margin-top: 18px;
  width: auto;
  padding: 10px 18px;
}
.pane-body.shell-page { padding: 16px 20px 28px; }
.shell-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(220px, 0.85fr);
  gap: 22px;
  align-items: start;
}
.shell-lead { margin: 0 0 14px; }
.preset-label {
  margin: 14px 0 8px;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.preset-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.preset-card {
  margin: 0;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #10131b;
  color: var(--txt);
  font-weight: 600;
}
.preset-card span { display: block; font-weight: 400; color: var(--muted); font-size: 12px; margin-top: 4px; }
.preset-card.on { border-color: var(--acc); }
.feat-row { display: flex; flex-wrap: wrap; gap: 10px 16px; margin-top: 8px; }
.feat-row .chk { margin-top: 8px; }
.shell-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 18px; }
.shell-actions button { margin: 0; width: auto; padding: 10px 18px; }
.shell-adv { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 10px; }
.shell-adv summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.btn-ghost {
  margin-top: 12px;
  background: transparent !important;
  color: var(--txt) !important;
  border: 1px solid var(--line) !important;
}
.shell-stage {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
}
.mock-wrap {
  height: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #0d1018;
  border-radius: 12px;
}
.mock-lid, .mock-box {
  position: relative;
  background: #2a3348;
  border: 2px solid #7d8aa3;
  border-radius: 6px;
}
.mock-lid { background: #3a445c; }
.mock-cam {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #10131b;
  border: 2px solid var(--acc);
  left: 62%;
  top: 50%;
  transform: translate(-50%, -50%);
}
.mock-cam.off, .mock-cable.off { display: none; }
.mock-cable {
  position: absolute;
  left: 0;
  top: 42%;
  width: 8px;
  height: 22px;
  background: #10131b;
  border-radius: 0 4px 4px 0;
}
.mock-dims { color: var(--txt); font-size: 14px; margin: 12px 0 8px; }
.mock-list { margin: 0; padding-left: 18px; font-size: 13px; }
.shell-editor label { display: block; font-size: 13px; margin-top: 10px; }
.shell-editor input[type=number], .shell-editor select {
  width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #10131b;
  color: var(--txt);
}
@media (max-width: 900px) {
  .shell-layout { grid-template-columns: 1fr; }
}
.side-top button, .side-bot button { margin-top: 0; }
.side-bot { border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.side-bot button { background: transparent; color: var(--muted); border: 1px solid var(--line); }
#pc-dot { cursor: pointer; }
#pc-dot.on { color: #6dca8a; }
.pc-console {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.pc-chips {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--line);
}
.pc-chip {
  margin: 0;
  width: auto;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #10131b;
  color: var(--txt);
  font-size: 13px;
}
.pc-chip:hover { border-color: var(--acc); }
.conv-list {
  list-style: none;
  margin: 0;
  padding: 8px;
  overflow: auto;
  flex: 1;
  min-height: 0;
}
.conv-list li {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
}
.conv-list li.on, .conv-list li:hover { background: #232a3c; }
.conv-list li span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.conv-list .del {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0 4px;
  font-size: 16px;
}
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
.main > .view { flex: 1; }
#chat-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-head {
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.head-right {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.model-pick {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.model-pick select {
  width: auto;
  max-width: min(280px, 42vw);
  margin: 0;
  padding: 6px 8px;
  font-size: 13px;
}
.run-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #1a120c;
  background: var(--acc);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 600;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.run-status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #1a120c;
  animation: run-blink 0.9s ease-in-out infinite;
}
@keyframes run-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}
.msg.streaming .who {
  color: var(--acc);
}
.stream-cursor {
  display: inline-block;
  width: 7px;
  height: 1em;
  margin-left: 2px;
  background: var(--acc2);
  vertical-align: text-bottom;
  animation: run-blink 0.8s step-end infinite;
}
.composer.is-running textarea,
.composer.is-running button {
  opacity: 0.7;
}
.composer.is-running button {
  cursor: wait;
}
.log {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.msg {
  max-width: min(760px, 100%);
  padding: 12px 14px;
  border-radius: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.msg.user { align-self: flex-end; background: var(--user); }
.msg.assistant { align-self: flex-start; background: var(--bot); border: 1px solid var(--line); }
.msg .who { display: block; font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.kit-dl {
  display: inline-block;
  margin-top: 8px;
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--acc);
  color: #1a120c !important;
  font-weight: 700;
  text-decoration: none;
}
.gen-img {
  display: block;
  max-width: min(100%, 440px);
  border-radius: 10px;
  margin-top: 10px;
  border: 1px solid var(--line);
}
.shell-banner {
  flex-shrink: 0;
  margin: 0;
  padding: 10px 20px;
  background: #243049;
  color: var(--txt);
  font-size: 13px;
  line-height: 1.5;
  border-bottom: 1px solid var(--line);
}
.shell-banner.hidden { display: none !important; }
button.linkish {
  margin: 0;
  padding: 0;
  width: auto;
  border: 0;
  background: none;
  color: var(--acc);
  font-weight: 600;
}
.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 14px 18px 18px;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}
.composer button { margin: 0; width: auto; padding: 10px 22px; }
.composer textarea {
  resize: none;
  min-height: 52px;
  max-height: 88px;
  overflow-y: auto;
}

@media (max-width: 800px) {
  .app { grid-template-columns: 1fr; }
  .side { display: none; }
}
