﻿/* =====================================================================
   Memoring Co — Luxury Design System v4 "Midnight & Gold"
   Deep. Editorial. Unmistakably premium.
   ===================================================================== */

/* ──────────────────────────────────────────────────────────────────────
   1. DESIGN TOKENS
   ────────────────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300;1,400;1,500&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  /* ─ Warm neutrals (light mode) ─ */
  --ink:         #1c1208;
  --ink-soft:    #3d2e1a;
  --muted:       #7a6a52;
  --muted-soft:  #a8937a;
  --cream:       #fffef9;
  --paper:       #faf5eb;
  --paper-2:     #f2e9d8;
  --paper-3:     #e6d9c2;
  --paper-4:     #d6c8ae;

  /* ─ Gold palette ─ */
  --gold:        #b8892c;
  --gold-2:      #d4a84e;
  --gold-3:      #e8c870;
  --gold-light:  #f0d898;
  --gold-pale:   #fdf5e0;
  --gold-deep:   #8a6318;
  --gold-glow:   rgba(184, 137, 44, 0.28);

  /* ─ Brand (very deep warm midnight, used for primary buttons/brand) ─ */
  --brand:       #1c1208;
  --brand-2:     #2e1e0a;
  --brand-3:     #4a3118;
  --brand-inv:   #fffef9;

  /* ─ Status ─ */
  --rose:        #b84040;
  --success-bg:  #f0f8f0;
  --success-ink: #256025;
  --danger-bg:   #fdf0f0;
  --danger-ink:  #8a2020;
  --warn-bg:     #fdf8e8;
  --warn-ink:    #7a5818;

  /* ─ Gradients ─ */
  --grad-brand:  linear-gradient(145deg, #1c1208 0%, #3d2510 100%);
  --grad-gold:   linear-gradient(135deg, #c9a040 0%, #e8c870 50%, #a87828 100%);
  --grad-gold-h: linear-gradient(135deg, #d4a84e 0%, #f0d898 100%);
  --grad-warm:   linear-gradient(160deg, #fffef9 0%, #f5ecda 100%);
  --grad-hero:   linear-gradient(160deg, #08070f 0%, #0f0e1e 55%, #08070f 100%);
  --grad-aurora: linear-gradient(135deg, #b8892c 0%, #e8c870 50%, #c9a040 100%);
  --grad-cinematic: linear-gradient(160deg, #080603 0%, #1a1208 50%, #060402 100%);

  /* ─ Glass ─ */
  --glass:       rgba(255, 254, 249, 0.88);
  --glass-blur:  saturate(180%) blur(20px);

  /* ─ Shadows (warm-tinted) ─ */
  --shadow-xs:   0 1px 3px rgba(28, 18, 8, 0.06);
  --shadow-sm:   0 2px 12px rgba(28, 18, 8, 0.08), 0 1px 3px rgba(28, 18, 8, 0.05);
  --shadow:      0 8px 32px -4px rgba(28, 18, 8, 0.14), 0 3px 10px -2px rgba(28, 18, 8, 0.08);
  --shadow-lg:   0 24px 64px -8px rgba(28, 18, 8, 0.22), 0 8px 20px -4px rgba(28, 18, 8, 0.12);
  --shadow-gold: 0 8px 28px -4px rgba(184, 137, 44, 0.40);
  --shadow-brand:0 8px 28px -4px rgba(28, 18, 8, 0.45);
  --ring-gold:   0 0 0 3px rgba(184, 137, 44, 0.22);

  /* ─ Geometry ─ */
  --rad-xs:  3px;
  --rad-sm:  8px;
  --rad:     14px;
  --rad-lg:  20px;
  --rad-xl:  28px;
  --rad-pill:9999px;

  /* ─ Typography ─ */
  --serif: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --sans:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* ─ Motion ─ */
  --ease:        cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out:    cubic-bezier(0.0, 0.0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.38, 0.64, 1);

  /* ─ Layout ─ */
  --sidebar-w:  272px;
  --topbar-h:   64px;
  --mab-h:      72px;

  /* ─ Borders ─ */
  --line:        rgba(28, 18, 8, 0.08);
  --line-med:    rgba(28, 18, 8, 0.14);
  --line-strong: rgba(28, 18, 8, 0.22);
  --line-gold:   rgba(184, 137, 44, 0.30);
}

[data-theme="dark"] {
  --ink:         #f5ede0;
  --ink-soft:    #d4bfa0;
  --muted:       #8a7560;
  --muted-soft:  #6a5a48;
  --cream:       #0f0d0a;
  --paper:       #0a0806;
  --paper-2:     #161210;
  --paper-3:     #201c18;
  --paper-4:     #2c2620;

  --gold:        #d4a84e;
  --gold-2:      #e8c870;
  --gold-3:      #f0d898;
  --gold-light:  #f5e4b8;
  --gold-pale:   #1e1a10;
  --gold-deep:   #c9a040;
  --gold-glow:   rgba(212, 168, 78, 0.22);

  --brand:       #e8c870;
  --brand-2:     #d4a84e;
  --brand-3:     #c9a040;
  --brand-inv:   #0f0d0a;

  --line:        rgba(245, 237, 224, 0.08);
  --line-med:    rgba(245, 237, 224, 0.14);
  --line-strong: rgba(245, 237, 224, 0.22);
  --line-gold:   rgba(212, 168, 78, 0.25);

  --glass:       rgba(10, 8, 6, 0.88);
  --shadow-sm:   0 2px 12px rgba(0, 0, 0, 0.40);
  --shadow:      0 8px 32px -4px rgba(0, 0, 0, 0.60), 0 3px 10px -2px rgba(0, 0, 0, 0.40);
  --shadow-lg:   0 24px 64px -8px rgba(0, 0, 0, 0.70);

  --success-bg:  rgba(37, 96, 37, 0.18);
  --success-ink: #7dd87d;
  --danger-bg:   rgba(138, 32, 32, 0.18);
  --danger-ink:  #f5a0a0;
  --warn-bg:     rgba(122, 88, 24, 0.18);
  --warn-ink:    #f0d080;

  --grad-warm:   linear-gradient(160deg, #0f0d0a 0%, #1a1510 100%);

  /* ─ Brand buttons become gold in dark mode so they remain readable ─ */
  --grad-brand:  linear-gradient(145deg, #c9a040 0%, #a87020 100%);
}

/* ──────────────────────────────────────────────────────────────────────
   2. RESET & BASE
   ────────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 15.5px;
  line-height: 1.65;
  min-height: 100vh;
  overflow-x: hidden;
}

img, video { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
a { color: var(--gold-deep); text-decoration: none; transition: color 0.15s var(--ease); }
a:hover { color: var(--gold); }

::selection { background: rgba(184, 137, 44, 0.22); color: var(--ink); }

/* ──────────────────────────────────────────────────────────────────────
   3. TYPOGRAPHY
   ────────────────────────────────────────────────────────────────────── */
h1, h2, h3, h4, h5 {
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
  line-height: 1.12;
}
h1 { font-size: clamp(2.2rem, 5vw, 3.2rem); font-weight: 400; }
h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); font-weight: 500; }
h3 { font-size: clamp(1.2rem, 2vw, 1.55rem); font-weight: 500; }
h4 { font-size: 1.1rem; font-weight: 600; font-family: var(--sans); letter-spacing: 0; }

p { line-height: 1.7; }

.display-serif {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(3rem, 7vw, 5.5rem);
  line-height: 1.0;
  letter-spacing: -0.02em;
}

/* Utilities */
.muted      { color: var(--muted); }
.text-sm    { font-size: 0.875rem; }
.text-xs    { font-size: 0.78rem; }
.center     { text-align: center; }
.serif      { font-family: var(--serif); }
.gold       { color: var(--gold); }
.mt-1       { margin-top: 0.75rem; }
.mt-2       { margin-top: 1.5rem; }
.mt-3       { margin-top: 2.5rem; }
.mb-1       { margin-bottom: 0.75rem; }
.mb-2       { margin-bottom: 1.5rem; }
.mt-0       { margin-top: 0; }
.mb-0       { margin-bottom: 0; }

.row-between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

code {
  font-family: 'SF Mono', 'JetBrains Mono', ui-monospace, monospace;
  background: var(--paper-2);
  padding: 2px 7px;
  border-radius: var(--rad-xs);
  font-size: 0.85em;
  color: var(--gold-deep);
  border: 1px solid var(--line);
}

/* ──────────────────────────────────────────────────────────────────────
   4. ANIMATIONS & KEYFRAMES
   ────────────────────────────────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-16px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes goldShimmer {
  0%   { background-position: -300% center; }
  100% { background-position: 300% center; }
}
@keyframes goldPulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 var(--gold-glow); }
  50%       { opacity: 0.8; box-shadow: 0 0 0 10px transparent; }
}
@keyframes scrollCue {
  0%, 100% { transform: translate(-50%, 0); opacity: 0.7; }
  50%       { transform: translate(-50%, 10px); opacity: 0.3; }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes nfcPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%       { transform: scale(1.18); opacity: 0.6; }
}

/* Page entrance */
.app-body .content-inner > *,
.auth-panel-inner > * {
  animation: fadeUp 0.45s var(--ease) both;
}
.app-body .content-inner > *:nth-child(1) { animation-delay: 0.04s; }
.app-body .content-inner > *:nth-child(2) { animation-delay: 0.09s; }
.app-body .content-inner > *:nth-child(3) { animation-delay: 0.14s; }
.app-body .content-inner > *:nth-child(4) { animation-delay: 0.18s; }
.app-body .content-inner > *:nth-child(5) { animation-delay: 0.22s; }

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.reveal.is-visible { opacity: 1; transform: translateY(0); }

/* ──────────────────────────────────────────────────────────────────────
   5. BUTTONS
   ────────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.4rem;
  min-height: 44px;
  background: var(--cream);
  color: var(--ink);
  border: 1px solid var(--line-med);
  border-radius: var(--rad-sm);
  font: 500 0.88rem/1 var(--sans);
  letter-spacing: 0.02em;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.18s var(--ease), color 0.18s var(--ease),
              transform 0.18s var(--ease-spring), box-shadow 0.18s var(--ease),
              border-color 0.18s var(--ease);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}
.btn:hover  { transform: translateY(-1px); box-shadow: var(--shadow-sm); text-decoration: none; border-color: var(--line-strong); }
.btn:active { transform: translateY(0); box-shadow: none; }
.btn:focus-visible { outline: none; box-shadow: var(--ring-gold); }

.btn-primary {
  background: linear-gradient(135deg, #c9a040 0%, #e8c870 45%, #b8892c 100%);
  color: #1c1208;
  border-color: transparent;
  box-shadow: 0 6px 24px -4px rgba(184, 137, 44, 0.50);
  font-weight: 600;
}
.btn-primary:hover {
  background: linear-gradient(135deg, #d4b050 0%, #f0d898 45%, #c9a040 100%);
  color: #1c1208;
  box-shadow: 0 12px 36px -4px rgba(184, 137, 44, 0.70);
  transform: translateY(-2px);
}
[data-theme="dark"] .btn-primary:hover {
  background: linear-gradient(135deg, #e0bc5a 0%, #f8e4a0 45%, #d4a84e 100%);
  color: #1c1208;
  box-shadow: 0 12px 36px -4px rgba(184, 137, 44, 0.70);
}

.btn-gold {
  background: var(--grad-gold);
  color: var(--brand);
  border-color: transparent;
  box-shadow: var(--shadow-gold);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.82rem;
}
.btn-gold:hover {
  background: var(--grad-gold-h);
  color: var(--ink);
  box-shadow: 0 14px 38px -4px rgba(184, 137, 44, 0.55);
  transform: translateY(-2px);
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--line-med);
  color: var(--ink-soft);
}
.btn-ghost:hover { background: var(--paper-2); color: var(--ink); border-color: var(--line-strong); }

.btn-ghost-gold {
  background: transparent;
  border: 1px solid var(--line-gold);
  color: var(--gold-deep);
}
.btn-ghost-gold:hover { background: rgba(184, 137, 44, 0.07); color: var(--gold); border-color: var(--gold); }

.btn-danger {
  background: linear-gradient(135deg, #8a2020, #a82828);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 16px -4px rgba(138, 32, 32, 0.45);
  font-weight: 600;
}
.btn-danger:hover { filter: brightness(1.08); color: #fff; transform: translateY(-1px); }

.btn-lg  { padding: 0.9rem 2rem; min-height: 52px; font-size: 0.95rem; }
.btn-sm  { padding: 0.38rem 0.9rem; min-height: 34px; font-size: 0.8rem; }
.btn-block { display: flex; width: 100%; }
.btn.is-active { background: var(--grad-brand); color: var(--gold-light); border-color: transparent; }

.btn-row    { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.center-row { justify-content: center; }

.link-btn {
  background: none; border: none;
  color: var(--gold-deep);
  cursor: pointer;
  font: 500 0.87rem var(--sans);
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 0;
  transition: color 0.15s;
}
.link-btn:hover { color: var(--gold); }

/* ──────────────────────────────────────────────────────────────────────
   6. FORMS
   ────────────────────────────────────────────────────────────────────── */
.form-row      { margin-bottom: 1.2rem; }
.form-row label:not(.radio-card):not(.remember-row) {
  display: block;
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.45rem;
  font-family: var(--sans);
}
.form-grid          { display: grid; gap: 1rem; }
.form-grid.cols-2   { grid-template-columns: 1fr 1fr; }
@media (max-width: 540px) { .form-grid.cols-2 { grid-template-columns: 1fr; } }

input[type=text],
input[type=email],
input[type=password],
input[type=number],
input[type=tel],
input[type=date],
input[type=file],
textarea,
select {
  width: 100%;
  padding: 0.72rem 1rem;
  min-height: 46px;
  background: var(--cream);
  color: var(--ink);
  border: 1.5px solid var(--paper-3);
  border-radius: var(--rad-sm);
  font: 400 0.93rem/1.4 var(--sans);
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease), background 0.18s;
  appearance: none;
  -webkit-appearance: none;
}
input:hover:not(:focus), textarea:hover:not(:focus), select:hover:not(:focus) {
  border-color: var(--paper-4);
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: var(--ring-gold);
  background: var(--cream);
}
textarea { min-height: 120px; resize: vertical; font-family: var(--sans); line-height: 1.6; }
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237a6a52' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

.form-hint { font-size: 0.8rem; color: var(--muted); margin-top: 0.3rem; }

.remember-row {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.8rem 1rem;
  border-radius: var(--rad-sm);
  background: var(--paper);
  border: 1.5px solid var(--paper-3);
  margin: 0.6rem 0;
}
.remember-row input { width: auto; min-height: 0; padding: 0; border-radius: 4px; accent-color: var(--gold); }
.remember-row span  { font-size: 0.9rem; color: var(--ink-soft); }

.radio-row  { display: grid; gap: 0.7rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.radio-card {
  display: flex; flex-direction: column; gap: 0.2rem;
  padding: 1rem 1.2rem;
  border: 1.5px solid var(--paper-3);
  border-radius: var(--rad);
  background: var(--cream);
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s, box-shadow 0.18s, transform 0.18s;
}
.radio-card input { display: none; }
.radio-card:hover { border-color: var(--gold-2); transform: translateY(-1px); }
.radio-card:has(input:checked) {
  border-color: var(--gold);
  background: var(--gold-pale);
  box-shadow: var(--ring-gold);
}
.radio-card strong { font-family: var(--serif); font-size: 1.2rem; font-weight: 500; color: var(--ink); }
.radio-card span   { font-size: 0.83rem; color: var(--muted); }

/* ──────────────────────────────────────────────────────────────────────
   7. ALERTS & FLASH
   ────────────────────────────────────────────────────────────────────── */
.alert, .flash {
  padding: 0.85rem 1.1rem;
  border-radius: var(--rad-sm);
  margin-bottom: 1.2rem;
  font-size: 0.9rem;
  display: flex; align-items: flex-start; gap: 0.6rem;
  line-height: 1.5;
  border: 1px solid transparent;
}
.alert-err,  .flash-err  { background: var(--danger-bg);  color: var(--danger-ink);  border-color: rgba(138, 32, 32, 0.18); }
.alert-ok,   .flash-ok   { background: var(--success-bg); color: var(--success-ink); border-color: rgba(37, 96, 37, 0.18); }
.alert-info, .flash-info { background: var(--paper-2);    color: var(--ink-soft);    border-color: var(--line-med); }

/* ──────────────────────────────────────────────────────────────────────
   8. APP SHELL
   ────────────────────────────────────────────────────────────────────── */
.app-body { background: var(--paper); }

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr auto;
  min-height: 100vh;
}

/* ── 8a. Sidebar ── */
.sidebar {
  grid-row: 1 / span 3;
  background: var(--cream);
  border-right: 1px solid var(--line);
  padding: 0 0 1rem;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow: hidden;
}

.sidebar-brand {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 1.2rem 1.2rem 1.1rem;
  border-bottom: 1px solid var(--line-gold);
  color: var(--ink);
  text-decoration: none;
  background: linear-gradient(180deg, rgba(184,137,44,0.04) 0%, transparent 100%);
  transition: opacity 0.15s;
}
.sidebar-brand:hover { opacity: 0.85; text-decoration: none; }
.sidebar-brand img, .sidebar-brand .brand-mark { flex-shrink: 0; }

.sidebar-brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.sidebar-brand .name {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.2rem;
  letter-spacing: 0.05em;
  color: var(--ink);
}
.sidebar-brand .dot  {
  background: var(--grad-gold);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  padding: 0 3px;
}
.sidebar-brand .tag  {
  font-size: 0.63rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-top: 3px;
  font-weight: 500;
}

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0.75rem;
  scrollbar-width: thin;
  scrollbar-color: var(--paper-3) transparent;
}
.sidebar-scroll::-webkit-scrollbar { width: 4px; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: var(--paper-3); border-radius: 4px; }

.nav-section       { margin-bottom: 1.5rem; }
.nav-section-label {
  padding: 0 0.6rem;
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--gold-deep);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 0.45rem;
}

.nav-link {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.58rem 0.75rem;
  border-radius: var(--rad-sm);
  font-size: 0.88rem;
  font-weight: 450;
  color: var(--ink-soft);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  margin-bottom: 2px;
  border: 1px solid transparent;
}
.nav-link:hover { background: var(--paper); color: var(--ink); text-decoration: none; }
.nav-link.is-active {
  background: linear-gradient(135deg, rgba(184,137,44,0.10), rgba(200,160,64,0.06));
  color: var(--ink);
  font-weight: 600;
  border-color: var(--line-gold);
}
.nav-link.is-active .nav-ico { color: var(--gold); }

.nav-ico {
  width: 18px; height: 18px; flex-shrink: 0;
  color: var(--muted-soft);
  display: flex; align-items: center; justify-content: center;
  transition: color 0.15s;
}
.nav-link:hover .nav-ico { color: var(--gold); }

.sidebar-foot {
  padding: 0.75rem 0.75rem 0;
  border-top: 1px solid var(--line-gold);
}
.user-card { display: flex; align-items: center; gap: 0.6rem; padding: 0.5rem 0.3rem; }
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--grad-brand);
  color: var(--gold-light);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.78rem;
  flex-shrink: 0; letter-spacing: 0.5px;
  border: 1.5px solid rgba(184, 137, 44, 0.3);
}
.user-info       { flex: 1; min-width: 0; }
.user-info .name { font-weight: 600; font-size: 0.87rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.user-info .email { font-size: 0.7rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logout {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  color: var(--muted); text-decoration: none; font-size: 1rem;
  transition: background 0.15s, color 0.15s; flex-shrink: 0;
}
.logout:hover { background: var(--paper-2); color: var(--rose); }

/* ── 8b. Topbar ── */
.topbar {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0 1.4rem;
  height: var(--topbar-h);
  background: var(--glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
}

/* Gold accent line below topbar */
.topbar::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(184,137,44,0.4) 50%, transparent 100%);
  pointer-events: none;
}

.topbar-title-group { flex: 1; min-width: 0; }
.topbar-title {
  font-family: var(--serif);
  font-size: 1.4rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1.1;
  color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.topbar-sub { font-size: 0.78rem; color: var(--muted); margin-top: 2px; }

.topbar-right { display: flex; align-items: center; gap: 0.4rem; }

.icon-btn {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 50%;
  width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--muted);
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.15s;
}
.icon-btn:hover { background: var(--paper-2); color: var(--gold); border-color: var(--line-gold); transform: scale(1.06); }

.sidebar-toggle { display: none; }

.hamburger-icon { width: 18px; height: 14px; display: flex; flex-direction: column; justify-content: space-between; }
.hamburger-icon span { display: block; height: 1.5px; background: currentColor; border-radius: 2px; transition: transform 0.2s, opacity 0.2s; }

.theme-toggle-glyph {
  width: 16px; height: 16px; border-radius: 50%;
  background: conic-gradient(#b8892c 180deg, #1c1208 180deg);
}
[data-theme="dark"] .theme-toggle-glyph {
  background: conic-gradient(#0f0d0a 180deg, #d4a84e 180deg);
}

/* ── 8c. Content ── */
.content { padding: 2rem 1.8rem calc(var(--mab-h) + 2rem); min-width: 0; }
.content-inner { max-width: 1100px; margin: 0 auto; }

/* Mobile-only action bar — desktop uses the topbar slot instead */
.page-actions-bar { display: none; justify-content: flex-end; margin-bottom: 1.5rem; gap: 0.6rem; flex-wrap: wrap; }

/* ── 8d. Footer ── */
.footer {
  grid-column: 2 / 3;
  padding: 1.5rem 2rem;
  background: var(--cream);
  border-top: 1px solid var(--line);
  font-size: 0.8rem;
  color: var(--muted);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem;
}
.footer-brand { display: flex; align-items: center; gap: 0.65rem; flex-wrap: wrap; }
.footer-wordmark {
  font-family: var(--serif); font-size: 1.1rem; font-weight: 500;
  letter-spacing: 0.04em; color: var(--ink);
}
.footer-wordmark span {
  background: var(--grad-gold); -webkit-background-clip: text;
  background-clip: text; color: transparent; padding: 0 2px; font-weight: 600;
}
.footer-copy-year { color: var(--muted); font-size: 0.8rem; }
.footer-legal { display: flex; align-items: center; gap: 0.3rem; flex-wrap: wrap; }
.footer-legal span { color: var(--line-med); }

/* Gold top rule on footer */
.footer::before {
  content: '';
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(184,137,44,0.35), transparent);
}
.footer { position: relative; }
.footer-legal a { color: var(--muted); margin: 0 0.3rem; transition: color 0.15s; }
.footer-legal a:hover { color: var(--gold); }

/* ── 8e. Mobile Sidebar ── */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: -300px; top: 0; bottom: 0;
    width: var(--sidebar-w); z-index: 60;
    box-shadow: var(--shadow-lg);
    transition: left 0.28s var(--ease-out);
    /* dvh adjusts when mobile browser chrome shows/hides — fixes iOS cutoff */
    height: 100vh;
    height: 100dvh;
    /* Allow the user-card footer to always remain visible */
    overflow: hidden;
  }
  .sidebar.is-open { left: 0; }
  /* Ensure the user card / logout area is never clipped by safe area */
  .sidebar-foot {
    flex-shrink: 0;
    padding: 0.75rem 0.75rem max(1rem, env(safe-area-inset-bottom, 1rem));
  }
  .user-card { padding: 0.4rem 0.2rem; }
  .logout {
    width: 40px;
    height: 40px;
    background: var(--paper-2);
    flex-shrink: 0;
  }
  .sidebar-backdrop {
    position: fixed; inset: 0;
    background: rgba(10, 7, 4, 0.58);
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
    z-index: 50; opacity: 0; pointer-events: none;
    transition: opacity 0.28s var(--ease-out);
  }
  .sidebar-backdrop.is-open { opacity: 1; pointer-events: auto; }
  .sidebar-toggle { display: inline-flex; }
  .topbar-actions-desktop { display: none; }
  .page-actions-bar { display: flex; justify-content: flex-start; flex-wrap: wrap; }
  .footer {
    grid-column: 1;
    padding-bottom: calc(var(--mab-h) + env(safe-area-inset-bottom, 0px) + 1.5rem);
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.65rem;
  }
  .footer-legal { justify-content: center; }
  .content { padding: 1.5rem 1rem calc(var(--mab-h) + env(safe-area-inset-bottom, 0px) + 1.5rem); }
}

/* ──────────────────────────────────────────────────────────────────────
   9. CARDS
   ────────────────────────────────────────────────────────────────────── */
.card {
  background: var(--cream);
  border-radius: var(--rad);
  padding: 1.6rem 1.8rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line);
  margin-bottom: 1.4rem;
  transition: box-shadow 0.22s var(--ease), border-color 0.22s var(--ease), transform 0.22s var(--ease);
  position: relative;
}
.card:hover { box-shadow: var(--shadow); }

.section-title {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 400;
  margin: 2rem 0 1rem;
  color: var(--ink);
  display: flex; align-items: center; gap: 0.75rem;
  letter-spacing: 0.02em;
}
.section-title::after {
  content: '';
  flex: 1; height: 1px;
  background: linear-gradient(90deg, var(--line-gold), transparent);
}

.empty {
  text-align: center; padding: 4rem 2rem;
  background: var(--cream);
  border-radius: var(--rad);
  border: 1px dashed var(--line-gold);
  box-shadow: var(--shadow-xs);
}
.empty h2, .empty h3 { font-family: var(--serif); font-weight: 400; margin: 0.75rem 0 0.4rem; }
.empty p { color: var(--muted); max-width: 380px; margin: 0 auto 1.5rem; }

.empty-icon {
  display: inline-flex; padding: 1.2rem;
  background: var(--gold-pale);
  border-radius: 50%;
  border: 1px solid var(--line-gold);
  color: var(--gold);
  margin-bottom: 0.5rem;
}
.hero-empty { padding: 5rem 2rem; }

/* ──────────────────────────────────────────────────────────────────────
   10. AUTH LAYOUT
   ────────────────────────────────────────────────────────────────────── */
.auth-body { background: #08070f; min-height: 100vh; }

.auth-split { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; }

.auth-hero {
  background: var(--grad-hero);
  color: var(--cream);
  padding: 3rem;
  display: flex; align-items: center;
  position: relative; overflow: hidden;
}

/* Noise grain */
.auth-hero::before {
  content: ''; position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.88' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.025'/%3E%3C/svg%3E");
  opacity: .55; pointer-events: none;
}

/* Gold radial glow */
.auth-hero::after {
  content: ''; position: absolute;
  width: 600px; height: 600px; border-radius: 50%;
  background: radial-gradient(circle, rgba(201, 168, 76, 0.14) 0%, transparent 65%);
  top: -100px; right: -100px; pointer-events: none;
}

.auth-hero-inner {
  position: relative; z-index: 2;
  max-width: 460px;
  animation: fadeUp 0.65s var(--ease) both;
}

.auth-brand {
  display: flex; align-items: center; gap: 0.85rem;
  color: var(--cream); text-decoration: none; margin-bottom: 3.5rem;
}
.auth-brand:hover { opacity: 0.9; text-decoration: none; color: var(--cream); }
.auth-brand img, .auth-brand .brand-mark { flex-shrink: 0; }
.auth-brand .name {
  display: block;
  font-family: var(--serif); font-size: 1.55rem; font-weight: 500; letter-spacing: 0.05em;
}
.auth-brand .dot  { color: var(--gold-3); padding: 0 3px; }
.auth-brand .tag  { display: block; font-size: 0.68rem; opacity: 0.68; text-transform: uppercase; letter-spacing: 2px; margin-top: 3px; }

.auth-hero-copy h1 {
  font-family: var(--serif);
  font-size: clamp(2rem, 4.5vw, 2.8rem);
  color: var(--cream); line-height: 1.12;
  margin: 0 0 1.1rem; font-weight: 300;
  letter-spacing: -0.01em;
}
.auth-hero-copy p { font-size: 1rem; opacity: 0.82; line-height: 1.7; color: var(--cream); }

.auth-features { list-style: none; padding: 0; margin: 1.8rem 0; }
.auth-features li {
  padding: 0.45rem 0; opacity: 0.9; font-size: 0.93rem;
  display: flex; align-items: center; gap: 0.7rem; color: var(--cream);
}
.auth-features .mark {
  width: 20px; height: 20px;
  background: rgba(200, 160, 44, 0.22);
  border: 1px solid rgba(200, 160, 44, 0.45);
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--gold-3); font-size: 0.75rem; flex-shrink: 0;
}

.auth-hero-foot { margin-top: 3.5rem; font-size: 0.78rem; opacity: 0.55; }
.auth-hero-foot a { color: var(--cream); opacity: 0.85; }

.auth-hero-ornament {
  width: 48px; height: 1px;
  background: var(--grad-gold);
  margin: 1.8rem 0; border-radius: 2px;
}

.auth-panel {
  background: #f5f4f2;
  display: flex; align-items: center; justify-content: center;
  padding: 3rem 2rem;
}
.auth-panel-inner {
  width: 100%; max-width: 420px;
  animation: fadeUp 0.55s 0.1s var(--ease) both;
}
.auth-panel-inner h2 {
  font-family: var(--serif); font-size: 2.2rem; margin: 0 0 0.4rem; font-weight: 400;
}
.auth-sub  { color: var(--muted); margin-bottom: 2rem; font-size: 0.93rem; line-height: 1.6; }
.auth-foot { text-align: center; margin-top: 1.5rem; color: var(--muted); font-size: 0.88rem; }

.auth-divider {
  text-align: center; margin: 1.4rem 0;
  position: relative; color: var(--muted); font-size: 0.78rem;
  text-transform: uppercase; letter-spacing: 1.5px; font-weight: 600;
}
.auth-divider::before,
.auth-divider::after {
  content: ''; display: inline-block; width: 34%; height: 1px;
  background: var(--line-med); vertical-align: middle; margin: 0 0.8rem;
}
.google-btn-wrap { display: flex; justify-content: center; margin: 1rem 0 0.5rem; }

@media (max-width: 860px) {
  .auth-split        { grid-template-columns: 1fr; }
  .auth-hero         { display: none; }
  .auth-panel        { padding: 2.5rem 1.5rem; min-height: 100vh; }
  .auth-panel-inner  { max-width: 100%; }
}

/* ──────────────────────────────────────────────────────────────────────
   11. DASHBOARD / JEWELRY GRID
   ────────────────────────────────────────────────────────────────────── */
.jewelry-grid { display: grid; gap: 1.4rem; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }

.jewelry-card {
  background: var(--cream);
  border-radius: var(--rad);
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  text-decoration: none; color: var(--ink);
  transition: transform 0.28s var(--ease-spring), box-shadow 0.28s var(--ease), border-color 0.28s;
  display: block;
}
.jewelry-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
  border-color: var(--line-gold);
  text-decoration: none; color: var(--ink);
}

.jewelry-cover {
  position: relative; aspect-ratio: 4/3;
  background:
    radial-gradient(ellipse at 38% 32%, rgba(201,168,76,0.14) 0%, transparent 62%),
    linear-gradient(145deg, #0a0918 0%, #100f1e 50%, #08071a 100%);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.jewelry-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.45s var(--ease); }
.jewelry-card:hover .jewelry-cover img { transform: scale(1.05); }

.jewelry-cover-placeholder {
  font-family: var(--serif);
  font-size: 5rem;
  color: var(--gold-3);
  font-weight: 300;
  opacity: 0.80;
  user-select: none;
  text-shadow: 0 0 40px rgba(200, 160, 44, 0.55), 0 2px 20px rgba(200, 160, 44, 0.35);
}

.jewelry-cover .badge {
  position: absolute; top: 0.8rem; right: 0.8rem;
  padding: 0.28rem 0.8rem;
  border-radius: var(--rad-pill);
  font-size: 0.64rem; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.badge-lost     { background: rgba(170, 40, 40, 0.92); color: #fff; }
.badge-memorial { background: rgba(184, 137, 44, 0.92); color: #1c1208; }

.jewelry-body    { padding: 1.15rem 1.4rem 1.4rem; }
.jewelry-type    { font-size: 0.63rem; color: var(--gold); text-transform: uppercase; letter-spacing: 2px; font-weight: 700; margin-bottom: 0.4rem; }
.jewelry-title   { font-family: var(--serif); font-size: 1.4rem; font-weight: 400; margin: 0 0 0.4rem; line-height: 1.15; }
.jewelry-meta    { font-size: 0.82rem; color: var(--muted); }

/* Gold left-edge on pending transfer */
.pending-transfer {
  border-left: 3px solid var(--gold);
  background: linear-gradient(135deg, var(--cream), rgba(184, 137, 44, 0.04));
}

/* ──────────────────────────────────────────────────────────────────────
   12. MEMORY SPACE (owner view)
   ────────────────────────────────────────────────────────────────────── */
.memory-space { display: flex; flex-direction: column; gap: 2rem; }

.memory-head {
  display: flex; align-items: flex-start; gap: 1.25rem;
  padding: 1.35rem 1.5rem;
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: var(--rad-lg);
  box-shadow: var(--shadow-xs);
  margin-bottom: 0.25rem;
}
.memory-head-visual { flex-shrink: 0; }
.memory-head-cover {
  width: 88px; height: 88px; object-fit: cover;
  border-radius: 12px; display: block;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-xs);
}
.memory-head-glyph {
  width: 88px; height: 88px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--paper) 0%, var(--paper-2) 100%);
  border: 1px solid var(--line);
  color: var(--ink-soft);
}
.memory-head-glyph svg { width: 52px; height: 52px; }
.memory-head-body { min-width: 0; flex: 1; padding-top: 0.15rem; }
.memory-head-type {
  margin: 0 0 0.35rem; font-size: 0.68rem; letter-spacing: 0.14em;
  text-transform: uppercase; font-weight: 600; color: var(--muted);
}
.memory-head-title {
  font-family: var(--serif); font-weight: 400; font-size: clamp(1.55rem, 3vw, 2rem);
  line-height: 1.15; letter-spacing: -0.01em; color: var(--ink);
  margin: 0 0 0.45rem;
}
.memory-head-desc {
  margin: 0; font-size: 0.92rem; line-height: 1.6;
  color: var(--ink-soft); max-width: 52ch;
}
.memory-head-tags {
  list-style: none; margin: 0.85rem 0 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 0.4rem;
}
.memory-head-tags li {
  font-size: 0.72rem; letter-spacing: 0.04em;
  padding: 0.22rem 0.62rem; border-radius: var(--rad-pill);
  background: var(--paper); border: 1px solid var(--line);
  color: var(--muted);
}

.memory-hero {
  border-radius: var(--rad-lg); min-height: 320px;
  padding: 2.5rem 2.2rem;
  background: var(--grad-hero);
  background-size: cover; background-position: center;
  color: var(--cream);
  display: flex; align-items: flex-end;
  position: relative; overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.memory-hero::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(10,6,4,0.72) 0%, transparent 60%);
  pointer-events: none;
}

/* Thin gold rule at bottom of hero */
.memory-hero::before {
  content: ''; position: absolute;
  bottom: 0; left: 0; right: 0; height: 2px;
  background: var(--grad-gold);
  z-index: 3; pointer-events: none;
}

.memory-hero-inner { position: relative; z-index: 2; max-width: 720px; }

.memory-eyebrow {
  display: inline-block; font-size: 0.66rem;
  letter-spacing: 2.5px; text-transform: uppercase; font-weight: 700;
  opacity: 0.9; margin-bottom: 0.55rem; color: var(--gold-3);
}
.memory-title {
  font-family: var(--serif);
  font-size: clamp(2rem, 4vw, 2.8rem); color: var(--cream);
  margin: 0 0 0.5rem; line-height: 1.1; font-weight: 300;
  letter-spacing: -0.01em;
}
.memory-desc  { font-size: 1rem; opacity: 0.88; max-width: 580px; line-height: 1.65; color: var(--cream); }

.memory-hero-pills { margin-top: 1.2rem; display: flex; gap: 0.5rem; flex-wrap: wrap; }
.pill {
  display: inline-block; padding: 0.3rem 0.85rem;
  background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.20);
  border-radius: var(--rad-pill); font-size: 0.74rem; font-weight: 600;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.pill-memorial { background: rgba(184, 137, 44, 0.88); color: #1c1208; border-color: transparent; }
.pill-lost     { background: rgba(170, 40, 40, 0.88); color: #fff; border-color: transparent; }

/* ── Memory thumbnail grid ───────────────────────────────────────────── */
.mem-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 10px;
  margin-bottom: 1.2rem;
}
.mem-grid-hint {
  font-size: .82rem;
  color: var(--ink-soft, #6c6760);
  margin: 0 0 .6rem;
  display: flex; align-items: center; gap: .55rem;
  flex-wrap: wrap;
}
.mem-grid-status {
  font-size: .75rem;
  color: var(--ink-soft, #8a8580);
  font-style: italic;
}
.mem-thumb {
  position: relative;
  aspect-ratio: 1;
  background: var(--paper-3);
  border-radius: var(--rad);
  overflow: hidden;
  cursor: pointer;
  outline-offset: 2px;
  transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
  user-select: none;
}
.mem-thumb:focus-visible { outline: 2px solid var(--gold); }
.mem-thumb img,
.mem-thumb video {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}
.mem-thumb:hover img,
.mem-thumb:hover video { transform: scale(1.04); }

/* Story-board grid: bigger tiles, drag-friendly. */
.mem-grid--story .mem-thumb { aspect-ratio: 4/5; }
.mem-thumb[draggable="true"] { cursor: grab; }
.mem-thumb.is-dragging {
  opacity: .35;
  cursor: grabbing;
  transform: scale(.97);
}
.mem-thumb.is-drop-target {
  box-shadow: 0 0 0 3px var(--accent, #1a1a1a) inset, 0 8px 24px rgba(0,0,0,.12);
}
.mem-thumb-handle {
  position: absolute; top: 6px; left: 6px;
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.5);
  color: #fff;
  border-radius: 999px;
  z-index: 4;
  opacity: 0;
  transition: opacity .15s ease;
  pointer-events: none;
}
.mem-thumb:hover .mem-thumb-handle,
.mem-thumb:focus-within .mem-thumb-handle { opacity: 1; }

.mem-thumb-link {
  position: absolute; inset: 0;
  display: block;
  color: inherit;
  text-decoration: none;
}
.mem-thumb-actions {
  position: absolute; top: 6px; right: 6px;
  display: flex; gap: 4px;
  z-index: 5;
  opacity: 0;
  transition: opacity .15s ease;
}
.mem-thumb:hover .mem-thumb-actions,
.mem-thumb:focus-within .mem-thumb-actions { opacity: 1; }
.mem-thumb-act {
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.6);
  color: #fff;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s ease;
}
.mem-thumb-act:hover { background: rgba(0,0,0,.85); }
.mem-thumb-act--danger:hover { background: #b02020; }
.mem-thumb-del-form { margin: 0; padding: 0; }

.mem-thumb-album-badge {
  position: absolute; bottom: 8px; left: 8px;
  background: rgba(0,0,0,.65);
  color: #fff;
  font-size: .72rem; font-weight: 600;
  padding: 3px 8px 3px 6px;
  border-radius: 999px;
  display: inline-flex; align-items: center; gap: 4px;
  z-index: 3;
  pointer-events: none;
}

/* Text/letter/voice tile cards (no media) inside the storyboard grid. */
.mem-thumb-card {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; gap: .35rem;
  padding: .85rem .9rem;
  background: linear-gradient(180deg, var(--paper-2, #f3efe8) 0%, var(--paper-3, #e9e3d8) 100%);
  color: var(--ink, #1c1c1c);
  overflow: hidden;
  font-family: var(--serif, Georgia, serif);
}
.mem-thumb-kind {
  font-size: .58rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--ink-soft, #7a756e);
  font-weight: 600;
  font-family: var(--sans, system-ui, sans-serif);
}
.mem-thumb-card-title {
  font-size: 1rem;
  line-height: 1.18;
  margin: 0;
  color: var(--ink, #1c1c1c);
}
.mem-thumb-card-body {
  font-size: .78rem;
  line-height: 1.45;
  margin: 0;
  color: var(--ink-soft, #555);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 6;
  -webkit-box-orient: vertical;
}

.mem-thumb-play {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.28);
  pointer-events: none;
}
.mem-thumb-overlay {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.55));
  padding: 0.4rem 0.5rem 0.35rem;
  font-size: 0.72rem; color: #fff; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  opacity: 0; transition: opacity 0.18s;
}
.mem-thumb:hover .mem-thumb-overlay { opacity: 1; }

/* ── Photo-reorder strip (upload form) ───────────────────────────────── */
.photo-reorder { margin-top: .9rem; }
.photo-reorder-hint {
  font-size: .8rem;
  color: var(--ink-soft, #6c6760);
  margin: 0 0 .55rem;
}
.photo-reorder-list {
  list-style: none; padding: 0; margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}
.photo-reorder-item {
  display: flex; flex-direction: column;
  gap: .5rem;
  background: var(--paper-2, #f6f3ec);
  border: 1px solid var(--line, #e3ddd1);
  border-radius: var(--rad, 12px);
  padding: 8px 8px 10px;
  cursor: grab;
  user-select: none;
  transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
}
.photo-reorder-item.is-dragging { opacity: .4; cursor: grabbing; transform: scale(.97); }
.photo-reorder-item.is-drop-target {
  box-shadow: 0 0 0 2px var(--accent, #1a1a1a);
}
.photo-reorder-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  background: var(--paper-3, #eee);
}
.photo-reorder-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}
.photo-reorder-num {
  position: absolute; top: 6px; left: 6px;
  background: rgba(0,0,0,.7);
  color: #fff;
  font-size: .7rem; font-weight: 600;
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.photo-reorder-rm {
  position: absolute; top: 6px; right: 6px;
  background: rgba(0,0,0,.6);
  color: #fff; border: 0;
  width: 22px; height: 22px; border-radius: 50%;
  font-size: 1rem; line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.photo-reorder-rm:hover { background: rgba(0,0,0,.85); }
.photo-reorder-cap {
  width: 100%;
  font-size: .82rem;
  padding: .42rem .55rem;
  border: 1px solid var(--line, #d9d4c7);
  border-radius: 8px;
  background: #fff;
  color: var(--ink, #1c1c1c);
  cursor: text;
}
.photo-reorder-cap:focus {
  outline: none;
  border-color: var(--ink, #1c1c1c);
  box-shadow: 0 0 0 3px rgba(0,0,0,.06);
}

/* ── In-browser voice recorder (memories/add.php) ────────────────────── */
.voice-recorder {
  background: linear-gradient(180deg, #fafaf6 0%, #f3efe5 100%);
  border: 1px solid var(--line, #e3ddd1);
  border-radius: 14px;
  padding: 1rem 1.1rem 1.1rem;
  margin-top: .6rem;
}
.voice-recorder-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: .6rem;
  margin-bottom: .8rem;
}
.voice-recorder-eyebrow {
  font: 600 .68rem/1.4 var(--sans, system-ui);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft, #6c6760);
}
.voice-recorder-time {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--ink, #1c1c1c);
}
.voice-recorder[data-state="recording"] .voice-recorder-time {
  color: #b02020;
}

.voice-recorder-stage {
  position: relative;
  min-height: 86px;
  background: #ffffff;
  border: 1px solid rgba(0,0,0,.06);
  border-radius: 10px;
  padding: .8rem 1rem;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.voice-recorder-viz {
  display: flex; align-items: center; justify-content: center;
  gap: 3px;
  width: 100%; height: 56px;
}
.voice-recorder-bar {
  display: inline-block;
  width: 4px; height: 100%;
  background: linear-gradient(180deg, #d8c896 0%, #b48a35 100%);
  border-radius: 2px;
  transform: scaleY(0.1);
  transform-origin: 50% 50%;
  transition: transform .08s ease-out;
  opacity: .35;
}
.voice-recorder[data-state="recording"] .voice-recorder-bar {
  opacity: 1;
  background: linear-gradient(180deg, #e2876d 0%, #b02020 100%);
}
.voice-recorder[data-state="idle"] .voice-recorder-bar:nth-child(2n) { height: 60%; }
.voice-recorder[data-state="idle"] .voice-recorder-bar:nth-child(3n) { height: 80%; }

.voice-recorder-playback {
  width: 100%;
  max-width: 100%;
}
.voice-recorder[data-state="review"] .voice-recorder-viz { display: none; }

.voice-recorder-actions {
  display: flex; flex-wrap: wrap; gap: .5rem;
  margin-top: .9rem;
}
.voice-recorder-btn {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .55rem 1.1rem;
  border-radius: 999px;
  font: 600 .76rem/1 var(--sans, system-ui);
  letter-spacing: .04em;
  cursor: pointer;
  border: 1px solid transparent;
  background: #fff;
  color: var(--ink, #1c1c1c);
  transition: background .2s ease, border-color .2s ease, transform .15s ease;
}
.voice-recorder-btn:hover { transform: translateY(-1px); }
.voice-recorder-btn--record {
  background: #b02020;
  color: #fff;
  border-color: #8e1818;
  padding-left: .9rem;
}
.voice-recorder-btn--record:hover { background: #c02828; }
.voice-recorder-dot {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 0 rgba(255,255,255,0.6);
}
.voice-recorder[data-state="recording"] .voice-recorder-btn--record { display: none; }
.voice-recorder[data-state="recording"] .voice-recorder-dot {
  animation: voiceRecDotPulse 1.2s ease-in-out infinite;
}
@keyframes voiceRecDotPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(176,32,32,0.4); }
  50%      { box-shadow: 0 0 0 6px rgba(176,32,32,0); }
}
.voice-recorder-btn--stop {
  background: #1c1c1c;
  color: #fff;
  border-color: #000;
}
.voice-recorder-btn--stop:hover { background: #2a2a2a; }
.voice-recorder-btn--ghost {
  background: transparent;
  border-color: var(--line, #d9d4c7);
  color: var(--ink, #1c1c1c);
}
.voice-recorder-btn--ghost:hover { border-color: var(--ink, #1c1c1c); }
.voice-recorder-btn--clear {
  background: transparent;
  border-color: transparent;
  color: var(--ink-soft, #6c6760);
  padding: .55rem .8rem;
}
.voice-recorder-btn--clear:hover { color: #b02020; }

.voice-recorder-msg {
  margin: .7rem 0 0;
  font-size: .82rem;
  color: var(--ink-soft, #6c6760);
  min-height: 1.2em;
}
.voice-recorder-msg.is-err { color: #b02020; }

/* ── Music modal inside keepsake view ────────────────────────────────── */
.ks-music-rights {
  background: var(--paper-2, #f6f3ec);
  border: 1px solid var(--line, #e3ddd1);
  border-radius: 10px;
  padding: .85rem 1rem;
  font-size: .82rem;
  color: var(--ink-soft, #4a4540);
  line-height: 1.5;
  margin-bottom: 1rem;
}
.ks-music-rights ul { margin: .5rem 0 0; padding-left: 1.1rem; }
.ks-music-rights li { margin-bottom: .25rem; }
.ks-music-rights a { color: var(--ink, #1c1c1c); }
.ks-music-current {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem;
  background: var(--paper-2, #f6f3ec);
  border: 1px solid var(--line, #e3ddd1);
  border-radius: 10px;
  padding: .75rem 1rem;
  margin-bottom: .5rem;
  flex-wrap: wrap;
}
.ks-music-current-title { font-weight: 600; }
.ks-music-current-credit { font-size: .78rem; color: var(--ink-soft, #6c6760); margin-top: 2px; }
.ks-music-current audio { max-width: 280px; }

/* ── Album editor grid (memories/edit.php) ───────────────────────────── */
.album-edit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  margin-top: .9rem;
}
.album-edit-tile {
  position: relative;
  display: block;
  aspect-ratio: 4/5;
  border-radius: 10px;
  overflow: hidden;
  background: var(--paper-3, #eee);
  text-decoration: none;
  color: inherit;
}
.album-edit-tile img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.album-edit-cap {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: .35rem .5rem;
  background: linear-gradient(transparent, rgba(0,0,0,.7));
  color: #fff;
  font-size: .72rem;
  line-height: 1.25;
  display: block;
}

/* ── Other memories (voice, text) list ─────────────────────────────── */
.mem-list { display: flex; flex-direction: column; gap: 0; margin-bottom: 1.2rem; }
.mem-row {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.65rem 0.8rem;
  border-radius: var(--rad);
  border: 1px solid var(--line);
  background: var(--cream);
  margin-bottom: 6px;
  font-size: 0.88rem;
}
.mem-row-ico { font-size: 1.1rem; flex-shrink: 0; }
.mem-row-body { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mem-row-body .muted { font-size: 0.84rem; }
.mem-audio { display: block; width: 100%; max-width: 340px; margin-top: 0.35rem; }
.mem-row-meta { font-size: 0.76rem; color: var(--muted); flex-shrink: 0; white-space: nowrap; }
.mem-row-del {
  flex-shrink: 0; font-size: 1.1rem; line-height: 1;
  color: var(--muted); cursor: pointer;
  background: none; border: none; padding: 0 0.2rem;
  transition: color 0.15s;
}
.mem-row-del:hover { color: var(--danger); }

/* ── Lightbox ─────────────────────────────────────────────────────────── */
.mem-lb {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,0.92);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 1.5rem;
  gap: 1rem;
}
.mem-lb[hidden] { display: none; }
.mem-lb-close {
  position: absolute; top: 1rem; right: 1rem;
  background: rgba(255,255,255,0.12); border: none; border-radius: 50%;
  width: 40px; height: 40px; font-size: 1.4rem; line-height: 1;
  color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.mem-lb-close:hover { background: rgba(255,255,255,0.25); }
.mem-lb-media { max-width: 100%; max-height: 72vh; display: flex; align-items: center; justify-content: center; }
.mem-lb-media img,
.mem-lb-media video {
  max-width: 100%; max-height: 68vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6);
}
.mem-lb-info { text-align: center; color: #f5ede0; max-width: 600px; }
.mem-lb-title { display: block; font-family: var(--serif); font-size: 1.4rem; font-weight: 400; margin-bottom: 0.4rem; }
.mem-lb-body  { font-size: 0.95rem; line-height: 1.7; color: rgba(245,237,224,0.78); margin: 0 0 0.5rem; white-space: pre-wrap; }
.mem-lb-date  { font-size: 0.68rem; letter-spacing: 2px; text-transform: uppercase; color: var(--gold-3); font-weight: 600; }
.mem-lb-del   { margin-top: 0.5rem; }

/* ── Existing aliases (still used) ─────────────────────────────────── */
.memory-stream { display: flex; flex-direction: column; gap: 1.8rem; }
.memory-item   { background: var(--cream); border-radius: var(--rad-lg); overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.memory-photo  { width: 100%; display: block; max-height: 480px; object-fit: contain; background: var(--paper-3); }
.memory-video, .memory-audio { width: 100%; display: block; }
.memory-text   { padding: 1.2rem 1.5rem; }
.memory-text h3 { font-family: var(--serif); font-weight: 400; font-size: 1.3rem; margin: 0 0 0.4rem; }
.memory-text p  { color: var(--ink-soft); line-height: 1.75; white-space: pre-wrap; }
.memory-foot   { display: flex; justify-content: space-between; align-items: center; padding: 0.75rem 1.4rem; border-top: 1px solid var(--line); font-size: 0.82rem; color: var(--muted); }
.inline-form   { display: inline; margin: 0; }
.memory-empty  { text-align: center; padding: 4.5rem 2rem; background: var(--cream); border-radius: var(--rad-lg); border: 1px solid var(--line); }
.memory-empty-mark { margin-bottom: 1rem; display: flex; justify-content: center; }
.memory-empty-icon { width: 3.25rem; height: 3.25rem; color: var(--ink-soft); opacity: 0.55; }
.memory-empty h2 { font-family: var(--serif); font-weight: 400; font-size: 1.65rem; margin: 0 0 0.5rem; color: var(--ink); }
.memory-empty p { color: var(--muted); max-width: 36ch; margin: 0 auto 1.5rem; line-height: 1.65; }
.owner-tools h3 { font-family: var(--serif); font-weight: 400; margin: 0 0 0.8rem; font-size: 1.4rem; }

/* ── Keepsake editor (view.php) ─────────────────────────────────────── */
.story-workspace { margin-top: 1.75rem; }
.story-workspace-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem;
}
.story-workspace-head h2 {
  font-family: var(--serif); font-weight: 400; font-size: 1.55rem;
  margin: 0 0 0.2rem; line-height: 1.2;
}
.story-workspace-meta { font-size: 0.82rem; color: var(--muted); margin: 0; }
.story-workspace-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.ks-manage {
  margin-top: 2.5rem; padding: 1.35rem 1.5rem;
  border: 1px solid var(--line); border-radius: var(--rad-lg);
  background: var(--cream);
}
.ks-manage-title {
  font-family: var(--serif); font-weight: 400; font-size: 1.25rem;
  margin: 0 0 0.35rem;
}
.ks-manage-sub { font-size: 0.84rem; color: var(--muted); margin: 0 0 1.1rem; line-height: 1.55; }
.ks-manage-groups { display: flex; flex-direction: column; gap: 1rem; }
.ks-manage-group-label {
  font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted); font-weight: 600; margin-bottom: 0.45rem;
}
.ks-manage-btns { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.ks-manage-btns .btn { font-size: 0.84rem; }

.ks-modal[hidden] { display: none; }
.ks-modal {
  position: fixed; inset: 0; z-index: 9000;
  display: flex; align-items: center; justify-content: center;
  padding: 1.25rem;
}
.ks-modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(8, 7, 15, 0.55);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.ks-modal-panel {
  position: relative; z-index: 1;
  width: 100%; max-width: 520px; max-height: min(88vh, 720px);
  overflow: auto; background: var(--cream);
  border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.18);
  padding: 1.5rem 1.6rem 1.35rem;
}
.ks-modal-panel--wide { max-width: 560px; }
.ks-modal-close {
  position: absolute; top: 0.85rem; right: 0.85rem;
  width: 2rem; height: 2rem; border: none; border-radius: 999px;
  background: var(--paper-3); color: var(--ink-soft);
  font-size: 1.25rem; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.ks-modal-close:hover { background: var(--line); color: var(--ink); }
.ks-modal-title {
  font-family: var(--serif); font-weight: 400; font-size: 1.35rem;
  margin: 0 2rem 0.35rem 0; line-height: 1.25;
}
.ks-modal-desc {
  font-size: 0.86rem; color: var(--muted); line-height: 1.6;
  margin: 0 0 1.25rem;
}
.ks-field { display: block; margin-bottom: 0.95rem; }
.ks-field-label {
  display: block; font-size: 0.72rem; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--muted); font-weight: 600;
  margin-bottom: 0.35rem;
}
.ks-field input,
.ks-field select,
.ks-field textarea {
  width: 100%; padding: 0.58rem 0.75rem; border-radius: 8px;
  background: var(--paper); border: 1px solid var(--line);
  color: inherit; font-size: 0.92rem;
}
.ks-field-hint {
  display: block; margin-top: 0.32rem; font-size: 0.78rem;
  color: var(--muted); line-height: 1.5;
}
.ks-field-grid {
  display: grid; gap: 0.85rem;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
}
.ks-modal-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 1.1rem; }

.ks-circle-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.75rem; padding: 0.7rem 0; border-top: 1px solid var(--line);
}
.ks-circle-row:first-of-type { border-top: none; padding-top: 0; }
.ks-circle-name { font-size: 0.92rem; }
.ks-circle-meta { font-size: 0.76rem; color: var(--muted); margin-top: 0.15rem; }

.ks-share-row {
  display: flex; gap: 0.5rem; align-items: stretch; flex-wrap: wrap;
}
.ks-share-row input {
  flex: 1; min-width: 12rem; font-size: 0.82rem;
  padding: 0.55rem 0.7rem; border-radius: 8px;
  border: 1px solid var(--line); background: var(--paper);
}

.ks-circle-banner {
  margin-top: 1rem; padding: 0.75rem 1rem;
  border-radius: var(--rad); border: 1px solid var(--line);
  background: var(--paper-3); font-size: 0.86rem; color: var(--muted);
}

@media (max-width: 640px) {
  .story-workspace-head { align-items: flex-start; }
  .ks-modal-panel { padding: 1.25rem 1.15rem 1.1rem; max-height: 92vh; }
}

/* ──────────────────────────────────────────────────────────────────────
   13. CINEMATIC FULL-BLEED VIEW (public)
   ────────────────────────────────────────────────────────────────────── */
.cinematic-body { background: #080603; color: #f5ede0; font-family: var(--sans); min-height: 100dvh; }
/* Only the film page locks scroll fully */
.cinematic-body:has(#film) { overflow: hidden; height: 100dvh; }
.cinematic-body .memoring-offline-banner { background: rgba(255,255,255,0.10); color: #f5ede0; }

.cinematic { min-height: 100vh; display: flex; flex-direction: column; }

.cinematic-hero {
  min-height: 100vh; padding: 5rem 2rem;
  background: var(--grad-cinematic);
  background-size: cover; background-position: center;
  display: flex; align-items: center; justify-content: center; flex-direction: column;
  text-align: center; position: relative; isolation: isolate;
}

.cinematic-hero::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .22 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.38; mix-blend-mode: overlay;
}
.cinematic-hero::after {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(ellipse at 50% 40%, rgba(184,137,44,0.12) 0%, transparent 65%);
  pointer-events: none;
}

.cinematic-hero-inner { max-width: 720px; animation: fadeUp 0.75s 0.15s var(--ease) both; }

.cinematic-eyebrow {
  display: inline-block; font-size: 0.72rem; letter-spacing: 3px;
  text-transform: uppercase; font-weight: 700; opacity: 0.85;
  color: var(--gold-3); margin-bottom: 1.2rem;
}

.cinematic-title {
  font-family: var(--serif); font-weight: 300;
  font-size: clamp(2.5rem, 8vw, 5rem); line-height: 1.05;
  color: #fffdf5; margin: 0 0 1.5rem; letter-spacing: -0.015em;
}

.cinematic-desc {
  font-size: clamp(1rem, 2vw, 1.18rem); line-height: 1.78;
  opacity: 0.86; max-width: 580px; margin: 0 auto;
  color: rgba(245, 237, 224, 0.92);
}

.cinematic-tag {
  display: inline-block; margin-top: 1.8rem; padding: 0.48rem 1.3rem;
  background: var(--grad-gold); color: #1c1208;
  border-radius: var(--rad-pill); font-size: 0.82rem; font-weight: 700; letter-spacing: 0.5px;
  box-shadow: var(--shadow-gold);
}

.cinematic-scroll-cue {
  position: absolute; bottom: 2rem; left: 50%; transform: translateX(-50%);
  color: var(--gold-3); font-size: 1.8rem; opacity: 0.7;
  animation: scrollCue 2.4s ease-in-out infinite;
}

.cinematic-stream { display: flex; flex-direction: column; gap: 0; }

.cinematic-item {
  padding: 5rem 2rem; min-height: 65vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  border-bottom: 1px solid rgba(245, 237, 224, 0.05);
}

.cinematic-item img,
.cinematic-item video { max-width: min(860px, 100%); max-height: 80vh; width: auto; border-radius: var(--rad-lg); box-shadow: 0 30px 80px rgba(0,0,0,0.65); }

.cinematic-item audio { width: min(520px, 100%); }

.cinematic-text { max-width: 660px; margin: 2.2rem auto 0; }
.cinematic-text h2 {
  font-family: var(--serif); color: #fffdf5;
  font-size: clamp(1.6rem, 3.5vw, 2.4rem); margin: 0 0 1rem;
  line-height: 1.15; font-weight: 400; letter-spacing: -0.01em;
}
.cinematic-text p { font-size: 1.1rem; line-height: 1.85; opacity: 0.88; white-space: pre-wrap; color: rgba(245, 237, 224, 0.92); }
.cinematic-date { color: var(--gold-3); font-size: 0.72rem; letter-spacing: 2.5px; text-transform: uppercase; font-weight: 700; margin-top: 1.8rem; opacity: 0.82; }

.cinematic-empty { padding: 7rem 2rem; text-align: center; font-family: var(--serif); font-size: 1.6rem; opacity: 0.7; color: var(--gold-3); }

.cinematic-foot {
  padding: 2.5rem 2rem; text-align: center;
  border-top: 1px solid rgba(245, 237, 224, 0.07);
  display: flex; justify-content: center; gap: 1rem; align-items: center;
  font-size: 0.85rem; color: rgba(245, 237, 224, 0.5);
}
.cinematic-brand { color: var(--gold-3); font-family: var(--serif); font-size: 1.15rem; text-decoration: none; letter-spacing: 0.05em; font-weight: 400; }
.cinematic-brand:hover { color: var(--gold-2); }
.cinematic-foot .muted { color: rgba(245, 237, 224, 0.4); }

.cinematic-hero-gate { background: linear-gradient(160deg, #1c0e04 0%, #060402 100%); }
.cinematic-error { color: #f5a0a0; margin: 1rem 0; font-size: 0.93rem; }

.pin-form { display: flex; flex-direction: column; align-items: center; gap: 1rem; margin-top: 2.5rem; }
.pin-input {
  text-align: center; letter-spacing: 20px; font-size: 2rem; font-weight: 600;
  background: rgba(245, 237, 224, 0.07); color: #fffdf5;
  border: 1.5px solid rgba(184, 137, 44, 0.35);
  border-radius: var(--rad-sm); padding: 1rem 1.8rem;
  max-width: 260px; width: 100%;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.pin-input:focus { border-color: var(--gold-2); box-shadow: 0 0 0 4px rgba(184, 137, 44, 0.18); outline: none; }

.cinematic-hero-lost { background: linear-gradient(160deg, #3a1010 0%, #060402 100%); }
.cinematic-contact   { margin-top: 2rem; font-size: 1.05rem; line-height: 1.85; color: rgba(245, 237, 224, 0.9); }
.cinematic-contact a { color: var(--gold-3); }

/* ──────────────────────────────────────────────────────────────────────
   14. ACTIVATION CARD
   ────────────────────────────────────────────────────────────────────── */
.activation-card {
  max-width: 520px;
  margin: clamp(1rem, 4vw, 4rem) auto;
  text-align: center;
  padding: clamp(1.75rem, 4vw, 3.5rem) clamp(1.25rem, 4vw, 2.5rem);
  background: var(--cream);
  border-radius: var(--rad-xl); border: 1px solid var(--line-gold);
  box-shadow: var(--shadow-lg); animation: fadeUp 0.55s var(--ease) both;
}
.activation-card::before {
  content: ''; display: block; width: 40px; height: 2px;
  background: var(--grad-gold); margin: 0 auto 1rem; border-radius: 2px;
}
.activation-mark { font-size: 2.5rem; color: var(--gold-2); margin-bottom: 0.6rem; display: block; }
.activation-card h1 { margin: 0 0 0.75rem; }

@media (max-width: 600px) {
  .activation-card {
    margin: 0.5rem auto;
    padding: 1.4rem 1.1rem 1.6rem;
    border-radius: var(--rad-lg);
  }
  .activation-card::before { margin-bottom: 0.75rem; }
  .activation-mark { font-size: 2rem; margin-bottom: 0.4rem; }
  .activation-card h1 { font-size: 1.6rem; margin-bottom: 0.6rem; }
  .activation-card .muted { font-size: 0.88rem; line-height: 1.55; }
}

/* ──────────────────────────────────────────────────────────────────────
   15. TABLES (admin)
   ────────────────────────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto; background: var(--cream);
  border-radius: var(--rad); border: 1px solid var(--line);
  box-shadow: var(--shadow-sm); margin-bottom: 1.5rem;
}
.data-table { width: 100%; border-collapse: collapse; min-width: 600px; }
.data-table th,
.data-table td {
  padding: 0.88rem 1.1rem;
  text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 0.9rem;
}
.data-table th {
  background: var(--paper);
  font-size: 0.67rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.5px; color: var(--gold-deep);
}
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: var(--paper); }

.batch-output {
  background: #0d0a06; color: var(--gold-3);
  padding: 1.2rem; border-radius: var(--rad-sm);
  border: 1px solid var(--line-gold);
  font-family: 'SF Mono', 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.82rem; white-space: pre; overflow: auto; max-height: 300px;
}

/* ──────────────────────────────────────────────────────────────────────
   16. STATS GRID
   ────────────────────────────────────────────────────────────────────── */
.stats-grid { display: grid; gap: 1.2rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: 2rem; }

.stat {
  background: var(--cream);
  padding: 1.6rem; border-radius: var(--rad);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  text-decoration: none; color: var(--ink);
  transition: transform 0.22s var(--ease-spring), box-shadow 0.22s, border-color 0.22s;
  position: relative; overflow: hidden;
}
/* Animated gold underline */
.stat::before {
  content: ''; position: absolute; bottom: 0; left: 0; right: 0;
  height: 2px; background: var(--grad-gold);
  transform: scaleX(0); transform-origin: left;
  transition: transform 0.35s var(--ease);
}
.stat:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--line-gold); text-decoration: none; }
.stat:hover::before { transform: scaleX(1); }

.stat.brand {
  background: var(--grad-hero);
  color: var(--cream); border-color: transparent;
  box-shadow: var(--shadow-brand);
}
.stat.brand .stat-label { color: rgba(245, 237, 224, 0.7); }
.stat.brand .stat-foot  { color: rgba(245, 237, 224, 0.65); }
.stat.brand .stat-value { color: var(--gold-3); }

.stat-label { font-size: 0.64rem; color: var(--gold-deep); text-transform: uppercase; letter-spacing: 2px; font-weight: 700; }
.stat-value { font-family: var(--serif); font-weight: 400; font-size: 2.8rem; line-height: 1; margin: 0.4rem 0 0.2rem; color: var(--ink); }
.stat-foot  { font-size: 0.8rem; color: var(--muted); }

/* ──────────────────────────────────────────────────────────────────────
   17. SETTINGS
   ────────────────────────────────────────────────────────────────────── */
.settings-grid { display: grid; gap: 1.4rem; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.settings-grid .card h3 { font-family: var(--serif); font-weight: 500; margin: 0 0 1rem; font-size: 1.4rem; }

.plain-list { list-style: none; padding: 0; margin: 0; }
.plain-list li {
  padding: 0.7rem 0; border-bottom: 1px solid var(--line);
  font-size: 0.93rem; color: var(--ink-soft);
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
}
.plain-list li:last-child { border-bottom: 0; }

.device-list { list-style: none; padding: 0; margin: 0; }
.device-list li { padding: 0.85rem 0; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 0.75rem; }
.device-list li:last-child { border-bottom: 0; }

.chip-card   { padding: 1rem 1.4rem; }
.chips-list  { display: flex; flex-direction: column; gap: 0.6rem; }

.transfer-note {
  border-left: 3px solid var(--gold);
  margin: 1rem 0; padding: 0.75rem 1.2rem;
  color: var(--ink-soft); font-style: italic;
  background: rgba(184, 137, 44, 0.06);
  border-radius: 0 var(--rad-sm) var(--rad-sm) 0;
}

/* ──────────────────────────────────────────────────────────────────────
   18. LEGAL
   ────────────────────────────────────────────────────────────────────── */
.legal-doc { line-height: 1.85; max-width: 720px; }
.legal-doc h1 { font-family: var(--serif); font-weight: 400; margin-bottom: 0.5rem; }
.legal-doc h2 { font-family: var(--serif); font-weight: 500; margin: 2.5rem 0 0.75rem; font-size: 1.5rem; }
.legal-doc p  { color: var(--ink-soft); margin-bottom: 1rem; }
.legal-doc ul { padding-left: 1.5rem; margin-bottom: 1rem; }
.legal-doc li { margin: 0.4rem 0; color: var(--ink-soft); }

/* ──────────────────────────────────────────────────────────────────────
   19. MOBILE ACTION BAR
   ────────────────────────────────────────────────────────────────────── */
.mobile-action-bar {
  display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  background: var(--glass);
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  border-top: 1px solid var(--line-gold);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  height: var(--mab-h);
}

.mab-inner { display: flex; align-items: stretch; height: 100%; padding: 0 0.25rem; }

.mab-tab {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 3px; padding: 0.4rem 0;
  color: var(--muted-soft); text-decoration: none;
  font-size: 0.65rem; font-weight: 500; letter-spacing: 0.3px;
  transition: color 0.18s var(--ease); position: relative;
}
.mab-tab::before {
  content: ''; position: absolute; top: 0; left: 50%;
  transform: translateX(-50%) scaleX(0); width: 32px; height: 2px;
  background: var(--grad-gold); border-radius: 0 0 4px 4px;
  transition: transform 0.22s var(--ease-spring);
}
.mab-tab.is-active { color: var(--gold-deep); }
.mab-tab.is-active::before { transform: translateX(-50%) scaleX(1); }
.mab-tab.is-active .mab-glyph { color: var(--gold); }

.mab-glyph { width: 24px; height: 24px; color: var(--muted-soft); transition: color 0.18s var(--ease), transform 0.18s var(--ease-spring); }
.mab-tab:hover .mab-glyph { transform: translateY(-1px); color: var(--gold); }

.mab-label { font-size: 0.66rem; line-height: 1; }

.mab-tab-add .mab-glyph {
  width: 36px; height: 36px;
  background: var(--grad-brand);
  border-radius: 50%; color: var(--gold-3);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-brand);
  transition: transform 0.22s var(--ease-spring), box-shadow 0.2s; padding: 8px;
}
.mab-tab-add:hover .mab-glyph { transform: translateY(-2px) scale(1.08); box-shadow: 0 10px 28px -4px rgba(28, 18, 8, 0.5); color: var(--gold-light); }
.mab-tab-add::before { display: none; }

@media (max-width: 900px) { .mobile-action-bar { display: block; } }

/* ──────────────────────────────────────────────────────────────────────
   20. OFFLINE BANNER & TOASTS
   ────────────────────────────────────────────────────────────────────── */
.memoring-toast-stack {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%);
  z-index: 9999; display: flex; flex-direction: column; gap: 0.5rem;
  pointer-events: none; align-items: center;
}

.memoring-offline-banner {
  position: fixed;
  bottom: calc(var(--mab-h) + env(safe-area-inset-bottom, 0px));
  left: 0; right: 0; z-index: 45;
  background: var(--brand);
  color: var(--gold-3);
  display: flex; align-items: center; gap: 0.65rem;
  padding: 0.65rem 1.2rem; font-size: 0.85rem;
  border-top: 1px solid rgba(184, 137, 44, 0.25);
}
@media (min-width: 901px) { .memoring-offline-banner { bottom: 0; } }

.memoring-offline-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--gold-3);
  animation: goldPulse 2s ease-in-out infinite; flex-shrink: 0;
}

/* ──────────────────────────────────────────────────────────────────────
   21. MARKETING WEBSITE
   ────────────────────────────────────────────────────────────────────── */
.mc-body {
  --mc-onyx:        #0d0a06;
  --mc-onyx-2:      #181208;
  --mc-onyx-3:      #2a1e0e;
  --mc-ivory:       #fffef5;
  --mc-ivory-2:     #f5ecda;
  --mc-pearl:       #fffef5;
  --mc-line:        rgba(28,18,8,.07);
  --mc-line-dark:   rgba(245,237,224,.09);
  --mc-ink:         #1c1208;
  --mc-ink-soft:    #4a3828;
  --mc-mute:        #7a6a52;
  --mc-mute-dark:   rgba(245,237,224,.62);

  --mc-gold:        #c9a040;
  --mc-gold-soft:   #e8c870;
  --mc-gold-deep:   #8a6318;
  --mc-gold-pale:   #fdf5e0;

  background: var(--mc-pearl);
  color: var(--mc-ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
.mc-body * { box-sizing: border-box; }
.mc-body a { color: inherit; text-decoration: none; }
.mc-body em { font-style: italic; color: var(--mc-gold); }

/* ─── Section building blocks ─── */
.mc-eyebrow {
  display: inline-flex; align-items: center; gap: 12px;
  font: 700 0.64rem/1 var(--sans);
  letter-spacing: 4px; text-transform: uppercase; color: var(--mc-gold);
  margin-bottom: 1.2rem;
}
.mc-eyebrow::before { content: ''; display: block; width: 32px; height: 1px; background: currentColor; flex-shrink: 0; }
.mc-eyebrow.gold { color: var(--mc-gold-soft); }

.mc-h2 {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(2.2rem, 5vw, 4rem); line-height: 1.06;
  letter-spacing: -0.015em; margin: 0 0 1.2rem;
}
.mc-h2.light { color: var(--mc-pearl); }

.mc-section-head            { max-width: 780px; margin-bottom: 3.5rem; }
.mc-section-head.center     { margin-left: auto; margin-right: auto; text-align: center; }

/* ─── Sticky nav ─── */
.mc-nav {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem clamp(1.25rem, 4vw, 3rem);
  background: rgba(255, 254, 245, 0.88);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--mc-line);
  transition: background 0.3s;
}
/* Thin gold bottom rule on nav */
.mc-nav::after {
  content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(201, 160, 64, 0.5), transparent);
  pointer-events: none;
}

.mc-brand { display: inline-flex; align-items: center; gap: 0.85rem; color: var(--mc-onyx); }

.mc-brand-mark {
  width: 46px; height: 46px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 12px;
  background: linear-gradient(145deg, #1c1208 0%, #3d2510 100%);
  color: var(--mc-gold-soft);
  box-shadow: 0 6px 18px rgba(28, 18, 8, 0.40), inset 0 0 0 1px rgba(200, 160, 44, 0.20);
}

.mc-brand-words   { display: flex; flex-direction: column; line-height: 1.1; }
.mc-brand-name    { font-family: var(--serif); font-weight: 500; font-size: 1.5rem; letter-spacing: 0.05em; color: var(--mc-onyx); }
.mc-brand-dot     { color: var(--mc-gold); padding: 0 3px; }
.mc-brand-tag     { font-size: 0.63rem; letter-spacing: 3px; text-transform: uppercase; color: var(--mc-mute); margin-top: 3px; }

.mc-nav-links { display: flex; align-items: center; gap: 2rem; }
.mc-nav-links a {
  font-size: 0.88rem; font-weight: 500; color: var(--mc-ink-soft);
  position: relative; padding: 0.3rem 0; transition: color 0.18s;
}
.mc-nav-links a:hover { color: var(--mc-onyx); }
.mc-nav-links a:not(.mc-pill)::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -2px; height: 1px;
  background: var(--mc-gold);
  transform: scaleX(0); transform-origin: left;
  transition: transform 0.28s var(--ease);
}
.mc-nav-links a:not(.mc-pill):hover::after { transform: scaleX(1); }

.mc-pill {
  background: var(--mc-onyx); color: var(--mc-ivory) !important;
  padding: 0.65rem 1.5rem; border-radius: 999px;
  font-size: 0.85rem; font-weight: 600; letter-spacing: 0.1em;
  text-transform: uppercase; font-size: 0.78rem;
  transition: background 0.18s, transform 0.18s var(--ease-spring), box-shadow 0.18s;
  box-shadow: 0 6px 20px rgba(28, 18, 8, 0.35);
}
.mc-pill:hover { background: var(--mc-gold); color: var(--mc-onyx) !important; transform: translateY(-1px); box-shadow: 0 10px 28px rgba(28, 18, 8, 0.40); }
.mc-pill::after { display: none !important; }

@media (max-width: 860px) {
  .mc-nav-links a:not(.mc-pill) { display: none; }
  .mc-brand-mark { width: 38px; height: 38px; }
  .mc-brand-name { font-size: 1.3rem; }
  .mc-brand-tag  { display: none; }
}

/* ─── HERO ─── */
.mc-hero {
  position: relative; isolation: isolate;
  min-height: calc(100vh - 72px);
  padding: clamp(3rem, 7vw, 6rem) clamp(1.5rem, 4vw, 4rem) 5rem;
  background:
    radial-gradient(ellipse at 75% 15%, rgba(200, 160, 44, 0.20), transparent 52%),
    radial-gradient(ellipse at 15% 85%, rgba(184, 120, 28, 0.12), transparent 52%),
    linear-gradient(160deg, #0d0a06 0%, #1e1408 50%, #0a0704 100%);
  color: var(--mc-pearl);
  overflow: hidden;
}

.mc-hero-grain {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  opacity: 0.28; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.88' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .35 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.mc-hero-inner {
  position: relative; z-index: 1; max-width: 1300px; margin: 0 auto;
  display: grid; gap: clamp(2.5rem, 6vw, 5rem);
  grid-template-columns: 1.1fr 1fr; align-items: center;
}

.mc-hero .mc-eyebrow { color: var(--mc-gold-soft); }

.mc-display {
  font-family: var(--serif); font-weight: 300;
  font-size: clamp(3.4rem, 9vw, 7.2rem);
  line-height: 0.95; letter-spacing: -0.02em; margin: 0 0 1.8rem;
  color: var(--mc-pearl);
}
.mc-display em { font-style: italic; color: var(--mc-gold-soft); }

.mc-lede {
  font-size: clamp(1rem, 1.5vw, 1.16rem); line-height: 1.78;
  max-width: 500px; color: rgba(245, 237, 224, 0.80); margin: 0 0 2.5rem;
}

.mc-cta-row { display: flex; gap: 1rem; flex-wrap: wrap; }

.mc-cta {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.95rem 2rem; min-height: 54px;
  border-radius: 999px;
  font: 600 0.85rem/1 var(--sans); letter-spacing: 0.08em; text-transform: uppercase;
  transition: transform 0.18s var(--ease-spring), background 0.18s, color 0.18s, box-shadow 0.18s;
}

.mc-cta-primary {
  background: linear-gradient(135deg, #c9a040 0%, #e8c870 50%, #b88020 100%);
  color: #1c1208;
  box-shadow: 0 12px 36px -6px rgba(184, 137, 44, 0.60);
}
.mc-cta-primary:hover { filter: brightness(1.08); transform: translateY(-2px); box-shadow: 0 18px 44px -6px rgba(184, 137, 44, 0.65); color: #1c1208; }

.mc-cta-ghost {
  background: transparent; color: var(--mc-pearl);
  border: 1.5px solid rgba(245, 237, 224, 0.28);
}
.mc-cta-ghost:hover { background: rgba(245, 237, 224, 0.06); border-color: var(--mc-gold-soft); transform: translateY(-1px); color: var(--mc-pearl); }

.mc-cta-gold {
  background: linear-gradient(135deg, #c9a040 0%, #e8c870 50%, #b88020 100%);
  color: #1c1208;
  box-shadow: 0 14px 40px -6px rgba(184, 137, 44, 0.65);
}
.mc-cta-gold:hover { filter: brightness(1.07); transform: translateY(-2px); color: #1c1208; }

.mc-trust {
  margin-top: 2.2rem; display: inline-flex; align-items: center; gap: 0.7rem;
  font-size: 0.78rem; letter-spacing: 0.6px; color: rgba(245, 237, 224, 0.65);
}
.mc-trust-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--mc-gold-soft); box-shadow: 0 0 14px var(--mc-gold);
  animation: goldPulse 2.8s ease-in-out infinite; flex-shrink: 0;
}

.mc-hero-art { display: flex; align-items: center; justify-content: center; }
.mc-ring-art { width: 100%; max-width: 500px; height: auto; filter: drop-shadow(0 32px 64px rgba(184, 137, 44, 0.22)) drop-shadow(0 16px 32px rgba(0,0,0,0.50)); }

.mc-scroll-cue {
  position: absolute; bottom: 1.8rem; left: 50%; transform: translateX(-50%);
  color: var(--mc-gold-soft); font-size: 1.6rem; opacity: 0.72;
  animation: scrollCue 2.6s ease-in-out infinite;
}

@media (max-width: 920px) {
  .mc-hero-inner { grid-template-columns: 1fr; text-align: center; }
  .mc-hero-copy  { order: 2; }
  .mc-hero-art   { order: 1; }
  .mc-ring-art   { max-width: 320px; margin: 0 auto; }
  .mc-lede       { margin-left: auto; margin-right: auto; }
  .mc-cta-row    { justify-content: center; }
  .mc-eyebrow    { margin-left: auto; margin-right: auto; }
  .mc-trust      { justify-content: center; }
}

/* ─── EDITORIAL QUOTE ─── */
.mc-quote {
  background: var(--mc-pearl);
  padding: clamp(5rem, 12vw, 10rem) clamp(1.5rem, 5vw, 4rem);
  text-align: center; border-bottom: 1px solid var(--mc-line);
}
.mc-quote-eyebrow { font: 700 0.64rem/1 var(--sans); letter-spacing: 4px; text-transform: uppercase; color: var(--mc-gold); margin: 0 0 2rem; }
.mc-quote-body {
  font-family: var(--serif); font-weight: 300;
  font-size: clamp(2.2rem, 5.5vw, 4rem); line-height: 1.12;
  color: var(--mc-onyx); margin: 0 auto 2rem; max-width: 880px; letter-spacing: -0.01em;
}
.mc-quote-body em { font-style: italic; color: var(--mc-gold); }
.mc-quote-foot { max-width: 560px; margin: 0 auto; color: var(--mc-ink-soft); line-height: 1.8; font-size: 1.05rem; }

/* ─── HOW IT WORKS ─── */
.mc-how { background: var(--mc-ivory-2); padding: clamp(4rem, 9vw, 8rem) clamp(1.5rem, 5vw, 4rem); }
.mc-how-grid {
  display: grid; gap: clamp(1.2rem, 2.5vw, 1.8rem);
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  max-width: 1200px; margin: 0 auto;
}
.mc-step {
  background: var(--mc-pearl); padding: 2.5rem 2rem;
  border: 1px solid var(--mc-line); border-radius: var(--rad-lg);
  position: relative;
  transition: transform 0.28s var(--ease-spring), box-shadow 0.28s, border-color 0.28s;
}
.mc-step::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--mc-gold), transparent);
  border-radius: var(--rad-lg) var(--rad-lg) 0 0;
  transform: scaleX(0); transform-origin: center;
  transition: transform 0.35s var(--ease);
}
.mc-step:hover { transform: translateY(-7px); box-shadow: 0 28px 56px -8px rgba(28, 18, 8, 0.12); border-color: rgba(201, 160, 64, 0.45); }
.mc-step:hover::before { transform: scaleX(1); }

.mc-step-num { display: block; font-family: var(--serif); font-style: italic; font-size: 2.8rem; color: var(--mc-gold); margin-bottom: 0.75rem; line-height: 1; opacity: 0.65; }
.mc-step h3 { font-family: var(--serif); font-weight: 500; font-size: 1.5rem; margin: 0 0 0.8rem; color: var(--mc-onyx); }
.mc-step p  { color: var(--mc-ink-soft); line-height: 1.75; margin: 0; font-size: 0.94rem; }

/* ─── COLLECTION ─── */
.mc-collection {
  background: var(--mc-onyx); color: var(--mc-pearl);
  padding: clamp(4rem, 9vw, 8rem) clamp(1.5rem, 5vw, 4rem);
  position: relative;
}
/* Subtle gold radial on collection */
.mc-collection::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at 80% 15%, rgba(201, 160, 44, 0.10), transparent 55%);
  pointer-events: none;
}
.mc-collection > * { position: relative; z-index: 1; }
.mc-collection .mc-eyebrow { color: var(--mc-gold-soft); }
.mc-collection .mc-h2      { color: var(--mc-pearl); }

.mc-coll-grid {
  display: grid; gap: clamp(1rem, 2vw, 1.4rem);
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  max-width: 1200px; margin: 0 auto;
}
.mc-coll-card {
  padding: 2.2rem 1.8rem 2rem;
  border: 1px solid rgba(201, 160, 44, 0.15); border-radius: var(--rad-lg);
  transition: transform 0.28s var(--ease-spring), border-color 0.28s, background 0.28s;
  background: rgba(255, 254, 245, 0.02);
}
.mc-coll-card:hover { transform: translateY(-5px); border-color: rgba(201, 160, 44, 0.5); background: rgba(201, 160, 44, 0.04); }

.mc-coll-art {
  width: 72px; height: 72px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--mc-gold-soft); margin-bottom: 1.4rem;
  background: rgba(201, 160, 44, 0.10);
  border-radius: var(--rad); border: 1px solid rgba(201, 160, 44, 0.22);
}
.mc-coll-art svg { width: 36px; height: 36px; }
.mc-coll-card h3 { font-family: var(--serif); font-weight: 500; font-size: 1.35rem; margin: 0 0 0.55rem; color: var(--mc-pearl); }
.mc-coll-card p  { color: rgba(245, 237, 224, 0.68); font-size: 0.93rem; line-height: 1.72; margin: 0; }

/* ─── STILLNESS ─── */
.mc-stillness {
  background: var(--mc-pearl);
  padding: clamp(5rem, 12vw, 10rem) clamp(1.5rem, 5vw, 4rem);
  text-align: center;
}
.mc-stillness-line {
  font-family: var(--serif); font-weight: 300;
  font-size: clamp(2.4rem, 7vw, 5rem); line-height: 1.05;
  margin: 0 0 1.6rem; color: var(--mc-onyx); letter-spacing: -0.015em;
}
/* Thin gold rule under stillness headline */
.mc-stillness-line::after {
  content: '';
  display: block; width: 60px; height: 1.5px;
  background: linear-gradient(90deg, transparent, var(--mc-gold), transparent);
  margin: 1.4rem auto 0; border-radius: 2px;
}
.mc-stillness-foot { max-width: 520px; margin: 1.5rem auto 0; color: var(--mc-ink-soft); line-height: 1.82; }

/* ─── CTA BAND ─── */
.mc-cta-band {
  background:
    radial-gradient(ellipse at 30% 10%, rgba(201, 160, 44, 0.22), transparent 55%),
    linear-gradient(160deg, #1a1208 0%, var(--mc-onyx) 100%);
  color: var(--mc-pearl);
  padding: clamp(5rem, 10vw, 9rem) clamp(1.5rem, 5vw, 4rem);
  text-align: center;
}
.mc-cta-band-inner { max-width: 700px; margin: 0 auto; }
.mc-cta-band p { font-size: 1.1rem; line-height: 1.78; color: rgba(245, 237, 224, 0.75); margin: 0 0 2.5rem; }

/* ─── FOOTER ─── */
.mc-footer {
  background: var(--mc-onyx); color: rgba(245, 237, 224, 0.62);
  padding: 3.5rem clamp(1.5rem, 5vw, 4rem) 2.5rem;
  border-top: 1px solid rgba(201, 160, 44, 0.18);
  display: grid; gap: 2rem; grid-template-columns: 1fr auto; align-items: start;
}
.mc-footer-brand { display: flex; flex-direction: column; gap: 0.4rem; }
.mc-footer-brand .mc-brand-name { color: var(--mc-pearl); font-size: 1.4rem; }
.mc-footer-tag { font-size: 0.83rem; color: rgba(245, 237, 224, 0.48); }
.mc-footer-links { display: flex; flex-wrap: wrap; gap: 1.5rem; font-size: 0.88rem; }
.mc-footer-links a { color: rgba(245, 237, 224, 0.72); transition: color 0.15s; }
.mc-footer-links a:hover { color: var(--mc-gold-soft); }
.mc-footer-copy {
  grid-column: 1 / -1; font-size: 0.76rem; letter-spacing: 0.3px;
  color: rgba(245, 237, 224, 0.38);
  border-top: 1px solid rgba(201, 160, 44, 0.12); padding-top: 1.6rem; margin-top: 0.5rem;
}
@media (max-width: 680px) { .mc-footer { grid-template-columns: 1fr; } }

/* ──────────────────────────────────────────────────────────────────────
   22. ONBOARDING / PIN / SPECIAL SCREENS
   ────────────────────────────────────────────────────────────────────── */
.onboarding-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 2rem;
  background: radial-gradient(ellipse at 50% 0%, rgba(184, 137, 44, 0.08), transparent 60%), var(--paper);
}
.onboarding-card {
  width: 100%; max-width: 480px;
  background: var(--cream); border-radius: var(--rad-xl);
  border: 1px solid var(--line-gold); box-shadow: var(--shadow-lg);
  padding: 3rem 2.5rem; text-align: center;
  animation: fadeUp 0.55s var(--ease) both;
}
/* Gold top bar */
.onboarding-card::before {
  content: ''; display: block; width: 56px; height: 2px;
  background: var(--grad-gold); margin: 0 auto 1.5rem; border-radius: 2px;
}
.onboarding-mark { font-size: 3rem; color: var(--gold-2); margin-bottom: 1rem; }

/* ──────────────────────────────────────────────────────────────────────
   23. MISCELLANEOUS UTILITIES
   ────────────────────────────────────────────────────────────────────── */
.gold-line { width: 48px; height: 1.5px; background: var(--grad-gold); margin: 1.2rem 0; border-radius: 2px; }
.gold-line.center { margin-left: auto; margin-right: auto; }

.tag-pill {
  display: inline-block; padding: 0.22rem 0.72rem;
  border-radius: var(--rad-pill); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.8px;
  background: var(--paper-2); color: var(--muted); text-transform: uppercase;
  border: 1px solid var(--line);
}
.tag-pill-gold { background: var(--gold-pale); color: var(--gold-deep); border: 1px solid var(--line-gold); }

.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--line-med); border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite; display: inline-block;
}

.divider { border: none; border-top: 1px solid var(--line); margin: 1.5rem 0; }

.section { margin-bottom: 2.5rem; }
.section:last-child { margin-bottom: 0; }

.stack { display: flex; flex-direction: column; }

/* ══════════════════════════════════════════════════════════════════════
   24. CINEMATIC MEMORY FILM
   ──────────────────────────────────────────────────────────────────────
   This is the viewer experience. Not a website. Not a dashboard.
   Fullscreen, auto-advancing, touch-driven, emotional.
   ══════════════════════════════════════════════════════════════════════ */

/* Lock body — the film owns the viewport */
html:has(#film) { overflow: hidden; height: 100dvh; }
.cinematic-wrap { position: relative; padding: 0; max-width: none; min-height: 100dvh; }
/* When the film player is mounted inside, lock viewport. */
.cinematic-wrap:has(#film) { height: 100dvh; overflow: hidden; }
/* Toast/offline banner z-index over film */
.cinematic-body .memoring-toast-stack { z-index: 400; }
.cinematic-body .memoring-offline-banner { z-index: 401; }

/* ─────────────────────────────────────────────────────────────────────
   ENTRANCE VEIL — magical NFC reveal
   ───────────────────────────────────────────────────────────────────── */
.film-veil {
  position: fixed; inset: 0; z-index: 200;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  background:
    radial-gradient(ellipse at 50% 50%, rgba(20, 14, 6, 0.95) 0%, #050302 70%, #000 100%);
  color: #f5ede0;
  transition: opacity 0.7s ease, transform 0.7s ease;
  padding: 2rem;
  cursor: pointer;
}
.film-veil.is-leaving { opacity: 0; transform: scale(1.04); pointer-events: none; }

.film-veil-brand {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(0.95rem, 2.5vw, 1.15rem);
  letter-spacing: 0.32em;
  color: rgba(184, 137, 44, 0.75);
  text-transform: uppercase;
  margin-bottom: 3rem;
  opacity: 0;
  animation: filmVeilBrand 1.0s 0.2s ease-out forwards;
}
.film-veil-word { display: inline-block; }
.film-veil-dot {
  display: inline-block; padding: 0 0.4em;
  background: var(--grad-gold);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  font-weight: 600;
}

.film-veil-title {
  font-family: var(--serif); font-weight: 300;
  font-size: clamp(2.5rem, 9vw, 5.5rem);
  line-height: 1.0; letter-spacing: -0.015em;
  color: #fffdf5;
  margin: 0 0 1.2rem;
  max-width: 18ch;
  opacity: 0;
  animation: filmVeilTitle 1.4s 1.0s cubic-bezier(.18,.7,.25,1) forwards;
}
.film-veil-sub {
  font-family: var(--serif); font-style: italic;
  font-size: clamp(1rem, 2.2vw, 1.3rem);
  color: rgba(245, 237, 224, 0.55);
  margin: 0 0 4rem;
  opacity: 0;
  animation: filmVeilSub 1.2s 1.8s ease-out forwards;
}
.film-veil-tap {
  background: transparent; border: 0; cursor: pointer;
  color: rgba(184, 137, 44, 0.85);
  display: inline-flex; flex-direction: column; align-items: center; gap: 0.9rem;
  opacity: 0;
  animation: filmVeilSub 1.0s 2.6s ease-out forwards;
}
.film-veil-tap-ring {
  width: 56px; height: 56px;
  border: 1.5px solid rgba(184, 137, 44, 0.55);
  border-radius: 50%;
  position: relative;
  animation: filmRing 2.6s ease-in-out infinite;
}
.film-veil-tap-ring::before, .film-veil-tap-ring::after {
  content: ''; position: absolute; inset: -10px;
  border: 1px solid rgba(184, 137, 44, 0.25);
  border-radius: 50%;
  animation: filmRingPulse 2.8s ease-in-out infinite;
}
.film-veil-tap-ring::after { inset: -20px; animation-delay: 0.6s; }
.film-veil-tap-label {
  font-size: 0.62rem; letter-spacing: 0.35em; text-transform: uppercase;
  font-weight: 600; color: rgba(184, 137, 44, 0.72);
}

@keyframes filmVeilBrand {
  0%   { opacity: 0; transform: translateY(8px); letter-spacing: 0.5em; }
  100% { opacity: 1; transform: translateY(0);   letter-spacing: 0.32em; }
}
@keyframes filmVeilTitle {
  0%   { opacity: 0; transform: translateY(20px); filter: blur(8px); }
  100% { opacity: 1; transform: translateY(0);    filter: blur(0); }
}
@keyframes filmVeilSub {
  0%   { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: translateY(0); }
}
@keyframes filmRing {
  0%, 100% { transform: scale(1); opacity: 0.9; }
  50%      { transform: scale(1.08); opacity: 1; }
}
@keyframes filmRingPulse {
  0%   { opacity: 0.4; transform: scale(0.9); }
  50%  { opacity: 0.05; transform: scale(1.15); }
  100% { opacity: 0; transform: scale(1.3); }
}

/* ─────────────────────────────────────────────────────────────────────
   FILM ROOT — the player surface
   ───────────────────────────────────────────────────────────────────── */
.film {
  position: relative;
  height: 100dvh; width: 100%;
  overflow: hidden;
  background: #050302;
  color: #f5ede0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* ── Progress segments (top, Instagram-story style) ─────────────────── */
.film-progress {
  position: absolute; top: 0; left: 0; right: 0;
  z-index: 50;
  display: flex; gap: 4px;
  padding: 12px 14px 0;
  pointer-events: none;
}
.film-seg {
  flex: 1; height: 2.5px;
  background: rgba(245, 237, 224, 0.15);
  border-radius: 2px;
  overflow: hidden;
}
.film-seg-fill {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, rgba(245,237,224,0.92), #fffdf5);
  border-radius: 2px;
  transition: width 0.06s linear;
}
@media (display-mode: standalone) { .film-progress { padding-top: max(14px, env(safe-area-inset-top)); } }

/* ── Edge tap zones (invisible) ─────────────────────────────────────── */
.film-tap-zone {
  position: absolute; top: 0; bottom: 0;
  width: 30%;
  z-index: 30;
  background: transparent; border: 0; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.film-tap-zone--left  { left: 0; }
.film-tap-zone--right { right: 0; width: 50%; }

/* ── Floating tools (top-right) ─────────────────────────────────────── */
/* Legacy owner menu hidden; sound toggle stays for shared-link visitors. */
.film-tools, .film-tool { display: none !important; }

.film-sound-btn {
  position: absolute;
  top: max(16px, env(safe-area-inset-top, 0px));
  right: 14px;
  z-index: 48;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  background: rgba(12, 10, 8, 0.42);
  color: rgba(245, 237, 224, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.2s ease, opacity 0.2s ease;
}
.film-sound-btn:hover,
.film-sound-btn:focus-visible {
  background: rgba(12, 10, 8, 0.62);
  outline: none;
}
.film-sound-btn:not(.is-on) { opacity: 0.72; }

.film-audio-prompt {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(8, 6, 4, 0.55);
  pointer-events: auto;
}
.film-audio-prompt[hidden] { display: none !important; }
.film-audio-prompt-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 14px 22px;
  border: 1px solid rgba(245, 237, 224, 0.35);
  border-radius: 999px;
  background: rgba(20, 16, 12, 0.82);
  color: #f5ede0;
  font: inherit;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  animation: film-audio-pulse 2.4s ease-in-out infinite;
}
@keyframes film-audio-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 237, 224, 0.15); }
  50%      { box-shadow: 0 0 0 10px rgba(245, 237, 224, 0); }
}

/* ─────────────────────────────────────────────────────────────────────
   STAGE — all chapters layered, crossfaded
   ───────────────────────────────────────────────────────────────────── */
.film-stage {
  position: absolute; inset: 0;
  z-index: 10;
}

/* ── Candle embers (per chapter) ────────────────────────────────────────
   A field of slow-rising warm motes that drift behind every chapter:
   photos, albums, videos, memorial cover, letters, notes, the closing
   credits. Rendered inside each chapter article (not at stage level)
   because the active chapter creates its own stacking context at
   z-index: 5 and would otherwise cover them.

   Within a chapter article the layering is:
     ─ bg-blur / bg-ambient   z:1   the blurred backdrop
     ─ film-stars / veils     z:2   stars / soft veils on memorial cover
     ─ film-embers            z:3   ← here. floats in front of the bg
     ─ photo / video / album  z:4   the actual visual content
     ─ ch-center / caption    z:5–6 text content always on top
*/
.film-embers {
  position: absolute; inset: 0;
  z-index: 3;
  pointer-events: none;
  overflow: hidden;
  /* Soft top vignette so embers fade before they hit the very top
     of the frame — keeps the eye on the photo, not the edge. */
  mask-image: linear-gradient(180deg, transparent 0%, #000 12%, #000 100%);
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 12%, #000 100%);
}
.film-ember {
  position: absolute;
  bottom: -14px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: radial-gradient(circle at center,
    rgba(255, 232, 178, 1)    0%,
    rgba(255, 200, 120, 0.7) 35%,
    rgba(220, 170, 70,  0.0) 75%);
  box-shadow:
    0 0 8px  rgba(255, 215, 140, 0.75),
    0 0 18px rgba(255, 180, 90,  0.35),
    0 0 38px rgba(220, 150, 60,  0.15);
  opacity: 0;
  /* Belt + suspenders: pointer-events is not inherited, so explicitly
     drop it here too. (The container .film-embers also has it, so a
     click that lands in the gap between embers passes straight through;
     this guarantees the same when the click lands on an ember pixel.) */
  pointer-events: none;
  mix-blend-mode: screen;     /* glows over dark backdrops without bleaching them */
  animation: filmEmberRise 22s linear infinite;
}
@keyframes filmEmberRise {
  0%   { opacity: 0;    transform: translate(0,   0)        scale(0.8); }
  8%   { opacity: 0.9;                                                   }
  35%  {                transform: translate(6px, -32vh)    scale(1);   }
  60%  {                transform: translate(-4px,-58vh)    scale(1.05);}
  88%  { opacity: 0.55;                                                  }
  100% { opacity: 0;    transform: translate(8px, -112vh)   scale(0.55);}
}
.film-ch {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  overflow: hidden;
  opacity: 0;
  transform: scale(1.015);
  pointer-events: none;
  transition: opacity 0.9s ease, transform 0.9s ease;
}
.film-ch.is-active {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
  z-index: 5;
}

/* ── Universal veils (over backgrounds) ─────────────────────────────── */
.film-veil-soft {
  position: absolute; inset: 0; z-index: 2;
  /* Stronger bottom darkening so the centered caption stays readable
     even over white skies / bright backgrounds. */
  background:
    radial-gradient(ellipse at 50% 35%, rgba(0,0,0,0) 25%, rgba(0,0,0,0.42) 100%),
    linear-gradient(to bottom,
        rgba(0,0,0,0)   45%,
        rgba(0,0,0,0.55) 78%,
        rgba(0,0,0,0.88) 100%);
  pointer-events: none;
}
.film-veil-dark {
  position: absolute; inset: 0; z-index: 2;
  background: rgba(0, 0, 0, 0.62);
  pointer-events: none;
}
.film-veil-bottom {
  position: absolute; inset: 0; z-index: 3;
  background: linear-gradient(to bottom,
      transparent 50%,
      rgba(0,0,0,0.55) 78%,
      rgba(0,0,0,0.92) 100%);
  pointer-events: none;
}

/* ── Blurred backsplash (photo background) ──────────────────────────── */
.film-bg-blur {
  position: absolute; inset: -30px;
  background-size: cover; background-position: center;
  filter: blur(40px) brightness(0.45) saturate(1.15);
  transform: scale(1.15);
  z-index: 1;
  animation: filmBlurDrift 24s ease-in-out infinite alternate;
}
@keyframes filmBlurDrift {
  0%   { transform: scale(1.15) translate(0, 0); }
  100% { transform: scale(1.22) translate(-2%, -1%); }
}

/* ── Ambient backgrounds (per chapter type) ─────────────────────────── */
.film-bg-ambient {
  position: absolute; inset: 0; z-index: 1;
}
.film-bg-ambient--voice {
  background:
    radial-gradient(ellipse 80% 60% at 50% 50%, rgba(184, 137, 44, 0.18) 0%, transparent 60%),
    radial-gradient(ellipse 100% 80% at 50% 100%, rgba(74, 49, 24, 0.45) 0%, transparent 70%),
    linear-gradient(160deg, #0e0a05 0%, #060402 100%);
  animation: filmAmbientShift 18s ease-in-out infinite alternate;
}
.film-bg-ambient--memorial {
  background:
    radial-gradient(ellipse at 50% 30%, rgba(60, 30, 80, 0.18) 0%, transparent 55%),
    linear-gradient(180deg, #08070a 0%, #050304 60%, #000 100%);
}
.film-bg-ambient--letter {
  background:
    radial-gradient(ellipse at 30% 20%, rgba(184, 137, 44, 0.10) 0%, transparent 55%),
    radial-gradient(ellipse at 70% 80%, rgba(110, 80, 30, 0.10) 0%, transparent 55%),
    linear-gradient(160deg, #140e07 0%, #080603 100%);
}
.film-bg-ambient--note {
  background:
    radial-gradient(ellipse at 50% 30%, rgba(184, 137, 44, 0.08) 0%, transparent 60%),
    linear-gradient(160deg, #0c0904 0%, #050302 100%);
  animation: filmAmbientShift 18s ease-in-out infinite alternate;
}
.film-bg-ambient--closing {
  background:
    radial-gradient(ellipse 70% 50% at 50% 35%, rgba(220, 170, 70, 0.18) 0%, transparent 60%),
    radial-gradient(ellipse 90% 70% at 50% 100%, rgba(40, 25, 8, 0.55) 0%, transparent 70%),
    linear-gradient(180deg, #0c0905 0%, #060402 60%, #020101 100%);
}
@keyframes filmAmbientShift {
  0%   { filter: hue-rotate(0deg) brightness(1.0); }
  100% { filter: hue-rotate(8deg) brightness(1.08); }
}

/* ── Star field (memorial) ──────────────────────────────────────────── */
.film-stars {
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background-image:
    radial-gradient(1px 1px at 20% 30%, rgba(245, 237, 224, 0.6) 50%, transparent),
    radial-gradient(1px 1px at 80% 10%, rgba(245, 237, 224, 0.4) 50%, transparent),
    radial-gradient(1.5px 1.5px at 50% 70%, rgba(245, 237, 224, 0.55) 50%, transparent),
    radial-gradient(1px 1px at 35% 85%, rgba(245, 237, 224, 0.35) 50%, transparent),
    radial-gradient(1.5px 1.5px at 70% 50%, rgba(245, 237, 224, 0.5) 50%, transparent),
    radial-gradient(1px 1px at 15% 60%, rgba(245, 237, 224, 0.4) 50%, transparent),
    radial-gradient(1px 1px at 90% 80%, rgba(245, 237, 224, 0.5) 50%, transparent);
  animation: filmStarTwinkle 6s ease-in-out infinite alternate;
}
@keyframes filmStarTwinkle {
  0%   { opacity: 0.55; }
  100% { opacity: 1; }
}

/* ─────────────────────────────────────────────────────────────────────
   PHOTO chapter — blurred backdrop + contained photo + Ken Burns
   ───────────────────────────────────────────────────────────────────── */
.film-photo-stage {
  position: absolute; inset: 0; z-index: 4;
  display: flex; align-items: center; justify-content: center;
  padding: 7vh 6vw 26vh;
}
.film-photo {
  max-width: 100%; max-height: 100%;
  width: auto; height: auto;
  object-fit: contain;
  display: block;
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.70),
    0 6px 18px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(245, 237, 224, 0.06);
  border-radius: 3px;
  transform-origin: 50% 50%;
}
/* Random Ken-Burns variants. The PHP picks one per photo at render time. */
.film-ch--photo.is-active .film-photo--kb-in        { animation: filmKBIn       7.5s ease-out forwards; }
.film-ch--photo.is-active .film-photo--kb-out       { animation: filmKBOut      7.5s ease-out forwards; }
.film-ch--photo.is-active .film-photo--kb-pan-left  { animation: filmKBPanLeft  8s   ease-out forwards; }
.film-ch--photo.is-active .film-photo--kb-pan-right { animation: filmKBPanRight 8s   ease-out forwards; }
.film-ch--photo.is-active .film-photo--kb-zoom-up   { animation: filmKBZoomUp   8s   ease-out forwards; }
@keyframes filmKBIn       { 0% { transform: scale(1.00);                 } 100% { transform: scale(1.10);                 } }
@keyframes filmKBOut      { 0% { transform: scale(1.10);                 } 100% { transform: scale(1.00);                 } }
@keyframes filmKBPanLeft  { 0% { transform: scale(1.07) translate(2%,0); } 100% { transform: scale(1.07) translate(-2%,0); } }
@keyframes filmKBPanRight { 0% { transform: scale(1.07) translate(-2%,0);} 100% { transform: scale(1.07) translate(2%,0);  } }
@keyframes filmKBZoomUp   { 0% { transform: scale(1.00) translate(0,1%); } 100% { transform: scale(1.08) translate(0,-1%); } }

/* ─────────────────────────────────────────────────────────────────────
   ALBUM chapter — auto-cycling slides, crossfade between them
   ───────────────────────────────────────────────────────────────────── */
.film-album-stage {
  position: absolute; inset: 0;
  z-index: 4;
}
.film-album-slide {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 7vh 6vw 22vh;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1.1s ease;
}
.film-album-slide.is-active {
  opacity: 1;
}
.film-album-slide .film-photo {
  max-width: 100%; max-height: 100%;
  object-fit: contain;
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.70),
    0 6px 18px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(245, 237, 224, 0.06);
  border-radius: 3px;
  transform-origin: 50% 50%;
}
.film-album-slide.is-active .film-photo--kb-in        { animation: filmKBIn       7s ease-out forwards; }
.film-album-slide.is-active .film-photo--kb-out       { animation: filmKBOut      7s ease-out forwards; }
.film-album-slide.is-active .film-photo--kb-pan-left  { animation: filmKBPanLeft  7s ease-out forwards; }
.film-album-slide.is-active .film-photo--kb-pan-right { animation: filmKBPanRight 7s ease-out forwards; }
.film-album-slide.is-active .film-photo--kb-zoom-up   { animation: filmKBZoomUp   7s ease-out forwards; }

.film-caption--album {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 1.5rem clamp(1.4rem, 5vw, 2.4rem) 11vh;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.film-caption--album-title {
  z-index: 7;
}
.film-caption-prompt {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.15rem, 2.4vw, 1.55rem);
  line-height: 1.4;
  color: rgba(255, 254, 248, 0.94);
  text-shadow:
    0 2px 22px rgba(0, 0, 0, 0.75),
    0 1px 0  rgba(0, 0, 0, 0.4);
  max-width: 32ch;
  margin-left: auto; margin-right: auto;
}

/* ─────────────────────────────────────────────────────────────────────
   VIDEO chapter — letterboxed so the entire frame is visible
   ───────────────────────────────────────────────────────────────────── */
.film-video-stage {
  /* No background — the parent .film already has #050302, and a solid
     bg here would cover the candle-embers floating behind (z:3) in the
     letterbox area. The video element itself carries `background: #000`
     so it still loads cleanly while the source decodes. */
  position: absolute; inset: 0; z-index: 4;
  display: flex; align-items: center; justify-content: center;
}
.film-video {
  max-width: 100%;
  max-height: 100%;
  width: auto; height: auto;
  object-fit: contain;
  background: #000;
  box-shadow: 0 24px 80px rgba(0,0,0,.6);
  transition: opacity 0.2s linear;
}

/* ─────────────────────────────────────────────────────────────────────
   MEMORIAL COVER chapter — portrait + dates + epitaph

   This is the obituary slide. It needs to feel sacred and alive — not
   static. We layer:
     ─ a softly drifting candle-ember field          (rising particles)
     ─ a breathing halo behind the portrait           (slow pulse)
     ─ a long slow Ken-Burns on the portrait itself   (subtle scale)
     ─ slightly delayed entrance fades on the text    (one line at a time)
   ───────────────────────────────────────────────────────────────────── */
.film-bg-blur--soft { filter: blur(38px) brightness(.45) saturate(.85); }

.film-memorial-cover {
  padding-top: 6vh; padding-bottom: 6vh;
  display: flex; flex-direction: column; align-items: center;
}

.film-memorial-portrait {
  position: relative;
  width: clamp(160px, 28vw, 240px);
  height: clamp(160px, 28vw, 240px);
  border-radius: 50%;
  overflow: visible;       /* glow ring sits outside the circle */
  margin-bottom: 1.6rem;
  /* The image itself stays clipped; the glow halo sits behind it. */
  isolation: isolate;
  animation: filmMemorialPortraitBreathe 6.5s ease-in-out infinite;
}
.film-memorial-portrait img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 50%;
  box-shadow:
    0 20px 60px rgba(0,0,0,.55),
    0 0 0 4px rgba(255,254,248,.08),
    0 0 0 1px rgba(255,254,248,.18);
  position: relative;
  z-index: 2;
}
@keyframes filmMemorialPortraitBreathe {
  0%, 100% { transform: scale(1);     }
  50%      { transform: scale(1.018); }
}

/* Candlelight halo behind the portrait. Tuned to be clearly visible
   but never overpowering — feels like the portrait is sitting in
   warm candlelight, not floating in a sun. */
.film-memorial-portrait-glow {
  position: absolute;
  inset: -40%;
  border-radius: 50%;
  z-index: 1;
  background:
    radial-gradient(circle at 50% 50%,
      rgba(255, 222, 168, 0.45) 0%,
      rgba(255, 195, 115, 0.25) 28%,
      rgba(200, 140, 55,  0.12) 52%,
      rgba(0, 0, 0, 0)          75%);
  filter: blur(12px);
  pointer-events: none;
  mix-blend-mode: screen;
  animation: filmMemorialPortraitGlow 6s ease-in-out infinite;
}
@keyframes filmMemorialPortraitGlow {
  0%, 100% { opacity: 0.55; transform: scale(0.97); }
  50%      { opacity: 0.85; transform: scale(1.05); }
}

/* When there is no portrait, the diamond ornament breathes with the
   same cadence as the portrait halo would have. The compound selector
   (`.film-ch--memorial-cover .film-orn`) wins over the generic
   `.film-orn` rule defined later in this file. */
.film-ch--memorial-cover .film-orn--memorial {
  font-size: clamp(2.6rem, 5vw, 3.4rem);
  color: rgba(245, 237, 224, 0.85);
  margin-bottom: 1.4rem;
  text-shadow:
    0 0 28px rgba(255, 224, 168, 0.55),
    0 0 60px rgba(220, 170, 70, 0.35);
  animation: filmMemorialOrnBreathe 5s ease-in-out infinite;
}
@keyframes filmMemorialOrnBreathe {
  0%, 100% { opacity: 0.85; transform: scale(1);    }
  50%      { opacity: 1;    transform: scale(1.07); }
}

/* (Memorial-specific embers are now provided by .film-stage-embers
   at storyboard level — see further down in this file.) */

/* ── Staggered entrance for the obituary text ─────────────────────────
   Each line settles in one after another so the eye is drawn through
   the page like reading a memorial card. */
.film-ch--memorial-cover.is-active .film-eyebrow {
  opacity: 0; transform: translateY(8px);
  animation: filmMemorialLineIn 1.4s 0.55s cubic-bezier(.2,.7,.25,1) forwards;
}
.film-ch--memorial-cover.is-active .film-memorial-dates {
  opacity: 0; transform: translateY(8px);
  animation: filmMemorialLineIn 1.4s 0.95s cubic-bezier(.2,.7,.25,1) forwards;
}
.film-ch--memorial-cover.is-active .film-memorial-fullDates {
  opacity: 0; transform: translateY(8px);
  animation: filmMemorialLineIn 1.4s 1.25s cubic-bezier(.2,.7,.25,1) forwards;
}
.film-ch--memorial-cover.is-active .film-prose--memorial {
  opacity: 0; transform: translateY(10px);
  animation: filmMemorialLineIn 1.6s 1.55s cubic-bezier(.2,.7,.25,1) forwards;
}
@keyframes filmMemorialLineIn {
  0%   { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: translateY(0);    }
}
.film-memorial-dates {
  font-family: var(--serif);
  font-size: clamp(1.4rem, 3vw, 1.8rem);
  letter-spacing: .04em;
  color: rgba(255,254,248,.9);
  margin: .25rem 0 0;
}
.film-memorial-tilde {
  opacity: .55;
  margin: 0 .6rem;
  font-weight: 300;
}
.film-memorial-fullDates {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.4rem 0.7rem;
  font-size: .75rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: rgba(245,237,224,.55);
  margin: .55rem 0 1.6rem;
  max-width: min(92vw, 460px);
  text-align: center;
}
.film-memorial-fullDate { white-space: nowrap; }
.film-memorial-fullDate-sep {
  opacity: 0.55;
  font-weight: 300;
}
/* On phones, stack the two date lines so neither one wraps mid-word.
   Hide the bullet separator since the visual stacking does that job. */
@media (max-width: 480px) {
  .film-memorial-fullDates {
    flex-direction: column;
    gap: 0.3rem;
    font-size: 0.68rem;
    letter-spacing: .18em;
  }
  .film-memorial-fullDate-sep { display: none; }
}

/* ─────────────────────────────────────────────────────────────────────
   CAPTION (over photo / video) — MONUMENTAL, CENTERED.

   The caption sits in the lower portion of the frame above a soft
   bottom gradient (.film-veil-soft / .film-veil-bottom). Every
   element inside is centered on the horizontal axis so the photo
   above remains the gravitational centre of the composition.
   ───────────────────────────────────────────────────────────────────── */
.film-caption {
  position: absolute; left: 0; right: 0; bottom: 0;
  z-index: 6;
  padding: 1.6rem clamp(1.4rem, 5vw, 3rem) clamp(2.4rem, 5vh, 3.4rem);
  color: #fffef8;
  text-align: center;
  /* Flex column so every child (mark, title, body) sits centered on
     the same vertical spine regardless of length / wrapping. */
  display: flex;
  flex-direction: column;
  align-items: center;
  opacity: 0;
  transform: translateY(22px);
}
.film-ch.is-active .film-caption {
  animation: filmCaptionIn 1.2s 0.45s cubic-bezier(.2,.7,.25,1) forwards;
}
@keyframes filmCaptionIn {
  0%   { opacity: 0; transform: translateY(22px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* Delicate gold mark above the caption title — two hairline gradients
   flanking a tiny gold diamond. Evokes the engraving inside a
   wedding band. */
.film-caption-mark {
  position: relative;
  display: block;
  width: clamp(70px, 14vw, 130px);
  height: 10px;
  margin: 0 auto 1rem;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 8 8'><path d='M4 0 L8 4 L4 8 L0 4 Z' fill='%23dcaa46' opacity='0.9'/></svg>");
  background-repeat: no-repeat;
  background-position: center center;
  background-size: 7px 7px;
  filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.6));
}
.film-caption-mark::before,
.film-caption-mark::after {
  content: '';
  position: absolute;
  top: 50%;
  height: 1px;
  width: calc(50% - 11px);
  transform: translateY(-50%);
  background: linear-gradient(90deg, transparent, rgba(220, 170, 70, 0.6));
}
.film-caption-mark::before { left: 0; }
.film-caption-mark::after  {
  right: 0;
  background: linear-gradient(270deg, transparent, rgba(220, 170, 70, 0.6));
}

.film-caption-title {
  font-family: var(--serif);
  font-weight: 400;
  font-style: italic;
  font-size: clamp(2rem, 5.6vw, 3.2rem);
  line-height: 1.06;
  letter-spacing: -0.012em;
  margin: 0 0 0.7rem;
  color: #fffef8;
  /* Layered shadow keeps the title readable over ANY photo — bright
     skies, white wedding dresses, dark forests, etc. */
  text-shadow:
    0 2px 22px rgba(0, 0, 0, 0.8),
    0 1px 0  rgba(0, 0, 0, 0.45),
    0 0 38px rgba(0, 0, 0, 0.35);
  max-width: 24ch;
  text-wrap: balance;
}
.film-caption-body {
  font-family: var(--serif);
  font-size: clamp(1rem, 1.7vw, 1.18rem);
  line-height: 1.65;
  color: rgba(255, 254, 248, 0.92);
  margin: 0 auto;
  max-width: 38ch;
  text-shadow:
    0 1px 14px rgba(0, 0, 0, 0.75),
    0 1px 0  rgba(0, 0, 0, 0.35);
}

/* ─────────────────────────────────────────────────────────────────────
   CENTERED CHAPTER LAYOUT (voice, memorial, letter, note, closing, empty)
   ───────────────────────────────────────────────────────────────────── */
.film-ch-center {
  position: relative; z-index: 5;
  max-width: min(92vw, 640px);
  padding: 8vh 1.5rem;
  text-align: center;
  /* Flex column so every child — block OR inline — lands on the same
     vertical spine. This fixes the voice-note waveform and any inline
     ornaments that wouldn't center via text-align alone. */
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: auto;
  opacity: 0;
  transform: translateY(16px);
}
.film-ch.is-active .film-ch-center {
  animation: filmCenterIn 1.2s 0.3s cubic-bezier(.18,.7,.25,1) forwards;
}
@keyframes filmCenterIn {
  0%   { opacity: 0; transform: translateY(16px) scale(0.98); filter: blur(4px); }
  100% { opacity: 1; transform: translateY(0)    scale(1);    filter: blur(0); }
}
.film-ch-center--letter {
  text-align: left;
  max-width: min(92vw, 620px);
  align-items: stretch;
}

/* ── Typography ─────────────────────────────────────────────────────── */
.film-eyebrow {
  font-size: 0.68rem; font-weight: 600; letter-spacing: 0.4em;
  text-transform: uppercase;
  color: rgba(220, 170, 70, 0.82);
  margin: 0 0 1.4rem;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.45);
}
.film-eyebrow--gold {
  background: var(--grad-gold);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  letter-spacing: 0.32em;
}
.film-title-xl {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(2.6rem, 8.2vw, 5rem);
  line-height: 1.02; letter-spacing: -0.018em;
  color: #fffef8;
  margin: 0 0 1.4rem;
  max-width: 18ch;
  text-wrap: balance;
  text-shadow:
    0 3px 28px rgba(0, 0, 0, 0.8),
    0 1px 0  rgba(0, 0, 0, 0.45);
}
.film-title-lg {
  font-family: var(--serif); font-weight: 400;
  font-style: italic;
  font-size: clamp(2rem, 5.4vw, 3.1rem);
  line-height: 1.1; letter-spacing: -0.012em;
  color: #fffef8;
  margin: 0 0 1.2rem;
  max-width: 22ch;
  text-wrap: balance;
  text-shadow:
    0 3px 24px rgba(0, 0, 0, 0.75),
    0 1px 0  rgba(0, 0, 0, 0.4);
}
.film-title-md {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(1.6rem, 4.2vw, 2.4rem);
  line-height: 1.18; letter-spacing: -0.01em;
  color: #fffef8;
  margin: 0 0 1.5rem;
  text-shadow:
    0 2px 18px rgba(0, 0, 0, 0.65),
    0 1px 0  rgba(0, 0, 0, 0.35);
}
.film-handwritten {
  font-style: italic;
  color: rgba(255, 254, 248, 0.95);
}
.film-prose {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(1.1rem, 2vw, 1.3rem);
  line-height: 1.78;
  color: rgba(255, 254, 248, 0.92);
  margin: 0 auto 1.6rem;
  max-width: 32ch;
  white-space: pre-wrap;
  text-shadow:
    0 1px 14px rgba(0, 0, 0, 0.6),
    0 1px 0  rgba(0, 0, 0, 0.3);
}
.film-prose--letter {
  text-align: left;
  max-width: none;
  font-size: clamp(1.05rem, 1.9vw, 1.2rem);
  line-height: 1.85;
  color: rgba(255, 254, 248, 0.92);
}
.film-prose--memorial {
  font-style: italic;
  color: rgba(245, 237, 224, 0.85);
}
.film-prose--center { text-align: center; max-width: 28ch; }
.film-stamp {
  display: block;
  font-size: 0.6rem; font-weight: 700; letter-spacing: 0.35em;
  text-transform: uppercase;
  color: rgba(184, 137, 44, 0.62);
  margin-top: 1.4rem;
}

/* ── Ornament ───────────────────────────────────────────────────────── */
.film-orn {
  font-family: var(--serif);
  font-size: 1.6rem; letter-spacing: 0.5em;
  color: rgba(245, 237, 224, 0.45);
  margin-bottom: 1.5rem;
  animation: filmOrnGlow 4s ease-in-out infinite;
}
.film-orn--gold {
  background: var(--grad-gold);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  opacity: 1;
  font-size: 2rem;
}
@keyframes filmOrnGlow {
  0%, 100% { opacity: 0.45; }
  50%      { opacity: 0.85; }
}

/* ─────────────────────────────────────────────────────────────────────
   VOICE-NOTE OVERLAYS
   Voice notes no longer get a slide of their own — they play as an
   audio layer on top of the surrounding visual chapter. The <audio>
   elements are present in the DOM for JS to drive, but must never
   take up space or render any UI of their own.
   ───────────────────────────────────────────────────────────────────── */
.film-voice-overlay {
  position: absolute;
  width: 0; height: 0;
  opacity: 0;
  pointer-events: none;
}

/* ─────────────────────────────────────────────────────────────────────
   VOICE WAVEFORM
   (Used only on the all-voice fallback chapter when a keepsake has
   no photos / videos but does have voice notes.)
   ───────────────────────────────────────────────────────────────────── */
.film-wave {
  display: flex; align-items: center; justify-content: center;
  gap: 6px; height: 90px;
  margin: 0 auto 2rem;
  max-width: 280px;
}
.film-wave-bar {
  width: 4px;
  background: linear-gradient(to top, rgba(184, 137, 44, 0.4), var(--gold-3));
  border-radius: 4px;
  height: 30%;
  animation: filmWave 1.2s ease-in-out infinite;
  transform-origin: 50% 50%;
}
@keyframes filmWave {
  0%, 100% { height: 25%; opacity: 0.65; }
  50%      { height: 100%; opacity: 1; }
}

/* ─────────────────────────────────────────────────────────────────────
   CTAs
   ───────────────────────────────────────────────────────────────────── */
.film-cta {
  display: inline-flex; align-items: center; gap: 0.6rem;
  padding: 0.85rem 2rem;
  background: var(--grad-gold);
  color: #1c1208;
  border: 0; border-radius: var(--rad-pill);
  font: 700 0.78rem/1 var(--sans);
  letter-spacing: 0.18em; text-transform: uppercase;
  text-decoration: none; cursor: pointer;
  box-shadow: 0 16px 40px -8px rgba(184, 137, 44, 0.55);
  transition: transform 0.2s var(--ease-spring), filter 0.2s;
}
.film-cta:hover { transform: translateY(-2px); filter: brightness(1.08); color: #1c1208; }
.film-cta-ghost {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.75rem 1.7rem;
  background: transparent;
  border: 1px solid rgba(245, 237, 224, 0.25);
  border-radius: var(--rad-pill);
  color: rgba(245, 237, 224, 0.9);
  font: 600 0.72rem/1 var(--sans);
  letter-spacing: 0.18em; text-transform: uppercase;
  text-decoration: none; cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.film-cta-ghost:hover { background: rgba(245, 237, 224, 0.06); border-color: rgba(245, 237, 224, 0.5); color: #fff; }

.film-closing-actions {
  display: flex; gap: 0.7rem; flex-wrap: wrap;
  justify-content: center;
  margin-top: clamp(1rem, 2.5vh, 1.6rem);
}

/* ─────────────────────────────────────────────────────────────────────
   CLOSING CHAPTER — credits / mosaic / brand signature
   ───────────────────────────────────────────────────────────────────── */
.film-ch--closing {
  display: block;
  /* Allow the closing chapter to scroll when its content overruns
     the viewport (very common on mobile portrait — the mosaic plus
     hero plus action buttons stack taller than 100vh). The bar is
     hidden visually so the cinematic look isn't broken. */
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;            /* Firefox */
}
.film-ch--closing::-webkit-scrollbar { display: none; }  /* Safari / Chromium */

.film-closing {
  position: relative; z-index: 5;
  min-height: 100%;
  display: flex; flex-direction: column;
  align-items: center;
  /* The HERO (brand + title + sub) sits as a single centered block;
     the mosaic + buttons flow underneath. flex-start + generous top
     padding pins the title in the upper-middle so it reads as the
     focal point rather than floating against the bottom. */
  justify-content: flex-start;
  text-align: center;
  /* Padding kept tighter than before so the buttons + foot land
     inside the viewport on average mobile heights. The chapter
     scrolls when they don't, but the goal is to fit by default. */
  padding: clamp(1.6rem, 5vh, 3.4rem) clamp(1.2rem, 5vw, 2.4rem)
           calc(env(safe-area-inset-bottom, 0px) + clamp(1.6rem, 5vh, 3rem));
  max-width: min(94vw, 760px);
  margin: 0 auto;
  opacity: 0;
  animation: filmCenterIn 1.4s 0.25s cubic-bezier(.18,.7,.25,1) forwards;
}

.film-closing-brand {
  display: inline-flex; align-items: baseline; gap: 0.4rem;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(0.78rem, 1.3vw, 0.92rem);
  letter-spacing: 0.36em;
  text-transform: uppercase;
  color: rgba(245, 237, 224, 0.45);
  margin: 0 0 clamp(0.9rem, 2.5vh, 1.6rem);
}
.film-closing-word { display: inline-block; }
.film-closing-dot {
  color: rgba(220, 170, 70, 0.85);
  font-size: 1.2em;
  transform: translateY(-0.05em);
}

/* The hero block — every piece of text in it is centered on the
   exact same horizontal axis (title, eyebrow, sub). */
.film-closing-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 100%;
  margin-bottom: clamp(1rem, 2.5vh, 1.8rem);
}

.film-closing-orn {
  display: inline-flex;
  margin: 0 0 clamp(1rem, 2.2vh, 1.6rem);
  filter: drop-shadow(0 4px 18px rgba(220, 170, 70, 0.18));
  animation: filmClosingOrnBreathe 5s ease-in-out infinite;
}
@keyframes filmClosingOrnBreathe {
  0%, 100% { transform: scale(1); opacity: 0.92; }
  50%      { transform: scale(1.05); opacity: 1; }
}

/* Soft eyebrow ("Kept close, always.") — sits above the keepsake's
   title in a smaller, italic serif. */
.film-closing-eyebrow {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1rem, 2.2vw, 1.35rem);
  line-height: 1.3;
  color: rgba(245, 237, 224, 0.78);
  margin: 0 0 0.55rem;
  letter-spacing: 0.01em;
  text-shadow: 0 2px 18px rgba(0,0,0,.35);
  max-width: 28ch;
}

/* The KEEPSAKE TITLE — the visual hero of the closing chapter.
   Big, centered, dignified. */
.film-closing-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2.4rem, 7vw, 4.6rem);
  line-height: 1.04;
  color: rgba(255, 254, 248, 0.98);
  margin: 0 0 0.85rem;
  letter-spacing: -0.012em;
  text-shadow:
    0 4px 28px rgba(0, 0, 0, 0.55),
    0 1px 0 rgba(220, 170, 70, 0.10);
  /* Avoid orphan single words by keeping the title to ~22 chars per line. */
  max-width: 22ch;
  text-wrap: balance;
}

.film-closing-sub {
  font-family: var(--sans, var(--serif));
  font-size: clamp(0.85rem, 1.5vw, 0.98rem);
  color: rgba(245, 237, 224, 0.55);
  letter-spacing: 0.06em;
  margin: 0;
  max-width: 36ch;
}

/* ── Mosaic of memory thumbnails ─────────────────────────────────────── */
.film-closing-mosaic {
  display: grid;
  gap: clamp(5px, 0.9vw, 10px);
  margin: 0.3rem 0 clamp(0.9rem, 2.5vh, 1.6rem);
  width: 100%;
  max-width: 460px;
}
.film-closing-mosaic--n1 { grid-template-columns: 1fr; }
.film-closing-mosaic--n2 { grid-template-columns: repeat(2, 1fr); }
.film-closing-mosaic--n3,
.film-closing-mosaic--n6,
.film-closing-mosaic--n9 { grid-template-columns: repeat(3, 1fr); }
.film-closing-mosaic--n4,
.film-closing-mosaic--n8 { grid-template-columns: repeat(4, 1fr); }
.film-closing-mosaic--n5,
.film-closing-mosaic--n7 { grid-template-columns: repeat(4, 1fr); }
.film-closing-mosaic--n5 .film-closing-tile:nth-child(1),
.film-closing-mosaic--n7 .film-closing-tile:nth-child(1) {
  grid-column: span 2; grid-row: span 2;
}

.film-closing-tile {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 6px;
  background: rgba(245, 237, 224, 0.04);
  box-shadow:
    0 6px 20px rgba(0, 0, 0, 0.45),
    inset 0 0 0 1px rgba(220, 170, 70, 0.12);
  opacity: 0;
  transform: translateY(14px) scale(0.96);
  animation: filmClosingTileIn 0.95s cubic-bezier(.2,.7,.2,1) forwards;
}
.film-closing-tile img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  filter: saturate(0.92) brightness(0.94);
  transition: filter 0.4s ease, transform 0.6s ease;
}
.film-closing-tile:hover img {
  filter: saturate(1) brightness(1.04);
  transform: scale(1.04);
}
.film-closing-tile::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(0,0,0,0.35) 100%);
  pointer-events: none;
}
@keyframes filmClosingTileIn {
  0%   { opacity: 0; transform: translateY(14px) scale(0.96); }
  100% { opacity: 1; transform: translateY(0)    scale(1); }
}

/* ── Meta (year span + byline) ───────────────────────────────────────── */
.film-closing-meta {
  display: flex; flex-direction: column; gap: 0.25rem;
  margin: 0 0 0.6rem;
}
.film-closing-meta-line {
  font-family: var(--serif);
  font-size: 0.84rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: rgba(220, 170, 70, 0.82);
}
.film-closing-meta-line--soft {
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.92rem;
  letter-spacing: 0.04em;
  text-transform: none;
  color: rgba(245, 237, 224, 0.55);
}

/* ── Action buttons ──────────────────────────────────────────────────── */
.film-closing-btn {
  display: inline-flex; align-items: center; gap: 0.55rem;
  padding: 0.78rem 1.6rem;
  border-radius: 999px;
  font: 600 0.72rem/1 var(--sans, system-ui);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.25s ease, border-color 0.25s ease, transform 0.2s ease;
}
.film-closing-btn:hover { transform: translateY(-1px); }
.film-closing-btn--primary {
  background: rgba(245, 237, 224, 0.10);
  border-color: rgba(245, 237, 224, 0.35);
  color: rgba(255, 254, 248, 0.95);
}
.film-closing-btn--primary:hover {
  background: rgba(245, 237, 224, 0.18);
  border-color: rgba(245, 237, 224, 0.55);
}
.film-closing-btn--ghost {
  background: transparent;
  border-color: rgba(245, 237, 224, 0.22);
  color: rgba(245, 237, 224, 0.78);
}
.film-closing-btn--ghost:hover {
  border-color: rgba(245, 237, 224, 0.45);
  color: #fff;
}
.film-closing-btn--gold {
  background: linear-gradient(135deg, #d9b35a 0%, #b48a35 100%);
  color: #1a0f02;
  border-color: rgba(220, 170, 70, 0.4);
  box-shadow: 0 8px 20px rgba(180, 138, 53, 0.25);
}
.film-closing-btn--gold:hover {
  background: linear-gradient(135deg, #e7c272 0%, #c69a40 100%);
  box-shadow: 0 10px 26px rgba(180, 138, 53, 0.35);
}

.film-closing-foot {
  margin: clamp(1.2rem, 3vh, 1.8rem) 0 0;
  font-family: var(--serif);
  font-size: 0.7rem;
  letter-spacing: 0.25em;
  text-transform: lowercase;
  color: rgba(245, 237, 224, 0.32);
}

/* ── Drifting embers ─────────────────────────────────────────────────── */
.film-closing-particles {
  position: absolute; inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
}
.film-closing-spark {
  position: absolute;
  bottom: -10px;
  width: 3px; height: 3px;
  border-radius: 50%;
  background: radial-gradient(circle at center, rgba(255, 220, 140, 0.95) 0%, rgba(220, 170, 70, 0) 70%);
  box-shadow: 0 0 6px rgba(255, 210, 120, 0.6);
  opacity: 0;
  animation: filmSparkDrift 14s linear infinite;
}
@keyframes filmSparkDrift {
  0%   { opacity: 0; transform: translateY(0) translateX(0); }
  10%  { opacity: 0.9; }
  85%  { opacity: 0.7; }
  100% { opacity: 0; transform: translateY(-110vh) translateX(20px); }
}

/* ── Mobile tightening ─────────────────────────────────────────────────
   The closing chapter has more stacked content (brand + hero + mosaic +
   meta + actions + foot) than any other slide. On phones we squeeze
   every layer down so all of it lands above the fold and the action
   buttons are large, easy-to-tap targets that never get clipped. */
@media (max-width: 560px) {
  .film-closing {
    padding: 2.6vh 1rem calc(env(safe-area-inset-bottom, 0px) + 2.6vh);
  }
  .film-closing-brand   { margin: 0 0 0.7rem; font-size: 0.66rem; letter-spacing: 0.28em; }
  .film-closing-hero    { margin-bottom: 0.9rem; }
  .film-closing-orn     { margin-bottom: 0.7rem; transform: scale(0.85); }
  .film-closing-eyebrow { font-size: 0.86rem; margin-bottom: 0.35rem; }
  .film-closing-title {
    /* Much smaller upper bound — long names (e.g. "Margaret Elizabeth
       Thompson-Carruthers") were overrunning the previous 2.9rem cap.
       Letter-spacing tightened so the line wraps later. */
    font-size: clamp(1.5rem, 7vw, 2.1rem);
    line-height: 1.08;
    max-width: 20ch;
    letter-spacing: -0.02em;
    margin-bottom: 0.55rem;
  }
  .film-closing-sub {
    font-size: 0.74rem;
    letter-spacing: 0.05em;
    max-width: 28ch;
  }

  .film-closing-mosaic {
    max-width: 320px;
    gap: 4px;
    margin: 0.2rem 0 0.9rem;
  }
  .film-closing-mosaic--n5,
  .film-closing-mosaic--n6,
  .film-closing-mosaic--n7,
  .film-closing-mosaic--n8,
  .film-closing-mosaic--n9 { grid-template-columns: repeat(3, 1fr); }
  .film-closing-mosaic--n5 .film-closing-tile:nth-child(1),
  .film-closing-mosaic--n7 .film-closing-tile:nth-child(1) {
    grid-column: span 2; grid-row: span 2;
  }
  .film-closing-tile { border-radius: 5px; }

  .film-closing-meta { margin-bottom: 0.4rem; gap: 0.18rem; }
  .film-closing-meta-line { font-size: 0.7rem; letter-spacing: 0.26em; }
  .film-closing-meta-line--soft { font-size: 0.78rem; }

  /* Action buttons go full-width and stack vertically so every button
     is a comfortable tap target (≥ 44px tall, easily reachable). The
     previous wrap-flex layout left "Share this keepsake" squashed and
     hard to hit. */
  .film-closing-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 0.55rem;
    width: 100%;
    max-width: 320px;
    margin-top: 0.5rem;
  }
  .film-closing-btn {
    justify-content: center;
    width: 100%;
    padding: 0.95rem 1.1rem;
    min-height: 46px;
    font-size: 0.72rem;
    letter-spacing: 0.14em;
  }
  .film-closing-foot { margin-top: 0.9rem; font-size: 0.6rem; letter-spacing: 0.22em; }
}

/* Very small phones (≤ 380px wide — iPhone SE 1st gen, older Androids).
   Drop the mosaic entirely on the smallest screens to guarantee the
   buttons sit above the fold; the title + sub still carry the moment. */
@media (max-width: 380px) {
  .film-closing-title { font-size: clamp(1.35rem, 6.5vw, 1.85rem); }
  .film-closing-mosaic { display: none; }
  .film-closing-meta-line { font-size: 0.66rem; letter-spacing: 0.22em; }
}

/* ─────────────────────────────────────────────────────────────────────
   PAUSE INDICATOR
   ───────────────────────────────────────────────────────────────────── */
.film-pause-ind {
  position: absolute; inset: 0; z-index: 40;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
  background: rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  color: rgba(255, 255, 255, 0.85);
  animation: filmPauseIn 0.2s ease-out;
}
@keyframes filmPauseIn {
  0%   { opacity: 0; }
  100% { opacity: 1; }
}

/* ─────────────────────────────────────────────────────────────────────
   OWNER SHEET (bottom slide-up)
   ───────────────────────────────────────────────────────────────────── */
.film-sheet {
  position: fixed; inset: 0; z-index: 300;
}
.film-sheet-backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.28s ease;
}
.film-sheet.is-open .film-sheet-backdrop { opacity: 1; }

.film-sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(184, 137, 44, 0.10) 0%, transparent 70%),
    linear-gradient(180deg, #14100a 0%, #08060a 100%);
  border-top: 1px solid rgba(184, 137, 44, 0.18);
  border-radius: 24px 24px 0 0;
  padding: 1rem clamp(1.2rem, 4vw, 2rem) calc(2rem + env(safe-area-inset-bottom, 0));
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(.2,.8,.2,1);
  color: #f5ede0;
  text-align: center;
}
.film-sheet.is-open .film-sheet-panel { transform: translateY(0); }

.film-sheet-grip {
  width: 38px; height: 4px;
  background: rgba(245, 237, 224, 0.25);
  border-radius: 4px;
  margin: 0 auto 1.2rem;
}
.film-sheet-eyebrow {
  font-size: 0.6rem; font-weight: 700; letter-spacing: 0.3em;
  text-transform: uppercase; color: var(--gold-3); margin: 0 0 0.4rem;
}
.film-sheet-title {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(1.4rem, 4vw, 1.9rem);
  margin: 0 0 1.8rem; color: #fffef8; line-height: 1.15;
}
.film-sheet-actions {
  display: flex; flex-direction: column; gap: 0.5rem;
  margin-top: 0.5rem;
}
.film-sheet-act {
  display: flex; align-items: center; gap: 0.9rem;
  padding: 1rem 1.2rem;
  background: rgba(245, 237, 224, 0.04);
  border: 1px solid rgba(184, 137, 44, 0.15);
  border-radius: 14px;
  color: #fffef8;
  text-decoration: none;
  font-size: 0.95rem; font-weight: 500;
  text-align: left;
  transition: background 0.18s, border-color 0.18s, transform 0.18s;
}
.film-sheet-act:hover {
  background: rgba(245, 237, 224, 0.08);
  border-color: rgba(184, 137, 44, 0.35);
  color: #fffef8;
  transform: translateY(-1px);
}
.film-sheet-ico {
  width: 36px; height: 36px;
  background: rgba(184, 137, 44, 0.10);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--gold-3); flex-shrink: 0;
}

/* ─────────────────────────────────────────────────────────────────────
   RESPONSIVE — tiny phones
   ───────────────────────────────────────────────────────────────────── */
@media (max-width: 380px) {
  .film-caption        { padding-bottom: 2rem; }
  .film-caption-title  { font-size: 1.7rem; max-width: 18ch; }
  .film-caption-body   { font-size: 0.95rem; max-width: 30ch; }
  .film-caption-mark   { width: 60px; margin-bottom: 0.75rem; }
  .film-title-xl       { font-size: 2.3rem; max-width: 14ch; }
  .film-title-lg       { font-size: 1.85rem; max-width: 18ch; }
  .film-prose          { font-size: 1.05rem; line-height: 1.7; }
  .film-photo-stage   { padding: 5vh 4vw 22vh; }
}

/* CHIP WRITER PANEL (admin NFC writer)
   ────────────────────────────────────────────────────────────────────── */
.chip-writer {
  border: 1px solid var(--line-gold) !important;
  background: linear-gradient(160deg, var(--cream) 0%, var(--gold-pale) 100%);
}

.chip-writer-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem;
}

.chip-writer-cap {
  display: inline-block; padding: 0.25rem 0.75rem;
  border-radius: var(--rad-pill); font-size: 0.7rem; font-weight: 700;
  letter-spacing: 0.8px; text-transform: uppercase; flex-shrink: 0;
  margin-top: 0.2rem;
}
.chip-writer-cap[data-tone="ok"]   { background: var(--success-bg); color: var(--success-ink); border: 1px solid rgba(37,96,37,0.18); }
.chip-writer-cap[data-tone="err"]  { background: var(--danger-bg); color: var(--danger-ink); border: 1px solid rgba(138,32,32,0.18); }
.chip-writer-cap[data-tone="warn"] { background: var(--warn-bg); color: var(--warn-ink); border: 1px solid rgba(122,88,24,0.18); }

.chip-writer-status {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: 1rem 1.2rem;
  border-radius: var(--rad-sm);
  background: var(--paper-2);
  border: 1px solid var(--line-gold);
  margin-bottom: 1rem;
}
.chip-writer-status[data-state="arming"]  { border-color: var(--gold-2); background: var(--gold-pale); }
.chip-writer-status[data-state="success"] { border-color: rgba(37,96,37,0.35); background: var(--success-bg); }
.chip-writer-status[data-state="error"]   { border-color: rgba(138,32,32,0.25); background: var(--danger-bg); }

.chip-writer-status-icon {
  width: 40px; height: 40px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: rgba(184, 137, 44, 0.12); color: var(--gold);
  animation: nfcPulse 1.5s ease-in-out infinite;
}
[data-state="success"] .chip-writer-status-icon { background: rgba(37,96,37,0.14); color: var(--success-ink); animation: none; }
[data-state="error"]   .chip-writer-status-icon { background: rgba(138,32,32,0.12); color: var(--danger-ink); animation: none; }

.chip-writer-status-text { flex: 1; min-width: 0; }
.chip-writer-status-text strong { display: block; font-weight: 600; font-size: 0.93rem; color: var(--ink); margin-bottom: 2px; }

.chip-writer-toolbar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.chip-writer-spacer { flex: 1; }

.chip-writer-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0; }

.chip-writer-row {
  display: flex; align-items: center; gap: 0.9rem; flex-wrap: wrap;
  padding: 0.8rem 0.4rem;
  border-bottom: 1px solid var(--line);
  transition: background 0.18s;
}
.chip-writer-row:last-child { border-bottom: 0; }
.chip-writer-row.is-arming { background: var(--gold-pale); }
.chip-writer-row[data-cw-already-encoded] { opacity: 0.72; }

.chip-writer-row-icon {
  width: 32px; height: 32px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--gold); opacity: 0.6;
}

.chip-writer-row-main { flex: 1; min-width: 0; }
.chip-writer-row-code { font-weight: 600; font-size: 0.88rem; }
.chip-writer-row-code code { font-size: 0.82rem; }
.chip-writer-row-url { font-size: 0.78rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px; }

.chip-writer-row-state { display: flex; align-items: center; }
.chip-writer-row-actions { display: flex; align-items: center; gap: 0.4rem; flex-shrink: 0; }

.chip-writer-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 0.22rem 0.65rem;
  border-radius: var(--rad-pill); font-size: 0.68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.6px;
}
.chip-writer-pill--done { background: var(--success-bg); color: var(--success-ink); border: 1px solid rgba(37,96,37,0.20); }

.chip-writer-fallback {
  padding: 1.2rem 0 0; border-top: 1px dashed var(--line-med); margin-top: 0.5rem;
}
.chip-writer-fallback h3 { font-family: var(--serif); font-weight: 500; font-size: 1.3rem; margin: 0 0 0.6rem; }

/* ──────────────────────────────────────────────────────────────────────
   25. ADMIN MISC (badge helpers)
   ────────────────────────────────────────────────────────────────────── */
.badge-admin {
  background: var(--grad-gold); color: #1c1208;
  padding: 0.2rem 0.65rem; border-radius: var(--rad-pill);
  font-size: 0.68rem; letter-spacing: 0.8px; text-transform: uppercase; font-weight: 700;
}

.filter-row { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; margin-bottom: 1.2rem; }
.filter-select { width: auto; min-width: 160px; min-height: 40px; font-size: 0.88rem; }
.filter-input  { flex: 1; min-width: 200px; min-height: 40px; font-size: 0.88rem; }

.nfc-enc-done { color: var(--success-ink); font-size: 0.7rem; cursor: help; }
.nfc-enc-pend { color: var(--muted-soft); font-size: 0.7rem; cursor: help; }

/* ──────────────────────────────────────────────────────────────────────
   26. COMPREHENSIVE MOBILE FIXES
   ────────────────────────────────────────────────────────────────────── */

/* ── Mobile action bar: block layout so .mab-inner fills full width ── */
@media (max-width: 900px) {
  .mobile-action-bar {
    /* display: block (set above) + auto height = bar is exactly as tall as
       the inner tab row + safe-area padding — no flex-row width squashing */
    height: auto;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .mab-inner {
    /* Block child fills parent width; explicit height for the tab area */
    width: 100%;
    height: var(--mab-h);
    display: flex;       /* re-declare flex so tabs lay out correctly */
    align-items: stretch;
  }
}

/* ── Topbar: compact on narrow phones ── */
@media (max-width: 480px) {
  .topbar { padding: 0 0.75rem; gap: 0.45rem; }
  .topbar-title { font-size: 1.1rem; }
  .topbar-sub { display: none; }
  .icon-btn { width: 36px; height: 36px; }
}

/* ── Page-actions bar: left-aligned + wrap nicely on mobile ── */
@media (max-width: 900px) {
  .page-actions-bar {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .page-actions-bar .btn { flex-shrink: 0; }
}

/* ── Button rows: stack vertically on very small screens ── */
@media (max-width: 480px) {
  .btn-row { flex-direction: column; align-items: stretch; }
  .btn-row .btn { width: 100%; justify-content: center; }
  /* Keep small utility buttons (e.g. "Cancel") auto-width */
  .btn-row .btn-sm { width: auto; align-self: flex-start; }
}

/* ── Cards: tighter padding on phones ── */
@media (max-width: 540px) {
  .card { padding: 1.2rem 1rem; }
  .memory-head { flex-direction: column; align-items: stretch; padding: 1.15rem; }
  .memory-head-visual { display: flex; justify-content: center; }
  .memory-hero { padding: 1.5rem 1.2rem; min-height: 220px; }
}

/* ── Settings grid: single column on phones ── */
@media (max-width: 600px) {
  .settings-grid { grid-template-columns: 1fr; }
}

/* ── Radio cards (visibility picker etc.): single column on phones ── */
@media (max-width: 540px) {
  .radio-row { grid-template-columns: 1fr; }
}

/* ── Stats grid: 2 columns on phones ── */
@media (max-width: 540px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Jewelry grid: single column on very small phones ── */
@media (max-width: 400px) {
  .jewelry-grid { grid-template-columns: 1fr; }
}

/* ── Auth panel: better spacing on small phones ── */
@media (max-width: 480px) {
  .auth-panel { padding: 2rem 1.2rem 2.5rem; align-items: flex-start; }
  .auth-panel-inner h2 { font-size: 1.8rem; }
  .auth-sub { margin-bottom: 1.4rem; }
  .onboarding-card { padding: 2rem 1.2rem; }
  .onboarding-wrap { padding: 1rem; }
}

/* ── Admin filter row: stack on phones ── */
@media (max-width: 600px) {
  .filter-row { flex-direction: column; }
  .filter-select,
  .filter-input { width: 100%; min-width: 0; }
}

/* ── Tables collapse to stacked cards on phones ──────────────────
   On <=720px screens, any .data-table inside a .table-wrap stops
   behaving like a table and renders each row as a self-contained
   card with label/value pairs. <td>s with data-label="..." attribute
   get that label rendered to the left.  Designed so admin index, ring
   show, history, and scan-event tables stop scrolling sideways and
   stay readable on a phone. */
@media (max-width: 720px) {
  .table-wrap {
    overflow: visible;
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 0;
  }
  .data-table {
    min-width: 0;
    border-collapse: separate;
    border-spacing: 0;
    display: block;
  }
  .data-table thead { display: none; }
  .data-table tbody,
  .data-table tr,
  .data-table td { display: block; width: 100%; }
  .data-table tr {
    background: var(--cream);
    border: 1px solid var(--line);
    border-radius: var(--rad);
    box-shadow: var(--shadow-sm);
    padding: 0.85rem 1rem;
    margin-bottom: 0.85rem;
  }
  .data-table tbody tr:hover { background: var(--cream); }
  .data-table td {
    border-bottom: 1px dashed var(--line);
    padding: 0.55rem 0;
    font-size: 0.92rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    text-align: right;
    overflow-wrap: anywhere;
  }
  .data-table td:last-child { border-bottom: 0; }
  .data-table td[data-label]::before {
    content: attr(data-label);
    flex: 0 0 auto;
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--gold-deep);
    text-align: left;
    max-width: 45%;
  }
  /* When a row has a single full-width cell (e.g. an actions row),
     let it span without label space. */
  .data-table td.data-full {
    justify-content: flex-start;
    text-align: left;
  }
  .data-table td.data-full::before { display: none; }
}

/* ── chip-writer: stack on mobile ── */
@media (max-width: 600px) {
  .chip-writer-head { flex-direction: column; gap: 0.5rem; }
  .chip-writer-row { flex-wrap: wrap; }
  .chip-writer-row-url { max-width: 100%; }
}

/* ── Dark mode: keep btn-gold readable (text was dark brand) ── */
[data-theme="dark"] .btn-gold {
  color: #0f0d0a;
}
[data-theme="dark"] .btn-gold:hover {
  color: #0f0d0a;
}

/* ── Dark mode: keep btn-ghost legible ── */
[data-theme="dark"] .btn-ghost {
  background: var(--paper-3);
  color: var(--ink);
  border-color: var(--line-med);
}
[data-theme="dark"] .btn-ghost:hover {
  background: var(--paper-4);
  color: var(--ink);
}

/* ── Dark mode: mab-tab-add needs gold glyph on dark bg ── */
[data-theme="dark"] .mab-tab-add .mab-glyph {
  background: var(--grad-brand);
  color: #0f0d0a;
}

/* ── Dark mode: sidebar user card avatar stays readable ── */
[data-theme="dark"] .user-avatar {
  background: var(--grad-brand);
  color: #0f0d0a;
  border-color: rgba(212, 168, 78, 0.4);
}

/* ── Dark mode: icon-btn borders more visible ── */
[data-theme="dark"] .icon-btn {
  border-color: var(--line-med);
}

/* ── Forms on mobile: bigger tap targets ── */
@media (max-width: 540px) {
  input[type=text],
  input[type=email],
  input[type=password],
  input[type=number],
  input[type=tel],
  input[type=date],
  select {
    min-height: 50px;
    font-size: 1rem;
  }
  .btn-lg { padding: 0.85rem 1.5rem; min-height: 52px; }
  .btn-block { min-height: 52px; }
}

/* ── ks-manage: 2-column button grid on mobile ───────────────────── */
@media (max-width: 640px) {
  .ks-manage {
    padding: 1rem;
    margin-top: 1.5rem;
  }
  .ks-manage-btns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }
  .ks-manage-btns .btn {
    width: 100%;
    justify-content: center;
    text-align: center;
    font-size: 0.8rem;
    padding: 0.6rem 0.6rem;
    min-height: 44px;
    white-space: normal;
    line-height: 1.25;
  }
}

/* ── ks-manage: single column on very small phones ── */
@media (max-width: 380px) {
  .ks-manage-btns {
    grid-template-columns: 1fr;
  }
}

/* ── CSS ring brand-mark — replaces logo.png everywhere ─────────────────── */
.brand-mark {
  position: relative;
  flex-shrink: 0;
  display: inline-block;
  border-radius: 50%;
}
.brand-mark::before {
  content: '';
  position: absolute; inset: 0;
  border-radius: 50%;
  border: 1.5px solid var(--gold);
  border-right-color: rgba(184, 137, 44, 0.22);
  animation: brandMarkSpin 22s linear infinite;
}
.brand-mark::after {
  content: '';
  position: absolute; inset: 26%;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 38%, var(--gold-3), var(--gold), var(--gold-deep));
  box-shadow: 0 0 10px rgba(184, 137, 44, 0.45);
}
@keyframes brandMarkSpin { to { transform: rotate(360deg); } }
.brand-mark-sm { width: 32px; height: 32px; }
.brand-mark-md { width: 44px; height: 44px; }
.brand-mark-lg { width: 50px; height: 50px; }

/* ── Auth-panel: mobile brand mark (hidden on desktop — auth-hero handles it) ── */
.auth-panel-brand {
  display: none;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
  margin-bottom: 2.25rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid var(--line);
}
.auth-panel-brand .brand-mark { flex-shrink: 0; }
.auth-panel-brand-text { display: flex; flex-direction: column; gap: 0.18rem; }
.auth-panel-brand-name {
  font-family: var(--serif);
  font-size: 1.22rem;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: 0.04em;
  line-height: 1;
}
.auth-panel-brand-name span {
  background: var(--grad-gold);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 600;
}
.auth-panel-brand-tag {
  font-size: 0.68rem;
  color: var(--muted);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
@media (max-width: 900px) {
  .auth-panel-brand { display: flex; }
}
