:root {
  --fc-bg: #f7f4ef;
  --fc-surface: #ffffff;
  --fc-ink: #2c2416;
  --fc-muted: #6b6256;
  --fc-accent: #8b5e3c;
  --fc-accent-dark: #6f4a2f;
  --fc-border: #e6dfd4;
  --fc-success: #2f6b4f;
  --fc-danger: #9b3b3b;
  --fc-radius: 0.85rem;
  --fc-shadow: 0 10px 30px rgba(44, 36, 22, 0.08);
}

html, body {
  min-height: 100%;
}

body.app-body {
  background:
    radial-gradient(circle at top left, rgba(139, 94, 60, 0.08), transparent 28%),
    linear-gradient(180deg, #fbf8f3 0%, var(--fc-bg) 100%);
  color: var(--fc-ink);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

body.guest-body {
  background:
    radial-gradient(circle at 20% 20%, rgba(139, 94, 60, 0.12), transparent 35%),
    linear-gradient(160deg, #fbf8f3, #efe7db);
  color: var(--fc-ink);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

.navbar-family {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--fc-border);
}

.navbar-brand {
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--fc-accent-dark) !important;
}

.nav-link.active {
  color: var(--fc-accent-dark) !important;
  font-weight: 600;
}

.card-soft {
  background: var(--fc-surface);
  border: 1px solid var(--fc-border);
  border-radius: var(--fc-radius);
  box-shadow: var(--fc-shadow);
}

.action-card {
  border-radius: var(--fc-radius);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.action-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(44, 36, 22, 0.12);
}

/* Primary CTA — matches filled "Help tag photos" button on gallery */
.action-card-primary {
  background: linear-gradient(145deg, var(--fc-accent) 0%, var(--fc-accent-dark) 100%);
  border: 1px solid var(--fc-accent-dark);
  box-shadow: 0 12px 28px rgba(111, 74, 47, 0.28);
  color: #fff;
}

.action-card-primary:hover {
  color: #fff;
  box-shadow: 0 16px 32px rgba(111, 74, 47, 0.35);
}

.action-card-primary .action-card-title {
  color: #fff;
  font-size: 1.1rem;
}

.action-card-primary .action-card-desc {
  color: rgba(255, 255, 255, 0.88);
}

.btn-family {
  background: var(--fc-accent);
  border-color: var(--fc-accent);
  color: #fff;
}

.btn-family:hover,
.btn-family:focus {
  background: var(--fc-accent-dark);
  border-color: var(--fc-accent-dark);
  color: #fff;
}

.btn-outline-family {
  color: var(--fc-accent-dark);
  border-color: var(--fc-accent);
}

.btn-outline-family:hover {
  background: var(--fc-accent);
  border-color: var(--fc-accent);
  color: #fff;
}

.text-muted-family {
  color: var(--fc-muted) !important;
}

.stat-pill {
  border-radius: 999px;
  background: #f1e9df;
  color: var(--fc-accent-dark);
  padding: 0.35rem 0.8rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.85rem;
}

.photo-tile {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 0.75rem;
  border: 1px solid var(--fc-border);
  background: #efe8de;
}

.photo-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s ease;
}

.photo-tile:hover img {
  transform: scale(1.04);
}

.photo-tile .badge-tag {
  position: absolute;
  left: 0.4rem;
  bottom: 0.4rem;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  border-radius: 999px;
  font-size: 0.72rem;
  padding: 0.15rem 0.45rem;
}

.photo-stage-wrap {
  width: 100%;
}

.photo-stage {
  position: relative;
  display: block;
  max-width: 100%;
  line-height: 0;
  border-radius: var(--fc-radius);
  overflow: visible; /* keep name labels above boxes visible */
  background: #1d1812;
  user-select: none;
  touch-action: none;
  cursor: crosshair;
  width: 100%;
}

.photo-hero {
  max-height: min(72vh, 820px);
  width: 100%;
  height: auto;
  object-fit: contain;
  background: #1d1812;
  border-radius: var(--fc-radius);
  display: block;
  pointer-events: none;
}

.tag-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.tag-box {
  position: absolute;
  border: 2px solid rgba(255, 236, 200, 0.95);
  border-radius: 0.35rem;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35), 0 4px 14px rgba(0, 0, 0, 0.25);
  background: rgba(139, 94, 60, 0.12);
  pointer-events: none;
  box-sizing: border-box;
}

.tag-box-draft {
  border-style: dashed;
  border-color: #f0d9b5;
  background: rgba(240, 217, 181, 0.18);
  z-index: 5;
}

.tag-box-saved {
  z-index: 3;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
}

/* Show tags only while the pointer is over the photo, or when a chip highlights one */
.photo-stage:hover .tag-box-saved,
.photo-stage:focus-within .tag-box-saved,
.photo-stage.is-touch-reveal .tag-box-saved,
.tag-box-saved.is-active {
  opacity: 1;
  visibility: visible;
}

.tag-box-saved.is-active {
  border-color: #fff;
  background: rgba(139, 94, 60, 0.28);
  z-index: 4;
}

.tag-box-label {
  position: absolute;
  left: 0;
  bottom: 100%;
  margin-bottom: 3px;
  max-width: 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: rgba(44, 36, 22, 0.88);
  color: #fff;
  font-size: 0.72rem;
  line-height: 1.2;
  padding: 0.15rem 0.4rem;
  border-radius: 0.3rem;
  pointer-events: none;
}

.tag-loc-dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--fc-accent);
  display: inline-block;
}

.tag-chip-located {
  cursor: default;
}

.tag-chip.is-active {
  outline: 2px solid var(--fc-accent);
  background: #e8d9c8;
}

#tag-location-status.has-box {
  color: var(--fc-success);
  font-weight: 600;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: #f1e9df;
  border: 1px solid var(--fc-border);
  border-radius: 999px;
  padding: 0.25rem 0.6rem;
  margin: 0.15rem;
  font-size: 0.9rem;
}

.tag-search-wrap {
  position: relative;
  z-index: 30;
}

.suggest-list {
  position: absolute;
  z-index: 40;
  left: 0;
  right: 0;
  top: calc(100% + 2px);
  background: #fff;
  border: 2px solid var(--fc-accent);
  border-radius: 0.5rem;
  box-shadow: 0 8px 24px rgba(44, 36, 22, 0.18), 0 0 0 1px rgba(139, 94, 60, 0.12);
  max-height: 240px;
  overflow: auto;
}

.suggest-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 0.55rem 0.75rem;
}

.suggest-item:hover,
.suggest-item:focus {
  background: #f7f1ea;
}

.suggest-year {
  display: inline-block;
  font-weight: 700;
  color: var(--fc-accent-dark);
  background: #f1e9df;
  border-radius: 999px;
  padding: 0.05rem 0.45rem;
  font-size: 0.8rem;
  margin-left: 0.15rem;
}

.suggest-item-create {
  border-top: 1px solid var(--fc-border);
  color: var(--fc-accent-dark);
  background: #fbf6f0;
}

.suggest-item-create:hover,
.suggest-item-create:focus {
  background: #f3e8db;
}

.login-card {
  width: min(420px, 100%);
}

.dropzone {
  border: 2px dashed #cbb9a4;
  border-radius: var(--fc-radius);
  background: #fbf8f3;
  padding: 2rem 1rem;
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.dropzone.dragover {
  border-color: var(--fc-accent);
  background: #f3ebe2;
}

.queue-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: #fff8ef;
  border-bottom: 1px solid var(--fc-border);
  padding: 0.65rem 0;
}

.family-table td {
  vertical-align: middle;
}

.flash-wrap {
  max-width: 960px;
}
