/* ═══════════════════════════════════════════════════════════════════
   memory.css — Memory plane (PalaceMemoryViews.swift), palace explorers
   (PalaceExplorerViews.swift, MemPalaceExplorer.swift) and memory sheets.
   Prefixes: mem- (plane, rows, sheets) · pal- (explorer) · mp- (MemPalace)
   ═══════════════════════════════════════════════════════════════════ */

/* ── Plane ─────────────────────────────────────────────────────── */
.mem-plane { position: absolute; inset: 0; }
.mem-immersive { position: absolute; inset: 0; }
.mem-scroll { position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; }
.mem-stack {
  display: flex; flex-direction: column; align-items: stretch; gap: 12px;
  padding: 56px 24px 132px; max-width: 760px; margin: 0 auto; min-height: 100%;
}

/* Immersive greeting header — ZStack overlay; the spacer passes taps through. */
.mem-greeting-row {
  position: absolute; left: 0; right: 0; top: 0; z-index: 6;
  display: flex; align-items: flex-start; gap: 8px;
  padding: 56px 16px 0; pointer-events: none;
}
.mem-greeting-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 0 1 auto; }
.mem-greeting { font: 700 22px/28px var(--font-rounded); letter-spacing: 0.35px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mem-greeting-sub { font-size: 15px; line-height: 20px; letter-spacing: -0.24px; color: var(--ink-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mem-greeting-spacer { flex: 1 1 8px; min-width: 8px; }
.mem-greeting-buttons { display: flex; gap: 8px; flex: none; pointer-events: auto; }
.mem-greeting-buttons.disabled { pointer-events: none; }

.mem-icon-btn { width: 44px; height: 44px; flex: none; display: grid; place-items: center; color: var(--ink-soft); }
.mem-icon-btn.accent { color: var(--accent); }

/* List header */
.mem-header { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.mem-header-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mem-title { font: 600 22px/28px var(--font-display); letter-spacing: 0.35px; color: var(--ink); }
.mem-caption { font-size: 12px; line-height: 16px; color: var(--ink-soft); }

/* Search bar — holoInset(16), 44 tall */
.mem-search { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 4px 0 14px; flex: none; }
.mem-search > * { position: relative; z-index: 1; }
.mem-search-input {
  flex: 1 1 auto; min-width: 0; height: 44px;
  font-size: 17px; line-height: 22px; letter-spacing: -0.41px;
  color: #fff; caret-color: var(--accent);
}
.pm-app[data-appearance="light"] .mem-search-input { color: #000; }
.pm-app .mem-search-input::placeholder, .pm-app .mem-input::placeholder, .pm-app .mem-textarea::placeholder { color: var(--label3); }
.mem-search-clear { min-width: 44px; min-height: 44px; display: grid; place-items: center; flex: none; }

/* ── Rows & states (MemoryRow · MemoryEmptyState · MemoryErrorNotice) ── */
.mem-row {
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
  width: 100%; padding: 18px; text-align: left; flex: none;
}
.mem-row-title { font-size: 17px; line-height: 22px; font-weight: 600; letter-spacing: -0.41px; color: var(--ink); }
.mem-row-preview { font-size: 15px; line-height: 20px; letter-spacing: -0.24px; color: var(--ink-soft); white-space: pre-line; }
.mem-row-date { font-size: 12px; line-height: 16px; color: var(--ink-soft); }
.clamp-2, .clamp-3 { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.clamp-2 { -webkit-line-clamp: 2; }
.clamp-3 { -webkit-line-clamp: 3; }

.mem-label { display: inline-flex; align-items: flex-start; gap: 5px; line-height: 1.34; text-align: left; overflow-wrap: anywhere; }
.mem-label > .sf { margin-top: 0.1em; }
.mem-label.soft, .soft { color: var(--ink-soft); }
.mem-label.subheadline { font-size: 15px; line-height: 20px; gap: 6px; }
.mem-label.caption { font-size: 12px; line-height: 16px; }
.mem-label.title3 { font: 500 20px/25px var(--font-display); letter-spacing: 0.38px; color: var(--ink); gap: 8px; align-items: center; }
.mem-label.title3 > .sf { margin-top: 0; }
.mem-label.accent-label { color: var(--accent); font-size: 17px; line-height: 22px; gap: 7px; align-items: center; letter-spacing: -0.41px; }
.mem-label.accent-label > .sf { margin-top: 0; }

.mem-empty { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; width: 100%; padding: 24px 0; }
.mem-empty-title { font: 500 20px/25px var(--font-display); letter-spacing: 0.38px; color: var(--ink); }
.mem-empty-message { font-size: 17px; line-height: 22px; letter-spacing: -0.41px; color: var(--ink-soft); }

.mem-error { display: flex; align-items: flex-start; gap: 6px; font-size: 15px; line-height: 20px; letter-spacing: -0.24px; color: var(--danger); }
.mem-error > .sf { margin-top: 1px; }

.mem-searching { padding: 12px 0; }
.mem-progress { display: inline-flex; flex-direction: column; align-items: center; gap: 8px; align-self: flex-start; font-size: 17px; line-height: 22px; letter-spacing: -0.41px; color: var(--label2); }

/* ── Buttons (.borderedProminent / .bordered, iOS 26 capsules) ── */
.mem-btn-slot { display: flex; align-items: center; justify-content: flex-start; min-height: 44px; width: 100%; flex: none; }
.mem-btn-slot.primary { justify-content: center; }
.mem-btn-primary, .mem-btn-secondary {
  border-radius: 999px; padding: 6.5px 16px; font-size: 17px; line-height: 22px; letter-spacing: -0.41px;
  transition: opacity 0.15s ease, background 0.2s ease, filter 0.15s ease; white-space: nowrap;
}
.mem-btn-primary { font-weight: 600; padding-inline: 20px; background: var(--accent); color: var(--on-accent); }
.mem-btn-primary:active:not(:disabled) { filter: brightness(1.12); opacity: 0.85; }
.mem-btn-primary:disabled { background: rgb(120 120 128 / 0.24); color: var(--ink-soft); }
.pm-app[data-appearance="light"] .mem-btn-primary:disabled { background: rgb(120 120 128 / 0.14); }
.mem-btn-secondary { background: rgb(var(--accent-rgb) / 0.16); color: var(--accent); }
.mem-btn-secondary.destructive { background: rgb(var(--red-rgb) / 0.15); color: rgb(var(--red-rgb)); }
.mem-btn-secondary.system { font-size: 17px; }
.mem-btn-secondary:active:not(:disabled) { opacity: 0.6; }
.mem-btn-secondary:disabled { background: rgb(120 120 128 / 0.16); color: var(--label3); }

/* ── Sheets (memorySheetStyle) ── */
/* .memorySheetStyle() applies .tint(Holo.accent) to the NavigationStack, so .confirmationAction is accent glass. */
.mem-sheet { position: relative; display: flex; flex-direction: column; height: 100%; min-height: 0; color: var(--ink); --toolbar-tint: rgb(var(--accent-rgb) / 0.95); }
.mem-sheet-inline { opacity: 0; transition: opacity 0.2s ease; }
.mem-sheet-inline.shown { opacity: 1; }
.mem-sheet-scroll { position: relative; }
.mem-sheet-title { font: 700 34px/41px var(--font-display); letter-spacing: 0.37px; color: var(--ink); padding: 3px 16px 8px; }
.mem-sheet-stack { display: flex; flex-direction: column; align-items: stretch; gap: 20px; padding: 24px; }
.mem-sheet-stack > .mem-label, .mem-sheet-stack > .mem-progress { align-self: flex-start; }
.mem-sheet-bar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 3;
  display: flex; flex-direction: column; align-items: stretch; gap: 10px;
  padding: 20px 20px calc(20px + var(--safe-bottom, 34px));
}
.mem-sheet-bar::before {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: 0.72;
  background-color: var(--mat-ultrathin-bg);
  -webkit-backdrop-filter: blur(var(--mat-blur)) saturate(var(--mat-sat));
  backdrop-filter: blur(var(--mat-blur)) saturate(var(--mat-sat));
}
.mem-sheet-bar > .mem-label, .mem-sheet-bar > .mem-progress { align-self: center; }

.mem-field { display: flex; flex-direction: column; gap: 8px; }
.mem-field-label { font-size: 15px; line-height: 20px; font-weight: 500; letter-spacing: -0.24px; color: var(--ink); }
.mem-field-well { display: block; padding: 14px; }
.mem-field-well.editor { padding: 10px; }
.mem-field-well.disabled { opacity: 0.5; }
.mem-field-well > * { position: relative; z-index: 1; }
.mem-input { display: block; width: 100%; font-size: 17px; line-height: 22px; letter-spacing: -0.41px; color: var(--ink); caret-color: var(--accent); }
.mem-textarea {
  display: block; width: 100%; min-height: 260px; resize: none; padding: 8px 5px;
  font-size: 17px; line-height: 22px; letter-spacing: -0.41px; color: var(--ink); caret-color: var(--accent);
}
.mem-detail-title { font: 600 22px/28px var(--font-display); letter-spacing: 0.35px; color: var(--ink); }
.mem-detail-date { font-size: 12px; line-height: 16px; color: var(--ink-soft); }
.mem-verbatim { font-size: 17px; line-height: 22px; letter-spacing: -0.41px; color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; }
.mem-divider { height: 0.5px; background: var(--separator); flex: none; }
.mem-body-soft { font-size: 15px; line-height: 20px; letter-spacing: -0.24px; color: var(--ink-soft); }
.mem-footnote { font-size: 13px; line-height: 18px; letter-spacing: -0.08px; color: var(--ink-soft); }
.mem-picker { min-height: 44px; display: flex; align-items: center; }
.mem-picker.disabled { opacity: 0.4; pointer-events: none; }
.mem-sheet .t-body.soft { color: var(--ink-soft); }

/* ── Explorer primitives ───────────────────────────────────────── */
.pal-canvas-fill { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }

.pal-loader { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; width: 100%; height: 100%; }
.mp-immersive > .pal-loader { position: absolute; inset: 0; }
.pal-loader-ring { overflow: visible; display: block; flex: none; }
.pal-loader-arc { transform-box: fill-box; transform-origin: center; }
.pal-loader-text { font-size: 15px; line-height: 20px; letter-spacing: -0.24px; color: var(--ink-soft); text-align: center; }

.pal-back { display: inline-flex; align-items: center; gap: 5px; min-height: 44px; align-self: flex-start; font-size: 15px; line-height: 20px; font-weight: 500; letter-spacing: -0.24px; color: var(--accent); }

/* PalaceBrowseChrome */
.pal-chrome { display: flex; flex-direction: column; gap: 8px; color: var(--ink); }
.pal-chrome-row { display: flex; align-items: center; gap: 4px; min-width: 0; }
.pal-chrome-icon { width: 44px; height: 44px; flex: none; display: grid; place-items: center; color: var(--ink); }
.pal-trail { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 5px; overflow: hidden; }
.pal-crumb { flex: 0 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 15px; line-height: 20px; font-weight: 500; letter-spacing: -0.24px; }
.pal-crumb.link { color: var(--accent); text-align: left; }
.pal-crumb.ancestor { color: var(--ink-soft); }
.pal-crumb.current { font: 600 20px/25px var(--font-display); letter-spacing: 0.38px; color: var(--ink); }
.pal-trail-sep { flex: none; display: grid; place-items: center; color: var(--ink-faint); }
.pal-chrome-subtitle { font-size: 15px; line-height: 20px; letter-spacing: -0.24px; color: var(--ink-soft); }

/* PalaceSpaceList */
.pal-space-list { display: flex; flex-direction: column; min-width: 0; }
.pal-space-list.embeds { position: absolute; inset: 0; }
.pal-space-head { flex: none; display: flex; flex-direction: column; }
.pal-space-back-row { display: flex; padding-left: 20px; padding-right: 20px; }
.pal-space-back { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font-size: 17px; line-height: 22px; font-weight: 500; letter-spacing: -0.41px; white-space: nowrap; }
.pal-space-title { padding-left: 20px; padding-right: 20px; font: 600 22px/28px var(--font-display); letter-spacing: 0.35px; color: var(--ink); }
.pal-space-count { padding: 0 20px 14px; font-size: 15px; line-height: 20px; letter-spacing: -0.24px; color: var(--ink-soft); }
.pal-space-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; }
.pal-space-rows { display: flex; flex-direction: column; gap: 8px; padding: 0 20px; }
.pal-space-section { padding: 10px 0 2px; font-size: 15px; line-height: 20px; font-weight: 600; letter-spacing: -0.24px; color: var(--ink-soft); }
.pal-space-row {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; text-align: left; flex: none;
  border-radius: 16px; background: rgb(var(--wash-rgb) / calc(0.055 * var(--wash-k)));
  box-shadow: inset 0 0 0 0.6px rgb(var(--wash-rgb) / calc(0.08 * var(--wash-k)));
}
.pal-space-row > .sf { margin-left: 8px; }
.pal-space-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.pal-space-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pal-space-name { font-size: 17px; line-height: 22px; font-weight: 600; letter-spacing: -0.41px; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pal-space-detail { font-size: 12px; line-height: 16px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Crossfade layers (SwiftUI default opacity transition, Holo.glide) */
.pal-fade { transition: opacity var(--dur-glide) var(--ease-glide); }
.pal-fade.entering, .pal-fade.leaving { opacity: 0; }
.pal-fade.leaving { position: absolute; left: 0; right: 0; top: 0; pointer-events: none; }

/* ── PalaceOrb ── */
.pal-orb { position: relative; display: block; flex: none; width: var(--d); height: var(--d); }
.pal-orb-halo { position: absolute; inset: -16px; border-radius: 50%; background: var(--t07); }
.pal-orb-body {
  position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle var(--d) at 0 0, var(--t12), transparent), var(--veil);
  box-shadow: 0 0 36px var(--t18), inset 0 0 0 0.5px var(--t40), 0 0 0 0.5px var(--t40);
}
.pal-orb-ring { position: absolute; left: -6px; top: -6px; width: calc(100% + 12px); height: calc(100% + 12px); display: block; pointer-events: none; }
.pal-orb-content { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; color: var(--t); pointer-events: none; }
.pal-orb-value { font-family: var(--font-rounded); font-weight: 300; line-height: 1.19; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pal-orb-unit { font-size: 15px; line-height: 20px; letter-spacing: -0.24px; color: var(--ink-soft); }

/* ── PalaceOrbitView ── */
.pal-orbit { position: relative; display: flex; flex-direction: column; width: 100%; }
.pal-orbit-header { height: 0; opacity: 0; overflow: visible; pointer-events: none; transition: height var(--dur-glide) var(--ease-glide), opacity var(--dur-glide) var(--ease-glide); }
.pal-orbit-header.shown { height: 56px; opacity: 1; pointer-events: auto; }
.pal-orbit-header-row { display: flex; align-items: center; gap: 8px; height: 44px; }
.pal-orbit-header-title { flex: 1 1 auto; min-width: 0; font-size: 17px; line-height: 22px; font-weight: 600; letter-spacing: -0.41px; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pal-orbit-collapse { width: 44px; height: 44px; flex: none; display: grid; place-items: center; color: var(--ink-soft); }
.pal-orbit-body { position: relative; }
.pal-orbit-frame { position: relative; width: 100%; transition: height var(--dur-glide) var(--ease-glide); }
.pal-orbit-lines { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; opacity: 0; transition: opacity var(--dur-glide) var(--ease-glide); }
.pal-orbit-lines.shown { opacity: 1; }
.pal-orbit-sat {
  position: absolute; width: 104px; transform: translate(-50%, -50%) scale(0.5); opacity: 0; pointer-events: none;
  transition: transform var(--dur-glide) var(--ease-glide), opacity var(--dur-glide) var(--ease-glide);
}
.pal-orbit-sat.shown { transform: translate(-50%, -50%); opacity: 1; pointer-events: auto; }
.pal-sat { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; }
.pal-sat-name { font-size: 12px; line-height: 16px; font-weight: 500; color: var(--ink); text-align: center; min-height: 30px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pal-orbit-center {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: var(--od); height: var(--od); border-radius: 50%;
  transition: width var(--dur-glide) var(--ease-glide), height var(--dur-glide) var(--ease-glide);
}
.pal-orbit-center .pal-orb { width: 100%; height: 100%; }
.pal-orbit-center .pal-orb-halo { transition: filter var(--dur-glide) var(--ease-glide); }
.pal-orbit-center:disabled { cursor: default; }
.pal-orbit-center-content { position: absolute; inset: 0; pointer-events: none; }
.pal-center-swap { position: absolute; inset: 0; display: grid; place-items: center; }
.pal-orbit-title {
  position: absolute; left: 50%; transform: translate(-50%, -50%); text-align: center; pointer-events: none;
  font-size: 17px; line-height: 22px; font-weight: 600; letter-spacing: -0.41px; color: var(--ink);
  opacity: 0; transition: opacity var(--dur-glide) var(--ease-glide);
}
.pal-orbit-title.shown { opacity: 1; }
.pal-orbit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); column-gap: 8px; row-gap: 24px; padding: 16px 0; }
.pal-grid-cell { display: flex; justify-content: center; min-width: 0; }
.pal-orbit.no-motion *, .pal-orbit.no-motion { transition: none !important; }

/* Saved / Desktop explorers */
.pal-saved, .pal-desktop { display: flex; flex-direction: column; align-items: stretch; gap: 18px; }
.pal-group-title { font: 600 22px/28px var(--font-display); letter-spacing: 0.35px; color: var(--ink); }
.pal-group-count { font-size: 15px; line-height: 20px; letter-spacing: -0.24px; color: var(--ink-soft); }
.pal-desktop-path { font-size: 12px; line-height: 16px; color: var(--ink-soft); }
.pal-progress-slot { display: flex; align-items: center; justify-content: center; min-height: 240px; width: 100%; }
.pal-progress-slot > .mem-progress { align-self: center; }

/* ── Standalone luminous node / grid (PalaceRoomGrid) ── */
.pal-node { position: relative; display: block; flex: none; }
.pal-node-canvas { position: absolute; pointer-events: none; }
.pal-node-text { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.pal-node-name { font-family: var(--font-rounded); font-weight: 600; line-height: 1.2; padding: 0 12px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pal-node-count { font-family: var(--font-rounded); font-weight: 700; line-height: 1.2; padding: 0 6px; white-space: nowrap; }
.pal-node-pill { font-family: var(--font-rounded); font-weight: 600; padding: 5px 16px; border-radius: 999px; }
.pal-corona { display: block; }
.pal-room-grid-scroll { overflow-y: auto; }
.pal-room-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); column-gap: 16px; row-gap: 18px; padding: 20px; }
.pal-room-grid-item { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.pal-room-grid-label { font-size: 12px; line-height: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* ── PalaceWingPager / PalaceWingPage ── */
.pal-pager { position: absolute; inset: 0; overflow: hidden; touch-action: none; }
.pal-pager-canvas { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: block; pointer-events: none; z-index: 0; }
.pal-pager-track { position: absolute; left: 0; top: 0; right: 0; z-index: 1; will-change: transform; }
.pal-pager-list { position: absolute; inset: 0; }
.pal-page { position: absolute; left: 0; right: 0; overflow: visible; }
.pal-page-idle, .pal-page-open, .pal-page-list { position: absolute; inset: 0; }
.pal-page-idle { pointer-events: none; }
.pal-page-name { position: absolute; left: 0; top: 0; display: flex; align-items: center; justify-content: center; transform-origin: 50% 50%; will-change: transform, opacity; }
.pal-page-name > span {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  max-width: calc(100% - 24px); text-align: center; font-family: var(--font-rounded); font-weight: 600; line-height: 1.2;
}
.pal-page-label { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 10px; white-space: nowrap; }
.pal-page-rooms { font-size: 15px; line-height: 20px; letter-spacing: -0.24px; color: var(--ink-soft); }
.pal-page-chevron { display: block; will-change: transform; }
.pal-page-next { font-size: 12px; line-height: 16px; }
.pal-sat-node { position: absolute; left: 0; top: 0; border-radius: 50%; display: grid; place-items: center; }
.pal-sat-count { font-family: var(--font-rounded); font-weight: 700; line-height: 1.2; padding: 0 6px; white-space: nowrap; pointer-events: none; }
.pal-sat-label { position: absolute; left: 0; top: 0; width: 100px; display: flex; pointer-events: none; font-size: 12px; line-height: 16px; font-weight: 600; }
.pal-sat-label.leading { justify-content: flex-start; }
.pal-sat-label.trailing { justify-content: flex-end; }
.pal-sat-label.center { justify-content: center; }
.pal-sat-label > span { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal-hub-count { position: absolute; left: 0; top: 0; font-family: var(--font-rounded); font-weight: 700; font-size: 19.2px; line-height: 1.2; padding: 0 6px; white-space: nowrap; pointer-events: none; }
.pal-page-chrome { position: absolute; top: 56px; left: 12px; right: 12px; }
.pal-hub { position: absolute; left: 0; top: 0; border-radius: 50%; }

/* ── MemPalaceExplorer ── */
.mp-immersive { position: absolute; inset: 0; }
.mp-immersive-error { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 0 24px; }
.mp-immersive-error .mem-btn-slot { justify-content: center; width: auto; }
.mp-all-wings {
  position: absolute; right: 20px; z-index: 4; width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center; color: var(--ink);
  background: rgb(var(--wash-rgb) / calc(0.08 * var(--wash-k)));
  box-shadow: inset 0 0 0 1px rgb(var(--wash-rgb) / calc(0.12 * var(--wash-k)));
}
.mp-scroll { position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; }
.mp-stack { display: flex; flex-direction: column; align-items: stretch; gap: 16px; padding: 56px 24px 132px; max-width: 760px; margin: 0 auto; width: 100%; }
.mp-nested { width: 100%; }
.mp-section { font-size: 15px; line-height: 20px; font-weight: 500; letter-spacing: -0.24px; color: var(--ink-soft); }
.mp-space-row { display: flex; align-items: center; gap: 14px; width: 100%; padding: 16px; text-align: left; flex: none; }
.mp-space-row > * { position: relative; }
.mp-space-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.mp-space-name { font-size: 17px; line-height: 22px; font-weight: 600; letter-spacing: -0.41px; color: var(--ink); }
.mp-space-detail { font-size: 12px; line-height: 16px; color: var(--ink-soft); }
.mp-empty-text { font-size: 15px; line-height: 20px; letter-spacing: -0.24px; color: var(--ink-soft); padding: 12px 0; }
.mp-row-meta { display: flex; align-items: center; gap: 8px; width: 100%; font-size: 12px; line-height: 16px; color: var(--ink-soft); }
.mp-row-location { flex: 1 1 auto; min-width: 0; align-items: center; }
.mp-row-location > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.mp-row-location > .sf { margin-top: 0; }
.mp-row-date { flex: none; }
.mp-more { padding-bottom: 12px; }
.mp-no-wings { font-size: 17px; line-height: 22px; letter-spacing: -0.41px; color: var(--ink-soft); }

/* ── PalaceCosmos (design exploration: PalaceCosmos.js) ─────────── */
.cos { position: absolute; inset: 0; overflow: clip; touch-action: none; outline: none; user-select: none; -webkit-user-select: none; }
.cos-canvas { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: block; pointer-events: none; z-index: 0; }
.cos-level { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.cos-node {
  position: absolute; left: 0; top: 0; border-radius: 50%; transform-origin: 50% 50%; will-change: transform, opacity;
  display: flex; align-items: center; justify-content: center; text-align: center; color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}
.cos-node:focus-visible { outline: 2px solid rgb(var(--accent-rgb) / 0.7); outline-offset: 4px; }
.cos-box { display: flex; flex-direction: column; align-items: center; gap: 3px; max-width: 80%; pointer-events: none; }
.cos-name {
  font-family: var(--font-rounded); font-weight: 600; line-height: 1.12; letter-spacing: -0.01em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere;
  text-shadow: 0 0 14px rgb(0 0 0 / 0.35);
}
.cos-count { font-family: var(--font-rounded); font-weight: 600; line-height: 1.2; color: var(--ink-soft); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cos-detail { line-height: 1.2; color: var(--ink-faint); white-space: nowrap; }
.cos-mem { width: var(--w); display: flex; flex-direction: column; align-items: center; gap: 3px; pointer-events: none; }
.cos-mem-glyph { display: grid; place-items: center; opacity: 0.9; }
.cos-mem-title {
  font-weight: 600; line-height: 1.18; color: var(--ink); letter-spacing: -0.01em;
  display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere;
}
.cos-mem-date { font-family: var(--font-rounded); font-weight: 600; line-height: 1.2; white-space: nowrap; opacity: 0.92; }
.cos-page, .cos-create { display: flex; flex-direction: column; align-items: center; gap: 2px; pointer-events: none; }
.cos-page-n { font-family: var(--font-rounded); font-weight: 700; line-height: 1.1; }
.cos-page-u { font-size: 11px; line-height: 14px; color: var(--ink-soft); }
.cos-create > span { font-weight: 600; line-height: 1.2; max-width: 140px; }
.pm-app[data-appearance="light"] .cos-name { text-shadow: 0 0 12px rgb(255 255 255 / 0.7); }

.cos-status { position: absolute; left: 0; top: 0; display: flex; flex-direction: column; align-items: center; gap: 12px; max-width: 280px; text-align: center; will-change: transform, opacity; }
.cos-status-text { font-size: 15px; line-height: 20px; letter-spacing: -0.24px; color: var(--ink-soft); padding-top: 46px; }
.cos-status-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.cos-status-empty .cos-status-text { padding-top: 0; }
.cos-status-title { font: 600 20px/25px var(--font-display); letter-spacing: 0.38px; color: var(--ink); }
.cos-status-error { display: flex; flex-direction: column; align-items: center; gap: 12px; }

/* Trail: back chevron, breadcrumbs, caption + tunnel chips */
.cos-trail { position: absolute; left: 12px; right: 12px; z-index: 4; display: flex; flex-direction: column; gap: 2px; color: var(--ink); will-change: opacity; }
.cos-trail::before {
  content: ""; position: absolute; left: -12px; right: -12px; top: -60px; bottom: -16px; z-index: -1; pointer-events: none;
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  -webkit-mask-image: linear-gradient(#000 62%, transparent); mask-image: linear-gradient(#000 62%, transparent);
}
.cos-trail .pal-crumb.current { font-family: var(--font-rounded); }
.cos-caption { display: flex; align-items: center; gap: 8px; min-width: 0; padding-left: 48px; min-height: 22px; }
.cos-caption-text { flex: 0 0 auto; max-width: 62%; min-width: 0; font-size: 13px; line-height: 18px; letter-spacing: -0.08px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cos-caption-hint { display: inline-flex; align-items: center; gap: 5px; color: var(--ink); animation: cos-breathe 1.8s ease-in-out infinite; }
.cos-tunnels {
  display: inline-flex; align-items: center; gap: 5px; flex: 0 1 auto; min-width: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
  color: var(--ink-faint); touch-action: pan-x; -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); padding-right: 16px;
}
.cos-tunnels::-webkit-scrollbar { display: none; }
.cos-tunnel {
  flex: none; font-size: 12px; line-height: 16px; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap;
  color: var(--tint); background: color-mix(in srgb, var(--tint) 13%, transparent); box-shadow: inset 0 0 0 0.6px color-mix(in srgb, var(--tint) 45%, transparent);
}

/* Sibling bar: glide to the neighbouring wing or room */
.cos-siblings {
  position: absolute; left: 14px; right: 14px; z-index: 3; height: 30px;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; will-change: opacity;
}
.cos-sib { display: inline-flex; align-items: center; gap: 4px; min-height: 30px; min-width: 0; font-size: 13px; line-height: 18px; font-weight: 600; justify-self: start; }
.cos-sib.next { justify-self: end; }
.cos-sib > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 130px; }
.cos-sib-dots { display: inline-flex; gap: 5px; align-items: center; font-size: 11px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.cos-sib-dots > i { width: 4px; height: 4px; border-radius: 50%; background: rgb(var(--wash-rgb) / calc(0.28 * var(--wash-k))); transition: transform 0.3s ease, background 0.3s ease; }
.cos-sib-dots > i.on { background: var(--ink); transform: scale(1.5); }

/* The memory card: a crystal that opens into a glass page */
.cos-card {
  position: absolute; left: 0; top: 0; z-index: 2; overflow: hidden; will-change: transform, width, height;
  background: rgb(14 20 36 / 0.72); -webkit-backdrop-filter: blur(22px) saturate(1.6); backdrop-filter: blur(22px) saturate(1.6);
  box-shadow: inset 0 0 0 0.8px var(--tint-soft), 0 0 46px -10px var(--tint-soft), 0 24px 60px -18px rgb(0 0 0 / 0.55);
}
.pm-app[data-appearance="light"] .cos-card { background: rgb(250 252 255 / 0.8); box-shadow: inset 0 0 0 0.8px var(--tint-soft), 0 0 40px -12px var(--tint-soft), 0 20px 50px -20px rgb(40 52 80 / 0.35); }
.cos-card::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 120px; pointer-events: none; background: radial-gradient(120% 100% at 20% 0%, var(--tint-soft), transparent 70%); opacity: 0.55; }
.cos-card-inner { position: absolute; left: 0; top: 0; display: flex; flex-direction: column; gap: 12px; padding: 20px 20px 14px; will-change: transform, opacity; }
.cos-card-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.cos-card-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--tint); box-shadow: 0 0 10px var(--tint); flex: none; }
.cos-card-loc { flex: 1 1 auto; min-width: 0; font-size: 13px; line-height: 18px; font-weight: 600; color: var(--tint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cos-card-title { font: 600 22px/28px var(--font-display); letter-spacing: 0.35px; color: var(--ink); overflow-wrap: anywhere; }
.cos-card-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; line-height: 16px; color: var(--ink-soft); }
.cos-card-meta > span { display: inline-flex; align-items: center; gap: 5px; min-width: 0; }
.cos-card-src { max-width: 100%; }
.cos-card-body {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y;
  font-size: 17px; line-height: 24px; letter-spacing: -0.41px; color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere;
  display: flex; flex-direction: column; gap: 10px; user-select: text; -webkit-user-select: text;
}
.cos-card-empty, .cos-card-reading { font-size: 15px; line-height: 20px; color: var(--ink-faint); }
.cos-card-reading { animation: cos-breathe 1.4s ease-in-out infinite; }
@keyframes cos-breathe { 50% { opacity: 0.45; } }
.cos-card-tunnels { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.cos-card-also { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; line-height: 16px; font-weight: 600; color: var(--ink-faint); margin-right: 2px; }
.cos-card-foot { display: flex; align-items: center; gap: 4px; padding-top: 4px; border-top: 0.5px solid rgb(var(--wash-rgb) / calc(0.1 * var(--wash-k))); }
.cos-card-step { width: 36px; height: 36px; display: grid; place-items: center; color: var(--tint); border-radius: 50%; }
.cos-card-step:disabled { color: var(--ink-ghost); }
.cos-card-pos { font-size: 12px; line-height: 16px; color: var(--ink-soft); font-variant-numeric: tabular-nums; min-width: 52px; text-align: center; }
.cos-card-spacer { flex: 1 1 auto; }
.cos-card-foot .mem-btn-secondary { background: color-mix(in srgb, var(--tint) 16%, transparent); color: var(--tint); }

.cos-hint {
  position: absolute; left: 50%; transform: translateX(-50%); z-index: 3; display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px; border-radius: 999px; white-space: nowrap; font-size: 13px; line-height: 18px; font-weight: 500; color: var(--ink-soft);
  background: rgb(var(--wash-rgb) / calc(0.07 * var(--wash-k))); box-shadow: inset 0 0 0 0.6px rgb(var(--wash-rgb) / calc(0.12 * var(--wash-k)));
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); pointer-events: none;
  animation: cos-hint 5.2s var(--ease-out) both;
}
@keyframes cos-hint { 0% { opacity: 0; transform: translate(-50%, 8px); } 8%, 86% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; transform: translate(-50%, 0); } }

/* Hosts: the Memory plane lays the cosmos full-bleed under its header */
.mem-cosmos { position: absolute; inset: 0; }
.mem-cosmos-head { position: absolute; left: 0; right: 0; top: 0; z-index: 5; transition: opacity 0.35s var(--ease-out); }
.mem-cosmos-head .mem-stack { min-height: 0; padding-bottom: 0; }
.mem-cosmos-head.hidden { opacity: 0; pointer-events: none; }
.mem-greeting-row.cosmos { transition: opacity 0.35s var(--ease-out); }
.mp-all-wings.cosmos { right: 120px; width: 44px; height: 44px; border-radius: 0; background: none; box-shadow: none; color: var(--ink-soft); z-index: 7; transition: opacity 0.3s var(--ease-out); }
.mp-all-wings.cosmos.hidden { opacity: 0; pointer-events: none; }
