/* ── Design Tokens — Warm Midnight Capsule ──────────────────────────────── */
:root {
  /* Core palette */
  --bg-base:        #0B0C10;
  --bg-elevated:    #141720;
  --surface-soft:   #1C2130;
  --accent:         #F2C98A;
  --text-primary:   #F6F3EE;
  --text-secondary: #B8BFCC;
  --line-soft:      #2A3140;
  --state-success:  #6BC79A;
  --state-warning:  #E2B867;
  --state-danger:   #E07A86;

  /* Legacy aliases — keep for any inline references */
  --bg:           var(--bg-base);
  --text:         var(--text-primary);
  --hint:         var(--text-secondary);
  --link:         var(--accent);
  --btn-bg:       var(--accent);
  --btn-text:     var(--bg-base);
  --secondary-bg: var(--bg-elevated);

  /* Mercy layer — warm overtones for emotionally resonant surfaces.
     Derived from --accent so they shift with the user's preset choice.
     Applied via border/background on pair-identity and empty-state components.
     Does NOT override the base dark palette — purely additive. */
  --mercy-border:  color-mix(in srgb, var(--accent) 18%, transparent);
  --mercy-surface: color-mix(in srgb, var(--accent)  4%, transparent);
}

/* ── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* html must be dark too — prevents white flash before CSS paints */
html { background: #0B0C10; color-scheme: dark; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 16px env(safe-area-inset-bottom, 16px);
}

/* When tab bar is present, add bottom padding so content isn't hidden */
#app.has-tabbar {
  padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
}

.hidden { display: none !important; }
.hint { color: var(--text-secondary); }

/* ── Loading ────────────────────────────────────────────────────────────── */
.loading-center {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--line-soft);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.error-text {
  color: var(--state-danger);
  text-align: center;
  padding: 24px;
  font-size: 0.95rem;
}

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn-primary, .btn-secondary {
  display: block;
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  margin-top: 12px;
  transition: opacity 0.15s;
}
.btn-primary:disabled, .btn-secondary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary  { background: var(--accent); color: var(--bg-base); }
.btn-secondary { background: var(--surface-soft); color: var(--text-primary); }
.btn-primary:active:not(:disabled)  { opacity: 0.82; }
.btn-secondary:active:not(:disabled) { opacity: 0.7; }

.btn-danger-soft {
  background: transparent;
  color: var(--state-danger);
  border: 1px solid var(--state-danger);
}

.btn-small {
  padding: 6px 14px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
}
.btn-small.btn-primary   { background: var(--accent); color: var(--bg-base); }
.btn-small.btn-secondary { background: var(--surface-soft); color: var(--text-primary); }
.btn-small.btn-danger-sm { background: transparent; color: var(--state-danger); border: 1px solid var(--state-danger); }
.btn-small:active:not(:disabled) { opacity: 0.75; }

/* ── Forms ──────────────────────────────────────────────────────────────── */
.form-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 20px;
  margin-top: 8px;
  color: var(--text-primary);
}

form label {
  display: block;
  margin-bottom: 16px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

form input[type="text"],
form input[type="date"] {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 11px 14px;
  border: 1.5px solid var(--line-soft);
  border-radius: 10px;
  font-size: 1rem;
  background: var(--surface-soft);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s;
  -webkit-appearance: none;
}
form input:focus { border-color: var(--accent); }

/* Date input calendar icon color on WebKit */
::-webkit-calendar-picker-indicator { filter: invert(0.8); cursor: pointer; }

/* ── Cards ──────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-elevated);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.card-title { font-weight: 600; margin-bottom: 6px; color: var(--text-primary); }
.card-sub   { font-size: 0.85rem; color: var(--text-secondary); margin-top: 2px; }
.card-actions { margin-top: 10px; display: flex; gap: 8px; }

/* ── Hero / Timer ───────────────────────────────────────────────────────── */
.hero {
  text-align: center;
  padding: 40px 0 28px;
}
.couple-name  { font-size: 1.5rem; font-weight: 700; margin-bottom: 20px; color: var(--text-primary); }
.timer-block  { margin-bottom: 4px; }
.timer-days   { font-size: 5rem; font-weight: 800; color: var(--accent); line-height: 1; }
.timer-label  { display: block; font-size: 1rem; color: var(--text-secondary); margin-top: 4px; }
.timer-detail { font-size: 0.82rem; color: var(--text-secondary); margin-top: 4px; }

/* ── Member portrait grid ────────────────────────────────────────────────── */
.profile-members-grid {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.profile-member-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-elevated);
  border-radius: 12px;
  padding: 10px 14px;
  flex: 1;
  min-width: 0;
}
.member-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface-soft);
  border: 1.5px solid var(--line-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
  letter-spacing: 0.02em;
}
/* Avatar image inside .member-avatar circle */
.member-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}
.member-info { min-width: 0; }
.member-name {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.member-handle {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.member-bio {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
/* legacy — kept for any non-profile usage */
.member-row {
  font-size: 0.9rem;
  padding: 4px 0;
  color: var(--text-primary);
}

/* ── Invite code ────────────────────────────────────────────────────────── */
.invite-code-wrap { margin: 8px 0 4px; }
.invite-code {
  display: inline-block;
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 1rem;
  background: var(--surface-soft);
  border-radius: 8px;
  padding: 6px 10px;
  word-break: break-all;
  color: var(--accent);
  letter-spacing: 0.03em;
}
.invite-expires { margin-top: 2px; }

/* ── Onboarding ─────────────────────────────────────────────────────────── */
/* ── Onboarding — Welcome ───────────────────────────────────────────────── */
.onboarding {
  text-align: center;
  padding: 72px 0 32px;
}
.onb-wordmark {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--accent);
  margin-bottom: 28px;
}
.onb-headline {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
  letter-spacing: -0.01em;
}
.onb-sub {
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 48px;
}
.onb-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ── Onboarding — Step header ───────────────────────────────────────────── */
.onb-step-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 0 24px;
}
.btn-back-icon {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 4px 8px 4px 0;
  line-height: 1;
  flex-shrink: 0;
  transition: color 0.15s;
}
.btn-back-icon:active { color: var(--text-primary); }
.onb-step-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* ── Onboarding — Hero preview card ─────────────────────────────────────── */
.onb-preview-card {
  background: var(--bg-elevated);
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  padding: 28px 24px 24px;
  text-align: center;
  margin-bottom: 28px;
}
.onb-preview-days {
  font-size: 3.5rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  letter-spacing: -0.03em;
  margin-bottom: 6px;
}
.onb-preview-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}
.onb-preview-hint {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ── Onboarding — Form extras ───────────────────────────────────────────── */
.onb-optional {
  color: var(--text-secondary);
  opacity: 0.6;
  font-weight: 400;
  font-size: 0.8em;
}
.onb-code-input {
  width: 100%;
  box-sizing: border-box;
  text-align: center;
  font-size: 1.3rem;
  font-family: monospace;
  letter-spacing: 0.06em;
  padding: 16px;
  margin-bottom: 16px;
  background: var(--surface-soft);
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  color: var(--text-primary);
  transition: border-color 0.15s;
}
.onb-code-input:focus {
  outline: none;
  border-color: var(--accent);
}
.onb-join-hint {
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.6;
  margin-bottom: 28px;
}

/* ── Invite accept page ─────────────────────────────────────────────────── */
.invite-page {
  text-align: center;
  padding: 56px 0 32px;
}
.invite-checking {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  padding: 24px 0;
}
.invite-valid-heading {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}
.invite-valid-sub {
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.5;
}
#invite-info { margin-bottom: 4px; text-align: left; }
.invite-action-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}
.invite-error-icon {
  font-size: 2.5rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
  line-height: 1;
}
.invite-error-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}
.invite-error-sub {
  color: var(--text-secondary);
  margin-bottom: 28px;
  line-height: 1.5;
}
.invite-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 0;
}
.invite-success-check {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--state-success);
  color: var(--bg-base);
  font-size: 1.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}
.invite-success-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}
.invite-success-sub {
  color: var(--text-secondary);
}

/* ── Screen header (events, etc.) ───────────────────────────────────────── */
.screen-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 0 16px;
}
.screen-title {
  flex: 1;
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0;
  color: var(--text-primary);
}
.btn-back {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.95rem;
  cursor: pointer;
  padding: 4px 0;
  white-space: nowrap;
}

/* ── Section label ───────────────────────────────────────────────────────── */
.section-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

/* ── Event item ──────────────────────────────────────────────────────────── */
.event-item {
  background: var(--bg-elevated);
  border-radius: 14px;
  padding: 14px 14px 14px 16px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-left: 3px solid transparent;
  transition: border-color 0.15s, opacity 0.15s;
}
.event-item.today {
  border-left-color: var(--accent);
  background: rgba(242, 201, 138, 0.07);
}
.event-item.soon  { border-left-color: var(--state-warning); }
.event-item.past  { opacity: 0.6; }

.event-emoji {
  font-size: 1.5rem;
  line-height: 1;
  min-width: 32px;
  text-align: center;
  flex-shrink: 0;
}
.event-body   { flex: 1; min-width: 0; }
.event-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}
.event-recur-icon {
  font-size: 0.75em;
  color: var(--text-secondary);
  margin-left: 4px;
  vertical-align: middle;
}
.event-time-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.event-date-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.event-date-text::after { content: ' ·'; }
.event-countdown {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.event-countdown.today { color: var(--accent); }
.event-countdown.soon  { color: var(--state-warning); }
.event-countdown.past  { color: var(--text-secondary); font-weight: 400; }
.event-meta {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.event-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
  align-self: center;
}

/* ── Events screen — header add button ──────────────────────────────────── */
.btn-icon-add {
  background: var(--surface-soft);
  border: 1px solid var(--line-soft);
  color: var(--accent);
  font-size: 1.2rem;
  line-height: 1;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}
.btn-icon-add:active { background: var(--line-soft); }

/* ── Small icon buttons (edit / delete on cards) ─────────────────────────── */
.btn-icon-sm {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.9rem;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.btn-icon-sm:active {
  background: var(--surface-soft);
  color: var(--text-primary);
}

/* ── Type chips ──────────────────────────────────────────────────────────── */
.type-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 18px;
}
.type-chip {
  background: var(--surface-soft);
  border: 1.5px solid var(--line-soft);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  line-height: 1.3;
}
.type-chip.active {
  background: rgba(242, 201, 138, 0.12);
  border-color: var(--accent);
  color: var(--accent);
}
.type-chip:active { opacity: 0.8; }

/* ── Events section header + past toggle ────────────────────────────────── */
.events-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  margin-top: 4px;
}
.events-past-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  padding: 4px 0;
}
.events-past-toggle:active { color: var(--text-primary); }
.events-past-toggle-arrow {
  font-size: 1rem;
  line-height: 1;
  color: var(--text-secondary);
  transition: transform 0.15s;
}

/* ── Event form card ─────────────────────────────────────────────────────── */
.event-form-card {
  background: var(--bg-elevated);
  border-radius: 16px;
  padding: 20px 16px;
  margin-bottom: 20px;
}
.event-form-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
}
.form-field-label {
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 0;
}
.form-actions-row {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}
.form-actions-row .btn-primary,
.form-actions-row .btn-secondary { flex: 1; }

/* ── Events empty state ──────────────────────────────────────────────────── */
.events-empty-state {
  text-align: center;
  padding: 40px 16px;
}
.events-empty-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  opacity: 0.65;
}
.events-empty-text {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
  max-width: 260px;
  margin: 0 auto;
}

/* Mercy-mode hint — warm subdued note used inside achievement and other
   empty sections where the CTA isn't immediate (e.g. "unlock over time"). */
.mercy-empty-hint {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.55;
  text-align: center;
  padding: 12px 8px 4px;
  opacity: 0.8;
}

/* ── Next event on home ──────────────────────────────────────────────────── */
.next-event-row { display: flex; align-items: center; gap: 10px; }
.next-event-emoji { font-size: 1.6rem; line-height: 1; }
.next-event-info { flex: 1; }
.next-event-title { font-weight: 600; font-size: 0.95rem; color: var(--text-primary); }
.next-event-date  { font-size: 0.82rem; color: var(--text-secondary); margin-top: 2px; }

/* ── Form select ─────────────────────────────────────────────────────────── */
.form-select {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 11px 14px;
  border: 1.5px solid var(--line-soft);
  border-radius: 10px;
  font-size: 1rem;
  background: var(--surface-soft);
  color: var(--text-primary);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.form-select:focus { border-color: var(--accent); }

/* ── Checkbox label ──────────────────────────────────────────────────────── */
.label-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary) !important;
  cursor: pointer;
}
.label-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ── Events empty state ──────────────────────────────────────────────────── */
.events-empty { text-align: center; padding: 24px 0; font-size: 0.9rem; color: var(--text-secondary); }

/* ── Home nav row ────────────────────────────────────────────────────────── */
.home-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}
.home-nav .btn-secondary { margin-top: 0; }

/* ── Memory item ─────────────────────────────────────────────────────────── */
/* ── Last memory on home ─────────────────────────────────────────────────── */
.last-memory-row { display: flex; align-items: center; gap: 10px; }
.last-memory-thumb {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--surface-soft);
}
.last-memory-info { flex: 1; min-width: 0; }
.last-memory-title {
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
}
.last-memory-date { font-size: 0.82rem; color: var(--text-secondary); margin-top: 2px; }

/* ── Memory gallery card ─────────────────────────────────────────────────── */
.memory-card {
  background: var(--bg-elevated);
  border-radius: 16px;
  margin-bottom: 14px;
  overflow: hidden;
  cursor: pointer;
  transition: opacity 0.12s;
  -webkit-tap-highlight-color: transparent;
}
.memory-card:active { opacity: 0.82; }
.memory-card-photo-wrap {
  position: relative;
  padding-top: 62%;   /* ~8:5 cinematic ratio */
  background: var(--surface-soft);
  overflow: hidden;
}
.memory-card-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.memory-card-no-photo {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  opacity: 0.25;
}
.memory-card-footer {
  padding: 12px 16px 14px;
}
.memory-card-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.memory-card-date {
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.memory-card-snippet {
  opacity: 0.75;
}

/* ── Memory grid (2-column) ──────────────────────────────────────────────── */
.memories-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 4px;
}
.memories-grid .memory-card { margin-bottom: 0; }

/* ── Pinned memory card ──────────────────────────────────────────────────── */
.memory-card-pinned {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.memory-pin-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 0.85rem;
  background: rgba(0,0,0,.55);
  border-radius: 8px;
  padding: 2px 6px;
  pointer-events: none;
  z-index: 2;
}

/* ── Resurfaced memories section ─────────────────────────────────────────── */
.memories-resurfaced-section {
  margin-bottom: 20px;
}
.memories-resurfaced-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

/* ── Memory detail overlay ───────────────────────────────────────────────── */
.memory-detail {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(480px, 100%);
  z-index: 200;
  background: var(--bg-base);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.memory-detail-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 14px 16px 0;
}
.memory-detail-close {
  background: var(--surface-soft);
  border: none;
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.12s, background 0.12s;
}
.memory-detail-close:active {
  background: var(--line-soft);
  color: var(--text-primary);
}
.memory-detail-photo-wrap {
  position: relative;
  padding-top: 65%;
  background: var(--surface-soft);
  overflow: hidden;
  margin: 12px 0 0;
}
.memory-detail-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.memory-detail-no-photo {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.5rem;
  opacity: 0.2;
}
.memory-detail-content {
  padding: 20px 20px 40px;
}
.memory-detail-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  margin-bottom: 6px;
  line-height: 1.25;
}
.memory-detail-date {
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 16px;
}
.memory-detail-desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 24px;
}
.memory-detail-footer {
  display: flex;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
  flex-wrap: wrap;
}
.memory-detail-footer .btn-secondary { flex: 1; min-width: 100px; }
.memory-detail-footer .btn-danger-text { align-self: center; }

/* ── Photo upload zone (form) ────────────────────────────────────────────── */
.photo-zone {
  position: relative;
  margin-bottom: 18px;
}
.photo-zone-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 160px;
  border: 1.5px dashed var(--line-soft);
  border-radius: 14px;
  cursor: pointer;
  background: var(--surface-soft);
  transition: border-color 0.15s;
}
.photo-zone-empty:active { border-color: var(--accent); }
/* Compact variant for personal avatar (smaller than pair cover) */
.photo-zone--compact .photo-zone-empty { height: 80px; flex-direction: row; gap: 10px; }
.photo-zone--compact .photo-zone-preview img { height: 80px; width: 80px; border-radius: 50%; object-fit: cover; }
.photo-zone-icon { font-size: 2rem; opacity: 0.45; }
.photo-zone-text { font-size: 0.85rem; color: var(--text-secondary); }
.photo-zone-preview {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
}
.photo-zone-preview img {
  display: block;
  width: 100%;
  height: 220px;
  object-fit: cover;
}
.photo-remove-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  font-size: 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mf-upload-status {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 6px;
  min-height: 1.2em;
}

/* ── Gallery: focal-point crop UI ───────────────────────────────────────── */
.photo-crop-hint {
  font-size: 0.75rem;
  color: var(--accent);
  margin-top: 6px;
  text-align: center;
}
.photo-zone-preview { position: relative; }
.photo-crop-dot {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #fff;
  transform: translate(-50%, -50%);
  pointer-events: none;
  box-shadow: 0 0 6px rgba(0,0,0,0.6);
}

/* ── Video zone (form upload) ───────────────────────────────────────────── */
.video-zone {
  margin-bottom: 16px;
}
.video-zone-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  height: 80px;
  border: 1.5px dashed var(--line-soft);
  border-radius: 12px;
  cursor: pointer;
  background: var(--surface-soft);
}
.video-zone-empty:active { border-color: var(--accent); }
.video-zone-preview {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
}
.video-zone-player {
  width: 100%;
  max-height: 200px;
  display: block;
  background: #000;
}
/* Reuse photo-remove-btn positioning for video zone */
.video-zone-preview .photo-remove-btn {
  position: absolute;
  top: 8px;
  right: 8px;
}

/* ── Video player (detail overlay) ─────────────────────────────────────── */
.md-video-wrap {
  background: #000;
  margin-bottom: 0;
}
.md-video-player {
  width: 100%;
  max-height: 260px;
  display: block;
  background: #000;
}

/* ── Gallery: extra photos strip in form ────────────────────────────────── */
.extra-photos-section {
  margin-bottom: 16px;
}
.extra-photos-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.extra-photos-strip {
  display: flex;
  gap: 8px;
}
.extra-slot {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
}
.extra-slot--empty {
  background: var(--surface-soft);
  border: 1.5px dashed var(--line-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.extra-slot--empty:active { border-color: var(--accent); }
.extra-slot-plus {
  font-size: 1.4rem;
  color: var(--text-secondary);
  line-height: 1;
}
.extra-slot--filled img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.extra-slot-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(0,0,0,0.7);
  color: #fff;
  font-size: 0.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  line-height: 1;
}

/* ── Gallery: detail overlay strip ─────────────────────────────────────── */
.md-gallery-strip {
  display: flex;
  gap: 6px;
  padding: 8px 16px;
  overflow-x: auto;
  scrollbar-width: none;
  background: var(--bg-base);
}
.md-gallery-strip::-webkit-scrollbar { display: none; }
.md-gallery-thumb {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  display: block;
}

/* ── Profile screen ──────────────────────────────────────────────────────── */

/* Full-bleed cover zone — breaks out of #app's 16px padding */
.profile-cover-zone {
  position: relative;
  margin: -16px -16px 0;
  width: calc(100% + 32px);
  height: 220px;
  overflow: hidden;
  flex-shrink: 0;
}
.profile-cover-bg {
  position: absolute;
  inset: 0;
}
.profile-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.profile-cover-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 30%, rgba(11,12,16,0.72) 100%);
}
.profile-cover-default {
  position: absolute;
  inset: 0;
  background: linear-gradient(150deg, #1a2035 0%, #0d1420 60%, #0B0C10 100%);
}
.profile-cover-default::after {
  content: '';
  position: absolute;
  top: -40px;
  left: -40px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(242,201,138,0.13) 0%, transparent 70%);
}

/* Edit button overlaid top-right */
.profile-edit-fab {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  background: rgba(11,12,16,0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(242,201,138,0.25);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.profile-edit-fab:active { opacity: 0.75; }

/* Pair identity overlaid at bottom of cover */
.profile-hero-overlay {
  position: absolute;
  bottom: 18px;
  left: 18px;
  right: 18px;
  z-index: 2;
}
.profile-pair-name {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.15;
  letter-spacing: -0.01em;
  text-shadow: 0 1px 8px rgba(0,0,0,0.4);
  margin-bottom: 3px;
}
.profile-days {
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 500;
  opacity: 0.9;
  text-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

/* Description below cover */
.profile-description {
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text-secondary);
  margin: 14px 0 0;
  padding: 0;
}
.profile-description:empty { display: none; }

/* Section spacing */
.profile-section { margin-top: 20px; }

/* Edit form card */
.profile-edit-card {
  background: var(--bg-elevated);
  border-radius: 16px;
  padding: 20px 16px;
  margin-top: 20px;
}

/* Danger zone */
.profile-danger {
  text-align: center;
  padding: 28px 0 8px;
}

/* ── Profile stats row ───────────────────────────────────────────────────── */
.profile-stats-row {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}
.profile-stat-chip {
  flex: 1;
  background: var(--bg-elevated);
  border: none;
  border-radius: 14px;
  padding: 12px 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.1s;
}
.profile-stat-chip:active { opacity: 0.75; }
.profile-stat-num {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
}
.profile-stat-label {
  font-size: 0.72rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Profile milestone bar ───────────────────────────────────────────────── */
.profile-milestone-bar-wrap {
  background: var(--bg-elevated);
  border-radius: 14px;
  padding: 14px 16px;
}
.profile-milestone-label {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.profile-milestone-track {
  height: 4px;
  background: var(--surface-soft);
  border-radius: 2px;
  overflow: hidden;
}
.profile-milestone-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.4s ease;
}
.profile-milestone-section.milestone-near .profile-milestone-fill {
  background: var(--state-warning);
  box-shadow: 0 0 6px var(--state-warning);
}

/* ── Achievement summary sublabel ────────────────────────────────────────── */
.section-sublabel {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 2px;
  margin-bottom: 10px;
}

/* ── Share / screenshot overlay ─────────────────────────────────────────── */
.share-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.share-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-color: var(--bg-base);
  filter: blur(18px) brightness(0.45);
  transform: scale(1.08);  /* hide blur edges */
}
.share-bg-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    160deg,
    rgba(0,0,0,0.25) 0%,
    rgba(11,12,16,0.75) 100%
  );
}
.share-card {
  position: relative;
  z-index: 10;
  text-align: center;
  padding: 0 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1;
  justify-content: center;
}
.share-brand {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: 0.85;
  margin-bottom: 8px;
}
.share-days-number {
  font-size: 6rem;
  font-weight: 900;
  color: var(--accent);
  line-height: 1;
  letter-spacing: -0.03em;
}
.share-days-label {
  font-size: 1.1rem;
  color: var(--text-secondary);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: lowercase;
}
.share-since {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: -2px;
}
.share-participants {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  max-width: 100%;
}
.share-av-row {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.share-av {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface-soft);
  border: 2px solid rgba(255,255,255,0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.share-av-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.share-av-initials {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}
.share-av-names {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.01em;
  max-width: min(280px, 85vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}
.share-milestone {
  font-size: 0.8rem;
  color: var(--text-secondary);
  border: 1px solid var(--line-soft);
  border-radius: 20px;
  padding: 4px 14px;
  margin-top: 4px;
}
.share-microcopy {
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-style: italic;
  margin-top: 10px;
  opacity: 0.7;
}
.share-controls {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 24px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
  width: 100%;
  box-sizing: border-box;
}
.share-tg-btn { flex: 1; }
.share-close-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface-soft);
  border: none;
  color: var(--text-secondary);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.share-close-btn:active { opacity: 0.7; }

/* ── Achievement collectibles grid ───────────────────────────────────────── */
.achievements-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.achievement-collectible {
  background: var(--bg-elevated);
  border-radius: 14px;
  padding: 18px 12px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  position: relative;
  border: 1px solid transparent;
  transition: border-color 0.15s ease;
}
.achievement-collectible.unlocked {
  border-color: rgba(242,201,138,0.2);
}
.achievement-collectible.unlocked::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 14px;
  background: rgba(242,201,138,0.04);
  pointer-events: none;
}
.achievement-collectible.locked {
  opacity: 0.38;
  filter: grayscale(0.6);
}
.achievement-glyph {
  font-size: 2.4rem;
  line-height: 1;
  margin-bottom: 2px;
}
.achievement-collectible.locked .achievement-glyph {
  filter: grayscale(1);
}
.achievement-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}
.achievement-status {
  font-size: 0.73rem;
  color: var(--text-secondary);
  line-height: 1.3;
}
.achievement-collectible.unlocked .achievement-status {
  color: var(--state-success);
}
.achievement-stamp {
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 0.68rem;
  color: var(--accent);
  font-weight: 700;
  opacity: 0.8;
  letter-spacing: 0.04em;
}

/* keep old classes as no-ops in case referenced elsewhere */
.achievement-item { display: flex; align-items: center; gap: 12px; background: var(--bg-elevated); border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; }
.achievement-item.locked { opacity: 0.35; }
.achievement-icon { font-size: 1.6rem; line-height: 1; min-width: 32px; text-align: center; }
.achievement-info { flex: 1; }
.achievement-title { font-weight: 600; font-size: 0.95rem; color: var(--text-primary); }
.achievement-sub   { font-size: 0.8rem; color: var(--text-secondary); margin-top: 2px; }
.achievement-check { font-size: 1.2rem; color: var(--accent); flex-shrink: 0; }

/* ── Date preview (shows DD.MM.YYYY under input[type=date]) ─────────────── */
.date-preview {
  display: block;
  min-height: 1.1em;
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 4px;
  letter-spacing: 0.03em;
}

/* ── Form textarea ───────────────────────────────────────────────────────── */
.form-textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 11px 14px;
  border: 1.5px solid var(--line-soft);
  border-radius: 10px;
  font-size: 1rem;
  background: var(--surface-soft);
  color: var(--text-primary);
  outline: none;
  resize: vertical;
  min-height: 80px;
  font-family: inherit;
}
.form-textarea:focus { border-color: var(--accent); }

/* ── Gender toggle ───────────────────────────────────────────────────────── */
.gender-toggle-row {
  display: flex;
  gap: 8px;
  margin-bottom: .75rem;
}
.gender-btn {
  flex: 1;
  padding: .45rem .5rem;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text-secondary);
  font-size: .85rem;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.gender-btn.active {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  border-color: var(--accent);
  color: var(--accent);
}
.gender-btn--clear {
  flex: 0 0 auto;
  font-size: .78rem;
  color: var(--text-secondary);
  opacity: .7;
}
.gender-btn--clear.active {
  background: transparent;
  border-color: var(--line-soft);
  color: var(--text-secondary);
  opacity: 1;
}

/* ── Toggle switch ───────────────────────────────────────────────────────── */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .6rem 0;
  cursor: pointer;
  color: var(--text-primary);
  font-size: .9rem;
  gap: 12px;
}
.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.toggle-knob {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--surface-soft);
  border-radius: 24px;
  transition: background .2s;
}
.toggle-knob::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: var(--text-secondary);
  border-radius: 50%;
  transition: transform .2s, background .2s;
}
.toggle-switch input:checked + .toggle-knob { background: var(--accent); }
.toggle-switch input:checked + .toggle-knob::before {
  transform: translateX(20px);
  background: var(--bg-base);
}

/* ── Post-join «Наша пара» block ─────────────────────────────────────────── */
.home-pair-block {
  background: var(--bg-elevated);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 10px;
  border: 1px solid var(--mercy-border);
}
.home-pair-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
  margin-bottom: 10px;
}
.home-pair-members {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}
.home-pair-member {
  display: flex;
  align-items: center;
  gap: 10px;
}
.home-pair-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--surface-soft);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--text-secondary);
  overflow: hidden;
}
.home-pair-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}
.home-pair-member-info { flex: 1; min-width: 0; }
.home-pair-member-name {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.home-pair-member-bio {
  font-size: 0.78rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}
.home-pair-wish-btn { width: 100%; margin-top: 4px; }
.home-pair-wish-preview {
  background: var(--surface-soft);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.wish-preview-item { display: flex; flex-direction: column; gap: 1px; }
.wish-preview-label {
  font-size: 0.7rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.wish-preview-text {
  font-size: 0.85rem;
  color: var(--text-primary);
  line-height: 1.35;
}

/* ── Daily Wish overlay (bottom sheet) ───────────────────────────────────── */
.wish-overlay {
  position: fixed;
  inset: 0;
  z-index: 180;
  background: rgba(11,12,16,.72);
  display: flex;
  align-items: flex-end;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.wish-modal {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  background: var(--bg-elevated);
  border-radius: 18px 18px 0 0;
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--mercy-border);
}
.wish-modal-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 14px;
  color: var(--text-primary);
}
.wish-textarea {
  width: 100%;
  min-height: 80px;
  background: var(--surface-soft);
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.4;
  resize: vertical;
  margin-bottom: 10px;
}
.wish-textarea:focus { outline: none; border-color: var(--accent); }
.wish-modal-actions { display: flex; gap: 8px; }
.wish-modal-actions .btn { flex: 1; }

/* ── Anniversary mode ────────────────────────────────────────────────────── */
.anniversary-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(90deg, rgba(242,201,138,.18), rgba(242,201,138,.08));
  border: 1px solid rgba(242,201,138,.3);
  border-radius: 12px;
  margin: 12px 16px 0;
  padding: 10px 16px;
  font-size: .9rem;
  color: var(--accent);
  font-weight: 600;
  animation: anniversary-pulse 3s ease-in-out infinite;
}
.anniversary-icon { font-size: 1.1rem; }
@keyframes anniversary-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .75; }
}
.anniversary-day #days-count { color: var(--accent); text-shadow: 0 0 20px rgba(242,201,138,.4); }

/* ── Memory reaction button ──────────────────────────────────────────────── */
.memory-react-btn {
  background: none;
  border: 1px solid var(--line-soft);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: .95rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color .15s, color .15s;
  white-space: nowrap;
}
.memory-react-btn:hover,
.memory-react-btn--active { border-color: #e07a86; color: #e07a86; }

/* Reaction badge on memory cards */
.memory-card-reaction {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: .75rem;
  color: var(--text-secondary);
  margin-top: 2px;
}
.memory-card-reaction--mine { color: #e07a86; }

/* ── Tab bar ─────────────────────────────────────────────────────────────── */
/*
  Fixed elements ignore margin: auto — centering requires the translate trick.
  width: min(480px, 100%) ensures it never exceeds the app column width.
*/
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(480px, 100%);
  height: calc(56px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--bg-elevated);
  border-top: 1px solid var(--line-soft);
  display: flex;
  z-index: 100;
}

.tab-btn {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 8px 4px 6px;
  transition: color 0.12s;
  -webkit-tap-highlight-color: transparent;
}
/* Accent indicator line at top of active tab */
.tab-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 24px;
  height: 2px;
  background: var(--accent);
  border-radius: 0 0 2px 2px;
  transition: transform 0.15s ease;
}
.tab-btn.active { color: var(--accent); }
.tab-btn.active::before { transform: translateX(-50%) scaleX(1); }
.tab-icon { font-size: 1.25rem; line-height: 1; }
.tab-label { font-size: 0.62rem; font-weight: 500; letter-spacing: 0.02em; }

/* ── Ambient background (home hero) ─────────────────────────────────────── */
.ambient-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.ambient-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: blur(28px) brightness(0.28);
  transform: scale(1.1); /* hide blur edges */
}
.ambient-bg-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, #1C2130 0%, #0B0C10 100%);
}

/* Home hero wrapper needs position:relative for ambient to work */
.hero-wrap {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  margin-bottom: 12px;
}
.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 36px 20px 28px;
}

/* ── Milestone progress ──────────────────────────────────────────────────── */
.milestone-bar-wrap {
  margin-top: 16px;
}
.milestone-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.milestone-bar-track {
  height: 4px;
  background: var(--line-soft);
  border-radius: 2px;
  overflow: hidden;
}
.milestone-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.6s ease;
}

/* ── Timer secondary breakdown ───────────────────────────────────────────── */
.timer-breakdown {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 6px;
}

/* ── Quick actions row ───────────────────────────────────────────────────── */
.quick-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  margin-bottom: 4px;
}
.quick-action-btn {
  flex: 1;
  padding: 10px 8px;
  border-radius: 10px;
  border: 1px solid var(--line-soft);
  background: var(--surface-soft);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s, border-color 0.15s;
}
.quick-action-btn:active { background: var(--bg-elevated); }

/* ── Milestone pills (Home sliding window) ───────────────────────────────── */
.milestone-pills-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 8px 16px 4px;
  margin-bottom: 6px;
}
.milestone-pills {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: nowrap;
}
.ms-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 5px 13px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.ms-pill--past {
  background: var(--surface-soft);
  color: var(--accent);
  font-weight: 600;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  opacity: 1;
}
@keyframes ms-pulse {
  0%, 100% { box-shadow: 0 2px 8px var(--cute-glow-md); }
  50%       { box-shadow: 0 4px 16px var(--cute-glow-md); }
}
.ms-pill--next {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 2px 8px var(--cute-glow-md);
  animation: ms-pulse 2.5s ease-in-out infinite;
}
.ms-pill--future {
  background: var(--surface-soft);
  color: var(--text-secondary);
  border: 1px solid var(--line-soft);
  opacity: 0.7;
}
.ms-pill--done {
  background: var(--accent);
  color: #fff;
  font-weight: 500;
}
.ms-pill-check {
  font-size: 0.7rem;
}
.milestone-pills-sub {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-align: center;
}

/* ── Home 2-up grid ──────────────────────────────────────────────────────── */
.home-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}
.home-block {
  border-radius: 14px;
  overflow: hidden;
  min-height: 130px;
  position: relative;
  display: flex;
  flex-direction: column;
  -webkit-tap-highlight-color: transparent;
}

/* Event block */
.home-event-block {
  background: var(--bg-elevated);
  padding: 14px 12px;
  justify-content: space-between;
  cursor: pointer;
}
.home-event-block:active { opacity: 0.8; }

.home-block-sublabel {
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.home-event-emoji { font-size: 1.5rem; line-height: 1; margin-bottom: 4px; }
.home-event-days-num {
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
}
.home-event-days-unit {
  font-size: 0.72rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.home-event-today {
  display: inline-block;
  background: var(--accent);
  color: var(--bg-base);
  font-size: 0.68rem;
  font-weight: 700;
  border-radius: 6px;
  padding: 3px 7px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.home-event-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 6px;
}
.home-event-empty-icon { font-size: 1.4rem; margin-bottom: 6px; opacity: 0.7; }
.home-event-empty-text {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.4;
}
.home-event-empty-link {
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 500;
  margin-top: 6px;
  display: inline-block;
  text-decoration: none;
}

/* Memory block */
.home-memory-block { background: var(--surface-soft); cursor: pointer; }
.home-memory-block:active { opacity: 0.8; }

.home-memory-photo-bg {
  position: absolute;
  inset: 0;
}
.home-memory-photo-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.home-memory-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(11,12,16,0.88) 0%, rgba(11,12,16,0.15) 65%, transparent 100%);
}
.home-memory-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px 12px;
}
.home-memory-no-photo {
  padding: 14px 12px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.home-memory-icon { font-size: 1.5rem; line-height: 1; margin-bottom: 4px; }
.home-memory-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.home-memory-date {
  font-size: 0.68rem;
  color: var(--text-secondary);
  margin-top: 3px;
}
.home-memory-empty-text {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.4;
}
.home-memory-empty-link {
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 500;
  margin-top: 6px;
  display: inline-block;
  text-decoration: none;
}

/* ── Home invite card (solo state) ──────────────────────────────────────── */
.home-invite-card {
  background: var(--bg-elevated);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 10px;
  border: 1px solid var(--mercy-border);
}
.home-invite-inner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}
.home-invite-text { flex: 1; min-width: 0; }
.home-invite-title {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 6px;
  color: var(--text-primary);
}
.home-invite-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 8px;
}
/* Two primary actions side by side */
.invite-main-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
/* Single-button state (empty invite) fills full width */
.home-invite-actions > .btn-small {
  width: 100%;
}

/* ── Danger zone (bottom, minimal) ──────────────────────────────────────── */
.home-danger {
  text-align: center;
  padding: 8px 0 4px;
}
.btn-danger-text {
  background: none;
  border: none;
  color: var(--state-danger);
  font-size: 0.82rem;
  cursor: pointer;
  opacity: 0.7;
  padding: 6px 12px;
}
.btn-danger-text:active { opacity: 1; }

/* ══════════════════════════════════════════════════════════════════════════
   Polish layer — motion, loading, tactile, states
   All durations ≤ 200ms.  No bouncing.  No confetti.
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Screen reveal — subtle opacity shift on show ────────────────────────── */
.screen:not(.hidden) {
  animation: ld-reveal 0.15s ease-out;
}
@keyframes ld-reveal {
  from { opacity: 0.5; }
  to   { opacity: 1; }
}

/* ── Form panel slide-in ─────────────────────────────────────────────────── */
#event-form-wrap:not(.hidden),
#memory-form-wrap:not(.hidden),
#profile-edit-wrap:not(.hidden) {
  animation: ld-slide-in 0.17s ease-out;
}
@keyframes ld-slide-in {
  from { opacity: 0; transform: translateY(7px); }
  to   { opacity: 1; transform: none; }
}

/* ── Loading shimmer skeleton ────────────────────────────────────────────── */
.loading-shimmer {
  height: 64px;
  border-radius: 14px;
  background: linear-gradient(
    90deg,
    var(--bg-elevated) 25%,
    var(--surface-soft) 50%,
    var(--bg-elevated) 75%
  );
  background-size: 200% 100%;
  animation: ld-shimmer 1.5s ease-in-out infinite;
  margin-bottom: 10px;
}
.loading-shimmer.short { height: 44px; }
@keyframes ld-shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* ── Tactile press states ────────────────────────────────────────────────── */
.event-item         { cursor: pointer; transition: opacity 0.1s ease; }
.event-item:active  { opacity: 0.65; }

.memory-card        { transition: transform 0.12s ease, opacity 0.12s ease; }
.memory-card:active { transform: scale(0.975); opacity: 0.8; }

.quick-action-btn        { transition: opacity 0.1s ease, transform 0.12s ease; }
.quick-action-btn:active { opacity: 0.72; transform: scale(0.97); }

.home-event-block        { transition: opacity 0.1s ease; }
.home-event-block:active { opacity: 0.75; }
.home-memory-block        { transition: opacity 0.1s ease; }
.home-memory-block:active { opacity: 0.75; }

/* ── Error shake ─────────────────────────────────────────────────────────── */
@keyframes ld-shake {
  0%, 100% { transform: translateX(0); }
  20%, 60%  { transform: translateX(-5px); }
  40%, 80%  { transform: translateX(5px); }
}
.error-text.shake { animation: ld-shake 0.28s ease-out; }

/* ── Empty state action button ───────────────────────────────────────────── */
.events-empty-action {
  display: inline-block;
  margin-top: 14px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 0;
  -webkit-tap-highlight-color: transparent;
}
.events-empty-action:active { opacity: 0.65; }

/* ── Focus Timer Overlay ─────────────────────────────────────────────────── */
.focus-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--bg-base);
  display: flex;
  align-items: center;
  justify-content: center;
}
.focus-overlay.hidden { display: none; }
.focus-inner {
  text-align: center;
  padding: 40px 24px;
  width: 100%;
  max-width: 480px;
}
.focus-days {
  font-size: 7rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
}
.focus-label {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-top: 10px;
}
.focus-breakdown {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 16px;
  min-height: 1.2em;
}
.focus-milestone {
  display: inline-block;
  margin-top: 28px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  border: 1px solid var(--line-soft);
  border-radius: 20px;
  padding: 8px 20px;
}
.focus-close {
  display: block;
  margin: 48px auto 0;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.88rem;
  cursor: pointer;
  padding: 10px 24px;
  letter-spacing: 0.05em;
  opacity: 0.6;
  -webkit-tap-highlight-color: transparent;
}
.focus-close:active { opacity: 1; }

/* ── Near-milestone state ────────────────────────────────────────────────── */
.milestone-near .milestone-bar-fill {
  background: var(--state-warning);
  box-shadow: 0 0 6px rgba(226,184,103,0.45);
}
.milestone-near .milestone-label { color: var(--state-warning); }

/* ── Theme preset picker ─────────────────────────────────────────────────── */
.theme-picker {
  display: flex;
  gap: 14px;
  padding: 6px 0 8px;
  align-items: center;
}
.preset-swatch {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.1s ease;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}
.preset-swatch.preset-active {
  border-color: var(--text-primary);
  transform: scale(1.12);
}
.preset-swatch:active { transform: scale(0.95); }

/* ── Events filter chips row ─────────────────────────────────────────────── */
.events-filter-row {
  display: flex;
  gap: 8px;
  padding: 4px 0 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.events-filter-row::-webkit-scrollbar { display: none; }
.filter-chip {
  flex-shrink: 0;
  background: var(--surface-soft);
  border: 1.5px solid var(--line-soft);
  color: var(--text-secondary);
  font-size: 0.85rem;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.filter-chip.active {
  background: rgba(242, 201, 138, 0.12);
  border-color: var(--accent);
  color: var(--accent);
}
.filter-chip:active { opacity: 0.8; }

/* ── Strong countdown (today / soon) ────────────────────────────────────── */
.event-countdown.strong {
  font-size: 0.88rem;
  font-weight: 700;
}

/* ── Home event recurrence badge ─────────────────────────────────────────── */
.home-event-recur {
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ── Cute Mode ───────────────────────────────────────────────────────────── */
/* Activated via body.cute-mode (toggled by localStorage "ld_cute").
   Additive layer — strengthens the mercy token set and adds warm surface
   tints / glows. Scales with the active accent preset via color-mix.
   Never overrides layout or the base dark palette. */

body.cute-mode {
  /* Strengthened mercy tokens — derived from current accent preset */
  --mercy-border:  color-mix(in srgb, var(--accent) 32%, transparent);
  --mercy-surface: color-mix(in srgb, var(--accent) 10%, transparent);

  /* Shared derived tokens used by the rules below */
  --cute-bg-tint:    color-mix(in srgb, var(--bg-elevated) 94%, var(--accent) 6%);
  --cute-glow-sm:    color-mix(in srgb, var(--accent)  5%, transparent);
  --cute-glow-md:    color-mix(in srgb, var(--accent)  8%, transparent);
  --cute-glow-lg:    color-mix(in srgb, var(--accent) 14%, transparent);
  --cute-section-color: color-mix(in srgb, var(--text-secondary) 55%, var(--accent) 45%);
  --cute-radius-card:   18px;
  --cute-radius-btn:    14px;
}

/* Identity cards — warmer surface, rounder corners, subtle glow */
body.cute-mode .home-pair-block,
body.cute-mode .home-invite-card {
  border-radius: 20px;
  background: var(--cute-bg-tint);
  box-shadow: 0 0 28px var(--cute-glow-sm);
}

/* Member avatars — thin accent ring */
body.cute-mode .home-pair-avatar {
  box-shadow: 0 0 0 2px var(--mercy-border);
}

/* Pair block title — slightly warmer */
body.cute-mode .home-pair-title {
  color: color-mix(in srgb, var(--text-primary) 80%, var(--accent) 20%);
}

/* Wish modal — tinted surface, rounder top, soft top glow */
body.cute-mode .wish-modal {
  border-radius: 22px 22px 0 0;
  background: var(--cute-bg-tint);
  box-shadow: 0 -4px 36px var(--cute-glow-md);
}

/* Wish textarea — warm border */
body.cute-mode .wish-textarea {
  border-color: var(--mercy-border);
}

/* Empty-state copy — warmer secondary text */
body.cute-mode .mercy-empty-hint {
  opacity: 1;
  color: color-mix(in srgb, var(--text-secondary) 50%, var(--accent) 50%);
}

body.cute-mode .home-event-empty-text,
body.cute-mode .home-memory-empty-text {
  color: color-mix(in srgb, var(--text-secondary) 75%, var(--accent) 25%);
}

/* Secondary text that softly echoes the accent */
body.cute-mode .home-pair-member-bio,
body.cute-mode .wish-preview-label {
  color: color-mix(in srgb, var(--text-secondary) 65%, var(--accent) 35%);
}

/* ── Cute Mode — extended surface coverage ───────────────────────────────── */

/* Home hero — soft glow ring + warm tint around the whole wrap */
body.cute-mode .hero-wrap {
  box-shadow: 0 0 40px var(--cute-glow-md);
}

/* Timer counter — gentle amber text-glow for extra presence */
body.cute-mode .timer-days {
  text-shadow: 0 0 28px var(--cute-glow-lg);
}

/* Couple name on home hero — slightly warmer */
body.cute-mode .couple-name {
  color: color-mix(in srgb, var(--text-primary) 82%, var(--accent) 18%);
}

/* Milestone bar — brighter fill + faint track tint */
body.cute-mode .milestone-bar-fill {
  box-shadow: 0 0 8px var(--cute-glow-md);
}
body.cute-mode .milestone-label {
  color: var(--cute-section-color);
}

/* Home grid blocks — event block gets warm tint */
body.cute-mode .home-event-block {
  background: var(--cute-bg-tint);
  border-radius: var(--cute-radius-card);
}
body.cute-mode .home-block-sublabel {
  color: var(--cute-section-color);
}

/* Quick action chips — warm border + rounder */
body.cute-mode .quick-action-btn {
  border-color: var(--mercy-border);
  border-radius: var(--cute-radius-btn);
  color: color-mix(in srgb, var(--text-primary) 80%, var(--accent) 20%);
}

/* Generic card — rounder, subtle warm border */
body.cute-mode .card {
  border-radius: var(--cute-radius-card);
  border: 1px solid var(--mercy-border);
  background: var(--cute-bg-tint);
}

/* Section labels — warm accent tint */
body.cute-mode .section-label {
  color: var(--cute-section-color);
}

/* Primary button — soft ambient glow on press (always glowing slightly) */
body.cute-mode .btn-primary {
  box-shadow: 0 2px 18px var(--cute-glow-md);
  border-radius: var(--cute-radius-btn);
}
body.cute-mode .btn-secondary {
  border-radius: var(--cute-radius-btn);
  border: 1px solid var(--mercy-border);
}

/* Form inputs — warm focus ring, rounder */
body.cute-mode form input[type="text"]:focus,
body.cute-mode form input[type="date"]:focus,
body.cute-mode .form-textarea:focus,
body.cute-mode .form-select:focus {
  box-shadow: 0 0 0 3px var(--cute-glow-md);
}

/* Tab bar — subtle warm top border */
body.cute-mode .tab-bar {
  border-top-color: var(--mercy-border);
  background: color-mix(in srgb, var(--bg-elevated) 97%, var(--accent) 3%);
}

/* ── Profile screen ──────────────────────────────────────────────────── */

/* Member portrait cards — tinted + rounder */
body.cute-mode .profile-member-card {
  background: var(--cute-bg-tint);
  border-radius: var(--cute-radius-card);
  border: 1px solid var(--mercy-border);
}

/* Stat chips — tinted */
body.cute-mode .profile-stat-chip {
  background: var(--cute-bg-tint);
  border: 1px solid var(--mercy-border);
  border-radius: var(--cute-radius-card);
}

/* Milestone bar wrap — tinted */
body.cute-mode .profile-milestone-bar-wrap {
  background: var(--cute-bg-tint);
  border: 1px solid var(--mercy-border);
}
body.cute-mode .profile-milestone-label {
  color: var(--cute-section-color);
}

/* Edit form card — tinted */
body.cute-mode .profile-edit-card {
  background: var(--cute-bg-tint);
  border: 1px solid var(--mercy-border);
  border-radius: var(--cute-radius-card);
}

/* Member avatar ring on profile */
body.cute-mode .member-avatar {
  border-color: var(--mercy-border);
  box-shadow: 0 0 0 2px var(--cute-glow-sm);
}

/* ── Achievements ─────────────────────────────────────────────────────── */

/* Unlocked collectible — stronger glow + warmer inner tint */
body.cute-mode .achievement-collectible.unlocked {
  border-color: var(--mercy-border);
  box-shadow: 0 0 20px var(--cute-glow-sm);
  border-radius: var(--cute-radius-card);
}
body.cute-mode .achievement-collectible.unlocked::before {
  background: var(--mercy-surface);
}
body.cute-mode .achievement-collectible.unlocked .achievement-name {
  color: color-mix(in srgb, var(--text-primary) 80%, var(--accent) 20%);
}

/* Locked — slightly less greyed so it feels like a soft dream, not absence */
body.cute-mode .achievement-collectible.locked {
  opacity: 0.45;
  filter: grayscale(0.4);
}

/* ── Events screen ────────────────────────────────────────────────────── */

/* Event items — rounder + warm today tint */
body.cute-mode .event-item {
  border-radius: var(--cute-radius-card);
}
body.cute-mode .event-item.today {
  background: color-mix(in srgb, rgba(242,201,138,0.07) 100%, var(--cute-bg-tint) 0%);
  box-shadow: inset 0 0 0 1px var(--mercy-border);
}

/* Active type chips + filter chips — warmer active state */
body.cute-mode .type-chip.active,
body.cute-mode .filter-chip.active {
  background: var(--mercy-surface);
  border-color: var(--mercy-border);
  box-shadow: 0 0 10px var(--cute-glow-sm);
}

/* Event form card — tinted */
body.cute-mode .event-form-card {
  background: var(--cute-bg-tint);
  border: 1px solid var(--mercy-border);
  border-radius: var(--cute-radius-card);
}

/* Events empty state text — warmer */
body.cute-mode .events-empty-text {
  color: color-mix(in srgb, var(--text-secondary) 70%, var(--accent) 30%);
}

/* ── Memories screen ──────────────────────────────────────────────────── */

/* Memory cards — rounder, soft glow on hover area */
body.cute-mode .memory-card {
  border-radius: var(--cute-radius-card);
  box-shadow: 0 2px 18px var(--cute-glow-sm);
}
body.cute-mode .memory-card-pinned {
  outline-color: var(--mercy-border);
}

/* Memory detail content area — slightly tinted */
body.cute-mode .memory-detail-content {
  background: color-mix(in srgb, var(--bg-base) 97%, var(--accent) 3%);
}
body.cute-mode .memory-detail-title {
  color: color-mix(in srgb, var(--text-primary) 85%, var(--accent) 15%);
}

/* Section label inside memories section used for "год назад" label */
body.cute-mode .memories-resurfaced-label {
  color: color-mix(in srgb, var(--accent) 85%, var(--text-primary) 15%);
}

.cute-mode-toggle-row { margin-top: 8px; }
.cute-mode-label { font-size: 0.9rem; }

/* ── Sugar Blush Love World ──────────────────────────────────────────────── */
/* Activated via body.sugar-blush (ld_sugar localStorage key).
   Full creamy-pink palette swap — Pink Diary × Love Scrapbook × Glossy Sticker World.
   Builds on top of the always-on cute-mode warm base.
   "LoveDays в cute mode должен выглядеть так, будто это ваш маленький секретный
    pink-love-space" — Sugar Blush Love World brief. */

/* Fix html background flash when sugar blush is stored */
html:has(body.sugar-blush) {
  background: #FFF0F3;
  color-scheme: light;
}

body.sugar-blush {
  /* ── Core palette — Sugar Blush Love World ─────────────────────────────── */
  --bg-base:        #FFF0F3;   /* Milky Pink — main background */
  --bg-elevated:    #FFF8FA;   /* Pearl White — card surfaces */
  --surface-soft:   #FDEDF2;   /* Blush capsule — inputs, secondary */
  --accent:         #E8607A;   /* Strawberry Cream — primary CTA */
  --text-primary:   #3D1A24;   /* Deep rose-dark — main text */
  --text-secondary: #9B6070;   /* Muted blush — hints, meta */
  --line-soft:      #F4C8D4;   /* Blush divider */
  --state-success:  #6BAF7A;
  --state-warning:  #D4905A;
  --state-danger:   #D94065;   /* Cherry Kiss */

  /* Override cute-mode derived tokens for the pink world */
  --mercy-border:       #F4C8D4;
  --mercy-surface:      rgba(244, 160, 176, 0.15);
  --cute-bg-tint:       #FFF8FA;
  --cute-glow-sm:       rgba(232, 96, 122, 0.10);
  --cute-glow-md:       rgba(232, 96, 122, 0.18);
  --cute-glow-lg:       rgba(232, 96, 122, 0.28);
  --cute-section-color: #C75070;
  --cute-radius-card:   22px;
  --cute-radius-btn:    20px;

  color-scheme: light;
  background: #FFF0F3;
  color: #3D1A24;
}

/* ── Sugar Blush — Spinner ─────────────────────────────────────────────── */
body.sugar-blush .spinner {
  border-color: #F4C8D4;
  border-top-color: #E8607A;
}

/* ── Sugar Blush — Buttons ─────────────────────────────────────────────── */
/* Primary: white text on strawberry-pink glossy pill */
body.sugar-blush .btn-primary {
  background: linear-gradient(145deg, #EE7080 0%, #D94065 100%);
  color: #FFFFFF;
  box-shadow: 0 4px 22px rgba(232, 96, 122, 0.35);
}
body.sugar-blush .btn-primary:active { transform: scale(0.97); }
body.sugar-blush .btn-secondary {
  background: #FFF0F6;
  color: #3D1A24;
  box-shadow: 0 2px 10px rgba(244, 200, 212, 0.25);
}

/* ── Sugar Blush — Home hero wrap — dreamy pink gradient ───────────────── */
body.sugar-blush .hero-wrap {
  background: linear-gradient(160deg, #FDEDF2 0%, #FFF0F6 55%, #FFF8FA 100%);
  border: 1.5px solid #F4C8D4;
  box-shadow: 0 4px 32px rgba(232, 96, 122, 0.13);
}

/* Couple name — pearl white for readability on the always-dark ambient backdrop */
body.sugar-blush .couple-name {
  color: #FFF8FA;
  text-shadow: 0 1px 14px rgba(244, 160, 176, 0.40);
}

/* Timer number: strawberry pink (accent already changes, but reinforce with glow) */
body.sugar-blush .timer-days {
  color: #E8607A;
  text-shadow: 0 2px 20px rgba(232, 96, 122, 0.35);
}

/* ── Sugar Blush — Milestone bars ──────────────────────────────────────── */
body.sugar-blush .milestone-bar-fill {
  background: linear-gradient(90deg, #F4A0B0 0%, #E8607A 100%);
}
@keyframes ms-pulse-blush {
  0%, 100% { box-shadow: 0 2px 8px rgba(232,96,122,0.35); }
  50%       { box-shadow: 0 4px 18px rgba(232,96,122,0.6); }
}
body.sugar-blush .ms-pill--next {
  background: linear-gradient(135deg, #EE7080, #D94065);
  box-shadow: 0 2px 8px rgba(232,96,122,0.35);
  animation: ms-pulse-blush 2.5s ease-in-out infinite;
}
body.sugar-blush .ms-pill--done {
  background: linear-gradient(135deg, #EE7080, #D94065);
}
body.sugar-blush .ms-pill--past {
  background: rgba(244,200,212,0.25);
  color: #D94065;
  border-color: rgba(232,96,122,0.4);
  opacity: 1;
}
body.sugar-blush .ms-pill--future {
  background: #FFF0F6;
  border-color: #F4C8D4;
  color: var(--text-secondary);
}

/* ── Sugar Blush — Event item "today" — pink glow instead of amber ─────── */
/* Override the hardcoded rgba(242,201,138,0.07) from base + cute-mode */
body.sugar-blush .event-item.today {
  background: linear-gradient(135deg, #FFF0F6 0%, #FFF8FA 100%) !important;
  box-shadow: inset 0 0 0 1.5px #F4A0B0;
}

/* ── Sugar Blush — Chips active — pink gradient ────────────────────────── */
body.sugar-blush .type-chip.active,
body.sugar-blush .filter-chip.active {
  background: linear-gradient(135deg, #F4A0B0 0%, #E8607A 100%);
  border-color: transparent;
  color: #FFFFFF;
  box-shadow: 0 2px 12px rgba(232, 96, 122, 0.35);
}
body.sugar-blush .type-chip,
body.sugar-blush .filter-chip {
  background: #FFF0F6;
  border-color: #F4C8D4;
  color: #9B6070;
}

/* ── Sugar Blush — Profile cover default (no photo) ───────────────────── */
body.sugar-blush .profile-cover-default {
  background: linear-gradient(150deg, #F8C8D0 0%, #FFF0F3 60%, #FDDCE8 100%);
}
/* Keep original dark overlay intact — it ensures pair-name text is readable
   over any user photo. Only override the text itself to a warm white. */
body.sugar-blush .profile-pair-name {
  color: #FFF8FA;
}
/* Edit FAB on cover — swap dark frosted-glass for a blush-tinted one */
body.sugar-blush .profile-edit-fab {
  background: rgba(255, 248, 250, 0.78);
  border-color: rgba(244, 200, 212, 0.70);
  color: #E8607A;
}

/* ── Sugar Blush — Achievement collectibles ────────────────────────────── */
body.sugar-blush .achievement-collectible.unlocked {
  background: linear-gradient(135deg, #FFF0F6 0%, #FFF8FA 100%);
  border: 1.5px solid #F4A0B0 !important;
  box-shadow: 0 0 28px rgba(232, 96, 122, 0.22) !important;
}
body.sugar-blush .achievement-collectible.unlocked::before {
  background: rgba(232, 96, 122, 0.07) !important;
}
body.sugar-blush .achievement-collectible.unlocked .achievement-name {
  color: #C75070 !important;
}
body.sugar-blush .achievement-collectible.locked {
  filter: grayscale(0.2) sepia(0.35);
  opacity: 0.42;
}

/* ── Sugar Blush — Tab bar ─────────────────────────────────────────────── */
body.sugar-blush .tab-bar {
  background: rgba(255, 248, 250, 0.96);
  border-top-color: #F4C8D4;
  backdrop-filter: blur(12px);
  box-shadow: 0 -4px 20px rgba(244, 200, 212, 0.3);
}
body.sugar-blush .tab-btn         { color: #9B6070; }
body.sugar-blush .tab-btn.active  { color: #E8607A; }
body.sugar-blush .tab-btn::before { background: #E8607A; }

/* ── Sugar Blush — Toggle knob (profile settings) ──────────────────────── */
body.sugar-blush .toggle-knob { background: #F4C8D4; }
body.sugar-blush .toggle-knob::before { background: #C7A0A8; }
body.sugar-blush .toggle-switch input:checked + .toggle-knob {
  background: linear-gradient(135deg, #F4A0B0, #E8607A);
}
body.sugar-blush .toggle-switch input:checked + .toggle-knob::before {
  background: #FFFFFF;
}

/* ── Sugar Blush — Cute-mode toggle row (love-note card) ───────────────── */
body.sugar-blush .cute-mode-toggle-row {
  background: #FFF0F6;
  border: 1.5px solid #F4C8D4;
  border-radius: 14px;
  padding: 10px 12px;
}
body.sugar-blush .cute-mode-label { color: #C75070; }

/* ── Sugar Blush — Wish modal (love letter) ────────────────────────────── */
body.sugar-blush .wish-modal {
  background: #FFF8FA;
  border-top: 1.5px solid #F4C8D4;
  box-shadow: 0 -4px 32px rgba(232, 96, 122, 0.18);
}

/* ── Sugar Blush — Home memory block — photo overlay text ──────────────── */
/* .home-memory-content only exists when a photo is present (dark overlay beneath).
   .home-memory-no-photo uses surface-soft background so dark tokens are fine there. */
body.sugar-blush .home-memory-content .home-memory-name   { color: #FFF8FA; }
body.sugar-blush .home-memory-content .home-memory-date   { color: rgba(255, 248, 250, 0.75); }
body.sugar-blush .home-memory-content .home-block-sublabel { color: rgba(255, 248, 250, 0.65); }

/* ── Sugar Blush — Memory detail ───────────────────────────────────────── */
body.sugar-blush .memory-detail-content { background: #FFF0F3; }

/* ── Sugar Blush — Anniversary banner (home) ───────────────────────────── */
body.sugar-blush .anniversary-banner {
  background: linear-gradient(90deg, rgba(244,160,176,.22), rgba(232,96,122,.10));
}

/* ── Sugar Blush — Crop sheet ──────────────────────────────────────────── */
body.sugar-blush .crop-sheet {
  background: #FFF8FA;
  border-top: 1.5px solid #F4C8D4;
}

/* ── Sugar Blush — Onboarding preview card ─────────────────────────────── */
body.sugar-blush .onb-preview-card {
  background: #FFF8FA;
  border: 1.5px solid #F4C8D4;
}

/* ── Sugar Blush — Share card ──────────────────────────────────────────── */
body.sugar-blush .share-card {
  background: linear-gradient(160deg, #FDEDF2 0%, #FFF0F6 60%, #FFF8FA 100%);
  border: 1.5px solid #F4C8D4;
}
body.sugar-blush .share-brand        { color: #E8607A; }
body.sugar-blush .share-days-number  { color: #E8607A; }
body.sugar-blush .share-av           { border-color: rgba(232,96,122,0.3); }

/* ── Crop Editor ─────────────────────────────────────────────────────────── */
/* Pan-to-position, canvas-based, no library dependencies.
   z-index 450: above img-viewer (400), memory-detail (200), wish (180). */
.crop-editor {
  position: fixed;
  inset: 0;
  z-index: 450;
  background: rgba(0, 0, 0, 0.82);
  display: flex;
  align-items: flex-end;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.crop-sheet {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  background: var(--bg-elevated);
  border-radius: 20px 20px 0 0;
  padding: 20px 16px 20px;
}
.crop-title {
  text-align: center;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 14px;
}
/* The viewport IS the crop frame — overflow:hidden clips the panning image */
.crop-viewport {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: 8px;
  background: #111;
  touch-action: none;      /* prevent scroll while panning */
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
}
.crop-viewport:active { cursor: grabbing; }
.crop-img {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: top left;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  will-change: transform;
  display: block;
}
.crop-hint {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin: 10px 0 14px;
}
.crop-actions { display: flex; gap: 10px; }
.crop-actions .btn-primary,
.crop-actions .btn-secondary { flex: 1; margin-top: 0; }

/* ── Image viewer overlay ────────────────────────────────────────────────── */
/* z-index 400: above memory-detail (200), focus-overlay (200), wish (180)
   but well below share-overlay (900) — those are independent explicit flows. */
.img-viewer {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(0, 0, 0, 0.93);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  -webkit-tap-highlight-color: transparent;
}
.img-viewer-img {
  max-width: 96%;
  max-height: 92vh;
  object-fit: contain;
  border-radius: 4px;
  pointer-events: none;   /* tapping image counts as tapping backdrop → closes */
  user-select: none;
  -webkit-user-select: none;
}
.img-viewer-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  border: none;
  color: #fff;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.12s;
}
.img-viewer-close:active { background: rgba(255,255,255,0.28); }

/* Make tappable avatars / photos feel interactive */
.iv-tappable {
  cursor: zoom-in;
  -webkit-tap-highlight-color: transparent;
}
.iv-tappable:active { opacity: 0.8; }
