:root {
  --bg: #000000;
  --bg-elevated: #111111;
  --ink: #ffffff;
  --muted: #9ca3af;
  --accent: #ff2d8a;
  --accent-strong: #ff1493;
  --accent-ink: #ffffff;
  --line: rgba(255, 255, 255, 0.1);
  --ok: #ff2d8a;
  --font-display: "Montserrat", "Avenir Next", "Segoe UI", sans-serif;
  --font-body: "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  color: var(--ink);
  font-family: var(--font-body);
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(255, 45, 138, 0.22), transparent 55%),
    radial-gradient(ellipse 40% 30% at 100% 20%, rgba(255, 20, 147, 0.08), transparent 50%),
    #000000;
  background-attachment: fixed;
}

.home-logo-only {
  min-height: 100dvh;
}

.logo-page {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 2rem 1.25rem;
  animation: rise 560ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.brand-logo-hero {
  width: min(360px, 82vw);
}

.page {
  min-height: 100dvh;
  display: grid;
  align-content: start;
  gap: 2.75rem;
  padding: 2.75rem 1.25rem 4rem;
  max-width: 36rem;
  margin: 0 auto;
}

.home-page .hero {
  min-height: min(72dvh, 38rem);
  align-content: center;
  padding-top: 1rem;
}

.brand-logo {
  display: block;
  height: auto;
  width: min(240px, 72vw);
  object-fit: contain;
}

.brand-logo-lg {
  width: min(300px, 82vw);
}

.hero {
  display: grid;
  gap: 1.05rem;
  justify-items: start;
}

.hero .brand-logo {
  margin-bottom: 0.5rem;
  animation: rise 520ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.hero h1 {
  animation: rise 560ms cubic-bezier(0.22, 1, 0.36, 1) 60ms both;
}

.hero .lede {
  animation: rise 600ms cubic-bezier(0.22, 1, 0.36, 1) 110ms both;
}

.hero .connect-panel {
  animation: rise 640ms cubic-bezier(0.22, 1, 0.36, 1) 160ms both;
}

h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 5vw, 2.25rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  text-transform: uppercase;
  line-height: 1.05;
}

.lede,
.note {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  max-width: 34ch;
}

.note {
  font-size: 0.88rem;
  max-width: none;
}

.connect-panel {
  width: 100%;
  margin-top: 0.75rem;
  display: grid;
  gap: 0.75rem;
  padding: 1.2rem 1.15rem 1.15rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(255, 45, 138, 0.22);
  background:
    linear-gradient(165deg, rgba(255, 45, 138, 0.1), rgba(255, 255, 255, 0.02) 45%),
    rgba(17, 17, 17, 0.85);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

.connect-panel label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.connect-panel input[type="text"] {
  width: 100%;
  padding: 0.9rem 0.95rem;
  border-radius: 0.45rem;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.45);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
}

.connect-panel input[type="text"]:focus {
  outline: none;
  border-color: rgba(255, 45, 138, 0.7);
  box-shadow: 0 0 0 3px rgba(255, 45, 138, 0.18);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.95rem 1.3rem;
  border-radius: 0.45rem;
  border: 0;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 750;
  font-family: var(--font-display);
  letter-spacing: 0.02em;
  text-decoration: none;
  cursor: pointer;
  transition: transform 160ms ease, filter 160ms ease, box-shadow 160ms ease;
}

.btn-block {
  width: 100%;
}

.btn-google-mark {
  display: inline-grid;
  place-items: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 0.25rem;
  background: #fff;
  color: #111;
  font-size: 0.85rem;
  font-weight: 800;
  font-family: var(--font-body);
}

.btn:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 10px 32px rgba(255, 45, 138, 0.35);
}

.btn:active {
  transform: translateY(0);
}

.panel {
  border-top: 1px solid var(--line);
  padding-top: 1.75rem;
  animation: rise 480ms ease both;
}

.panel-head {
  display: grid;
  gap: 0.3rem;
  margin-bottom: 1.1rem;
}

.panel h2,
.status h2,
.emails h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.panel-sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

#accounts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.85rem;
}

.account {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.85rem 1rem;
  align-items: start;
  padding: 1rem;
  border-radius: 0.65rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.account img {
  width: 2.65rem;
  height: 2.65rem;
  border-radius: 50%;
  object-fit: cover;
  background: var(--line);
  border: 1px solid rgba(255, 45, 138, 0.25);
}

.account .meta {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.account .email {
  font-weight: 700;
  word-break: break-word;
}

.account .sub {
  color: var(--muted);
  font-size: 0.88rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  width: fit-content;
  margin-top: 0.25rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: rgba(255, 45, 138, 0.12);
  border: 1px solid rgba(255, 45, 138, 0.28);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.badge::before {
  content: "";
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(255, 45, 138, 0.8);
}

.empty {
  color: var(--muted);
  padding: 0.5rem 0;
}

.account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.7rem;
}

.btn-small {
  padding: 0.5rem 0.8rem;
  font-size: 0.82rem;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  font-weight: 650;
}

.btn-small:disabled {
  opacity: 0.65;
  cursor: wait;
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: none;
}

.btn-ghost:hover {
  border-color: rgba(255, 45, 138, 0.5);
  box-shadow: none;
  filter: none;
}

.emails {
  border-top: 1px solid var(--line);
  padding-top: 1.75rem;
  animation: rise 480ms ease both;
}

.emails-head {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.scrape-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

#emails,
#coupons,
#senders {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.email-row {
  padding: 0.9rem 0.95rem;
  border-radius: 0.55rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
}

.email-subject {
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.email-meta {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 0.4rem;
}

.email-snippet {
  color: var(--ink);
  opacity: 0.88;
  font-size: 0.92rem;
  line-height: 1.45;
}

.email-snippet code {
  color: var(--accent);
  font-weight: 700;
}

.sender-form {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.sender-form label {
  font-size: 0.85rem;
  color: var(--muted);
}

.sender-form input[type="text"],
.sender-form textarea {
  width: 100%;
  padding: 0.8rem 0.9rem;
  border-radius: 0.45rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font: inherit;
}

.sender-form textarea {
  resize: vertical;
  min-height: 4.5rem;
}

.sender-form input[type="text"]:focus,
.sender-form textarea:focus {
  outline: none;
  border-color: rgba(255, 45, 138, 0.65);
  box-shadow: 0 0 0 3px rgba(255, 45, 138, 0.15);
}

.sender-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem;
  border-radius: 0.5rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.95rem;
}

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

@keyframes success-in {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Full-page OAuth success */
.success-page-body {
  min-height: 100dvh;
}

.success-page {
  min-height: 100dvh;
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
  gap: 1.1rem;
  padding: 2.5rem 1.25rem;
  max-width: 28rem;
  margin: 0 auto;
  animation: success-in 560ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.success-page .brand-logo {
  margin-bottom: 1.5rem;
}

.success-check {
  position: relative;
  width: 6.5rem;
  height: 6.5rem;
  display: grid;
  place-items: center;
  margin: 0.35rem 0 0.25rem;
}

.success-check-pulse {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(255, 45, 138, 0.22);
  animation: check-pulse 1.8s ease-out 0.55s both infinite;
}

.success-check-ring {
  position: relative;
  z-index: 1;
  width: 5.25rem;
  height: 5.25rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--accent);
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.12), transparent 45%),
    rgba(255, 45, 138, 0.1);
  border: 1px solid rgba(255, 45, 138, 0.4);
  box-shadow:
    0 0 0 6px rgba(255, 45, 138, 0.06),
    0 12px 40px rgba(255, 45, 138, 0.28);
  animation: check-pop 560ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.success-check-svg {
  width: 3.35rem;
  height: 3.35rem;
  overflow: visible;
}

.success-check-circle {
  stroke-dasharray: 190;
  stroke-dashoffset: 190;
  transform-origin: center;
  animation: check-draw-circle 700ms cubic-bezier(0.4, 0, 0.2, 1) 120ms forwards;
}

.success-check-tick {
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  animation: check-draw-tick 480ms cubic-bezier(0.4, 0, 0.2, 1) 520ms forwards;
}

@keyframes check-pop {
  0% {
    opacity: 0;
    transform: scale(0.55);
  }
  70% {
    opacity: 1;
    transform: scale(1.06);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes check-draw-circle {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes check-draw-tick {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes check-pulse {
  0% {
    transform: scale(0.85);
    opacity: 0.55;
  }
  70% {
    transform: scale(1.35);
    opacity: 0;
  }
  100% {
    transform: scale(1.35);
    opacity: 0;
  }
}

.success-page h1 {
  margin: 0.55rem 0 0;
  font-size: clamp(1.85rem, 6vw, 2.4rem);
  color: var(--ink);
}

.success-lede {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  max-width: 32ch;
}

.success-email-line {
  margin: 0.5rem 0 0;
  font-weight: 700;
  font-size: 1.05rem;
  word-break: break-word;
  color: var(--accent);
}

.success-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

@media (prefers-reduced-motion: reduce) {
  .btn,
  .panel,
  .emails,
  .success-page,
  .success-check-ring,
  .success-check-pulse,
  .success-check-circle,
  .success-check-tick,
  .hero .brand-logo,
  .hero h1,
  .hero .lede,
  .hero .connect-panel {
    transition: none;
    animation: none;
  }

  .success-check-circle,
  .success-check-tick {
    stroke-dashoffset: 0;
  }

  .success-check-pulse {
    display: none;
  }
}
