@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Unbounded:wght@500;600;700;800;900&display=swap');

:root {
  --bg: #0a0a0f;
  --surface: #14141c;
  --surface-2: #1c1c28;
  --surface-3: #252532;
  --text: #f5f5f7;
  --muted: #8a8a9a;
  --muted-2: #5a5a68;
  --pink: #ff2e88;
  --purple: #a855f7;
  --cyan: #06b6d4;
  --red: #ff4d6d;
  --gradient: linear-gradient(135deg, #ff2e88 0%, #a855f7 100%);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Manrope', -apple-system, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

/* ═══════════════════════════════════════════
   VIEWS — ЖЁСТКО: только .active виден
   Специфичность 0,2,0 + !important — перебивает
   любые .app-view / .error-view / .placeholder-view
   ═══════════════════════════════════════════ */
.view { display: none !important; }
.view.active { display: flex !important; }

/* ═══════════ TOPBAR / LOGO ═══════════ */
.topbar {
  padding: 24px 6vw;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}
.logo {
  font-family: 'Unbounded', sans-serif;
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -0.5px;
}
.logo span {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.topbar-meta {
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--muted);
  text-transform: uppercase;
}

/* ═══════════ PLACEHOLDER ═══════════ */
#view-placeholder {
  min-height: 100vh;
  flex-direction: column;
  width: 100%;
}
#view-placeholder::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 800px 500px at 80% 0%, rgba(255, 46, 136, 0.15), transparent 60%),
    radial-gradient(ellipse 600px 400px at 20% 100%, rgba(168, 85, 247, 0.12), transparent 60%);
  pointer-events: none;
  z-index: -1;
}
.placeholder-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
}
.placeholder-content { max-width: 560px; width: 100%; text-align: center; }
.badge-construction {
  display: inline-block;
  padding: 8px 16px;
  background: rgba(255, 46, 136, 0.1);
  border: 1px solid rgba(255, 46, 136, 0.3);
  color: #ff8ab8;
  font-size: 11px;
  letter-spacing: 1.5px;
  border-radius: 100px;
  margin-bottom: 28px;
}
.placeholder-content h1 {
  font-family: 'Unbounded', sans-serif;
  font-size: clamp(36px, 6vw, 64px);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -2px;
  margin-bottom: 20px;
}
.placeholder-content h1 em {
  font-style: normal;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.placeholder-desc {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
  margin-bottom: 40px;
}

.redirect-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 32px;
  text-align: left;
}
.redirect-label {
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}
.redirect-form { display: flex; gap: 10px; }
.redirect-form input {
  flex: 1;
  background: #0a0a0f;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  color: var(--text);
  font-family: 'Manrope', monospace;
  font-size: 13px;
  padding: 14px 16px;
  outline: none;
  transition: 0.2s;
}
.redirect-form input:focus { border-color: var(--pink); }
.redirect-form input::placeholder { color: var(--muted-2); }
.redirect-form button {
  background: var(--gradient);
  border: none;
  color: white;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.5px;
  padding: 14px 22px;
  border-radius: 10px;
  transition: 0.2s;
  white-space: nowrap;
}
.redirect-form button:hover { filter: brightness(1.15); transform: translateY(-1px); }
.redirect-hint {
  margin-top: 10px;
  font-size: 11px;
  color: var(--muted-2);
}

.demo-links { text-align: left; }
.demo-label {
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}
.demo-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.demo-buttons a {
  padding: 8px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 12px;
  color: var(--text);
  transition: 0.2s;
}
.demo-buttons a:hover {
  border-color: var(--pink);
  color: var(--pink);
}
.placeholder-footer {
  padding: 24px 6vw;
  display: flex;
  justify-content: space-between;
  color: var(--muted-2);
  font-size: 11px;
  border-top: 1px solid var(--border);
}

/* ═══════════ ERROR VIEWS ═══════════ */
#view-unauthorized,
#view-notfound {
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 24px;
  width: 100%;
  background: radial-gradient(ellipse 800px 500px at 50% 30%, rgba(255, 46, 136, 0.1), transparent 70%);
}
.error-content { text-align: center; max-width: 400px; }
.error-code {
  font-family: 'Unbounded', sans-serif;
  font-size: clamp(96px, 20vw, 160px);
  font-weight: 900;
  line-height: 1;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -8px;
  margin-bottom: 16px;
}
.error-title {
  font-family: 'Unbounded', sans-serif;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 4px;
  margin-bottom: 16px;
}
.error-desc { color: var(--muted); font-size: 14px; line-height: 1.7; margin-bottom: 32px; }
.error-btn {
  display: inline-block;
  padding: 14px 28px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  transition: 0.2s;
}
.error-btn:hover { border-color: var(--pink); color: var(--pink); }

/* ═══════════ APP ═══════════ */
#view-app {
  min-height: 100vh;
  flex-direction: column;
  width: 100%;
  background:
    radial-gradient(ellipse 800px 600px at 50% 0%, rgba(168, 85, 247, 0.08), transparent 60%),
    radial-gradient(ellipse 600px 400px at 50% 100%, rgba(255, 46, 136, 0.06), transparent 60%);
}
.app-header {
  padding: 20px 5vw;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.app-logo {
  font-family: 'Unbounded', sans-serif;
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.5px;
}
.app-logo span {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.app-user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.app-user-label { color: var(--muted); }
.app-user-name {
  font-weight: 700;
  color: var(--text);
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 100px;
}
.app-logout {
  padding: 8px 10px;
  color: var(--muted);
  font-size: 16px;
  transition: 0.2s;
  border-radius: 50%;
}
.app-logout:hover { color: var(--pink); background: var(--surface); }

.app-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  min-height: 0;
}
.card-stack {
  width: 100%;
  max-width: 400px;
  aspect-ratio: 3 / 4.4;
  position: relative;
}

.card {
  width: 100%;
  height: 100%;
  border-radius: 24px;
  overflow: hidden;
  position: relative;
  background: var(--surface);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55), 0 0 0 1px var(--border);
  cursor: pointer;
  animation: cardEnter 0.4s cubic-bezier(0.34, 1.2, 0.64, 1);
}
@keyframes cardEnter {
  from { opacity: 0; transform: scale(0.92) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.card-photo-wrap {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: linear-gradient(135deg, #2a1a30, #14101c);
}
.card-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.6s ease;
}
.card-photo-wrap.no-photo .card-photo { display: none; }
.card-photo-fallback {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  font-family: 'Unbounded', sans-serif;
  font-size: 140px;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.15);
  background: linear-gradient(135deg, rgba(255, 46, 136, 0.15), rgba(168, 85, 247, 0.15));
}
.card-photo-wrap.no-photo .card-photo-fallback { display: flex; }

.photo-dots {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  gap: 4px;
  z-index: 3;
}
.photo-dots .dot {
  flex: 1;
  height: 3px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 2px;
  transition: 0.3s;
}
.photo-dots .dot.active { background: white; }

.card-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.6) 25%, transparent 55%);
  pointer-events: none;
  z-index: 1;
}
.card-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 28px 22px 24px;
  z-index: 2;
}
.card-name-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.card-name {
  font-family: 'Unbounded', sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: white;
  line-height: 1;
  letter-spacing: -0.5px;
}
.card-age {
  font-family: 'Unbounded', sans-serif;
  font-size: 22px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.85);
}
.para-badge {
  padding: 4px 10px;
  background: rgba(255, 46, 136, 0.15);
  border: 1px solid rgba(255, 46, 136, 0.4);
  color: #ff8ab8;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  border-radius: 100px;
  text-transform: uppercase;
}
.card-bio {
  font-size: 13px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.85);
  max-width: 95%;
}

.card-empty {
  width: 100%;
  height: 100%;
  border-radius: 24px;
  border: 2px dashed var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  padding: 40px;
}

.app-actions {
  display: flex;
  justify-content: center;
  gap: 20px;
  padding: 16px 20px 20px;
  flex-shrink: 0;
}
.action-btn {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 2px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: 0.2s;
  padding: 14px;
}
.action-btn svg { width: 100%; height: 100%; }
.action-btn:hover { transform: scale(1.08); }
.action-btn:active { transform: scale(0.95); }
.action-btn.dislike { color: var(--red); border-color: rgba(255, 77, 109, 0.35); }
.action-btn.dislike:hover { background: rgba(255, 77, 109, 0.12); box-shadow: 0 0 30px rgba(255, 77, 109, 0.25); }
.action-btn.skip { color: var(--cyan); border-color: rgba(6, 182, 212, 0.35); }
.action-btn.skip:hover { background: rgba(6, 182, 212, 0.12); box-shadow: 0 0 30px rgba(6, 182, 212, 0.25); }
.action-btn.like {
  width: 70px;
  height: 70px;
  color: white;
  background: var(--gradient);
  border: none;
  box-shadow: 0 8px 30px rgba(255, 46, 136, 0.35);
}
.action-btn.like:hover { box-shadow: 0 12px 40px rgba(255, 46, 136, 0.5); }

.app-hint {
  text-align: center;
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted-2);
  padding-bottom: 20px;
  flex-shrink: 0;
}

/* ═══════════ MATCH OVERLAY ═══════════ */
.match-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(10, 10, 15, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.35s ease;
  overflow-y: auto;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.match-card {
  max-width: 420px;
  width: 100%;
  text-align: center;
  animation: popIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  padding: 20px 0;
}
@keyframes popIn {
  from { opacity: 0; transform: scale(0.85); }
  to   { opacity: 1; transform: scale(1); }
}
.match-badge {
  display: inline-block;
  font-family: 'Unbounded', sans-serif;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 3px;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 24px;
  text-transform: uppercase;
}
.match-photo-wrap {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  margin: 0 auto 22px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #2a1a30, #14101c);
  border: 3px solid transparent;
  background-clip: padding-box;
  box-shadow: 0 0 0 3px rgba(255, 46, 136, 0.5), 0 20px 60px rgba(255, 46, 136, 0.3);
}
.match-photo-wrap::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: var(--gradient);
  z-index: -1;
}
#matchPhoto {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.match-photo-fallback {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  font-family: 'Unbounded', sans-serif;
  font-size: 80px;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.4);
  background: linear-gradient(135deg, rgba(255, 46, 136, 0.25), rgba(168, 85, 247, 0.25));
}
.match-photo-wrap.no-photo .match-photo-fallback { display: flex; }
.match-photo-wrap.no-photo #matchPhoto { display: none; }

.match-name {
  font-family: 'Unbounded', sans-serif;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 8px;
}
.match-meta {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 14px;
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}
.match-meta .meta-para {
  padding: 4px 10px;
  background: rgba(255, 46, 136, 0.15);
  border: 1px solid rgba(255, 46, 136, 0.4);
  color: #ff8ab8;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  border-radius: 100px;
  text-transform: uppercase;
}
.match-note {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 28px;
  line-height: 1.6;
}
.match-actions {
  display: flex;
  gap: 10px;
  max-width: 340px;
  margin: 0 auto;
}
.match-btn {
  flex: 1;
  padding: 16px 20px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.3px;
  border: none;
  transition: 0.2s;
}
.match-btn.primary {
  background: var(--gradient);
  color: white;
  box-shadow: 0 8px 30px rgba(255, 46, 136, 0.35);
}
.match-btn.primary:hover { filter: brightness(1.15); transform: translateY(-1px); }
.match-btn.secondary {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
}
.match-btn.secondary:hover { border-color: var(--pink); color: var(--pink); }
.match-escape {
  font-size: 11px;
  color: var(--muted-2);
  margin-top: 18px;
  letter-spacing: 0.5px;
  min-height: 16px;
  font-style: italic;
}

/* ═══════════ TOAST ═══════════ */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translate(-50%, 140%);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  padding: 14px 22px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6);
  z-index: 200;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-width: 90vw;
  text-align: center;
}
.toast.show { transform: translate(-50%, 0); }

/* ═══════════ RESPONSIVE ═══════════ */
@media (max-width: 600px) {
  .card-stack { max-width: 100%; aspect-ratio: auto; height: calc(100vh - 260px); min-height: 400px; }
  .card-name { font-size: 24px; }
  .card-age { font-size: 20px; }
  .app-stage { padding: 12px; }
  .action-btn { width: 56px; height: 56px; }
  .action-btn.like { width: 64px; height: 64px; }
  .placeholder-content h1 { font-size: 36px; }
  .redirect-form { flex-direction: column; }
  .match-photo-wrap { width: 160px; height: 160px; }
  .match-name { font-size: 26px; }
  .match-actions { flex-direction: column; }
}