:root {
  --bg-0: #04070a;
  --bg-1: #07111a;
  --bg-2: #0a1a22;
  --panel: rgba(14, 30, 38, 0.62);
  --panel-strong: rgba(16, 38, 48, 0.86);
  --line: rgba(108, 242, 192, 0.22);
  --line-strong: rgba(108, 242, 192, 0.5);
  --accent: #6cf2c0;
  --accent-deep: #2bbf95;
  --accent-glow: rgba(108, 242, 192, 0.55);
  --gold: #ffc55a;
  --gold-glow: rgba(255, 197, 90, 0.5);
  --muted: #8fb0ad;
  --text: #eafaf4;
  --shadow: rgba(0, 0, 0, 0.46);
  color-scheme: dark;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg-0);
}

button, input, textarea { font: inherit; }

body { display: grid; place-items: center; }

.screen {
  position: relative;
  width: min(100vw, 1280px);
  height: min(100vh, 800px);
  min-width: 1024px;
  min-height: 640px;
  display: grid;
  grid-template-columns: 320px 1fr 320px;
  gap: 40px;
  padding: 28px;
  color: var(--text);
  background:
    radial-gradient(ellipse at 50% 38%, rgba(60, 220, 180, 0.16), transparent 30%),
    radial-gradient(ellipse at 50% 96%, rgba(30, 90, 120, 0.22), transparent 40%),
    linear-gradient(170deg, #061018 0%, #04090d 50%, #050d12 100%);
  overflow: hidden;
}

/* subtle grid texture */
.screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(108, 242, 192, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(108, 242, 192, 0.022) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at center, black, transparent 80%);
  pointer-events: none;
}

.screen::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 12% 18%, rgba(108, 242, 192, 0.05), transparent 22%),
    radial-gradient(circle at 88% 82%, rgba(255, 197, 90, 0.04), transparent 24%);
  pointer-events: none;
}

.side, .stage {
  position: relative;
  z-index: 1;
  min-height: 0;
}

.side {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 24px 70px var(--shadow);
  padding: 24px 22px;
  height: 744px;
}

/* ---------- left: transcript ---------- */

.status-card {
  height: 54px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  border: 1px solid rgba(108, 242, 192, 0.4);
  border-radius: 12px;
  background: rgba(12, 42, 40, 0.78);
  color: rgba(234, 250, 244, 0.86);
  font-size: 19px;
  font-weight: 800;
}

.pulse-dot {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 16px var(--accent-glow);
  opacity: 0.34;
}

.screen.is-listening .pulse-dot,
.screen.is-thinking .pulse-dot,
.screen.is-speaking .pulse-dot {
  opacity: 1;
  animation: pulse 1s infinite ease-in-out;
}

.connection-badge {
  margin-left: auto;
  min-width: 76px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(108, 242, 192, 0.28);
  border-radius: 14px;
  color: #8ff0d8;
  background: rgba(10, 44, 42, 0.6);
  font-size: 12px;
  font-weight: 800;
}

.continuous-badge {
  border-color: rgba(255, 197, 90, 0.6);
  color: var(--gold);
  background: rgba(90, 58, 14, 0.62);
  box-shadow: 0 0 16px var(--gold-glow);
}

.transcript-copy { padding-top: 22px; }

.section-label, .reply-header {
  margin: 0;
  color: #9fc6c0;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
}

.recognition-text {
  margin: 12px 0 0;
  color: rgba(216, 244, 236, 0.6);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.6;
  word-break: break-word;
}

.mini-log {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 22px;
  max-height: 120px;
  overflow: hidden;
  color: rgba(196, 230, 222, 0.5);
  font-size: 13px;
  line-height: 1.7;
}

/* ---------- center stage ---------- */

.stage {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr auto auto auto;
  justify-items: center;
  padding: 16px 8px;
}

.brand-row {
  width: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.brand-name, .brand-subtitle { margin: 0; }

.brand-name {
  font-size: 21px;
  font-weight: 900;
  letter-spacing: 0.5px;
}

.brand-subtitle {
  margin-top: 6px;
  color: rgba(160, 204, 196, 0.66);
  font-size: 13px;
  font-weight: 700;
}

/* the big circular interaction zone */
.orb-zone {
  position: relative;
  width: 440px;
  height: 440px;
  display: grid;
  place-items: center;
  align-self: center;
}

.orb {
  position: relative;
  width: 260px;
  height: 260px;
  display: grid;
  place-items: center;
}

.orb-glow {
  position: absolute;
  inset: -40px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(108, 242, 192, 0.32), transparent 68%);
  filter: blur(8px);
  transition: background 0.5s ease;
}

.orb-ring {
  position: absolute;
  border-radius: 999px;
  border: 1px solid rgba(108, 242, 192, 0.3);
}

.orb-ring-outer {
  width: 260px;
  height: 260px;
}

.orb-ring-mid {
  width: 200px;
  height: 200px;
  border-color: rgba(108, 242, 192, 0.22);
}

.orb-core {
  position: relative;
  width: 168px;
  height: 168px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 32% 26%, rgba(255, 255, 255, 0.18), transparent 38%),
    radial-gradient(circle at 70% 78%, rgba(108, 242, 192, 0.4), transparent 60%),
    linear-gradient(150deg, rgba(28, 78, 72, 0.92), rgba(8, 26, 30, 0.98));
  border: 1px solid rgba(130, 240, 206, 0.4);
  box-shadow: 0 24px 64px rgba(4, 18, 19, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  display: grid;
  place-items: center;
}

.orb-eye {
  width: 70px;
  height: 70px;
  border-radius: 999px;
  background: radial-gradient(circle at 38% 36%, #ffffff, var(--accent) 55%, var(--accent-deep) 100%);
  box-shadow: 0 0 32px var(--accent-glow), 0 0 80px rgba(108, 242, 192, 0.3);
}

/* wave bars inside core */
.wave-bars {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 34px;
}

.wave-bars span {
  width: 4px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
  height: 8px;
  opacity: 0.5;
}

/* ripples expanding from orb */
.ripple {
  position: absolute;
  border-radius: 999px;
  border: 1px solid rgba(108, 242, 192, 0.28);
  opacity: 0;
}

.ripple-1 { width: 260px; height: 260px; }
.ripple-2 { width: 260px; height: 260px; }
.ripple-3 { width: 260px; height: 260px; }

/* default (idle) core breathing */
.orb-glow { animation: glowBreath 4s infinite ease-in-out; }
.orb-core { animation: coreBreath 4s infinite ease-in-out; }

/* center status text under orb */
.stage-centerline {
  min-height: 30px;
  display: grid;
  place-items: center;
  margin-top: 4px;
}

.centerline-text {
  color: rgba(196, 232, 224, 0.7);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

/* ---------- primary button ---------- */

.primary-action {
  margin-top: 18px;
  margin-bottom: 14px;
  height: 52px;
  min-width: 248px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 0 26px;
  border: 1px solid rgba(108, 242, 192, 0.5);
  border-radius: 999px;
  color: var(--accent);
  background: rgba(10, 56, 52, 0.66);
  box-shadow: 0 16px 42px rgba(108, 242, 192, 0.12);
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.mic-icon {
  width: 14px;
  height: 18px;
  position: relative;
  background: currentColor;
  border-radius: 8px 8px 9px 9px;
}
.mic-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -7px;
  transform: translateX(-50%);
  width: 9px;
  height: 5px;
  border: 2px solid currentColor;
  border-top: 0;
  border-radius: 0 0 9px 9px;
}

.primary-action:hover {
  transform: translateY(-1px);
}

.primary-action.is-active-continuous {
  border-color: rgba(255, 197, 90, 0.72);
  color: var(--gold);
  background: rgba(96, 62, 14, 0.72);
  box-shadow: 0 16px 42px var(--gold-glow);
}

/* ---------- control row ---------- */

.control-row {
  display: flex;
  align-items: center;
  justify-content: center;
}

.control-button, .replay-button {
  height: 46px;
  border: 0;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
  transition: transform 0.18s ease, opacity 0.18s ease, filter 0.18s ease;
}

.control-button {
  min-width: 142px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 20px;
}

.control-resume {
  border: 1px solid rgba(255, 197, 90, 0.42);
  color: var(--gold);
  background: rgba(63, 48, 18, 0.52);
}

.control-button:hover:not(:disabled),
.replay-button:hover:not(:disabled) { transform: translateY(-1px); }

.play-icon {
  display: inline-block;
  width: 0; height: 0; background: transparent;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 10px solid currentColor;
}

/* ---------- right: reply ---------- */

.reply-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.reply-header strong {
  color: #8fc0ff;
  font-size: 13px;
}

.assistant-text {
  margin: 20px 0 0;
  font-size: 23px;
  font-weight: 900;
  line-height: 1.5;
  word-break: break-word;
}

.reply-footer {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: rgba(196, 230, 222, 0.66);
  font-size: 13px;
  font-weight: 800;
}

.replay-button {
  height: 36px;
  min-width: 68px;
  border: 1px solid rgba(108, 242, 192, 0.34);
  color: var(--accent);
  background: rgba(18, 56, 54, 0.84);
}

.replay-button:disabled,
.control-button:disabled,
.primary-action:disabled {
  cursor: not-allowed;
  opacity: 0.42;
  transform: none;
}

/* ---------- state-driven animations ---------- */

/* listening: waves dance + ripples expand */
.screen.is-listening .wave-bars span {
  animation: barDance 0.9s infinite ease-in-out;
}
.screen.is-listening .wave-bars span:nth-child(2) { animation-delay: 0.06s; }
.screen.is-listening .wave-bars span:nth-child(3) { animation-delay: 0.12s; }
.screen.is-listening .wave-bars span:nth-child(4) { animation-delay: 0.18s; }
.screen.is-listening .wave-bars span:nth-child(5) { animation-delay: 0.24s; }
.screen.is-listening .wave-bars span:nth-child(6) { animation-delay: 0.3s; }
.screen.is-listening .wave-bars span:nth-child(7) { animation-delay: 0.36s; }
.screen.is-listening .wave-bars span:nth-child(8) { animation-delay: 0.42s; }
.screen.is-listening .wave-bars span:nth-child(9) { animation-delay: 0.48s; }
.screen.is-listening .wave-bars span:nth-child(10) { animation-delay: 0.54s; }
.screen.is-listening .wave-bars span:nth-child(11) { animation-delay: 0.6s; }
.screen.is-listening .wave-bars span:nth-child(12) { animation-delay: 0.66s; }
.screen.is-listening .wave-bars span:nth-child(13) { animation-delay: 0.72s; }
.screen.is-listening .wave-bars span:nth-child(14) { animation-delay: 0.78s; }
.screen.is-listening .wave-bars span:nth-child(15) { animation-delay: 0.84s; }

.screen.is-listening .ripple {
  animation: rippleOut 2.4s infinite ease-out;
}
.screen.is-listening .ripple-2 { animation-delay: 0.8s; }
.screen.is-listening .ripple-3 { animation-delay: 1.6s; }

.screen.is-listening .orb-eye {
  animation: eyePulse 1s infinite ease-in-out;
}

/* thinking: core floats, glow shifts to blue */
.screen.is-thinking .orb-glow {
  animation: glowBreath 1.8s infinite ease-in-out;
  background: radial-gradient(circle, rgba(120, 170, 255, 0.3), transparent 68%);
}
.screen.is-thinking .orb-core {
  animation: thinkFloat 1.8s infinite ease-in-out;
  border-color: rgba(140, 180, 255, 0.5);
}
.screen.is-thinking .orb-eye {
  background: radial-gradient(circle at 38% 36%, #ffffff, #9fc0ff 55%, #4f7be0 100%);
  box-shadow: 0 0 32px rgba(143, 192, 255, 0.6);
  animation: thinkSpin 2.4s infinite linear;
}
.screen.is-thinking .wave-bars span {
  background: #9fc0ff;
  animation: barDance 0.6s infinite ease-in-out;
}

/* speaking: gold pulse, ripples gold */
.screen.is-speaking .orb-glow {
  background: radial-gradient(circle, rgba(255, 197, 90, 0.3), transparent 68%);
}
.screen.is-speaking .orb-core {
  border-color: rgba(255, 197, 90, 0.5);
}
.screen.is-speaking .orb-eye {
  background: radial-gradient(circle at 38% 36%, #ffffff, var(--gold) 55%, #c98a1a 100%);
  box-shadow: 0 0 32px var(--gold-glow);
  animation: eyePulse 0.8s infinite ease-in-out;
}
.screen.is-speaking .wave-bars span {
  background: var(--gold);
  box-shadow: 0 0 10px var(--gold-glow);
  animation: barDance 0.75s infinite ease-in-out;
}
.screen.is-speaking .ripple {
  border-color: rgba(255, 197, 90, 0.4);
  animation: rippleOut 2.2s infinite ease-out;
}
.screen.is-speaking .ripple-2 { animation-delay: 0.7s; }
.screen.is-speaking .ripple-3 { animation-delay: 1.4s; }

/* ---------- keyframes ---------- */

@keyframes pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 12px var(--accent); }
  50% { transform: scale(1.35); box-shadow: 0 0 26px var(--accent); }
}

@keyframes barDance {
  0%, 100% { transform: scaleY(0.5); opacity: 0.6; }
  45% { transform: scaleY(1.3); opacity: 1; }
}

@keyframes rippleOut {
  0% { transform: scale(1); opacity: 0.5; }
  100% { transform: scale(1.9); opacity: 0; }
}

@keyframes eyePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}

@keyframes glowBreath {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

@keyframes coreBreath {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

@keyframes thinkFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-6px) scale(1.02); }
}

@keyframes thinkSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@media (max-width: 1120px), (max-height: 700px) {
  .screen {
    transform: scale(min(calc(100vw / 1280), calc(100vh / 800)));
    transform-origin: center;
    width: 1280px;
    height: 800px;
  }
}

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