:root {
  --bg: #060812;
  --panel: rgba(13, 17, 33, 0.78);
  --panel-hover: #151c31;
  --ink: #f5f7ff;
  --muted: #8f98b2;
  --line: rgba(148, 163, 207, 0.14);
  --line-strong: rgba(139, 154, 255, 0.28);
  --blue: #5f7cff;
  --cyan: #46d9ff;
  --violet: #a86cff;
  --green: #36e6a1;
  --danger: #ff6f91;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.46);
  font-family: Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { width: 100%; height: 100%; }

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(rgba(109, 127, 199, 0.026) 1px, transparent 1px),
    linear-gradient(90deg, rgba(109, 127, 199, 0.026) 1px, transparent 1px),
    radial-gradient(circle at 74% 12%, rgba(87, 80, 255, 0.14), transparent 28%),
    radial-gradient(circle at 48% 88%, rgba(36, 190, 255, 0.07), transparent 33%),
    var(--bg);
  background-size: 44px 44px, 44px 44px, auto, auto, auto;
  overflow: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(115deg, rgba(255, 255, 255, 0.018), transparent 27%, transparent 73%, rgba(122, 96, 255, 0.025));
  z-index: 0;
}

button, input, textarea, select { font: inherit; }
button { color: inherit; }

.ambient {
  position: fixed;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  filter: blur(110px);
  opacity: .13;
  pointer-events: none;
  z-index: 0;
}
.ambient-one { top: -240px; right: 12%; background: var(--violet); }
.ambient-two { bottom: -300px; left: 22%; background: var(--cyan); }

.app-shell {
  position: relative;
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr);
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  z-index: 1;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  padding: 26px 20px 22px;
  border-right: 1px solid var(--line);
  background: rgba(5, 8, 18, 0.78);
  box-shadow: 18px 0 80px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(24px);
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 13px; padding: 2px 5px; }
.brand-mark {
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(124, 148, 255, .34);
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(83, 107, 255, .28), rgba(129, 61, 255, .12));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 12px 32px rgba(62, 81, 255, .22);
  overflow: hidden;
}
.brand-mark::before { content: ""; width: 17px; height: 17px; border: 2px solid #8fa3ff; transform: rotate(45deg); }
.brand-mark span { position: absolute; width: 4px; height: 4px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 12px var(--cyan); }
.brand-mark span:nth-child(1) { top: 8px; right: 8px; }
.brand-mark span:nth-child(2) { bottom: 8px; left: 8px; }
.brand-mark span:nth-child(3) { bottom: 7px; right: 7px; background: var(--violet); }
.brand-copy strong { display: block; font-size: 16px; letter-spacing: .08em; }
.brand-copy span { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }

.new-chat {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 32px 0 28px;
  padding: 13px 14px;
  border: 1px solid rgba(111, 134, 255, .38);
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(105deg, rgba(75, 99, 232, .94), rgba(117, 78, 232, .9));
  box-shadow: 0 14px 32px rgba(70, 79, 210, .22), inset 0 1px 0 rgba(255,255,255,.15);
  cursor: pointer;
  transition: transform .18s ease, filter .18s ease, box-shadow .18s ease;
}
.new-chat:hover { transform: translateY(-2px); filter: brightness(1.08); box-shadow: 0 18px 38px rgba(70, 79, 210, .3); }
.new-chat-icon { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 7px; background: rgba(255,255,255,.13); }
.new-chat-arrow { margin-left: auto; opacity: .72; }

.side-nav { display: flex; flex: 0 0 auto; flex-direction: column; gap: 7px; }
.side-label, .eyebrow { color: #707b98; font-size: 10px; font-weight: 800; letter-spacing: .16em; }
.side-label { margin: 0 10px 5px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 11px 12px;
  color: var(--muted);
  font-size: 13px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
}
button.nav-item { cursor: pointer; }
.nav-item.active { color: #eef1ff; border-color: var(--line); background: rgba(86, 105, 204, .09); }
.nav-icon { display: grid; place-items: center; width: 24px; height: 24px; color: #aeb8ff; border-radius: 8px; background: rgba(101, 120, 255, .1); }
.nav-pulse { width: 6px; height: 6px; margin-left: auto; border-radius: 50%; background: var(--green); box-shadow: 0 0 12px var(--green); }
.nav-count { margin-left: auto; padding: 3px 7px; color: #8b95af; font-size: 10px; border: 1px solid var(--line); border-radius: 999px; }

.history-panel {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 110px;
  margin: 22px 0 14px;
  overflow: hidden;
}
.history-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; padding-right: 7px; }
.history-head .side-label { margin-bottom: 0; }
.history-count { display: grid; place-items: center; min-width: 21px; height: 21px; padding: 0 6px; color: #8792ae; font-size: 9px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.025); }
.history-list { display: flex; flex: 1 1 auto; flex-direction: column; gap: 5px; min-height: 0; padding-right: 4px; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: rgba(126,142,194,.22) transparent; }
.history-list::-webkit-scrollbar { width: 5px; }
.history-list::-webkit-scrollbar-thumb { border-radius: 99px; background: rgba(126,142,194,.22); }
.history-entry { position: relative; display: flex; align-items: center; flex: 0 0 auto; border: 1px solid transparent; border-radius: 11px; transition: border-color .16s ease, background .16s ease; }
.history-entry:hover { border-color: rgba(130,146,210,.12); background: rgba(255,255,255,.025); }
.history-entry.active { border-color: rgba(94,124,255,.22); background: linear-gradient(105deg, rgba(73,98,212,.14), rgba(83,53,151,.09)); }
.history-select { display: flex; align-items: center; gap: 9px; min-width: 0; width: 100%; padding: 9px 34px 9px 9px; text-align: left; border: 0; background: transparent; cursor: pointer; }
.history-glyph { display: grid; place-items: center; flex: 0 0 25px; width: 25px; height: 25px; color: #7f8cc2; font-size: 12px; border-radius: 8px; background: rgba(103,120,205,.08); }
.history-entry.active .history-glyph { color: var(--cyan); background: rgba(70,217,255,.09); }
.history-copy { display: block; min-width: 0; }
.history-copy strong, .history-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-copy strong { color: #c7cde0; font-size: 11px; font-weight: 650; }
.history-entry.active .history-copy strong { color: #f1f3ff; }
.history-copy small { margin-top: 4px; color: #626d88; font-size: 9px; }
.history-delete { position: absolute; top: 50%; right: 6px; display: grid; place-items: center; width: 25px; height: 25px; padding: 0; color: #68728b; font-size: 16px; border: 0; border-radius: 7px; background: transparent; opacity: 0; transform: translateY(-50%); cursor: pointer; transition: opacity .16s ease, color .16s ease, background .16s ease; }
.history-entry:hover .history-delete, .history-entry:focus-within .history-delete { opacity: 1; }
.history-delete:hover { color: #ff9db4; background: rgba(255,111,145,.09); }

.connection-card {
  flex: 0 0 auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: linear-gradient(145deg, rgba(18, 24, 45, .88), rgba(9, 13, 26, .88));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.025);
}
.connection-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 11px; }
.connection-card strong { display: block; font-size: 14px; }
.connection-card p { min-height: 32px; margin: 6px 0 13px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.connection-line { height: 2px; border-radius: 99px; background: rgba(109, 126, 173, .12); overflow: hidden; }
.connection-line span { display: block; width: 38%; height: 100%; background: linear-gradient(90deg, var(--blue), var(--cyan)); box-shadow: 0 0 10px var(--cyan); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #606981; box-shadow: 0 0 0 4px rgba(96, 105, 129, .11); }
.status-dot.connected { background: var(--green); box-shadow: 0 0 0 4px rgba(54, 230, 161, .1), 0 0 12px rgba(54,230,161,.55); }
.status-dot.error { background: var(--danger); box-shadow: 0 0 0 4px rgba(255, 111, 145, .1); }

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-top: 10px;
  padding: 11px 12px;
  color: var(--muted);
  font-size: 12px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  cursor: pointer;
}
.sidebar-link span:last-child { margin-left: auto; }
.sidebar-link:hover { color: var(--ink); border-color: var(--line); background: rgba(255,255,255,.025); }
.settings-glyph { color: #98a8ff; font-size: 18px; }

.main-panel { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-width: 0; min-height: 0; height: 100vh; height: 100dvh; overflow: hidden; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  height: 88px;
  flex: 0 0 auto;
  padding: 20px clamp(26px, 4vw, 58px);
  border-bottom: 1px solid var(--line);
  background: rgba(7, 10, 20, .36);
  backdrop-filter: blur(16px);
}
.topbar h1 { margin: 5px 0 0; font-size: 18px; font-weight: 650; letter-spacing: .01em; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.secure-badge { display: inline-flex; align-items: center; gap: 8px; padding: 7px 11px; color: #9ea8c5; font-size: 9px; font-weight: 800; letter-spacing: .12em; border: 1px solid var(--line); border-radius: 999px; background: rgba(15,20,38,.66); }
.secure-badge i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px rgba(54, 230, 161, .8); }
.icon-button { display: grid; place-items: center; width: 38px; height: 38px; color: #b4bdd5; font-size: 18px; border: 1px solid var(--line); border-radius: 11px; background: rgba(14, 18, 34, .72); cursor: pointer; }
.icon-button:hover { color: #fff; border-color: var(--line-strong); background: var(--panel-hover); }
.mobile-only { display: none; }

.conversation {
  position: relative;
  height: 100%;
  min-height: 0;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 34px clamp(24px, 4vw, 60px) 42px;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}
.conversation::-webkit-scrollbar { width: 8px; }
.conversation::-webkit-scrollbar-thumb { border-radius: 99px; background: rgba(126, 142, 194, .2); }

.welcome { width: min(1180px, 100%); margin: clamp(10px, 3vh, 38px) auto 0; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(360px, .82fr); gap: clamp(34px, 5vw, 80px); align-items: center; }
.hero-copy { min-width: 0; }
.hero-kicker { display: inline-flex; align-items: center; gap: 9px; color: #9faaf0; font-size: 10px; font-weight: 800; letter-spacing: .18em; }
.hero-kicker > span { width: 26px; height: 1px; background: linear-gradient(90deg, var(--cyan), var(--violet)); box-shadow: 0 0 10px var(--cyan); }
.hero-copy h2 { margin: 20px 0 18px; font-size: clamp(42px, 5.2vw, 72px); font-weight: 700; line-height: 1.1; letter-spacing: -.045em; }
.hero-copy h2 em { color: transparent; font-style: normal; background: linear-gradient(102deg, #f4f6ff 5%, #89b9ff 42%, #a88aff 78%); -webkit-background-clip: text; background-clip: text; }
.hero-copy > p { max-width: 650px; margin: 0; color: var(--muted); font-size: 15px; line-height: 1.85; }

.model-matrix { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 28px; }
.model-chip { display: inline-flex; align-items: center; gap: 8px; padding: 8px 11px 8px 8px; color: #707994; font-size: 11px; font-weight: 650; border: 1px solid rgba(134, 147, 190, .1); border-radius: 999px; background: rgba(11,15,29,.6); opacity: .58; }
.model-chip.active { color: #e7ebff; border-color: rgba(75, 215, 255, .25); background: linear-gradient(120deg, rgba(39, 120, 166, .18), rgba(75, 78, 175, .13)); opacity: 1; box-shadow: inset 0 1px 0 rgba(255,255,255,.04), 0 8px 25px rgba(20, 88, 166, .08); }
.model-chip > i { width: 5px; height: 5px; border-radius: 50%; background: var(--green); box-shadow: 0 0 9px var(--green); }
.model-symbol { display: grid; place-items: center; width: 22px; height: 22px; color: #c5ccdf; font-size: 9px; font-weight: 900; border-radius: 7px; background: rgba(255,255,255,.05); }
.deepseek-symbol { color: #84ddff; background: rgba(62, 178, 255, .13); }
.codex-symbol { color: #e4e8ff; background: rgba(151, 162, 255, .12); }
.claude-symbol { color: #e9a77c; background: rgba(225, 133, 76, .1); }
.gemini-symbol { color: #a78bff; background: rgba(144, 104, 255, .12); }
.grok-symbol { color: #d9deed; background: rgba(255,255,255,.06); }

.hero-visual { position: relative; width: min(460px, 100%); aspect-ratio: 1; margin: 0 auto; }
.visual-grid { position: absolute; inset: 8%; border-radius: 50%; opacity: .32; background: linear-gradient(rgba(102, 123, 206, .1) 1px, transparent 1px), linear-gradient(90deg, rgba(102, 123, 206, .1) 1px, transparent 1px); background-size: 22px 22px; mask-image: radial-gradient(circle, #000 20%, transparent 71%); }
.orbit { position: absolute; border: 1px solid rgba(119, 140, 232, .15); border-radius: 50%; }
.orbit::before, .orbit::after { content: ""; position: absolute; inset: 12%; border: 1px solid rgba(109, 199, 255, .06); border-radius: 50%; }
.orbit::after { inset: 30%; }
.orbit-outer { inset: 4%; animation: orbit-spin 28s linear infinite; }
.orbit-inner { inset: 20%; border-color: rgba(143, 92, 255, .22); animation: orbit-spin 18s linear infinite reverse; }
.core-glow { position: absolute; inset: 28%; border-radius: 50%; background: radial-gradient(circle, rgba(80, 106, 255, .38), rgba(116, 69, 255, .09) 48%, transparent 72%); filter: blur(10px); animation: pulse-glow 4s ease-in-out infinite; }
.core-mark { position: absolute; inset: 37%; display: grid; place-items: center; border: 1px solid rgba(140, 162, 255, .43); border-radius: 28px; background: linear-gradient(145deg, rgba(39, 51, 105, .92), rgba(42, 23, 76, .82)); box-shadow: inset 0 1px 1px rgba(255,255,255,.12), 0 0 50px rgba(82, 96, 255, .28); transform: rotate(45deg); }
.core-mark span, .core-mark small { transform: rotate(-45deg); }
.core-mark span { font-size: 25px; font-weight: 800; letter-spacing: -.06em; text-shadow: 0 0 20px rgba(102,215,255,.45); }
.core-mark small { position: absolute; right: 17%; bottom: 16%; color: var(--cyan); font-size: 8px; font-weight: 900; letter-spacing: .12em; }
.orbit-node { position: absolute; width: 8px; height: 8px; border: 2px solid var(--bg); border-radius: 50%; background: var(--cyan); box-shadow: 0 0 16px var(--cyan); }
.node-one { top: 13%; left: 51%; }
.node-two { right: 13%; bottom: 34%; background: var(--violet); box-shadow: 0 0 16px var(--violet); }
.node-three { left: 16%; bottom: 24%; width: 6px; height: 6px; background: var(--green); box-shadow: 0 0 14px var(--green); }
.signal-card { position: absolute; display: flex; align-items: center; gap: 8px; padding: 9px 12px; color: #9ba5c0; font-size: 8px; font-weight: 800; letter-spacing: .15em; border: 1px solid var(--line); border-radius: 10px; background: rgba(10, 14, 28, .76); box-shadow: 0 14px 34px rgba(0,0,0,.25); backdrop-filter: blur(12px); }
.signal-card span { width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 10px var(--cyan); }
.signal-card-top { top: 19%; right: 0; }
.signal-card-bottom { left: 0; bottom: 20%; }
.signal-card-bottom span { background: var(--green); box-shadow: 0 0 10px var(--green); }
@keyframes orbit-spin { to { transform: rotate(360deg); } }
@keyframes pulse-glow { 0%,100% { opacity: .7; transform: scale(.96); } 50% { opacity: 1; transform: scale(1.06); } }

.quick-actions { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 4px; }
.quick-actions button { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 14px; text-align: left; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(135deg, rgba(17,22,41,.75), rgba(10,14,28,.72)); box-shadow: inset 0 1px 0 rgba(255,255,255,.025); cursor: pointer; transition: transform .18s ease, border-color .18s ease, background .18s ease; }
.quick-actions button:hover { transform: translateY(-2px); border-color: var(--line-strong); background: var(--panel-hover); }
.quick-actions button > span:nth-child(2) { min-width: 0; }
.quick-actions strong, .quick-actions small { display: block; }
.quick-actions strong { margin-bottom: 4px; font-size: 12px; }
.quick-actions small { color: var(--muted); font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quick-actions button > i { margin-left: auto; color: #74809d; font-style: normal; }
.quick-icon { display: grid; place-items: center; flex: 0 0 34px; width: 34px; height: 34px; font-size: 15px; border-radius: 10px; }
.quick-icon.cyan { color: var(--cyan); background: rgba(70, 217, 255, .1); }
.quick-icon.violet { color: #bd8fff; background: rgba(168,108,255,.1); }
.quick-icon.blue { color: #90a6ff; background: rgba(95,124,255,.11); }

.messages { display: flex; flex-direction: column; gap: 25px; width: min(960px, 100%); min-height: 0; margin: 10px auto 0; padding-bottom: 10px; }
.message { display: flex; gap: 13px; align-items: flex-start; }
.message.user { flex-direction: row-reverse; }
.avatar { display: grid; place-items: center; flex: 0 0 36px; width: 36px; height: 36px; color: #fff; font-size: 10px; font-weight: 800; border: 1px solid rgba(121,145,255,.32); border-radius: 11px; background: linear-gradient(145deg, #5268d9, #704cc5); box-shadow: 0 10px 24px rgba(65, 73, 188, .17); }
.message.user .avatar { color: #cbd4ff; border-color: var(--line); background: #151a2b; box-shadow: none; }
.message-body { min-width: 0; max-width: min(78%, 780px); }
.message-meta { display: flex; align-items: center; gap: 9px; margin: 0 3px 7px; color: var(--muted); font-size: 10px; }
.message.user .message-meta { justify-content: flex-end; }
.bubble { max-width: 100%; padding: 15px 17px; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; color: #dce1f1; line-height: 1.75; border: 1px solid var(--line); border-radius: 17px 17px 17px 5px; background: rgba(15, 20, 37, .9); box-shadow: 0 12px 32px rgba(0,0,0,.16); }
.message.user .bubble { color: #edf0ff; border-color: rgba(103, 126, 240, .25); border-radius: 17px 17px 5px 17px; background: linear-gradient(135deg, rgba(62,79,161,.42), rgba(60,42,113,.36)); }
.message.error .bubble { color: #ff9db4; border-color: rgba(255,111,145,.3); background: rgba(85,25,43,.25); }
.typing { display: inline-flex; gap: 5px; padding: 3px 0; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); animation: bounce 1s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .15s; background: var(--blue); }
.typing i:nth-child(3) { animation-delay: .3s; background: var(--violet); }
@keyframes bounce { 0%,60%,100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-5px); opacity: 1; } }
.copy-button { margin-top: 7px; padding: 5px 8px; color: var(--muted); font-size: 10px; border: 0; border-radius: 7px; background: transparent; cursor: pointer; }
.copy-button:hover { color: var(--ink); background: rgba(255,255,255,.04); }

.composer-wrap { flex: 0 0 auto; min-width: 0; padding: 12px clamp(24px, 4vw, 60px) 22px; background: linear-gradient(180deg, rgba(6,8,18,0), rgba(6,8,18,.96) 28%); }
.composer { width: min(960px, 100%); margin: 0 auto; padding: 11px 12px 10px; border: 1px solid rgba(124,144,215,.24); border-radius: 18px; background: rgba(13,17,31,.9); box-shadow: 0 18px 60px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.035); backdrop-filter: blur(16px); }
.composer:focus-within { border-color: rgba(97,129,255,.42); box-shadow: 0 20px 65px rgba(0,0,0,.4), 0 0 0 3px rgba(93,119,255,.06); }
.composer textarea { display: block; width: 100%; max-height: 180px; padding: 8px 9px 14px; resize: none; color: var(--ink); line-height: 1.6; border: 0; outline: 0; background: transparent; }
.composer textarea::placeholder { color: #69738d; }
.composer-toolbar { display: flex; align-items: center; gap: 10px; }
.model-control { display: flex; align-items: center; min-width: 0; color: #7f89a4; font-size: 10px; }
.model-control-icon { display: grid; place-items: center; width: 25px; height: 25px; margin-right: 7px; color: var(--cyan); border-radius: 8px; background: rgba(70,217,255,.08); }
.model-control label { margin-right: 7px; }
.model-control select { max-width: 250px; padding: 6px 9px; color: #dce2f8; font-size: 10px; border: 1px solid var(--line); border-radius: 8px; outline: none; background: #0d1222; }
.composer-hint { margin-left: auto; color: #59637c; font-size: 9px; }
.send-button { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; color: #fff; border: 1px solid rgba(136,150,255,.25); border-radius: 10px; background: linear-gradient(120deg, #566ff1, #7b54dc); box-shadow: 0 9px 22px rgba(74,83,212,.2); cursor: pointer; }
.send-button:disabled { cursor: not-allowed; opacity: .34; box-shadow: none; }
.send-button:not(:disabled):hover { filter: brightness(1.12); }

.modal-backdrop { position: fixed; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(2,4,10,.76); backdrop-filter: blur(14px); z-index: 100; }
.modal { position: relative; width: min(520px, 100%); padding: 34px; border: 1px solid rgba(133,151,221,.22); border-radius: 22px; background: linear-gradient(150deg, rgba(19,25,46,.98), rgba(8,12,24,.98)); box-shadow: 0 35px 100px rgba(0,0,0,.62), inset 0 1px 0 rgba(255,255,255,.04); }
.modal::before { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; background: radial-gradient(circle at 12% 0%, rgba(78,108,255,.13), transparent 36%); }
.modal > * { position: relative; }
.modal-mark { display: grid; place-items: center; width: 45px; height: 45px; margin-bottom: 22px; color: #fff; font-size: 18px; font-weight: 800; border: 1px solid rgba(132,153,255,.35); border-radius: 14px; background: linear-gradient(145deg, rgba(82,106,228,.75), rgba(111,62,181,.72)); box-shadow: 0 14px 30px rgba(61,72,190,.25); }
.modal h2 { margin: 8px 0 10px; font-size: 28px; letter-spacing: -.025em; }
.modal-intro { margin: 0 0 25px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.modal-close { position: absolute; top: 17px; right: 17px; width: 34px; height: 34px; color: #8d97b2; font-size: 21px; border: 0; border-radius: 9px; background: transparent; cursor: pointer; z-index: 2; }
.modal-close:hover { color: #fff; background: rgba(255,255,255,.05); }
.field-label { display: block; margin-bottom: 9px; color: #d9def0; font-size: 12px; font-weight: 700; }
.key-input-wrap { display: flex; align-items: center; gap: 8px; padding: 0 13px; border: 1px solid rgba(128,144,197,.24); border-radius: 11px; background: rgba(4,7,16,.55); }
.key-input-wrap:focus-within { border-color: rgba(97,129,255,.55); box-shadow: 0 0 0 3px rgba(95,124,255,.08); }
.key-input-wrap > span { color: #7382bd; font-size: 18px; }
.modal input { width: 100%; padding: 13px 0; color: var(--ink); border: 0; outline: none; background: transparent; }
.modal input::placeholder { color: #4f5971; }
.field-help { margin: 8px 0 0; color: #69738d; font-size: 10px; }
.modal-error { margin-top: 14px; padding: 11px 13px; color: #ff9db4; font-size: 12px; border: 1px solid rgba(255,111,145,.25); border-radius: 9px; background: rgba(92,24,43,.2); }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 25px; }
.primary-button, .secondary-button { padding: 10px 14px; border-radius: 10px; cursor: pointer; }
.primary-button { color: white; border: 1px solid rgba(136,150,255,.3); background: linear-gradient(120deg, #566ff1, #7b54dc); }
.secondary-button { color: #9fa8c0; border: 1px solid var(--line); background: rgba(255,255,255,.025); }
.primary-button:hover { filter: brightness(1.1); }
.secondary-button:hover { color: #fff; background: rgba(255,255,255,.05); }
.toast { position: fixed; right: 24px; bottom: 24px; max-width: min(420px, calc(100vw - 48px)); padding: 12px 16px; color: white; font-size: 12px; border: 1px solid var(--line-strong); border-radius: 11px; background: #11172a; box-shadow: var(--shadow); z-index: 120; }

@media (max-width: 1120px) {
  .welcome { grid-template-columns: minmax(0, 1fr) 340px; gap: 34px; }
  .hero-copy h2 { font-size: clamp(42px, 5.7vw, 62px); }
}

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; width: min(286px, 88vw); transform: translateX(-105%); transition: transform .22s ease; box-shadow: 25px 0 70px rgba(0,0,0,.48); }
  .sidebar.open { transform: translateX(0); }
  .history-delete { opacity: 1; }
  .mobile-only { display: grid; }
  .topbar { height: 78px; padding: 16px 20px; }
  .topbar-title { flex: 1; }
  .secure-badge { display: none; }
  .conversation { padding: 25px 18px 36px; }
  .composer-wrap { padding: 10px 14px 16px; }
  .welcome { grid-template-columns: 1fr; margin-top: 12px; }
  .hero-visual { width: min(380px, 86vw); grid-row: 2; }
  .quick-actions { grid-template-columns: 1fr; }
  .hero-copy h2 { font-size: clamp(40px, 10vw, 64px); }
  .message-body { max-width: 88%; }
}

@media (max-width: 560px) {
  .topbar .eyebrow { display: none; }
  .topbar h1 { margin-top: 0; font-size: 16px; }
  .hero-copy h2 { font-size: 40px; }
  .hero-copy > p { font-size: 13px; }
  .hero-visual { width: min(310px, 90vw); }
  .model-matrix { gap: 6px; }
  .model-chip { padding-right: 9px; }
  .composer-hint, .model-control label { display: none; }
  .model-control select { max-width: 155px; }
  .send-button #sendButtonText { display: none; }
  .modal { padding: 28px 20px 22px; }
  .modal-actions { flex-direction: column-reverse; }
  .primary-button, .secondary-button { width: 100%; }
}

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