:root {
  --ink: #1f1a14;
  --muted: #6f6458;
  --glass: rgba(255, 255, 255, 0.44);
  --glass-strong: rgba(255, 255, 255, 0.62);
  --glass-soft: rgba(255, 255, 255, 0.28);
  --line: rgba(255, 255, 255, 0.52);
  --line-warm: rgba(111, 94, 71, 0.22);
  --green: #496f47;
  --green-soft: rgba(73, 111, 71, 0.16);
  --client-green: #78993d;
  --client-green-soft: rgba(120, 153, 61, 0.37);
  --coral: #f44831;
  --coral-soft: rgba(244, 72, 49, 0.37);
  --bottom-safe-space: max(18px, calc(env(safe-area-inset-bottom, 0px) + 5px));
  --shadow: 0 24px 80px rgba(45, 34, 22, 0.18);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  min-height: 100svh;
  overflow: hidden;
  color: var(--ink);
  font-family:
    Manrope,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background: #12100d url("./assets/background.webp?v=20260514-mobile-fix-1") center center / cover no-repeat;
}

button,
input,
textarea {
  font: inherit;
}

.landing {
  position: relative;
  width: 100vw;
  height: 100svh;
  overflow: hidden;
  background: url("./assets/background.webp?v=20260514-mobile-fix-1") center center / cover no-repeat;
  box-shadow: none;
}

.landing::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(15, 11, 7, 0.04), rgba(15, 11, 7, 0.18)),
    linear-gradient(90deg, rgba(255, 246, 231, 0.02), rgba(255, 246, 231, 0.16) 58%, rgba(20, 15, 10, 0.04));
}

.chat-shell {
  position: absolute;
  z-index: 1;
  inset:
    max(4px, env(safe-area-inset-top))
    max(7px, env(safe-area-inset-right))
    max(3px, env(safe-area-inset-bottom))
    max(7px, env(safe-area-inset-left));
  width: auto;
  height: auto;
  margin: 0;
  display: flex;
  transform: none;
  flex-direction: column;
  gap: 8px;
  padding: 4px 2px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.chat-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  gap: 8px;
  padding: 0 3px;
  min-height: 56px;
}

.brand-mark {
  position: absolute;
  left: 3px;
  top: 0;
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: transparent;
  font-weight: 800;
  background: transparent url("./assets/brand-logo.webp?v=20260514-mobile-fix-1") center / cover no-repeat;
  box-shadow: 0 10px 26px rgba(45, 34, 22, 0.14);
}

.chat-header > div:last-child {
  width: 100%;
  min-width: 0;
}

.eyebrow,
.chat-header h1 {
  margin: 0;
}

.eyebrow {
  display: none;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.chat-header h1 {
  margin-top: 0;
  padding: 0 64px;
  font-size: 17px;
  line-height: 1.12;
  font-weight: 800;
  text-align: center;
}

.progress {
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(111, 94, 71, 0.12);
}

.progress-bar {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(73, 111, 71, 0.92), rgba(197, 169, 119, 0.92));
  transition: width 760ms cubic-bezier(0.22, 1, 0.36, 1);
}

.chat-log {
  display: flex;
  position: relative;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  gap: 9px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 2px 4px;
  -webkit-mask-image: linear-gradient(
    180deg,
    transparent 0,
    rgba(0, 0, 0, 0.18) 14px,
    #000 48px,
    #000 calc(100% - 8px)
  );
  mask-image: linear-gradient(
    180deg,
    transparent 0,
    rgba(0, 0, 0, 0.18) 14px,
    #000 48px,
    #000 calc(100% - 8px)
  );
  scroll-behavior: auto;
  scrollbar-width: none;
}

.chat-log::-webkit-scrollbar,
.controls::-webkit-scrollbar {
  display: none;
}

.chat-log::before {
  content: "";
  position: sticky;
  z-index: 2;
  top: -16px;
  display: block;
  height: 42px;
  flex: 0 0 42px;
  margin-bottom: -42px;
  pointer-events: none;
  background: transparent;
}

.message-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  opacity: 0;
  transform: translate3d(0, 16px, 0) scale(0.988);
  animation: bubbleIn 760ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
  contain: layout paint;
  will-change: opacity, transform;
}

.message-row.user {
  justify-content: flex-end;
}

.message-row.static {
  opacity: 1;
  transform: none;
  animation: none;
  will-change: auto;
}

.message-row.is-exiting {
  pointer-events: none;
  animation: driftAway 360ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.avatar {
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 0;
  border-radius: 50%;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.26);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.5), 0 8px 22px rgba(45, 34, 22, 0.1);
}

.message-row.user .avatar {
  background-color: rgba(73, 111, 71, 0.18);
}

.bot-avatar {
  color: transparent;
  background:
    url("./assets/realtbot-avatar.webp?v=20260514-mobile-fix-1") center / cover no-repeat;
}

.user-avatar {
  color: transparent;
  background:
    url("./assets/client-avatar.webp?v=20260514-mobile-fix-1") center / cover no-repeat;
}

.bubble {
  max-width: calc(100% - 42px);
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 18px 18px 18px 7px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.42;
  white-space: pre-line;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.54), rgba(255, 255, 255, 0.18)),
    rgba(255, 255, 255, 0.3);
  box-shadow: 0 14px 34px rgba(45, 34, 22, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.56);
  backdrop-filter: blur(18px) saturate(1.08);
  -webkit-backdrop-filter: blur(18px) saturate(1.08);
}

.message-row.user .bubble {
  border-color: rgba(73, 111, 71, 0.26);
  border-radius: 18px 18px 7px 18px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.48), rgba(73, 111, 71, 0.14)),
    rgba(255, 255, 255, 0.28);
}

.controls {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  margin-top: auto;
  gap: 7px;
  max-height: min(62%, calc(100svh - 132px));
  overflow-y: auto;
  padding-top: 0;
  padding-right: 1px;
  padding-bottom: var(--bottom-safe-space);
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.choice-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
}

.choice-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.choice-grid.single {
  grid-template-columns: 1fr;
}

.choice-button,
.nav-button,
.input-submit {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 999px;
  color: var(--ink);
  cursor: pointer;
  font-weight: 760;
  line-height: 1.18;
  text-align: center;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.25)),
    rgba(255, 255, 255, 0.28);
  box-shadow: 0 13px 30px rgba(45, 34, 22, 0.13), inset 0 1px 0 rgba(255, 255, 255, 0.46);
  backdrop-filter: blur(18px) saturate(1.08);
  -webkit-backdrop-filter: blur(18px) saturate(1.08);
  transition:
    transform 320ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 320ms cubic-bezier(0.22, 1, 0.36, 1),
    border-color 320ms ease,
    background 320ms ease,
    opacity 320ms ease;
}

.choice-button {
  padding: 9px 13px;
  font-size: 13px;
}

.multi-choice-button {
  justify-content: center;
  padding-inline: 30px 14px;
  text-align: center;
}

.multi-choice-button::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 50%;
  width: 13px;
  height: 13px;
  transform: translateY(-50%);
  border: 1.5px solid rgba(73, 111, 71, 0.42);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.21);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.56);
}

.multi-choice-button.is-selected {
  border-color: rgba(73, 111, 71, 0.44);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.58), rgba(73, 111, 71, 0.26)),
    rgba(255, 255, 255, 0.33);
}

.multi-choice-button.is-selected::before {
  border-color: rgba(73, 111, 71, 0.78);
  background: radial-gradient(circle at center, rgba(73, 111, 71, 0.94) 0 46%, rgba(255, 255, 255, 0.42) 49%);
}

.choice-button:hover,
.input-submit:hover {
  border-color: rgba(73, 111, 71, 0.27);
  box-shadow: 0 14px 34px rgba(45, 34, 22, 0.13), inset 0 1px 0 rgba(255, 255, 255, 0.54);
  transform: translateY(-1px);
}

.choice-button.is-pressing,
.input-submit.is-pressing,
.nav-button.is-pressing {
  animation: buttonPress 420ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.choice-button[disabled],
.input-submit[disabled] {
  cursor: wait;
  opacity: 0.68;
}

.primary-submit {
  border-color: rgba(213, 231, 164, 0.46);
  color: #fffdf2;
  background:
    linear-gradient(145deg, rgba(170, 194, 89, 0.62), rgba(85, 119, 38, 0.44)),
    rgba(120, 153, 61, 0.49);
  box-shadow: 0 14px 34px rgba(70, 93, 37, 0.18), inset 0 1px 0 rgba(255, 255, 235, 0.5);
  text-shadow: 0 1px 9px rgba(38, 55, 18, 0.24);
}

.primary-submit:hover {
  border-color: rgba(229, 244, 180, 0.58);
  box-shadow: 0 16px 38px rgba(70, 93, 37, 0.22), inset 0 1px 0 rgba(255, 255, 235, 0.58);
}

.ripple {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.74);
  transform: translate(-50%, -50%) scale(1);
  animation: ripple 860ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.input-panel {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.text-input {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--ink);
  outline: none;
  resize: vertical;
  background: rgba(255, 255, 255, 0.52);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.54);
  transition:
    border-color 320ms ease,
    box-shadow 320ms cubic-bezier(0.22, 1, 0.36, 1),
    background 320ms ease;
}

textarea.text-input {
  min-height: 72px;
}

.text-input::placeholder {
  color: rgba(38, 33, 26, 0.68);
  opacity: 1;
}

.text-input:focus {
  border-color: rgba(73, 111, 71, 0.44);
  box-shadow: 0 0 0 4px rgba(73, 111, 71, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.54);
}

.nav-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 0;
}

.nav-button {
  min-height: 34px;
  padding: 8px 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
  background: rgba(255, 255, 255, 0.3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.coral-nav-button {
  border-color: rgba(255, 171, 145, 0.46);
  color: #fff6ef;
  background:
    linear-gradient(145deg, rgba(255, 131, 104, 0.58), rgba(232, 52, 36, 0.38)),
    rgba(244, 72, 49, 0.49);
  box-shadow: 0 12px 28px rgba(139, 37, 22, 0.16), inset 0 1px 0 rgba(255, 238, 225, 0.5);
}

.coral-nav-button:hover {
  border-color: rgba(255, 199, 176, 0.58);
  box-shadow: 0 15px 32px rgba(139, 37, 22, 0.2), inset 0 1px 0 rgba(255, 244, 235, 0.59);
}

.coral-nav-button[disabled] {
  color: rgba(255, 246, 239, 0.66);
}

.success-actions {
  display: grid;
  gap: 9px;
}

.hidden {
  display: none;
}

@keyframes bubbleIn {
  0% {
    opacity: 0;
    transform: translate3d(0, 18px, 0) scale(0.984);
  }
  58% {
    opacity: 1;
    transform: translate3d(0, -2px, 0) scale(1.002);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

@keyframes driftAway {
  to {
    opacity: 0;
    transform: translate3d(0, -18px, 0) scale(0.988);
  }
}

@keyframes buttonPress {
  0% {
    transform: scale(1);
  }
  38% {
    transform: scale(0.972);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes ripple {
  to {
    opacity: 0;
    transform: translate(-50%, -50%) scale(22);
  }
}

@media (max-width: 560px) {
  .landing {
    width: 100vw;
    height: 100svh;
    background-position: center center;
  }

  .chat-shell {
    inset:
      max(4px, env(safe-area-inset-top))
      max(7px, env(safe-area-inset-right))
      max(3px, env(safe-area-inset-bottom))
      max(7px, env(safe-area-inset-left));
    width: auto;
    height: auto;
    padding: 4px 2px 0;
  }

  .chat-header h1 {
    font-size: 16px;
  }

  .bubble {
    max-width: calc(100% - 40px);
  }
}

@media (hover: none), (pointer: coarse), (max-width: 560px) {
  .avatar,
  .bubble,
  .choice-button,
  .nav-button,
  .input-submit,
  .text-input {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .bubble {
    background:
      linear-gradient(145deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.23)),
      rgba(255, 255, 255, 0.34);
  }

  .message-row.user .bubble {
    background:
      linear-gradient(145deg, rgba(255, 255, 255, 0.53), rgba(73, 111, 71, 0.16)),
      rgba(255, 255, 255, 0.3);
  }

  .ripple {
    display: none;
  }
}

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