/* ============================================================
   GLOBAL
============================================================ */

html, body {
  margin: 0;
  font-family: Arial, sans-serif;
  height: 100%;
  background: #f8f4f1;
  overflow: hidden;
  touch-action: manipulation;
}

.link {
  fill: none;
  stroke: #888;
  stroke-width: 1.5px;
}

#logo {
  position: fixed;
  top: env(safe-area-inset-top);
  left: 8px;
  z-index: 1100;
}


/* ============================================
   HEADER BASE
============================================ */

.app-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background: rgba(248, 244, 241, 0.97);
  backdrop-filter: blur(6px);
  box-shadow: 0 2px 10px rgba(0,0,0,0.12);
  z-index: 1000;
}

.header-inner {
  max-width: 1400px;
  margin: auto;
  padding: 2px 16px;
  display: flex;
  flex-direction: column;
}

/* ============================================
   TOP ROW (Logo + Search + Auth)
============================================ */

.header-top-row {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 18px;
}

/* Push auth section to the far right */
.header-top-row .header-right {
  margin-left: auto;
}

/* Mobile search row: hidden on desktop */
.header-search-row {
  display: none;
}

/* ============================================
   LEFT SECTION (legacy, kept for compatibility)
============================================ */

.header-left {
  display: flex;
  align-items: center;
  gap: 18px;
}

.app-logo {
  height: 80px;
  cursor: pointer;
}

.search-wrapper {
  position: relative;
}

.header-search-desktop {
  width: 360px;
}

#personSearch {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #ddd;
  font-size: 14px;
  transition: all 0.2s ease;
}

#personSearch:focus {
  outline: none;
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79,70,229,0.15);
}

/* Search Results */

#personSearchResults {
  position: absolute;
  top: 110%;
  left: 0;
  width: 100%;
  max-height: 260px;
  overflow-y: auto;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.18);
  display: none;
  z-index: 2000;
}

.search-item {
  padding: 10px 14px;
  cursor: pointer;
}

.search-item:hover {
  background: #f1f5ff;
}

.search-item-name {
  font-size: 14px;
  font-weight: 700;
  color: #111827;
  line-height: 1.25;
}

.search-item-meta {
  margin-top: 2px;
  font-size: 12px;
  color: #6b7280;
  line-height: 1.25;
}

/* ============================================
   RIGHT SECTION
============================================ */

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.scope-switcher-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.scope-switcher-label {
  font-size: 12px;
  color: #444;
  white-space: nowrap;
}

.scope-switcher {
  min-width: 140px;
  max-width: 200px;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid #ddd;
  background: #fff;
  font-size: 13px;
}

.mobile-only {
  display: none;
}

/* Google Button */

.btn-google {
  background: #fff;
  border: 1px solid #ddd;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  transition: 0.2s;
}

.btn-google:hover {
  background: #f5f5f5;
}
#home-section {
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 94px 20px;
  box-sizing: border-box;
}

/* HERO */
.hero {
  padding: 60px 20px;
  background: linear-gradient(135deg, #4e73df, #1cc88a);
  color: white;
  border-radius: 12px;
  margin-bottom: 60px;
}

.hero h1 {
  font-size: 42px;
  margin-bottom: 20px;
}

.hero-subtitle {
  font-size: 18px;
  margin-bottom: 30px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* Buttons */
.primary-btn {
  background: #4e73df;
  color: white;
  padding: 12px 24px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  margin: 10px;
  font-size: 16px;
}

.primary-btn:hover {
  background: #2e59d9;
}

.secondary-btn {
  background: white;
  color: #4e73df;
  border: 2px solid #4e73df;
  padding: 12px 24px;
  border-radius: 6px;
  cursor: pointer;
  margin: 10px;
}

.large-btn {
  padding: 14px 32px;
  font-size: 18px;
}

/* ABOUT */
.about-section {
  max-width: 800px;
  margin: 0 auto 60px auto;
}

/* EXPLORE COLLECTIONS */
.explore-section {
  margin: 0 auto 60px auto;
  max-width: 1200px;
}

.explore-subtitle {
  color: #4b5563;
  margin: 8px 0 20px 0;
}

.collections-grid {
  --collection-card-width: 320px;
  --collection-card-height: 200px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(var(--collection-card-width), 1fr));
  gap: 20px;
}

.collection-card {
  width: 100%;
  padding: 0;
  text-align: left;
  font: inherit;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.collection-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
}

.collection-art {
  width: 100%;
  /* height: var(--collection-card-height); */
  object-fit: contain;
  object-position: center;
  display: block;
  background: linear-gradient(135deg, #eef2ff, #fef3c7);
}

.collection-body {
  flex: 1;
  padding: 14px 16px;
}

.collection-content {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.collection-text {
  flex: 1 1 auto;
  min-width: 0;
}

.collection-title {
  margin: 0;
  font-size: 18px;
}

.collection-count {
  flex: 0 0 auto;
  min-width: 90px;
  padding: 8px 12px;
  border-radius: 12px;
  background: #eef2ff;
  color: #1e3a8a;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.1;
}

.collection-count-value {
  font-size: 22px;
  font-weight: 800;
}

.collection-count-label {
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.collection-desc {
  margin: 2px 0 0 0;
  font-size: 13px;
  color: #4b5563;
  line-height: 1.4;
}

.collections-empty {
  margin-top: 10px;
  color: #6b7280;
}

/* FEATURES */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-top: 30px;
}

.feature-card {
  background: white;
  padding: 25px;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.feature-icon {
  font-size: 30px;
  margin-bottom: 10px;
}

/* CTA */
.cta-section {
  margin-top: 60px;
}

#main-container {
  height: 100vh;
}


#app-section {
  display: none;
  height: 100%;
  overflow: hidden;
}

#tree-container,
#mainTreeSvg,
#lineageSvg {
  width: 100%;
  height: 100%;
  display: block;
}
/* ============================================
   USER MENU
============================================ */

.user-menu {
  position: relative;
}

.profile-trigger {
  background: none;
  border: none;
  cursor: pointer;
  position: relative;
  padding: 0;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.avatar.large {
  width: 52px;
  height: 52px;
}

.dropdown-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  background: #4f46e5;
  color: #fff;
  font-size: 11px;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Dropdown */

.dropdown-menu {
  position: absolute;
  right: 0;
  top: 120%;
  width: 240px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.2);
  padding: 12px 0;
  animation: fadeIn 0.15s ease-in-out;
  z-index: 3000;
}

.dropdown-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
}

.user-info span {
  font-weight: 600;
}

.dropdown-item {
  width: 100%;
  background: none;
  border: none;
  text-align: left;
  padding: 10px 16px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
}

.dropdown-item:hover {
  background: #f5f7ff;
}

.dropdown-divider {
  height: 1px;
  background: #eee;
  margin: 8px 0;
}

.dropdown-item.danger {
  color: #d32f2f;
}

.hidden {
  display: none;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   RESPONSIVE
============================================ */

@media (max-width: 768px) {

  .header-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 4px 12px;
  }

  /* Row 1: Logo left, Sign-in right — no gap between them */
  .header-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 0;
  }

  /* Hide desktop search on mobile */
  .header-search-desktop {
    display: none !important;
  }

  /* Row 2: Show mobile search row */
  .header-search-row {
    display: flex;
    width: 100%;
    padding-bottom: 6px;
  }

  .header-search-row .search-wrapper {
    width: 100%;
  }

  .header-right .scope-switcher-wrap {
    display: none;
  }

  .mobile-only {
    display: flex;
    margin-bottom: 6px;
  }

  .header-search-row .scope-switcher-wrap.mobile-only {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }

  .header-search-row .scope-switcher-wrap.mobile-only .scope-switcher {
    width: 100%;
    min-width: 0;
    max-width: none;
  }

  .scope-switcher {
    min-width: 150px;
    max-width: 220px;
  }

  .collections-grid {
    --collection-card-width: 280px;
    --collection-card-height: 176px;
  }

  #personSearchMobile {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid #ddd;
    font-size: 16px; /* ≥16 prevents iOS zoom */
    transition: all 0.2s ease;
  }

  #personSearchMobile:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79,70,229,0.15);
  }

  #personSearchResultsMobile {
    position: absolute;
    top: 110%;
    left: 0;
    width: 100%;
    max-height: 260px;
    overflow-y: auto;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.18);
    display: none;
    z-index: 2000;
  }

  .dropdown-menu {
    right: 0;
  }
}

@media (max-width: 520px) {
  .collections-grid {
    --collection-card-width: 100%;
    --collection-card-height: 188px;
  }
}


/* ============================================================
   PERSON CARD (DESCENDANTS)
============================================================ */

.person-card {
  cursor: pointer;
}

.person-card rect {
  transition:
    stroke 0.2s ease,
    stroke-width 0.2s ease,
    filter 0.2s ease;
}

.person-card.hover-card rect {
  stroke: #1e88e5;
  stroke-width: 3;
  filter: drop-shadow(0 0 6px rgba(30,136,229,0.4));
}

/* ============================================================
   PERSON PHOTO (ANCESTRY)
============================================================ */

.person-photo {
  cursor: pointer;
}

.person-photo-border {
  transition:
    stroke 0.2s ease,
    stroke-width 0.2s ease,
    filter 0.2s ease;
}

.person-photo-border.hover-photo {
  stroke: #d81b60;
  stroke-width: 3;
  filter: drop-shadow(0 0 6px rgba(216,27,96,0.6));
}

.person-card.selected-person rect {
  stroke: #ff9800;
  stroke-width: 3;
  filter: drop-shadow(0 0 6px rgba(255,152,0,0.6));
}

.person-card.focused rect {
  stroke: #ff9800;
  stroke-width: 4;
  filter: drop-shadow(0 0 10px rgba(255,152,0,0.6));
}


/* ============================================================
   MARRIAGE PHOTOS
============================================================ */

.marriage-photo {
  cursor: pointer;
}

.marriage-photo-border {
  transition:
    stroke 0.2s ease,
    stroke-width 0.2s ease,
    filter 0.2s ease;
}

.marriage-photo:hover + .marriage-photo-border,
.marriage-photo-border.hovered {
  stroke: #7b1fa2;
  stroke-width: 3;
  filter: drop-shadow(0 0 6px rgba(123,31,162,0.65));
}

.marriage-jump-pulse rect:first-of-type {
  animation: marriage-jump-pulse 1200ms ease-out 1;
}

@keyframes marriage-jump-pulse {
  0% {
    stroke: #f59e0b;
    stroke-width: 2;
    filter: drop-shadow(0 0 0 rgba(245, 158, 11, 0));
  }
  45% {
    stroke: #f97316;
    stroke-width: 4;
    filter: drop-shadow(0 0 10px rgba(249, 115, 22, 0.45));
  }
  100% {
    stroke: #555;
    stroke-width: 1;
    filter: drop-shadow(0 0 0 rgba(245, 158, 11, 0));
  }
}

/* ============================================================
   MOBILE TUNING
============================================================ */

@media (max-width: 480px) {
  #toolbar {
    /* padding: 6px; */
    gap: 6px;
  }

  #toolbar select,
  #toolbar input {
    font-size: 16px;   /* 🔑 keep ≥16 to avoid zoom */
    padding: 6px 8px;
    min-height: 40px;
  }

  #toolbar button {
    font-size: 14px;
    padding: 6px 8px;
    min-height: 40px;
  }

  #personSearch {
    min-width: 160px;
    flex: 1;          /* 🔑 allow shrink instead of wrapping */
  }
  
}



/* ===============================
   ACTION PANEL (MOBILE FIRST)
================================ */


.panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 1999;
}

.panel-overlay.hidden {
  display: none;
}

.action-panel {
  position: fixed;
  bottom: -100%;
  left: 0;
  right: 0;
  background: #fff;
  border-radius: 18px 18px 0 0;
  z-index: 2000;
  box-shadow: 0 -8px 24px rgba(0,0,0,0.3);
  transition: bottom 0.35s ease;
  padding: 12px 16px 24px;
}

.action-panel.visible {
  transform: translateY(0);
}

/* .action-panel.hidden {
  display: none;
} */

/* ---------- HEADER ---------- */

.action-panel-header {
  padding: 10px 14px 6px;
  border-bottom: 1px solid #e0e0e0;
  position: relative;
  text-align: center;
}

.panel-handle {
  width: 40px;
  height: 5px;
  background: #ccc;
  border-radius: 3px;
  margin: 0 auto 8px;
}

.panel-title {
  font-size: 16px;
  font-weight: bold;
}

#panelCloseBtn {
  position: absolute;
  right: 12px;
  top: 10px;
  border: none;
  background: transparent;
  font-size: 18px;
  cursor: pointer;
}

/* ---------- BODY ---------- */

.action-panel-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}

.panel-divider {
  height: 1px;
  background: #e0e0e0;
  margin: 8px 0;
}

/* ---------- BUTTONS ---------- */

.panel-btn {
  font-size: 16px;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid #ccc;
  background: #fafafa;
  cursor: pointer;
  text-align: left;
}

.panel-btn.primary {
  background: #1e88e5;
  color: #fff;
  border: none;
}

.panel-btn:active {
  transform: scale(0.98);
}

.panel-btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (min-width: 900px) {

  .action-panel {
    top: 0;
    bottom: 0;
    left: auto;
    right: 0;
    width: 320px;
    height: 100vh;
    border-radius: 0;
    transform: translateX(100%);
  }

  .action-panel.visible {
    transform: translateX(0);
  }

  .panel-handle {
    display: none;
  }
}


.person-card.selected rect {
  stroke: #ff9800;
  stroke-width: 4;
  filter: drop-shadow(0 0 8px rgba(255,152,0,0.6));
}


/* ===============================
   VIEW MODE FLOATING PANEL
================================ */

.view-mode-panel {
  position: fixed;
  bottom: 20px;
  left: 16px;
  z-index: 1500;

  display: flex;
  flex-direction: column;
  gap: 10px;

  background: rgba(248, 244, 241, 0.95);
  border-radius: 12px;
  padding: 4px;

  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  touch-action: manipulation;
}

/* MODE BUTTON */
.mode-btn {
  display: flex;
  align-items: center;
  gap: 6px;

  border: none;
  background: transparent;
  cursor: pointer;

  font-size: 16px;
  padding: 10px 14px;
  border-radius: 8px;

  color: #444;
  font-weight: bold;

  transition:
    background 0.2s ease,
    color 0.2s ease,
    transform 0.1s ease;
}

/* LABEL (hide on very small screens if needed later) */
.mode-btn span {
  font-size: 13px;
}

/* ACTIVE STATE */
.mode-btn.active {
  background: #1e88e5;
  color: #fff;
}

/* PRESS FEEDBACK */
.mode-btn:active {
  transform: scale(0.95);
}

/* ANCESTRY LINKS */
.link.paternal {
  stroke: #1e88e5;
}

.link.maternal {
  stroke: #d81b60;
}

.radial-overlay {
  position: fixed;
  inset: 0;
  backdrop-filter: blur(20px);
  background: rgba(0,0,0,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
}

#personActionMenu {
  overflow: visible;
  position: absolute;
}

.radial-overlay.hidden {
  display: none;
}

.radial-menu {
  position: absolute;
  width: 260px;
  height: 260px;
  pointer-events: auto;
}

.radial-slice {
  fill: #f8fafc;
  stroke: #cbd5e1;
  stroke-width: 1;
  cursor: pointer;
  transition: fill 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.radial-slice:hover {
  fill: #e2e8f0;
}

.radial-icon {
  font-size: 18px;
  fill: #334155;
  pointer-events: none;
  text-anchor: middle;
  dominant-baseline: middle;
}

.radial-label {
  font-size: 12px;
  font-weight: 600;
  fill: #ffffff;
  stroke: rgba(0,0,0,0.75);
  stroke-width: 3px;
  paint-order: stroke;
  line-height: 1.1;
  /* color: #334155; */
  word-break: break-word;
  white-space: normal;
  max-width: 90px;
  pointer-events: none;
}


.radial-center {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid white;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.radial-center img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.radial-wrapper {
  position: relative;
  width: 440px;
  height: 440px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.radial-person-name {
  position: absolute;
  bottom: 50px;            /* distance from bottom of wrapper */
  left: 50%;
  transform: translateX(-50%);
  font-size: 14px;
  font-weight: 600;
  color: #111;
  text-align: center;
  pointer-events: none;
}


.radial-icon-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #334155;
  pointer-events: none;
}


/* MOBILE TUNING */
@media (max-width: 480px) {
  .view-mode-panel {
    bottom: 10px;
    left: 8px;
  }

  .mode-btn {
    padding: 8px;
    /* font-size: 20px; */
  }

  .mode-btn span {
    display: none; /* icons only on small screens */
  }
}

/* ------------------------------
   Overlay
------------------------------ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

/* ------------------------------
   Card
------------------------------ */
.profile-setup-card {
  width: 95%;
  max-width: 520px;
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.2);
  padding: 28px 30px;
  animation: fadeScale 0.2s ease-out;
}

@keyframes fadeScale {
  from { transform: scale(0.96); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ------------------------------
   Header
------------------------------ */
.modal-header h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  color: #0f172a;
}

.modal-header p {
  margin-top: 6px;
  font-size: 14px;
  color: #64748b;
}

/* ------------------------------
   Body
------------------------------ */
.modal-body {
  margin-top: 22px;
}

.form-row {
  display: flex;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.form-group {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.form-group label {
  font-size: 13px;
  margin-bottom: 6px;
  color: #475569;
  font-weight: 500;
}

.form-group input,
.form-group select {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  font-size: 14px;
  transition: all 0.2s ease;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* ------------------------------
   Actions
------------------------------ */
.modal-actions {
  margin-top: 10px;
}

.btn-primary {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border: none;
  color: white;
  padding: 12px 16px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s ease;
}

.btn-primary:hover {
  opacity: 0.92;
}

.btn-full {
  width: 100%;
}

/* Close button (top-right X) */
.modal-close-btn {
  position: absolute;
  top: 14px;
  right: 16px;
  background: transparent;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: #94a3b8;
  transition: 0.2s ease;
}

.modal-close-btn:hover {
  color: #0f172a;
}

/* Secondary button */
.btn-secondary {
  background: transparent;
  border: 1px solid #cbd5e1;
  color: #475569;
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 500;
  cursor: pointer;
  transition: 0.2s ease;
}

.btn-secondary:hover {
  background: #f1f5f9;
}

/* Modal action layout */
.modal-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 16px;
}

/* ------------------------------
   Mobile
------------------------------ */
@media (max-width: 480px) {
  .form-row {
    flex-direction: column;
  }
}



.hidden {
  display: none !important;
}

.modal-card {
  background: white;
  padding: 24px;
  border-radius: 12px;
  width: 420px;
  max-width: 95%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 50px rgba(0,0,0,0.2);
}

.modal-wide {
  width: 560px;
}

.match-list {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.match-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  margin-bottom: 12px;
  background: #fff;
  transition: 0.2s ease;
}

.match-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.best-match {
  border: 2px solid #2563eb;
  background: #f8fafc;
}

.match-avatar {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  object-fit: cover;
}

.match-details {
  flex: 1;
}

.match-name {
  font-weight: 600;
  font-size: 16px;
}

.match-meta {
  font-size: 13px;
  color: #6b7280;
  margin-top: 4px;
}

.match-score {
  font-size: 12px;
  color: #2563eb;
  margin-top: 6px;
}

.match-actions {
  display: flex;
  align-items: center;
}

.match-modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.match-back-btn {
  background: none;
  border: none;
  font-size: 14px;
  cursor: pointer;
  color: #2563eb;
}

.match-back-btn:hover {
  text-decoration: underline;
}


.claimed-badge {
  font-size: 12px;
  margin-top: 6px;
  font-weight: 500;
}

.claimed-by-you {
  color: #16a34a;
}

.claimed-by-other {
  color: #dc2626;
}

.btn-disabled {
  background: #e5e7eb;
  color: #6b7280;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: not-allowed;
}

.match-parents {
  font-size: 12px;
  color: #555;
  margin-top: 4px;
  line-height: 1.3;
}


.btn-primary {
  background: #2563eb;
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
}

.btn-secondary {
  background: #e2e8f0;
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
}

.modal-footer {
  margin-top: 20px;
  text-align: center;
}

/* Mobile */
@media (max-width: 600px) {
  .modal-card {
    width: 95%;
    padding: 16px;
  }
}


.confirm-summary {
  margin-top: 16px;
  font-size: 14px;
  line-height: 1.6;
  color: #334155;
}

/* ------------------------------
   Edit Person Modal
------------------------------ */
.edit-person-card {
  width: min(900px, 96vw);
}

.edit-person-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.edit-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.edit-tab-btn {
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #334155;
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
}

.edit-tab-btn.active {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}

.edit-tab-panel {
  display: none;
}

.edit-tab-panel.active {
  display: block;
}

#ep_aboutText {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  font-size: 14px;
  resize: vertical;
}

.photo-crop-card {
  width: min(420px, 96vw);
}

.crop-help-text {
  margin-top: -4px;
  color: #64748b;
  font-size: 13px;
}

.photo-crop-stage {
  display: flex;
  justify-content: center;
  margin: 10px 0 14px;
}

#photoCropCanvas {
  width: 320px;
  height: 320px;
  border-radius: 12px;
  border: 1px solid #cbd5e1;
  cursor: grab;
  touch-action: none;
  background: #f1f5f9;
}

#photoCropCanvas:active {
  cursor: grabbing;
}

.form-group-full {
  grid-column: 1 / -1;
}

.family-search-wrap {
  position: relative;
}

#ep_familyResults {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 220px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.15);
  z-index: 20;
}

.family-search-item {
  padding: 9px 12px;
  font-size: 14px;
  cursor: pointer;
}

.family-search-item:hover {
  background: #eff6ff;
}

.form-help {
  margin-top: 6px;
  font-size: 12px;
  color: #64748b;
}

.edit-photo-preview {
  margin-top: 8px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid #ddd;
}

#ep_takePhotoBtn {
  margin-top: 8px;
  width: fit-content;
}

.camera-capture-card {
  width: min(480px, 96vw);
}

.camera-stage {
  margin-top: 10px;
  border-radius: 12px;
  overflow: hidden;
  background: #0f172a;
  border: 1px solid #cbd5e1;
}

#cameraVideo {
  width: 100%;
  max-height: 62vh;
  display: block;
  object-fit: cover;
  background: #0f172a;
}

.spouse-search-card {
  width: min(560px, 96vw);
}

.spouse-search-results {
  margin-top: 8px;
  height: 240px;
  overflow-y: auto;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
}

.spouse-search-item {
  padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
}

.spouse-search-item:last-child {
  border-bottom: none;
}

.spouse-search-item:hover,
.spouse-search-item.active {
  background: #eff6ff;
}

.child-search-card {
  width: min(560px, 96vw);
}

.child-search-results {
  margin-top: 8px;
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
}

.child-search-item {
  padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
}

.child-search-item:last-child {
  border-bottom: none;
}

.child-search-item:hover,
.child-search-item.active {
  background: #eff6ff;
}

.parent-search-card {
  width: min(560px, 96vw);
}

.parent-search-results {
  margin-top: 8px;
  height: 240px;
  overflow-y: auto;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
}

.parent-search-item {
  padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
}

.parent-search-item:last-child {
  border-bottom: none;
}

.parent-search-item:hover,
.parent-search-item.active {
  background: #eff6ff;
}

@media (max-width: 768px) {
  .edit-person-grid {
    grid-template-columns: 1fr;
  }

  .edit-person-card {
    width: 96vw;
    max-height: 90vh;
  }
}

/* ============================================================
   TOAST NOTIFICATIONS
============================================================ */

.fr-toast-container {
  position: fixed;
  top: max(14px, calc(env(safe-area-inset-top) + 8px));
  right: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(92vw, 380px);
  z-index: 20000;
  pointer-events: none;
}

.fr-toast {
  pointer-events: auto;
  position: relative;
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: start;
  gap: 10px;
  padding: 12px 12px 12px 10px;
  border-radius: 12px;
  color: #fff;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(8px);
  opacity: 0;
  transform: translateX(16px) scale(0.98);
  transition: transform 0.22s ease, opacity 0.22s ease;
  overflow: hidden;
}

.fr-toast.is-visible {
  opacity: 1;
  transform: translateX(0) scale(1);
}

.fr-toast.is-closing {
  opacity: 0;
  transform: translateX(14px) scale(0.98);
}

.fr-toast--success { background: linear-gradient(135deg, #16a34a, #15803d); }
.fr-toast--error { background: linear-gradient(135deg, #dc2626, #b91c1c); }
.fr-toast--warning { background: linear-gradient(135deg, #d97706, #b45309); }
.fr-toast--info { background: linear-gradient(135deg, #2563eb, #1d4ed8); }

.fr-toast__icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  background: rgba(255,255,255,0.2);
  margin-top: 1px;
}

.fr-toast__title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.2px;
  margin-bottom: 2px;
}

.fr-toast__message {
  font-size: 13px;
  line-height: 1.35;
  opacity: 0.95;
  white-space: pre-wrap;
}

.fr-toast__close {
  border: none;
  background: rgba(255,255,255,0.2);
  color: #fff;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}

.fr-toast__close:hover {
  background: rgba(255,255,255,0.3);
}

.fr-toast__progress {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 3px;
  background: rgba(255,255,255,0.35);
  transform-origin: left center;
}

.fr-toast__progress.is-running {
  transform: scaleX(0);
  transition-property: transform;
  transition-timing-function: linear;
}

@media (max-width: 480px) {
  .fr-toast-container {
    top: max(10px, calc(env(safe-area-inset-top) + 6px));
    right: 8px;
    left: 8px;
    width: auto;
  }
}
