* { box-sizing: border-box; }

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  background: #07090c;
  color: #f2eadb;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.reunion-demo,
.stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

.reunion-demo {
  --keyboard-inset: 0px;
}

.wake-gate {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: max(28px, env(safe-area-inset-top)) 24px max(38px, env(safe-area-inset-bottom));
  color: #f7eddb;
  background:
    radial-gradient(circle at 50% 38%, rgba(88, 93, 105, 0.24), rgba(7, 9, 12, 0) 36%),
    #050608;
  transition:
    opacity 420ms ease,
    visibility 420ms ease;
}

.wake-gate::before,
.wake-gate::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 50%;
  z-index: 1;
  background: #050608;
  transform: translateY(0);
  transition: transform 1600ms cubic-bezier(0.76, 0, 0.24, 1);
}

.wake-gate::before {
  top: 0;
}

.wake-gate::after {
  bottom: 0;
}

.reunion-demo.opening .wake-gate::before {
  transform: translateY(-100%);
}

.reunion-demo.opening .wake-gate::after {
  transform: translateY(100%);
}

.reunion-demo.entered .wake-gate {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.wake-copy {
  position: relative;
  z-index: 2;
  width: min(86vw, 420px);
  min-height: 48px;
  text-align: center;
  font-size: 28px;
  line-height: 1.35;
  letter-spacing: 0.08em;
  text-shadow: 0 0 28px rgba(247, 237, 219, 0.22), 0 3px 18px rgba(0, 0, 0, 0.85);
  transition: opacity 180ms ease, transform 180ms ease;
}

.wake-copy span {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(8px);
  animation: wakeWordCycle 4200ms ease-in-out infinite;
}

.wake-copy span:nth-child(2) {
  animation-delay: 1400ms;
}

.wake-copy span:nth-child(3) {
  animation-delay: 2800ms;
}

.wake-button {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: max(86px, calc(74px + env(safe-area-inset-bottom)));
  width: min(78vw, 260px);
  min-height: 48px;
  border: 1px solid rgba(226,190,116,0.56);
  border-radius: 999px;
  color: #11151b;
  background: rgba(226,190,116,0.94);
  font: inherit;
  font-size: 16px;
  line-height: 1;
  box-shadow: 0 12px 34px rgba(0,0,0,0.36);
  transform: translateX(-50%);
  animation: wakeButtonBreath 2400ms ease-in-out infinite;
  transition:
    opacity 180ms ease,
    transform 180ms ease,
    background 180ms ease,
    border-color 180ms ease;
}

.reunion-demo.opening .wake-copy,
.reunion-demo.opening .wake-button {
  opacity: 0;
  pointer-events: none;
}

.reunion-demo.opening .wake-copy {
  transform: translateY(-8px);
}

.reunion-demo.opening .wake-button {
  animation: none;
  transform: translateX(-50%) scale(0.98);
}

.wake-button:active {
  transform: translateX(-50%) translateY(1px);
}

@keyframes wakeWordCycle {
  0%, 10% {
    opacity: 0;
    transform: translateY(8px);
  }
  18%, 31% {
    opacity: 1;
    transform: translateY(0);
  }
  42%, 100% {
    opacity: 0;
    transform: translateY(-8px);
  }
}

@keyframes wakeButtonBreath {
  0%, 100% {
    transform: translateX(-50%) scale(1);
  }
  50% {
    transform: translateX(-50%) scale(1.06);
  }
}

.stage-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #07090c;
  opacity: 0;
  z-index: 1;
  pointer-events: none;
}

.stage-video.interaction-video {
  transform: scale(1.02);
  transform-origin: center center;
}

.stage-video.interaction-video.no-scale {
  transform: none;
}

.stage-video.priming {
  opacity: 0.001;
  z-index: 2;
}

.video-pool {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.stage-video.active {
  opacity: 1;
  z-index: 3;
}

.shade {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(0,0,0,0.45) 0%, rgba(0,0,0,0) 34%, rgba(0,0,0,0.75) 100%),
    linear-gradient(90deg, rgba(0,0,0,0.25), rgba(0,0,0,0), rgba(0,0,0,0.25));
}

.topbar {
  position: absolute;
  top: calc(max(18px, env(safe-area-inset-top)) + 14px);
  left: 18px;
  right: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  z-index: 5;
  color: rgba(242,234,219,0.9);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-shadow: 0 2px 12px rgba(0,0,0,0.8);
}

.topbar-main-title {
  position: fixed;
  left: 50%;
  top: max(18px, env(safe-area-inset-top));
  margin: 0;
  max-width: 42vw;
  overflow: hidden;
  color: rgba(247,237,219,0.94);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.12em;
  line-height: 1.25;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  transform: translateX(-50%);
  pointer-events: none;
}

.topbar-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-title {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.topbar-version {
  color: rgba(242,234,219,0.62);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.sound-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(242,234,219,0.34);
  border-radius: 50%;
  padding: 0;
  color: #f7eddb;
  background: rgba(16, 19, 25, 0.58);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font: inherit;
  font-size: 18px;
  line-height: 1;
  text-shadow: 0 2px 10px rgba(0,0,0,0.8);
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  transition:
    opacity 160ms ease,
    transform 180ms ease,
    background 180ms ease,
    border-color 180ms ease;
}

.sound-btn.playing {
  color: #11151b;
  background: rgba(226,190,116,0.92);
  border-color: rgba(226,190,116,0.95);
  text-shadow: none;
}

.sound-btn.unavailable {
  opacity: 0.45;
}

.sound-btn:active {
  transform: translateY(1px);
}

.status-pill {
  display: none;
  min-width: 72px;
  text-align: center;
  color: #11151b;
  background: rgba(226,190,116,0.92);
  border-radius: 999px;
  padding: 5px 10px;
  text-shadow: none;
}

.caption {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: calc(78px + env(safe-area-inset-bottom));
  z-index: 5;
  min-height: 1.5em;
  color: #fff4df;
  font-size: 18px;
  line-height: 1.5;
  text-shadow: 0 2px 14px rgba(0,0,0,0.95);
}

.actions {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: calc(max(14px, env(safe-area-inset-bottom)) + var(--keyboard-inset, 0px));
  z-index: 6;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition:
    bottom 220ms ease,
    transform 180ms ease,
    background 180ms ease,
    border-color 180ms ease;
}

.prompt-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.prompt-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: min(52vh, 360px);
  overflow: auto;
  padding: 8px;
  border: 1px solid rgba(226,190,116,0.32);
  border-radius: 8px;
  background: rgba(9, 11, 15, 0.76);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 16px 44px rgba(0,0,0,0.42);
  opacity: 0;
  transform: translateY(8px);
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 160ms ease,
    transform 180ms ease,
    visibility 160ms ease;
}

.actions.open .prompt-list {
  opacity: 1;
  transform: translateY(0);
  visibility: visible;
  pointer-events: auto;
}

.prompt-input {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 48px;
  border: 1px solid rgba(226,190,116,0.48);
  border-radius: 8px;
  padding: 0 44px 0 15px;
  color: rgba(247,237,219,0.9);
  background: rgba(16, 19, 25, 0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font: inherit;
  font-size: 16px;
  line-height: 1.2;
  text-align: left;
  outline: none;
  box-shadow: 0 10px 30px rgba(0,0,0,0.32);
  transition:
    opacity 160ms ease,
    transform 180ms ease,
    background 180ms ease,
    border-color 180ms ease;
}

.send-btn {
  flex: 0 0 48px;
  width: 48px;
  min-height: 48px;
  border: 1px solid rgba(226,190,116,0.58);
  border-radius: 50%;
  color: rgba(226,190,116,0.92);
  background:
    rgba(16, 19, 25, 0.46)
    url("data:image/svg+xml,%3Csvg width='30' height='30' viewBox='0 0 30 30' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cg transform='rotate(-35 15 15)'%3E%3Cpath d='M6.5 7.5L23.5 15L6.5 22.5L10.2 15L6.5 7.5Z' stroke='%23e2be74' stroke-width='2' stroke-linejoin='round'/%3E%3Cpath d='M10.4 15H17.8' stroke='%23e2be74' stroke-width='2' stroke-linecap='round'/%3E%3C/g%3E%3C/svg%3E")
    center / 30px 30px no-repeat;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font: inherit;
  font-size: 0;
  line-height: 0;
  box-shadow: inset 0 0 0 1px rgba(247,237,219,0.08), 0 8px 24px rgba(0,0,0,0.18);
  transition:
    opacity 160ms ease,
    transform 180ms ease,
    background 180ms ease,
    border-color 180ms ease;
}

.voice-btn {
  flex: 0 0 48px;
  width: 48px;
  min-height: 48px;
  position: relative;
  border: 1px solid rgba(226,190,116,0.58);
  border-radius: 50%;
  color: rgba(226,190,116,0.92);
  background: transparent;
  font: inherit;
  font-size: 0;
  box-shadow: inset 0 0 0 1px rgba(247,237,219,0.08), 0 8px 24px rgba(0,0,0,0.18);
  background-image:
    url("data:image/svg+xml,%3Csvg width='30' height='30' viewBox='0 0 30 30' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect x='4.5' y='13' width='2.6' height='7' rx='1.3' fill='%23e2be74' fill-opacity='0.9'/%3E%3Crect x='11.1' y='8' width='2.8' height='17' rx='1.4' fill='%23e2be74' fill-opacity='0.92'/%3E%3Crect x='17.6' y='11' width='2.8' height='11' rx='1.4' fill='%23e2be74' fill-opacity='0.92'/%3E%3Crect x='24.1' y='6' width='2.8' height='21' rx='1.4' fill='%23e2be74' fill-opacity='0.92'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: 30px 30px;
  background-position: center;
}

.voice-btn::before {
  content: none;
}

.voice-btn::after {
  content: none;
}

.prompt-input::after {
  content: "";
  position: absolute;
  right: 16px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 1px solid rgba(247,237,219,0.72);
  border-bottom: 1px solid rgba(247,237,219,0.72);
  transform: translateY(-65%) rotate(45deg);
  transition: transform 180ms ease;
}

.actions.open .prompt-input::after {
  transform: translateY(-35%) rotate(225deg);
}

.prompt-input:disabled {
  opacity: 1;
  color: #f7eddb;
  border-color: rgba(226,190,116,0.92);
  background: rgba(22, 19, 15, 0.88);
}

.send-btn:disabled {
  opacity: 0.58;
}

.prompt-input:disabled::after {
  width: 13px;
  height: 13px;
  border: 2px solid rgba(247,237,219,0.38);
  border-top-color: #f7eddb;
  border-radius: 50%;
  transform: translateY(-50%);
  animation: action-loading 0.72s linear infinite;
}

.prompt-input-label {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.action-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  min-width: 0;
  min-height: 40px;
  border: 1px solid rgba(226,190,116,0.42);
  border-radius: 7px;
  padding: 9px 12px;
  color: #f7eddb;
  background: rgba(16, 19, 25, 0.68);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font: inherit;
  font-size: 14px;
  line-height: 1.2;
  text-align: left;
  overflow-wrap: anywhere;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  transition:
    opacity 160ms ease,
    transform 180ms ease,
    background 180ms ease,
    border-color 180ms ease;
}

.action-btn-label {
  display: block;
}

.action-btn:disabled {
  opacity: 0.54;
}

.actions.busy .prompt-list {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.actions.busy .action-btn {
  opacity: 0.28;
  filter: grayscale(0.7);
}

.action-btn:active {
  transform: translateY(1px);
  background: rgba(226,190,116,0.22);
  border-color: rgba(226,190,116,0.9);
}

.prompt-input:active {
  transform: translateY(1px);
  background: rgba(226,190,116,0.18);
  border-color: rgba(226,190,116,0.86);
}

.send-btn:active {
  transform: translateY(1px);
  background-color: rgba(226,190,116,0.18);
  border-color: rgba(226,190,116,0.86);
}

.voice-btn:active {
  transform: translateY(1px);
  background: rgba(226,190,116,0.18);
  border-color: rgba(226,190,116,0.86);
}

.lead-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(0,0,0,0.62);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 180ms ease, visibility 180ms ease;
}

.lead-modal.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.lead-dialog {
  position: relative;
  width: min(100%, 360px);
  border: 1px solid rgba(226,190,116,0.42);
  border-radius: 10px;
  padding: 22px 18px 18px;
  color: #f7eddb;
  background: rgba(10, 12, 16, 0.94);
  box-shadow: 0 22px 60px rgba(0,0,0,0.58);
}

.lead-dialog h2 {
  margin: 0 34px 10px 0;
  font-size: 19px;
  line-height: 1.25;
}

.lead-copy {
  margin: 0 0 16px;
  color: rgba(247,237,219,0.82);
  font-size: 14px;
  line-height: 1.55;
}

.lead-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(247,237,219,0.22);
  border-radius: 50%;
  color: #f7eddb;
  background: rgba(255,255,255,0.04);
  font: inherit;
  font-size: 0;
  line-height: 0;
}

.lead-close::before,
.lead-close::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 14px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transform-origin: center;
}

.lead-close::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.lead-close::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.lead-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lead-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: rgba(247,237,219,0.72);
  font-size: 12px;
}

.lead-form input {
  width: 100%;
  min-height: 42px;
  border: 1px solid rgba(226,190,116,0.35);
  border-radius: 7px;
  padding: 0 12px;
  color: #f7eddb;
  background: rgba(255,255,255,0.06);
  font: inherit;
  font-size: 16px;
  outline: none;
}

.lead-form input:focus {
  border-color: rgba(226,190,116,0.82);
}

.lead-message {
  min-height: 18px;
  color: rgba(247,237,219,0.74);
  font-size: 12px;
  line-height: 1.4;
}

.lead-message[data-type="error"] {
  color: #ffb0a8;
}

.lead-message[data-type="success"] {
  color: #cdebb5;
}

.lead-submit {
  min-height: 42px;
  border: 1px solid rgba(226,190,116,0.76);
  border-radius: 7px;
  color: #11151b;
  background: rgba(226,190,116,0.92);
  font: inherit;
  font-size: 15px;
}

.lead-submit:disabled {
  opacity: 0.56;
}

.debug-panel {
  position: fixed;
  top: max(78px, env(safe-area-inset-top));
  right: 8px;
  z-index: 80;
  width: min(360px, calc(100vw - 16px));
  max-height: 42vh;
  overflow: auto;
  padding: 8px 10px;
  border: 1px solid rgba(216, 188, 116, 0.42);
  border-radius: 8px;
  background: rgba(6, 8, 10, 0.82);
  color: #f3dfaa;
  font: 11px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  pointer-events: none;
  white-space: normal;
  word-break: break-all;
}

@keyframes action-loading {
  to { transform: translateY(-50%) rotate(360deg); }
}

@media (min-width: 720px) {
  .stage {
    left: 50%;
    width: min(100vw, 460px);
    transform: translateX(-50%);
    background: #07090c;
  }

  .stage::before,
  .stage::after {
    content: "";
    position: fixed;
    top: 0;
    bottom: 0;
    width: calc((100vw - min(100vw, 460px)) / 2);
    background: #07090c;
  }

  .stage::before { right: 100%; }
  .stage::after { left: 100%; }
}

@media (max-width: 360px) {
  .caption {
    bottom: calc(100px + env(safe-area-inset-bottom));
    font-size: 16px;
  }
}
