﻿:root {
  --bg: #edf2fb;
  --bg-2: #dbe4f3;
  --panel: #0b1220;
  --panel-2: #131d33;
  --card: #ffffff;
  --text: #1d2433;
  --muted: #6b7488;
  --brand-a: #1d97b6;
  --brand-b: #2563eb;
  --ok: #2dbf6e;
  --line: #d7dfef;
  --ring: rgba(37, 99, 235, 0.24);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: radial-gradient(1200px 600px at 80% -10%, #c9dafb 0%, var(--bg) 55%), linear-gradient(180deg, var(--bg), var(--bg-2));
  color: var(--text);
  font-family: "Outfit", "Noto Sans SC", sans-serif;
  min-height: 100vh;
}

.app-shell { display: grid; grid-template-columns: 320px 1fr; min-height: 100vh; }
.sidebar {
  background: linear-gradient(180deg, #071226 0%, #0f1930 100%);
  border-right: 1px solid rgba(255,255,255,0.08);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sidebar-title { color: #90a4d4; font-size: 13px; margin: 10px 2px 4px; }
.conversation-list { overflow: auto; display: flex; flex-direction: column; gap: 8px; min-height: 0; }

.conv-item {
  border: 1px solid rgba(112, 146, 255, 0.25);
  background: rgba(15, 32, 62, 0.5);
  color: #d8e4ff;
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}
.conv-item:hover { transform: translateY(-1px); border-color: rgba(122, 185, 255, 0.6); }
.conv-item.active { background: linear-gradient(130deg, rgba(30,88,188,0.55), rgba(17,161,165,0.35)); border-color: #59d1ff; }
.conv-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 18px; }

.main { display: grid; grid-template-rows: 72px 1fr auto; min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: linear-gradient(90deg, var(--brand-a), var(--brand-b));
  color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px;
}
.brand { font-size: 30px; letter-spacing: 1px; font-weight: 700; }
.controls { display: flex; gap: 14px; align-items: center; }
.control-group { position: relative; }
.label { font-size: 14px; opacity: 0.9; margin-right: 8px; }

.model-btn {
  border: 1px solid rgba(255,255,255,0.35);
  background: rgba(255,255,255,0.17);
  color: #fff;
  border-radius: 12px;
  min-width: 180px;
  height: 42px;
  padding: 0 12px;
  font-size: 20px;
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer;
  transition: all .2s ease;
}
.model-btn:hover { background: rgba(255,255,255,0.24); }
.model-btn:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--ring); }
.chev { transition: transform .2s ease; }
.model-select-wrap.open .chev { transform: rotate(180deg); }
.model-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 54px;
  min-width: 180px;
  background: #0e1a33;
  border: 1px solid rgba(103, 159, 255, 0.42);
  box-shadow: 0 14px 32px rgba(5, 16, 42, 0.45);
  border-radius: 12px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transform-origin: top;
  animation: menuIn 160ms ease;
}
@keyframes menuIn {
  from { opacity: 0; transform: translateY(-4px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.model-option {
  border: 0;
  background: transparent;
  color: #dce7ff;
  text-align: left;
  border-radius: 8px;
  height: 36px;
  padding: 0 12px;
  font-size: 18px;
  cursor: pointer;
}
.model-option:hover { background: rgba(103, 159, 255, 0.24); }
.model-option.active { background: linear-gradient(90deg, #1f6ae0, #1484cb); color: #fff; }
.hidden { display: none !important; }

.switch-wrap { display: inline-flex; align-items: center; gap: 8px; color: #eef5ff; font-size: 17px; }
.switch-wrap input { display: none; }
.switch-wrap i {
  width: 44px; height: 25px; border-radius: 999px;
  background: rgba(255,255,255,0.34); position: relative;
  transition: background .2s ease;
}
.switch-wrap i::after {
  content: ""; position: absolute; left: 3px; top: 3px;
  width: 19px; height: 19px; border-radius: 50%; background: #fff;
  transition: transform .2s ease;
}
.switch-wrap input:checked + i { background: var(--ok); }
.switch-wrap input:checked + i::after { transform: translateX(19px); }

.chat {
  padding: 24px;
  overflow: auto;
}
.msg { display: flex; margin: 0 0 16px; }
.msg.user { justify-content: flex-end; }
.bubble {
  max-width: min(1000px, 88%);
  border-radius: 18px;
  padding: 14px 16px;
}
.user .bubble { background: linear-gradient(130deg, #0ea5b7, #2563eb); color: #fff; box-shadow: 0 8px 18px rgba(28, 74, 151, .25); }
.assistant-bubble { background: rgba(255,255,255,0.88); border: 1px solid var(--line); box-shadow: 0 12px 28px rgba(32, 49, 84, 0.08); }

.reasoning-box {
  border: 1px solid #c8d8ff;
  background: #f2f6ff;
  border-radius: 12px;
  margin-bottom: 12px;
  overflow: hidden;
}
.reasoning-box summary {
  list-style: none;
  cursor: pointer;
  height: 40px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  color: #1f4aac;
  font-weight: 600;
}
.reasoning-box summary::-webkit-details-marker { display: none; }
.reasoning-box .reasoning-content {
  border-top: 1px dashed #c8d8ff;
  padding: 12px;
  white-space: pre-wrap;
  color: #3f4e73;
  line-height: 1.6;
}
.answer-title { color: #058e79; font-weight: 700; margin: 4px 0 8px; }
.content { line-height: 1.75; }

.markdown-body p { margin: 8px 0; }
.markdown-body ul, .markdown-body ol { padding-left: 20px; }
.markdown-body a { color: #1a64d8; text-decoration: none; }
.markdown-body a:hover { text-decoration: underline; }
.markdown-body pre { overflow: auto; background: #0f1b33; color: #e2ecff; padding: 10px; border-radius: 10px; }
.markdown-body code { background: #eff4ff; padding: 2px 5px; border-radius: 6px; }
.markdown-body pre code { background: transparent; }

.composer {
  background: rgba(255,255,255,.88);
  border-top: 1px solid var(--line);
  padding: 12px 18px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
}
textarea {
  width: 100%; min-height: 52px; max-height: 180px; resize: none;
  border: 1px solid #bfd0f7; border-radius: 14px; font-size: 18px;
  padding: 14px 16px; background: #fff;
  font-family: "Noto Sans SC", sans-serif;
}
textarea:focus { outline: none; box-shadow: 0 0 0 4px var(--ring); border-color: #78a2ff; }

.btn {
  border: 1px solid transparent;
  border-radius: 12px;
  min-height: 44px;
  padding: 0 16px;
  font-size: 19px;
  cursor: pointer;
  transition: all .2s ease;
}
.btn-primary { background: linear-gradient(130deg, #164fbc, #0f8097); color: #fff; border-color: rgba(128, 186, 255, 0.4); }
.btn-ghost { background: rgba(13, 45, 102, 0.5); border-color: rgba(127, 173, 255, 0.35); color: #d5e6ff; }
.btn-send { background: linear-gradient(130deg, #1aa4b1, #2c60e5); color: #fff; min-width: 110px; }
.btn:hover { filter: brightness(1.05); transform: translateY(-1px); }
.btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }

@media (max-width: 960px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .brand { font-size: 24px; }
  .controls { gap: 8px; }
  .model-btn { min-width: 130px; font-size: 16px; }
  .model-menu { left: 0; min-width: 150px; }
}
