:root {
  /* Apple-inspired cool neutrals */
  --bg: #f5f5f7;
  --card: #ffffff;
  --card-hover: #ffffff;
  --ink: #1d1d1f;
  --ink-dim: #6e6e73;
  --ink-faint: #86868b;

  /* single accent — a clear, refined blue */
  --blue: #0071e3;
  --blue-bright: #4a9eff;

  --line: #d2d2d7;
  --line-soft: rgba(0,0,0,.07);

  --radius-lg: 20px;
  --radius-md: 14px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.04), 0 6px 16px -8px rgba(0,0,0,.08);
  --shadow: 0 8px 30px -6px rgba(0,0,0,.12);

  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "Segoe UI", Roboto, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(.4,0,.2,1);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-optical-sizing: auto;                 /* §15: let the system font size its shapes optically */
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;  /* §1: no grey tap flash — feedback is ours to design */
  position: relative;
  min-height: 100vh;
}

a { color: inherit; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ---------- ambient background ---------- */
/* §14: calm, static blooms — no full-viewport looping motion */
.gate-bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.gate-bg .orb {
  position: absolute; border-radius: 50%; filter: blur(100px); opacity: .14;
}
.gate-bg .orb-a {
  width: 48vw; height: 48vw; top: -18vw; left: -12vw;
  background: radial-gradient(circle, var(--blue-bright), transparent 70%);
}
.gate-bg .orb-b {
  width: 42vw; height: 42vw; bottom: -18vw; right: -14vw;
  background: radial-gradient(circle, #8fb3d9, transparent 70%);
}
.gate-bg.subtle .orb { opacity: .07; }
.gate-bg .grain { display: none; }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes shake {
  10%,90% { transform: translateX(-1px); }
  20%,80% { transform: translateX(2px); }
  30%,50%,70% { transform: translateX(-4px); }
  40%,60% { transform: translateX(4px); }
}

/* ---------- gate (login) ---------- */
.gate-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
}
.gate-card {
  width: 100%; max-width: 400px; text-align: center;
  background: rgba(255,255,255,.72);
  border: 1px solid rgba(255,255,255,.6);
  border-radius: 26px;
  backdrop-filter: saturate(180%) blur(30px);
  -webkit-backdrop-filter: saturate(180%) blur(30px);
  box-shadow: var(--shadow);
  padding: 3rem 2.5rem;
  animation: rise .6s var(--ease) both;
}
.gate-card.has-error { animation: rise .6s var(--ease) both, shake .5s ease .1s; }

.gate-mark { width: 50px; margin: 0 auto 1.5rem; color: var(--blue); }
.gate-mark svg { width: 100%; display: block; }
.gate-card h1 {
  font-family: var(--font-display); font-weight: 600; font-size: 1.95rem;
  letter-spacing: -.022em; margin: 0 0 2rem;
}
.gate-tagline { color: var(--ink-dim); font-size: .95rem; margin: 0 0 2.25rem; }

.gate-form .field { position: relative; margin-bottom: .85rem; }
.gate-form input {
  width: 100%; padding: 14px 46px 14px 16px; font-size: 1rem;
  background: #fff; border: 1px solid var(--line);
  border-radius: 12px; color: var(--ink); font-family: inherit;
  transition: border-color .2s, box-shadow .2s;
}
.gate-form input::placeholder { color: var(--ink-faint); }
.gate-form input:focus {
  outline: none; border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(10,113,227,.16);
}
.gate-form input:disabled { opacity: .5; }

.field-toggle {
  position: absolute; right: 7px; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  background: none; border: none; color: var(--ink-faint); cursor: pointer;
  border-radius: 8px; transition: color .2s, background .2s;
}
.field-toggle:hover { color: var(--blue); background: rgba(0,0,0,.04); }
.field-toggle svg { width: 19px; height: 19px; }

.gate-submit {
  width: 100%; padding: 13px; margin-top: .4rem; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: .5rem;
  font-family: inherit; font-size: 1rem; font-weight: 500; color: #fff;
  background: var(--blue);
  border-radius: 12px; transition: background .2s, transform .2s var(--ease), box-shadow .25s;
}
.gate-submit:hover:not(:disabled) { background: #0a5fc0; transform: translateY(-1px); box-shadow: 0 10px 24px -12px rgba(10,113,227,.7); }
.gate-submit:active:not(:disabled) { transform: translateY(0); }
.gate-submit:disabled { opacity: .45; cursor: not-allowed; }
.gate-submit svg { width: 18px; height: 18px; transition: transform .25s; }
.gate-submit:hover:not(:disabled) svg { transform: translateX(3px); }

.gate-error { color: #d0362a; font-size: .87rem; margin: 1rem 0 0; }
.gate-footnote { color: var(--ink-faint); font-size: .78rem; margin: 2rem 0 0; }

/* ---------- shared chrome (topbar / footer) ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: .9rem clamp(1.25rem, 4vw, 2.75rem);
  position: sticky; top: 0; z-index: 20;
  background: rgba(245,245,247,.7);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  /* §12: scroll edge effect — hairline appears only once content slides underneath */
  border-bottom: 1px solid transparent;
  transition: border-color .3s var(--ease), background .3s var(--ease);
}
.topbar.is-scrolled {
  border-bottom-color: var(--line-soft);
  background: rgba(245,245,247,.82);
}
.brand { display: flex; align-items: center; gap: .65rem; }
.brand-mark { width: 28px; color: var(--blue); }
.brand-mark svg { width: 100%; display: block; }
.brand-text { font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; letter-spacing: -.02em; }

.logout-link {
  display: inline-flex; align-items: center; gap: .5rem; text-decoration: none;
  color: var(--ink-dim); font-size: .85rem; padding: .5rem 1rem;
  border: 1px solid var(--line); border-radius: 999px; transition: color .2s, border-color .2s, background .2s;
}
.logout-link:hover { color: var(--ink); border-color: var(--ink-faint); background: rgba(0,0,0,.03); }
.logout-link svg { width: 16px; height: 16px; }

.dash-footer, .browse-main + .dash-footer {
  text-align: center; color: var(--ink-faint); font-size: .78rem;
  padding: 2.5rem 1rem 3.5rem; position: relative; z-index: 2;
}

/* ---------- dashboard ---------- */
.dash-main { max-width: 1200px; margin: 0 auto; padding: 2rem clamp(1.25rem, 4vw, 2.75rem) 4rem; position: relative; z-index: 2; }
.dash-intro { animation: rise .6s var(--ease) both; }
.dash-intro h1 { font-family: var(--font-display); font-weight: 600; font-size: clamp(2.1rem, 4vw, 3rem); margin: .4rem 0 .55rem; letter-spacing: -.025em; text-wrap: balance; }
.dash-intro p { color: var(--ink-dim); max-width: none; line-height: 1.55; font-size: 1.08rem; margin: 0; }

.dash-layout {
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 1.5rem; align-items: stretch; margin-top: 2.75rem;
}
.dash-side { display: flex; flex-direction: column; gap: 1.5rem; }
.dash-side .card { flex: 1; }
.tree-col { display: flex; flex-direction: column; animation: rise .6s var(--ease) both; }

.card {
  position: relative; display: flex; align-items: center; gap: 1.1rem;
  background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--radius-lg);
  padding: 1.6rem 1.85rem; text-decoration: none; color: inherit;
  box-shadow: var(--shadow-sm);
  animation: rise .6s var(--ease) both; animation-delay: var(--delay, 0s);
  transition: transform .35s var(--ease), box-shadow .35s var(--ease);
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.card-visual-icon {
  flex: none; width: 54px; height: 54px; border-radius: 15px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(150deg, var(--blue-bright), var(--blue)); color: #fff;
  box-shadow: 0 6px 16px -6px rgba(10,113,227,.55);
}
.card-visual-icon svg { width: 25px; height: 25px; }
.card h3 { flex: 1; font-family: var(--font-display); font-weight: 600; font-size: 1.22rem; margin: 0; letter-spacing: -.018em; padding-right: 2.4rem; }
.dash-side .card { background: linear-gradient(180deg, #ffffff, #fcfbf8); }
.card-arrow {
  position: absolute; top: 50%; right: 1.6rem; transform: translateY(-50%);
  width: 32px; height: 32px; flex: none; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; color: var(--ink-faint);
  background: rgba(0,0,0,.04);
  transition: transform .3s var(--ease), color .3s, background .3s;
}
.card-arrow svg { width: 15px; height: 15px; }
.card:hover .card-arrow { transform: translateY(-50%) translateX(3px); color: #fff; background: var(--blue); }

.tree-feature {
  position: relative; flex: 1; display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--radius-lg);
  padding: clamp(1.85rem, 3vw, 2.75rem); text-decoration: none; color: inherit; overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform .35s var(--ease), box-shadow .35s var(--ease);
}
.tree-feature:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
/* lightweight, self-contained tree illustration (§16 craft; no external loads) */
.tree-preview {
  position: relative; flex: 1; min-height: 300px; margin-bottom: 1.5rem;
  display: flex; align-items: center; justify-content: center;
  padding: clamp(1.25rem, 3vw, 2.25rem);
  border-radius: var(--radius-md); overflow: hidden;
  background:
    radial-gradient(circle at 50% 38%, rgba(10,113,227,.08), transparent 62%),
    linear-gradient(180deg, #fbfbfc, #eef0f2);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.05);
}
.tree-mini {
  width: 100%; max-width: 400px; height: auto; position: relative; z-index: 1;
  transition: transform .5s var(--ease);
}
.tree-feature:hover .tree-mini { transform: scale(1.025); }
.tree-preview-badge {
  position: absolute; right: 14px; bottom: 14px; z-index: 2;
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; color: #fff;
  background: linear-gradient(150deg, var(--blue-bright), var(--blue));
  box-shadow: 0 8px 20px -6px rgba(10,113,227,.6);
  transition: transform .35s var(--ease);
}
.tree-preview-badge svg { width: 18px; height: 18px; }
.tree-feature:hover .tree-preview-badge { transform: translateX(3px) scale(1.05); }

.tree-feature-body { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.tree-feature-body h2 {
  font-family: var(--font-display); font-weight: 600; font-size: 1.55rem;
  margin: .1rem 0 0; letter-spacing: -.022em;
}
.tree-feature-cta {
  flex: none; display: inline-flex; align-items: center; gap: .35rem;
  font-weight: 500; color: var(--blue); font-size: .95rem;
  padding: .5rem .95rem; border-radius: 999px; background: rgba(10,113,227,.1);
  transition: background .25s, color .25s;
}
.tree-feature-cta svg { width: 16px; height: 16px; transition: transform .3s var(--ease); }
.tree-feature:hover .tree-feature-cta { background: var(--blue); color: #fff; }
.tree-feature:hover .tree-feature-cta svg { transform: translateX(3px); }

.tree-feature-external { font-size: .84rem; margin: 1rem .2rem 0; }
.tree-feature-external a { color: var(--ink-faint); text-decoration: none; transition: color .2s; }
.tree-feature-external a:hover { color: var(--blue); }

.card-eyebrow { display: block; text-transform: uppercase; letter-spacing: .07em; font-size: .72rem; font-weight: 600; color: var(--blue); margin-bottom: .35rem; }

/* ---------- browse ---------- */
.browse-main { max-width: 1240px; margin: 0 auto; padding: 2rem clamp(1.25rem, 4vw, 2.75rem) 4rem; position: relative; z-index: 2; }

.back-link {
  display: inline-flex; align-items: center; gap: .45rem; text-decoration: none;
  color: var(--ink-dim); font-size: .9rem; margin-bottom: 1.5rem; transition: color .2s;
}
.back-link svg { width: 16px; height: 16px; transition: transform .2s var(--ease); }
.back-link:hover { color: var(--blue); }
.back-link:hover svg { transform: translateX(-3px); }

.breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; font-size: .92rem; margin-bottom: 2rem; }
.crumb { text-decoration: none; color: var(--ink-dim); transition: color .2s; }
.crumb:hover { color: var(--blue); }
.crumb.current { color: var(--ink); font-weight: 500; }
.crumb-sep { color: var(--ink-faint); }

.empty-state { text-align: center; padding: 5rem 1rem; color: var(--ink-dim); }
.empty-state svg { width: 46px; height: 46px; color: var(--ink-faint); margin-bottom: 1.1rem; }
.empty-state p { margin: 0; }
.empty-state .empty-sub { font-size: .85rem; color: var(--ink-faint); margin-top: .3rem; }

.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1.1rem; }
.tile {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: .7rem;
  padding: 1.7rem 1.4rem; background: var(--card); border: 1px solid var(--line-soft);
  border-radius: var(--radius-md); text-decoration: none; color: inherit;
  box-shadow: var(--shadow-sm);
  transition: transform .3s var(--ease), box-shadow .3s var(--ease);
}
.tile:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.tile-locked { position: relative; opacity: .62; cursor: not-allowed; }
.tile-locked:hover { transform: none; box-shadow: var(--shadow-sm); }
.tile-locked .tile-icon { filter: grayscale(1); }
.tile-lock {
  position: absolute; top: 10px; right: 10px; width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--card); color: var(--ink-dim); box-shadow: var(--shadow-sm);
}
.tile-lock svg { width: 12px; height: 12px; }
.tile-icon { width: 46px; height: 46px; border-radius: 13px; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.045); color: var(--ink-dim); }
.tile-icon svg { width: 22px; height: 22px; }
.tile-name { font-size: .88rem; font-weight: 500; color: var(--ink); max-width: 100%; word-break: break-word; }
.tile-meta { font-size: .73rem; color: var(--ink-faint); }

.tile[data-kind="folder"] .tile-icon { background: rgba(10,113,227,.12); color: var(--blue); }
.tile[data-kind="pdf"] .tile-icon { background: rgba(224,90,90,.12); color: #d0453e; }
.tile[data-kind="image"] .tile-icon { background: rgba(0,113,227,.12); color: #0071e3; }
.tile[data-kind="doc"] .tile-icon { background: rgba(0,113,227,.12); color: #0071e3; }
.tile[data-kind="sheet"] .tile-icon { background: rgba(40,160,90,.13); color: #1e9e57; }
.tile[data-kind="slide"] .tile-icon { background: rgba(230,140,60,.14); color: #db7a1e; }
.tile[data-kind="archive"] .tile-icon { background: rgba(150,110,200,.13); color: #7d55c7; }
.tile[data-kind="web"] .tile-icon { background: rgba(60,160,160,.13); color: #2a9d9d; }
.tile[data-kind="text"] .tile-icon { background: rgba(0,0,0,.06); color: #86868b; }
.tile[data-kind="markdown"] .tile-icon { background: rgba(150,110,200,.13); color: #7d55c7; }
.tile[data-kind="gdrive"] .tile-icon { background: rgba(15,157,88,.13); color: #0f9d58; }

.file-grid-compact { margin-bottom: 2.5rem; }

/* ---------- photo gallery (Albums photos) ---------- */
.gallery { display: grid; grid-template-columns: 100px minmax(0, 1fr); gap: 2rem; align-items: start; }
.gallery-index {
  position: sticky; top: 5.5rem; display: flex; flex-direction: column; gap: .55rem;
  max-height: calc(100vh - 7rem); overflow-y: auto; padding-right: .5rem;
}
.gallery-index a {
  font-size: .82rem; color: var(--ink-faint); text-decoration: none; white-space: nowrap;
  padding: .15rem 0; border-left: 2px solid transparent; padding-left: .6rem; transition: color .2s, border-color .2s;
}
.gallery-index a:hover { color: var(--blue); border-left-color: var(--blue); }

.gallery-group { scroll-margin-top: 5.5rem; margin-bottom: 2.5rem; }
.gallery-group-title {
  font-family: var(--font-display); font-weight: 600; font-size: 1.15rem;
  letter-spacing: -.015em; color: var(--ink); margin: 0 0 1rem;
}
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; }
.gallery-thumb {
  position: relative; display: block; aspect-ratio: 1; border-radius: 12px; overflow: hidden;
  background: var(--card); box-shadow: var(--shadow-sm);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.gallery-thumb:hover { transform: scale(1.03); box-shadow: var(--shadow); z-index: 1; }
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-thumb-flag {
  position: absolute; right: 8px; bottom: 8px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--blue); box-shadow: 0 0 0 2px rgba(255,255,255,.85);
}

@media (max-width: 720px) {
  .gallery { grid-template-columns: 1fr; }
  .gallery-index {
    position: static; flex-direction: row; overflow-x: auto; overflow-y: visible;
    max-height: none; gap: 1rem; padding: 0 0 .5rem; margin-bottom: 1rem;
    border-bottom: 1px solid var(--line-soft);
  }
  .gallery-index a { border-left: 0; border-bottom: 2px solid transparent; padding: 0 0 .4rem; }
  .gallery-index a:hover { border-bottom-color: var(--blue); }
}

/* ---------- markdown document view ---------- */
.doc-main { max-width: 1040px; margin: 0 auto; padding: 2rem clamp(1.25rem, 4vw, 2.75rem) 5rem; position: relative; z-index: 2; }
.doc-card {
  background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--radius-lg);
  padding: clamp(1.75rem, 5vw, 3.5rem); box-shadow: var(--shadow-sm);
  animation: rise .5s var(--ease) both;
}
.doc-meta { color: var(--ink-faint); font-size: .8rem; margin: 0 0 .5rem; text-transform: uppercase; letter-spacing: .06em; }
.doc-title {
  font-family: var(--font-display); font-weight: 600; font-size: clamp(1.8rem, 4vw, 2.5rem);
  letter-spacing: -.024em; margin: 0 0 1.75rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--line);
  text-wrap: balance;
}

/* ---------- embedded PDF viewer ---------- */
/* No max-width override here: the PDF page keeps the exact same margins as
   the markdown view (.doc-main's 1040px) — only the content inside the frame
   (via the iframe's "#view=FitH" open parameter) is meant to display larger. */
.pdf-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.pdf-head .back-link { margin-bottom: 0; }
.pdf-open { display: inline-flex; align-items: center; gap: .45rem; text-decoration: none; color: var(--blue); font-size: .9rem; font-weight: 500; }
.pdf-open svg { width: 16px; height: 16px; }
.pdf-open:hover { text-decoration: underline; text-underline-offset: 3px; }
.pdf-title { margin: 0 0 1.1rem; padding-bottom: 0; border-bottom: 0; }
.pdf-viewer {
  height: 90vh; min-height: 620px;
  background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--radius-lg);
  overflow: hidden; box-shadow: var(--shadow-sm);
}
.pdf-viewer iframe { width: 100%; height: 100%; border: 0; display: block; }

/* iOS/Android can't scroll a PDF inside an <iframe>, so on touch devices we
   swap the embed for a big button that opens the native full-screen viewer. */
.pdf-touch { display: none; }
@media (pointer: coarse) {
  .pdf-viewer { display: none; }
  .pdf-touch {
    display: flex; flex-direction: column; align-items: center; text-align: center; gap: .5rem;
    padding: 2.75rem 1.5rem; text-decoration: none; color: inherit;
    background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
  }
  .pdf-touch svg { width: 40px; height: 40px; color: var(--blue); margin-bottom: .3rem; }
  .pdf-touch-t { font-family: var(--font-display); font-weight: 600; font-size: 1.2rem; color: var(--blue); }
  .pdf-touch-s { font-size: .88rem; color: var(--ink-dim); }
  .pdf-touch:active { transform: scale(.99); }
}

/* ---------- photo detail view ---------- */
.photo-main { max-width: 980px; }
.photo-card { margin: 0; }
.photo-full {
  display: block; width: 100%; max-height: 78vh; object-fit: contain;
  border-radius: var(--radius-lg); background: var(--card); box-shadow: var(--shadow-sm);
}
.photo-info { padding: 1.1rem .2rem 0; }
.photo-caption { font-size: 1.05rem; color: var(--ink); margin: 0 0 .3rem; line-height: 1.5; }
.photo-date { font-size: .85rem; color: var(--ink-faint); margin: 0; }

.prose { color: var(--ink); line-height: 1.72; font-size: 1.05rem; }
.prose h1, .prose h2, .prose h3, .prose h4 {
  font-family: var(--font-display); font-weight: 600; letter-spacing: -.02em; color: var(--ink);
  margin: 2em 0 .6em; text-wrap: balance;
}
.prose h1 { font-size: 1.6rem; }
.prose h2 { font-size: 1.35rem; }
.prose h3 { font-size: 1.15rem; }
.prose h1:first-child, .prose h2:first-child, .prose h3:first-child { margin-top: 0; }
.prose p { margin: 0 0 1.15em; color: var(--ink); }
.prose a { color: #0071e3; text-decoration: none; }
.prose a:hover { text-decoration: underline; text-underline-offset: 3px; }
.prose strong { color: var(--ink); font-weight: 600; }
.prose ul, .prose ol { margin: 0 0 1.15em; padding-left: 1.4em; }
.prose li { margin: .35em 0; }
.prose blockquote {
  margin: 1.4em 0; padding: .3em 1.3em; border-left: 3px solid var(--blue);
  color: var(--ink-dim); background: rgba(0,0,0,.02); border-radius: 0 10px 10px 0;
}
.prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .87em;
  background: rgba(0,0,0,.05); padding: .15em .4em; border-radius: 5px; color: #0a58ca;
}
.prose pre {
  background: #1d1d1f; border: 1px solid var(--line); border-radius: 12px; padding: 1.1em 1.3em;
  overflow-x: auto; margin: 1.4em 0;
}
.prose pre code { background: none; padding: 0; color: #f5f5f7; font-size: .85em; }
.prose img { max-width: 100%; height: auto; border-radius: 12px; margin: 1.2em 0; display: block; }
.prose hr { border: none; border-top: 1px solid var(--line); margin: 2.2em 0; }
.prose table { width: 100%; border-collapse: collapse; margin: 1.4em 0; font-size: .95em; }
.prose th, .prose td { text-align: left; padding: .6em .8em; border-bottom: 1px solid var(--line); }
.prose th { color: var(--ink); font-weight: 600; }

/* ---------- press feedback (§1, §10: respond on pointer-down, instantly) ---------- */
.card, .tile, .tree-feature, .logout-link, .back-link, .crumb { -webkit-tap-highlight-color: transparent; }
.card:active, .tile:active, .tree-feature:active {
  transform: scale(.985); transition-duration: .1s;
}
.logout-link:active, .field-toggle:active { transform: scale(.96); transition-duration: .1s; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .dash-layout { grid-template-columns: 1fr; gap: 1.5rem; }
  .tree-preview { min-height: 240px; }
}

@media (max-width: 560px) {
  .gate-card { padding: 2.5rem 1.6rem; border-radius: 22px; }
  .logout-link span { display: none; }
  .card { padding: 1.4rem 1.5rem; }
  .tree-feature { padding: 1.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* §14: reduced transparency — make frosted materials frostier/solid, drop the blur */
@media (prefers-reduced-transparency: reduce) {
  .topbar { background: #f5f5f7; backdrop-filter: none; -webkit-backdrop-filter: none; }
  .topbar.is-scrolled { background: #f0f0f2; }
  .gate-card { background: #fff; backdrop-filter: none; -webkit-backdrop-filter: none; border-color: var(--line); }
  .gate-bg { display: none; }
}

/* §14: increased contrast — near-solid grounds and defined, contrasting borders */
@media (prefers-contrast: more) {
  :root { --ink-dim: #4a4a4d; --ink-faint: #66666a; --line-soft: rgba(0,0,0,.25); }
  .card, .tile, .tree-feature, .doc-card { border-color: var(--line); }
  .topbar.is-scrolled { border-bottom-color: var(--line); }
  .card-arrow { border: 1px solid var(--line); }
}
