:root {
  color-scheme: dark;
  --bg: #07090d;
  --panel: rgba(12, 18, 27, 0.82);
  --panel-strong: rgba(15, 24, 35, 0.94);
  --line: rgba(194, 164, 104, 0.32);
  --line-cool: rgba(84, 220, 255, 0.22);
  --gold: #d7b46a;
  --cyan: #65d7f5;
  --text: #f5f7fb;
  --muted: #aab4c2;
  --dark: #0b111a;
  --danger: #ff8b8b;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #020407;
  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  display: grid;
  grid-template-columns: minmax(320px, 1fr);
  gap: 24px;
  min-height: 100vh;
  padding: 0;
}

.visual-shell {
  padding: 0;
}

.brand-panel {
  position: relative;
  overflow: hidden;
  border: 0;
  background: #020407;
  box-shadow: none;
}

.brand-panel {
  min-height: 100vh;
}

.compact-brand {
  min-width: 0;
}

.brand-video,
.brand-image {
  position: absolute;
  left: 50%;
  top: 50%;
  max-width: none;
  object-fit: contain;
  transform: translate(-50%, -50%);
}

.brand-video {
  width: min(100vw, 150vh);
  height: 100%;
}

.brand-image {
  width: min(54vw, 720px);
  height: auto;
  filter: drop-shadow(0 24px 80px rgba(82, 160, 255, 0.28));
}

.brand-overlay {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 54% 50%, transparent 0, transparent 28%, rgba(2, 4, 7, 0.24) 47%, rgba(2, 4, 7, 0.9) 78%),
    linear-gradient(90deg, rgba(2, 4, 7, 0.92), rgba(2, 4, 7, 0.28) 34%, transparent 52%, rgba(2, 4, 7, 0.78) 100%),
    linear-gradient(180deg, rgba(2, 4, 7, 0.76), transparent 18%, transparent 72%, rgba(2, 4, 7, 0.82));
  pointer-events: none;
}

.interactive-brand {
  border: 0;
}

.brand-status {
  position: absolute;
  left: clamp(28px, 4vw, 80px);
  top: clamp(28px, 4vw, 72px);
  z-index: 2;
  display: grid;
  gap: 14px;
  max-width: min(520px, 38vw);
}

.brand-status h1 {
  margin: 0;
  max-width: none;
  font-size: clamp(2.25rem, 4.2vw, 5.25rem);
  line-height: 0.98;
  text-wrap: balance;
  text-shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
}

.floating-settings {
  position: absolute;
  top: clamp(20px, 3vw, 42px);
  right: clamp(20px, 3vw, 42px);
  z-index: 3;
}

.ambient-frame {
  position: absolute;
  inset: clamp(14px, 1.8vw, 34px);
  z-index: 1;
  border: 1px solid rgba(215, 180, 106, 0.22);
  pointer-events: none;
}

.conversation-panel {
  position: absolute;
  right: clamp(28px, 4vw, 80px);
  bottom: clamp(28px, 4vw, 72px);
  z-index: 4;
  width: min(520px, 36vw);
  max-height: min(48vh, 520px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border: 1px solid rgba(101, 215, 245, 0.22);
  background: rgba(5, 10, 16, 0.72);
  backdrop-filter: blur(14px);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
}

.conversation-header {
  padding: 12px 14px;
  color: var(--gold);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.conversation-log {
  min-height: 0;
  overflow-y: auto;
  padding: 14px;
  display: grid;
  gap: 12px;
}

.message {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.045);
}

.message.user {
  border-color: rgba(101, 215, 245, 0.3);
  background: rgba(28, 134, 170, 0.13);
}

.message.assistant {
  border-color: rgba(215, 180, 106, 0.28);
  background: rgba(215, 180, 106, 0.09);
}

.message.error {
  border-color: rgba(255, 139, 139, 0.36);
  background: rgba(255, 139, 139, 0.1);
}

.message-label {
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.message-en {
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.45;
}

.message-zh {
  color: rgba(245, 247, 251, 0.78);
  font-size: 0.86rem;
  line-height: 1.55;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 6px;
}

.eyebrow,
.demo-kicker,
.section-label {
  display: block;
  color: var(--gold);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  margin-top: 14px;
  max-width: 12ch;
  font-size: clamp(3rem, 7vw, 5.5rem);
  line-height: 0.94;
  letter-spacing: 0;
}

.topbar,
.demo-header,
.actions,
.composer {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar {
  justify-content: space-between;
  margin-bottom: 24px;
}

.topbar h2 {
  margin-top: 6px;
  font-size: clamp(1.8rem, 4vw, 3.4rem);
  letter-spacing: 0;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.segmented {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
}

.segment,
.ghost-button,
.send-button,
.icon-button {
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.segment {
  min-width: 72px;
  min-height: 36px;
  padding: 0 14px;
}

.segment.active,
.send-button {
  border-color: rgba(215, 180, 106, 0.72);
  background: rgba(215, 180, 106, 0.18);
  color: #ffe7ae;
}

.demo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: auto;
  margin-bottom: auto;
}

.demo-card {
  min-height: 260px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 14px;
  padding: 22px;
  text-align: left;
  color: var(--text);
  border: 1px solid var(--line);
  background:
    linear-gradient(140deg, rgba(215, 180, 106, 0.16), transparent 46%),
    linear-gradient(180deg, rgba(101, 215, 245, 0.08), rgba(255, 255, 255, 0.03));
}

.demo-card.compact {
  min-height: 128px;
  padding: 16px;
}

.demo-card.active {
  border-color: var(--cyan);
  background:
    linear-gradient(140deg, rgba(101, 215, 245, 0.15), transparent 46%),
    linear-gradient(180deg, rgba(215, 180, 106, 0.1), rgba(255, 255, 255, 0.04));
}

.demo-card strong {
  font-size: 1.45rem;
  line-height: 1.15;
}

.demo-card span:last-child {
  color: var(--muted);
  line-height: 1.55;
}

.demo-card:hover,
.segment:hover,
.ghost-button:hover,
.send-button:hover,
.icon-button:hover,
.mic-button:hover {
  transform: translateY(-1px);
  border-color: var(--cyan);
}

.hidden {
  display: none !important;
}

.chat-view {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  gap: 18px;
}

.icon-button {
  width: 42px;
  height: 42px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  font-size: 2rem;
}

.status {
  width: max-content;
  min-width: 128px;
  padding: 10px 18px;
  color: var(--cyan);
  border: 1px solid var(--line-cool);
  background: rgba(5, 21, 30, 0.54);
  backdrop-filter: blur(8px);
  font-weight: 700;
}

.notice {
  max-width: min(560px, 42vw);
  min-height: 1.4em;
  color: rgba(245, 247, 251, 0.72);
  font-size: clamp(0.95rem, 1.1vw, 1.15rem);
  line-height: 1.5;
  text-shadow: 0 8px 24px rgba(0, 0, 0, 0.75);
}

.start-experience {
  position: absolute;
  left: 50%;
  bottom: clamp(34px, 5vw, 72px);
  z-index: 9;
  min-height: 58px;
  padding: 0 28px;
  transform: translateX(-50%);
  border: 1px solid rgba(215, 180, 106, 0.72);
  background: rgba(13, 18, 28, 0.78);
  color: #ffe7ae;
  font-weight: 800;
  backdrop-filter: blur(12px);
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.42);
}

.start-experience:hover {
  border-color: var(--cyan);
}

.listening-image {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 8;
  width: min(22vw, 260px);
  height: auto;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 18px 48px rgba(44, 139, 255, 0.35));
  pointer-events: none;
}

.settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(3, 6, 10, 0.72);
  backdrop-filter: blur(10px);
}

.settings-panel {
  width: min(760px, 100%);
  border: 1px solid var(--line);
  background: rgba(11, 17, 26, 0.97);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  padding: 22px;
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}

.settings-header h3 {
  margin: 0;
  font-size: 1.45rem;
}

.settings-group {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.settings-note {
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.voice-test-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 72% 12%, rgba(101, 215, 245, 0.18), transparent 32%),
    linear-gradient(135deg, #05070b 0%, #0b111a 48%, #05070b 100%);
}

.voice-test-shell {
  width: min(1220px, calc(100vw - 48px));
  margin: 0 auto;
  padding: 48px 0;
  display: grid;
  gap: 28px;
}

.voice-test-header {
  position: relative;
  display: grid;
  gap: 10px;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(215, 180, 106, 0.24);
}

.voice-test-header h1 {
  margin: 0;
  font-size: clamp(2.5rem, 5vw, 5rem);
  line-height: 0.96;
}

.voice-test-header p {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.55;
}

.voice-back-link {
  position: absolute;
  right: 0;
  top: 0;
  padding: 12px 16px;
  border: 1px solid rgba(101, 215, 245, 0.28);
  color: var(--cyan);
  text-decoration: none;
  background: rgba(101, 215, 245, 0.08);
}

.voice-console {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(360px, 0.86fr);
  gap: 22px;
}

.voice-grid,
.voice-workbench {
  border: 1px solid rgba(215, 180, 106, 0.22);
  background: rgba(7, 11, 17, 0.74);
  backdrop-filter: blur(16px);
}

.voice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
}

.voice-card {
  min-height: 118px;
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
  text-align: left;
}

.voice-card:hover,
.voice-card.active {
  border-color: rgba(101, 215, 245, 0.72);
  background: rgba(101, 215, 245, 0.12);
}

.voice-card strong {
  font-size: 1.15rem;
}

.voice-card span {
  color: var(--gold);
  font-size: 0.92rem;
}

.voice-card small {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

.voice-workbench {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.selected-voice {
  display: grid;
  gap: 6px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.selected-voice strong {
  font-size: 2rem;
}

.selected-voice span:last-child {
  color: var(--muted);
}

.voice-script-label {
  color: var(--gold);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

#sampleText {
  width: 100%;
  resize: vertical;
  min-height: 180px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font: inherit;
  line-height: 1.5;
}

.voice-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.primary-button,
.secondary-button {
  min-height: 48px;
  padding: 0 18px;
  border: 1px solid rgba(215, 180, 106, 0.6);
  color: #ffe7ae;
  background: rgba(101, 78, 30, 0.58);
  font-weight: 800;
}

.secondary-button {
  border-color: rgba(255, 255, 255, 0.16);
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
}

.primary-button:disabled,
.secondary-button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.voice-status {
  color: var(--cyan);
  font-weight: 700;
}

#voiceAudio {
  width: 100%;
}

@media (max-width: 980px) {
  .brand-video {
    width: 140vw;
  }

  .brand-image {
    width: min(72vw, 620px);
  }

  .brand-status {
    max-width: min(560px, 70vw);
  }

  .conversation-panel {
    width: min(460px, 44vw);
  }
}

@media (max-width: 640px) {
  .shell {
    padding: 12px;
    gap: 12px;
  }

  .topbar,
  .demo-header,
  .composer,
  .actions {
    flex-wrap: wrap;
  }

  .brand-status {
    left: 22px;
    right: 22px;
    max-width: none;
  }

  .conversation-panel {
    left: 22px;
    right: 22px;
    bottom: 22px;
    width: auto;
    max-height: 36vh;
  }

  .notice {
    max-width: none;
  }

  .brand-status h1 {
    font-size: clamp(2rem, 13vw, 3.4rem);
  }

  .listening-image {
    width: min(44vw, 220px);
  }

  .brand-image {
    width: min(84vw, 420px);
  }

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

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

  .voice-test-shell {
    width: min(100vw - 28px, 1220px);
    padding: 24px 0;
  }

  .voice-back-link {
    position: static;
    width: fit-content;
  }

  .voice-console,
  .voice-grid {
    grid-template-columns: 1fr;
  }

  .demo-card {
    min-height: 190px;
  }

  .segmented,
  #textInput,
  .send-button,
  .mic-button,
  .ghost-button {
    width: 100%;
  }

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