:root {
  --pink:    #ff4b7e;
  --green:   #2ed47a;
  --yellow:  #ffcc00;
  --purple:  #8b5cf6;
  --blue:    #3b82f6;
  --bg:      #1a0a2e;
  --surface: #2a1547;
  --card-bg: #ffffff;
  --text:    #1a0a2e;
  --muted:   #6b7280;
  --radius:  20px;
  --shadow:  0 20px 60px rgba(0,0,0,.45);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Nunito', sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100dvh;
  overflow: hidden;
  user-select: none;
}

/* ── Splash ── */
.splash {
  position: fixed; inset: 0;
  background: linear-gradient(160deg, #1a0a2e 0%, #3d1a6e 60%, #1a0a2e 100%);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  transition: opacity .5s, transform .5s;
}

.splash.fade-out { opacity: 0; transform: scale(1.05); pointer-events: none; }

.splash-inner {
  position: relative; z-index: 2;
  text-align: center;
  padding: 2rem;
}

.splash-logo { font-size: 5rem; line-height: 1; margin-bottom: .5rem; animation: bounce 1.5s infinite; }

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-12px); }
}

.splash-title {
  font-family: 'Fredoka One', cursive;
  font-size: 3.5rem;
  color: #fff;
  text-shadow: 0 2px 20px rgba(255,75,126,.6);
  margin-bottom: .3rem;
}

.splash-sub {
  color: var(--yellow);
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: 1.4rem;
}

.splash-tagline {
  color: rgba(255,255,255,.8);
  font-size: 1.1rem;
  line-height: 1.6;
  margin-bottom: 2rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--pink), #c026d3);
  color: #fff;
  border: none;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 1.05rem;
  padding: .9rem 2.4rem;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(255,75,126,.4);
  transition: transform .15s, box-shadow .15s;
  display: block;
  margin: 0 auto .8rem;
}

.btn-primary:hover { transform: scale(1.05); box-shadow: 0 12px 32px rgba(255,75,126,.6); }
.btn-primary:active { transform: scale(.97); }

.btn-ghost {
  background: transparent;
  border: 2px solid rgba(255,255,255,.3);
  color: rgba(255,255,255,.7);
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: .95rem;
  padding: .6rem 1.8rem;
  border-radius: 50px;
  cursor: pointer;
  transition: border-color .2s, color .2s;
  display: block;
  margin: 0 auto;
}

.btn-ghost:hover { border-color: rgba(255,255,255,.7); color: #fff; }

.splash-fine {
  color: rgba(255,255,255,.35);
  font-size: .75rem;
  margin-top: .6rem;
}

.splash-bg-emojis {
  position: absolute; inset: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(3, 1fr);
  font-size: 2.5rem;
  opacity: .07;
  pointer-events: none;
  place-items: center;
}

/* ── App ── */
.app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  background: linear-gradient(180deg, #2a1547 0%, #1a0a2e 100%);
}

/* ── Topbar ── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .9rem 1.2rem;
  flex-shrink: 0;
}

.topbar-logo {
  font-family: 'Fredoka One', cursive;
  font-size: 1.5rem;
  color: #fff;
  text-shadow: 0 2px 10px rgba(255,75,126,.5);
}

.icon-btn {
  background: rgba(255,255,255,.08);
  border: none;
  color: #fff;
  font-size: 1.2rem;
  width: 44px; height: 44px;
  border-radius: 50%;
  cursor: pointer;
  transition: background .2s;
  position: relative;
}

.icon-btn:hover { background: rgba(255,255,255,.18); }

.badge {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--pink);
  color: #fff;
  font-size: .65rem;
  font-weight: 800;
  min-width: 18px; height: 18px;
  border-radius: 50px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
}

/* ── Card area ── */
.card-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 0 1rem;
}

.card-stack {
  position: relative;
  width: 100%;
  max-width: 360px;
  aspect-ratio: 3/4;
}

/* ── Swipe labels ── */
.swipe-label {
  position: absolute;
  top: 2rem;
  font-family: 'Fredoka One', cursive;
  font-size: 2rem;
  border: 4px solid;
  border-radius: 12px;
  padding: .3rem .9rem;
  transform: rotate(-20deg);
  opacity: 0;
  pointer-events: none;
  z-index: 50;
  transition: opacity .1s;
}

.swipe-label.like  { left: 1.5rem; color: var(--green);  border-color: var(--green);  transform: rotate(-20deg); }
.swipe-label.nope  { right: 1.5rem; color: var(--pink);  border-color: var(--pink);   transform: rotate(20deg); }
.swipe-label.super { left: 50%; transform: translateX(-50%) rotate(0); top: 1rem; color: var(--yellow); border-color: var(--yellow); }

/* ── Card ── */
.horse-card {
  position: absolute;
  inset: 0;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  will-change: transform;
  transition: transform .05s;
}

.horse-card:active { cursor: grabbing; }

.horse-card.animating {
  transition: transform .4s cubic-bezier(.17,.67,.38,.99), opacity .4s;
}

.horse-card.swiped-right { transform: translateX(150%) rotate(30deg) !important; opacity: 0; }
.horse-card.swiped-left  { transform: translateX(-150%) rotate(-30deg) !important; opacity: 0; }
.horse-card.swiped-super { transform: translateY(-150%) !important; opacity: 0; }

.card-photo {
  width: 100%;
  height: 68%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8rem;
  position: relative;
  overflow: hidden;
}

.card-gradient {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 60%;
  background: linear-gradient(transparent, rgba(0,0,0,.6));
}

.card-tag {
  position: absolute;
  top: .8rem; right: .8rem;
  background: rgba(0,0,0,.45);
  color: #fff;
  font-size: .75rem;
  font-weight: 800;
  padding: .25rem .65rem;
  border-radius: 50px;
  backdrop-filter: blur(4px);
}

.card-info {
  padding: .9rem 1.1rem;
}

.card-name {
  font-family: 'Fredoka One', cursive;
  font-size: 1.6rem;
  color: var(--text);
  line-height: 1;
}

.card-age {
  font-size: .9rem;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: .4rem;
}

.card-bio {
  font-size: .87rem;
  color: #374151;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-traits {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  margin-top: .6rem;
}

.trait {
  background: #f3e8ff;
  color: #7c3aed;
  font-size: .72rem;
  font-weight: 700;
  padding: .2rem .55rem;
  border-radius: 50px;
}

/* back cards */
.horse-card:nth-child(2) { transform: scale(.95) translateY(12px); z-index: 1; }
.horse-card:nth-child(3) { transform: scale(.90) translateY(24px); z-index: 0; }

/* ── Action buttons ── */
.actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
  padding: 1rem 1rem 1.4rem;
  flex-shrink: 0;
}

.action-btn {
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.5rem;
  display: flex; align-items: center; justify-content: center;
  transition: transform .15s, box-shadow .15s;
  box-shadow: 0 6px 20px rgba(0,0,0,.35);
}

.action-btn.nope  { width: 60px; height: 60px; background: #fff; color: var(--pink);   box-shadow: 0 6px 20px rgba(255,75,126,.3); }
.action-btn.like  { width: 60px; height: 60px; background: #fff; color: var(--green);  box-shadow: 0 6px 20px rgba(46,212,122,.3); }
.action-btn.super { width: 52px; height: 52px; background: #fff; color: var(--yellow); box-shadow: 0 6px 20px rgba(255,204,0,.3); }

.action-btn:hover { transform: scale(1.12); }
.action-btn:active { transform: scale(.95); }

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 2rem;
  color: rgba(255,255,255,.85);
}

.empty-icon { font-size: 5rem; margin-bottom: 1rem; }
.empty-state h2 { font-family: 'Fredoka One', cursive; font-size: 1.8rem; color: #fff; margin-bottom: .5rem; }
.empty-state p  { font-size: .95rem; color: rgba(255,255,255,.6); line-height: 1.5; margin-bottom: 1.5rem; }

/* ── Match overlay ── */
.match-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.75);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
  backdrop-filter: blur(8px);
  animation: fadeIn .3s;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.match-box {
  background: linear-gradient(160deg, #2a1547, #3d1a6e);
  border-radius: 24px;
  padding: 2.5rem 2rem;
  text-align: center;
  max-width: 340px;
  width: 90%;
  box-shadow: 0 24px 80px rgba(255,75,126,.4);
  border: 1px solid rgba(255,255,255,.1);
  animation: popIn .4s cubic-bezier(.175,.885,.32,1.275);
}

@keyframes popIn {
  from { transform: scale(.6); opacity: 0; }
  to   { transform: scale(1);  opacity: 1; }
}

.match-sparkles { font-size: 1.5rem; margin-bottom: .5rem; }

.match-title {
  font-family: 'Fredoka One', cursive;
  font-size: 2.5rem;
  background: linear-gradient(135deg, var(--yellow), var(--pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: .4rem;
}

.match-sub {
  color: rgba(255,255,255,.8);
  font-size: .95rem;
  margin-bottom: 1.5rem;
}

.match-photos {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .8rem;
  margin-bottom: 1.5rem;
}

.match-photo {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: rgba(255,255,255,.1);
  display: flex; align-items: center; justify-content: center;
  font-size: 3rem;
  border: 3px solid var(--pink);
}

.match-heart { font-size: 2rem; animation: pulse 1s infinite; }

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.3); }
}

/* ── Panel ── */
.panel {
  position: fixed; inset: 0;
  background: linear-gradient(160deg, #1a0a2e, #2a1547);
  z-index: 150;
  display: flex; flex-direction: column;
  animation: slideUp .3s ease;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem 1.4rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.panel-header h2 {
  color: #fff;
  font-family: 'Fredoka One', cursive;
  font-size: 1.5rem;
}

.panel-close {
  background: rgba(255,255,255,.1);
  border: none;
  color: #fff;
  font-size: 1rem;
  width: 36px; height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-family: inherit;
  font-weight: 700;
  transition: background .2s;
}

.panel-close:hover { background: rgba(255,255,255,.2); }

.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.4rem;
}

.no-matches {
  color: rgba(255,255,255,.4);
  text-align: center;
  margin-top: 3rem;
  font-size: .95rem;
}

/* Match list item */
.match-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .9rem 0;
  border-bottom: 1px solid rgba(255,255,255,.06);
  color: #fff;
}

.match-item-emoji { font-size: 2.5rem; }
.match-item-info { flex: 1; }
.match-item-name { font-weight: 800; font-size: 1rem; }
.match-item-msg  { font-size: .82rem; color: rgba(255,255,255,.5); margin-top: .1rem; }
.match-item-time { font-size: .75rem; color: rgba(255,255,255,.3); }

/* Profile panel */
.profile-avatar {
  font-size: 5rem;
  text-align: center;
  margin: 1.2rem 0 1.5rem;
}

.profile-field {
  margin-bottom: 1rem;
}

.profile-field label {
  display: block;
  color: rgba(255,255,255,.5);
  font-size: .82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: .35rem;
}

.profile-field input,
.profile-field textarea {
  width: 100%;
  background: rgba(255,255,255,.07);
  border: 1.5px solid rgba(255,255,255,.12);
  border-radius: 12px;
  color: #fff;
  font-family: 'Nunito', sans-serif;
  font-size: .95rem;
  font-weight: 600;
  padding: .7rem 1rem;
  outline: none;
  transition: border-color .2s;
  resize: vertical;
}

.profile-field input:focus,
.profile-field textarea:focus { border-color: var(--purple); }

.profile-field span {
  color: rgba(255,255,255,.4);
  font-size: .85rem;
  margin-left: .3rem;
}

/* ── Utilities ── */
.hidden { display: none !important; }

.backdrop {
  position: fixed; inset: 0;
  z-index: 140;
  background: transparent;
}

/* ── Responsive ── */
@media (max-height: 700px) {
  .card-area { padding: 0 .6rem; }
  .splash-logo { font-size: 3.5rem; }
  .splash-title { font-size: 2.5rem; }
}
