@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Playfair+Display:ital,wght@1,600&display=swap");

:root {
  --ink: #2c2925;
  --paper: #f6efe5;
  --cream: #fffaf2;
  --terracotta: #d86f4b;
  --sage: #607c6b;
  --gold: #d9a443;
  --line: rgba(44, 41, 37, .14);
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--paper); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 8%, rgba(216,111,75,.13), transparent 25rem),
    radial-gradient(circle at 92% 95%, rgba(96,124,107,.13), transparent 28rem),
    var(--paper);
  font-family: "DM Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }
a { color: inherit; text-decoration: none; }

.flash {
  position: fixed;
  z-index: 20;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  padding: .8rem 1.1rem;
  border-radius: 999px;
  color: white;
  background: var(--terracotta);
  box-shadow: 0 8px 30px rgba(44,41,37,.18);
}

.landing-shell {
  width: min(1120px, calc(100% - 2rem));
  min-height: 100vh;
  margin: auto;
  padding: 1.6rem 0 3rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  font-size: .98rem;
  font-weight: 700;
  letter-spacing: -.02em;
}

.brand-mark {
  display: grid;
  width: 2.25rem;
  height: 2.25rem;
  place-items: center;
  border-radius: 50% 50% 48% 52% / 54% 47% 53% 46%;
  color: var(--cream);
  background: var(--terracotta);
  font: italic 600 1.35rem "Playfair Display", serif;
  transform: rotate(-7deg);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, .8fr);
  column-gap: clamp(3rem, 8vw, 8rem);
  align-items: center;
  min-height: 72vh;
  padding: 3rem 3vw 1rem;
}

.hero > .eyebrow, .hero > h1, .hero > .hero-copy { grid-column: 1; }
.hero > .setup-card, .hero > .join-panel { grid-column: 2; }
.hero > .setup-card { grid-row: 1 / span 3; align-self: end; }
.hero > .join-panel { grid-row: 4; }

.eyebrow {
  align-self: end;
  margin-bottom: 1.2rem;
  color: var(--terracotta);
  font-size: .71rem;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.hero h1, .matches-hero h1 {
  margin: 0;
  font-size: clamp(3.6rem, 7vw, 7.2rem);
  font-weight: 500;
  line-height: .88;
  letter-spacing: -.07em;
}

.hero h1 em, .matches-hero h1 em {
  color: var(--terracotta);
  font-family: "Playfair Display", Georgia, serif;
  font-weight: 600;
}

.hero-copy {
  max-width: 34rem;
  margin: 2rem 0 0;
  color: rgba(44,41,37,.68);
  font-size: 1.05rem;
  line-height: 1.7;
}

.setup-card {
  padding: 1.7rem;
  border: 1px solid rgba(255,255,255,.8);
  border-radius: 1.6rem;
  background: rgba(255,250,242,.82);
  box-shadow: 0 30px 80px rgba(71,58,43,.12);
  backdrop-filter: blur(12px);
}

.step-label {
  margin-bottom: 1.25rem;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.setup-form { display: grid; gap: 1rem; }

.setup-form label { display: grid; gap: .45rem; }
.setup-form label span { font-size: .75rem; font-weight: 600; }

input, select {
  width: 100%;
  padding: .9rem 1rem;
  border: 1px solid var(--line);
  border-radius: .8rem;
  outline: none;
  color: var(--ink);
  background: rgba(255,255,255,.72);
}

input:focus, select:focus {
  border-color: var(--terracotta);
  box-shadow: 0 0 0 3px rgba(216,111,75,.12);
}

.primary-button, .secondary-button {
  display: inline-flex;
  min-height: 3.2rem;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: .85rem;
  padding: .9rem 1.15rem;
  cursor: pointer;
  font-weight: 700;
}

.primary-button {
  color: white;
  background: var(--ink);
  box-shadow: 0 8px 24px rgba(44,41,37,.18);
}

.secondary-button { background: rgba(44,41,37,.08); }

.join-panel { margin-top: 1rem; color: rgba(44,41,37,.65); font-size: .82rem; }
.join-panel summary { cursor: pointer; text-align: center; }
.join-form { display: grid; grid-template-columns: .8fr 1fr auto; gap: .5rem; margin-top: .7rem; }

.how-it-works {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--line);
}

.how-it-works div {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.2rem 1rem;
  border-right: 1px solid var(--line);
  color: rgba(44,41,37,.7);
  font-size: .8rem;
}

.how-it-works div:last-child { border-right: 0; }
.how-it-works b { color: var(--terracotta); font-size: .65rem; letter-spacing: .12em; }

.app-shell {
  width: min(560px, 100%);
  min-height: 100dvh;
  margin: auto;
  position: relative;
  padding: env(safe-area-inset-top) 1.1rem calc(6.5rem + env(safe-area-inset-bottom));
  overflow: hidden;
  background: rgba(246,239,229,.72);
}

.app-header {
  display: flex;
  height: 5.25rem;
  align-items: center;
  justify-content: space-between;
}

.brand.compact { font-size: .9rem; }
.brand.compact .brand-mark { width: 1.95rem; height: 1.95rem; font-size: 1.1rem; }

.matches-pill {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .55rem .8rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 700;
  background: rgba(255,250,242,.7);
}
.matches-pill > span:first-child { color: var(--terracotta); }

.welcome-card {
  position: fixed;
  z-index: 10;
  inset: 50% auto auto 50%;
  width: min(420px, calc(100% - 2rem));
  padding: 2rem;
  border-radius: 1.5rem;
  background: var(--cream);
  box-shadow: 0 30px 100px rgba(44,41,37,.3);
  transform: translate(-50%, -50%);
}

.welcome-card::before {
  content: "";
  position: fixed;
  z-index: -2;
  inset: -100vh -100vw;
  background: rgba(44,41,37,.42);
  backdrop-filter: blur(4px);
}

.welcome-card h2 { margin: 0 0 .6rem; font-size: 2rem; letter-spacing: -.04em; }
.welcome-card p { color: rgba(44,41,37,.68); line-height: 1.55; }
.welcome-card .share-button { width: 100%; }
.close-button { position: absolute; top: .8rem; right: .9rem; border: 0; background: none; font-size: 1.6rem; cursor: pointer; }
.couple-code { margin-top: 1rem; text-align: center; font-size: .72rem; color: rgba(44,41,37,.56); }
.couple-code strong { margin-left: .3rem; color: var(--ink); letter-spacing: .12em; }

.swipe-stage { padding-top: .5rem; }

.player-line {
  display: flex;
  justify-content: space-between;
  margin-bottom: .9rem;
  color: rgba(44,41,37,.55);
  font-size: .72rem;
}
.player-line strong { color: var(--ink); }

.card-stack {
  height: min(58dvh, 500px);
  min-height: 390px;
  position: relative;
  perspective: 1000px;
}

.name-card {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border: 1px solid rgba(44,41,37,.1);
  border-radius: 2rem;
  user-select: none;
  touch-action: none;
  background:
    linear-gradient(135deg, rgba(255,255,255,.52), transparent 48%),
    var(--cream);
  box-shadow: 0 28px 60px rgba(71,58,43,.13);
  transition: transform .24s ease, opacity .24s ease;
}

.name-card::after {
  content: "";
  position: absolute;
  inset: 1rem;
  border: 1px solid rgba(216,111,75,.16);
  border-radius: 1.35rem;
  pointer-events: none;
}

.ghost-card {
  inset: .7rem 1rem -.7rem;
  background: rgba(255,250,242,.65);
  transform: rotate(2deg);
  box-shadow: none;
}

.name-card.dragging { transition: none; }
.name-card h1 {
  max-width: 90%;
  margin: 0;
  font-size: clamp(3rem, 14vw, 5.5rem);
  font-weight: 500;
  letter-spacing: -.07em;
  text-align: center;
  overflow-wrap: anywhere;
}

.card-flourish { position: absolute; top: 2.2rem; color: var(--gold); font-size: 1.3rem; }
.card-note { position: absolute; bottom: 2rem; color: rgba(44,41,37,.4); font: italic 600 .95rem "Playfair Display", serif; }

.decision-stamp {
  position: absolute;
  z-index: 2;
  top: 2.5rem;
  padding: .45rem .65rem;
  border: 3px solid;
  border-radius: .4rem;
  opacity: 0;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: .08em;
}
.decision-stamp.yes { left: 2rem; color: var(--sage); transform: rotate(-9deg); }
.decision-stamp.nope { right: 2rem; color: var(--terracotta); transform: rotate(9deg); }
.name-card.fly-right { transform: translateX(130vw) rotate(22deg) !important; opacity: 0; }
.name-card.fly-left { transform: translateX(-130vw) rotate(-22deg) !important; opacity: 0; }

.swipe-actions {
  display: grid;
  grid-template-columns: 5rem 1fr 5rem;
  align-items: center;
  gap: 1rem;
  padding: 1.2rem 1rem .6rem;
}

.action-button {
  display: grid;
  width: 4.8rem;
  height: 4.8rem;
  place-items: center;
  align-content: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  cursor: pointer;
  background: var(--cream);
  box-shadow: 0 12px 30px rgba(71,58,43,.1);
  transition: transform .15s ease;
}
.action-button:active { transform: scale(.92); }
.action-button span { font-size: 2rem; line-height: 1; }
.action-button small { margin-top: .2rem; font-size: .58rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.action-button.dislike { color: var(--terracotta); }
.action-button.like { color: white; border-color: var(--sage); background: var(--sage); }
.swipe-hint { color: rgba(44,41,37,.34); font-size: .65rem; letter-spacing: .08em; text-align: center; text-transform: uppercase; }

.bottom-nav {
  position: fixed;
  z-index: 5;
  bottom: 0;
  left: 50%;
  display: grid;
  width: min(560px, 100%);
  grid-template-columns: 1fr 1fr;
  padding: .7rem 1rem calc(.7rem + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(246,239,229,.92);
  backdrop-filter: blur(18px);
  transform: translateX(-50%);
}

.bottom-nav a { display: grid; gap: .2rem; place-items: center; color: rgba(44,41,37,.4); font-size: .67rem; font-weight: 700; }
.bottom-nav a span { font-size: 1.25rem; }
.bottom-nav a.active { color: var(--terracotta); }

.matches-page { min-height: 100dvh; overflow: visible; }
.couple-mini { font-size: .68rem; color: rgba(44,41,37,.48); }
.couple-mini strong { color: var(--ink); letter-spacing: .1em; }

.matches-hero { padding: 2.5rem .5rem 2rem; }
.matches-hero h1 { font-size: clamp(3.2rem, 16vw, 5.5rem); }
.matches-hero p { color: rgba(44,41,37,.52); font-size: .78rem; }

.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.match-card {
  min-height: 9rem;
  position: relative;
  display: grid;
  align-content: center;
  padding: 1.2rem;
  border: 1px solid rgba(44,41,37,.08);
  border-radius: 1.2rem;
  background: rgba(255,250,242,.82);
  box-shadow: 0 12px 30px rgba(71,58,43,.07);
}
.match-card h2 { margin: .5rem 0; font-size: 1.5rem; letter-spacing: -.04em; overflow-wrap: anywhere; }
.match-number { color: var(--terracotta); font-size: .6rem; font-weight: 700; letter-spacing: .1em; }
.matched-hearts { color: var(--sage); font-size: .65rem; letter-spacing: -.2em; }

.empty-state { padding: 15vh 2rem 2rem; text-align: center; }
.empty-state h1, .empty-state h2 { margin: 1rem 0 .5rem; font-size: 2rem; letter-spacing: -.04em; }
.empty-state p { max-width: 22rem; margin: 0 auto 1.5rem; color: rgba(44,41,37,.58); line-height: 1.6; }
.big-heart { color: var(--terracotta); font-size: 3rem; }
.compact-empty { margin-top: 2rem; padding-top: 4rem; border: 1px dashed var(--line); border-radius: 1.4rem; }
.orbit-hearts { display: flex; justify-content: center; gap: 1.4rem; color: var(--terracotta); font-size: 1.6rem; }

@media (max-width: 760px) {
  .landing-shell { width: min(100% - 1.4rem, 560px); }
  .hero { display: block; min-height: auto; padding: 4rem .35rem 2rem; }
  .hero h1 { font-size: clamp(3.45rem, 17vw, 5rem); }
  .hero-copy { margin-bottom: 2rem; }
  .setup-card { padding: 1.25rem; }
  .how-it-works { grid-template-columns: 1fr; }
  .how-it-works div { border-right: 0; border-bottom: 1px solid var(--line); }
  .join-form { grid-template-columns: 1fr; }
}

@media (max-height: 720px) {
  .card-stack { height: 54dvh; min-height: 340px; }
  .swipe-actions { padding-top: .7rem; }
  .action-button { width: 4.2rem; height: 4.2rem; }
}

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