:root {
  --wb: #8a3ffc;
  --wb-dark: #6d28d9;
  --cyan: #8bd8ec;
  --rose: #f2b8d4;
  --mint: #bdebd8;
  --ink: #17151f;
  --muted: #6e6878;
  --line: #ece6f4;
  --surface: #ffffff;
  --soft: #f7f1fb;
  --success: #17b26a;
  --warning: #f79009;
  --danger: #e5484d;
  --shadow: 0 16px 42px rgba(55, 17, 83, 0.14);
  --float-shadow: 0 18px 42px rgba(56, 15, 91, 0.14), 0 1px 0 rgba(255,255,255,0.88) inset;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(145deg, rgba(255,255,255,0.96) 0%, rgba(249,244,253,0.98) 46%, rgba(238,248,250,0.96) 100%);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top)) 14px calc(82px + env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--wb-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
  line-height: 1.12;
}

h2 {
  font-size: 23px;
  line-height: 1.08;
}

h3 {
  font-size: 17px;
}

.icon-button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(135deg, var(--wb), var(--cyan));
  box-shadow: 0 12px 30px rgba(161, 0, 255, 0.26);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.icon-button:active {
  transform: scale(0.94) rotate(18deg);
}

.screen {
  display: grid;
  gap: 12px;
}

.subscription-strip,
.hero-panel,
.tab-panel,
.metric-card,
.analysis-card,
.empty-state,
.floating-block {
  border: 1px solid rgba(161, 0, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: var(--float-shadow);
  backdrop-filter: blur(18px);
}

.glass-card {
  position: relative;
  isolation: isolate;
}

.glass-card::before {
  content: "";
  position: absolute;
  inset: 1px;
  z-index: -1;
  border-radius: 7px;
  background: linear-gradient(145deg, rgba(255,255,255,0.62), rgba(255,255,255,0.18));
}

.subscription-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  animation: rise 420ms ease both;
}

.subscription-strip > div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 6px rgba(23, 178, 106, 0.12);
}

.subscription-strip.is-expired .status-dot {
  background: var(--danger);
  box-shadow: 0 0 0 6px rgba(229, 72, 77, 0.12);
}

.strip-label {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.hero-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 132px;
  padding: 16px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(109, 40, 217, 0.95), rgba(179, 119, 255, 0.78) 52%, rgba(139, 216, 236, 0.78)),
    var(--wb);
  color: #fff;
  animation: rise 520ms ease both;
}

.hero-copy {
  max-width: 76%;
}

.hero-copy .eyebrow,
.hero-copy p {
  color: rgba(255, 255, 255, 0.82);
}

.hero-copy p {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.42;
}

.switch-control {
  position: relative;
  flex: 0 0 auto;
  width: 56px;
  height: 34px;
}

.switch-control input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.switch-control span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.26);
  transition: background 200ms ease;
}

.switch-control span::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 6px 16px rgba(31, 8, 50, 0.28);
  transition: transform 220ms cubic-bezier(.2,.8,.2,1);
}

.switch-control input:checked + span::after {
  transform: translateX(22px);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.metric-card {
  min-height: 74px;
  padding: 10px;
  animation: rise 600ms ease both;
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  font-size: 21px;
  white-space: nowrap;
}

.trial-card strong {
  font-size: 15px;
  margin-top: 12px;
}

.tab-panel {
  padding: 8px;
  animation: rise 680ms ease both;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 4px;
  border-radius: 8px;
  background: rgba(247, 241, 251, 0.86);
}

.tab {
  min-height: 38px;
  border: 0;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  font-weight: 800;
  transition: color 160ms ease, background 160ms ease, transform 160ms ease;
}

.tab.is-active {
  color: var(--wb-dark);
  background: #fff;
  box-shadow: 0 8px 18px rgba(82, 32, 121, 0.12);
}

.tab:active,
.nav-item:active,
.primary-button:active,
.plan-card:active {
  transform: scale(0.98);
}

.tab-content {
  display: none;
  padding: 14px 4px 4px;
}

.tab-content.is-active {
  display: grid;
  gap: 12px;
  animation: fadeSlide 260ms ease both;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-heading span {
  color: var(--wb-dark);
  font-size: 13px;
  font-weight: 800;
}

.rating-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.rating-button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fff;
  font-weight: 900;
  box-shadow: 0 8px 20px rgba(51, 20, 74, 0.07);
}

.rating-button.is-active {
  border-color: rgba(161, 0, 255, 0.28);
  color: #fff;
  background: var(--wb);
  box-shadow: 0 12px 24px rgba(161, 0, 255, 0.22);
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.field input,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--ink);
  background: #fff;
  outline: none;
  resize: vertical;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.field input:focus,
.field textarea:focus {
  border-color: rgba(161, 0, 255, 0.56);
  box-shadow: 0 0 0 4px rgba(161, 0, 255, 0.08);
}

.primary-button {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(135deg, var(--wb), #cc1dff 62%, var(--cyan));
  font-weight: 900;
  box-shadow: 0 12px 26px rgba(161, 0, 255, 0.24);
}

.plans {
  display: grid;
  gap: 10px;
}

.plan-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--ink);
  background: #fff;
  text-align: left;
  box-shadow: 0 10px 26px rgba(55, 17, 83, 0.09);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.plan-card:hover {
  border-color: rgba(161, 0, 255, 0.32);
  box-shadow: 0 16px 34px rgba(55, 17, 83, 0.14);
}

.plan-card.is-accent {
  border-color: rgba(161, 0, 255, 0.26);
  background: #fbf5ff;
}

.plan-card span {
  color: var(--muted);
  font-weight: 800;
}

.plan-card strong {
  color: var(--wb-dark);
  font-size: 18px;
}

.analysis-card {
  padding: 14px;
  min-height: 116px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.86), rgba(250,245,255,0.72)),
    rgba(255,255,255,0.84);
}

.analysis-card.is-loading {
  background:
    linear-gradient(90deg, rgba(255,255,255,0.56), rgba(161,0,255,0.08), rgba(255,255,255,0.56)),
    rgba(255,255,255,0.84);
  background-size: 220% 100%;
  animation: shimmer 1200ms linear infinite;
}

.analysis-card span {
  color: var(--wb-dark);
  font-size: 13px;
  font-weight: 800;
}

.analysis-card p {
  margin-top: 10px;
  color: #2f2738;
  font-size: 15px;
  line-height: 1.62;
  white-space: pre-line;
}

.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: min(100%, 520px);
  margin: 0 auto;
  padding: 7px 14px calc(7px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(161, 0, 255, 0.12);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(18px);
}

.nav-item {
  display: grid;
  place-items: center;
  gap: 2px;
  min-height: 50px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font-size: 18px;
  font-weight: 900;
}

.nav-item span {
  font-size: 11px;
}

.nav-item.is-active {
  color: var(--wb-dark);
  background: linear-gradient(135deg, rgba(161,0,255,0.10), rgba(0,191,216,0.08));
  box-shadow: 0 10px 22px rgba(55,17,83,0.08);
}

.floating-block {
  display: grid;
  gap: 12px;
  padding: 12px;
}

.mini-switch {
  position: relative;
  width: 48px;
  height: 28px;
}

.mini-switch input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.mini-switch span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #e7ddec;
}

.mini-switch span::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 6px 14px rgba(36, 18, 50, 0.20);
  transition: transform 180ms ease;
}

.mini-switch input:checked + span {
  background: linear-gradient(135deg, var(--wb), var(--cyan));
}

.mini-switch input:checked + span::after {
  transform: translateX(20px);
}

.emoji-row {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 6px;
}

.emoji-button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(55, 17, 83, 0.08);
  font-size: 16px;
}

.emoji-button.is-active {
  border-color: rgba(0, 191, 216, 0.36);
  background: linear-gradient(135deg, rgba(161,0,255,0.12), rgba(0,191,216,0.16));
}

.ghost-button {
  min-height: 42px;
  border: 1px solid rgba(161,0,255,0.18);
  border-radius: 8px;
  color: var(--wb-dark);
  background: rgba(255,255,255,0.74);
  font-weight: 900;
  box-shadow: 0 10px 22px rgba(55, 17, 83, 0.08);
}

.empty-state {
  display: none;
  gap: 12px;
  margin-top: 14px;
  padding: 18px;
}

.empty-state p:not(.eyebrow) {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.promo-field {
  margin-top: 2px;
}

.connect-sheet {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: grid;
  align-items: end;
  padding: 14px;
  background: rgba(30, 22, 42, 0);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease, background 220ms ease;
}

.connect-sheet.is-open {
  opacity: 1;
  pointer-events: auto;
  background: rgba(30, 22, 42, 0.24);
}

.sheet-card {
  position: relative;
  display: grid;
  gap: 16px;
  width: min(100%, 492px);
  max-height: min(78vh, 680px);
  margin: 0 auto;
  padding: 20px;
  overflow: auto;
  border-radius: 8px;
  transform: translateY(24px);
  transition: transform 240ms cubic-bezier(.2,.8,.2,1);
}

.connect-sheet.is-open .sheet-card {
  transform: translateY(0);
}

.sheet-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  background: rgba(255,255,255,0.82);
  font-size: 24px;
  line-height: 1;
}

.sheet-step {
  display: none;
  gap: 14px;
  padding-top: 14px;
}

.sheet-step.is-active {
  display: grid;
  animation: fadeSlide 240ms ease both;
}

.sheet-step p:not(.eyebrow) {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: calc(88px + env(safe-area-inset-bottom));
  left: 16px;
  z-index: 5;
  max-width: 488px;
  margin: 0 auto;
  padding: 13px 14px;
  border-radius: 8px;
  color: #fff;
  background: #251332;
  box-shadow: 0 16px 36px rgba(23, 16, 34, 0.22);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeSlide {
  from {
    opacity: 0;
    transform: translateX(8px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes shimmer {
  from {
    background-position: 220% 0;
  }
  to {
    background-position: -220% 0;
  }
}

@media (max-width: 360px) {
  .app-shell {
    padding-right: 12px;
    padding-left: 12px;
  }

  h1 {
    font-size: 22px;
  }

  h2 {
    font-size: 22px;
  }

  .hero-copy {
    max-width: 72%;
  }

  .metric-card {
    padding: 10px;
  }

  .metric-card strong {
    font-size: 18px;
  }

  .metrics-grid {
    gap: 8px;
  }

  .emoji-row {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}
