@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Playfair+Display:wght@500;600;700&display=swap");

:root {
  color-scheme: dark;
  font-family: "DM Sans", sans-serif;
  color: #f1ebdf;
  background: #100d18;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  --orange: #e69b4b;
  --muted: #9c93a2;
  --surface: #191523;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background:
    radial-gradient(ellipse at 50% 30%, rgb(79 45 87 / 19%), transparent 48%),
    #100d18;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.app {
  width: min(100% - 40px, 660px);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgb(255 255 255 / 8%);
  font-size: 10px;
  letter-spacing: 0.14em;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #f1ebdf;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.17em;
}

.brand-mark {
  color: var(--orange);
  font-size: 18px;
}

.edition {
  color: #817a89;
}

.scene {
  position: relative;
  flex: 1;
  min-height: 450px;
  padding: clamp(42px, 10vh, 85px) 8px 28px;
  overflow: hidden;
}

.moon {
  position: absolute;
  top: 72px;
  right: 7%;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: #e5c393;
  opacity: 0.11;
  box-shadow: 0 0 70px 20px rgb(230 155 75 / 10%);
}

.bats {
  position: absolute;
  top: 135px;
  right: 10%;
  color: #a78ba3;
  font-size: 19px;
  opacity: 0.58;
}

.lantern {
  position: absolute;
  top: 68px;
  right: 15%;
  width: 43px;
  height: 51px;
  display: grid;
  place-items: center;
  border: 1px solid rgb(230 155 75 / 55%);
  border-radius: 45% 45% 42% 42%;
  color: var(--orange);
  background: #261b24;
  box-shadow: 0 0 34px rgb(230 155 75 / 35%), inset 0 0 15px rgb(230 155 75 / 18%);
  transform: rotate(4deg);
  animation: glow 3s ease-in-out infinite;
}

.intro,
.conversation {
  position: relative;
  z-index: 1;
}

.eyebrow,
.message-label {
  color: var(--orange);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 22px;
}

.status-dot,
.status-indicator {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--orange);
}

.status-dot {
  box-shadow: 0 0 10px rgb(230 155 75 / 70%);
}

h1 {
  margin: 0;
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(42px, 10vw, 65px);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1.05;
}

h1 > span {
  color: var(--orange);
}

.subtitle {
  max-width: 360px;
  margin: 16px 0 0;
  color: #aaa1ad;
  font-size: 13px;
  line-height: 1.7;
}

.character-cast {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 19px;
}

.cast-character {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 9px;
  border: 1px solid rgb(255 255 255 / 9%);
  border-radius: 999px;
  color: #dfd4e0;
  background: rgb(29 24 39 / 80%);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.cast-character small {
  color: #938896;
  font-size: 7px;
  font-weight: 500;
}

.cast-icon {
  color: #d3a3d8;
}

.cast-caio .cast-icon {
  color: #df8588;
}

.cast-pedro .cast-icon {
  color: #9fbd9e;
}

.conversation {
  display: grid;
  gap: 12px;
  max-height: 230px;
  margin-top: 37px;
  overflow-y: auto;
  scrollbar-color: #514052 transparent;
  scrollbar-width: thin;
}

.message {
  width: fit-content;
  max-width: 91%;
  padding: 14px 16px;
  border: 1px solid rgb(255 255 255 / 7%);
  border-radius: 3px 14px 14px 14px;
  background: rgb(29 24 39 / 89%);
  animation: appear 220ms ease-out;
}

.user-message {
  justify-self: end;
  border-color: rgb(230 155 75 / 22%);
  border-radius: 14px 3px 14px 14px;
  background: rgb(66 43 48 / 55%);
}

.message-label {
  color: #bca4be;
  font-size: 8px;
}

.character-luana {
  border-left: 2px solid #bd8bc5;
}

.character-luana .message-label {
  color: #d6a4df;
}

.character-caio {
  border-left: 2px solid #c86d73;
}

.character-caio .message-label {
  color: #e58b90;
}

.character-pedro {
  border-left: 2px solid #8da78f;
}

.character-pedro .message-label {
  color: #a7c3a6;
}

.user-message .message-label {
  color: var(--orange);
}

.message p {
  margin: 5px 0 0;
  color: #e4dce4;
  font-size: 13px;
  line-height: 1.65;
}

.controls {
  padding: 17px 0 23px;
  border-top: 1px solid rgb(255 255 255 / 8%);
  text-align: center;
}

.status-line {
  min-height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 13px;
  color: var(--muted);
  font-size: 11px;
}

.status-indicator {
  width: 6px;
  height: 6px;
  background: #77717d;
}

.status-line.is-active .status-indicator {
  background: #eb765e;
  box-shadow: 0 0 9px rgb(235 118 94 / 70%);
  animation: pulse 1.2s ease-in-out infinite;
}

.talk-button {
  width: 100%;
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  border: 1px solid #e6a054;
  border-radius: 6px;
  background: linear-gradient(110deg, #c87936, #dc9045);
  box-shadow: 0 6px 24px rgb(198 112 47 / 19%);
  color: #20141b;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  transition: filter 150ms ease, transform 150ms ease;
}

.talk-button:hover:not(:disabled) {
  filter: brightness(1.09);
  transform: translateY(-1px);
}

.talk-button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.talk-button.is-listening {
  border-color: #b96c69;
  background: linear-gradient(110deg, #683f50, #8b4e56);
  box-shadow: 0 6px 24px rgb(168 75 84 / 20%);
  color: #fff3e7;
}

.button-icon {
  font-size: 17px;
}

.text-toggle {
  margin-top: 13px;
  padding: 7px;
  border: 0;
  background: transparent;
  color: #aaa1ad;
  cursor: pointer;
  font-size: 11px;
}

.text-toggle span {
  color: #dfab72;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.text-form {
  display: flex;
  gap: 8px;
  margin-top: 11px;
}

.text-form[hidden] {
  display: none;
}

.text-form input {
  width: 100%;
  min-width: 0;
  height: 45px;
  padding: 0 13px;
  border: 1px solid #443646;
  border-radius: 6px;
  outline: none;
  background: #1b1622;
  color: #f1ebdf;
}

.text-form input:focus {
  border-color: var(--orange);
}

.text-form button {
  width: 47px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 6px;
  background: #d78a42;
  color: #20141b;
  cursor: pointer;
  font-size: 22px;
}

.privacy-note {
  margin: 14px 0 0;
  color: #817a89;
  font-size: 10px;
  line-height: 1.6;
}

.privacy-note span {
  color: var(--orange);
}

.microphone-help {
  margin: 10px auto 0;
  color: #aaa1ad;
  font-size: 11px;
  line-height: 1.65;
  text-align: left;
}

.microphone-help summary {
  width: fit-content;
  margin: 0 auto;
  color: #dfab72;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.help-content {
  padding: 5px 2px 0;
}

.help-content p {
  margin: 9px 0;
}

.help-content strong {
  color: #e4dce4;
}

footer {
  min-height: 39px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid rgb(255 255 255 / 6%);
  color: #696270;
  font-size: 8px;
  letter-spacing: 0.12em;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes pulse {
  50% {
    opacity: 0.42;
    transform: scale(0.8);
  }
}

@keyframes glow {
  50% {
    box-shadow: 0 0 44px rgb(230 155 75 / 52%), inset 0 0 15px rgb(230 155 75 / 18%);
  }
}

@keyframes appear {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
}

@media (max-width: 420px) {
  .app {
    width: min(100% - 32px, 660px);
  }

  .scene {
    min-height: 410px;
    padding-top: 52px;
  }

  .lantern {
    right: 9%;
  }

  footer {
    font-size: 7px;
  }
}

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