:root {
  color-scheme: light;
  --ink: #17211d;
  --muted: #66736d;
  --paper: #f7f8f4;
  --surface: #ffffff;
  --line: #d8ddd5;
  --mint: #8df0c7;
  --mint-strong: #2aa87c;
  --coral: #ff7d67;
  --blue: #4f7cff;
  --gold: #f5c84c;
  --shadow: 0 18px 50px rgba(23, 33, 29, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    linear-gradient(transparent 23px, rgba(23, 33, 29, 0.04) 24px),
    linear-gradient(90deg, transparent 23px, rgba(23, 33, 29, 0.04) 24px),
    var(--paper);
  background-size: 24px 24px;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell {
  width: min(1180px, calc(100vw - 32px));
  min-height: calc(100vh - 32px);
  margin: 16px auto;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 12px;
}

.topbar,
.askbar,
.source-panel,
.insight-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.topbar {
  min-height: 84px;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.motion-toggle {
  min-height: 38px;
  padding: 6px 10px 6px 7px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 850;
  white-space: nowrap;
}

.motion-toggle__track {
  width: 34px;
  height: 20px;
  padding: 3px;
  border-radius: 999px;
  background: var(--mint-strong);
  transition: 160ms ease;
}

.motion-toggle__thumb {
  width: 14px;
  height: 14px;
  display: block;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 2px 5px rgba(23, 33, 29, 0.18);
  transform: translateX(14px);
  transition: 160ms ease;
}

.motion-toggle[aria-pressed="false"] .motion-toggle__track {
  background: #b8c0ba;
}

.motion-toggle[aria-pressed="false"] .motion-toggle__thumb {
  transform: translateX(0);
}

.eyebrow {
  margin: 5px 0 0;
  color: var(--mint-strong);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(1.45rem, 2vw, 2.15rem);
  line-height: 1.05;
  letter-spacing: 0;
}

.workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(248px, 310px) minmax(0, 1fr);
  gap: 16px;
}

.app-shell.panel-hidden .workspace {
  grid-template-columns: 1fr;
}

.app-shell.panel-hidden .source-panel {
  display: none;
}

.source-panel {
  padding: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.panel-status {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 9px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 99px;
  background: var(--mint-strong);
  box-shadow: 0 0 0 5px rgba(42, 168, 124, 0.14);
}

.source-list {
  max-height: min(44vh, 380px);
  overflow: auto;
  display: grid;
  gap: 10px;
  align-content: start;
  padding-right: 4px;
}

.panel-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  overflow: hidden;
}

.panel-section summary {
  min-height: 48px;
  padding: 9px 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 900;
  cursor: pointer;
  list-style: none;
}

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

.panel-section summary::after {
  content: "+";
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: white;
}

.panel-section[open] summary::after {
  content: "-";
}

.panel-section summary small {
  grid-column: 1 / 2;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.panel-section > .source-tools,
.panel-section > .layer-panel,
.panel-section > .avatar-tools,
.panel-section > .source-list {
  margin: 0 10px 10px;
}

.source-tools,
.avatar-tools {
  display: grid;
  gap: 8px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: #fbfcfa;
}

.avatar-tools {
  cursor: pointer;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

.avatar-tools.is-dragging {
  border-color: var(--mint-strong);
  background: rgba(141, 240, 199, 0.16);
  transform: translateY(-1px);
}

.source-tools label,
.avatar-tools {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.avatar-tools small {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 650;
  line-height: 1.35;
}

.source-tools input,
.avatar-tools input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 10px;
  outline: none;
}

.source-tools input:focus,
.avatar-tools input:focus {
  border-color: var(--mint-strong);
  box-shadow: 0 0 0 4px rgba(42, 168, 124, 0.14);
}

.source-tools button,
.source-action {
  min-height: 36px;
  border: 1px solid var(--ink);
  border-radius: 7px;
  background: var(--ink);
  color: white;
  font-weight: 850;
}

.source-tools button[disabled] {
  opacity: 0.58;
  cursor: wait;
}

#sourceStatus,
#youtubeStatus {
  min-height: 18px;
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.layer-panel {
  display: grid;
  gap: 8px;
}

.layer-card {
  display: grid;
  gap: 3px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.layer-card span {
  color: var(--mint-strong);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.layer-card strong {
  color: var(--ink);
  font-size: 0.88rem;
  line-height: 1.2;
}

.layer-card small {
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.35;
}

.server-banner {
  margin: 0 0 12px;
  padding: 12px;
  border: 1px solid #f0b429;
  border-radius: 8px;
  background: #fff8e8;
  color: var(--ink);
  font-size: 0.82rem;
  line-height: 1.45;
}

.server-banner code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9em;
}

.source-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: white;
}

.warning-card {
  border-color: #f0b429;
  background: #fff8e8;
}

.source-card a {
  color: var(--ink);
  font-weight: 850;
  text-decoration: none;
}

.source-card a:hover {
  color: var(--blue);
}

.source-meta {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.score-pill {
  display: inline-flex;
  align-items: center;
  margin-top: 8px;
  margin-right: 5px;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(79, 124, 255, 0.12);
  color: #234eb8;
  font-size: 0.72rem;
  font-weight: 850;
}

.chunk-pill {
  background: rgba(42, 168, 124, 0.13);
  color: #197557;
}

.source-action {
  margin-top: 8px;
  min-height: 32px;
  padding: 0 9px;
  border-color: var(--line);
  background: white;
  color: var(--ink);
  font-size: 0.78rem;
}

.stage {
  min-height: 500px;
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 112%, rgba(141, 240, 199, 0.48), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(238, 244, 238, 0.86));
}

.insight-card {
  width: min(680px, calc(100% - 40px));
  min-height: 144px;
  align-self: start;
  margin-top: 32px;
  padding: 0;
  position: relative;
  z-index: 2;
  overflow: hidden;
}

.insight-card::before {
  content: "";
  display: block;
  height: 5px;
  background: linear-gradient(90deg, var(--mint-strong), var(--blue), var(--gold));
}

.insight-header {
  min-height: 42px;
  padding: 12px 18px 10px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(216, 221, 213, 0.8);
  background: rgba(247, 248, 244, 0.72);
}

.insight-header span {
  color: var(--mint-strong);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.insight-header small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

#answerText {
  margin: 0;
}

.insight-body {
  padding: 18px 20px 22px;
  font-size: clamp(1rem, 1.25vw, 1.18rem);
  line-height: 1.55;
}

.insight-body strong {
  color: var(--ink);
  font-weight: 900;
}

.insight-body pre {
  margin: 12px 0;
  max-height: 260px;
  overflow: auto;
  border: 1px solid rgba(26, 46, 38, 0.14);
  border-radius: 8px;
  background: #101914;
  color: #e5fff3;
  padding: 14px;
  font-size: 0.86rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

.insight-body code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.pet-wrap {
  align-self: end;
  width: min(520px, 100%);
  height: 360px;
  position: relative;
  display: grid;
  place-items: end center;
}

.pet-shadow {
  position: absolute;
  bottom: 52px;
  width: 164px;
  height: 22px;
  border: 5px solid rgba(18, 24, 23, 0.18);
  border-radius: 4px;
  background: rgba(18, 24, 23, 0.07);
  transform: skewX(-8deg);
}

.thought-code {
  position: absolute;
  top: 26px;
  right: 34px;
  display: grid;
  gap: 8px;
  opacity: 0;
  transform: translateY(8px);
  transition: 180ms ease;
}

.thought-code span {
  width: max-content;
  max-width: min(270px, 54vw);
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  box-shadow: 0 9px 18px rgba(23, 33, 29, 0.08);
}

.pet {
  --outline: #121817;
  --skin: #f4c89a;
  --skin-shadow: #e0a873;
  --hair: #2a2119;
  --hair-light: #4a382b;
  --shirt: #2f3b38;
  --shirt-light: #4a5a56;
  width: 260px;
  height: 260px;
  position: relative;
  image-rendering: pixelated;
  transform-origin: center bottom;
  animation: idle-bob 1.9s steps(2, end) infinite;
  filter: drop-shadow(0 8px 0 rgba(18, 24, 23, 0.1));
  cursor: pointer;
  outline: none;
  transition:
    filter 160ms ease,
    transform 160ms ease;
}

.pixel-pet {
  display: grid;
  place-items: end center;
  --pet-lean: 0deg;
  --pet-shift-x: 0px;
  --pet-shift-y: 0px;
}

.pixel-pet__orbit {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}

.pixel-pet__orbit-item {
  position: absolute;
  font-size: 1.35rem;
  line-height: 1;
  opacity: 0;
  transform: translateY(8px) scale(0.85);
  transition: 220ms ease;
}

.pixel-pet__orbit-brain {
  top: 8px;
  left: 50%;
  margin-left: -0.7rem;
}

.pixel-pet__orbit-spark {
  top: 42px;
  right: 18px;
}

.pixel-pet__orbit-tokens {
  top: 54px;
  left: 16px;
}

.has-custom-avatar .pixel-pet__orbit {
  display: none;
}

.pet:focus-visible {
  filter:
    drop-shadow(0 8px 0 rgba(18, 24, 23, 0.1))
    drop-shadow(0 0 0 rgba(42, 168, 124, 0.7));
}

.pet.is-dragging {
  filter:
    drop-shadow(0 8px 0 rgba(18, 24, 23, 0.1))
    drop-shadow(0 0 16px rgba(42, 168, 124, 0.52));
}

.pixel-pet__stack {
  width: 100%;
  height: 100%;
  position: relative;
  z-index: 2;
  transform:
    translate(var(--pet-shift-x), var(--pet-shift-y))
    rotate(var(--pet-lean));
  transform-origin: center bottom;
  transition: transform 180ms steps(3, end);
}

.pet-image,
.pixel-pet__img,
.pet-layer {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  object-fit: contain;
  mix-blend-mode: normal;
  transform-origin: center bottom;
}

.pet-image,
.pixel-pet__img {
  position: relative;
  z-index: 2;
}

.pet-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.pet-layer--mouth-closed {
  z-index: 3;
  opacity: 0;
}

.pet-layer--mouth-open {
  z-index: 4;
  opacity: 0;
}

.pet-layer--eyes-closed {
  z-index: 5;
  opacity: 0;
}

.pet.is-blinking .pet-layer--eyes-closed {
  opacity: 1;
}

.pet:hover .pixel-pet__orbit-item,
.pet:focus-visible .pixel-pet__orbit-item {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.pet.is-poked .pixel-pet__stack {
  animation: poke-bounce 340ms steps(3, end);
}

.pet-empty-label {
  position: absolute;
  left: 50%;
  bottom: -38px;
  width: max-content;
  max-width: 220px;
  transform: translateX(-50%);
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
  box-shadow: 0 10px 20px rgba(23, 33, 29, 0.08);
}

.has-custom-avatar .pet-empty-label {
  display: none;
}

.has-custom-avatar .pet-image,
.has-custom-avatar .pixel-pet__img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 0;
}

.has-custom-avatar .pet-layer {
  display: none;
}

.pet-head {
  position: absolute;
  left: 34px;
  top: 16px;
  width: 142px;
  height: 132px;
  border: 6px solid var(--outline);
  border-radius: 24px 24px 22px 22px;
  background: var(--skin);
  box-shadow:
    inset -12px -9px 0 rgba(183, 105, 75, 0.18),
    inset 9px 8px 0 rgba(255, 229, 206, 0.28),
    -6px 0 0 var(--outline),
    6px 0 0 var(--outline);
  z-index: 3;
}

.pet-head::before,
.pet-head::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  background: var(--skin);
  border-left: 5px solid var(--outline);
  border-top: 5px solid var(--outline);
}

.pet-head::before {
  left: 9px;
  top: 8px;
}

.pet-head::after {
  right: 9px;
  top: 8px;
  transform: scaleX(-1);
}

.pet-hair {
  position: absolute;
  background: var(--hair);
  border: 5px solid var(--outline);
  z-index: 4;
}

.hair-back {
  left: 30px;
  top: 3px;
  width: 151px;
  height: 78px;
  border-radius: 24px 24px 8px 8px;
  box-shadow: inset 16px 9px 0 var(--hair-light);
}

.hair-front {
  left: -7px;
  top: -13px;
  width: 154px;
  height: 54px;
  border-radius: 22px 22px 8px 8px;
  clip-path: polygon(0 0, 100% 0, 100% 70%, 85% 55%, 73% 78%, 60% 48%, 47% 60%, 36% 92%, 25% 58%, 0 76%);
}

.hair-front::after {
  content: "";
  position: absolute;
  left: 48px;
  top: 25px;
  width: 42px;
  height: 20px;
  border-radius: 0 0 18px 18px;
  background: var(--skin);
}

.ear {
  position: absolute;
  top: 61px;
  width: 22px;
  height: 34px;
  border: 5px solid var(--outline);
  border-radius: 13px;
  background: var(--skin);
  box-shadow: inset -4px -3px 0 rgba(183, 105, 75, 0.16);
  z-index: -1;
}

.ear-left {
  left: -19px;
}

.ear-right {
  right: -19px;
}

.brows,
.eyes,
.cheeks {
  position: absolute;
  display: flex;
  z-index: 6;
}

.brows {
  left: 33px;
  top: 53px;
  gap: 43px;
}

.brows span {
  width: 24px;
  height: 6px;
  border-radius: 99px;
  background: var(--outline);
}

.brows span:first-child {
  transform: rotate(-8deg);
}

.brows span:last-child {
  transform: rotate(8deg);
}

.eyes {
  left: 43px;
  top: 67px;
  gap: 48px;
  z-index: 6;
}

.eyes span {
  width: 9px;
  height: 11px;
  background: var(--outline);
  border-radius: 99px;
  box-shadow: 3px -2px 0 rgba(255, 255, 255, 0.36);
}

.nose {
  position: absolute;
  left: 67px;
  top: 76px;
  width: 10px;
  height: 18px;
  border-right: 4px solid rgba(99, 60, 48, 0.55);
  border-bottom: 4px solid rgba(99, 60, 48, 0.55);
  border-radius: 0 0 9px 0;
  z-index: 5;
}

.stubble {
  position: absolute;
  left: 28px;
  top: 83px;
  width: 88px;
  height: 35px;
  border: 0;
  border-bottom: 10px dotted rgba(55, 43, 38, 0.42);
  border-radius: 0 0 42px 42px;
  opacity: 0.92;
  z-index: 4;
}

.cheeks {
  left: 30px;
  top: 91px;
  gap: 64px;
}

.cheeks span {
  width: 14px;
  height: 8px;
  border-radius: 99px;
  background: rgba(255, 124, 103, 0.32);
}

.mouth {
  position: absolute;
  left: 59px;
  top: 101px;
  width: 31px;
  height: 14px;
  border: 5px solid var(--outline);
  border-top: 0;
  border-radius: 0 0 99px 99px;
  z-index: 5;
  background: #f4d5c4;
}

.pet-body {
  position: absolute;
  left: 39px;
  top: 137px;
  width: 132px;
  height: 86px;
  border: 6px solid var(--outline);
  border-radius: 18px 18px 12px 12px;
  background:
    linear-gradient(135deg, var(--shirt-light) 0 28%, var(--shirt) 28% 100%);
  box-shadow:
    -7px 0 0 rgba(18, 24, 23, 0.08),
    7px 0 0 rgba(18, 24, 23, 0.08);
  z-index: 2;
}

.neck {
  position: absolute;
  left: 43px;
  top: -20px;
  width: 36px;
  height: 25px;
  border: 5px solid var(--outline);
  border-bottom: 0;
  background: var(--skin-shadow);
  z-index: -1;
}

.collar {
  position: absolute;
  left: 35px;
  top: 2px;
  width: 52px;
  height: 20px;
  border-left: 5px solid var(--outline);
  border-right: 5px solid var(--outline);
  border-bottom: 5px solid var(--outline);
  border-radius: 0 0 22px 22px;
  background: #101614;
}

.tee-mark {
  position: absolute;
  left: 53px;
  top: 29px;
  width: 24px;
  height: 24px;
  border: 4px solid var(--mint);
  border-left-color: var(--coral);
  border-bottom-color: var(--gold);
  transform: rotate(45deg);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.04);
}

.tiny-keyboard {
  position: absolute;
  left: 37px;
  top: 58px;
  width: 58px;
  height: 18px;
  border: 4px solid var(--outline);
  border-radius: 4px;
  background: #dfe8df;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.tiny-keyboard span {
  width: 7px;
  height: 5px;
  background: #56645e;
}

.arm {
  position: absolute;
  width: 32px;
  height: 74px;
  border: 6px solid var(--outline);
  border-radius: 16px;
  background: var(--shirt-light);
  top: 8px;
  z-index: -1;
}

.arm-left {
  left: -28px;
  transform: rotate(12deg);
}

.arm-right {
  right: -28px;
  transform: rotate(-15deg);
}

.legs {
  position: absolute;
  left: 68px;
  top: 217px;
  display: flex;
  gap: 23px;
}

.legs span {
  width: 24px;
  height: 32px;
  border: 6px solid var(--outline);
  border-radius: 0 0 12px 12px;
  background: #24302b;
}

.askbar {
  min-height: 72px;
  padding: 10px 12px;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto 52px;
  gap: 10px;
  align-items: center;
}

.icon-button,
.send-button {
  width: 48px;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f4f8f3;
  color: var(--ink);
  display: grid;
  place-items: center;
}

.send-button {
  background: var(--ink);
  color: white;
}

.icon-button[disabled] {
  opacity: 0.46;
  cursor: not-allowed;
}

.icon-button svg,
.send-button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.input-wrap input {
  width: 100%;
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 0 14px;
  outline: none;
}

.input-wrap input:focus {
  border-color: var(--mint-strong);
  box-shadow: 0 0 0 4px rgba(42, 168, 124, 0.14);
}

.voice-controls {
  min-height: 48px;
  display: grid;
  grid-template-columns: auto minmax(150px, 220px) auto;
  gap: 8px;
  align-items: stretch;
}

.mute-button,
.voice-picker select,
.voice-preview-button {
  min-height: 48px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
  background: #fbfcfa;
}

.mute-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 104px;
  color: var(--ink);
}

.mute-button:hover,
.mute-button:focus-visible,
.voice-preview-button:hover,
.voice-preview-button:focus-visible {
  border-color: var(--mint-strong);
  box-shadow: 0 0 0 4px rgba(42, 168, 124, 0.14);
  outline: none;
}

.mute-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.voice-off-icon,
.mute-button.is-muted .voice-on-icon {
  display: none;
}

.mute-button.is-muted {
  background: #fff8e8;
  border-color: #f0b429;
  color: #7a4a00;
}

.mute-button.is-muted .voice-off-icon {
  display: block;
}

.mute-button[disabled] {
  opacity: 0.46;
  cursor: not-allowed;
}

.voice-preview-button {
  color: var(--ink);
}

.voice-preview-button[disabled] {
  opacity: 0.46;
  cursor: not-allowed;
}

.voice-picker select {
  width: 100%;
  color: var(--ink);
  outline: none;
}

.voice-picker select:focus {
  border-color: var(--mint-strong);
  box-shadow: 0 0 0 4px rgba(42, 168, 124, 0.14);
}

.disclaimer {
  margin: 0 2px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.app-shell[data-state="listening"] .pet {
  animation-duration: 1.25s;
}

.app-shell[data-state="listening"] .brows span:first-child {
  transform: rotate(5deg);
}

.app-shell[data-state="listening"] .brows span:last-child {
  transform: rotate(-5deg);
}

.app-shell[data-state="listening"] .pixel-pet__stack {
  animation: pixel-listen-pulse 1.1s ease-in-out infinite;
}

.app-shell[data-state="thinking"] .thought-code {
  opacity: 1;
  transform: translateY(0);
}

.app-shell[data-state="thinking"] .pet {
  animation: think-tilt 1.15s steps(2, end) infinite;
}

.app-shell[data-state="thinking"] .pet-image {
  filter: saturate(0.96) contrast(1.08);
}

.app-shell[data-state="thinking"] .pixel-pet__orbit-item {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.app-shell[data-state="thinking"] .pixel-pet__orbit-brain {
  animation: pixel-orbit-float 1.4s ease-in-out infinite;
}

.app-shell[data-state="thinking"] .pixel-pet__orbit-spark {
  animation: pixel-orbit-float 1.4s ease-in-out infinite 120ms;
}

.app-shell[data-state="thinking"] .pixel-pet__orbit-tokens {
  animation: pixel-orbit-float 1.4s ease-in-out infinite 240ms;
}

.app-shell[data-state="talking"] .pixel-pet__stack {
  animation: talk-nod 520ms steps(2, end) infinite;
}

.app-shell[data-state="talking"] .pet-layer--mouth-open,
.pet.is-speaking .pet-layer--mouth-open {
  animation: mouth-flap 260ms steps(2, end) infinite;
}

@keyframes idle-bob {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-8px);
  }
}

@keyframes think-tilt {
  0%,
  100% {
    transform: translateY(-2px) rotate(-2deg);
  }

  50% {
    transform: translateY(-8px) rotate(2deg);
  }
}

@keyframes talk-mouth {
  0%,
  100% {
    height: 7px;
  }

  50% {
    height: 15px;
    border-top: 4px solid var(--outline);
    border-radius: 10px;
  }
}

@keyframes mouth-flap {
  0%,
  46%,
  100% {
    opacity: 0;
  }

  47%,
  78% {
    opacity: 1;
  }
}

@keyframes talk-nod {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-4px);
  }
}

@keyframes poke-bounce {
  0%,
  100% {
    transform:
      translate(var(--pet-shift-x), var(--pet-shift-y))
      rotate(var(--pet-lean))
      scale(1);
  }

  42% {
    transform:
      translate(var(--pet-shift-x), calc(var(--pet-shift-y) - 10px))
      rotate(0deg)
      scale(1.05, 0.96);
  }

  72% {
    transform:
      translate(var(--pet-shift-x), calc(var(--pet-shift-y) + 4px))
      rotate(var(--pet-lean))
      scale(0.98, 1.03);
  }
}

@keyframes small-wave {
  0%,
  100% {
    transform: rotate(-15deg);
  }

  50% {
    transform: rotate(-31deg) translateY(-4px);
  }
}

@keyframes pixel-orbit-float {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }

  50% {
    transform: translateY(-10px) scale(1.08);
  }
}

@keyframes pixel-listen-pulse {
  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.04);
  }
}

body.motion-disabled .pet,
body.motion-disabled .pixel-pet__stack,
body.motion-disabled .pet-layer--mouth-open,
body.motion-disabled .pixel-pet__orbit-item,
body.motion-disabled .thought-code {
  animation: none !important;
  transition: none !important;
}

body.motion-disabled .pet-layer--mouth-open,
body.motion-disabled .pet-layer--eyes-closed,
body.motion-disabled .pixel-pet__orbit-item {
  opacity: 0 !important;
}

@media (prefers-reduced-motion: reduce) {
  body:not(.motion-enabled) .pet,
  body:not(.motion-enabled) .pixel-pet__stack,
  body:not(.motion-enabled) .pet-layer--mouth-open,
  body:not(.motion-enabled) .pixel-pet__orbit-item,
  body:not(.motion-enabled) .thought-code {
    animation: none !important;
    transition: none !important;
  }

  body:not(.motion-enabled) .pet-layer--mouth-open,
  body:not(.motion-enabled) .pet-layer--eyes-closed,
  body:not(.motion-enabled) .pixel-pet__orbit-item {
    opacity: 0 !important;
  }
}

@media (max-width: 880px) {
  .app-shell {
    width: min(100vw - 20px, 720px);
    min-height: calc(100vh - 20px);
    margin: 10px auto;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .source-panel {
    order: 2;
    max-height: 380px;
  }

  .stage {
    min-height: 520px;
  }

  .askbar {
    grid-template-columns: 44px minmax(0, 1fr) 48px;
  }

  .voice-controls {
    grid-column: 1 / -1;
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .insight-card {
    width: calc(100% - 24px);
    min-height: 174px;
    margin-top: 14px;
  }

  .insight-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
    padding: 10px 14px;
  }

  .insight-body {
    padding: 14px 16px 18px;
  }

  .pet-wrap {
    height: 330px;
    transform: scale(0.88);
    transform-origin: center bottom;
  }
}
