:root {
  --brand: #FF3B5C;
  --brand-dark: #E72A4A;
  --brand-soft: #1a1a1a;
  --bg: #f3f4f6;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.18);
  --online: #10b981;
  --verified: #10b981;
  --verified-bg: #d1fae5;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

/* Topbar */
.topbar {
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 14px 24px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
}

.brand {
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
}
.brand-strong { color: var(--text); }
.brand-soft { color: var(--brand); margin-left: 4px; }

.search input {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  display: block;
  padding: 10px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f9fafb;
  font-size: 0.95rem;
  outline: none;
}
.search input:focus { border-color: var(--brand); }

.register-btn {
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 10px 22px;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  cursor: pointer;
}
.register-btn:hover { background: var(--brand-dark); }

/* Profiles grid */
.page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
}

.profiles-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
}

@media (max-width: 1024px) {
  .profiles-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
  .profiles-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .topbar-inner { grid-template-columns: auto auto; gap: 12px; }
  .search { grid-column: 1 / -1; order: 3; }
  .page { padding: 16px; }
}
@media (max-width: 480px) {
  /* Mobile: dwa profile obok siebie (gęsty grid jak Tinder/Bumble swipe-list) */
  .profiles-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .page { padding: 10px; }
  .tile-body { padding: 10px 10px 12px; }
  .tile-name { font-size: 0.9rem; }
  .tile-location { font-size: 0.75rem; margin-bottom: 8px; }
  .tile-cta { font-size: 0.72rem; padding: 8px; letter-spacing: 0.02em; }
  .tile-online-badge { font-size: 0.65rem; padding: 2px 7px; bottom: 8px; left: 8px; }
  .locked-cta { font-size: 0.68rem; padding: 8px 12px; }
}

.tile {
  background: var(--card);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.tile-photo {
  position: relative;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  cursor: pointer;
  background: #e5e7eb;
}

.tile-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tile-online-badge {
  position: absolute;
  bottom: 10px;
  left: 10px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.tile-online-badge::before {
  content: "●";
  color: var(--online);
  margin-right: 4px;
}

.tile-menu {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tile-body {
  padding: 12px 14px 14px;
}

.tile-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.tile-name {
  font-weight: 700;
  font-size: 1rem;
}

.tile-verified {
  color: var(--verified);
  font-size: 0.9rem;
}

.tile-location {
  color: var(--muted);
  font-size: 0.82rem;
  margin-bottom: 10px;
}
.tile-location::before {
  content: "📍 ";
}

.tile-cta {
  display: block;
  width: 100%;
  background: var(--brand);
  color: #fff;
  text-align: center;
  padding: 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  border: none;
  cursor: pointer;
}
.tile-cta:hover { background: var(--brand-dark); }

/* Lazy reveal — kafle przed scrollem ukryte z gridu (zero miejsca, brak layout-shiftu) */
.tile-hidden { display: none !important; }

/* Locked teaser — ostatnie 2 zablurowane z overlay'em CTA */
.tile-locked .tile-photo {
  cursor: default;
  position: relative;
}
.tile-locked .tile-photo img {
  filter: blur(14px) brightness(0.85) saturate(0.7);
  transform: scale(1.1); /* przykryj rozmyte krawędzie */
  pointer-events: none;
  user-select: none;
}
.tile-locked .locked-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, rgba(0,0,0,0.05) 0%, rgba(0,0,0,0.35) 100%);
  z-index: 3;
}
.locked-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--brand);
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  box-shadow: 0 6px 20px rgba(255,59,92,0.5);
  white-space: nowrap;
  text-decoration: none;
  transition: transform 0.15s ease, background 0.15s ease;
}
.locked-cta:hover {
  background: var(--brand-dark);
  transform: scale(1.04);
}
.locked-cta-icon { font-size: 0.95rem; line-height: 1; }
.tile-locked .locked-body {
  filter: blur(5px);
  pointer-events: none;
  user-select: none;
}
.tile-locked .locked-body .tile-cta {
  cursor: default;
}

/* Sentinel dla IntersectionObserver — zero rozmiaru, nie psuje gridu */
.reveal-sentinel {
  grid-column: 1 / -1;
  height: 1px;
  margin: 0;
  padding: 0;
  pointer-events: none;
}

/* Modals */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  align-items: center;
  justify-content: center;
}
.modal.is-open { display: flex; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

.modal-card {
  position: relative;
  background: var(--card);
  border-radius: 12px;
  max-width: 720px;
  width: calc(100% - 32px);
  max-height: 90vh;
  overflow: hidden; /* card sam nie scrolluje — wewnetrzne sekcje zarzadzaja overflow */
  display: grid;
  grid-template-columns: 1fr 1fr;
  box-shadow: var(--shadow-lg);
}

@media (max-width: 640px) {
  .modal-card {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr; /* photo: naturalna wysokosc, body: reszta */
    max-width: 460px;
    max-height: 95vh;
  }
}

.modal-photo {
  position: relative;
  background: #e5e7eb;
  min-height: 360px;
}

@media (max-width: 640px) {
  /* Mobile: niskie zdjecie zeby zostawic miejsce na opis + CTA above-the-fold */
  .modal-photo {
    min-height: 0;
    height: 38vh;
    max-height: 320px;
  }
}

.modal-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.modal-photo .online-badge {
  position: absolute;
  bottom: 14px;
  left: 14px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}
.modal-photo .online-badge::before {
  content: "● ";
  color: var(--online);
}

.modal-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  border: none;
  cursor: pointer;
  font-size: 1.4rem;
  line-height: 1;
  z-index: 2;
}

.modal-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  min-height: 0; /* pozwala flex-child shrinkowac w grid-row */
  overflow: hidden;
}

/* Bio ma wewnetrzny scroll dla bardzo dlugich tekstow.
 * Wszystko inne (h2, badge, location, hint, CTA) zostaje sztywne.
 * #modal-bio jest jedynym flex: 1 child — przejmuje pozostale miejsce. */
#modal-bio {
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
}

/* Pozostale dzieci modal-body: nie shrinkuj, nie growuj */
.modal-body > *:not(#modal-bio) {
  flex: 0 0 auto;
}

/* CTA pinowany na dole modal-body — flex-shrink: 0 + margin-top: auto pcha go na koniec
 * gdyby bio bylo krotkie. Przy dlugim bio bio scrolluje, CTA stoi w miejscu. */
.modal-body .cta-btn {
  flex-shrink: 0;
  margin-top: 12px;
}

@media (max-width: 640px) {
  .modal-body {
    padding: 14px 16px 16px;
  }
  .modal-body h2 { font-size: 1.2rem; margin-bottom: 4px; }
  .modal-body h3 { font-size: 0.9rem; margin-bottom: 4px; }
  .modal-body hr { margin: 10px 0; }
  .modal-location { margin: 8px 0; font-size: 0.85rem; }
  .modal-body p { font-size: 0.85rem; line-height: 1.4; margin-bottom: 8px; }
  .modal-hint { font-size: 0.78rem !important; margin: 8px 0 6px !important; }
  .modal-body .cta-btn { padding: 12px; font-size: 0.9rem; }
}

.modal-body h2 {
  margin: 0 0 8px;
  font-size: 1.5rem;
  font-weight: 800;
}

.verified-badge {
  display: inline-block;
  background: var(--verified-bg);
  color: var(--verified);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
}

.modal-location {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 12px 0;
}

.modal-body hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 16px 0;
}

.modal-body h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  font-weight: 700;
}

.modal-body p {
  margin: 0 0 18px;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text);
}

.modal-hint {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem !important;
  margin: 18px 0 12px !important;
}

.cta-btn {
  display: block;
  background: var(--brand);
  color: #fff;
  text-align: center;
  padding: 16px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.cta-btn:hover { background: var(--brand-dark); }

/* Report popup */
.report-card {
  position: relative;
  background: var(--card);
  border-radius: 12px;
  max-width: 420px;
  width: calc(100% - 32px);
  padding: 24px;
  box-shadow: var(--shadow-lg);
}

.report-cancel {
  background: none;
  border: none;
  color: var(--brand);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0 0 8px;
}

.report-card h3 {
  margin: 0 0 8px;
  font-size: 1.4rem;
  font-weight: 800;
}

.report-card hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 0 0 18px;
}

.report-card form label {
  display: block;
  margin-bottom: 14px;
  font-weight: 600;
  font-size: 0.9rem;
}

.report-card input,
.report-card textarea {
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
}
.report-card input:focus,
.report-card textarea:focus { border-color: var(--brand); }

.report-submit {
  width: 100%;
  background: #111827;
  color: #fff;
  padding: 12px;
  border: none;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 6px;
}
.report-submit:hover { background: #000; }

.report-thanks {
  margin-top: 14px;
  color: var(--verified);
  font-weight: 600;
  text-align: center;
}
