:root {
  --bg-top: #f6efe6;
  --bg-bottom: #dfe9f3;
  --card: rgba(255, 255, 255, 0.84);
  --card-strong: rgba(255, 255, 255, 0.94);
  --border: rgba(30, 52, 76, 0.12);
  --text: #16324a;
  --muted: #5e6f80;
  --accent: #1d7c78;
  --accent-strong: #0f5d59;
  --accent-soft: rgba(29, 124, 120, 0.12);
  --success: #2f8f63;
  --warning: #b37a1f;
  --error: #a03f3f;
  --shadow: 0 24px 80px rgba(18, 45, 74, 0.14);
  --radius-xl: 30px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Avenir Next", Avenir, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.75), transparent 34%),
    linear-gradient(160deg, var(--bg-top), var(--bg-bottom));
}

body {
  min-height: 100vh;
}

.page-shell {
  width: min(1240px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0 40px;
}

.hero-card {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  gap: 32px;
  align-items: stretch;
  padding: 28px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.portrait-column {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.portrait-frame {
  position: relative;
  overflow: hidden;
  min-height: 480px;
  border-radius: 26px;
  background:
    radial-gradient(circle at 50% 24%, rgba(255, 255, 255, 0.12), transparent 42%),
    linear-gradient(180deg, rgba(58, 64, 74, 0.92), rgba(34, 39, 47, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.65);
}

.portrait-image {
  position: relative;
  z-index: 2;
  display: block;
  width: 100%;
  height: 100%;
  min-height: 480px;
  object-fit: cover;
  object-position: 50% 50%;
  transform: none;
  transform-origin: center center;
  transition: transform 240ms ease;
}

.portrait-video {
  position: relative;
  z-index: 2;
  display: block;
  width: 100%;
  height: 100%;
  min-height: 480px;
  object-fit: cover;
  object-position: 50% 50%;
  background: #0d1015;
  transition: transform 240ms ease;
}

.portrait-frame.is-speaking .portrait-image {
  transform: scale(1.008);
}

.portrait-frame.is-speaking .portrait-video {
  transform: scale(1.006);
}

.portrait-vignette {
  position: absolute;
  inset: 0;
  z-index: 3;
  background:
    radial-gradient(circle at 50% 36%, transparent 0, transparent 26%, rgba(4, 7, 11, 0.08) 66%, rgba(4, 7, 11, 0.22) 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(8, 22, 37, 0.12));
  pointer-events: none;
}

.portrait-glow {
  position: absolute;
  inset: auto auto -12% -10%;
  width: 76%;
  height: 38%;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(29, 124, 120, 0.38), transparent 72%);
  filter: blur(18px);
  z-index: 1;
}

.speech-orbit {
  position: absolute;
  inset: 12% 17% 14% 17%;
  z-index: 4;
  border-radius: 46%;
  border: 2px solid rgba(30, 171, 162, 0.14);
  box-shadow:
    0 0 0 10px rgba(30, 171, 162, 0.05),
    0 0 0 22px rgba(30, 171, 162, 0.025);
  animation: speech-orbit-pulse 1.4s ease-in-out infinite;
  pointer-events: none;
}

.portrait-frame.is-speaking .speech-orbit {
  display: block !important;
}

.mouth-rig {
  --mouth-open: 0;
  --mouth-round: 0;
  --mouth-width: 1;
  --mouth-tilt: 0deg;
  position: absolute;
  left: 49.8%;
  top: 53.2%;
  width: 16%;
  height: 9%;
  z-index: 5;
  transform: translate(-50%, -50%) rotate(var(--mouth-tilt));
  pointer-events: none;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.22));
}

.portrait-frame.is-speaking .mouth-rig {
  display: block !important;
}

.mouth-shadow {
  position: absolute;
  inset: 22% 10% 6% 10%;
  border-radius: 999px;
  background: radial-gradient(circle at center, rgba(5, 5, 6, 0.34), transparent 70%);
  filter: blur(4px);
  opacity: calc(0.16 + var(--mouth-open) * 0.26);
  transform: scaleX(calc(0.84 + var(--mouth-width) * 0.22)) scaleY(calc(0.45 + var(--mouth-open) * 0.64));
}

.mouth-shape {
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(44px * var(--mouth-width));
  max-width: 100%;
  height: calc(8px + 20px * var(--mouth-open));
  min-height: 4px;
  transform: translate(-50%, -50%);
  border-radius: calc(12px + 12px * var(--mouth-round));
  background:
    linear-gradient(180deg, rgba(44, 36, 34, 0.84), rgba(15, 14, 14, 0.92));
  box-shadow:
    inset 0 1px 0 rgba(255, 245, 232, 0.12),
    inset 0 -3px 6px rgba(0, 0, 0, 0.3),
    0 1px 2px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  opacity: calc(0.42 + var(--mouth-open) * 0.3);
}

.mouth-inner {
  position: absolute;
  inset: 24% 11% 14% 11%;
  border-radius: inherit;
  background:
    radial-gradient(circle at 50% 84%, rgba(58, 31, 34, 0.65), rgba(12, 10, 11, 0.96) 62%, rgba(3, 3, 3, 0.96) 100%);
  transform: scaleY(calc(0.14 + var(--mouth-open) * 0.82));
  transform-origin: center 12%;
}

.mouth-teeth {
  position: absolute;
  left: 17%;
  right: 17%;
  top: 16%;
  height: calc(2px + 7px * var(--mouth-open));
  border-radius: 0 0 12px 12px;
  background: linear-gradient(180deg, rgba(249, 246, 239, 0.82), rgba(225, 219, 214, 0.58));
  opacity: calc(var(--mouth-open) * 0.52);
}

.mouth-highlight {
  position: absolute;
  left: 18%;
  right: 18%;
  top: 18%;
  height: 14%;
  border-radius: 999px;
  background: rgba(248, 243, 239, 0.14);
  opacity: calc(0.14 + var(--mouth-open) * 0.14);
}

.voice-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.88rem;
  background: var(--card-strong);
  border: 1px solid var(--border);
  color: var(--muted);
}

.chip-live {
  color: var(--success);
  background: rgba(47, 143, 99, 0.1);
}

#speech-chip {
  color: var(--accent-strong);
  background: rgba(29, 124, 120, 0.12);
}

.content-column {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.78rem;
  color: var(--accent-strong);
  font-weight: 700;
}

h1,
h2 {
  margin: 0;
  line-height: 1.04;
}

h1 {
  font-size: clamp(2rem, 4vw, 4.1rem);
  max-width: 12ch;
}

h2 {
  font-size: 1.05rem;
}

.lead,
.notice p,
.status-message,
.response-text,
.footer-notes p {
  margin: 0;
  line-height: 1.65;
}

.lead {
  max-width: 66ch;
  font-size: 1.04rem;
  color: var(--muted);
}

.contact-banner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 18px 20px;
  background:
    linear-gradient(135deg, rgba(29, 124, 120, 0.12), rgba(15, 93, 89, 0.05)),
    var(--card-strong);
  border: 1px solid rgba(29, 124, 120, 0.18);
  border-radius: var(--radius-lg);
}

.contact-banner-copy {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.contact-kicker,
.contact-title,
.contact-note {
  margin: 0;
}

.contact-kicker {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--accent-strong);
}

.contact-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

.contact-title a {
  color: var(--accent-strong);
  text-decoration: none;
}

.contact-title a:hover {
  text-decoration: underline;
}

.contact-note {
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.55;
  max-width: 62ch;
}

.contact-banner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.contact-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 138px;
  padding: 12px 18px;
  border-radius: 999px;
  font-weight: 700;
  text-decoration: none;
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  box-shadow: 0 10px 24px rgba(15, 93, 89, 0.14);
}

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

.contact-action.secondary {
  color: var(--accent-strong);
  background: rgba(255, 255, 255, 0.68);
  box-shadow: none;
  border: 1px solid rgba(29, 124, 120, 0.16);
}

.notice-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.notice,
.status-panel,
.response-panel,
.footer-notes {
  background: var(--card-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.notice {
  padding: 16px;
}

.notice p {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.95rem;
}

.question-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  background: var(--card-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.field-label,
.status-label {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--muted);
}

textarea {
  width: 100%;
  resize: vertical;
  min-height: 126px;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(21, 58, 86, 0.16);
  background: rgba(252, 253, 255, 0.95);
  color: var(--text);
  font: inherit;
  line-height: 1.55;
}

textarea:focus {
  outline: 2px solid rgba(29, 124, 120, 0.22);
  border-color: rgba(29, 124, 120, 0.4);
}

.button-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  box-shadow: 0 10px 24px rgba(15, 93, 89, 0.18);
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.64;
  cursor: wait;
  transform: none;
}

.secondary-button {
  color: var(--text);
  background: rgba(17, 41, 62, 0.07);
  box-shadow: none;
}

.status-panel {
  padding: 16px 18px;
}

.status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 7px 11px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 700;
}

.status-badge.idle {
  background: rgba(25, 70, 107, 0.08);
  color: var(--muted);
}

.status-badge.queued,
.status-badge.running {
  background: rgba(179, 122, 31, 0.12);
  color: var(--warning);
}

.status-badge.ready {
  background: rgba(47, 143, 99, 0.12);
  color: var(--success);
}

.status-badge.error {
  background: rgba(160, 63, 63, 0.12);
  color: var(--error);
}

.status-message {
  margin-top: 12px;
  color: var(--muted);
}

.thinking-bar {
  margin-top: 14px;
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(23, 66, 96, 0.08);
  overflow: hidden;
}

.thinking-bar span {
  display: block;
  width: 34%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: thinking-slide 1.25s linear infinite;
}

@keyframes thinking-slide {
  from {
    transform: translateX(-110%);
  }

  to {
    transform: translateX(310%);
  }
}

@keyframes speech-orbit-pulse {
  0% {
    transform: scale(0.98);
    opacity: 0.42;
  }

  50% {
    transform: scale(1.02);
    opacity: 0.74;
  }

  100% {
    transform: scale(0.98);
    opacity: 0.42;
  }
}

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

.response-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.audio-block {
  grid-column: 1 / -1;
}

.video-block {
  grid-column: 1 / -1;
}

.muted {
  color: var(--muted);
}

audio {
  width: 100%;
}

.video-download-link {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  color: var(--accent-strong);
  font-weight: 700;
  text-decoration: none;
}

.video-download-link:hover {
  text-decoration: underline;
}

.footer-notes {
  padding: 14px 16px;
}

.footer-notes p {
  color: var(--muted);
  font-size: 0.92rem;
}

.hidden {
  display: none !important;
}

@media (max-width: 980px) {
  .hero-card {
    grid-template-columns: 1fr;
  }

  .contact-banner {
    grid-template-columns: 1fr;
  }

  .portrait-frame,
  .portrait-image,
  .portrait-video {
    min-height: 380px;
  }

  .portrait-image {
    transform: none;
  }

  .mouth-rig {
    top: 53.5%;
    width: 18%;
  }

  .notice-grid,
  .response-panel {
    grid-template-columns: 1fr;
  }

  .audio-block {
    grid-column: auto;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(100vw - 18px, 100%);
    padding: 12px 0 18px;
  }

  .hero-card {
    padding: 14px;
    gap: 18px;
    border-radius: 22px;
  }

  .portrait-image {
    transform: none;
    object-position: 50% 50%;
  }

  .mouth-rig {
    top: 53.8%;
    width: 19%;
  }

  .question-form,
  .status-panel,
  .response-panel,
  .notice,
  .footer-notes {
    padding: 14px;
  }

  .button-row {
    flex-direction: column;
  }

  button {
    width: 100%;
  }

  .contact-banner-actions {
    flex-direction: column;
  }

  .contact-action {
    width: 100%;
  }
}
