:root {
  color-scheme: light;
  --ink: #10203b;
  --muted: #6a7890;
  --line: rgba(92, 116, 158, 0.18);
  --primary: #1e63f3;
  --primary-deep: #0c45c9;
  --primary-soft: #eaf2ff;
  --surface: rgba(255, 255, 255, 0.9);
  --surface-solid: #ffffff;
  --success: #1ca878;
  --danger: #dd4d5d;
  --shadow: 0 24px 70px rgba(28, 64, 124, 0.14);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { height: 100%; background: #eef4ff; overflow: hidden; }
body {
  width: 100%;
  height: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 10%, rgba(74, 132, 255, 0.18), transparent 30%),
    radial-gradient(circle at 92% 82%, rgba(109, 199, 255, 0.18), transparent 28%),
    linear-gradient(145deg, #f6f9ff 0%, #eef4ff 45%, #f8fbff 100%);
  overflow: hidden;
  overscroll-behavior: none;
}

button, textarea { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.ambient {
  position: fixed;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  filter: blur(100px);
  opacity: .22;
  pointer-events: none;
}
.ambient-one { background: #3379ff; top: -180px; left: -120px; }
.ambient-two { background: #72d9ff; right: -170px; bottom: -200px; }

.app-shell {
  width: min(1480px, calc(100% - 40px));
  height: calc(100vh - 40px);
  height: calc(100dvh - 40px);
  min-height: 0;
  max-height: calc(100dvh - 40px);
  margin: 20px auto;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(255,255,255,.8);
  border-radius: 32px;
  background: rgba(249, 252, 255, 0.74);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
  overflow: hidden;
}

.topbar {
  flex: 0 0 auto;
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.72);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  color: inherit;
  text-decoration: none;
}
.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  color: white;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .5px;
  background: linear-gradient(145deg, #2876ff, #0b43c5);
  box-shadow: 0 9px 25px rgba(30, 99, 243, .3);
}
.brand strong { display: block; font-size: 17px; letter-spacing: .2px; }
.brand small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }

.top-actions { display: flex; align-items: center; gap: 10px; }
.model-status {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  background: white;
  border: 1px solid var(--line);
  color: #52627a;
  font-size: 13px;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #b6c0cf;
  box-shadow: 0 0 0 5px rgba(182,192,207,.15);
}
.model-status.online .status-dot { background: var(--success); box-shadow: 0 0 0 5px rgba(28,168,120,.13); }
.model-status.offline .status-dot { background: var(--danger); box-shadow: 0 0 0 5px rgba(221,77,93,.12); }

.icon-button, .voice-button {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: white;
  color: #516078;
  cursor: pointer;
  transition: .2s ease;
}
.icon-button { width: 42px; height: 42px; border-radius: 13px; }
.icon-button:hover, .voice-button:hover { color: var(--primary); border-color: rgba(30,99,243,.3); transform: translateY(-1px); }
.icon-button svg, .voice-button svg, .send-button svg, .privacy-note svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.workspace {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(360px, 43%) minmax(0, 57%);
}

.assistant-panel {
  position: relative;
  height: 100%;
  min-height: 0;
  padding: 28px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  background: #0d367e;
  color: white;
}
.assistant-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(7,25,62,.05) 20%, rgba(6,26,64,.38) 52%, rgba(7,29,73,.98) 92%),
    linear-gradient(90deg, rgba(13,54,126,.2), transparent 60%);
  pointer-events: none;
}
.assistant-photo { position: absolute; inset: 0; }
.assistant-photo img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 27%; transform: scale(1.02); }
.photo-shade { position: absolute; inset: 0; box-shadow: inset 0 0 100px rgba(3,21,55,.3); }
.assistant-state {
  position: absolute;
  top: 22px;
  left: 22px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 13px;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 999px;
  background: rgba(9,32,78,.38);
  backdrop-filter: blur(12px);
  font-size: 12px;
}
.state-indicator { width: 8px; height: 8px; border-radius: 50%; background: #57e9ad; box-shadow: 0 0 0 5px rgba(87,233,173,.12); }
.assistant-panel.thinking .state-indicator { background: #ffd269; animation: pulse 1s infinite; }
.assistant-panel.speaking .state-indicator { background: #77b7ff; animation: pulse .75s infinite; }

.assistant-copy, .capability-grid, .privacy-note { position: relative; z-index: 2; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 2px; opacity: .72; }
.assistant-copy h1 { margin: 9px 0 10px; font-size: clamp(28px, 3.2vw, 46px); line-height: 1.17; letter-spacing: -.6px; }
.assistant-copy p { max-width: 590px; margin: 0; color: rgba(255,255,255,.76); font-size: 14px; line-height: 1.8; }

.capability-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 22px;
}
.capability-card {
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  text-align: left;
  color: white;
  border: 1px solid rgba(255,255,255,.17);
  border-radius: 15px;
  background: rgba(11, 42, 98, .52);
  backdrop-filter: blur(14px);
  cursor: pointer;
  transition: .22s ease;
}
.capability-card:hover { transform: translateY(-2px); border-color: rgba(255,255,255,.36); background: rgba(22,67,145,.66); }
.capability-icon { flex: 0 0 auto; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px; background: rgba(255,255,255,.16); font-weight: 800; }
.capability-card strong, .capability-card small { display: block; }
.capability-card strong { font-size: 13px; }
.capability-card small { margin-top: 4px; color: rgba(255,255,255,.62); font-size: 10px; }

.privacy-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 13px;
  color: rgba(255,255,255,.58);
  font-size: 10px;
}
.privacy-note svg { flex: 0 0 auto; width: 17px; }

.chat-panel {
  min-width: 0;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  background: rgba(255,255,255,.82);
}
.chat-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 30px 32px 20px;
}
.section-label { color: var(--primary); font-size: 12px; font-weight: 700; letter-spacing: 1.5px; }
.chat-header h2 { margin: 5px 0 7px; font-size: 25px; }
.chat-header p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.header-badge { flex: 0 0 auto; padding: 8px 12px; border-radius: 999px; color: var(--primary-deep); background: var(--primary-soft); font-size: 11px; font-weight: 700; }

.quick-prompts {
  display: flex;
  gap: 8px;
  padding: 0 32px 18px;
  overflow-x: auto;
  scrollbar-width: none;
}
.quick-prompts::-webkit-scrollbar { display: none; }
.quick-prompts button {
  flex: 0 0 auto;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f7f9fd;
  color: #53647c;
  font-size: 11px;
  cursor: pointer;
  transition: .2s;
}
.quick-prompts button:hover { color: var(--primary); border-color: rgba(30,99,243,.28); background: var(--primary-soft); }

.messages {
  min-height: 0;
  padding: 12px 32px 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scroll-behavior: smooth;
}
.messages::-webkit-scrollbar { width: 8px; }
.messages::-webkit-scrollbar-thumb { background: rgba(87,108,142,.16); border-radius: 999px; }

.empty-state {
  height: 100%;
  min-height: 300px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
}
.empty-state div { max-width: 430px; }
.empty-icon { width: 58px; height: 58px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 18px; color: white; background: linear-gradient(145deg,#4c8cff,#1558e7); box-shadow: 0 14px 30px rgba(30,99,243,.24); font-weight: 800; }
.empty-state h3 { margin: 0 0 8px; color: var(--ink); font-size: 18px; }
.empty-state p { margin: 0; font-size: 12px; line-height: 1.8; }

.message {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin: 15px 0;
  animation: messageIn .25s ease both;
}
.message.user { flex-direction: row-reverse; }
.message-avatar { flex: 0 0 auto; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 12px; color: white; font-size: 11px; font-weight: 800; background: linear-gradient(145deg,#4f8eff,#1658e5); box-shadow: 0 8px 18px rgba(30,99,243,.18); }
.message.user .message-avatar { background: #e8eef8; color: #66758c; box-shadow: none; }
.message-body { max-width: min(78%, 680px); }
.message.user .message-body { text-align: right; }
.message-label { margin: 0 4px 5px; color: #8792a5; font-size: 10px; }
.message-bubble {
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 7px 17px 17px 17px;
  background: white;
  box-shadow: 0 8px 22px rgba(48,75,122,.06);
  color: #24324a;
  font-size: 13px;
  line-height: 1.75;
  text-align: left;
  white-space: pre-wrap;
  word-break: break-word;
}
.message.user .message-bubble { color: white; border: 0; border-radius: 17px 7px 17px 17px; background: linear-gradient(145deg,#2e78f8,#1353da); }
.message.error .message-bubble { color: #9e2d3a; background: #fff4f5; border-color: rgba(221,77,93,.25); }
.message-actions { display: flex; gap: 7px; margin-top: 7px; }
.message.user .message-actions { justify-content: flex-end; }
.message-actions button { padding: 4px 8px; border: 0; border-radius: 8px; color: #77859a; background: transparent; font-size: 10px; cursor: pointer; }
.message-actions button:hover { color: var(--primary); background: var(--primary-soft); }

.typing-bubble { display: inline-flex; gap: 5px; align-items: center; min-width: 62px; }
.typing-bubble span { width: 7px; height: 7px; border-radius: 50%; background: #87a5d7; animation: typing 1.2s infinite; }
.typing-bubble span:nth-child(2) { animation-delay: .15s; }
.typing-bubble span:nth-child(3) { animation-delay: .3s; }

.composer {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin: 0 28px 25px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: white;
  box-shadow: 0 16px 40px rgba(41,73,128,.1);
}
.composer:focus-within { border-color: rgba(30,99,243,.42); box-shadow: 0 16px 42px rgba(30,99,243,.13); }
.composer-box { min-width: 0; position: relative; display: flex; align-items: flex-end; }
textarea {
  width: 100%;
  max-height: 130px;
  min-height: 48px;
  padding: 13px 48px 11px 13px;
  resize: none;
  border: 0;
  outline: none;
  color: var(--ink);
  background: transparent;
  font-size: 13px;
  line-height: 1.6;
}
textarea::placeholder { color: #a0abba; }
.voice-button { position: absolute; right: 5px; bottom: 5px; width: 38px; height: 38px; border: 0; border-radius: 12px; background: #f3f6fb; }
.voice-button.listening { color: white; background: var(--danger); animation: pulse 1s infinite; }
.send-button {
  align-self: stretch;
  min-width: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 19px;
  border: 0;
  border-radius: 14px;
  color: white;
  background: linear-gradient(145deg,#2d78fa,#0c4acf);
  box-shadow: 0 10px 24px rgba(30,99,243,.25);
  cursor: pointer;
  transition: .2s;
}
.send-button:hover { transform: translateY(-1px); filter: brightness(1.03); }
.send-button:disabled { cursor: not-allowed; opacity: .6; transform: none; }
.send-button svg { width: 19px; }
.composer-meta {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  padding: 0 5px;
  color: #929dac;
  font-size: 9px;
}

.footer {
  flex: 0 0 42px;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 24px;
  border-top: 1px solid var(--line);
  color: #8490a2;
  background: rgba(255,255,255,.72);
  font-size: 10px;
}

@keyframes pulse { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(.7); opacity: .55; } }
@keyframes typing { 0%,70%,100% { transform: translateY(0); opacity: .35; } 35% { transform: translateY(-4px); opacity: 1; } }
@keyframes messageIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 1050px) {
  .app-shell { width: calc(100% - 24px); height: calc(100dvh - 24px); min-height: 0; max-height: calc(100dvh - 24px); margin: 12px auto; border-radius: 24px; }
  .workspace { grid-template-columns: 38% 62%; }
  .assistant-panel { padding: 20px; }
  .capability-grid { grid-template-columns: 1fr; }
  .capability-card:nth-child(n+3) { display: none; }
  .chat-header { padding: 24px 24px 18px; }
  .quick-prompts { padding-left: 24px; padding-right: 24px; }
  .messages { padding-left: 24px; padding-right: 24px; }
}

@media (max-width: 760px) {
  body { background: #f2f6fd; }
  .app-shell {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    max-height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
  }
  .topbar { min-height: 64px; padding: 9px 12px; }
  .brand { min-width: 0; }
  .brand-mark { width: 40px; height: 40px; border-radius: 12px; }
  .brand strong { display: block; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
  .brand small { display: none; }
  .model-status { max-width: 112px; min-height: 36px; padding: 0 9px; white-space: nowrap; overflow: hidden; }
  .model-status span:last-child { overflow: hidden; text-overflow: ellipsis; }
  .icon-button { width: 38px; height: 38px; }

  .workspace {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: minmax(170px, 31%) minmax(0, 69%);
    min-height: 0;
    overflow: hidden;
  }
  .assistant-panel {
    height: auto;
    min-height: 0;
    padding: 14px 16px;
  }
  .assistant-photo img { object-position: 50% 25%; }
  .assistant-state { top: 12px; left: 12px; padding: 7px 10px; }
  .assistant-copy h1 { margin: 6px 0 0; font-size: 23px; line-height: 1.12; }
  .assistant-copy p,
  .capability-grid,
  .privacy-note { display: none; }

  .chat-panel {
    height: 100%;
    min-height: 0;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
  }
  .chat-header { padding: 14px 15px 8px; }
  .chat-header h2 { margin: 3px 0 4px; font-size: 19px; }
  .chat-header p { max-width: 92%; font-size: 9px; line-height: 1.45; }
  .section-label { font-size: 10px; }
  .header-badge { display: none; }
  .quick-prompts { padding: 0 15px 8px; }
  .quick-prompts button { padding: 7px 10px; font-size: 10px; }
  .messages { min-height: 0; padding: 4px 13px 10px; }
  .empty-state { min-height: 160px; }
  .empty-icon { width: 46px; height: 46px; margin-bottom: 10px; border-radius: 14px; }
  .empty-state h3 { font-size: 16px; }
  .empty-state p { font-size: 10px; }
  .message { margin: 10px 0; }
  .message-avatar { width: 30px; height: 30px; border-radius: 10px; }
  .message-body { max-width: 88%; }
  .message-bubble { padding: 10px 12px; font-size: 12px; line-height: 1.65; }
  .composer {
    margin: 0 10px max(9px, env(safe-area-inset-bottom));
    padding: 7px;
    gap: 7px;
    border-radius: 16px;
  }
  textarea { min-height: 42px; max-height: 88px; padding: 10px 43px 9px 10px; font-size: 12px; }
  .voice-button { width: 34px; height: 34px; }
  .send-button { min-width: 70px; padding: 0 12px; border-radius: 12px; }
  .send-button span { font-size: 12px; }
  .composer-meta { display: none; }
  .footer { display: none; }
}

@media (max-width: 420px) {
  .model-status { display: none; }
  .workspace { grid-template-rows: minmax(145px, 27%) minmax(0, 73%); }
  .assistant-copy h1 { font-size: 20px; }
  .chat-header p { display: none; }
  .quick-prompts { padding-top: 2px; }
}

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