:root {
  color-scheme: light only;
  font-family: Inter, "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  background: #fff;
  color: #111827;
  --ink: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --soft: #f7f7f8;
  --active: #0f766e;
  --recording: #dc2626;
}

html {
  color-scheme: light only;
  background: #fff;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  background: #fff;
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

.view-switch {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 70;
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(14px);
}

.view-switch button {
  min-width: 46px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  color: #6b7280;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
}

.view-switch button.active {
  color: #fff;
  background: #111827;
}

.evil-palette-button {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 90;
  display: block;
  height: 28px;
  min-width: 66px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 999px;
  padding: 0 12px;
  color: #111827;
  background: rgba(241, 245, 249, 0.94);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(14px);
  cursor: pointer;
  font-size: 12px;
  outline: none;
}

.evil-frame {
  position: fixed;
  inset: 0;
  z-index: 10;
  width: 100vw;
  height: 100vh;
  border: 0;
  background: #03040a;
}

.app {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 24px 24px calc(24px + env(safe-area-inset-bottom));
}

.stage {
  width: min(420px, 100%);
  display: grid;
  justify-items: center;
  gap: 24px;
  position: relative;
  z-index: 1;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 24px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 14px;
  transform: translateY(-18px);
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #c7cbd1;
}

.dot.connecting {
  background: #ca8a04;
}

.dot.connected {
  background: var(--active);
}

.dot.recording,
.dot.error {
  background: var(--recording);
}

.orb-shell {
  width: min(310px, 68vw);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  position: relative;
}

.orb-canvas {
  position: absolute;
  inset: -18%;
  width: 136%;
  height: 136%;
  pointer-events: none;
  z-index: 0;
}

.talk-button {
  width: 118px;
  height: 118px;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  z-index: 1;
  background:
    radial-gradient(circle at var(--orb-shine-x, 76%) var(--orb-shine-y, 20%), rgba(255, 255, 255, 0.94), transparent 22%),
    radial-gradient(ellipse at var(--orb-deep-x, 52%) var(--orb-deep-y, 84%), rgba(14, 165, 233, var(--orb-deep-alpha, 0.66)), transparent 45%),
    radial-gradient(ellipse at var(--orb-mist-x, 44%) var(--orb-mist-y, 58%), rgba(147, 197, 253, var(--orb-mist-alpha, 0.42)), transparent 49%),
    radial-gradient(circle at 50% 51%, rgba(248, 250, 252, 0.82), rgba(191, 219, 254, 0.58) 56%, rgba(59, 130, 246, var(--orb-rim-alpha, 0.4)) 100%);
  background-size: 132% 132%, 148% 148%, 136% 136%, 100% 100%;
  background-position: 74% 18%, 48% 86%, 44% 58%, 50% 50%;
  background-repeat: no-repeat;
  color: #fff;
  cursor: pointer;
  box-shadow:
    0 20px 46px rgba(96, 165, 250, 0.22),
    inset 0 0 28px rgba(255, 255, 255, 0.24),
    inset 0 0 0 1px rgba(255, 255, 255, 0.78);
  transition:
    transform 160ms ease,
    box-shadow 220ms ease,
    opacity 160ms ease,
    filter 260ms ease;
  animation: orbCoreFlow var(--orb-core-duration, 14s) ease-in-out infinite;
  touch-action: none;
  user-select: none;
}

.talk-button::before,
.talk-button::after,
.orb-vapor {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
}

.talk-button::before {
  inset: -22%;
  z-index: 1;
  background-image:
    radial-gradient(ellipse at var(--orb-cloud-white-x, 28%) var(--orb-cloud-white-y, 24%), rgba(255, 255, 255, var(--orb-cloud-white, 0.66)), transparent 31%),
    radial-gradient(ellipse at var(--orb-cloud-mist-x, 70%) var(--orb-cloud-mist-y, 38%), rgba(224, 242, 254, var(--orb-cloud-mist, 0.58)), transparent 39%),
    radial-gradient(ellipse at var(--orb-cloud-cyan-x, 44%) var(--orb-cloud-cyan-y, 78%), rgba(186, 230, 253, var(--orb-cloud-cyan, 0.42)), transparent 46%),
    radial-gradient(ellipse at var(--orb-cloud-blue-x, 62%) var(--orb-cloud-blue-y, 88%), rgba(14, 165, 233, var(--orb-cloud-blue, 0.22)), transparent 45%);
  background-size: 118% 118%, 128% 128%, 134% 134%, 126% 126%;
  background-repeat: no-repeat;
  filter: blur(6px) saturate(var(--orb-cloud-saturate, 1));
  mix-blend-mode: normal;
  opacity: var(--orb-cloud-opacity, 0.64);
  transform: translate3d(0, var(--orb-cloud-rise, 0), 0) scale(var(--orb-cloud-scale, 1.06));
  animation: orbCloudFlow var(--orb-cloud-duration, 10.8s) ease-in-out infinite;
  transition: opacity 220ms ease;
  will-change: transform, opacity;
}

.orb-vapor {
  inset: -30%;
  z-index: 1;
  opacity: var(--orb-vapor-opacity, 0.62);
  filter: blur(8px) saturate(var(--orb-cloud-saturate, 1));
  mix-blend-mode: normal;
  will-change: transform, opacity;
}

.orb-vapor-a {
  background:
    radial-gradient(ellipse at var(--orb-vapor-a-x, 34%) var(--orb-vapor-a-y, 32%), rgba(255, 255, 255, 0.8), transparent 30%),
    radial-gradient(ellipse at var(--orb-vapor-a2-x, 50%) var(--orb-vapor-a2-y, 68%), rgba(224, 242, 254, 0.68), transparent 45%),
    radial-gradient(ellipse at 62% 82%, rgba(125, 211, 252, 0.32), transparent 40%);
  animation: orbVaporA var(--orb-vapor-duration, 9.6s) ease-in-out infinite;
}

.orb-vapor-b {
  background:
    radial-gradient(ellipse at var(--orb-vapor-b-x, 62%) var(--orb-vapor-b-y, 38%), rgba(255, 255, 255, 0.64), transparent 30%),
    radial-gradient(ellipse at var(--orb-vapor-b2-x, 36%) var(--orb-vapor-b2-y, 78%), rgba(186, 230, 253, 0.54), transparent 42%),
    radial-gradient(ellipse at 58% 72%, rgba(56, 189, 248, 0.27), transparent 46%);
  opacity: calc(var(--orb-vapor-opacity, 0.56) * 0.78);
  animation: orbVaporB var(--orb-vapor-duration-b, 12.4s) ease-in-out infinite;
}

.talk-button::after {
  z-index: 2;
  background:
    radial-gradient(
      ellipse at var(--orb-cap-x, 38%) var(--orb-cap-y, 23%),
      rgba(255, 255, 255, var(--orb-cap-alpha, 0.62)) 0%,
      rgba(255, 255, 255, calc(var(--orb-cap-alpha, 0.62) * 0.32)) 38%,
      transparent 66%
    ),
    radial-gradient(ellipse at 22% 62%, rgba(96, 165, 250, 0.2), transparent 36%),
    radial-gradient(ellipse at var(--orb-bottom-x, 50%) var(--orb-bottom-y, 92%), rgba(14, 165, 233, var(--orb-bottom-alpha, 0.24)), transparent 42%),
    radial-gradient(circle at 50% 58%, transparent 51%, rgba(37, 99, 235, 0.3) 100%);
  box-shadow:
    inset 10px 12px 24px rgba(255, 255, 255, 0.56),
    inset -12px -18px 30px rgba(37, 99, 235, 0.2),
    inset 0 0 0 1px rgba(255, 255, 255, 0.78);
  opacity: var(--orb-glass-opacity, 0.76);
  transform: translate3d(var(--orb-surface-x, 0), var(--orb-surface-y, 0), 0) scale(var(--orb-surface-scale, 1));
  transition:
    opacity 220ms ease,
    transform 220ms ease;
  will-change: transform, opacity;
}

.talk-button:hover {
  transform: translateY(-1px);
  box-shadow:
    0 22px 54px rgba(96, 165, 250, 0.24),
    inset 0 0 28px rgba(255, 255, 255, 0.28);
}

.talk-button:active {
  transform: scale(0.97);
}

.talk-button.recording {
  transform: scale(0.98);
  filter: saturate(1.05);
  box-shadow:
    0 22px 58px rgba(96, 165, 250, 0.26),
    inset 0 0 34px rgba(255, 255, 255, 0.28);
}

.talk-button.connected {
  filter: saturate(1.02);
}

.talk-button.connecting {
  filter: saturate(0.98);
}

.talk-button.recording::before {
  opacity: var(--orb-cloud-opacity, 0.96);
}

.talk-button.connected::before {
  opacity: var(--orb-cloud-opacity, 0.9);
}

.talk-button.connecting::before {
  opacity: var(--orb-cloud-opacity, 0.76);
}

@keyframes orbCoreFlow {
  0%, 100% {
    background-position: 74% 18%, 48% 86%, 44% 58%, 50% 50%;
  }
  32% {
    background-position: 86% 24%, 60% 76%, 34% 65%, 50% 50%;
  }
  62% {
    background-position: 69% 14%, 42% 92%, 54% 50%, 50% 50%;
  }
  84% {
    background-position: 78% 27%, 52% 82%, 39% 55%, 50% 50%;
  }
}

@keyframes orbCloudFlow {
  0%, 100% {
    background-position: 0% 0%, 78% 12%, 22% 88%, 74% 86%;
    transform: translate3d(calc(var(--orb-tilt-x, 0px) - 7px), calc(var(--orb-tilt-y, 0px) + var(--orb-cloud-rise, 0px) - 4px), 0) scale(var(--orb-cloud-scale, 1.06)) rotate(-7deg);
  }
  34% {
    background-position: 24% 10%, 55% 34%, 44% 70%, 52% 96%;
    transform: translate3d(calc(var(--orb-tilt-x, 0px) + 8px), calc(var(--orb-tilt-y, 0px) + var(--orb-cloud-rise, 0px) + 3px), 0) scale(calc(var(--orb-cloud-scale, 1.06) + 0.045)) rotate(6deg);
  }
  68% {
    background-position: 10% 26%, 92% 18%, 30% 58%, 76% 70%;
    transform: translate3d(calc(var(--orb-tilt-x, 0px) - 2px), calc(var(--orb-tilt-y, 0px) + var(--orb-cloud-rise, 0px) + 7px), 0) scale(calc(var(--orb-cloud-scale, 1.06) + 0.025)) rotate(3deg);
  }
}

@keyframes orbVaporA {
  0%, 100% {
    transform: translate3d(calc(var(--orb-tilt-x, 0px) - 10px), calc(var(--orb-tilt-y, 0px) + var(--orb-cloud-rise, 0px) + 5px), 0) scale(var(--orb-vapor-scale, 1.04)) rotate(-10deg);
  }
  40% {
    transform: translate3d(calc(var(--orb-tilt-x, 0px) + 10px), calc(var(--orb-tilt-y, 0px) + var(--orb-cloud-rise, 0px) - 5px), 0) scale(calc(var(--orb-vapor-scale, 1.04) + 0.075)) rotate(8deg);
  }
  72% {
    transform: translate3d(calc(var(--orb-tilt-x, 0px) + 2px), calc(var(--orb-tilt-y, 0px) + var(--orb-cloud-rise, 0px) + 10px), 0) scale(calc(var(--orb-vapor-scale, 1.04) + 0.03)) rotate(3deg);
  }
}

@keyframes orbVaporB {
  0%, 100% {
    transform: translate3d(calc(var(--orb-tilt-x, 0px) + 9px), calc(var(--orb-tilt-y, 0px) + var(--orb-cloud-rise, 0px) - 4px), 0) scale(var(--orb-vapor-scale-b, 1.08)) rotate(12deg);
  }
  35% {
    transform: translate3d(calc(var(--orb-tilt-x, 0px) - 9px), calc(var(--orb-tilt-y, 0px) + var(--orb-cloud-rise, 0px) + 9px), 0) scale(calc(var(--orb-vapor-scale-b, 1.08) + 0.055)) rotate(-8deg);
  }
  70% {
    transform: translate3d(calc(var(--orb-tilt-x, 0px) + 1px), calc(var(--orb-tilt-y, 0px) + var(--orb-cloud-rise, 0px) - 8px), 0) scale(calc(var(--orb-vapor-scale-b, 1.08) + 0.03)) rotate(5deg);
  }
}

.talk-button:disabled {
  cursor: wait;
  opacity: 0.64;
}

.activation {
  display: grid;
  justify-items: center;
  gap: 6px;
  min-height: 86px;
  color: #4b5563;
  font-size: 13px;
}

.activation strong {
  color: var(--ink);
  font-size: 40px;
  line-height: 1;
  letter-spacing: 0.1em;
}

.activation small {
  color: var(--muted);
}

.activation a {
  color: var(--ink);
  text-underline-offset: 3px;
}

.hidden {
  display: none;
}

.last-message {
  width: min(380px, 100%);
  min-height: 0;
  margin-top: 14px;
  padding: 12px 15px;
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 14px;
  background: rgba(248, 250, 252, 0.92);
  box-shadow:
    0 12px 34px rgba(15, 23, 42, 0.055),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
  color: #374151;
  font-size: 15px;
  line-height: 1.6;
  text-align: left;
  word-break: break-word;
  transform: translateY(12px);
}

.last-message:empty {
  display: none;
}

.text-composer {
  width: min(420px, 100%);
  margin-top: 8px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(203, 213, 225, 0.74);
  border-radius: 14px;
  padding: 5px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(248, 250, 252, 0.9));
  box-shadow:
    0 14px 38px rgba(15, 23, 42, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.78);
  transform: translateY(12px);
  transition:
    border-color 160ms ease,
    box-shadow 180ms ease,
    background 180ms ease;
}

.text-composer.hidden {
  display: none;
}

.chat-editor {
  min-width: 0;
  height: 38px;
  border: 0;
  border-radius: 10px;
  padding: 9px 11px;
  color: var(--ink);
  background: transparent;
  overflow: hidden;
  line-height: 20px;
  color-scheme: light only;
  white-space: nowrap;
  outline: 0;
  user-select: text;
  -webkit-user-select: text;
}

.text-composer button {
  min-width: 58px;
  height: 38px;
  border: 0;
  border-radius: 10px;
  padding: 0 13px;
  color: #fff;
  background: #111827;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.14);
  transition:
    opacity 160ms ease,
    transform 160ms ease,
    background 160ms ease;
}

.chat-editor:focus {
  outline: 0;
}

.text-composer:focus-within {
  border-color: rgba(125, 211, 252, 0.82);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.94));
  box-shadow:
    0 16px 42px rgba(15, 23, 42, 0.07),
    0 0 0 3px rgba(125, 211, 252, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.84);
}

.text-composer button:active {
  transform: scale(0.97);
}

.text-composer button:disabled {
  cursor: default;
  opacity: 0.46;
  box-shadow: none;
}

.settings {
  position: fixed;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  width: min(360px, calc(100vw - 32px));
  color: var(--muted);
  font-size: 12px;
  z-index: 20;
}

.settings summary {
  width: max-content;
  margin-left: auto;
  padding: 7px 10px;
  border-radius: 8px;
  color: #7b8492;
  cursor: pointer;
  list-style: none;
}

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

.settings summary:hover {
  background: var(--soft);
  color: #4b5563;
}

.settings[open] {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color-scheme: light only;
  box-shadow: 0 16px 36px rgba(17, 24, 39, 0.1);
}

.settings[open] summary {
  margin-bottom: 8px;
}

.settings fieldset {
  margin: 0 0 10px;
  padding: 0;
  border: 0;
}

.settings legend,
.settings label > span {
  display: block;
  margin-bottom: 6px;
  color: #4b5563;
}

.mode-control {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.settings .mode-control label {
  position: relative;
  display: block;
  margin: 0;
}

.settings .mode-control input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.settings .mode-control label > span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  width: 100%;
  margin: 0;
  border-radius: 6px;
  color: #6b7280;
  cursor: pointer;
  line-height: 1;
}

.settings .mode-control input:checked + span {
  color: var(--ink);
  background: #fff;
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.08);
}

.settings label,
.settings-field {
  display: grid;
  gap: 0;
  margin-top: 10px;
}

.settings label.hidden {
  display: none;
}

.field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.settings .field-row label {
  display: block;
  margin: 0;
  color: #4b5563;
}

.settings input[type="text"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 9px;
  color: var(--ink);
  background: #fff;
  -webkit-text-fill-color: var(--ink);
  color-scheme: light only;
}

#identityCodeInput {
  -webkit-text-security: disc;
  text-security: disc;
}

.settings input[type="text"]:focus {
  outline: 2px solid rgba(15, 118, 110, 0.18);
  border-color: rgba(15, 118, 110, 0.55);
}

.toggle-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.settings .toggle-row > span {
  margin: 0;
}

.toggle-row input[type="checkbox"] {
  width: 38px;
  height: 22px;
  margin: 0;
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #e5e7eb;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease;
  position: relative;
}

.toggle-row input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.16);
  transition: transform 160ms ease;
}

.toggle-row input[type="checkbox"]:checked {
  border-color: rgba(15, 118, 110, 0.4);
  background: var(--active);
}

.toggle-row input[type="checkbox"]:checked::after {
  transform: translateX(16px);
}

.settings-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.settings button {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  color: #374151;
  background: #fff;
  cursor: pointer;
}

.settings-actions button {
  margin-top: 0;
}

.settings button:disabled {
  cursor: default;
  color: #9ca3af;
  background: #f9fafb;
}

.settings button:hover {
  background: var(--soft);
}

.settings button:disabled:hover {
  background: #f9fafb;
}

.settings .subtle-action {
  min-height: auto;
  margin: 0;
  border: 0;
  padding: 0;
  color: #b3bac5;
  background: transparent;
  font-size: 12px;
  cursor: pointer;
}

.settings .subtle-action:hover {
  color: #9ca3af;
  background: transparent;
}

.create-account-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 8px;
}

.create-account-panel.hidden {
  display: none;
}

.create-account-panel input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 9px;
  color: var(--ink);
  background: #fff;
}

.create-account-panel button {
  margin-top: 0;
}

.settings-state {
  margin-left: auto;
  color: #9ca3af;
}

.settings-state.dirty {
  color: #ca8a04;
}

.settings-state.saved {
  color: var(--active);
}

.ws-url {
  display: none;
  margin: 10px 0 0;
  overflow-wrap: anywhere;
  color: #9ca3af;
}

.icp-footer {
  position: fixed;
  left: 16px;
  bottom: calc(13px + env(safe-area-inset-bottom));
  z-index: 2;
  font-size: 12px;
  line-height: 1;
}

.icp-footer a {
  color: #9ca3af;
  text-decoration: none;
}

.icp-footer a:hover {
  color: #6b7280;
}

@keyframes caret-blink {
  0%,
  48% {
    opacity: 1;
  }

  49%,
  100% {
    opacity: 0;
  }
}

@media (max-width: 560px) {
  .app {
    padding: 18px 18px calc(92px + env(safe-area-inset-bottom));
  }

  .stage {
    gap: 18px;
    transform: none;
  }

  .orb-shell {
    width: 184px;
    aspect-ratio: 1;
    margin: 0;
  }

  .status {
    margin-bottom: 0;
    transform: none;
  }

  .orb-canvas {
    inset: -12%;
    width: 124%;
    height: 124%;
  }

  .talk-button {
    width: 104px;
    height: 104px;
  }

  .last-message {
    width: min(352px, calc(100vw - 48px));
    margin-top: 4px;
    padding: 12px 14px;
    font-size: 14px;
    line-height: 1.55;
    transform: none;
  }

  .text-composer {
    margin-top: 0;
    transform: none;
    width: min(352px, calc(100vw - 48px));
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 5px;
    padding: 5px;
  }

  .chat-editor,
  .text-composer button {
    height: 40px;
  }

  .text-composer button {
    min-width: 56px;
    padding: 0 11px;
  }

  .settings {
    right: 18px;
    bottom: calc(13px + env(safe-area-inset-bottom));
  }

  .settings:not([open]) {
    width: auto;
    height: 12px;
    line-height: 12px;
  }

  .settings:not([open]) summary {
    display: block;
    padding: 0;
    font-size: 12px;
    line-height: 12px;
    border-radius: 0;
  }

  .icp-footer {
    left: 12px;
    bottom: calc(13px + env(safe-area-inset-bottom));
    max-width: 46vw;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  body.text-input-focused .settings:not([open]) {
    opacity: 0;
    pointer-events: none;
  }

  body.text-input-focused .icp-footer {
    display: none;
  }

  .settings[open] {
    bottom: calc(10px + env(safe-area-inset-bottom));
    max-height: min(76svh, 520px);
    overflow: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .talk-button {
    transition: none;
  }

  .talk-button::before {
    animation: none;
  }

  .orb-vapor {
    animation: none;
  }

}

body.evil-mode {
  background: #03040a;
  color-scheme: dark;
}

body.evil-mode .view-switch {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(5, 8, 18, 0.68);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.38);
  transition:
    background 140ms ease,
    border-color 140ms ease,
    transform 140ms ease;
}

body.evil-mode .view-switch button {
  color: rgba(226, 232, 240, 0.7);
  transition:
    color 140ms ease,
    background 140ms ease,
    transform 140ms ease;
}

body.evil-mode .view-switch button.active {
  color: #0f172a;
  background: #e0f2fe;
}

.evil-palette-button[hidden] {
  display: none;
}

body.evil-mode .evil-palette-button {
  height: 30px;
  min-width: 70px;
  padding: 0 12px;
  border-color: rgba(255, 255, 255, 0.1);
  color: rgba(226, 232, 240, 0.82);
  background: rgba(5, 8, 18, 0.42);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.24);
  font-size: 12px;
  transition:
    color 140ms ease,
    background 140ms ease,
    border-color 140ms ease,
    transform 140ms ease;
}

body.evil-mode .view-switch:active,
body.evil-mode .evil-palette-button:active,
body.evil-mode .settings summary:active {
  transform: scale(0.97);
}

body.evil-mode .evil-palette-button[data-palette="warm-gold"] {
  border-color: rgba(251, 191, 36, 0.18);
  background:
    linear-gradient(90deg, rgba(251, 191, 36, 0.06), rgba(5, 8, 18, 0.42) 64%);
}

body.evil-mode .evil-palette-button[data-palette="ocean-blue"] {
  border-color: rgba(125, 211, 252, 0.16);
  background:
    linear-gradient(90deg, rgba(56, 189, 248, 0.06), rgba(5, 8, 18, 0.42) 64%);
}

body.evil-mode .evil-control-pulse {
  animation: evilControlPulse 220ms ease-out;
}

body.evil-mode .app {
  display: grid !important;
  position: fixed;
  inset: 0;
  z-index: 20;
  min-height: 100vh;
  min-height: 100svh;
  padding: 64px 24px calc(28px + env(safe-area-inset-bottom));
  background: transparent;
  color: rgba(226, 232, 240, 0.9);
  pointer-events: none;
}

body.evil-mode .stage {
  position: fixed;
  left: 50%;
  bottom: calc(86px + env(safe-area-inset-bottom));
  width: min(420px, calc(100vw - 32px));
  gap: 14px;
  transform: translateX(-50%);
  pointer-events: none;
}

body.evil-mode .status,
body.evil-mode .orb-shell,
body.evil-mode .last-message,
body.evil-mode .text-composer,
body.evil-mode .settings {
  pointer-events: auto;
}

body.evil-mode .status {
  display: none;
}

body.evil-mode .orb-shell {
  width: auto;
  aspect-ratio: auto;
}

body.evil-mode .orb-canvas,
body.evil-mode .orb-vapor {
  display: none;
}

body.evil-mode .talk-button {
  width: 128px;
  height: 44px;
  border-radius: 999px;
  background: rgba(7, 10, 22, 0.16);
  border: 1px solid rgba(148, 163, 184, 0.24);
  box-shadow:
    0 18px 42px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
  animation: none;
}

body.evil-mode .talk-button::before {
  display: block;
  inset: -1px;
  border-radius: inherit;
  background:
    linear-gradient(90deg, rgba(168, 85, 247, 0.28), rgba(56, 189, 248, 0.18)),
    rgba(15, 23, 42, 0.28);
  opacity: 1;
}

body.evil-mode .talk-button::after {
  content: "开始";
  display: grid;
  place-items: center;
  inset: 0;
  border-radius: inherit;
  color: rgba(248, 250, 252, 0.96);
  background: transparent;
  box-shadow: none;
  opacity: 1;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0;
  transform: none;
}

body.evil-mode .talk-button.connected::after {
  content: "继续";
}

body.evil-mode .talk-button.connecting::after {
  content: "连接中";
}

body.evil-mode .talk-button.recording::after {
  content: "停止";
}

body.evil-mode .talk-button.connecting {
  border-color: rgba(125, 211, 252, 0.42);
  background: rgba(14, 116, 144, 0.16);
  box-shadow:
    0 18px 44px rgba(0, 0, 0, 0.34),
    0 0 28px rgba(56, 189, 248, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

body.evil-mode .talk-button.connected {
  background: rgba(15, 23, 42, 0.26);
  border-color: rgba(216, 180, 254, 0.32);
  box-shadow:
    0 18px 46px rgba(0, 0, 0, 0.34),
    0 0 34px rgba(168, 85, 247, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

body.evil-mode .talk-button.recording {
  border-color: rgba(248, 113, 113, 0.42);
  background: rgba(127, 29, 29, 0.16);
  box-shadow:
    0 18px 46px rgba(0, 0, 0, 0.34),
    0 0 34px rgba(248, 113, 113, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

body.evil-mode .last-message {
  width: min(420px, calc(100vw - 32px));
  margin-top: 0;
  transform: none;
  background: rgba(8, 12, 28, 0.58);
  border-color: rgba(226, 232, 240, 0.16);
  color: rgba(241, 245, 249, 0.86);
  box-shadow:
    0 18px 42px rgba(0, 0, 0, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(16px);
}

body.evil-mode.text-input-enabled:not(.message-panel-active) .last-message {
  display: none;
}

body.evil-mode.message-panel-active .last-message {
  cursor: text;
}

body.evil-mode.message-panel-active .text-composer {
  display: none;
}

body.evil-mode .text-composer {
  width: min(420px, calc(100vw - 32px));
  margin-top: 0;
  transform: none;
  border-color: rgba(226, 232, 240, 0.18);
  background: rgba(8, 12, 28, 0.62);
  box-shadow:
    0 18px 46px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(16px);
}

body.evil-mode .chat-editor {
  color: rgba(248, 250, 252, 0.92);
  color-scheme: dark;
}

body.evil-mode .text-composer button {
  color: #0f172a;
  background: #e0e7ff;
  box-shadow: 0 10px 24px rgba(129, 140, 248, 0.18);
}

body.evil-mode .settings {
  display: block !important;
  z-index: 50;
  right: 18px;
  bottom: calc(18px + env(safe-area-inset-bottom));
  color: #e2e8f0;
}

body.evil-mode .settings:not([open]) {
  width: auto;
  height: 28px;
  line-height: 1;
}

body.evil-mode .settings summary {
  display: grid;
  place-items: center;
  min-width: 48px;
  height: 28px;
  margin-left: auto;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  color: rgba(226, 232, 240, 0.74);
  background: rgba(5, 8, 18, 0.34);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(14px);
  font-size: 12px;
  transition:
    color 140ms ease,
    background 140ms ease,
    border-color 140ms ease,
    transform 140ms ease;
}

body.evil-mode .settings[open] {
  border-color: rgba(226, 232, 240, 0.16);
  background: rgba(8, 12, 28, 0.88);
  color: #e5e7eb;
  color-scheme: dark;
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.44);
  backdrop-filter: blur(18px);
}

body.evil-mode .settings legend,
body.evil-mode .settings label > span,
body.evil-mode .settings .toggle-row > span {
  color: #cbd5e1;
}

body.evil-mode .settings .field-row label {
  color: #cbd5e1;
}

body.evil-mode .settings .mode-control {
  border-color: rgba(226, 232, 240, 0.16);
  background: rgba(248, 250, 252, 0.96);
}

body.evil-mode .settings .mode-control label > span {
  color: #475569;
}

body.evil-mode .settings .mode-control input:checked + span {
  color: #0f172a;
  background: #fff;
}

body.evil-mode .settings input[type="text"],
body.evil-mode .create-account-panel input {
  color: #f8fafc;
  -webkit-text-fill-color: #f8fafc;
  caret-color: #f8fafc;
  border-color: rgba(203, 213, 225, 0.28);
  background: rgba(15, 23, 42, 0.88);
  color-scheme: dark;
}

body.evil-mode .settings input[type="text"]::placeholder,
body.evil-mode .create-account-panel input::placeholder {
  color: #94a3b8;
  opacity: 1;
}

body.evil-mode .settings input[type="text"]:-webkit-autofill,
body.evil-mode .create-account-panel input:-webkit-autofill {
  -webkit-text-fill-color: #f8fafc;
  box-shadow: 0 0 0 1000px rgba(15, 23, 42, 0.92) inset;
}

body.evil-mode .settings .subtle-action {
  color: rgba(226, 232, 240, 0.78);
}

body.evil-mode .settings .subtle-action:hover {
  color: rgba(248, 250, 252, 0.94);
}

body.evil-mode .settings-state {
  color: rgba(148, 163, 184, 0.78);
}

body.evil-mode .settings-state.saved {
  color: rgba(45, 212, 191, 0.86);
}

body.evil-mode .icp-footer {
  display: none;
}

@keyframes evilControlPulse {
  0% {
    filter: brightness(1);
  }

  45% {
    filter: brightness(1.22) saturate(1.12);
  }

  100% {
    filter: brightness(1);
  }
}

@media (max-width: 560px) {
  body.evil-mode .stage {
    bottom: calc(78px + env(safe-area-inset-bottom));
    width: min(352px, calc(100vw - 32px));
    gap: 12px;
  }

  body.evil-mode .status {
    transform: none;
  }
}
