/* ======================================================================
   realdream.life — Celestial Atelier design system
   The interface your higher self uses to author your life.
   ====================================================================== */

/* ---- 1. Design tokens ---------------------------------------------- */
:root {
  /* Celestial Dawn (default) */
  --void: #070612;
  --void-2: #0c0a1c;
  --dusk: #14112a;
  --surface: rgba(20, 17, 38, 0.66);
  --surface-2: rgba(26, 22, 48, 0.86);
  --surface-3: rgba(32, 27, 58, 0.96);

  --aurora: #8a7bff;
  --aurora-soft: #6c5cf0;
  --teal: #7fe3d4;
  --dawn: #ffb59e;
  --halo: #f5e6b8;
  --pearl: #f4f1ff;
  --muted: #a39ec9;
  --muted-2: #6f6a93;

  --line: rgba(244, 241, 255, 0.10);
  --line-2: rgba(244, 241, 255, 0.18);
  --line-bright: rgba(245, 230, 184, 0.42);
  --hairline: rgba(244, 241, 255, 0.06);

  --danger: #ff9b8b;
  --success: #bdf6cf;

  --iridescent: linear-gradient(118deg, var(--aurora) 0%, var(--dawn) 52%, var(--halo) 100%);
  --iridescent-soft: linear-gradient(118deg, rgba(138,123,255,0.22), rgba(255,181,158,0.22) 52%, rgba(245,230,184,0.22));

  --shadow-sm: 0 8px 24px -12px rgba(0, 0, 0, 0.6);
  --shadow: 0 30px 70px -28px rgba(0, 0, 0, 0.75);
  --shadow-glow: 0 0 60px -16px rgba(138, 123, 255, 0.45);

  --radius: 16px;
  --radius-sm: 11px;
  --radius-lg: 24px;
  --radius-pill: 999px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur: 360ms;

  --rail: 248px;
  --font-ui: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-mono: "SF Mono", ui-monospace, "JetBrains Mono", Menlo, monospace;

  --maxw: 1240px;
}

/* Midnight Gold */
body.theme-midnight {
  --void: #06050a;
  --void-2: #0b0a10;
  --dusk: #171210;
  --surface: rgba(28, 22, 16, 0.7);
  --surface-2: rgba(34, 26, 18, 0.88);
  --surface-3: rgba(40, 30, 20, 0.97);
  --aurora: #d8b25e;
  --aurora-soft: #b8924a;
  --teal: #d6c89a;
  --dawn: #e7c585;
  --halo: #fff1c4;
  --pearl: #fff6e6;
  --muted: #c7b894;
  --muted-2: #8c7f60;
  --line: rgba(255, 246, 230, 0.10);
  --line-2: rgba(255, 246, 230, 0.18);
  --line-bright: rgba(255, 241, 196, 0.45);
  --hairline: rgba(255, 246, 230, 0.06);
  --iridescent: linear-gradient(118deg, #d8b25e 0%, #e7c585 52%, #fff1c4 100%);
}

/* Aurora */
body.theme-aurora {
  --void: #04141a;
  --void-2: #061a20;
  --dusk: #0c262c;
  --surface: rgba(12, 38, 42, 0.7);
  --surface-2: rgba(14, 48, 52, 0.88);
  --surface-3: rgba(16, 56, 60, 0.97);
  --aurora: #5fe0c8;
  --aurora-soft: #36c2a8;
  --teal: #9affd0;
  --dawn: #ffc6ad;
  --halo: #e8ffd6;
  --pearl: #effffc;
  --muted: #9bd1c9;
  --muted-2: #5e8a83;
  --iridescent: linear-gradient(118deg, #5fe0c8 0%, #9affd0 48%, #c9b6ff 100%);
}

/* Pearl (light daytime) */
body.theme-pearl {
  --void: #f4f1fb;
  --void-2: #efeafa;
  --dusk: #ffffff;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-2: rgba(255, 255, 255, 0.86);
  --surface-3: rgba(255, 255, 255, 0.96);
  --aurora: #6a59d6;
  --aurora-soft: #5447bf;
  --teal: #0a8a7e;
  --dawn: #c0634f;
  --halo: #9a6c1c;
  --pearl: #181533;
  --muted: #5c5780;
  --muted-2: #8c87a8;
  --line: rgba(24, 21, 51, 0.12);
  --line-2: rgba(24, 21, 51, 0.20);
  --line-bright: rgba(106, 89, 214, 0.38);
  --hairline: rgba(24, 21, 51, 0.07);
  --shadow: 0 30px 70px -30px rgba(60, 50, 120, 0.30);
  --shadow-glow: 0 0 60px -16px rgba(106, 89, 214, 0.22);
  --iridescent: linear-gradient(118deg, #6a59d6 0%, #c0634f 52%, #9a6c1c 100%);
}

/* ---- 2. Reset & base ----------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  min-height: 100%;
  background: var(--void);
  color: var(--pearl);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.6;
  color: var(--pearl);
  background:
    radial-gradient(120% 90% at 16% -8%, rgba(138, 123, 255, 0.20), transparent 46%),
    radial-gradient(120% 90% at 88% 6%, rgba(255, 181, 158, 0.13), transparent 42%),
    radial-gradient(140% 120% at 50% 118%, rgba(127, 227, 212, 0.10), transparent 55%),
    linear-gradient(170deg, var(--void) 0%, var(--void-2) 60%, var(--void) 100%);
  background-attachment: fixed;
  letter-spacing: 0.005em;
  overflow-x: hidden;
}

body.theme-pearl {
  background:
    radial-gradient(120% 90% at 16% -8%, rgba(106, 89, 214, 0.16), transparent 46%),
    radial-gradient(120% 90% at 88% 6%, rgba(192, 99, 79, 0.12), transparent 42%),
    linear-gradient(170deg, #faf8ff 0%, #eef0fb 60%, #f7eef0 100%);
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
img { display: block; max-width: 100%; }
::selection { background: rgba(245, 230, 184, 0.26); color: var(--pearl); }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 99px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* ---- 3. Cosmos atmosphere ------------------------------------------ */
.cosmos { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.cosmos__orb {
  position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.55;
  mix-blend-mode: screen;
}
body.theme-pearl .cosmos__orb { mix-blend-mode: multiply; opacity: 0.22; filter: blur(90px); }
.cosmos__orb--aurora { width: 42vw; height: 42vw; left: -8vw; top: -10vw; background: radial-gradient(circle, var(--aurora), transparent 68%); animation: orb-a 38s ease-in-out infinite; }
.cosmos__orb--dawn { width: 34vw; height: 34vw; right: -6vw; top: 4vh; background: radial-gradient(circle, var(--dawn), transparent 70%); animation: orb-b 46s ease-in-out infinite; opacity: 0.42; }
.cosmos__orb--halo { width: 30vw; height: 30vw; left: 38vw; bottom: -14vw; background: radial-gradient(circle, var(--halo), transparent 72%); animation: orb-c 54s ease-in-out infinite; opacity: 0.30; }

/* fine film grain */
.cosmos__grain {
  position: absolute; inset: -50%; opacity: 0.05; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 160px 160px;
  animation: grain 8s steps(6) infinite;
}
body.theme-pearl .cosmos__grain { opacity: 0.035; mix-blend-mode: multiply; }

/* ensure content sits above cosmos */
.app-shell, .threshold, .share-card-page, .document-wrap, .manifest-overlay, .toast-stack { position: relative; z-index: 1; }

/* ---- 4. Typography helpers ----------------------------------------- */
.eyebrow, .panel-kicker, .stat-label, .small-label, .micro-label {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 0.66rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--halo);
  line-height: 1;
}
body.theme-pearl .eyebrow, body.theme-pearl .panel-kicker, body.theme-pearl .stat-label { color: var(--aurora); }
.panel-kicker { color: var(--muted); }
.display { font-family: var(--font-display); font-weight: 400; letter-spacing: -0.01em; line-height: 1; }
.serif { font-family: var(--font-display); }
.italic { font-style: italic; }

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }

/* ---- 5. Buttons & inputs ------------------------------------------- */
.primary-action, .secondary-action, .icon-text-button, .ghost-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 22px;
  border-radius: var(--radius-pill);
  font-weight: 600; font-size: 0.92rem; letter-spacing: 0.01em;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease);
  white-space: nowrap;
}
.primary-action {
  background: var(--iridescent); color: #1a1530; font-weight: 700;
  box-shadow: 0 10px 30px -10px rgba(138, 123, 255, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.primary-action:hover { transform: translateY(-1px); box-shadow: 0 16px 40px -12px rgba(138, 123, 255, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.5); }
.primary-action:active { transform: translateY(0); }

.secondary-action, .ghost-button, .icon-text-button {
  border: 1px solid var(--line-2); color: var(--pearl);
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(10px);
}
body.theme-pearl .secondary-action, body.theme-pearl .ghost-button, body.theme-pearl .icon-text-button { background: rgba(255, 255, 255, 0.5); }
.secondary-action:hover, .ghost-button:hover, .icon-text-button:hover {
  border-color: var(--line-bright); background: rgba(245, 230, 184, 0.08); color: var(--halo);
  transform: translateY(-1px);
}
.icon-text-button { min-height: 42px; padding: 0 16px; }
.ghost-button { min-height: 42px; padding: 0 16px; border-color: var(--line); }

.round-button {
  display: inline-grid; place-items: center;
  min-width: 42px; height: 42px; padding: 0 14px;
  border: 1px solid var(--line-2); border-radius: var(--radius-pill);
  color: var(--muted); background: rgba(255, 255, 255, 0.03);
  font-size: 0.8rem; font-weight: 600; letter-spacing: 0.04em;
  transition: all var(--dur) var(--ease);
}
.round-button:hover { color: var(--pearl); border-color: var(--line-bright); background: rgba(245, 230, 184, 0.08); }
.round-button.is-active { color: var(--halo); border-color: var(--line-bright); }

label {
  display: grid; gap: 8px;
  color: var(--muted); font-size: 0.86rem;
}
input, select, textarea {
  width: 100%; min-height: 46px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: rgba(8, 7, 19, 0.5); color: var(--pearl);
  outline: none; transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background var(--dur) var(--ease);
}
body.theme-pearl input, body.theme-pearl select, body.theme-pearl textarea { background: rgba(255, 255, 255, 0.7); }
input::placeholder, textarea::placeholder { color: var(--muted-2); }
textarea { min-height: 110px; resize: vertical; line-height: 1.6; }
input:hover, select:hover, textarea:hover { border-color: var(--line-2); }
input:focus, select:focus, textarea:focus {
  border-color: var(--line-bright);
  box-shadow: 0 0 0 4px rgba(245, 230, 184, 0.10);
  background: rgba(12, 10, 28, 0.6);
}
body.theme-pearl input:focus, body.theme-pearl select:focus, body.theme-pearl textarea:focus { background: #fff; }
select {
  appearance: none; -webkit-appearance: none;
  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='%23a39ec9' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 38px;
}
option { background: var(--dusk); color: var(--pearl); }

/* ---- 6. App shell -------------------------------------------------- */
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  gap: 0;
}

/* Sidebar / realm rail */
.sidebar {
  position: sticky; top: 0;
  height: 100vh;
  padding: 26px 18px 18px;
  display: flex; flex-direction: column; gap: 22px;
  overflow-y: auto;
  border-right: 1px solid var(--hairline);
  background: linear-gradient(180deg, rgba(12, 10, 28, 0.5), rgba(7, 6, 18, 0.2));
  backdrop-filter: blur(20px);
}
body.theme-pearl .sidebar { background: linear-gradient(180deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.2)); }

.brand {
  display: flex; gap: 12px; align-items: center;
  padding: 4px 6px 2px;
}
.brand-mark {
  display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 12px;
  color: #1a1530; font-weight: 800; font-size: 0.92rem; letter-spacing: -0.02em;
  background: var(--iridescent);
  box-shadow: 0 8px 22px -8px rgba(138, 123, 255, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.brand-text { display: grid; gap: 2px; }
.brand-text strong { font-family: var(--font-display); font-weight: 500; font-size: 1.06rem; letter-spacing: -0.01em; line-height: 1; }
.brand-text small { color: var(--muted-2); font-size: 0.66rem; letter-spacing: 0.16em; text-transform: uppercase; }

.realm-groups { display: grid; gap: 18px; }
.realm-group { display: grid; gap: 4px; }
.realm-group-label {
  font-size: 0.6rem; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--muted-2); font-weight: 600; padding: 0 8px; margin-bottom: 4px;
}
.realm-link {
  display: grid; grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px; align-items: center;
  padding: 9px 10px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  color: var(--muted);
  transition: all var(--dur) var(--ease);
  position: relative;
}
.realm-link strong { display: block; font-size: 0.92rem; font-weight: 600; letter-spacing: -0.005em; line-height: 1.25; }
.realm-link small { display: block; font-size: 0.7rem; color: var(--muted-2); letter-spacing: 0.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.realm-link:hover { color: var(--pearl); background: rgba(255, 255, 255, 0.04); }
.realm-link.is-active { color: var(--pearl); background: rgba(255, 255, 255, 0.06); border-color: var(--line); }
.realm-link.is-active::before {
  content: ""; position: absolute; left: -18px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 26px; border-radius: 0 4px 4px 0;
  background: var(--iridescent); box-shadow: 0 0 16px var(--aurora);
}
.realm-icon {
  display: grid; place-items: center; width: 34px; height: 34px;
  border-radius: 10px; color: var(--muted);
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--hairline);
  transition: all var(--dur) var(--ease);
}
.realm-icon svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.realm-link.is-active .realm-icon, .realm-link:hover .realm-icon { color: var(--halo); border-color: var(--line-bright); background: rgba(245, 230, 184, 0.08); }

.logout-form { margin-top: auto; }
.logout-form button { width: 100%; justify-content: center; }

/* Main column */
.app-main { min-width: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); }

.topbar {
  position: sticky; top: 0; z-index: 8;
  min-height: 72px; padding: 14px 30px;
  display: flex; align-items: center; gap: 14px;
  background: linear-gradient(180deg, rgba(7, 6, 18, 0.85), rgba(7, 6, 18, 0.4));
  backdrop-filter: blur(24px) saturate(140%);
  border-bottom: 1px solid var(--hairline);
}
body.theme-pearl .topbar { background: linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.4)); }
.mobile-menu { display: none; }

.topbar-metrics {
  flex: 1; display: flex; align-items: center; gap: 28px; min-width: 0;
}
.topbar-metric { display: grid; gap: 2px; min-width: 0; }
.topbar-metric .stat-label { font-size: 0.6rem; letter-spacing: 0.2em; color: var(--muted-2); }
.topbar-metric strong {
  font-family: var(--font-display); font-weight: 500; font-size: 1.32rem; line-height: 1.1;
  letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.topbar-metric.is-primary strong { font-size: 1.5rem; }
.topbar-metric.is-primary .stat-label { color: var(--halo); }

.topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.feed-button { position: relative; }
.feed-button .feed-dot {
  position: absolute; top: 6px; right: 7px; width: 7px; height: 7px; border-radius: 50%;
  background: var(--dawn); box-shadow: 0 0 10px var(--dawn); opacity: 0; transition: opacity var(--dur) var(--ease);
}
.feed-button .feed-dot.is-on { opacity: 1; animation: pulse-dot 2.4s ease-in-out infinite; }

.realm-stage { min-width: 0; padding: 30px 30px 80px; }
.realm-view { display: grid; gap: 22px; max-width: var(--maxw); }

/* ---- 7. Realm hero (atmospheric) ----------------------------------- */
.realm-hero {
  position: relative; overflow: hidden;
  min-height: 320px; border-radius: var(--radius-lg);
  padding: 44px clamp(28px, 5vw, 60px);
  display: flex; flex-direction: column; justify-content: flex-end; gap: 18px;
  border: 1px solid var(--line);
  isolation: isolate;
}
.realm-hero__sky {
  position: absolute; inset: 0; z-index: -2;
  background: var(--hero-sky, radial-gradient(120% 130% at 20% 10%, var(--aurora-soft), transparent 55%), radial-gradient(120% 120% at 90% 90%, var(--dawn), transparent 55%), linear-gradient(160deg, var(--dusk), var(--void)));
  opacity: 0.92;
}
body.theme-pearl .realm-hero__sky { opacity: 1; }
.realm-hero__sky::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(140% 100% at 50% 120%, rgba(7, 6, 18, 0.55), transparent 60%);
}
body.theme-pearl .realm-hero__sky::after { background: radial-gradient(140% 100% at 50% 120%, rgba(255,255,255,0.4), transparent 60%); }
.realm-hero__motif {
  position: absolute; inset: 0; z-index: -1; opacity: 0.42;
  color: rgba(244, 241, 255, 0.85);
  display: grid; place-items: center; pointer-events: none;
}
body.theme-pearl .realm-hero__motif { color: rgba(40, 32, 78, 0.55); opacity: 0.5; }
.realm-hero__motif svg { width: 100%; height: 100%; }
.realm-hero__content { position: relative; z-index: 1; max-width: 760px; display: grid; gap: 14px; }
.realm-hero h1 {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(2.1rem, 5vw, 3.6rem); line-height: 1.02; letter-spacing: -0.015em;
  text-wrap: balance;
}
.realm-hero p { margin: 0; max-width: 620px; color: var(--muted); font-size: 1.02rem; line-height: 1.65; }
.realm-hero .eyebrow { color: var(--halo); }

/* ---- 8. Grids & panels --------------------------------------------- */
.grid-2, .grid-3, .grid-4 { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.panel, .glass-panel, .metric-card, .catalog-card, .feed-item, .document, .share-card, .oracle-note, .manifest-card, .toolbar, .data-table, .topbar, .life-feed {
  border: 1px solid var(--line);
  background: var(--surface);
  backdrop-filter: blur(22px) saturate(130%);
  box-shadow: var(--shadow-sm);
  border-radius: var(--radius);
}
.glass-panel, .toolbar, .data-table, .document, .life-feed { background: var(--surface-2); }

/* subtle iridescent top hairline on panels */
.glass-panel, .metric-card, .catalog-card, .manifest-card, .oracle-note, .document, .share-card {
  position: relative; overflow: hidden;
}
.glass-panel::before, .metric-card::before, .catalog-card::before, .manifest-card::before, .oracle-note::before, .document::before, .share-card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(245, 230, 184, 0.32), transparent);
  opacity: 0.7;
}

.glass-panel, .metric-card, .catalog-card, .manifest-card, .oracle-note { padding: 22px; }

.panel-header { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; margin-bottom: 18px; }
.panel-header > div { display: grid; gap: 6px; min-width: 0; }
.panel-header h2 { font-family: var(--font-display); font-weight: 500; font-size: 1.32rem; letter-spacing: -0.01em; line-height: 1.1; }
.panel-header p, .glass-panel > p, .catalog-card p, .metric-card p, .oracle-note p, .feed-item p { color: var(--muted); line-height: 1.6; margin: 0; }

/* ---- 9. Metric cards ----------------------------------------------- */
.metric-card { display: grid; gap: 10px; align-content: start; }
.metric-card .stat-label { color: var(--muted-2); }
.metric-card strong {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(1.7rem, 2.6vw, 2.5rem); line-height: 1; letter-spacing: -0.02em;
  overflow-wrap: anywhere; color: var(--pearl);
}
.metric-card.is-accent strong { background: var(--iridescent); -webkit-background-clip: text; background-clip: text; color: transparent; }
.metric-card .trend { font-size: 0.78rem; color: var(--teal); display: inline-flex; gap: 5px; align-items: center; }
.metric-card p { font-size: 0.84rem; }

/* ---- 10. Catalog cards --------------------------------------------- */
.catalog-card { display: grid; gap: 14px; align-content: start; }
.catalog-card__art {
  height: 180px; margin: -22px -22px 0; border-radius: var(--radius) var(--radius) 0 0;
  position: relative; overflow: hidden; isolation: isolate;
}
.catalog-card__art .sky { position: absolute; inset: 0; z-index: 0; }
.catalog-card__art .motif { position: absolute; inset: 0; z-index: 1; opacity: 0.55; display: grid; place-items: center; }
.catalog-card__art .place { position: absolute; left: 16px; bottom: 14px; z-index: 2; }
.catalog-card__art .place small { display: block; font-size: 0.6rem; letter-spacing: 0.2em; text-transform: uppercase; color: rgba(244,241,255,0.7); }
.catalog-card__art .place strong { font-family: var(--font-display); font-weight: 500; font-size: 1.3rem; color: #fff; text-shadow: 0 2px 18px rgba(0,0,0,0.5); }
.catalog-card h3 { font-family: var(--font-display); font-weight: 500; font-size: 1.16rem; letter-spacing: -0.01em; }
.catalog-card .price { font-family: var(--font-display); font-weight: 500; font-size: 1.06rem; color: var(--pearl); }
.catalog-card .meta { color: var(--muted); font-size: 0.82rem; }

/* ---- 11. Pills, chips, status -------------------------------------- */
.pill-list, .chip-row { display: flex; flex-wrap: wrap; gap: 7px; }
.pill, .chip {
  display: inline-flex; align-items: center; min-height: 26px; max-width: 100%;
  padding: 4px 11px; border-radius: var(--radius-pill);
  border: 1px solid var(--line-2); color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.76rem; letter-spacing: 0.01em; overflow-wrap: anywhere;
}
.chip { color: var(--pearl); border-color: var(--line-bright); background: rgba(245, 230, 184, 0.06); }
.status-pill {
  display: inline-flex; align-items: center; gap: 7px;
  min-height: 28px; padding: 5px 13px; border-radius: var(--radius-pill);
  color: var(--success); border: 1px solid rgba(189, 246, 207, 0.3);
  background: rgba(189, 246, 207, 0.08); font-size: 0.76rem; font-weight: 600;
}
.status-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--success); box-shadow: 0 0 8px var(--success); }
.status-pill.is-sealed { color: var(--halo); border-color: var(--line-bright); background: rgba(245, 230, 184, 0.1); }
.status-pill.is-sealed::before { background: var(--halo); box-shadow: 0 0 8px var(--halo); }

/* ---- 12. Data tables ----------------------------------------------- */
.data-table { overflow: hidden; }
.data-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px;
  padding: 15px 22px; border-top: 1px solid var(--hairline);
  align-items: baseline;
}
.data-row:first-child { border-top: 0; }
.data-row span { color: var(--muted); font-size: 0.9rem; }
.data-row strong { font-family: var(--font-display); font-weight: 500; font-size: 1.08rem; letter-spacing: -0.01em; overflow-wrap: anywhere; text-align: right; }
.data-row .mono { font-family: var(--font-mono); font-size: 0.82rem; font-weight: 500; }

/* ---- 13. Timeline -------------------------------------------------- */
.timeline { display: grid; gap: 12px; }
.timeline-item { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 12px; align-items: center; }
.timeline-item span:last-child { color: var(--muted); font-size: 0.86rem; }
.timeline-dot {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--muted-2); box-shadow: 0 0 0 3px rgba(111, 106, 147, 0.15);
}
.timeline-item.is-done .timeline-dot { background: var(--halo); box-shadow: 0 0 12px var(--halo), 0 0 0 3px rgba(245, 230, 184, 0.18); }
.timeline-item.is-done span:last-child { color: var(--pearl); }

/* ---- 14. Forms & hold button --------------------------------------- */
.manifest-form { display: grid; gap: 14px; }
.form-row { display: grid; gap: 14px; }
.manifest-form .grid-2, .manifest-form .grid-3, .manifest-form .grid-4 { gap: 14px; }

.hold-button {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-height: 50px; width: 100%; padding: 0 24px;
  border-radius: var(--radius-pill);
  font-weight: 700; font-size: 0.95rem; letter-spacing: 0.01em;
  color: #1a1530;
  background: var(--iridescent);
  box-shadow: 0 12px 34px -14px rgba(138, 123, 255, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.45);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  --hold-progress: 0;
}
.hold-button span { position: relative; z-index: 2; display: inline-flex; align-items: center; gap: 9px; }
.hold-button .hold-glyph { font-size: 1.05rem; opacity: 0.85; }
.hold-button::after {
  content: ""; position: absolute; left: 50%; top: 50%; z-index: 1;
  width: 12px; height: 12px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.2) 60%, transparent 72%);
  transform: translate(-50%, -50%) scale(0);
  transition: transform 90ms linear;
}
.hold-button[data-holding="true"]::after { transform: translate(-50%, -50%) scale(calc(1 + var(--hold-progress) * 34)); }
.hold-button[data-holding="true"] { box-shadow: 0 16px 44px -12px rgba(245, 230, 184, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.6); }
.hold-button:hover { transform: translateY(-1px); }
.hold-button.is-quiet {
  background: rgba(255, 255, 255, 0.04); color: var(--pearl); border: 1px solid var(--line-2);
  box-shadow: none; min-height: 44px; padding: 0 18px; width: auto;
}
.hold-button.is-quiet:hover { border-color: var(--line-bright); color: var(--halo); background: rgba(245, 230, 184, 0.08); }
.hold-button.is-quiet::after { display: none; }
.hold-button.is-block { width: 100%; }

/* ---- 15. 3D / scene hosts ------------------------------------------ */
.wealth-card-scene, .vehicle-scene, .globe-scene {
  position: relative; overflow: hidden; min-height: 300px;
  border-radius: var(--radius);
}
.scene-host { position: absolute; inset: 0; z-index: 0; }
.globe-scene, .vehicle-scene, .wealth-card-scene { isolation: isolate; }
.globe-scene canvas.rdl-scene, .vehicle-scene canvas.rdl-scene {
  position: absolute !important; inset: 0; z-index: 0;
  width: 100% !important; height: 100% !important; display: block;
}
.globe-scene::after, .vehicle-scene::after {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(120% 100% at 50% 120%, rgba(7,6,18,0.5), transparent 60%);
}
.scene-caption { position: absolute; left: 18px; bottom: 14px; z-index: 2; display: grid; gap: 3px; pointer-events: none; }
.scene-caption .panel-kicker { color: var(--muted-2); }

/* Wealth card */
.wealth-card {
  width: min(440px, 84vw); aspect-ratio: 1.586; margin: 28px auto;
  padding: 26px 28px; border-radius: 22px;
  color: #f4f1ff; position: relative; overflow: hidden; isolation: isolate;
  display: flex; flex-direction: column; justify-content: space-between;
  transform: perspective(1200px) rotateY(-14deg) rotateX(7deg);
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transition: transform 600ms var(--ease);
  background:
    radial-gradient(120% 80% at 0% 0%, rgba(245, 230, 184, 0.4), transparent 50%),
    radial-gradient(120% 120% at 100% 100%, rgba(138, 123, 255, 0.7), transparent 55%),
    linear-gradient(145deg, #1c1838, #100e22 70%, #08071a);
  border: 1px solid rgba(245, 230, 184, 0.25);
}
.wealth-card::before {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, 0.18) 45%, transparent 60%);
  transform: translateX(-120%); transition: transform 1.4s var(--ease);
}
.wealth-card:hover { transform: perspective(1200px) rotateY(-8deg) rotateX(4deg) translateY(-4px); }
.wealth-card:hover::before { transform: translateX(120%); }
.wealth-card > * { position: relative; z-index: 1; }
.wealth-card__top { display: flex; justify-content: space-between; align-items: flex-start; }
.wealth-card__bank { font-size: 0.6rem; letter-spacing: 0.22em; text-transform: uppercase; color: rgba(245, 230, 184, 0.8); font-weight: 600; }
.wealth-card__chip { width: 38px; height: 28px; border-radius: 6px; background: linear-gradient(135deg, #f5e6b8, #c9a94a); box-shadow: inset 0 1px 0 rgba(255,255,255,0.4); }
.wealth-card__mono { font-family: var(--font-display); font-weight: 500; font-size: clamp(1.6rem, 4vw, 2.4rem); letter-spacing: 0.04em; line-height: 1; }
.wealth-card__number { font-family: var(--font-mono); font-size: 0.86rem; letter-spacing: 0.12em; color: rgba(244, 241, 255, 0.85); }
.wealth-card__foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; font-size: 0.66rem; letter-spacing: 0.12em; text-transform: uppercase; color: rgba(244, 241, 255, 0.7); }
.wealth-card__metal { font-weight: 600; color: rgba(245, 230, 184, 0.9); }

/* ---- 16. Oracle notes ---------------------------------------------- */
.oracle-note { padding: 18px 22px; border-radius: var(--radius); }
.oracle-note p { font-family: var(--font-display); font-style: italic; font-weight: 400; font-size: 1.06rem; line-height: 1.55; color: var(--pearl); }
.oracle-note .panel-kicker { margin-bottom: 10px; display: block; }

/* ---- 17. Manifest cards (ledger) ----------------------------------- */
.manifest-card { display: grid; gap: 12px; align-content: start; }
.manifest-card p { font-family: var(--font-display); font-style: italic; font-weight: 400; font-size: 1.04rem; line-height: 1.5; color: var(--pearl); }
.manifest-card .value { color: var(--halo); font-family: var(--font-display); font-weight: 500; font-style: normal; }

/* ---- 18. Empty states ---------------------------------------------- */
.empty-state {
  padding: 40px 28px; border: 1px dashed var(--line-2); border-radius: var(--radius);
  color: var(--muted); text-align: center; display: grid; gap: 10px; place-items: center; min-height: 120px;
  font-family: var(--font-display); font-style: italic; font-size: 1.05rem;
}
.empty-state small { font-family: var(--font-ui); font-style: normal; font-size: 0.8rem; color: var(--muted-2); letter-spacing: 0.04em; }

/* ---- 19. Life Feed ------------------------------------------------- */
.life-feed {
  position: fixed; top: 16px; right: 16px; z-index: 30;
  width: min(420px, calc(100vw - 32px)); height: calc(100vh - 32px);
  padding: 22px; display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 14px;
  border-radius: var(--radius-lg);
  transform: translateX(calc(100% + 32px)); transition: transform var(--dur) var(--ease);
}
.life-feed.is-open { transform: translateX(0); }
.life-feed header { display: flex; gap: 12px; align-items: center; }
.life-feed header h2 { flex: 1; font-family: var(--font-display); font-weight: 500; font-size: 1.3rem; }
.life-feed header .panel-kicker { display: block; }
.feed-list { overflow-y: auto; display: grid; gap: 12px; align-content: start; padding-right: 4px; }
.feed-item { padding: 16px 18px; box-shadow: none; border-radius: var(--radius-sm); display: grid; gap: 6px; animation: feed-in 520ms var(--ease) both; }
.feed-item h3 { font-family: var(--font-display); font-weight: 500; font-size: 1.02rem; line-height: 1.2; }
.feed-item .feed-realm { font-size: 0.6rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--halo); font-weight: 600; }

/* ---- 20. Manifest overlay (the bloom) ------------------------------ */
.manifest-overlay {
  position: fixed; inset: 0; z-index: 60; pointer-events: none;
  display: grid; place-items: center; opacity: 0;
  transition: opacity 220ms var(--ease);
  background: radial-gradient(circle at center, rgba(7, 6, 18, 0.5), rgba(7, 6, 18, 0.1) 50%);
}
.manifest-overlay.is-visible { opacity: 1; }
.manifest-bloom {
  position: absolute; width: 28vmin; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle, var(--halo), rgba(255, 181, 158, 0.5) 38%, transparent 70%);
  transform: scale(0.2); opacity: 0; mix-blend-mode: screen;
}
.manifest-overlay.is-visible .manifest-bloom { animation: bloom 1100ms var(--ease-out); }
.manifest-ripple {
  position: absolute; width: 28vmin; aspect-ratio: 1; border-radius: 50%;
  border: 1px solid rgba(245, 230, 184, 0.5); opacity: 0;
}
.manifest-overlay.is-visible .manifest-ripple { animation: ripple 1400ms var(--ease-out); }
.manifest-overlay p {
  position: relative; margin: 0;
  font-family: var(--font-display); font-style: italic; font-weight: 400;
  font-size: clamp(2.6rem, 7vw, 5.4rem); line-height: 1; letter-spacing: -0.01em;
  color: var(--halo); text-shadow: 0 0 50px rgba(245, 230, 184, 0.55);
  opacity: 0;
}
.manifest-overlay.is-visible p { animation: decree 1500ms var(--ease) 120ms both; }

/* ---- 21. Toasts ---------------------------------------------------- */
.toast-stack {
  position: fixed; left: 50%; bottom: 26px; z-index: 70;
  width: min(540px, calc(100vw - 32px)); transform: translateX(-50%);
  display: grid; gap: 10px;
}
.toast {
  padding: 15px 20px; border-radius: var(--radius-pill);
  border: 1px solid var(--line-bright); background: var(--surface-3);
  box-shadow: var(--shadow); backdrop-filter: blur(20px);
  font-size: 0.9rem; text-align: center;
  animation: toast-in 420ms var(--ease) both;
}
.toast.is-leaving { animation: toast-out 320ms var(--ease) both; }

/* ---- 22. Atelier gate / membership --------------------------------- */
.atelier-gate {
  position: fixed; inset: 0; z-index: 80;
  display: grid; place-items: center;
  opacity: 0; pointer-events: none;
  transition: opacity var(--dur) var(--ease);
}
.atelier-gate.is-visible { opacity: 1; pointer-events: auto; }
.atelier-gate__veil {
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 50% 40%, rgba(138, 123, 255, 0.20), transparent 44%),
    rgba(7, 6, 18, 0.72);
  backdrop-filter: blur(18px);
}
.atelier-gate__panel {
  position: relative; z-index: 1;
  width: min(520px, calc(100vw - 32px));
  padding: clamp(26px, 5vw, 42px);
  border: 1px solid var(--line-bright);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(120% 90% at 18% 0%, rgba(245, 230, 184, 0.16), transparent 42%),
    radial-gradient(120% 100% at 88% 100%, rgba(138, 123, 255, 0.22), transparent 52%),
    var(--surface-3);
  box-shadow: var(--shadow), var(--shadow-glow);
  display: grid; gap: 18px;
}
.atelier-gate__panel h2 {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(2rem, 5vw, 3.2rem); line-height: 1.02;
}
.atelier-gate__panel p { margin: 0; color: var(--muted); line-height: 1.65; }
.atelier-gate__plan {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; display: grid; gap: 5px;
  background: rgba(255, 255, 255, 0.04);
}
.atelier-gate__plan span { color: var(--halo); font-weight: 700; }
.atelier-gate__plan strong { font-family: var(--font-display); font-size: 1.5rem; font-weight: 500; }
.atelier-gate__actions { display: flex; gap: 12px; justify-content: flex-end; flex-wrap: wrap; }

.plan-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.plan-card {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; display: grid; gap: 12px; align-content: start;
  background: rgba(255, 255, 255, 0.035);
}
.plan-card.is-current { border-color: var(--line-bright); background: rgba(245, 230, 184, 0.07); }
.plan-card h3 { font-family: var(--font-display); font-weight: 500; font-size: 1.18rem; }
.plan-card > strong { font-family: var(--font-display); font-size: 1.55rem; font-weight: 500; color: var(--pearl); }
.plan-card p, .plan-card li { color: var(--muted); line-height: 1.55; font-size: 0.86rem; }
.plan-card ul { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.plan-request { width: 100%; margin-top: auto; }
.usage-meter {
  display: grid; gap: 10px; padding: 16px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035); margin-bottom: 14px;
}
.usage-meter > div { display: flex; justify-content: space-between; gap: 16px; align-items: baseline; }
.usage-meter strong { font-family: var(--font-display); font-size: 1.3rem; font-weight: 500; }
.usage-meter__bar {
  height: 8px; overflow: hidden; border-radius: var(--radius-pill);
  background: rgba(255,255,255,0.08);
}
.usage-meter__bar span {
  display: block; height: 100%; border-radius: inherit;
  background: var(--iridescent);
}
.account-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.account-form { display: grid; gap: 14px; }
.danger-zone { border-top: 1px solid var(--hairline); padding-top: 2px; }
.danger-zone p { color: var(--muted); margin: 0; }
.danger-zone .ghost-button:hover { color: var(--danger); border-color: rgba(255, 155, 139, 0.5); }

/* ---- 23. Documents & share cards ----------------------------------- */
.share-card-page, .document-wrap {
  min-height: 100vh; display: grid; place-items: center; gap: 22px; padding: 40px 24px;
}

.share-card {
  width: min(900px, 100%); min-height: min(600px, 70vh);
  padding: clamp(36px, 7vw, 80px); border-radius: var(--radius-lg);
  display: flex; flex-direction: column; justify-content: space-between; gap: 30px;
  background:
    radial-gradient(120% 90% at 18% 12%, rgba(245, 230, 184, 0.2), transparent 45%),
    radial-gradient(120% 120% at 88% 92%, rgba(138, 123, 255, 0.28), transparent 50%),
    var(--surface-3);
}
.share-card .share-mark { display: inline-flex; align-items: center; gap: 10px; }
.share-card .share-mark .brand-mark { width: 34px; height: 34px; border-radius: 10px; font-size: 0.78rem; }
.share-card .share-mark span { font-size: 0.7rem; letter-spacing: 0.22em; text-transform: uppercase; color: var(--halo); font-weight: 600; }
.share-card h1 {
  font-family: var(--font-display); font-style: italic; font-weight: 400;
  font-size: clamp(2.4rem, 6vw, 4.6rem); line-height: 1.05; letter-spacing: -0.015em; text-wrap: balance;
}
.share-card footer { display: flex; justify-content: space-between; gap: 16px; align-items: center; border-top: 1px solid var(--hairline); padding-top: 26px; }
.share-card footer .name { font-family: var(--font-display); font-weight: 500; font-size: 1.1rem; }
.share-card footer .seal-line { font-size: 0.66rem; letter-spacing: 0.22em; text-transform: uppercase; color: var(--halo); }

.document {
  width: min(780px, 100%); padding: clamp(36px, 5vw, 64px); border-radius: var(--radius-lg);
}
.document .doc-eyebrow { display: flex; align-items: center; gap: 12px; }
.document .doc-eyebrow::after { content: ""; flex: 1; height: 1px; background: var(--hairline); }
.document h1 { margin: 16px 0 6px; font-family: var(--font-display); font-weight: 400; font-size: clamp(2.1rem, 5vw, 3.6rem); line-height: 1.05; letter-spacing: -0.015em; }
.document .subtitle { color: var(--muted); margin: 0; }
.document dl { display: grid; gap: 0; margin: 34px 0; border-top: 1px solid var(--hairline); }
.document dl div { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 18px; padding: 16px 0; border-bottom: 1px solid var(--hairline); }
.document dt { color: var(--muted); font-size: 0.78rem; letter-spacing: 0.14em; text-transform: uppercase; font-weight: 600; align-self: center; }
.document dd { margin: 0; overflow-wrap: anywhere; font-family: var(--font-display); font-weight: 500; font-size: 1.08rem; }
.document dd.mono { font-family: var(--font-mono); font-size: 0.92rem; font-weight: 500; letter-spacing: 0.04em; }
.document footer { display: flex; justify-content: space-between; gap: 18px; align-items: center; margin-top: 30px; }
.document footer .name { color: var(--muted); font-size: 0.84rem; letter-spacing: 0.04em; }

.wax-seal {
  display: grid; place-items: center; text-align: center;
  width: 108px; height: 108px; border-radius: 50%;
  color: #2a1e10; font-size: 0.64rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; line-height: 1.3;
  background: radial-gradient(circle at 35% 30%, #fff3cf, #d8a94a 55%, #9a6c1c);
  box-shadow: 0 14px 30px -10px rgba(0, 0, 0, 0.5), inset 0 2px 4px rgba(255, 255, 255, 0.4), inset 0 -8px 18px rgba(120, 80, 20, 0.4);
  border: 2px solid rgba(154, 108, 28, 0.6);
}
.document-actions { display: flex; gap: 12px; }

/* ---- 24. Threshold (landing) --------------------------------------- */
.threshold {
  min-height: 100vh; display: grid; place-items: center; padding: 48px 24px;
}
.threshold__content {
  width: min(1120px, 100%); display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 60px; align-items: center;
}
.threshold__lead { display: grid; gap: 22px; max-width: 560px; }
.threshold__lead .eyebrow { display: inline-flex; align-items: center; gap: 12px; }
.threshold__lead .eyebrow::before { content: ""; width: 26px; height: 1px; background: var(--halo); }
.threshold h1 {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(2.8rem, 6.2vw, 5rem); line-height: 1.02; letter-spacing: -0.02em; text-wrap: balance;
}
.threshold h1 em { font-style: italic; background: var(--iridescent); -webkit-background-clip: text; background-clip: text; color: transparent; }
.threshold__copy { margin: 0; color: var(--muted); font-size: 1.12rem; line-height: 1.65; max-width: 480px; }
.threshold__pillars { display: grid; gap: 14px; margin-top: 8px; }
.threshold__pillar { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 12px; align-items: baseline; color: var(--muted); font-size: 0.92rem; }
.threshold__pillar svg { width: 18px; height: 18px; stroke: var(--halo); fill: none; stroke-width: 1.5; margin-top: 2px; }
.threshold__pillar strong { color: var(--pearl); font-weight: 600; }

.threshold-forms { display: grid; gap: 16px; }
.threshold-panel {
  display: grid; gap: 18px; padding: 28px; border-radius: var(--radius-lg);
}
.threshold-panel h2 { font-family: var(--font-display); font-weight: 500; font-size: 1.34rem; letter-spacing: -0.01em; }
.threshold-panel--quiet { background: rgba(255, 255, 255, 0.03); border-color: var(--line); box-shadow: none; }
body.theme-pearl .threshold-panel--quiet { background: rgba(255, 255, 255, 0.5); }
.threshold-panel form { display: grid; gap: 14px; }
.threshold-panel .primary-action { width: 100%; margin-top: 4px; }
.threshold-links { display: flex; justify-content: center; gap: 18px; color: var(--muted-2); font-size: 0.82rem; }
.threshold-links a:hover { color: var(--halo); }

.flash-stack { display: grid; gap: 8px; }
.flash {
  margin: 0; padding: 12px 16px; border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 155, 139, 0.4); background: rgba(255, 155, 139, 0.1);
  color: var(--danger); font-size: 0.88rem;
}

/* ---- 25. Count-up helper ------------------------------------------- */
[data-countup] { font-variant-numeric: tabular-nums; }

/* ---- 26. Animations ------------------------------------------------ */
@keyframes orb-a { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(6vw, 4vh) scale(1.1); } }
@keyframes orb-b { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(-5vw, 5vh) scale(1.08); } }
@keyframes orb-c { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(3vw, -4vh) scale(1.12); } }
@keyframes grain { 0% { transform: translate(0,0); } 10% { transform: translate(-4%, -3%); } 20% { transform: translate(-8%, 2%); } 30% { transform: translate(3%, -6%); } 40% { transform: translate(-2%, 4%); } 50% { transform: translate(-6%, 1%); } 60% { transform: translate(5%, -2%); } 70% { transform: translate(-3%, 6%); } 80% { transform: translate(2%, -4%); } 90% { transform: translate(-5%, 3%); } 100% { transform: translate(0,0); } }
@keyframes bloom { 0% { transform: scale(0.2); opacity: 0; } 24% { opacity: 1; } 100% { transform: scale(6.2); opacity: 0; } }
@keyframes ripple { 0% { transform: scale(0.2); opacity: 0.8; } 100% { transform: scale(7); opacity: 0; } }
@keyframes decree { 0% { opacity: 0; transform: translateY(12px) scale(0.98); letter-spacing: 0.04em; } 30% { opacity: 1; } 100% { opacity: 0; transform: translateY(-6px) scale(1); letter-spacing: -0.01em; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }
@keyframes feed-in { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: translateX(0); } }
@keyframes pulse-dot { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.5; transform: scale(1.4); } }
@keyframes realm-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }

.realm-view > * { animation: realm-in 520ms var(--ease) both; }
.realm-view > *:nth-child(2) { animation-delay: 60ms; }
.realm-view > *:nth-child(3) { animation-delay: 120ms; }
.realm-view > *:nth-child(4) { animation-delay: 180ms; }
.realm-view > *:nth-child(5) { animation-delay: 240ms; }
.realm-view > *:nth-child(6) { animation-delay: 300ms; }

/* ---- 27. Responsive ----------------------------------------------- */
@media (max-width: 1180px) {
  :root { --rail: 224px; }
  .realm-stage { padding: 26px 24px 80px; }
  .topbar { padding: 14px 24px; }
  .topbar-metrics { gap: 22px; }
}

@media (max-width: 1024px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; z-index: 40; top: 0; left: 0; bottom: 0;
    width: min(320px, 84vw); height: 100vh;
    transform: translateX(-100%); transition: transform var(--dur) var(--ease);
    border-right: 1px solid var(--line);
    background: var(--surface-3);
  }
  .sidebar.is-open { transform: translateX(0); }
  .mobile-menu {
    display: inline-flex; align-items: center; gap: 8px;
    min-height: 42px; padding: 0 14px;
    border: 1px solid var(--line-2); border-radius: var(--radius-pill);
    color: var(--pearl); background: rgba(255, 255, 255, 0.03); font-weight: 600; font-size: 0.84rem;
  }
  .mobile-menu svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.6; }
  .topbar-metrics { gap: 18px; }
  .topbar-metric:not(.is-primary) { display: none; }
  .threshold__content { grid-template-columns: 1fr; gap: 36px; }
  .threshold__lead { max-width: 100%; }
  .plan-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .grid-2.tight, .grid-3.tight, .grid-4.tight { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .realm-stage { padding: 20px 16px 70px; }
  .topbar { padding: 12px 16px; min-height: 64px; }
  .realm-hero { min-height: 260px; padding: 30px 22px; }
  .glass-panel, .metric-card, .catalog-card, .manifest-card, .oracle-note { padding: 18px; }
  .data-row { grid-template-columns: 1fr; gap: 4px; padding: 14px 18px; }
  .data-row strong { text-align: left; }
  .document dl div { grid-template-columns: 1fr; gap: 4px; }
  .manifest-overlay p { font-size: clamp(2.2rem, 12vw, 3.6rem); }
  .feed-item h3 { font-size: 0.98rem; }
  .atelier-gate__actions { justify-content: stretch; }
  .atelier-gate__actions > * { flex: 1; }
  .plan-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .topbar-metrics { gap: 14px; }
  .topbar-metric.is-primary strong { font-size: 1.18rem; }
  .round-button { padding: 0 10px; }
  .threshold { padding: 32px 18px; }
  .threshold-panel { padding: 22px; }
  .grid-2.tight, .grid-3.tight, .grid-4.tight { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 1ms !important; scroll-behavior: auto !important; }
  .cosmos__orb, .cosmos__grain, .realm-view > *, .feed-item, .feed-button .feed-dot { animation: none !important; }
}

/* ---- 28. Print ---------------------------------------------------- */
@media print {
  body { background: #fff; color: #111; }
  .cosmos, .document-actions { display: none; }
  .document, .share-card { box-shadow: none; border-color: #111; background: #fff; color: #111; }
  .share-card h1, .document h1 { color: #111; }
  .wax-seal { box-shadow: none; }
}
