:root {
  color-scheme: dark;
  --ink: #061018;
  --ink-soft: #0b1b26;
  --forest: #102b38;
  --paper: #eef3f4;
  --paper-deep: #e2eaec;
  --paper-line: rgba(18, 38, 48, 0.13);
  --cream: #f2f7f7;
  --muted: #8aa0a8;
  --muted-dark: #6f8087;
  --accent: #38d6ff;
  --accent-soft: #bdefff;
  --mint: #8ff0dd;
  --acid: #b9f4ff;
  --white: #ffffff;
  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC",
    Georgia, serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC",
    sans-serif;
  --mono: "SFMono-Regular", "Cascadia Code", "Roboto Mono", monospace;
  --shadow: 0 34px 90px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  background: var(--ink);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 15% 10%, rgba(27, 92, 116, 0.48), transparent 32%),
    radial-gradient(circle at 86% 96%, rgba(35, 135, 148, 0.22), transparent 34%),
    var(--ink);
  color: var(--cream);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

button,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--acid);
  outline-offset: 3px;
}

button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.page-grain {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  opacity: 0.16;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.78' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.3'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
}

.ambient {
  position: fixed;
  z-index: -1;
  border-radius: 999px;
  filter: blur(1px);
  pointer-events: none;
}

.ambient-one {
  top: -25vw;
  right: -8vw;
  width: 48vw;
  height: 48vw;
  background: radial-gradient(circle, rgba(72, 202, 236, 0.14), transparent 68%);
}

.ambient-two {
  bottom: -28vw;
  left: 20vw;
  width: 54vw;
  height: 54vw;
  background: radial-gradient(circle, rgba(78, 240, 210, 0.09), transparent 66%);
}

.app-frame {
  width: min(1520px, 100%);
  height: 100dvh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 22px clamp(18px, 3vw, 48px) 18px;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  margin-bottom: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(244, 241, 231, 0.2);
  border-radius: 50%;
  background: rgba(244, 241, 231, 0.04);
}

.brand-mark svg {
  width: 21px;
  fill: none;
  stroke: var(--acid);
  stroke-linecap: round;
  stroke-width: 1.4;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1;
}

.brand-copy strong {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.brand-copy small {
  color: rgba(244, 241, 231, 0.54);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.18em;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.system-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: rgba(244, 241, 231, 0.62);
  font-size: 12px;
  white-space: nowrap;
}

.status-light {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #e0a75e;
  box-shadow: 0 0 0 4px rgba(224, 167, 94, 0.1);
  animation: softPulse 2.4s ease-in-out infinite;
}

.system-status.is-ready .status-light {
  background: var(--mint);
  box-shadow: 0 0 0 4px rgba(183, 245, 218, 0.08);
}

.system-status.is-error .status-light {
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(255, 118, 88, 0.1);
}

.quiet-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid rgba(244, 241, 231, 0.15);
  border-radius: 999px;
  background: rgba(244, 241, 231, 0.045);
  color: rgba(244, 241, 231, 0.78);
  font-size: 12px;
  cursor: pointer;
  transition:
    border-color 180ms ease,
    background 180ms ease,
    color 180ms ease;
}

.quiet-button:hover {
  border-color: rgba(244, 241, 231, 0.3);
  background: rgba(244, 241, 231, 0.09);
  color: var(--white);
}

.quiet-button svg {
  width: 14px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.case-library-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid rgba(244, 241, 231, 0.12);
  border-radius: 999px;
  background: rgba(244, 241, 231, 0.035);
  color: rgba(244, 241, 231, 0.55);
  font-size: 12px;
  cursor: default;
}

.case-library-button:disabled {
  cursor: default;
  opacity: 1;
}

.case-library-button svg {
  width: 14px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.count-pill {
  display: grid;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  place-items: center;
  border-radius: 999px;
  background: var(--acid);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
}

.main-grid {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.03fr) minmax(440px, 0.97fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 18px;
  height: clamp(580px, calc(100dvh - 148px), 880px);
  min-height: 0;
  overflow: hidden;
}

.portrait-card,
.chat-panel {
  min-height: 0;
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.portrait-card {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  background: var(--forest);
  isolation: isolate;
}

.portrait-media {
  position: relative;
  min-height: 0;
  overflow: hidden;
}

.avatar-image,
.avatar-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 20%;
  opacity: 0;
  transform: scale(1.015);
  transition:
    opacity 380ms ease,
    transform 1.2s ease,
    filter 500ms ease;
}

.avatar-video.is-active,
.avatar-image {
  opacity: 1;
}

.portrait-card:hover .avatar-video.is-active,
.portrait-card:hover .avatar-image {
  transform: scale(1.027);
}

.portrait-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(4, 14, 11, 0.06) 32%, rgba(4, 13, 11, 0.26) 57%, rgba(4, 13, 11, 0.93) 92%),
    linear-gradient(90deg, rgba(3, 13, 10, 0.25), transparent 45%);
  pointer-events: none;
}

.portrait-grid-lines {
  position: absolute;
  inset: 0;
  opacity: 0.14;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.16) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.13) 1px, transparent 1px);
  background-size: 100% 25%, 25% 100%;
  mask-image: linear-gradient(to bottom, black, transparent 72%);
  pointer-events: none;
}

.speaking-halo {
  position: absolute;
  inset: 7% 9% 12%;
  border: 1px solid transparent;
  border-radius: 44% 44% 38% 38%;
  opacity: 0;
  pointer-events: none;
  box-shadow:
    0 0 0 1px rgba(183, 245, 218, 0.3),
    0 0 70px rgba(92, 200, 158, 0.42),
    inset 0 0 80px rgba(92, 200, 158, 0.08);
  transition: opacity 260ms ease;
}

.portrait-card.is-speaking .speaking-halo {
  opacity: 1;
  animation: haloBreathe 1.8s ease-in-out infinite;
}

.portrait-topline {
  position: absolute;
  top: 24px;
  right: 25px;
  left: 25px;
  display: flex;
  justify-content: space-between;
  color: rgba(244, 241, 231, 0.62);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.14em;
}

.portrait-topline-right {
  color: rgba(217, 243, 90, 0.74);
}

.portrait-sideword {
  position: absolute;
  top: 79px;
  right: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: rgba(244, 241, 231, 0.32);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.18em;
  writing-mode: vertical-rl;
}

.portrait-title {
  position: absolute;
  right: 28px;
  bottom: 27px;
  left: 28px;
  max-width: 560px;
}

.portrait-kicker {
  margin: 0 0 7px;
  color: var(--acid);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.portrait-title h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(38px, 4.6vw, 70px);
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 1.02;
  text-shadow: 0 2px 30px rgba(0, 0, 0, 0.22);
}

.portrait-title h1 span {
  display: block;
  margin-top: 6px;
  color: rgba(244, 241, 231, 0.72);
  font-family: var(--sans);
  font-size: 0.31em;
  font-weight: 400;
  letter-spacing: 0.08em;
}

.portrait-summary {
  max-width: 430px;
  margin: 13px 0 0;
  color: rgba(244, 241, 231, 0.68);
  font-size: 12px;
  line-height: 1.65;
}

.avatar-status {
  position: absolute;
  right: 22px;
  bottom: 24px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border: 1px solid rgba(244, 241, 231, 0.16);
  border-radius: 14px;
  background: rgba(6, 18, 14, 0.56);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(14px);
}

.waveform {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 55px;
  height: 27px;
}

.waveform span {
  width: 2px;
  height: 4px;
  border-radius: 999px;
  background: var(--mint);
  transform-origin: center;
  transition:
    height 100ms linear,
    opacity 180ms ease;
}

.avatar-status[data-state="idle"] .waveform span {
  height: 3px;
  opacity: 0.37;
}

.avatar-status[data-state="listening"] .waveform span {
  opacity: 0.95;
}

.avatar-status[data-state="thinking"] .waveform span {
  opacity: 0.65;
  animation: thinkingWave 1.1s ease-in-out infinite;
}

.avatar-status[data-state="speaking"] .waveform span {
  opacity: 1;
}

.status-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 74px;
}

.status-copy span {
  color: rgba(244, 241, 231, 0.45);
  font-size: 8px;
  letter-spacing: 0.11em;
}

.status-copy strong {
  font-size: 11px;
  font-weight: 500;
}

.chat-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto auto;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 25px 19px;
  border-bottom: 1px solid var(--paper-line);
}

.section-kicker {
  margin: 0 0 5px;
  color: #768178;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.14em;
}

.chat-header h2,
.knowledge-dialog h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 27px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wake-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 11px;
  border: 1px solid rgba(21, 45, 35, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.35);
  color: #505a52;
  font-size: 11px;
  cursor: pointer;
  transition:
    border-color 180ms ease,
    background 180ms ease,
    color 180ms ease;
}

.wake-toggle:hover {
  border-color: rgba(21, 45, 35, 0.3);
  background: rgba(255, 255, 255, 0.72);
}

.wake-toggle[aria-pressed="true"] {
  border-color: rgba(26, 95, 67, 0.32);
  background: #dceadf;
  color: #153d2f;
}

.wake-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #9da59e;
}

.wake-toggle[aria-pressed="true"] .wake-dot {
  background: #1a8d62;
  box-shadow: 0 0 0 4px rgba(26, 141, 98, 0.1);
  animation: softPulse 2s ease-in-out infinite;
}

.round-icon-button {
  display: grid;
  width: 34px;
  height: 34px;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(21, 45, 35, 0.14);
  border-radius: 50%;
  background: transparent;
  color: #677169;
  cursor: pointer;
  transition:
    color 180ms ease,
    background 180ms ease,
    border-color 180ms ease;
}

.round-icon-button:hover {
  border-color: rgba(21, 45, 35, 0.28);
  background: rgba(255, 255, 255, 0.55);
  color: var(--ink);
}

.round-icon-button svg {
  width: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.chat-log {
  min-height: 0;
  padding: 21px 25px 10px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: rgba(31, 52, 43, 0.18) transparent;
  scrollbar-width: thin;
}

.chat-log::-webkit-scrollbar {
  width: 5px;
}

.chat-log::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(31, 52, 43, 0.16);
}

.message {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 17px;
  animation: messageIn 340ms cubic-bezier(0.2, 0.68, 0.28, 1) both;
}

.message-avatar {
  display: grid;
  flex: 0 0 27px;
  width: 27px;
  height: 27px;
  margin-top: 17px;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: var(--acid);
  font-family: var(--serif);
  font-size: 12px;
}

.message-body {
  max-width: calc(100% - 38px);
}

.message-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 16px;
  margin-bottom: 5px;
  color: #717a73;
  font-size: 9px;
}

.message-meta span {
  color: #3d4941;
  font-weight: 500;
}

.message-meta time {
  font-family: var(--mono);
  font-size: 8px;
}

.message-text {
  margin: 0;
  color: #26352d;
  font-size: 13px;
  line-height: 1.72;
  white-space: pre-wrap;
}

.assistant-message .message-text {
  padding: 13px 14px;
  border: 1px solid rgba(20, 35, 29, 0.09);
  border-radius: 4px 16px 16px;
  background: rgba(255, 255, 255, 0.56);
  box-shadow: 0 7px 22px rgba(20, 35, 29, 0.035);
}

.user-message {
  justify-content: flex-end;
}

.user-message .message-avatar {
  display: none;
}

.user-message .message-body {
  max-width: 84%;
}

.user-message .message-meta {
  justify-content: flex-end;
  flex-direction: row-reverse;
}

.user-message .message-text {
  padding: 11px 14px;
  border-radius: 16px 4px 16px 16px;
  background: var(--forest);
  color: var(--cream);
  box-shadow: 0 9px 24px rgba(19, 40, 33, 0.12);
}

.answer-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-top: 7px;
}

.source-label {
  margin-right: 2px;
  color: #7f8981;
  font-size: 9px;
}

.source-chip {
  padding: 4px 7px;
  border: 1px solid rgba(28, 62, 47, 0.12);
  border-radius: 999px;
  background: rgba(218, 234, 221, 0.36);
  color: #3e5e4d;
  font-size: 9px;
  cursor: pointer;
}

.source-chip:hover {
  border-color: rgba(28, 62, 47, 0.25);
  background: rgba(218, 234, 221, 0.72);
}

.source-chip[aria-expanded="true"] {
  border-color: #315f4a;
  background: #315f4a;
  color: #f4f1e7;
}

.source-preview {
  flex-basis: 100%;
  margin: 5px 0 0;
  padding: 9px 10px;
  border-left: 2px solid rgba(49, 95, 74, 0.45);
  border-radius: 0 7px 7px 0;
  background: rgba(27, 50, 39, 0.055);
  color: #5f6962;
  font-size: 10px;
  line-height: 1.65;
}

.source-preview-text {
  margin: 0;
}

.source-preview .knowledge-slides {
  margin-top: 8px;
}

.source-details {
  margin-top: 7px;
  border-radius: 9px;
  background: rgba(27, 50, 39, 0.055);
  font-size: 10px;
}

.source-details summary {
  padding: 7px 9px;
  color: #657168;
  cursor: pointer;
  list-style: none;
}

.source-details summary::-webkit-details-marker {
  display: none;
}

.source-details summary::before {
  content: "+";
  display: inline-block;
  width: 13px;
  color: #3f6a53;
  font-family: var(--mono);
}

.source-details[open] summary::before {
  content: "−";
}

.source-details p {
  margin: 0;
  padding: 0 10px 9px 22px;
  color: #5f6962;
  line-height: 1.65;
}

.replay-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  padding: 4px 7px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #6d796f;
  font-size: 9px;
  cursor: pointer;
}

.replay-button:hover {
  background: rgba(20, 35, 29, 0.06);
  color: var(--ink);
}

.replay-button svg {
  width: 12px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.typing-message .message-text {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 49px;
  min-height: 38px;
}

.realtime-streaming-message .message-text::after {
  content: "▍";
  display: inline-block;
  margin-left: 2px;
  color: #557766;
  animation: softPulse 1s ease-in-out infinite;
}

.realtime-streaming-message.is-interrupted .message-text,
.message.is-interrupted .message-text {
  color: #68746c;
}

.typing-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #607268;
  animation: typingBounce 1.2s ease-in-out infinite;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.14s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.28s;
}

.quick-prompts {
  display: flex;
  gap: 6px;
  padding: 3px 25px 14px;
  overflow-x: auto;
  scrollbar-width: none;
}

.quick-prompts::-webkit-scrollbar {
  display: none;
}

.quick-prompts button {
  flex: 0 0 auto;
  padding: 7px 10px;
  border: 1px solid rgba(20, 35, 29, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.36);
  color: #5f6961;
  font-size: 10px;
  cursor: pointer;
  transition:
    border-color 180ms ease,
    background 180ms ease,
    color 180ms ease;
}

.quick-prompts button:hover {
  border-color: rgba(20, 35, 29, 0.25);
  background: rgba(255, 255, 255, 0.8);
  color: var(--ink);
}

.voice-hint {
  margin: 0 25px 12px;
  padding: 9px 11px;
  border: 1px solid rgba(153, 76, 53, 0.13);
  border-radius: 10px;
  background: rgba(255, 211, 199, 0.36);
  color: #7a4032;
  font-size: 10px;
  line-height: 1.5;
}

.composer {
  padding: 0 25px 22px;
}

.text-input-wrap {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: 48px;
  padding: 7px 7px 7px 15px;
  border: 1px solid rgba(20, 35, 29, 0.13);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.6);
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease;
}

.text-input-wrap:focus-within {
  border-color: rgba(31, 89, 63, 0.4);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 0 0 4px rgba(53, 125, 91, 0.07);
}

.text-input-wrap textarea {
  flex: 1;
  max-height: 108px;
  min-height: 33px;
  padding: 8px 10px 7px 0;
  overflow-y: auto;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.55;
}

.text-input-wrap textarea::placeholder {
  color: #9ba19b;
}

.send-button {
  display: grid;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: var(--ink);
  color: var(--cream);
  cursor: pointer;
  transition:
    transform 180ms ease,
    background 180ms ease;
}

.send-button:hover {
  transform: translateY(-1px);
  background: #1b3b2e;
}

.send-button svg {
  width: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.composer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 12px;
}

.talk-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 11px;
  min-width: 190px;
  padding: 8px 16px 8px 9px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: var(--ink);
  color: var(--cream);
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(7, 17, 15, 0.2);
  transition:
    transform 180ms ease,
    background 180ms ease,
    box-shadow 180ms ease;
}

.talk-button:hover {
  transform: translateY(-1px);
  background: #142a22;
  box-shadow: 0 13px 32px rgba(7, 17, 15, 0.26);
}

.talk-button.is-recording {
  background: #6f2d23;
  box-shadow: 0 0 0 5px rgba(255, 118, 88, 0.12);
}

.talk-button.is-live {
  background: #173328;
  box-shadow: 0 0 0 5px rgba(117, 211, 164, 0.08);
}

.talk-button.is-interruptible {
  background: #64332a;
  box-shadow: 0 0 0 5px rgba(255, 118, 88, 0.13);
}

.talk-button.is-interruptible .talk-button-icon {
  background: var(--accent-soft);
}

.talk-button.is-recording .talk-pulse {
  opacity: 1;
  animation: recordPulse 1.45s ease-out infinite;
}

.talk-button-icon {
  display: grid;
  flex: 0 0 37px;
  width: 37px;
  height: 37px;
  place-items: center;
  border-radius: 50%;
  background: var(--acid);
  color: var(--ink);
}

.talk-button.is-recording .talk-button-icon {
  background: var(--accent-soft);
}

.talk-button-icon svg {
  width: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.55;
}

.talk-button-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  text-align: left;
}

.talk-button-copy strong {
  font-size: 11px;
  font-weight: 500;
}

.talk-button-copy small {
  color: rgba(244, 241, 231, 0.5);
  font-size: 8px;
}

.talk-pulse {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(255, 211, 199, 0.32);
  border-radius: inherit;
  opacity: 0;
}

.conversation-note {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  color: #8b938c;
  font-size: 8px;
  text-align: right;
}

.page-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding-top: 14px;
  color: rgba(244, 241, 231, 0.32);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.1em;
}

.knowledge-dialog {
  width: min(660px, calc(100vw - 32px));
  max-height: min(760px, calc(100dvh - 48px));
  padding: 24px;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 35px 110px rgba(0, 0, 0, 0.45);
}

.knowledge-dialog::backdrop {
  background: rgba(2, 9, 7, 0.7);
  backdrop-filter: blur(9px);
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.dialog-head p:last-child {
  margin: 8px 0 0;
  color: #667169;
  font-size: 11px;
}

.dark-icon-button {
  color: #5b675f;
}

.knowledge-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.knowledge-item {
  min-height: 126px;
  padding: 13px;
  border: 1px solid rgba(20, 35, 29, 0.11);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.42);
}

.knowledge-item .item-index {
  color: #8b978f;
  font-family: var(--mono);
  font-size: 8px;
}

.knowledge-item h3 {
  margin: 8px 0 5px;
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 600;
}

.knowledge-item p {
  margin: 0;
  color: #6b756e;
  font-size: 10px;
  line-height: 1.55;
}

.knowledge-slides {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 9px;
}

.slide-thumb {
  position: relative;
  width: 76px;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(15, 45, 58, 0.16);
  border-radius: 6px;
  background: #07131a;
  cursor: pointer;
  transition:
    transform 160ms ease,
    border-color 160ms ease;
}

.slide-thumb:hover {
  border-color: rgba(24, 160, 190, 0.8);
  transform: translateY(-1px);
}

.slide-thumb img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.slide-thumb span {
  position: absolute;
  right: 3px;
  bottom: 2px;
  padding: 1px 3px;
  border-radius: 3px;
  background: rgba(4, 14, 20, 0.76);
  color: #dff8ff;
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.04em;
}

.slide-viewer {
  width: min(1080px, calc(100vw - 32px));
  max-height: calc(100dvh - 40px);
  padding: 18px;
  overflow: auto;
  border: 1px solid rgba(185, 244, 255, 0.18);
  border-radius: 20px;
  background: #07131a;
  color: var(--cream);
  box-shadow: 0 35px 110px rgba(0, 0, 0, 0.58);
}

.slide-viewer::backdrop {
  background: rgba(1, 8, 12, 0.8);
  backdrop-filter: blur(10px);
}

.slide-viewer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 12px;
}

.slide-viewer h2 {
  margin: 5px 0 0;
  font-family: var(--serif);
  font-size: clamp(16px, 2.4vw, 24px);
  font-weight: 600;
}

.slide-viewer img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
  background: #000;
}

.slide-viewer .section-kicker {
  color: rgba(185, 244, 255, 0.55);
}

.dialog-note {
  margin: 17px 0 0;
  color: #8c958e;
  font-size: 9px;
  line-height: 1.6;
}

.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  z-index: 50;
  max-width: min(430px, calc(100vw - 32px));
  padding: 11px 15px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 999px;
  background: rgba(6, 17, 14, 0.92);
  color: var(--cream);
  font-size: 11px;
  line-height: 1.4;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition:
    opacity 220ms ease,
    transform 220ms ease;
  backdrop-filter: blur(16px);
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.is-error {
  border-color: rgba(255, 118, 88, 0.32);
  background: rgba(75, 27, 20, 0.94);
}

@keyframes softPulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.45;
  }
}

@keyframes haloBreathe {
  0%,
  100% {
    transform: scale(0.982);
    opacity: 0.55;
  }
  50% {
    transform: scale(1.018);
    opacity: 1;
  }
}

@keyframes thinkingWave {
  0%,
  100% {
    height: 4px;
  }
  50% {
    height: 15px;
  }
}

@keyframes messageIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes typingBounce {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.45;
  }
  30% {
    transform: translateY(-3px);
    opacity: 1;
  }
}

@keyframes recordPulse {
  0% {
    opacity: 0.7;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(1.16);
  }
}

@media (max-width: 1180px) {
  .main-grid {
    grid-template-columns: minmax(0, 0.92fr) minmax(420px, 1.08fr);
  }

}

@media (max-width: 900px) {
  .app-frame {
    height: auto;
    min-height: auto;
    padding: 18px 14px 14px;
  }

  .main-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    height: auto;
    min-height: auto;
    overflow: visible;
  }

  .portrait-card {
    min-height: 520px;
  }

  .portrait-title {
    max-width: 520px;
  }

  .portrait-title h1 {
    font-size: clamp(44px, 11vw, 72px);
  }

  .chat-panel {
    min-height: 650px;
  }

  .page-footer {
    padding-bottom: 3px;
  }
}

@media (max-width: 620px) {
  .topbar {
    margin-bottom: 12px;
  }

  .system-status {
    display: none;
  }

  .quiet-button {
    padding: 0 9px;
  }

  .quiet-button > span:nth-of-type(1) {
    display: none;
  }

  .portrait-card,
  .chat-panel {
    border-radius: 21px;
  }

  .portrait-card {
    min-height: 560px;
  }

  .avatar-image,
  .avatar-video {
    object-position: 50% 6%;
  }

  .portrait-topline {
    top: 18px;
    right: 17px;
    left: 17px;
    font-size: 7px;
  }

  .portrait-topline-right {
    display: none;
  }

  .portrait-sideword {
    display: none;
  }

  .portrait-title {
    right: 18px;
    bottom: 21px;
    left: 18px;
  }

  .portrait-title h1 {
    font-size: clamp(36px, 11.5vw, 50px);
  }

  .portrait-summary {
    max-width: 310px;
    font-size: 11px;
  }

  .avatar-status {
    display: none;
  }

  .chat-panel {
    min-height: 620px;
  }

  .chat-header {
    padding: 19px 17px 15px;
  }

  .chat-header h2,
  .knowledge-dialog h2 {
    font-size: 23px;
  }

  .wake-toggle span:last-child {
    display: none;
  }

  .wake-toggle {
    width: 34px;
    padding: 0;
    justify-content: center;
  }

  .chat-log {
    padding: 17px 17px 8px;
  }

  .message-avatar {
    display: none;
  }

  .message-body {
    max-width: 100%;
  }

  .user-message .message-body {
    max-width: 92%;
  }

  .quick-prompts {
    padding-right: 17px;
    padding-left: 17px;
  }

  .voice-hint {
    margin-right: 17px;
    margin-left: 17px;
  }

  .composer {
    padding: 0 17px 18px;
  }

  .composer-actions {
    align-items: flex-end;
  }

  .talk-button {
    min-width: 0;
  }

  .talk-button-copy small {
    display: none;
  }

  .conversation-note > span:last-child {
    display: none;
  }

  .knowledge-dialog {
    padding: 19px;
  }

  .knowledge-list {
    grid-template-columns: 1fr;
  }

  .page-footer {
    font-size: 7px;
  }

  .page-footer span:last-child {
    display: none;
  }
}

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