
* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: #f3f8f4;
  color: #173e35;
  font: 14px system-ui, Arial, sans-serif;
}

button,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 10px;
  padding: 11px 14px;
  background: #e7f1e9;
  color: #15513e;
  font-weight: 700;
  cursor: pointer;
}

button:disabled {
  opacity: .5;
  cursor: default;
}

.primary {
  background: #166049;
  color: white;
}

.full {
  width: 100%;
}

main {
  max-width: 1120px;
  margin: auto;
  padding: 18px;
}

header {
  display: flex;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid #dce8df;
  padding: 8px 0 20px;
}

header b,
header small {
  display: block;
}

header small {
  color: #678477;
  font-size: 11px;
}

.logo {
  background: #155846;
  color: #fff;
  padding: 14px;
  border-radius: 12px;
  font-weight: 800;
}

#again {
  margin-left: auto;
}

.lead {
  max-width: 700px;
  padding: 30px 0;
}

.lead small,
.eyebrow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
  color: #328067;
}

.lead h1 {
  font: normal clamp(28px, 5vw, 48px)
    Georgia, serif;
  margin: 12px 0;
}

.lead p,
.card p {
  color: #59776d;
  line-height: 1.6;
}

.layout {
  display: grid;
  grid-template-columns:
    minmax(0, 1.5fr)
    minmax(270px, 1fr);
  gap: 16px;
}

.card {
  padding: 20px;
  border-radius: 16px;
  border: 1px solid #e0e9e2;
  background: white;
  box-shadow: 0 4px 18px #123f3010;
}

aside {
  display: grid;
  gap: 16px;
  align-content: start;
}

.chat {
  padding: 0;
  overflow: hidden;
}

.chatTitle {
  padding: 16px 18px;
  border-bottom: 1px solid #e0eae2;
  font-weight: 700;
}

.chatTitle span {
  float: right;
  color: #478770;
  font-size: 12px;
}

.avatar {
  height: 285px;
  position: relative;
  overflow: hidden;
  background: radial-gradient(
    circle,
    #e8f4ec,
    #d1e3d9
  );
}

.avatar.speaking {
  box-shadow:
    inset 0 0 0 4px #168f6b88;
}

.avatar.listening {
  box-shadow:
    inset 0 0 0 4px #36b48188;
}

#stage {
  position: absolute;
  inset: 0;
  touch-action: pan-y;
}

#stage canvas {
  width: 100%;
  height: 100%;
  display: block;
}

#avatarLoad {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #497666;
  text-align: center;
  padding: 10px;
}

#avatarStatus {
  position: absolute;
  bottom: 12px;
  left: 12px;
  background: #195746e8;
  color: white;
  border-radius: 30px;
  padding: 8px 11px;
  font-size: 12px;
}

#history {
  height: 240px;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bubble {
  align-self: flex-start;
  max-width: 93%;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: #eff6f0;
  border-radius: 12px;
  padding: 12px;
  line-height: 1.5;
}

.bubble.me {
  align-self: flex-end;
  background: #dcefe4;
}

form {
  padding: 18px;
}

label {
  display: block;
  font-weight: 700;
  margin-bottom: 8px;
}

textarea {
  display: block;
  width: 100%;
  border: 1px solid #b5d0c2;
  border-radius: 9px;
  padding: 12px;
  resize: vertical;
}

.buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.spread {
  justify-content: space-between;
}

#notice {
  min-height: 18px;
  font-size: 12px;
  color: #527364;
}

.counter b {
  font-size: 38px;
  color: #155b49;
}

.counter span {
  font-size: 12px;
}

progress {
  width: 100%;
  accent-color: #188a65;
}

.premium {
  background: #f9fcf9;
}

.premium h2 {
  font-size: 38px;
}

.tip {
  background: #e7f2e8;
  padding: 12px;
  border-radius: 11px;
}

hr {
  border: 0;
  border-top: 1px solid #dae6db;
}

/* PANTALLA DE BIENVENIDA */

.welcome {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #072820;
  color: white;
  overflow: hidden;
}

.welcome video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 38%;
}

.introShade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    0deg,
    #031b17df,
    transparent 75%
  );
}

.welcomeText {
  position: absolute;
  bottom: clamp(25px, 6vh, 75px);
  left: clamp(22px, 7vw, 110px);
  right: clamp(22px, 7vw, 110px);
  max-width: 730px;
  text-shadow: 0 3px 20px #0008;
}

.welcomeText small {
  letter-spacing: 2px;
  color: #c7f3de;
}

.welcomeText h1 {
  font: normal clamp(30px, 5vw, 61px)
    Georgia, serif;
  margin: 10px 0;
}

.welcomeText p {
  color: #eef8f1;
}

.welcome .buttons button {
  background: #f6fff3;
  color: #124933;
}

.welcome .buttons #sound {
  background: #16875c;
  color: white;
}

/* TRANSICION */

.transition {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background:
    radial-gradient(
      circle at 20% 30%,
      #26c89891,
      transparent 45%
    ),
    radial-gradient(
      circle at 80% 80%,
      #235fba88,
      transparent 45%
    ),
    #062d28;

  opacity: 1;
  transition: opacity .5s;
}

.transition.fade {
  opacity: 0;
}

.transition canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.transitionLabel {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  text-align: center;
  color: white;
  text-shadow: 0 2px 22px #0009;
  pointer-events: none;
}

.transitionLabel b {
  font-size: clamp(32px, 5vw, 65px);
  letter-spacing: 3px;
}

.transitionLabel p {
  font-size: 17px;
}

@media (max-width: 760px) {
  main {
    padding: 12px;
  }

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

  .welcome video {
    object-fit: contain;
  }

  .welcomeText h1 {
    font-size: 32px;
  }

  .avatar {
    height: 270px;
  }

  .buttons button {
    flex: 1 1 38%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .transition {
    transition: none;
  }
}
