:root {
  --bg-deep: #121413;
  --bg-mid: #1c1f1e;
  --surface: #262626;
  --text: #fafafa;
  --text-muted: #a8a8a8;
  --turquoise: #1ab298;
  --turquoise-light: #1fedc9;
  --cyan: #00d8df;
  --mint: #00feba;
  --health: #f88461;
  --fitness: #9c77fd;
  --skills: #2ab486;
  --card-radius: 8px;
  --font-body: "Figtree", system-ui, sans-serif;
  --font-display: "Syne", "Figtree", system-ui, sans-serif;
}

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

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

body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg-deep);
  overflow-x: hidden;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(26, 178, 152, 0.22), transparent 55%),
    radial-gradient(90% 60% at 80% 90%, rgba(0, 216, 223, 0.1), transparent 50%),
    linear-gradient(180deg, #161a19 0%, var(--bg-deep) 45%, #0d100f 100%);
}

.glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(64px);
  opacity: 0.55;
}

.glow-a {
  width: min(48vw, 420px);
  height: min(48vw, 420px);
  left: 50%;
  top: 58%;
  translate: -50% -20%;
  background: rgba(31, 237, 201, 0.16);
  animation: pulse-glow 7s ease-in-out infinite;
}

.glow-b {
  width: min(36vw, 280px);
  height: min(36vw, 280px);
  right: 8%;
  top: 18%;
  background: rgba(0, 216, 223, 0.1);
  animation: pulse-glow 9s ease-in-out infinite reverse;
}

.grain {
  position: absolute;
  inset: 0;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.hero {
  position: relative;
  z-index: 1;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: clamp(1.25rem, 4vw, 2.5rem) 1.25rem;
  text-align: center;
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  opacity: 0;
  transform: translateY(12px);
  animation: rise-in 700ms cubic-bezier(0.22, 1, 0.36, 1) 80ms forwards;
}

.brand-mark {
  width: 40px;
  height: 40px;
  filter: drop-shadow(0 0 18px rgba(31, 237, 201, 0.35));
}

.brand-wordmark {
  width: clamp(168px, 42vw, 240px);
  height: auto;
  filter: drop-shadow(0 2px 24px rgba(0, 216, 223, 0.25));
}

.tagline {
  margin: 1.15rem 0 0;
  max-width: 28ch;
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 3.4vw, 1.55rem);
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.02em;
  color: var(--text);
  opacity: 0;
  transform: translateY(12px);
  animation: rise-in 700ms cubic-bezier(0.22, 1, 0.36, 1) 180ms forwards;
}

.downloads {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.5rem;
  opacity: 0;
  transform: translateY(12px);
  animation: rise-in 700ms cubic-bezier(0.22, 1, 0.36, 1) 280ms forwards;
}

.store-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 168px;
  padding: 0.7rem 1.05rem;
  border-radius: 14px;
  border: 1px solid rgba(250, 250, 250, 0.14);
  background: rgba(38, 38, 38, 0.88);
  color: var(--text);
  text-decoration: none;
  backdrop-filter: blur(10px);
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background 180ms ease,
    box-shadow 180ms ease;
}

.store-btn:hover {
  transform: translateY(-2px);
  border-color: rgba(31, 237, 201, 0.45);
  background: rgba(45, 45, 45, 0.95);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

.store-btn:focus-visible {
  outline: 2px solid var(--turquoise-light);
  outline-offset: 3px;
}

.store-icon {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
}

.store-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.1;
}

.store-eyebrow {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

.store-name {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.fan-stage {
  flex: 0 0 auto;
  width: min(100%, 720px);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: clamp(1.25rem, 3.5vh, 2rem);
  /* Room for rotated card corners so they aren't clipped */
  padding: clamp(0.75rem, 2vh, 1.25rem) 0 clamp(1rem, 3vh, 1.75rem);
  min-height: 0;
  overflow: visible;
}

.fan-stack {
  position: relative;
  height: var(--card-h, 280px);
  width: var(--fan-w, 220px);
}

.fan-card {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: var(--card-w, 160px);
  height: var(--card-h, 280px);
  margin-left: calc(var(--card-w, 160px) / -2);
  transform-origin: bottom center;
  will-change: transform, opacity;
  border-radius: var(--card-radius);
  overflow: hidden;
  box-shadow:
    0 18px 40px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(255, 255, 255, 0.04);
}

.fan-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: #2a1f17;
}

/* Frame is the card chrome background; title/progress/art sit above it
   (same layering as HabitCardWidget in the Flutter app). */
.fan-card-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
  z-index: 0;
}

.fan-card-chrome {
  position: relative;
  z-index: 1;
  padding: 5.5% 6% 0;
  text-align: left;
  flex-shrink: 0;
}

.fan-card-title {
  margin: 0;
  font-family: var(--font-body);
  font-size: clamp(0.72rem, 2.1vw, 0.95rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.fan-card-category {
  margin: 0.15rem 0 0;
  font-size: clamp(0.55rem, 1.5vw, 0.68rem);
  font-weight: 500;
  color: rgba(255, 255, 255, 0.72);
  text-transform: capitalize;
}

.fan-card-progress {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 6% 0.25rem;
  flex-shrink: 0;
}

.fan-card-stars {
  color: #f59e0b;
  font-size: clamp(0.55rem, 1.4vw, 0.7rem);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.fan-card-bar {
  flex: 1;
  height: 4px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.fan-card-bar > span {
  display: block;
  height: 100%;
  width: var(--progress, 40%);
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--turquoise-light));
}

.fan-card-count {
  font-size: clamp(0.5rem, 1.3vw, 0.62rem);
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
}

.fan-card-art-wrap {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  margin: 0 5.5% 4.5%;
  border-radius: 6px;
  overflow: hidden;
  min-height: 0;
  background: rgba(0, 0, 0, 0.25);
}

.fan-card-art {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}

.fan-card[data-checked="false"]::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  background: rgba(0, 0, 0, 0.48);
  border-radius: inherit;
  pointer-events: none;
}

@keyframes rise-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse-glow {
  0%,
  100% {
    opacity: 0.4;
    scale: 1;
  }
  50% {
    opacity: 0.7;
    scale: 1.08;
  }
}

@media (max-width: 480px) {
  .downloads {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .store-btn {
    justify-content: center;
    min-width: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .brand,
  .tagline,
  .downloads,
  .glow-a,
  .glow-b {
    animation: none !important;
    opacity: 1;
    transform: none;
  }
}
