/* family-gifts — design inspired by Pinterest's visual language:
   white canvas, masonry of rounded cards, red #E60023 accent, pill buttons,
   bold compact typography. Light/dark follows the device setting. */

:root {
  color-scheme: light dark;

  --red: #e60023;
  --red-hover: #ad081b;
  --red-active: #8c0615;

  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #efefef;
  --surface-3: #e2e2e2;
  --surface-raised: #ffffff;
  --text: #111111;
  --text-2: #5f5f5f;
  --text-3: #767676;
  --border: #cdcdcd;
  --border-soft: #e9e9e9;
  --pill-active-bg: #111111;
  --pill-active-text: #ffffff;
  --focus: rgba(0, 132, 255, 0.5);
  --link: #111111;
  --accent-text: #e60023;
  --success-bg: #e6f4ea;
  --success-text: #0a6b3b;
  --warning-bg: #fff4d6;
  --warning-text: #7a5300;
  --info-bg: #e8f1fd;
  --info-text: #0b4ea2;
  --overlay: rgba(0, 0, 0, 0.42);
  --toast-bg: #111111;
  --toast-text: #ffffff;
  --shadow-card: 0 0 0 1px rgba(0, 0, 0, 0.02), 0 1px 20px rgba(0, 0, 0, 0.1);
  --shadow-pop: 0 0 8px rgba(0, 0, 0, 0.1), 0 8px 24px rgba(0, 0, 0, 0.12);

  --c0: #fde2e4; --c1: #dcebe5; --c2: #ffead6; --c3: #dfe7fd; --c4: #efece4; --c5: #ece1f0;
  --c0-t: #8a1c2b; --c1-t: #1f5640; --c2-t: #8a4a12; --c3-t: #23408f; --c4-t: #5c5543; --c5-t: #5f2f73;

  --radius-s: 8px;
  --radius-m: 16px;
  --radius-l: 24px;
  --radius-xl: 32px;
  --header-h: 72px;
  --bottom-nav-h: 64px;
  --gutter: 16px;
  --col: 236px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Helvetica,
    Ubuntu, Arial, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --red-hover: #ff1a3c;
    --red-active: #cc001f;
    --bg: #121212;
    --surface: #1c1c1c;
    --surface-2: #2b2b2b;
    --surface-3: #3a3a3a;
    --surface-raised: #222222;
    --text: #f1f1f1;
    --text-2: #b5b5b5;
    --text-3: #9a9a9a;
    --border: #555555;
    --border-soft: #2f2f2f;
    --pill-active-bg: #f1f1f1;
    --pill-active-text: #111111;
    --focus: rgba(77, 163, 255, 0.6);
    --link: #f1f1f1;
    --accent-text: #ff4f68;
    --success-bg: #12301f;
    --success-text: #7ee2a8;
    --warning-bg: #3a2d0a;
    --warning-text: #ffd36b;
    --info-bg: #10243f;
    --info-text: #9cc8ff;
    --overlay: rgba(0, 0, 0, 0.55);
    --toast-bg: #f1f1f1;
    --toast-text: #111111;
    --shadow-card: 0 0 0 1px rgba(255, 255, 255, 0.04), 0 1px 20px rgba(0, 0, 0, 0.6);
    --shadow-pop: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 8px 24px rgba(0, 0, 0, 0.6);

    --c0: #4a2229; --c1: #1e3a30; --c2: #4a321d; --c3: #222f52; --c4: #37342c; --c5: #3b2943;
    --c0-t: #ffc9d1; --c1-t: #b6ead2; --c2-t: #ffd3a8; --c3-t: #c3d3ff; --c4-t: #e4dccb; --c5-t: #ead0f5;
  }
}

/* ------------------------------------------------------------- Base ---- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; display: block; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: 28px; font-weight: 700; }
h2 { font-size: 20px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 700; }
p { margin: 0 0 12px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--focus); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.icon { width: 24px; height: 24px; flex: none; }
.icon-sm { width: 18px; height: 18px; flex: none; }
.icon-xs { width: 14px; height: 14px; flex: none; }

.muted { color: var(--text-2); }
.small { font-size: 14px; }
.tiny { font-size: 12px; }
.center { text-align: center; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.hidden { display: none !important; }

/* ---------------------------------------------------------- Buttons ---- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 48px; padding: 0 18px;
  border: 0; border-radius: var(--radius-l);
  font-size: 16px; font-weight: 600; line-height: 1;
  cursor: pointer; text-decoration: none !important; white-space: nowrap;
  transition: background-color 0.12s ease, transform 0.08s ease;
  background: var(--surface-2); color: var(--text);
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-hover); }
.btn-primary:active { background: var(--red-active); }
.btn-dark { background: var(--pill-active-bg); color: var(--pill-active-text); }
.btn-dark:hover { opacity: 0.88; background: var(--pill-active-bg); }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-success { background: var(--success-bg); color: var(--success-text); }
.btn-success:hover { filter: brightness(0.97); background: var(--success-bg); }
.btn-danger-text { background: transparent; color: var(--accent-text); }
.btn-danger-text:hover { background: var(--surface-2); }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 14px; border-radius: 18px; }
.btn-xs { min-height: 30px; padding: 0 12px; font-size: 13px; border-radius: 15px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; padding: 0;
  border: 0; border-radius: 50%; background: transparent; color: var(--text);
  cursor: pointer; text-decoration: none !important;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn.filled { background: var(--surface-2); }
.icon-btn.filled:hover { background: var(--surface-3); }
.icon-btn-sm { width: 36px; height: 36px; }

/* ------------------------------------------------------------ Forms ---- */

.field { margin-bottom: 16px; }
.field > label, .label {
  display: block; margin: 0 0 6px 8px;
  font-size: 12px; font-weight: 500; color: var(--text);
}
.input, .field input[type="text"], .field input[type="email"], .field input[type="password"],
.field input[type="url"], .field input[type="date"], .field textarea, .field select {
  display: block; width: 100%;
  min-height: 48px; padding: 11px 16px;
  border: 2px solid var(--border); border-radius: var(--radius-m);
  background: var(--surface); color: var(--text);
  font-size: 16px; line-height: 1.35;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.field textarea { resize: vertical; min-height: 110px; }
.input:hover, .field input:hover, .field textarea:hover { border-color: var(--text-3); }
.input:focus, .field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--border); box-shadow: 0 0 0 4px var(--focus);
}
.field input::placeholder, .field textarea::placeholder, .input::placeholder { color: var(--text-3); }
.field .help { margin: 6px 0 0 8px; font-size: 12px; color: var(--text-2); }
.field .error, .form-errors { margin: 6px 0 0 8px; font-size: 13px; color: var(--accent-text); font-weight: 600; }
.form-errors { margin: 0 0 16px; padding: 12px 16px; border-radius: var(--radius-m); background: var(--surface-2); }
.form-errors ul, .field .error ul { margin: 0; padding: 0; list-style: none; }
.field.has-error input, .field.has-error textarea { border-color: var(--red); }
.checkbox { display: flex; gap: 10px; align-items: center; margin: 0 0 16px 4px; font-size: 14px; cursor: pointer; }
.checkbox input { width: 20px; height: 20px; accent-color: var(--red); }

.link-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.link-row .input { flex: 1; }

.image-drop {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; min-height: 280px; padding: 24px;
  border: 2px dashed var(--border); border-radius: var(--radius-xl);
  background: var(--surface-2); color: var(--text-2); text-align: center; cursor: pointer;
  overflow: hidden;
}
.image-drop:hover, .image-drop.dragover { border-color: var(--text-3); }
.image-drop input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.image-drop img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.image-drop.has-image { border-style: solid; border-color: transparent; padding: 0; }
.image-drop.has-image .image-drop-hint { display: none; }
.image-drop-hint { display: flex; flex-direction: column; align-items: center; gap: 4px; pointer-events: none; }
.image-drop-hint .icon { width: 40px; height: 40px; margin-bottom: 6px; }

/* ----------------------------------------------------------- Header ---- */

.site-header {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 8px;
  height: var(--header-h); padding: 0 var(--gutter);
  background: var(--bg);
}
.site-header.scrolled { box-shadow: 0 1px 0 var(--border-soft); }

.brand {
  display: inline-flex; align-items: center; gap: 6px; padding: 0 8px 0 4px;
  height: 48px; border-radius: var(--radius-l); text-decoration: none !important; flex: none;
}
.brand:hover { background: var(--surface-2); }
.brand-mark { width: 32px; height: 32px; }
.brand-name { color: var(--accent-text); font-weight: 700; font-size: 20px; letter-spacing: -0.03em; }

.main-nav { display: flex; gap: 2px; flex: none; }
.nav-pill {
  display: inline-flex; align-items: center; height: 48px; padding: 0 16px;
  border-radius: var(--radius-l); font-weight: 600; color: var(--text); text-decoration: none !important;
}
.nav-pill:hover { background: var(--surface-2); }
.nav-pill.active { background: var(--pill-active-bg); color: var(--pill-active-text); }
.nav-pill .count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; margin-left: 6px; padding: 0 6px;
  border-radius: 10px; background: var(--red); color: #fff; font-size: 12px;
}

.search {
  position: relative; flex: 1; min-width: 0; margin: 0 4px;
}
.search input {
  width: 100%; height: 48px; padding: 0 16px 0 48px;
  border: 0; border-radius: var(--radius-l);
  background: var(--surface-2); color: var(--text); font-size: 16px;
}
.search input:hover { background: var(--surface-3); }
.search input:focus { outline: none; box-shadow: 0 0 0 4px var(--focus); background: var(--surface-2); }
.search input::placeholder { color: var(--text-3); }
.search .icon-sm { position: absolute; left: 18px; top: 15px; color: var(--text-2); pointer-events: none; }

.header-actions { display: flex; align-items: center; gap: 2px; flex: none; }

.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 60;
  min-width: 240px; padding: 8px;
  border-radius: var(--radius-m); background: var(--surface-raised); box-shadow: var(--shadow-pop);
}
.menu-panel.left { right: auto; left: 0; }
.menu-panel .menu-head { padding: 8px 8px 12px; font-size: 12px; color: var(--text-2); }
.menu-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px 8px; border: 0; border-radius: var(--radius-s);
  background: transparent; color: var(--text); font-size: 16px; font-weight: 600;
  text-align: left; text-decoration: none !important; cursor: pointer;
}
.menu-item:hover { background: var(--surface-2); }
.menu-item.danger { color: var(--accent-text); }
.menu-sep { height: 1px; margin: 6px 0; background: var(--border-soft); }
.menu form { margin: 0; }

/* ---------------------------------------------------------- Avatars ---- */

.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 32px; height: 32px; border-radius: 50%;
  color: #fff; font-weight: 700; font-size: 13px; letter-spacing: 0.02em;
  text-decoration: none !important; user-select: none;
}
.avatar-xs { width: 22px; height: 22px; font-size: 10px; }
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-md { width: 48px; height: 48px; font-size: 18px; }
.avatar-lg { width: 72px; height: 72px; font-size: 26px; }
.avatar-xl { width: 120px; height: 120px; font-size: 42px; }
.av-0 { background: #e60023; } .av-1 { background: #0074e8; } .av-2 { background: #008753; }
.av-3 { background: #9a4ad6; } .av-4 { background: #d16a00; } .av-5 { background: #0f8f8f; }
.av-6 { background: #c42e7a; } .av-7 { background: #5b5b5b; }

/* ----------------------------------------------------------- Layout ---- */

.page { padding: 8px var(--gutter) calc(48px + env(safe-area-inset-bottom)); }
.page-narrow { max-width: 640px; margin: 0 auto; }
.page-medium { max-width: 960px; margin: 0 auto; }

.page-head { margin: 8px 0 24px; text-align: center; }
.page-head h1 { font-size: 32px; }
.page-head p { margin-top: 8px; color: var(--text-2); }

.chips {
  display: flex; gap: 8px; margin: 0 calc(-1 * var(--gutter)) 16px; padding: 4px var(--gutter);
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.chips::-webkit-scrollbar { display: none; }
.chips-center { justify-content: safe center; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; flex: none;
  height: 40px; padding: 0 16px 0 6px;
  border-radius: 20px; background: var(--surface-2); color: var(--text);
  font-size: 15px; font-weight: 600; text-decoration: none !important; white-space: nowrap;
}
.chip.no-avatar { padding-left: 16px; }
.chip:hover { background: var(--surface-3); }
.chip.active { background: var(--pill-active-bg); color: var(--pill-active-text); }
.chip .chip-count { font-weight: 500; opacity: 0.7; }

.tabs { display: flex; justify-content: center; gap: 4px; margin: 0 0 24px; }
.tab {
  position: relative; padding: 8px 12px; border-radius: var(--radius-s);
  font-weight: 600; color: var(--text); text-decoration: none !important;
}
.tab:hover { background: var(--surface-2); }
.tab.active::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: -4px;
  height: 3px; border-radius: 2px; background: var(--text);
}

.empty {
  max-width: 420px; margin: 48px auto; padding: 0 16px; text-align: center;
}
.empty-art {
  display: grid; place-items: center; width: 96px; height: 96px; margin: 0 auto 20px;
  border-radius: 50%; background: var(--surface-2); color: var(--text-2);
}
.empty-art .icon { width: 44px; height: 44px; }
.empty h2 { margin-bottom: 8px; }
.empty p { color: var(--text-2); }

/* ---------------------------------------------------------- Masonry ---- */

.masonry {
  column-width: var(--col); column-gap: var(--gutter);
  max-width: calc(var(--col) * 7 + var(--gutter) * 6); margin: 0 auto;
}
.masonry.js-masonry {
  display: flex; gap: var(--gutter); align-items: flex-start; columns: auto;
}
.masonry-col { flex: 1; min-width: 0; }

.pin { break-inside: avoid; margin: 0 0 var(--gutter); position: relative; }
.pin-media {
  position: relative; display: block; overflow: hidden;
  border-radius: var(--radius-m); background: var(--surface-2);
  text-decoration: none !important; color: inherit;
}
.pin-media img { width: 100%; height: auto; }
.pin-media::after {
  content: ""; position: absolute; inset: 0; background: var(--overlay);
  opacity: 0; transition: opacity 0.15s ease; pointer-events: none;
}
.pin-text {
  display: flex; align-items: flex-end; min-height: 180px; padding: 20px 18px;
  font-size: 22px; font-weight: 700; line-height: 1.15; letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}
.pin-text.tall { min-height: 240px; }
.pin-text .pin-emoji { display: block; font-size: 30px; margin-bottom: 10px; }
.cc-0 { background: var(--c0); color: var(--c0-t); } .cc-1 { background: var(--c1); color: var(--c1-t); }
.cc-2 { background: var(--c2); color: var(--c2-t); } .cc-3 { background: var(--c3); color: var(--c3-t); }
.cc-4 { background: var(--c4); color: var(--c4-t); } .cc-5 { background: var(--c5); color: var(--c5-t); }

.pin-actions {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  display: flex; gap: 6px; opacity: 0; transition: opacity 0.15s ease;
}
.pin-actions form { margin: 0; }
.pin-badges { position: absolute; top: 10px; left: 10px; z-index: 2; display: flex; gap: 6px; flex-wrap: wrap; pointer-events: none; }
.pin-links {
  position: absolute; left: 12px; bottom: 12px; z-index: 2; opacity: 0; transition: opacity 0.15s ease;
  pointer-events: none;
}
.pin-links span {
  display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 0 12px;
  border-radius: 16px; background: rgba(255, 255, 255, 0.92); color: #111; font-size: 13px; font-weight: 600;
  max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

@media (hover: hover) {
  .pin:hover .pin-media::after, .pin:focus-within .pin-media::after { opacity: 1; }
  .pin:hover .pin-actions, .pin:focus-within .pin-actions,
  .pin:hover .pin-links, .pin:focus-within .pin-links { opacity: 1; }
}
@media (hover: none) {
  .pin-actions { display: none; }
}

.pin-meta { padding: 8px 6px 4px; }
.pin-title {
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  font-size: 14px; font-weight: 600; line-height: 1.3; color: var(--text); text-decoration: none !important;
  overflow-wrap: anywhere;
}
.pin-owner {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 6px;
  font-size: 13px; color: var(--text); text-decoration: none !important;
}
.pin-owner:hover span:last-child { text-decoration: underline; }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  height: 28px; padding: 0 10px; border-radius: 14px;
  background: rgba(255, 255, 255, 0.95); color: #111;
  font-size: 12px; font-weight: 700; white-space: nowrap;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}
.badge-red { background: var(--red); color: #fff; }
.badge-green { background: #0a8a4a; color: #fff; }
.badge-dark { background: #111; color: #fff; }
.badge-flat { box-shadow: none; }

/* ---------------------------------------------------- Detail / pin ---- */

.closeup {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  max-width: 1016px; margin: 8px auto 40px;
  border-radius: var(--radius-xl); background: var(--surface-raised); box-shadow: var(--shadow-card);
  overflow: hidden;
}
.closeup-media { background: var(--surface-2); min-height: 100%; }
.closeup-media img { width: 100%; height: 100%; max-height: 80vh; object-fit: cover; }
.closeup-media .pin-text { height: 100%; min-height: 420px; font-size: 36px; padding: 40px 32px; }
.closeup-body { display: flex; flex-direction: column; padding: 24px 32px 32px; min-width: 0; }
.closeup-bar { display: flex; align-items: center; gap: 8px; margin: -4px -8px 20px; }
.closeup-title { font-size: 30px; font-weight: 700; line-height: 1.15; margin-bottom: 12px; overflow-wrap: anywhere; }
.closeup-desc { white-space: pre-line; color: var(--text); margin-bottom: 20px; overflow-wrap: anywhere; }
.closeup-section { margin-top: 8px; padding-top: 16px; }
.closeup-section h3 { margin-bottom: 10px; }

.shop-links { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.shop-link {
  display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 16px 8px 8px;
  border-radius: var(--radius-m); background: var(--surface-2); color: var(--text);
  font-weight: 600; text-decoration: none !important;
}
.shop-link:hover { background: var(--surface-3); }
.shop-link .favicon {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  background: var(--surface-raised); color: var(--text-2); flex: none;
}
.shop-link .host { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.owner-row { display: flex; align-items: center; gap: 12px; margin: 4px 0 20px; }
.owner-row a { color: var(--text); font-weight: 600; }
.status-box {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; margin-bottom: 16px;
  border-radius: var(--radius-m); background: var(--surface-2); font-size: 15px;
}
.status-box .icon { margin-top: 1px; }
.status-box.green { background: var(--success-bg); color: var(--success-text); }
.status-box.info { background: var(--info-bg); color: var(--info-text); }
.status-box.warn { background: var(--warning-bg); color: var(--warning-text); }
.status-box strong { display: block; margin-bottom: 2px; }
.closeup-cta { margin-top: auto; padding-top: 16px; display: flex; gap: 8px; flex-wrap: wrap; }
.closeup-cta .btn { flex: 1; min-width: 160px; }

.back-link { position: fixed; top: calc(var(--header-h) + 12px); left: 16px; z-index: 5; }

.more-title { text-align: center; margin: 8px 0 20px; font-size: 20px; }

/* -------------------------------------------------------- Profiles ---- */

.profile-head { text-align: center; margin: 12px auto 28px; max-width: 520px; }
.profile-head .avatar { margin: 0 auto 14px; }
.profile-head h1 { font-size: 36px; }
.profile-head .meta { margin-top: 6px; color: var(--text-2); }
.profile-head .row { justify-content: center; margin-top: 16px; }

.member-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--gutter);
  max-width: 1200px; margin: 0 auto;
}
.member-card {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 24px 16px 20px;
  border-radius: var(--radius-l); background: var(--surface-2); color: var(--text);
  text-align: center; text-decoration: none !important; transition: transform 0.12s ease, background-color 0.12s;
}
.member-card:hover { background: var(--surface-3); transform: translateY(-2px); }
.member-card .avatar { margin-bottom: 8px; }
.member-card .name { font-weight: 700; font-size: 18px; }
.member-card .meta { font-size: 14px; color: var(--text-2); }
.member-card .chosen { margin-top: 6px; font-size: 13px; font-weight: 600; color: var(--success-text); }

.birthday-strip { max-width: 1200px; margin: 0 auto 28px; }
.birthday-strip h2 { margin-bottom: 12px; }
.birthday-list { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.birthday-item {
  display: flex; align-items: center; gap: 12px; flex: none; padding: 10px 18px 10px 10px;
  border-radius: 40px; background: var(--c0); color: var(--c0-t); text-decoration: none !important;
}
.birthday-item strong { display: block; font-size: 15px; }
.birthday-item span { font-size: 13px; }

/* ---------------------------------------------------- Panels / cards ---- */

.panel {
  padding: 24px; margin-bottom: 20px;
  border-radius: var(--radius-l); background: var(--surface-raised); box-shadow: var(--shadow-card);
}
.panel h2 { margin-bottom: 4px; }
.panel .panel-sub { color: var(--text-2); font-size: 14px; margin-bottom: 20px; }

.list { list-style: none; margin: 0; padding: 0; }
.list-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 0;
  border-top: 1px solid var(--border-soft);
}
.list-item:first-child { border-top: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.list-item .sub { font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; }
.list-item form { margin: 0; }

.copy-field { display: flex; gap: 8px; margin-top: 8px; }
.copy-field input {
  flex: 1; min-width: 0; height: 36px; padding: 0 12px;
  border: 1px solid var(--border-soft); border-radius: 18px; background: var(--surface-2);
  color: var(--text-2); font-size: 13px;
}

.gift-group { margin-bottom: 28px; }
.gift-group-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.gift-group-head h2 { font-size: 18px; }
.gift-row {
  display: flex; align-items: center; gap: 14px; padding: 10px;
  border-radius: var(--radius-m);
}
.gift-row:hover { background: var(--surface-2); }
.gift-thumb {
  display: grid; place-items: center; width: 64px; height: 64px; flex: none; overflow: hidden;
  border-radius: 12px; font-size: 26px; text-decoration: none !important;
}
.gift-thumb img { width: 100%; height: 100%; object-fit: cover; }
.gift-row .grow { flex: 1; min-width: 0; }
.gift-row .title { font-weight: 600; color: var(--text); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gift-row .sub { font-size: 13px; color: var(--text-2); }
.gift-row .sub.done { color: var(--success-text); font-weight: 600; }
.gift-row .sub.alert { color: var(--warning-text); font-weight: 600; }
.gift-row form { margin: 0; }
.gift-row .actions { display: flex; gap: 6px; flex: none; }

/* ------------------------------------------------------------- Auth ---- */

.auth-page { position: relative; min-height: 100vh; min-height: 100dvh; overflow: hidden;
  display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-bg {
  position: absolute; inset: -40px; display: grid; grid-template-columns: repeat(7, 1fr); gap: 16px;
  opacity: 0.55; filter: saturate(1.1); pointer-events: none; transform: rotate(-4deg) scale(1.1);
}
.auth-bg div { border-radius: 24px; }
.auth-bg-col { display: flex; flex-direction: column; gap: 16px; }
.auth-bg-col:nth-child(even) { margin-top: -80px; }
.auth-bg .t1 { height: 180px; } .auth-bg .t2 { height: 260px; } .auth-bg .t3 { height: 220px; }
.auth-bg .t4 { height: 300px; }
.auth-bg-fade { position: absolute; inset: 0; background: radial-gradient(ellipse at center, var(--bg) 25%, transparent 80%); opacity: 0.85; pointer-events: none; }

.auth-card {
  position: relative; z-index: 1; width: 100%; max-width: 484px;
  padding: 28px 40px 32px; border-radius: var(--radius-xl);
  background: var(--surface-raised); box-shadow: var(--shadow-pop); text-align: center;
}
.auth-card .brand-mark { width: 44px; height: 44px; margin: 0 auto 12px; }
.auth-card h1 { font-size: 30px; margin-bottom: 6px; }
.auth-card .lead { color: var(--text-2); margin-bottom: 22px; }
.auth-card form { max-width: 290px; margin: 0 auto; text-align: left; }
.auth-card .btn { width: 100%; margin-top: 4px; }
.auth-card .aux { margin-top: 14px; font-size: 14px; font-weight: 600; }
.auth-card .fine { margin-top: 22px; font-size: 12px; color: var(--text-2); }
.auth-card .invite-email {
  display: inline-flex; align-items: center; gap: 8px; margin-bottom: 18px; padding: 6px 14px;
  border-radius: 18px; background: var(--surface-2); font-size: 14px; font-weight: 600;
}

/* ------------------------------------------------------------ Toast ---- */

.toasts {
  position: fixed; left: 50%; bottom: 24px; z-index: 100; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; width: max-content; max-width: calc(100vw - 32px);
}
.toast {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px 14px 20px;
  border-radius: var(--radius-m); background: var(--toast-bg); color: var(--toast-text);
  font-weight: 600; font-size: 15px; box-shadow: var(--shadow-pop);
  animation: toast-in 0.25s ease-out;
}
.toast.leaving { animation: toast-out 0.25s ease-in forwards; }
.toast.error { background: var(--red); color: #fff; }
.toast button { flex: none; width: 28px; height: 28px; border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer; display: grid; place-items: center; }
.toast button:hover { background: rgba(127, 127, 127, 0.25); }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(16px); } }

/* ------------------------------------------------------- Bottom nav ---- */

.bottom-nav { display: none; }

.fab {
  position: fixed; right: 24px; bottom: 24px; z-index: 40;
  width: 56px; height: 56px; border-radius: 50%; border: 0;
  display: grid; place-items: center;
  background: var(--surface-raised); color: var(--text); box-shadow: var(--shadow-pop);
}
.fab:hover { background: var(--surface-2); }

.pager { display: flex; justify-content: center; gap: 8px; margin: 12px 0 24px; }

/* ------------------------------------------------------- Responsive ---- */

@media (max-width: 1100px) {
  .brand-name { display: none; }
}

@media (max-width: 860px) {
  :root { --header-h: 64px; --gutter: 12px; }
  .main-nav, .header-actions .desktop-only { display: none; }
  .brand { padding: 0 4px; }
  .site-header { gap: 4px; }

  .bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    display: flex; justify-content: space-around; align-items: center;
    height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom));
    padding: 0 8px env(safe-area-inset-bottom);
    background: var(--bg); box-shadow: 0 -1px 0 var(--border-soft);
  }
  .bottom-nav a {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    width: 64px; height: 52px; border-radius: var(--radius-m);
    color: var(--text-2); font-size: 11px; font-weight: 600; text-decoration: none !important;
  }
  .bottom-nav a.active { color: var(--text); }
  .bottom-nav a.active .icon { stroke-width: 2.6; }
  .bottom-nav .add {
    display: grid; place-items: center;
    width: 48px; height: 40px; border-radius: 14px; background: var(--red); color: #fff;
  }
  .bottom-nav .dot {
    position: absolute; top: 4px; right: 14px; min-width: 16px; height: 16px; padding: 0 4px;
    border-radius: 8px; background: var(--red); color: #fff; font-size: 10px; line-height: 16px; text-align: center;
  }
  .page { padding-bottom: calc(var(--bottom-nav-h) + 32px + env(safe-area-inset-bottom)); }
  .toasts { bottom: calc(var(--bottom-nav-h) + 16px + env(safe-area-inset-bottom)); }
  .fab { display: none; }
  .back-link { display: none; }

  .closeup { grid-template-columns: 1fr; border-radius: var(--radius-l); margin-top: 0; }
  .closeup-media img { max-height: 70vh; }
  .closeup-media .pin-text { min-height: 280px; font-size: 30px; }
  .closeup-body { padding: 20px 20px 24px; }
  .closeup-title { font-size: 26px; }
}

@media (max-width: 600px) {
  :root { --col: 160px; --gutter: 10px; }
  .masonry { column-count: 2; column-width: auto; }
  .pin { margin-bottom: 12px; }
  .pin-text { min-height: 150px; font-size: 18px; padding: 14px; }
  .pin-text.tall { min-height: 200px; }
  .pin-text .pin-emoji { font-size: 24px; }
  .pin-media { border-radius: 14px; }
  .page-head h1, .profile-head h1 { font-size: 28px; }
  .member-grid { grid-template-columns: repeat(2, 1fr); }
  .member-card { padding: 18px 10px 16px; }
  .member-card .avatar-lg { width: 60px; height: 60px; font-size: 22px; }
  .panel { padding: 18px; border-radius: var(--radius-m); }
  .auth-card { padding: 24px 20px 28px; }
  .auth-bg { grid-template-columns: repeat(4, 1fr); }
  .search input { height: 44px; }
  .search .icon-sm { top: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ------------------------------------------------------- Wish form ---- */

.form-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 32px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 24px; }
.image-tools { margin-top: 12px; }
.image-tools .checkbox { margin: 0; }
@media (max-width: 760px) {
  .form-grid { grid-template-columns: 1fr; gap: 20px; }
  .image-drop { min-height: 200px; }
  .form-actions .btn { flex: 1; }
}

/* ---------------------------------------------------- Avatar photos ---- */

.avatar { overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.avatar-edit { display: flex; justify-content: center; margin: 0 0 14px; }
.avatar-picker { position: relative; display: inline-block; border-radius: 50%; cursor: pointer; }
.avatar-picker .avatar { margin: 0; }
.avatar-picker input[type="file"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.avatar-picker:hover .avatar { filter: brightness(0.92); }
.avatar-picker:focus-within { box-shadow: 0 0 0 4px var(--focus); }
.avatar-picker-badge {
  position: absolute; right: 2px; bottom: 2px; display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--surface-raised); color: var(--text); box-shadow: var(--shadow-pop);
  pointer-events: none;
}
.avatar-edit.uploading .avatar { opacity: 0.5; }

/* ------------------------------------------------- Photo from link ---- */

.link-photo { margin-top: 12px; }
.link-photo .row { gap: 6px; }
.link-photo-status { margin: 0 0 8px 4px; font-size: 13px; color: var(--text-2); min-height: 0; }
.link-photo-status:empty { display: none; }
.link-photo-status.ok { color: var(--success-text); font-weight: 600; }
.link-photo-status.loading::before {
  content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 8px; vertical-align: -1px;
  border: 2px solid var(--border); border-top-color: var(--red); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.image-drop .image-source {
  position: absolute; left: 12px; bottom: 12px; z-index: 1; padding: 6px 12px; border-radius: 16px;
  background: rgba(255, 255, 255, 0.92); color: #111; font-size: 12px; font-weight: 700; pointer-events: none;
}
