:root {
  --navy: #202329;
  --blue: #b32632;
  --blue-dark: #8f1f2a;
  --blue-soft: #fff2f3;
  --silver: #c6cad3;
  --page: #f6f5f3;
  --surface: #ffffff;
  --surface-soft: #fbfaf8;
  --line: #dedbd7;
  --line-strong: #cbc7c2;
  --text: #202329;
  --muted: #64666c;
  --faint: #92949a;
  --success: #14845d;
  --danger: #c63b4d;
  --warn: #a66a09;
  --font-body: "Outfit", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", Consolas, monospace;
  --shadow: 0 22px 70px rgba(11, 19, 36, 0.09);
  --shadow-small: 0 10px 30px rgba(11, 19, 36, 0.07);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--page);
  color-scheme: light;
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  background: var(--page);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

svg {
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.ambient-grid {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(11, 19, 36, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(11, 19, 36, 0.025) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, #000, transparent 72%);
}

#app {
  width: min(1380px, calc(100% - 48px));
  min-height: 100dvh;
  margin: 0 auto;
}

.call-header {
  display: flex;
  min-height: 92px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}

.call-brand {
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--muted);
  text-decoration: none;
}

.call-brand img {
  width: 154px;
  height: auto;
}

.call-brand span {
  padding-left: 18px;
  border-left: 1px solid var(--line);
  font-size: 13px;
  font-weight: 500;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.system-status,
.credit-link,
.panel-link,
.live-note {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.credit-link {
  min-width: 142px;
  min-height: 50px;
  padding: 0 15px;
  color: var(--navy);
  text-decoration: none;
  transition:
    border-color 220ms var(--ease),
    background-color 220ms var(--ease),
    transform 220ms var(--ease);
}

.credit-link:hover {
  border-color: rgba(179, 38, 50, 0.34);
  background: #fff;
}

.credit-link:active {
  transform: translateY(1px);
}

.credit-link:focus-visible {
  outline: 3px solid rgba(179, 38, 50, 0.2);
  outline-offset: 3px;
}

.credit-link svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  color: var(--blue);
}

.credit-link__copy {
  display: grid;
  gap: 2px;
  line-height: 1;
}

.credit-link__copy small {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 7px;
  font-weight: 600;
  letter-spacing: 0.14em;
}

.credit-link__copy strong {
  color: var(--navy);
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.03em;
  white-space: nowrap;
}

.credit-link__time {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 6.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.credit-link.is-low {
  border-color: rgba(198, 59, 77, 0.34);
  background: #fff4f5;
}

.credit-link.is-low:hover {
  border-color: rgba(198, 59, 77, 0.5);
  background: #ffedef;
}

.credit-link.is-low svg,
.credit-link.is-low strong,
.credit-link.is-low .credit-link__time {
  color: var(--danger);
}

.credit-link.is-low small {
  color: #9e4653;
}

.system-status {
  padding: 0 15px;
  color: var(--success);
}

.status-dot,
.live-note i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.status-dot {
  animation: status-breathe 2.2s ease-in-out infinite;
}

@keyframes status-breathe {
  50% { opacity: 0.42; transform: scale(0.78); }
}

.panel-link {
  padding: 0 16px;
  color: var(--text);
  text-decoration: none;
  transition: border-color 180ms var(--ease), color 180ms var(--ease), transform 180ms var(--ease);
}

.panel-link svg {
  width: 17px;
  height: 17px;
}

.panel-link:hover {
  border-color: #b9cdf1;
  color: var(--blue-dark);
}

.panel-link:active,
.voice-btn:active,
.sfx-btn:active {
  transform: scale(0.97);
}

.call-main {
  padding: 56px 0 34px;
}

.call-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 34px;
  padding: 0 4px 34px;
  border-bottom: 1px solid var(--line);
}

.eyebrow,
.console-heading,
.voice-label,
.sfx-name,
#footer {
  font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: 0.11em;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--blue);
  font-size: 11px;
}

.call-intro h1 {
  margin: 0;
  font-size: clamp(42px, 5vw, 68px);
  font-weight: 600;
  letter-spacing: -0.05em;
  line-height: 0.98;
}

.call-intro p:last-child {
  max-width: 630px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 18px;
}

.live-note {
  flex: none;
  padding: 0 17px;
  border-color: #cce9dd;
  background: #eef9f4;
  color: var(--success);
}

.call-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(330px, 0.85fr);
  gap: 28px;
  margin-top: 30px;
}

.call-console,
.zebot-stage,
#sfxSection {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow-small);
}

.call-console {
  min-width: 0;
  padding: 28px;
}

.console-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--blue);
  font-size: 11px;
}

.console-step {
  color: var(--faint);
}

#voiceSection {
  padding: 28px 0 24px;
}

.voice-container {
  text-align: center;
}

.waveform {
  display: flex;
  height: 62px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-bottom: 8px;
  opacity: 0.34;
  transition: opacity 220ms var(--ease);
}

.waveform.active {
  opacity: 1;
}

.wave-bar {
  width: 4px;
  height: 8px;
  border-radius: 999px;
  background: var(--blue);
}

.waveform.active .wave-bar {
  animation: wave 640ms ease-in-out infinite alternate;
}

@keyframes wave {
  from { opacity: 0.35; transform: scaleY(0.35); }
  to { opacity: 1; transform: scaleY(4.8); }
}

.wave-bar:nth-child(2n) { animation-delay: 70ms; }
.wave-bar:nth-child(3n) { animation-delay: 140ms; }
.wave-bar:nth-child(4n) { animation-delay: 210ms; }
.wave-bar:nth-child(5n) { animation-delay: 280ms; }

.voice-btn {
  position: relative;
  display: grid;
  width: 104px;
  height: 104px;
  margin: 0 auto;
  place-items: center;
  border: 1px solid #bfd3f8;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  cursor: pointer;
  box-shadow:
    0 14px 35px rgba(179, 38, 50, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.26);
  transition: background-color 180ms var(--ease), border-color 180ms var(--ease), box-shadow 180ms var(--ease), transform 180ms var(--ease);
}

.voice-btn::before {
  position: absolute;
  inset: -10px;
  border: 1px solid #d7e5ff;
  border-radius: inherit;
  content: "";
}

.voice-btn:hover {
  background: var(--blue-dark);
}

.voice-btn:focus-visible,
.sfx-btn:focus-visible,
.panel-link:focus-visible {
  outline: 3px solid rgba(179, 38, 50, 0.25);
  outline-offset: 3px;
}

.voice-btn.listening {
  border-color: #ebbac1;
  background: var(--danger);
  box-shadow: 0 14px 35px rgba(198, 59, 77, 0.2);
}

.voice-btn:disabled {
  cursor: wait;
  opacity: 0.65;
}

.mic-icon,
.stop-icon {
  width: 36px;
  height: 36px;
}

.stop-icon {
  fill: currentColor;
  stroke: none;
}

.hidden {
  display: none !important;
}

.voice-label {
  margin-top: 22px;
  color: var(--muted);
  font-size: 11px;
}

.voice-label.active {
  color: var(--danger);
}

.voice-transcript {
  display: -webkit-box;
  max-width: 520px;
  max-height: 54px;
  margin: 12px auto 0;
  overflow: hidden;
  padding: 8px 12px;
  border: 1px solid #d8e5fb;
  border-radius: 11px;
  background: var(--blue-soft);
  color: var(--blue-dark);
  font-size: 13px;
  line-height: 1.4;
  text-align: left;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.voice-transcript:empty {
  display: none;
}

#chatSection {
  border-top: 1px solid var(--line);
  padding-top: 22px;
}

.chat-container {
  min-height: 136px;
  max-height: 250px;
  overflow-y: auto;
  border-radius: 16px;
  background: var(--surface-soft);
  padding: 18px;
  scroll-behavior: smooth;
}

.chat-welcome {
  display: grid;
  min-height: 100px;
  place-items: center;
  align-content: center;
  color: var(--muted);
  text-align: center;
}

.welcome-mark {
  display: grid;
  width: 36px;
  height: 36px;
  margin-bottom: 10px;
  place-items: center;
  border-radius: 10px;
  background: var(--blue-soft);
  color: var(--blue);
}

.welcome-mark svg {
  width: 20px;
  height: 20px;
}

.chat-welcome p {
  margin: 0;
}

.chat-welcome strong {
  color: var(--text);
}

.welcome-sub {
  margin-top: 3px !important;
  color: var(--faint);
  font-size: 13px;
}

.chat-msg {
  margin-bottom: 13px;
  animation: message-in 260ms var(--ease) both;
}

@keyframes message-in {
  from { opacity: 0; transform: translateY(8px); }
}

.chat-msg.user {
  text-align: right;
}

.chat-sender {
  margin-bottom: 4px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.1em;
}

.chat-bubble {
  display: inline-block;
  max-width: 88%;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  text-align: left;
}

.chat-msg.user .chat-bubble {
  border-color: #d1e1ff;
  background: var(--blue-soft);
}

.chat-msg.system .chat-bubble {
  display: block;
  border-color: #ecd7b1;
  background: #fff8ea;
  color: #75501a;
  text-align: center;
}

.zebot-stage {
  position: relative;
  min-height: 590px;
  overflow: hidden;
  background:
    radial-gradient(circle at 65% 48%, rgba(179, 38, 50, 0.12), transparent 31%),
    linear-gradient(160deg, #f7faff, #fff2f3);
}

.zebot-stage::before,
.zebot-stage::after {
  position: absolute;
  border: 1px solid rgba(179, 38, 50, 0.12);
  border-radius: 50%;
  content: "";
  pointer-events: none;
}

.zebot-stage::before {
  right: -120px;
  bottom: -90px;
  width: 430px;
  height: 430px;
}

.zebot-stage::after {
  right: -30px;
  bottom: 16px;
  width: 250px;
  height: 250px;
}

.zebot-stage .robot-img {
  position: absolute;
  right: 2%;
  bottom: -8%;
  z-index: 2;
  width: 100%;
  max-width: none;
  height: 108%;
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 24px 22px rgba(11, 19, 36, 0.15));
  transform-origin: 60% 80%;
  animation: zebot-float 5.2s ease-in-out infinite;
}

@keyframes zebot-float {
  50% { transform: translateY(-7px) rotate(0.4deg); }
}

.avatar-glow {
  position: absolute;
  right: 13%;
  top: 14%;
  z-index: 1;
  width: 170px;
  height: 170px;
  border: 1px solid rgba(179, 38, 50, 0.18);
  border-radius: 50%;
  animation: stage-ring 4s ease-in-out infinite;
}

@keyframes stage-ring {
  50% { opacity: 0.45; transform: scale(1.08); }
}

.stage-copy {
  position: absolute;
  top: 26px;
  left: 28px;
  z-index: 3;
  display: grid;
}

.stage-copy span {
  color: var(--blue);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
}

.stage-copy strong {
  max-width: 9ch;
  margin-top: 6px;
  color: var(--navy);
  font-size: 22px;
  line-height: 1.08;
}

.status-listening .status-dot,
.status-listening .status-text {
  color: var(--warn);
}

.status-processing .status-dot,
.status-processing .status-text {
  color: var(--blue);
}

.status-speaking .status-dot,
.status-speaking .status-text {
  color: #6e55a1;
}

.status-error .status-dot,
.status-error .status-text {
  color: var(--danger);
}

#sfxSection {
  margin-top: 28px;
  padding: 28px;
}

.section-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 22px;
}

.section-title h2 {
  margin: 0;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.section-title p:last-child {
  margin: 5px 0 0;
  color: var(--muted);
}

.section-title > svg {
  width: 28px;
  height: 28px;
  color: var(--blue);
}

.sfx-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 9px;
}

.sfx-btn {
  display: grid;
  min-width: 0;
  min-height: 82px;
  place-items: center;
  align-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--muted);
  cursor: pointer;
  transition: border-color 180ms var(--ease), background-color 180ms var(--ease), color 180ms var(--ease), transform 180ms var(--ease);
}

.sfx-btn:hover {
  border-color: #bfd3f8;
  background: var(--blue-soft);
  color: var(--blue-dark);
}

.sfx-icon {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
}

.sfx-icon svg {
  width: 24px;
  height: 24px;
}

.sfx-name {
  overflow: hidden;
  width: 100%;
  padding-inline: 4px;
  font-size: 8px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#footer {
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 9px;
}

#footer a {
  color: var(--muted);
  text-decoration: none;
}

@media (max-width: 1100px) {
  .call-layout {
    grid-template-columns: minmax(0, 1fr) 330px;
  }

  .sfx-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  #app {
    width: min(100% - 28px, 720px);
  }

  .call-header {
    min-height: 76px;
  }

  .call-brand span,
  .system-status {
    display: none;
  }

  .call-brand img {
    width: 124px;
  }

  .panel-link {
    min-height: 38px;
  }

  .credit-link {
    min-width: 128px;
    min-height: 46px;
    padding-inline: 12px;
  }

  .call-main {
    padding-top: 34px;
  }

  .call-intro {
    display: block;
  }

  .call-intro h1 {
    font-size: 46px;
  }

  .call-intro p:last-child {
    font-size: 16px;
  }

  .live-note {
    margin-top: 22px;
  }

  .call-layout {
    grid-template-columns: 1fr;
  }

  .zebot-stage {
    min-height: 330px;
  }

  .zebot-stage .robot-img {
    right: 6%;
    bottom: -26%;
    width: 76%;
    height: 124%;
  }

  .avatar-glow {
    right: 17%;
    top: 14%;
    width: 130px;
    height: 130px;
  }
}

@media (max-width: 520px) {
  #app {
    width: min(100% - 20px, 480px);
  }

  .call-header {
    gap: 10px;
  }

  .panel-link {
    padding-inline: 12px;
  }

  .panel-link span {
    display: none;
  }

  .credit-link {
    min-width: 126px;
    gap: 7px;
    padding-inline: 9px;
  }

  .credit-link svg {
    width: 18px;
    height: 18px;
  }

  .credit-link__copy strong {
    font-size: 13px;
  }

  .credit-link__time {
    font-size: 6px;
  }

  .call-intro h1 {
    font-size: 38px;
  }

  .call-console,
  #sfxSection {
    padding: 19px;
    border-radius: 18px;
  }

  .zebot-stage {
    min-height: 290px;
    border-radius: 18px;
  }

  .zebot-stage .robot-img {
    right: 6%;
    width: 80%;
  }

  .stage-copy {
    top: 20px;
    left: 20px;
  }

  .voice-btn {
    width: 92px;
    height: 92px;
  }

  .voice-label {
    font-size: 9px;
    letter-spacing: 0.08em;
  }

  .voice-transcript {
    max-height: 49px;
    padding: 7px 10px;
    font-size: 12px;
  }

  .chat-container {
    padding: 13px;
  }

  .sfx-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  #footer {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
