:root {
  --bg-900: #0c0a09;
  --bg-850: #14110f;
  --bg-800: #1c1917;
  --bg-760: #292524;
  --surface-100: #f8f5ef;
  --surface-200: #efe7d8;
  --surface-300: #d6c7ad;
  --line-soft: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(202, 138, 4, 0.28);
  --text-strong: #fefaf3;
  --text-body: #ddd6ce;
  --text-muted: #a8a29e;
  --accent: #ca8a04;
  --accent-strong: #f4c84b;
  --accent-shadow: rgba(202, 138, 4, 0.28);
  --success: #22c55e;
  --user-bubble: linear-gradient(135deg, #ca8a04 0%, #f4c84b 100%);
  --bot-bubble: linear-gradient(
    180deg,
    rgba(248, 245, 239, 0.98) 0%,
    rgba(239, 231, 216, 0.96) 100%
  );
  --panel-shadow: 0 28px 80px rgba(0, 0, 0, 0.45);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(
      circle at 15% 15%,
      rgba(202, 138, 4, 0.18),
      transparent 32%
    ),
    radial-gradient(
      circle at 85% 10%,
      rgba(34, 197, 94, 0.14),
      transparent 30%
    ),
    linear-gradient(160deg, #050505 0%, #111111 48%, #1c1917 100%);
  color: var(--text-strong);
  font-family:
    "Barlow",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

body,
button,
input,
textarea {
  font-family: inherit;
}

button,
input,
textarea {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

.page-shell {
  position: relative;
  display: flex;
  align-items: stretch;
  justify-content: center;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 0;
  isolation: isolate;
}

.ambient {
  position: absolute;
  inset: auto;
  pointer-events: none;
  z-index: 0;
}

.ambient-left,
.ambient-right {
  width: 34rem;
  height: 34rem;
  border-radius: 999px;
  filter: blur(40px);
  opacity: 0.85;
}

.ambient-left {
  top: -10rem;
  left: -12rem;
  background: radial-gradient(
    circle,
    rgba(202, 138, 4, 0.24) 0%,
    transparent 68%
  );
}

.ambient-right {
  right: -12rem;
  bottom: -10rem;
  background: radial-gradient(
    circle,
    rgba(34, 197, 94, 0.18) 0%,
    transparent 68%
  );
}

.ambient-grid {
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.32), transparent 85%);
}

.chat-container {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100dvh;
  background: linear-gradient(
    180deg,
    rgba(28, 25, 23, 0.98) 0%,
    rgba(12, 10, 9, 0.98) 100%
  );
  overflow: hidden;
}

.chat-container::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 12rem;
  background: linear-gradient(180deg, rgba(202, 138, 4, 0.12), transparent 85%);
  pointer-events: none;
}

.chat-header {
  position: relative;
  z-index: 2;
  flex-shrink: 0;
  padding: max(env(safe-area-inset-top), 18px) 18px 16px;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(
    180deg,
    rgba(28, 25, 23, 0.92) 0%,
    rgba(28, 25, 23, 0.7) 100%
  );
  backdrop-filter: blur(18px);
}

.header-kicker-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.header-kicker {
  margin: 0;
  color: var(--accent-strong);
  font-family: "Barlow Condensed", sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.header-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-body);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.status-dot,
.online-indicator {
  border-radius: 999px;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: var(--success);
  box-shadow: 0 0 0 5px rgba(34, 197, 94, 0.12);
}

.header-content {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-container {
  position: relative;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  flex-shrink: 0;
}

.logo-badge {
  width: 100%;
  height: 100%;
  padding: 3px;
  border-radius: 20px;
  background: linear-gradient(
    145deg,
    rgba(255, 255, 255, 0.22),
    rgba(202, 138, 4, 0.2)
  );
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 12px 24px rgba(0, 0, 0, 0.25);
}

.logo-icon {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 17px;
  object-fit: cover;
  object-position: center;
  background: #ffffff;
}

.online-indicator {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 13px;
  height: 13px;
  background: var(--success);
  border: 2px solid var(--bg-800);
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.12);
}

.title-container {
  min-width: 0;
  flex: 1;
}

.chat-title {
  margin: 0;
  color: var(--text-strong);
  font-family: "Barlow Condensed", sans-serif;
  font-size: 28px;
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.chat-subtitle {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.35;
}

.live-stats-bar {
  position: relative;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background:
    linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.07),
      rgba(255, 255, 255, 0.03)
    ),
    linear-gradient(90deg, rgba(202, 138, 4, 0.1), rgba(34, 197, 94, 0.06));
  overflow: hidden;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 12px 30px rgba(0, 0, 0, 0.18);
}

.live-stats-bar::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    115deg,
    transparent 18%,
    rgba(255, 255, 255, 0.12) 42%,
    transparent 70%
  );
  transform: translateX(-120%);
  animation: live-scan 4.2s linear infinite;
  pointer-events: none;
}

.live-stats-bar::after {
  content: "";
  position: absolute;
  inset: auto 10px 6px;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(34, 197, 94, 0.55),
    transparent
  );
  opacity: 0.8;
  pointer-events: none;
}

.live-stats-bar.is-live-burst {
  border-color: rgba(34, 197, 94, 0.24);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 14px 34px rgba(0, 0, 0, 0.2),
    0 0 0 1px rgba(34, 197, 94, 0.08);
}

.live-stat-item,
.live-stat-divider {
  position: relative;
  z-index: 1;
}

.live-stat-item {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  min-width: 0;
  color: #e7ded1;
  font-size: 10px;
  font-weight: 500;
  white-space: nowrap;
  line-height: 1.2;
}

.live-stat-value {
  display: inline-block;
  color: var(--text-strong);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-shadow: 0 0 16px rgba(255, 255, 255, 0.08);
  transition:
    color 220ms ease,
    transform 220ms ease,
    text-shadow 220ms ease;
}

.live-stat-value.is-ticking {
  color: #ffffff;
  transform: translateY(-1px) scale(1.04);
  text-shadow:
    0 0 22px rgba(255, 255, 255, 0.12),
    0 0 14px rgba(34, 197, 94, 0.18);
}

.live-stat-divider {
  color: rgba(244, 200, 75, 0.75);
  font-size: 11px;
}

.header-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.metric-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 8px 12px;
  border: 1px solid rgba(202, 138, 4, 0.18);
  border-radius: 999px;
  background: rgba(202, 138, 4, 0.08);
  color: #f5deb0;
  font-size: 10px;
  font-weight: 500;
}

.chat-stage {
  position: relative;
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
}

.chat-messages {
  position: relative;
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  gap: 4px;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 18px;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
}

.chat-messages::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.04), transparent 35%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.01), transparent 25%),
    radial-gradient(
      circle at bottom right,
      rgba(202, 138, 4, 0.06),
      transparent 24%
    );
  pointer-events: none;
}

.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
}

.bot-message-container,
.inline-options-container,
.typing-indicator,
.form-container,
.user-message {
  position: relative;
  z-index: 1;
}

.bot-message-container {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: 88%;
  margin: 8px 0;
  gap: 8px;
}

.bot-message-gif {
  display: block;
  width: min(220px, 100%);
  max-height: 170px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  object-fit: cover;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.28);
  animation: message-enter 360ms cubic-bezier(0.2, 0.9, 0.2, 1);
}

.bot-message,
.user-message {
  margin: 0;
  padding: 14px 16px;
  border-radius: 20px;
  line-height: 1.5;
  font-size: 15px;
  font-weight: 500;
  word-break: break-word;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.16);
  animation: message-enter 320ms cubic-bezier(0.2, 0.9, 0.2, 1);
}

.bot-message {
  color: #1c1917;
  background: var(--bot-bubble);
  border: 1px solid rgba(214, 199, 173, 0.75);
  border-bottom-left-radius: 8px;
}

.user-message {
  align-self: flex-end;
  max-width: 88%;
  color: #1c1917;
  background: var(--user-bubble);
  border: 1px solid rgba(255, 235, 176, 0.32);
  border-bottom-right-radius: 8px;
}

.inline-options-container {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 8px 0 14px;
  align-self: flex-start;
  max-width: 100%;
}

.inline-option-button {
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-strong);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background-color 180ms ease,
    box-shadow 180ms ease;
}

.inline-option-button:hover,
.inline-option-button:focus-visible {
  border-color: rgba(202, 138, 4, 0.42);
  background: rgba(202, 138, 4, 0.12);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
  transform: translateY(-1px);
}

.inline-option-button:active {
  transform: translateY(0) scale(0.98);
}

.whatsapp-option-button {
  border-color: rgba(34, 197, 94, 0.34);
  background: rgba(34, 197, 94, 0.08);
  color: #d5f6df;
}

.landing-page-option-button {
  border-color: rgba(202, 138, 4, 0.38);
  background: rgba(202, 138, 4, 0.1);
  color: #f5deb0;
}

.typing-indicator {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin: 8px 0;
  padding: 14px 16px;
  border: 1px solid rgba(214, 199, 173, 0.7);
  border-radius: 20px;
  border-bottom-left-radius: 8px;
  background: rgba(248, 245, 239, 0.92);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.14);
}

.typing-dots {
  display: flex;
  gap: 5px;
}

.typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #7c6b53;
  animation: typing 1.2s infinite ease-in-out;
}

.typing-dot:nth-child(1) {
  animation-delay: -0.24s;
}

.typing-dot:nth-child(2) {
  animation-delay: -0.12s;
}

.options-container {
  display: none;
}

.bottom-action-container {
  position: relative;
  z-index: 2;
  flex-shrink: 0;
  padding: 12px 18px max(env(safe-area-inset-bottom), 18px);
  border-top: 1px solid var(--line-soft);
  background: linear-gradient(
    180deg,
    rgba(12, 10, 9, 0.55) 0%,
    rgba(12, 10, 9, 0.96) 100%
  );
  backdrop-filter: blur(14px);
}

.cta-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(202, 138, 4, 0.18);
  border-radius: 24px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.04) 0%,
    rgba(202, 138, 4, 0.08) 100%
  );
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.apply-now-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 56px;
  padding: 16px 22px;
  border: 0;
  border-radius: 18px;
  background: linear-gradient(
    135deg,
    var(--accent) 0%,
    var(--accent-strong) 100%
  );
  color: #120f0a;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  box-shadow:
    0 16px 30px var(--accent-shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.34);
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    filter 180ms ease;
  user-select: none;
}

.apply-now-button:hover,
.apply-now-button:focus-visible {
  transform: translateY(-1px);
  filter: saturate(1.04);
  box-shadow:
    0 20px 34px rgba(202, 138, 4, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.34);
}

.apply-now-button:active {
  transform: translateY(0);
}

.whatsapp-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.cta-caption {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
}

.form-container {
  width: 100%;
  max-width: 100%;
  margin: 12px 0;
  padding: 18px;
  border: 1px solid rgba(214, 199, 173, 0.72);
  border-radius: 22px;
  background: linear-gradient(
    180deg,
    rgba(248, 245, 239, 0.98) 0%,
    rgba(239, 231, 216, 0.96) 100%
  );
  color: #1c1917;
  box-shadow: 0 16px 28px rgba(0, 0, 0, 0.16);
  animation: message-enter 360ms cubic-bezier(0.2, 0.9, 0.2, 1);
}

.form-title {
  margin: 0 0 16px;
  color: #1c1917;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.registration-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  color: #44403c;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.form-group input {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid rgba(41, 37, 36, 0.14);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  color: #1c1917;
  font-size: 16px;
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease,
    background-color 180ms ease;
}

.form-group input::placeholder {
  color: #78716c;
}

.form-group input:focus {
  outline: none;
  border-color: rgba(202, 138, 4, 0.56);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(202, 138, 4, 0.12);
}

.form-button-group {
  display: flex;
  width: 100%;
  gap: 10px;
  margin-top: 4px;
}

.form-submit-button,
.form-cancel-button {
  min-height: 48px;
  padding: 12px 18px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 700;
  transition:
    transform 180ms ease,
    background-color 180ms ease,
    box-shadow 180ms ease,
    opacity 180ms ease;
}

.form-submit-button {
  width: 100%;
  border: 0;
  background: linear-gradient(
    135deg,
    var(--accent) 0%,
    var(--accent-strong) 100%
  );
  color: #120f0a;
  box-shadow: 0 12px 24px rgba(202, 138, 4, 0.18);
}

.form-submit-button:hover:not(:disabled),
.form-submit-button:focus-visible:not(:disabled) {
  transform: translateY(-1px);
}

.form-submit-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

.form-cancel-button {
  border: 1px solid rgba(41, 37, 36, 0.12);
  background: rgba(255, 255, 255, 0.6);
  color: #1c1917;
}

.form-error-message {
  padding: 11px 13px;
  border: 1px solid rgba(220, 38, 38, 0.16);
  border-radius: 14px;
  background: rgba(220, 38, 38, 0.08);
  color: #991b1b;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  animation: shake 420ms ease-in-out;
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid rgba(202, 138, 4, 0.72);
  outline-offset: 2px;
}

@keyframes message-enter {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes typing {
  0%,
  80%,
  100% {
    transform: translateY(0) scale(0.86);
    opacity: 0.5;
  }

  40% {
    transform: translateY(-1px) scale(1);
    opacity: 1;
  }
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }

  30% {
    transform: translateX(-4px);
  }

  70% {
    transform: translateX(4px);
  }
}

@keyframes live-scan {
  from {
    transform: translateX(-120%);
  }

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

@media (min-width: 769px) {
  .page-shell {
    padding: 22px;
    align-items: center;
  }

  .chat-container {
    width: min(460px, 100%);
    min-height: auto;
    height: min(92vh, 860px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-xl);
    box-shadow: var(--panel-shadow);
  }

  .chat-header {
    padding: 18px 20px 16px;
  }

  .chat-messages {
    padding: 20px;
  }

  .bottom-action-container {
    padding: 14px 20px 20px;
  }
}

@media (max-height: 760px) {
  .chat-title {
    font-size: 24px;
  }

  .chat-subtitle {
    font-size: 13px;
  }

  .live-stats-bar {
    gap: 4px;
    padding: 7px 9px;
  }

  .live-stat-item {
    font-size: 10px;
  }

  .live-stat-value {
    font-size: 13px;
  }

  .header-metrics {
    gap: 6px;
  }

  .metric-pill {
    min-height: 30px;
    padding: 6px 10px;
    font-size: 10px;
  }

  .chat-messages {
    padding-top: 14px;
    padding-bottom: 14px;
  }

  .bot-message,
  .user-message,
  .typing-indicator {
    padding: 12px 14px;
  }

  .apply-now-button {
    min-height: 52px;
    font-size: 19px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html:focus-within {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
