:root {
  --bg: #eef2f7;
  --app-bg: #f5f7fb;
  --surface: #ffffff;
  --ink: #1a2332;
  --muted: #5c6b7a;
  --line: #e4eaf1;
  --gold: #c5a059;
  --gold-deep: #8d6e3f;
  --gold-soft: #f7f1e6;
  --bot: #eef2f7;
  --user: #efe6d4;
  --danger: #b42318;
  --shadow: 0 10px 40px rgba(15, 23, 42, 0.12);
  --font: 'Outfit', system-ui, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --app-w: 480px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100dvh;
}

a {
  color: var(--gold-deep);
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

/* App shell — full bleed on phone, centered card on desktop */
.wb-app {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  width: 100%;
  margin: 0 auto;
  background: var(--app-bg);
  position: relative;
  overflow: hidden;
}

.wb-top {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.wb-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.wb-brand img {
  height: 38px;
  width: auto;
  display: block;
}

.wb-brand strong {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink);
}

.wb-help {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--gold-soft);
  color: var(--gold-deep);
  border: 1px solid #e6d7b8;
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.wb-help:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(141, 110, 63, 0.15);
}

.wb-help svg {
  width: 14px;
  height: 14px;
}

.wb-progress-wrap {
  background: var(--surface);
  padding: 10px 18px 14px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.wb-progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 0.78rem;
  margin-bottom: 8px;
  font-weight: 500;
}

.wb-progress-bar {
  height: 5px;
  background: #e8edf3;
  border-radius: 99px;
  overflow: hidden;
}

.wb-progress-bar > span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold));
  border-radius: inherit;
  transition: width 0.55s var(--ease);
}

.wb-main {
  flex: 1;
  width: 100%;
  margin: 0 auto;
  padding: 20px 18px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

.wb-chat {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 8px;
}

.wb-msg {
  display: flex;
  gap: 10px;
  max-width: 90%;
  opacity: 0;
  animation: wb-msg-in 0.45s var(--ease) forwards;
}

.wb-msg.is-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.wb-avatar {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  overflow: hidden;
  padding: 5px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.wb-avatar img {
  width: 100%;
  height: auto;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.wb-bubble {
  background: var(--bot);
  border-radius: 16px 16px 16px 5px;
  padding: 12px 14px;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.wb-msg.is-user .wb-bubble {
  background: var(--user);
  border-radius: 16px 16px 5px 16px;
}

.wb-typing {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 14px 16px;
  min-width: 52px;
}

.wb-typing i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #9aa7b5;
  animation: wb-dot 1.1s ease-in-out infinite;
}

.wb-typing i:nth-child(2) {
  animation-delay: 0.15s;
}
.wb-typing i:nth-child(3) {
  animation-delay: 0.3s;
}

.wb-panel {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--line);
  box-shadow: 0 -12px 32px rgba(15, 23, 42, 0.08);
  padding: 16px 18px calc(16px + env(safe-area-inset-bottom));
  z-index: 30;
  flex-shrink: 0;
  transition: transform 0.35s var(--ease), opacity 0.35s var(--ease);
}

.wb-panel.is-swap {
  opacity: 0;
  transform: translateY(10px);
}

.wb-panel-inner {
  width: 100%;
  margin: 0 auto;
  animation: wb-panel-in 0.4s var(--ease) both;
}

.wb-edit {
  border: 0;
  background: none;
  color: var(--muted);
  padding: 0;
  margin: 0 0 10px;
  font-size: 0.82rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.2s ease;
}

.wb-edit:hover {
  color: var(--gold-deep);
}

.wb-q {
  margin: 0 0 14px;
  font-size: 1.2rem;
  font-weight: 650;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.wb-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

.wb-choices.is-stack {
  grid-template-columns: 1fr;
}

.wb-choice {
  appearance: none;
  border: 1.5px solid var(--line);
  background: #fff;
  border-radius: 16px;
  padding: 16px 14px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease),
    box-shadow 0.2s var(--ease), transform 0.2s var(--ease);
}

.wb-choice:hover {
  border-color: #d4b56e;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(141, 110, 63, 0.1);
}

.wb-choice:active {
  transform: translateY(0);
}

.wb-choice.is-on {
  border-color: var(--gold-deep);
  background: var(--gold-soft);
  box-shadow: inset 0 0 0 1px var(--gold-deep), 0 4px 14px rgba(141, 110, 63, 0.12);
}

.wb-choice strong {
  display: block;
  font-size: 1rem;
  margin-bottom: 3px;
}

.wb-choice span {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

.wb-gender {
  display: inline-flex;
  background: #eef2f7;
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 14px;
}

.wb-gender button {
  border: 0;
  background: transparent;
  padding: 9px 18px;
  border-radius: 999px;
  color: var(--muted);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.88rem;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.wb-gender button.is-on {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}

.wb-members {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.wb-member {
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 13px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  background: #fff;
  user-select: none;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease), transform 0.2s var(--ease);
}

.wb-member:hover {
  border-color: #d4b56e;
}

.wb-member.is-on {
  border-color: var(--gold-deep);
  background: var(--gold-soft);
}

.wb-check {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 1.5px solid #9aa7b5;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.wb-member.is-on .wb-check {
  background: var(--gold-deep);
  border-color: var(--gold-deep);
  color: #fff;
  font-size: 0.7rem;
}

.wb-fields,
.wb-ages {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.wb-field {
  display: grid;
  gap: 5px;
}

.wb-field label {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 500;
}

.wb-field input,
.wb-field select {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 13px 14px;
  background: #f8fafc;
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.wb-field input:focus,
.wb-field select:focus {
  border-color: var(--gold);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(197, 160, 89, 0.18);
}

.wb-cta {
  width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 15px 16px;
  background: linear-gradient(135deg, var(--gold-deep), var(--gold));
  color: #fff;
  font-weight: 700;
  font-size: 1.02rem;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(141, 110, 63, 0.28);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), filter 0.2s ease;
}

.wb-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(141, 110, 63, 0.34);
  filter: brightness(1.03);
}

.wb-cta:active {
  transform: translateY(0);
}

.wb-cta:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.wb-legal {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.45;
  text-align: center;
}

.wb-done {
  text-align: center;
  padding: 48px 16px 32px;
  animation: wb-msg-in 0.5s var(--ease) both;
}

.wb-done .mark {
  width: 72px;
  height: 72px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: var(--gold-soft);
  color: var(--gold-deep);
  display: grid;
  place-items: center;
  font-size: 1.8rem;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(141, 110, 63, 0.15);
}

.wb-done h2 {
  margin: 0 0 10px;
  font-size: 1.55rem;
  letter-spacing: -0.02em;
}

.wb-done p {
  margin: 0 auto 22px;
  max-width: 34ch;
  color: var(--muted);
  line-height: 1.55;
}

.wb-error {
  color: var(--danger);
  font-size: 0.82rem;
  margin: 0 0 8px;
  min-height: 1.2em;
}

.wb-hp {
  position: absolute;
  left: -9999px;
  opacity: 0;
  height: 0;
  width: 0;
  pointer-events: none;
}

@keyframes wb-msg-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes wb-panel-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes wb-dot {
  0%,
  80%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

/* Desktop / tablet — PolicyBazaar-style centered phone card */
@media (min-width: 640px) {
  body {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px 20px;
    background:
      radial-gradient(ellipse 80% 60% at 50% -10%, rgba(197, 160, 89, 0.18), transparent 55%),
      linear-gradient(165deg, #e8edf4 0%, #f3f5f8 45%, #e6ebf2 100%);
  }

  .wb-app {
    width: min(var(--app-w), 100%);
    height: min(860px, calc(100dvh - 56px));
    min-height: 640px;
    border-radius: 28px;
    box-shadow: var(--shadow), 0 0 0 1px rgba(15, 23, 42, 0.04);
    overflow: hidden;
  }

  .wb-top {
    padding: 14px 22px;
  }

  .wb-brand img {
    height: 42px;
  }

  .wb-brand strong {
    font-size: 1.05rem;
  }

  .wb-progress-wrap {
    padding: 12px 22px 16px;
  }

  .wb-main {
    padding: 24px 22px 20px;
  }

  .wb-panel {
    padding: 18px 22px 22px;
  }

  .wb-q {
    font-size: 1.28rem;
  }

  .wb-bubble {
    font-size: 0.98rem;
  }

  .wb-choice {
    padding: 18px 16px;
  }
}

@media (max-width: 420px) {
  .wb-brand strong {
    font-size: 0.9rem;
  }
  .wb-q {
    font-size: 1.08rem;
  }
}
