:root {
  color-scheme: dark;
  --ink: #f6f4ff;
  --muted: #a8a3ba;
  --deep: #080510;
  --surface: rgba(17, 11, 31, 0.78);
  --line: rgba(255, 255, 255, 0.11);
  --cyan: #5bf3ff;
  --pink: #ff4fd8;
  --lime: #d6ff5a;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background: var(--deep);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  min-height: 100dvh;
  color: var(--ink);
  overflow: hidden;
}

button {
  font: inherit;
}

.app-shell {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  isolation: isolate;
  background:
    radial-gradient(circle at 50% 20%, rgba(104, 31, 173, 0.26), transparent 37%),
    radial-gradient(circle at 92% 72%, rgba(0, 195, 255, 0.14), transparent 34%),
    var(--deep);
}

.status-bar {
  min-height: 55px;
  padding: calc(env(safe-area-inset-top) + 10px) 18px 10px;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.03em;
}

.status-mark {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #777284;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.05);
  transition: background 180ms ease, box-shadow 180ms ease;
}

body[data-state="listening"] .status-mark,
body[data-state="demo"] .status-mark {
  background: var(--cyan);
  box-shadow: 0 0 0 4px rgba(91, 243, 255, 0.13), 0 0 16px rgba(91, 243, 255, 0.78);
}

body[data-state="speaking"] .status-mark {
  background: var(--pink);
  box-shadow: 0 0 0 4px rgba(255, 79, 216, 0.14), 0 0 19px rgba(255, 79, 216, 0.82);
}

body[data-state="error"] .status-mark {
  background: #ff917a;
}

.icon-button {
  margin-left: auto;
  width: 29px;
  height: 29px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-family: Georgia, serif;
  font-size: 1rem;
}

.visual-stage {
  position: relative;
  min-height: 0;
  overflow: hidden;
}

#faceCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

.visual-copy {
  position: absolute;
  inset: auto 18px 18px;
  pointer-events: none;
  text-align: center;
}

.live-transcript {
  min-height: 1.3em;
  margin: 0;
  color: rgba(246, 244, 255, 0.75);
  font-size: clamp(0.82rem, 3vw, 1rem);
  line-height: 1.4;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.72);
}

.control-panel {
  position: relative;
  padding: 16px 18px calc(env(safe-area-inset-bottom) + 20px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(10, 6, 19, 0.16), rgba(10, 6, 19, 0.78));
  backdrop-filter: blur(16px);
}

.wordmark {
  display: flex;
  align-items: baseline;
  gap: 8px;
  letter-spacing: 0.16em;
}

.wordmark > span {
  font-size: 0.75rem;
  font-weight: 800;
}

.wordmark small {
  color: var(--muted);
  font-size: 0.58rem;
  letter-spacing: 0.09em;
}

.hint {
  min-height: 1.35em;
  margin: 6px 0 14px;
  color: var(--muted);
  font-size: 0.86rem;
}

.controls {
  display: flex;
  gap: 10px;
}

.talk-button {
  min-height: 56px;
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 0;
  border-radius: 18px;
  background: linear-gradient(100deg, #9c50ff, #ff4fd8 52%, #5bf3ff);
  box-shadow: 0 9px 32px rgba(128, 53, 255, 0.28);
  color: #11091d;
  font-weight: 800;
  letter-spacing: 0.01em;
  transition: transform 160ms ease, filter 160ms ease;
}

.talk-button:active {
  transform: scale(0.98);
  filter: brightness(1.12);
}

.talk-symbol {
  position: relative;
  width: 13px;
  height: 19px;
  border: 2px solid currentColor;
  border-radius: 9px;
}

.talk-symbol::after {
  position: absolute;
  top: 14px;
  left: 50%;
  width: 12px;
  height: 7px;
  border: 2px solid currentColor;
  border-top: 0;
  border-radius: 0 0 9px 9px;
  content: "";
  transform: translateX(-50%);
}

.mute-button {
  width: 56px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font-size: 1.45rem;
}

.mute-button[aria-pressed="true"] {
  border-color: rgba(255, 79, 216, 0.65);
  color: var(--pink);
  background: rgba(255, 79, 216, 0.1);
}

.privacy-note {
  margin: 11px 1px 0;
  color: rgba(168, 163, 186, 0.67);
  font-size: 0.68rem;
  line-height: 1.35;
}

dialog {
  width: min(370px, calc(100vw - 38px));
  padding: 28px 22px 21px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 22px;
  background: #171025;
  color: var(--ink);
  box-shadow: 0 24px 100px rgba(0, 0, 0, 0.65);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
}

dialog h2 {
  margin: 0 0 9px;
  font-size: 1.08rem;
  letter-spacing: 0.1em;
}

dialog p {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.dialog-close {
  position: absolute;
  top: 10px;
  right: 13px;
  width: 30px;
  height: 30px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.6rem;
}

.native-settings {
  display: grid;
  gap: 8px;
  margin-top: 17px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
}

.native-settings label {
  color: var(--muted);
  font-size: 0.76rem;
}

.native-settings input {
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: 0;
  background: rgba(0, 0, 0, 0.2);
  color: var(--ink);
  font: inherit;
  font-size: 0.8rem;
}

.native-settings input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(91, 243, 255, 0.1);
}

.native-settings button {
  min-height: 39px;
  border: 0;
  border-radius: 11px;
  background: rgba(91, 243, 255, 0.14);
  color: var(--cyan);
  font-weight: 700;
}

.native-settings small {
  min-height: 1.2em;
  color: var(--muted);
  font-size: 0.7rem;
}

@media (min-width: 700px) {
  .app-shell {
    width: min(500px, 100vw);
    margin: 0 auto;
    border-inline: 1px solid rgba(255, 255, 255, 0.07);
  }
}
