:root {
  --ink: #0f1115;
  --ink-2: #3c4250;
  --ink-3: #7a8190;
  --deck: #eef0f3;
  --active: #3b77a8;
  --tag: #d97757;
  --glass-blur: 22px;
  --glass-tint: 0.42;
  --glass-sat: 1.8;
  --core-pad: 10px;
  --radius: 30px;
  --font: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --shadow: 0 20px 56px rgba(28, 36, 64, 0.13), 0 2px 6px rgba(28, 36, 64, 0.05);
  --out-quint: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--deck);
  color: var(--ink);
  font: 400 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

button { font: inherit; color: inherit; }
a { color: inherit; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
::selection { background: rgba(123, 108, 255, 0.25); }

/* ---------- stage ---------- */
#stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
  transition: opacity 0.25s ease, filter 0.25s ease;
}
#stage.panning { cursor: grabbing; }
#bg, #links { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
#groups-layer, #cards-layer { position: absolute; left: 0; top: 0; }

html:not(.ready) #stage { opacity: 0; }
html.ready #stage { opacity: 1; transition: opacity 0.8s ease; }

/* ---------- groups (Rift comment/group frames) ---------- */
.group {
  position: absolute;
  left: 0;
  top: 0;
  border-radius: 40px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0.12));
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  pointer-events: none;
}
.group-title {
  position: absolute;
  left: 30px;
  bottom: 100%;
  margin: 0 0 12px;
  font-family: var(--font-title, var(--font));
  font-size: var(--group-size, 64px);
  font-weight: var(--group-weight, 640);
  letter-spacing: var(--group-tracking, -0.045em);
  line-height: 1;
  color: rgba(15, 17, 21, 0.86);
  white-space: nowrap;
}

/* ---------- cards: glass shell + white core ---------- */
.card {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 50% 50%;
  padding: var(--core-pad);
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, calc(var(--glass-tint) + 0.22)), rgba(255, 255, 255, calc(var(--glass-tint) * 0.45)));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  box-shadow:
    var(--shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    inset 0 -1px 0 rgba(255, 255, 255, 0.35),
    inset 0 0 0 1px rgba(255, 255, 255, 0.55);
  cursor: default;
  outline: none;
  user-select: none;
  -webkit-user-select: none;
  --mx: 30%;
  --my: 0%;
}
/* iridescent rim */
.card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1.2px;
  background: conic-gradient(from 210deg at 50% 50%,
    rgba(255, 255, 255, 0.9), rgba(186, 170, 255, 0.75), rgba(160, 232, 214, 0.7),
    rgba(255, 214, 170, 0.7), rgba(255, 190, 214, 0.75), rgba(255, 255, 255, 0.9));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.8;
  pointer-events: none;
}
/* specular sheen that follows the pointer */
.card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(420px circle at var(--mx) var(--my), rgba(255, 255, 255, 0.55), transparent 45%);
  mix-blend-mode: soft-light;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}
.card:hover::after { opacity: 1; }

.card-core {
  position: relative;
  z-index: 1;
  border-radius: max(4px, calc(var(--radius) - var(--core-pad)));
  background: var(--core-bg, #fff);
  padding: 26px 28px 24px;
  box-shadow: 0 1px 2px rgba(28, 36, 64, 0.05), 0 10px 30px rgba(28, 36, 64, 0.06);
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font: 500 11px/1 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 14px;
}
.meta-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.card-title {
  margin: 0 0 10px;
  font-family: var(--font-title, var(--font));
  font-size: var(--title-size, 25px);
  line-height: 1.12;
  font-weight: var(--title-weight, 600);
  letter-spacing: var(--title-tracking, -0.025em);
}
.card-body { color: var(--ink-2); font-size: 16px; line-height: 1.55; }
.card-body p { margin: 0 0 10px; }
.card-body p:last-child { margin-bottom: 0; }
.card-body strong { color: var(--ink); font-weight: 600; }
code {
  font: 500 0.88em var(--mono);
  background: #f2f3f6;
  border-radius: 6px;
  padding: 1px 6px;
}
.card-list { list-style: none; margin: 4px 0 0; padding: 0; }
.card-list li {
  position: relative;
  padding: 9px 0 9px 22px;
  border-top: 1px solid #eef0f3;
  color: var(--ink-2);
  font-size: 15.5px;
}
.card-list li:first-child { border-top: 0; }
.card-list li::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 17px;
  width: 8px;
  height: 8px;
  border-radius: 3px;
  background: color-mix(in srgb, var(--accent) 70%, white);
}
.card-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.pill-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px 8px 14px;
  border-radius: 999px;
  background: #f3f4f7;
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.2s, color 0.2s, transform 0.2s;
}
.pill-link svg { width: 14px; height: 14px; }
.pill-link:hover { background: var(--ink); color: #fff; }
.card-tags { display: flex; gap: 10px; margin-top: 14px; font: 500 12px var(--mono); color: var(--ink-3); }

.kind-hero .card-core { padding: 34px 36px 32px; }
.kind-hero .card-title { font-size: var(--hero-size, 46px); letter-spacing: var(--hero-tracking, -0.045em); margin-bottom: 14px; }
.kind-hero .card-body { font-size: 18px; }

.app-icon {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  font-size: 28px;
  font-weight: 600;
  color: #fff;
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.55), transparent 50%),
    linear-gradient(145deg, var(--c), color-mix(in srgb, var(--c) 55%, #1a1030));
  box-shadow: 0 10px 24px color-mix(in srgb, var(--c) 35%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.kind-contact .card-links a:first-child { font-size: 16px; background: var(--ink); color: #fff; }

blockquote {
  margin: 0;
  font-size: 22px;
  line-height: 1.35;
  letter-spacing: -0.015em;
  color: var(--ink);
}
blockquote p { margin: 0; }
.quote-by { margin: 12px 0 0; color: var(--ink-3); font-size: 14px; }

/* stack (Rift matrix): a scattered pile that fans out */
.kind-stack .card-core { background: linear-gradient(180deg, #fff, #fbfbfd); }
.stack-count {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 16px;
  font: 500 12px var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.stack-count span { font: 600 22px var(--font); color: var(--ink); letter-spacing: -0.02em; }
.kind-stack { cursor: pointer; }
.kind-stack .card-body::after { content: ''; }
.kind-stack.stack-open .card-body p::after { content: ' (click to gather)'; color: var(--ink-3); }
.card.in-pile { cursor: pointer; }
.card.in-pile .card-chrome { display: none; }
.card.in-pile .card-core > * { opacity: 0.35; }

/* selection chrome outside the card (Rift: label top-left, … top-right) */
.card.selected { outline: none; }   /* selection stays invisible for now */
.card-chrome {
  position: absolute;
  left: 6px;
  right: 0;
  bottom: calc(100% + 12px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.2s, transform 0.3s var(--out-quint);
  pointer-events: none;
}
.card.selected .card-chrome { opacity: 1; transform: none; pointer-events: auto; }
.chrome-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: 500 15px var(--font);
  color: var(--ink);
}
.chrome-label svg { width: 14px; height: 14px; fill: var(--accent); stroke: none; }
.chrome-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 0;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.8);
  box-shadow: 0 4px 14px rgba(28, 36, 64, 0.12);
  cursor: pointer;
}
.chrome-btn:hover { background: var(--active); color: #fff; }

/* ---------- ephemeral cards ---------- */
.card.ephemeral::before {
  padding: 1.6px;
  background: conic-gradient(from var(--spin, 0deg),
    rgba(255, 255, 255, 0.95), color-mix(in srgb, var(--accent) 80%, white), rgba(160, 232, 214, 0.9),
    rgba(255, 214, 170, 0.85), color-mix(in srgb, var(--accent) 60%, white), rgba(255, 255, 255, 0.95));
  animation: spin 6s linear infinite;
  opacity: 1;
}
@property --spin { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
@keyframes spin { to { --spin: 360deg; } }
.card.ephemeral .card-core { background: linear-gradient(180deg, #fff 0%, #fdfcff 100%); }
.card.ephemeral .card-meta::after {
  display: none;                     /* (no 'ephemeral' tag on answers either) */
  content: 'ephemeral';
  margin-left: auto;
  padding: 4px 7px 3px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 12%, white);
  color: color-mix(in srgb, var(--accent) 80%, black);
  font-size: 9px;
  letter-spacing: 0.14em;
}

/* the visitor's prompt: dark core inside the glass (Rift's dark prompt node) */
.card.kind-prompt .card-core {
  background: #111214;
  color: #eee;
  padding: 22px 24px 20px;
  box-shadow: 0 10px 30px rgba(10, 10, 20, 0.25);
}
.prompt-label { font: 500 10.5px var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: #8b8f99; margin-bottom: 10px; }
.prompt-text { margin: 0 0 18px; font-size: 17px; line-height: 1.4; color: #f2f2f4; overflow-wrap: anywhere; }
.prompt-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 26px; }
.ephemeral-tag {
  margin-left: auto;
  height: 22px;
  padding: 0 9px;
  border-radius: 11px;
  background: var(--tag);
  color: #fff;
  font: 600 9.5px/22px var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}
.card.failed .ephemeral-tag { background: #ff6d4d; }

.goo { position: relative; width: 44px; height: 26px; filter: url(#goo); }
.goo i {
  position: absolute;
  top: 7px;
  left: 16px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  animation: goo 1.6s ease-in-out infinite;
}
.goo i:nth-child(2) { animation-delay: -0.5s; }
.goo i:nth-child(3) { animation-delay: -1.05s; }
@keyframes goo {
  0%, 100% { transform: translate(-14px, 0) scale(0.8); }
  33% { transform: translate(12px, -4px) scale(1.15); }
  66% { transform: translate(2px, 5px) scale(0.95); }
}

/* materialize / dissolve */
.card.materializing .card-core::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(110deg, transparent 30%, color-mix(in srgb, var(--accent) 18%, transparent) 50%, transparent 70%);
  background-size: 250% 100%;
  animation: sweep 0.9s var(--out-quint) forwards;
  pointer-events: none;
}
@keyframes sweep { from { background-position: 120% 0; } to { background-position: -60% 0; } }
.card.dissolving {
  -webkit-mask-image: linear-gradient(0deg, #000 40%, transparent 60%);
  mask-image: linear-gradient(0deg, #000 40%, transparent 60%);
  -webkit-mask-size: 100% 300%;
  mask-size: 100% 300%;
  animation: dissolve 1.4s ease-in forwards;
  pointer-events: none;
}
@keyframes dissolve { from { -webkit-mask-position: 0 0; mask-position: 0 0; } to { -webkit-mask-position: 0 100%; mask-position: 0 100%; } }

/* ---------- HUD ---------- */
.hud { position: fixed; z-index: 30; }
.glass-pill {
  background: rgba(255, 255, 255, 0.58);
  -webkit-backdrop-filter: blur(18px) saturate(1.8);
  backdrop-filter: blur(18px) saturate(1.8);
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 10px 34px rgba(28, 36, 64, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  border-radius: 32px;
}
.hud-top {
  top: max(22px, env(safe-area-inset-top));
  left: 22px;
  right: 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
}
.hud-top > * { pointer-events: auto; }
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 56px;
  padding: 0 20px 0 8px;
  text-decoration: none;
}
.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 650;
  font-size: 16px;
  color: #fff;
  background: radial-gradient(circle at 30% 25%, #6c6f78, #111214 70%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-weight: 600; font-size: 14.5px; letter-spacing: -0.01em; }
.brand-text small { font: 500 10px var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); }

.nav { display: flex; gap: 4px; padding: 7px; height: 56px; align-items: center; }
.nav a {
  height: 42px;
  display: inline-flex;
  align-items: center;
  padding: 0 16px;
  border-radius: 21px;
  text-decoration: none;
  font-weight: 500;
  font-size: 14.5px;
  transition: background 0.2s, color 0.2s;
}
.nav a:hover { background: rgba(255, 255, 255, 0.8); }
.nav a.active { background: var(--ink); color: #fff; }

.hud-zoom {
  left: 22px;
  bottom: max(22px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 7px;
  height: 60px;
}
.bullet {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 0;
  background: transparent;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.bullet:hover { background: rgba(255, 255, 255, 0.85); }
.bullet:active { background: var(--active); color: #fff; }
.zoom-level { min-width: 46px; text-align: center; font: 500 12px var(--mono); color: var(--ink-2); }

.hud-tray {
  right: 22px;
  bottom: max(22px, env(safe-area-inset-bottom));
  height: 60px;
  min-width: 60px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font: 500 13px var(--mono);
  color: var(--ink-3);
}
.hud-tray.has { color: var(--ink); }
.hud-tray.has svg { color: var(--tag); }

/* ---------- prompt ---------- */
.prompt-wrap {
  position: fixed;
  z-index: 31;
  left: 50%;
  bottom: max(22px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(640px, calc(100vw - 260px));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.chip {
  height: 34px;
  padding: 0 14px;
  border-radius: 17px;
  border: 1px solid rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.6);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: 0 6px 18px rgba(28, 36, 64, 0.07);
  font-size: 13.5px;
  cursor: pointer;
  animation: chip-in 0.5s var(--out-quint) both;
  transition: background 0.2s, color 0.2s;
}
.chip:hover { background: var(--ink); color: #fff; }
@keyframes chip-in { from { opacity: 0; transform: translateY(8px); } }

.prompt {
  width: 100%;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 7px 7px 22px;
}
.prompt input {
  flex: 1;
  min-width: 0;
  height: 46px;
  border: 0;
  outline: 0;
  background: transparent;
  font: 400 16px var(--font);
  color: var(--ink);
}
.prompt input::placeholder { color: var(--ink-3); }
.anchor-chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 170px;
  height: 30px;
  margin-left: -10px;
  padding: 0 10px;
  border: 0;
  border-radius: 15px;
  background: var(--tag);
  color: #fff;
  font: 600 11px var(--mono);
  letter-spacing: 0.04em;
  cursor: pointer;
}
.anchor-chip[hidden] { display: none; }
.anchor-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.anchor-chip svg { width: 14px; height: 14px; flex: none; }
.send {
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 0;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: #fff;
  opacity: 0.3;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.2s;
  position: relative;
}
.prompt.has-text .send { opacity: 1; }
.prompt.has-text .send:hover { transform: scale(1.06); }
.prompt.busy .send { opacity: 1; }
.prompt.busy .send::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  animation: pulse 1.1s cubic-bezier(0.7, 0, 1, 1) infinite;
}
@keyframes pulse { from { transform: scale(1); opacity: 0.7; } to { transform: scale(1.7); opacity: 0; } }
.prompt-status {
  margin: 0;
  min-height: 16px;
  font: 500 11px var(--mono);
  letter-spacing: 0.04em;
  color: var(--ink-3);
  text-align: center;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- toasts ---------- */
.toasts {
  position: fixed;
  z-index: 40;
  top: 92px;
  right: 22px;
  width: 300px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  pointer-events: none;
}
.toast {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  box-shadow: 0 10px 30px rgba(28, 36, 64, 0.12);
  font-size: 14.5px;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.25s linear, transform 0.3s var(--out-quint);
}
.toast.on { opacity: 1; transform: none; }
.toast.error { background: rgba(255, 109, 77, 0.92); color: #fff; }
.toast.success { background: rgba(67, 236, 99, 0.9); }

/* ---------- zoom view (the camera dives into a card) ---------- */
.expanded {
  position: fixed;
  inset: 0;
  z-index: 50;
  --p: 0;
  background: rgba(214, 222, 219, calc(var(--p) * 0.18));
}
.expanded[hidden] { display: none; }
html.is-expanded .hud, html.is-expanded .prompt-wrap { opacity: 0; pointer-events: none; }
.hud, .prompt-wrap { transition: opacity 0.35s; }
.expanded-panel {
  position: fixed;
  transform-origin: 50% 50%;
  overflow: visible;                 /* the card's thick edge (drawn below it) must not be clipped flat */
  scrollbar-width: none;
  will-change: transform;
  filter: drop-shadow(0 calc(var(--p) * 28px) calc(8px + var(--p) * 40px) rgba(24, 34, 30, calc(0.12 + var(--p) * 0.12)));
}
.expanded-panel::-webkit-scrollbar { display: none; }
.expanded-panel .zoom-card {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
  pointer-events: auto;
  transition: none;
  animation: none;
}
.expanded-panel .zoom-card.selected { outline: 0; }
/* once it has landed, long text reads in full (scrolling inside the page) */
.expanded-panel .zoom-card.settled .card-core { -webkit-mask-image: none; mask-image: none; overflow: auto; scrollbar-width: none; }
.expanded-panel .zoom-card.settled .card-core::-webkit-scrollbar { display: none; }
.expanded-core .card-title { font-size: clamp(30px, 5vw, 48px); letter-spacing: -0.04em; }
.expanded-core .card-body { font-size: 18px; }
.back {
  position: fixed;
  top: 20px;
  left: 20px;
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  cursor: pointer;
  animation: back-in 0.4s cubic-bezier(0.33, 1, 0.68, 1);
}
@keyframes back-in { from { transform: translateX(-120px); } }
.expanded .back { opacity: var(--p); }

/* ---------- lab ---------- */
.lil-gui.lab-gui {
  --background-color: rgba(255, 255, 255, 0.85);
  --text-color: #1b1d22;
  --title-background-color: #111214;
  --title-text-color: #fff;
  --widget-color: #eceef2;
  --hover-color: #e2e5ea;
  --focus-color: #d8dbe2;
  --number-color: #3b77a8;
  --string-color: #22b893;
  --font-family: var(--mono);
  position: fixed;
  top: 92px !important;
  right: 22px !important;
  z-index: 60;
  border-radius: 14px;
  overflow: hidden;
  backdrop-filter: blur(16px);
}

.noscript { position: fixed; inset: 0; display: grid; place-content: center; text-align: center; padding: 24px; }

/* ---------- small screens ---------- */
@media (max-width: 760px) {
  .hud-top { left: 12px; right: 12px; top: max(12px, env(safe-area-inset-top)); flex-direction: column; align-items: stretch; gap: 8px; }
  .brand { height: 48px; align-self: flex-start; }
  .brand-mark { width: 34px; height: 34px; }
  .nav { height: 46px; padding: 4px; overflow-x: auto; justify-content: space-between; }
  .nav a { height: 38px; padding: 0 9px; font-size: 13px; flex: 1; justify-content: center; }
  .hud-zoom { display: none; }
  .prompt-wrap { width: calc(100vw - 24px); bottom: max(12px, env(safe-area-inset-bottom)); }
  .hud-tray { right: 12px; bottom: auto; top: max(12px, env(safe-area-inset-top)); height: 48px; }
  .toasts { top: 130px; right: 12px; left: 12px; width: auto; }
  .prompt-status { display: none; }
  .chips { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; width: 100%; padding-bottom: 2px; scrollbar-width: none; }
  .chip { flex: none; }
}

@media (prefers-reduced-motion: reduce) {
  .card.ephemeral::before { animation: none; }
  .goo i { animation-duration: 3s; }
}

/* ---------- printed image cards ---------- */
.kind-photo .card-core { padding: 0; overflow: hidden; }
.photo {
  position: relative;
  margin: 0;
  border-radius: inherit;
  overflow: hidden;
  line-height: 0;
}
.photo img {
  display: block;
  width: 100%;
  height: auto;
  filter: saturate(0.9) contrast(1.03) sepia(0.06);
  -webkit-user-drag: none;
  user-select: none;
}
/* ink on paper: grain, a soft print vignette and a faint top sheen */
.photo::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.35  0 0 0 0 0.3  0 0 0 0 0.2  0 0 0 .16 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    linear-gradient(175deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0) 40%);
  box-shadow: inset 0 0 50px rgba(90, 70, 30, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.45);
  mix-blend-mode: multiply;
  pointer-events: none;
}
.expanded-core:has(.photo) { padding: 0; overflow: hidden; }
.photo-caption { padding: 28px 36px 34px; }

/* ---------- sticky notes (content) ---------- */
.kind-sticky .card-core { padding: 26px 24px 30px; background: #fbe6a0; }
.sticky-text {
  margin: 0;
  font: 500 19px/1.25 var(--font);
  color: rgba(35, 32, 20, 0.88);
}

/* ---------- performance test: Thoughts matrix ---------- */
#matrix-gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }
#matrix-gl[hidden], #matrix-layer[hidden] { display: none; }
#matrix-layer { position: absolute; left: 0; top: 0; pointer-events: none; }
.thought {
  position: absolute;
  left: 0;
  top: 0;
  width: 220px;
  height: 220px;
  padding: 20px 20px;
  contain: layout paint style;
  color: #2c3331;
}
.thought-no {
  display: block;
  margin-bottom: 8px;
  font: 500 10px/1 var(--mono);
  letter-spacing: 0.12em;
  color: rgba(40, 50, 47, 0.45);
}
.thought p {
  margin: 0;
  font: 500 15.5px/1.35 var(--font);
  letter-spacing: -0.01em;
  display: -webkit-box;
  -webkit-line-clamp: 7;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.thought.is-sticky p { color: rgba(40, 36, 20, 0.85); }
.thought.is-dark { color: #eef0ee; }
.thought.is-dark .thought-no { color: rgba(238, 240, 238, 0.45); }
.matrix-title {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  white-space: nowrap;
  color: rgba(30, 40, 37, 0.62);
}
.matrix-title strong { font: 600 var(--size, 360px)/0.95 var(--font); letter-spacing: -0.045em; }
.matrix-title span { font: 500 calc(var(--size, 360px) * 0.2)/1 var(--mono); letter-spacing: 0.04em; padding-left: 0.4em; }
.matrix-title { gap: calc(var(--size, 360px) * 0.12); }

.pill-sep { width: 1px; height: 22px; background: currentColor; opacity: 0.15; margin: 0 4px; }
.bullet.on { background: var(--active); color: #fff; }

.perf {
  position: fixed;
  z-index: 36;
  right: 22px;
  top: 92px;
  width: 264px;
  padding: 16px 16px 14px;
  border-radius: 20px;
  font: 500 12px/1.3 var(--mono);
}
.perf header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.perf header strong { font: 600 14px var(--font); letter-spacing: -0.01em; }
.perf-x { border: 0; background: none; font-size: 20px; line-height: 1; cursor: pointer; opacity: 0.6; }
.perf dl { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin: 0 0 12px; }
.perf dt { opacity: 0.55; font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; }
.perf dd { margin: 2px 0 0; font-size: 15px; font-variant-numeric: tabular-nums; }
.perf-run {
  width: 100%;
  height: 38px;
  border: 0;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  font: 600 13px var(--font);
  cursor: pointer;
}
[data-dir='tabletop'] .perf-run { background: #f1f2f0; color: #1b1e1d; }
.perf-run:disabled { opacity: 0.5; cursor: progress; }
.perf-result { margin: 10px 0 0; font-size: 11px; line-height: 1.45; opacity: 0.85; white-space: pre-line; user-select: text; }
.perf-result:empty { display: none; }
@media (max-width: 760px) { .perf { top: auto; bottom: 150px; right: 12px; left: 12px; width: auto; } }

.matrix-btn .dense path { stroke-width: 1.4; }

.hud-bench {
  left: 22px;
  bottom: calc(max(22px, env(safe-area-inset-bottom)) + 70px);
  display: flex;
  gap: 4px;
  padding: 6px;
  height: 56px;
  align-items: center;
}
.hud-bench .bullet { width: 44px; height: 44px; }
@media (max-width: 760px) { .hud-bench { display: none; } }

.chips[hidden] { display: none; }

.nav[hidden] { display: none; }
.brand[hidden], .hud-tray[hidden] { display: none; }

/* ---------- polaroids ---------- */
.card.kind-polaroid { --radius: 6px; background: #f6f5f1; }
.kind-polaroid .card-core { padding: 11px 11px 0; background: transparent; box-shadow: none; }
.polaroid-photo {
  position: relative;
  margin: 0;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 1.5px;
  background: #d9d7d0;
}
.polaroid-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.9) contrast(1.04) sepia(0.05);
  -webkit-user-drag: none;
  user-select: none;
}
/* the print: a gloss sweep, a faint inner edge and vignette */
.polaroid-photo::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(130deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0) 38%, rgba(255, 255, 255, 0) 70%, rgba(255, 255, 255, 0.07) 100%);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1), inset 0 0 26px rgba(20, 16, 8, 0.18);
  pointer-events: none;
}
.polaroid-caption {
  margin: 0;
  height: 42px;
  display: flex;
  align-items: center;
  padding: 0 3px;
  font: 500 13px/1.2 var(--font);
  letter-spacing: -0.01em;
  color: #4b504d;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card.in-pile.in-folder .card-core > * { opacity: 1; }
.card.in-pile.in-folder { cursor: pointer; }

.card-subtitle { margin: -2px 0 18px; font: 500 14px/1.3 var(--font); letter-spacing: 0.01em; color: var(--ink-3); }

/* ---------- poster print ---------- */
.card.kind-poster { --radius: 8px; background: #f4f3ef; }
.kind-poster .card-core { padding: 16px 16px 0; background: transparent; box-shadow: none; }
.poster-photo {
  position: relative;
  margin: 0;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border-radius: 1px;
  background: #cfcac0;
}
.poster-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.94) contrast(1.02);
  -webkit-user-drag: none;
  user-select: none;
}
/* matte print: fine grain, soft vignette, no gloss */
.poster-photo::after {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.3  0 0 0 0 0.28  0 0 0 0 0.24  0 0 0 .14 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08), inset 0 0 40px rgba(20, 16, 8, 0.14);
  mix-blend-mode: multiply;
  pointer-events: none;
}
.poster-caption {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 50px;
  padding: 0 2px;
  font: 600 13px/1 var(--font);
  letter-spacing: -0.01em;
  color: #2d302e;
}
.poster-caption span + span { font: 500 10.5px var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: #7a7f7c; }
.expanded-core .poster-caption { padding: 0 36px; height: 64px; }

/* selection: no type label on any card */
.chrome-label { display: none; }
/* the glass folder: no selection chrome at all, a faint green outline */
.card.glass-folder .card-chrome { display: none; }

/* ================= HUD v2: thin glass, lit by the scene's key light ================= */
:root { --la: 135deg; --lhx: 0.85px; --lhy: 0.85px; --lsx: -6px; --lsy: 10px; }
html .glass-pill,
html[data-dir] .glass-pill,
html[data-theme] .glass-pill {
  color: #f2f4f5;
  border: 0;
  background:
    linear-gradient(var(--la), rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.04) 38%, rgba(255, 255, 255, 0) 62%),
    rgba(16, 19, 22, 0.62);
  -webkit-backdrop-filter: blur(16px) saturate(1.6);
  backdrop-filter: blur(16px) saturate(1.6);
  box-shadow:
    inset var(--lhx) var(--lhy) 0 rgba(255, 255, 255, 0.28),
    inset 0 0 0 0.5px rgba(255, 255, 255, 0.16),
    var(--lsx) var(--lsy) 26px rgba(18, 26, 34, 0.26);
}
html .bullet { color: inherit; }
html .bullet:hover { background: rgba(255, 255, 255, 0.12); }
html .bullet.on, html .bullet[aria-pressed='true'] { background: rgba(255, 255, 255, 0.9); color: #111; }
html .zoom-level { color: rgba(242, 244, 245, 0.6); }

/* zoom dock: a single icon until the pointer comes close */
.hud-zoom { gap: 0; padding: 0; height: 48px; min-width: 48px; overflow: hidden; transition: padding 0.35s var(--out-quint, ease), gap 0.35s; }
.hud-zoom .zoom-icon { flex: none; width: 48px; height: 48px; display: grid; place-items: center; cursor: pointer; transition: width 0.35s var(--out-quint, ease), opacity 0.25s; }
.hud-zoom .zoom-icon svg, .gear-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.hud-zoom > .bullet, .hud-zoom > .zoom-level {
  width: 0;
  min-width: 0;
  opacity: 0;
  overflow: hidden;
  transition: width 0.35s var(--out-quint, ease), min-width 0.35s var(--out-quint, ease), opacity 0.2s;
}
.hud-zoom .bullet { height: 38px; padding: 0; border: 0; }
.hud-zoom.near { padding: 0 5px; gap: 2px; }
.hud-zoom.near .zoom-icon { width: 0; opacity: 0; }
.hud-zoom.near > .bullet { width: 38px; opacity: 1; transition-delay: 0.04s; }
.hud-zoom.near > .zoom-level { width: auto; min-width: 46px; opacity: 1; }

/* gear: theme, light and stress test live behind it */
.hud-gear { right: 22px; bottom: max(22px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.gear-btn { width: 48px; height: 48px; border-radius: 50%; padding: 0; display: grid; place-items: center; cursor: pointer; }
.gear-btn svg { transition: transform 0.5s var(--out-quint, ease); }
.gear-btn.on svg { transform: rotate(60deg); }
.settings-panel {
  width: 212px;
  padding: 14px 14px 12px;
  border-radius: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transform-origin: 100% 100%;
  animation: panel-in 0.32s var(--out-quint, ease) both;
}
.settings-panel[hidden] { display: none; }
@keyframes panel-in { from { opacity: 0; transform: translateY(8px) scale(0.96); } }
.settings-panel h4 { margin: 0 0 8px; font: 500 10px var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: rgba(242, 244, 245, 0.5); }
.settings-panel .light-section:has(.gimbal[hidden]) { display: none; }
.settings-panel .gimbal { position: relative; right: auto; bottom: auto; width: 112px; height: 112px; margin: 0 auto; background: rgba(0, 0, 0, 0.25); box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.12); display: block; }
.settings-panel .gimbal[hidden] { display: none; }
.settings-panel .gimbal .g-read { right: 50%; transform: translate(50%, 4px); background: rgba(0, 0, 0, 0.6); }
.settings-panel .gimbal:hover .g-read, .settings-panel .gimbal.dragging .g-read { transform: translate(50%, 0); }
.settings-panel .hud-bench { position: static; display: flex; gap: 4px; height: auto; padding: 0; }
.settings-panel .hud-bench .bullet { width: 40px; height: 40px; }
.settings-panel .theme-switch { position: static; background: none; box-shadow: none; padding: 0; gap: 8px; }
html[data-theme] .settings-panel .theme-switch { background: none; }
.settings-panel .theme-switch button { width: 30px; height: 30px; }
.settings-panel .theme-switch button[aria-pressed='true'] { box-shadow: 0 0 0 2px rgba(16, 19, 22, 0.9), 0 0 0 3.5px rgba(255, 255, 255, 0.9); }
@media (max-width: 760px) { .hud-bench { display: flex; } .settings-panel .gimbal { display: block; } }

/* the prompt: press space, type into a small dark glass field */
.prompt-wrap { width: min(400px, calc(100vw - 150px)); bottom: max(26px, env(safe-area-inset-bottom)); transition: opacity 0.25s, transform 0.3s var(--out-quint, ease); opacity: 0; transform: translate(-50%, 10px) scale(0.97); }
.prompt-wrap.open { opacity: 1; transform: translate(-50%, 0); }
.prompt-wrap[hidden] { display: none; }
html .prompt.glass-pill { height: 46px; padding: 4px 4px 4px 18px; border-radius: 23px; }
html .prompt input { height: 38px; font-size: 14.5px; color: #f2f4f5; caret-color: #fff; }
html .prompt input::placeholder { color: rgba(242, 244, 245, 0.45); }
html .prompt .send { width: 38px; height: 38px; background: rgba(255, 255, 255, 0.92); color: #111; }
html .prompt .send svg { stroke: #111; }
.prompt-status { display: none; }
@media (max-width: 760px) { .hud-zoom { display: flex; } }
html[data-dir] .prompt.glass-pill, html[data-theme] .prompt.glass-pill {
  background:
    linear-gradient(var(--la), rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.04) 38%, rgba(255, 255, 255, 0) 62%),
    rgba(12, 14, 16, 0.78);
  box-shadow:
    inset var(--lhx) var(--lhy) 0 rgba(255, 255, 255, 0.28),
    inset 0 0 0 0.5px rgba(255, 255, 255, 0.16),
    var(--lsx) var(--lsy) 26px rgba(18, 26, 34, 0.26);
}
html[data-dir] .settings-panel .gimbal, html[data-theme] .settings-panel .gimbal { background: rgba(0, 0, 0, 0.25); box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.12); }

/* ================= photo block (all themes): a print mounted on a thick rounded block ================= */
html .card.kind-poster {
  --radius: 18px;
  --thick: 3px;
  background: #34333b;
  border-radius: var(--radius);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    0 1px 0 0 #6d6a73,
    0 2px 0 0 #4a4852,
    0 var(--thick) 0 0 #26252b;
}
html .card.kind-poster::before, html .card.kind-poster::after { display: none; }
html .card.kind-poster .card-core { padding: 0; background: transparent; box-shadow: none; border-radius: var(--radius); overflow: hidden; }
html .kind-poster .poster-photo { aspect-ratio: 3 / 4; border-radius: var(--radius); }
html .kind-poster .poster-photo::after {
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14), inset 0 1.5px 0 rgba(255, 255, 255, 0.28), inset 0 0 60px rgba(20, 16, 8, 0.16);
}

/* ================= post-it (all themes): square, handwritten, a hand-drawn underline ================= */
html .card.kind-sticky {
  --radius: 9px;
  --thick: 0.5px;
  aspect-ratio: 1;
  border-radius: var(--radius);
  background:
    radial-gradient(120% 90% at 100% 100%, rgba(150, 120, 30, 0.12), transparent 55%),
    linear-gradient(172deg, #fbf1bd 0%, #f7e7a0 70%, #f2dd8e 100%);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    inset 0 14px 10px -12px rgba(120, 96, 20, 0.14),
    0 var(--thick) 0 0 #d6c173;
}
html .card.kind-sticky::before, html .card.kind-sticky::after { display: none; }
html .card.kind-sticky .card-core { background: transparent; box-shadow: none; padding: 22px 16px 16px 19px; height: 100%; }
html .card.kind-sticky .sticky-text {
  margin: 0;
  font: 600 23px/1.02 'Caveat', 'Bradley Hand', cursive;
  letter-spacing: 0;
  color: #2b2a26;
  transform: rotate(-3deg);
  transform-origin: 0 0;
  max-width: 7.5em;
}
html .card.kind-sticky .sticky-underline {
  display: block;
  width: 58%;
  height: 8px;
  margin: 3px 0 0 30%;
  transform: rotate(-5deg);
  fill: none;
  stroke: #2b2a26;
  stroke-width: 2;
  stroke-linecap: round;
  opacity: 0.8;
}
html[data-dir] .prompt-wrap { width: min(400px, calc(100vw - 150px)); }

/* ================= the main page as a document (scales, never reflows) ================= */
.doc .card-title { margin: 0; }
html .card.kind-hero.fmt-letter .card-core { padding: 0; position: relative; overflow: hidden; -webkit-mask-image: none; mask-image: none; }
html .card.kind-hero.fmt-letter .doc {
  position: absolute;
  left: 0;
  top: 0;
  width: 640px;
  height: 828px;                       /* the card's 360 × 466 proportion */
  padding: 76px 72px 64px;
  box-sizing: border-box;
  overflow: hidden;
  transform: scale(0.5625);            /* 360 / 640 */
  transform-origin: 0 0;
  scrollbar-width: none;
}
html .card.kind-hero.fmt-letter .doc::-webkit-scrollbar { display: none; }
/* the title is the one thing that adapts: large enough to read on the table, easing to document size as you zoom in */
html .card.kind-hero .doc .card-title { font: 650 var(--doc-title, 64px)/1.04 var(--font); letter-spacing: -0.035em; color: var(--ink); margin: 0 0 12px; }
html .card.kind-hero .doc .card-subtitle { font: 500 15px/1.4 var(--font); letter-spacing: 0.01em; color: var(--ink-3); margin: 0 0 26px; }
html .card.kind-hero .doc .card-subtitle:has(+ .card-build) { margin-bottom: 6px; }
html .card.kind-hero .doc .card-build { font: 500 11px/1.3 var(--font); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); opacity: 0.7; margin: 0 0 26px; }
html .card.kind-hero .doc .card-body { font: 400 16.5px/1.66 var(--font); color: var(--ink-2); letter-spacing: -0.003em; }
html .card.kind-hero .doc .card-body p { margin: 0 0 14px; }
html .card.kind-hero .doc .card-body strong { color: var(--ink); font-weight: 600; }
html .card.kind-hero .doc .card-title::before { display: none; }
.expanded-panel .zoom-card.settled .doc { overflow: auto; }

/* ================= material dock (while a 3D object is selected): variants above materials ================= */
.material-dock {
  left: 50%;
  bottom: calc(max(26px, env(safe-area-inset-bottom)) + 62px);
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  animation: panel-in 0.28s var(--out-quint, ease) both;
}
.material-dock[hidden], .material-sub[hidden] { display: none; }
.material-bar, .material-sub { display: flex; gap: 2px; padding: 5px; border-radius: 22px; }
.material-sub { padding: 4px; border-radius: 18px; }
.material-bar button, .material-sub button {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 12px 0 7px;
  border: 0;
  border-radius: 17px;
  background: transparent;
  color: rgba(242, 244, 245, 0.8);
  font: 500 12.5px var(--font);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.material-sub button { height: 28px; padding: 0 11px; font-size: 12px; border-radius: 14px; }
.material-bar button:hover, .material-sub button:hover { background: rgba(255, 255, 255, 0.1); }
.material-bar button[aria-pressed='true'], .material-sub button[aria-pressed='true'] { background: rgba(255, 255, 255, 0.92); color: #111; }
.material-bar i { width: 18px; height: 18px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35), 0 1px 2px rgba(0, 0, 0, 0.25); }
@media (max-width: 760px) { .material-bar button span { display: none; } .material-bar button { padding: 0 8px; } }

/* settings: segmented choice (Moments folder) */
.settings-panel .seg { display: flex; gap: 2px; padding: 3px; border-radius: 12px; background: rgba(0, 0, 0, 0.25); }
/* segmented rows wrap onto a second line when their buttons don't fit */
.settings-panel .seg { flex-wrap: wrap; }
.settings-panel .seg button { flex: 1 0 auto; white-space: nowrap; padding: 0 8px; }
.settings-panel .seg.seg-wrap { flex-wrap: wrap; }
.settings-panel .range-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; font: 500 11px var(--font); color: rgba(242, 244, 245, 0.7); }
.settings-panel .range-row .range { flex: 1; }
.settings-panel .credit { margin: 8px 0 0; font: 400 10px/1.3 var(--font); color: rgba(242, 244, 245, 0.55); }
.settings-panel .credit a { color: inherit; }
.settings-panel .seg.seg-wrap button { flex: 1 0 30%; }
.settings-panel .seg button {
  flex: 1;
  height: 28px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: rgba(242, 244, 245, 0.75);
  font: 500 12px var(--font);
  cursor: pointer;
}
.settings-panel .seg button:hover { background: rgba(255, 255, 255, 0.08); }
.settings-panel .seg button[aria-pressed='true'] { background: rgba(255, 255, 255, 0.92); color: #111; }

/* the Moments cover while a 3D folder stands in for it: an invisible footprint; its prints wait hidden */
html .card.model-cover { background: transparent; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
html .card.model-cover::before, html .card.model-cover::after { display: none; }
html .card.model-cover .card-core { visibility: hidden; }
html .card.model-cover .card-chrome { display: none; }
.card.in-model { visibility: hidden; pointer-events: none; }
/* 3D objects show selection through the material bar, not a box around their footprint */
html .card.kind-model.selected, html .card.model-cover.selected { outline: none; }
/* the glass holders (corner, pocket) don't draw a selection box either */
html .card.pocket-cover.selected, html .card.corner-folder.selected { outline: none; }

/* ================= plain photos (setting): the whole image, card width, its own orientation ================= */
html[data-photos='plain'] .card.kind-polaroid {
  --radius: 16px;
  --thick: 3px;
  background: #2f2e33;
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 0 0 #67646c, 0 2px 0 0 #45434b, 0 var(--thick) 0 0 #26252b;
}
html[data-photos='plain'] .card.kind-polaroid .card-core { padding: 0; border-radius: var(--radius); overflow: hidden; }
html[data-photos='plain'] .kind-polaroid .polaroid-photo { aspect-ratio: auto; border-radius: var(--radius); }
html[data-photos='plain'] .kind-polaroid .polaroid-photo img { height: auto; filter: none; }
html[data-photos='plain'] .kind-polaroid .polaroid-photo::after { border-radius: inherit; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12), inset 0 1.5px 0 rgba(255, 255, 255, 0.25); }
html[data-photos='plain'] .kind-polaroid .polaroid-caption { display: none; }
/* square / framed (setting): the same whole image, inside a 2px white border — a print with a physical edge;
   square has (nearly) square corners, framed rounded ones */
html[data-photo-frame='square'] .card.kind-polaroid { --radius: 3px; }
html[data-photo-frame] .card.kind-polaroid {
  background: #f7f6f2;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 1px 0 0 #e2dfd7, 0 2px 0 0 #cfcbc1, 0 var(--thick) 0 0 #bdb8ad;
}
html[data-photo-frame] .card.kind-polaroid .card-core { padding: 2px; background: transparent; }
html[data-photo-frame='square'] .card.kind-polaroid .card-core { padding: 3px; }   /* (a slightly heavier border than framed) */
html[data-photo-frame] .kind-polaroid .polaroid-photo { border-radius: max(calc(var(--radius) - 2px), 1px); }
html[data-photo-frame] .kind-polaroid .polaroid-photo::after { box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.18); }
.settings-panel .range { width: 100%; accent-color: #f2f4f5; }
/* cards tucked under another card keep their content (it's paper, not a faded pile) */
.card.in-pile.in-paper .card-core > * { opacity: 1; }
/* photos resting in a 3D folder look exactly as they do anywhere else: no change when they land */
.card.in-pile.in-split .card-core > * { opacity: 1; }

/* no hover/selection button on cards: hovering shows what a card does instead */
html .card .card-chrome { display: none; }

/* section labels share one line (set per frame in main.js) */
.group-title { transform: translateY(var(--title-dy, 0px)); }

/* label colour swatches (settings) */
.settings-panel .swatches { display: flex; gap: 8px; }
.settings-panel .swatches button {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 0;
  padding: 0;
  cursor: pointer;
  background: var(--sw);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18), 0 0 0 0 rgba(255, 255, 255, 0);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.settings-panel .swatches button:hover { transform: scale(1.08); }
.settings-panel .swatches button[aria-pressed='true'] { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18), 0 0 0 2px rgba(255, 255, 255, 0.9); }

/* About row: the other cards fade away while you step through (buttons, arrow keys, or a click on a card) */
.group, #links { transition: opacity 0.3s ease; }
.card.carousel-away { pointer-events: none; }
html.in-carousel .group, html.in-carousel #links { opacity: 0; }
.carousel-nav {
  position: fixed;
  left: 50%;
  bottom: 28px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px;
  border-radius: 999px;
  transform: translate(-50%, 0);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
html:not(.in-carousel) .carousel-nav { opacity: 0; pointer-events: none; transform: translate(-50%, 12px); }
.carousel-nav button {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: transparent;
  color: inherit;
  cursor: pointer;
  transition: opacity 0.2s, background 0.2s;
}
.carousel-nav button:hover { background: rgba(255, 255, 255, 0.35); }
.carousel-nav button:disabled { opacity: 0.25; cursor: default; background: transparent; }
.carousel-nav svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.carousel-nav .count { min-width: 44px; text-align: center; font-size: 13px; font-variant-numeric: tabular-nums; opacity: 0.7; }
html.is-expanded .carousel-nav { display: none; }
/* the zoom view's gallery arrows (a photo from the open Moments grid) */
html.is-expanded .expanded.has-gallery .gallery-nav { display: flex; opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }
.expanded:not(.has-gallery) .gallery-nav { display: none; }
.gallery-caption {
  position: fixed;
  left: 50%;
  bottom: 84px;
  margin: 0;
  transform: translateX(-50%);
  font-size: clamp(22px, 3.2vw, 34px);
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
}
.expanded:not(.has-gallery) .gallery-caption { display: none; }

/* ---------- light clock (the time of day drives the light): top right, scroll to move through the day ----------
   a Braun wall clock after Dieter Rams: white face in a thin grey bezel, black marks and hands, a yellow hand */
.light-clock {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 30;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #f6f5f1;
  border: 2px solid #d9d7d0;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.9),
    inset 0 -2px 4px rgba(0, 0, 0, 0.05),
    0 1px 0 rgba(255, 255, 255, 0.6),
    var(--lsx, 4px) var(--lsy, 6px) 14px rgba(24, 30, 36, 0.18);
  cursor: ns-resize;
  outline: none;
}
.light-clock:focus-visible { border-color: #b9b6ad; }
.light-clock svg { width: 72px; height: 72px; overflow: visible; }
.light-clock svg circle { stroke: none; }        /* (the HUD's icon strokes don't apply to the dial) */
.light-clock .c-face { fill: none; }
.light-clock .t-m { stroke: #9a9892; stroke-width: 0.3; }
.light-clock .t-h { stroke: #1b1b1a; stroke-width: 1.35; }
.light-clock .c-hour, .light-clock .c-min { stroke: #1b1b1a; stroke-linecap: butt; }
.light-clock .c-hour { stroke-width: 2.3; }
.light-clock .c-min { stroke-width: 1.5; }
.light-clock .c-light line { stroke: #f2b21b; stroke-width: 0.8; }
.light-clock .c-light circle { fill: #f2b21b; }
.light-clock.night .c-light line { stroke: #9fb6d8; }
.light-clock.night .c-light circle { fill: #9fb6d8; }
.light-clock .c-pin { fill: #1b1b1a; }
.light-clock .c-read {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  font: 500 11px var(--font);
  letter-spacing: 0.02em;
  color: rgba(40, 46, 52, 0.72);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}
.light-clock:hover .c-read, .light-clock:focus-visible .c-read { opacity: 1; }
.light-clock.paused .c-light { opacity: 0.35; }

/* the 3D desk clock (Braun, after Dieter Rams) takes over: the HUD clock steps aside; hovering it shows the time */
.light-clock { display: none !important; }   /* (the 3D desk clock is the control; the HUD one never shows) */
html .card.kind-model.desk-clock { cursor: ns-resize; }
html .card.kind-model.desk-clock::after {
  display: block;
  content: attr(data-time);
  position: absolute;
  left: 50%;
  top: calc(100% + 10px);
  transform: translateX(-50%);
  font: 500 13px var(--font);
  color: rgba(40, 46, 52, 0.7);
  white-space: nowrap;
  background: none;
  mix-blend-mode: normal;
  opacity: 0;
  transition: opacity 0.2s ease;
}
html .card.kind-model.desk-clock:hover::after { opacity: 1; }

/* ================= app icons (launchers): a black glass tile with two letters, the full name underneath ================= */
html .card.kind-launcher {
  --radius: 19px;                   /* main.js LAUNCHER_RADIUS */
  aspect-ratio: 1;
  border-radius: var(--radius);
  background: var(--tile, linear-gradient(160deg, #2a2d30 0%, #151719 55%, #0c0d0e 100%));
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  overflow: visible;
  cursor: pointer;
}
html .card.kind-launcher::before, html .card.kind-launcher::after, html .card.kind-launcher .card-chrome { display: none; }
html .card.kind-launcher .card-core { padding: 0; background: transparent; box-shadow: none; height: 100%; display: grid; place-items: center; }
.launcher-glyph {
  font: 800 30px/1 var(--font);
  letter-spacing: -0.035em;
  color: #fff;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.launcher-mark { width: 68%; display: block; transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1); }
html .card.kind-launcher:hover .launcher-glyph, html .card.kind-launcher:hover .launcher-mark { transform: scale(1.06); }
.launcher-name {
  position: absolute;
  left: 50%;
  top: calc(100% + 10px);
  transform: translateX(-50%);
  white-space: nowrap;
  font: 500 15px/1.2 var(--font);
  letter-spacing: -0.01em;
  color: var(--ink-2, #4a5058);
}
.launcher-soon {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translate(-50%, 6px);
  padding: 6px 11px;
  border-radius: 999px;
  background: rgba(28, 30, 33, 0.88);
  color: #fff;
  font: 500 12px/1 var(--font);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
html .card.kind-launcher.soon-on .launcher-soon { opacity: 1; transform: translate(-50%, 0); }
html .card.links-out { cursor: pointer; }
.group .group-title { transition: opacity 0.35s ease; }
.group.carousel-away .group-title { opacity: 0; }
