:root {
  color-scheme: dark;
  --background: #090b0f;
  --surface: #11151b;
  --surface-raised: #151a22;
  --line: #29303b;
  --line-strong: #3b4655;
  --text: #f5f7fa;
  --muted: #98a2b2;
  --accent: #9de8cb;
  --accent-strong: #c1f4e1;
  --accent-ink: #08281d;
  --danger: #fda4af;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--background); }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 50% -20%, rgba(86, 211, 163, .11), transparent 38rem),
    var(--background);
}
button, a, summary { font: inherit; }
button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 3px solid rgba(167, 243, 208, .42);
  outline-offset: 4px;
}

.picker-page { display: grid; place-items: center; }
.picker-shell {
  display: grid;
  width: min(44rem, calc(100% - 2rem));
  min-height: 100dvh;
  place-content: center;
  justify-items: stretch;
  gap: 1.25rem;
  padding:
    max(2rem, env(safe-area-inset-top))
    max(1rem, env(safe-area-inset-right))
    max(2rem, env(safe-area-inset-bottom))
    max(1rem, env(safe-area-inset-left));
}
.folder-stage {
  position: relative;
  isolation: isolate;
  width: 14.5rem;
  max-width: 100%;
  min-height: 3.65rem;
  justify-self: center;
}
.idle-pet {
  position: absolute;
  z-index: 1;
  left: 50%;
  bottom: 2.55rem;
  width: 6.25rem;
  aspect-ratio: 4 / 3;
  pointer-events: none;
  opacity: 0;
  transform: translate3d(-50%, 3.45rem, 0) scale(.95);
  transform-origin: 50% 100%;
  transition:
    transform .9s cubic-bezier(.36, 0, .2, 1),
    opacity .68s ease;
}
.folder-stage.pet-visible .idle-pet {
  opacity: 1;
  transform: translate3d(-50%, 0, 0) scale(1);
  transition-duration: 1.42s, 1.04s;
  transition-timing-function: cubic-bezier(.2, .72, .18, 1), ease;
}
.idle-pet svg { display: block; width: 100%; height: auto; overflow: visible; }
.idle-pet-presence { transform-origin: 64px 84px; }
.idle-pet-head { transform-origin: 64px 60px; }
.idle-pet-ear {
  fill: #18241f;
  stroke: #456356;
  stroke-width: 2.4;
  stroke-linejoin: round;
}
.idle-pet-ear-inner { fill: #78cdb0; opacity: .72; }
.idle-pet-face {
  fill: #17211e;
  stroke: #46665a;
  stroke-width: 2.4;
}
.idle-pet-eyes { fill: #eafff7; transform-box: fill-box; transform-origin: center; }
.idle-pet-pupils { fill: #10241d; }
.idle-pet-glint { fill: #fff; opacity: .9; }
.idle-pet-cheek { fill: #d8a6a5; opacity: .33; }
.idle-pet-paws {
  position: absolute;
  z-index: 3;
  top: -.58rem;
  left: 50%;
  width: 6.25rem;
  pointer-events: none;
  opacity: 0;
  transform: translate3d(-50%, -.82rem, 0) scale(.9);
  transform-origin: 50% 100%;
  transition:
    transform .82s cubic-bezier(.36, 0, .2, 1),
    opacity .6s ease;
  transition-delay: .12s, .12s;
}
.folder-stage.pet-visible .idle-pet-paws {
  opacity: 1;
  transform: translate3d(-50%, 0, 0) scale(1);
  transition-duration: 1.18s, .86s;
  transition-delay: .16s, .16s;
  transition-timing-function: cubic-bezier(.2, .72, .18, 1), ease;
}
.idle-pet-paws svg { display: block; width: 100%; height: auto; overflow: visible; }
.idle-pet-paw {
  fill: #17211e;
  stroke: #46665a;
  stroke-width: 2.4;
}
.idle-pet-toes {
  fill: none;
  stroke: #8bcfb7;
  stroke-width: 1.5;
  stroke-linecap: round;
  opacity: .74;
}
.folder-stage.pet-visible .idle-pet-presence {
  animation: idle-pet-breathe 4.8s ease-in-out infinite;
}
.folder-stage.pet-visible .idle-pet-head {
  animation: idle-pet-look 11s ease-in-out infinite;
}
.folder-stage.pet-visible .idle-pet-pupils {
  animation: idle-pet-gaze 11s ease-in-out infinite;
}
.folder-stage.pet-visible .idle-pet-eyes {
  animation: idle-pet-blink 7.2s ease-in-out infinite;
}
@keyframes idle-pet-breathe {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-1.5px); }
}
@keyframes idle-pet-look {
  0%, 18%, 100% { transform: rotate(0deg) translateX(0); }
  28%, 43% { transform: rotate(1.8deg) translateX(1px); }
  55%, 68% { transform: rotate(-1.6deg) translateX(-1px); }
  80%, 92% { transform: rotate(.6deg) translateX(0); }
}
@keyframes idle-pet-gaze {
  0%, 18%, 100% { transform: translateX(0); }
  28%, 43% { transform: translateX(2.4px); }
  55%, 68% { transform: translateX(-2.4px); }
  80%, 92% { transform: translateX(.8px); }
}
@keyframes idle-pet-blink {
  0%, 43%, 46%, 78%, 81%, 100% { transform: scaleY(1); }
  44.4%, 79.4% { transform: scaleY(.08); }
}
#chooseFolder {
  position: relative;
  z-index: 2;
  width: 100%;
  min-height: 3.65rem;
  padding: .85rem 1.35rem;
  border: 1px solid rgba(193, 244, 225, .62);
  border-radius: 1rem;
  color: var(--accent-ink);
  background: linear-gradient(135deg, var(--accent-strong), var(--accent));
  box-shadow:
    0 1rem 3.2rem rgba(0, 0, 0, .3),
    inset 0 1px rgba(255, 255, 255, .32);
  font-size: 1rem;
  font-weight: 760;
  letter-spacing: .006em;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform .24s ease, border-color .24s ease, box-shadow .24s ease;
}
#chooseFolder:hover {
  transform: translateY(-1px);
  border-color: rgba(223, 255, 243, .92);
  box-shadow:
    0 1.2rem 3.6rem rgba(0, 0, 0, .34),
    inset 0 1px rgba(255, 255, 255, .4);
}
#chooseFolder:active { transform: translateY(0); }
#chooseFolder:disabled { cursor: wait; opacity: .6; transform: none; }
#status {
  width: 100%;
  min-height: 1.5rem;
  margin: 0;
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.5;
  text-align: center;
}
#status.error { color: var(--danger); }

.excluded-details {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: .8rem;
  background: rgba(17, 21, 27, .88);
  overflow: clip;
}
.excluded-details summary {
  display: flex;
  min-height: 2.75rem;
  align-items: center;
  padding: .7rem .9rem;
  color: var(--accent);
  font-size: .78rem;
  font-weight: 750;
  cursor: pointer;
  touch-action: manipulation;
}
.excluded-details summary::marker { content: ""; }
.excluded-details summary::-webkit-details-marker { display: none; }
.excluded-details summary::before {
  width: 1.2rem;
  content: "+";
  color: var(--muted);
  font: 700 .9rem ui-monospace, SFMono-Regular, Consolas, monospace;
}
.excluded-details[open] summary::before { content: "−"; }
.excluded-details summary:hover { background: rgba(167, 243, 208, .05); }
.excluded-groups {
  max-height: min(26rem, 55dvh);
  border-top: 1px solid var(--line);
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.excluded-groups section { padding: .8rem .9rem; }
.excluded-groups section + section { border-top: 1px solid var(--line); }
.excluded-groups h2 {
  margin: 0 0 .55rem;
  color: var(--muted);
  font-size: .72rem;
  letter-spacing: .02em;
}
.excluded-groups ul {
  display: grid;
  gap: .35rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.excluded-groups code {
  color: #d8dee9;
  font: 11px/1.45 ui-monospace, SFMono-Regular, Consolas, monospace;
  overflow-wrap: anywhere;
}
.excluded-groups p,
.local-only-note {
  margin: .65rem 0 0;
  color: var(--muted);
  font-size: .7rem;
  line-height: 1.5;
}
.local-only-note {
  margin: 0;
  padding: .7rem .9rem;
  border-top: 1px solid var(--line);
}

.workspace-card {
  width: 100%;
  padding: clamp(1rem, 3vw, 1.5rem);
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: rgba(17, 21, 27, .96);
  box-shadow: 0 1.5rem 5rem rgba(0, 0, 0, .24);
}
.workspace-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
}
.workspace-heading span:first-child {
  color: var(--accent);
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.workspace-heading h2 {
  margin: .3rem 0 0;
  font-size: clamp(1.25rem, 5vw, 1.8rem);
  overflow-wrap: anywhere;
}
.live-state {
  padding: .36rem .58rem;
  border: 1px solid rgba(167, 243, 208, .35);
  border-radius: 999px;
  color: var(--accent);
  background: rgba(167, 243, 208, .08);
  font-size: .68rem;
  font-weight: 750;
}
.workspace-card > p {
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.55;
}
.workspace-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .55rem;
  margin: 1rem 0 1.25rem;
}
.edit-panel { border-top: 1px solid var(--line); padding-top: .5rem; }
.edit-panel summary { cursor: pointer; padding: .85rem 0; font-size: .86rem; font-weight: 650; }
.edit-panel summary span { color: var(--muted); font-size: .75rem; font-weight: 400; margin-left: .5rem; }
.edit-panel p { color: var(--muted); font-size: .8rem; line-height: 1.6; }
#copyView { border-color: var(--accent); color: var(--accent); }
#changes:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.workspace-actions a,
.workspace-actions button,
#applyChanges {
  display: grid;
  min-height: 2.75rem;
  place-items: center;
  padding: .65rem .8rem;
  border: 1px solid var(--line-strong);
  border-radius: .65rem;
  color: var(--text);
  background: var(--surface-raised);
  font-size: .76rem;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.workspace-actions a:hover,
.workspace-actions button:hover,
#applyChanges:hover {
  border-color: rgba(167, 243, 208, .58);
}
.workspace-actions a:active,
.workspace-actions button:active,
#applyChanges:active {
  transform: translateY(1px);
  filter: brightness(1.12);
}
.workspace-actions button:disabled,
#applyChanges:disabled {
  cursor: default;
  opacity: .55;
  filter: none;
  transform: none;
}
.workspace-actions button[aria-pressed="true"] {
  border-color: rgba(167, 243, 208, .7);
  color: var(--accent);
  background: rgba(167, 243, 208, .14);
}
.workspace-actions button.flash {
  border-color: rgba(167, 243, 208, .9);
  box-shadow: 0 0 0 3px rgba(167, 243, 208, .22);
  animation: agentarm-flash .9s ease-in-out;
}
.workspace-actions button.flash-error {
  border-color: rgba(255, 138, 128, .9);
  box-shadow: 0 0 0 3px rgba(255, 138, 128, .22);
}
@keyframes agentarm-flash {
  0%   { box-shadow: 0 0 0 0 rgba(167, 243, 208, .35); }
  35%  { box-shadow: 0 0 0 4px rgba(167, 243, 208, .28); }
  100% { box-shadow: 0 0 0 0 rgba(167, 243, 208, 0); }
}
.workspace-card label {
  display: block;
  margin-bottom: .5rem;
  color: var(--muted);
  font-size: .75rem;
  font-weight: 700;
}
#changes {
  width: 100%;
  min-height: 10rem;
  resize: vertical;
  padding: .85rem;
  border: 1px solid var(--line);
  border-radius: .7rem;
  color: #d8dee9;
  background: #0c0f14;
  font: 12px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace;
  tab-size: 4;
}
#changes:focus { border-color: var(--accent); }
#applyChanges {
  width: 100%;
  margin-top: .65rem;
  color: var(--accent-ink);
  background: var(--accent);
}
#applyChanges:disabled { cursor: wait; opacity: .6; }
#changeStatus {
  min-height: 1.25rem;
  margin: .65rem 0 0;
  color: var(--accent);
  font-size: .75rem;
  transition: color .25s ease;
}
#changeStatus.just-changed {
  animation: agentarm-status-fade 1.1s ease-out;
}
@keyframes agentarm-status-fade {
  0%   { opacity: 0; transform: translateY(2px); }
  18%  { opacity: 1; transform: translateY(0); }
  100% { opacity: 1; transform: translateY(0); }
}
#changeStatus.error { color: var(--danger); }

.snapshot-shell {
  width: min(96rem, calc(100% - 2rem));
  margin: 0 auto;
  padding:
    max(1.2rem, env(safe-area-inset-top))
    max(0rem, env(safe-area-inset-right))
    max(4rem, env(safe-area-inset-bottom))
    max(0rem, env(safe-area-inset-left));
}
.snapshot-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0 2rem;
}
.snapshot-header span {
  color: var(--accent);
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.snapshot-header h1 {
  margin: .32rem 0 0;
  font-size: clamp(1.45rem, 4vw, 2.65rem);
  letter-spacing: -.035em;
}
.snapshot-header nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: .8rem;
}
.snapshot-header a, .section-heading a {
  color: var(--accent);
  text-underline-offset: .22em;
}
.document-section {
  min-width: 0;
  margin-bottom: 1rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--surface);
  box-shadow: 0 1.5rem 5rem rgba(0, 0, 0, .2);
  overflow: clip;
  content-visibility: auto;
  contain-intrinsic-size: auto 60rem;
}
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface-raised);
}
.section-heading div { display: flex; align-items: center; gap: .75rem; }
.section-heading > div:first-child > span {
  display: grid;
  width: 1.8rem;
  height: 1.8rem;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: .5rem;
  color: var(--muted);
  font: 700 .64rem ui-monospace, SFMono-Regular, Consolas, monospace;
}
.section-heading h2 { margin: 0; font-size: 1rem; }
.section-heading a { font-size: .76rem; }
.resource-links { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .8rem; }
.manifest-intro {
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.6;
}
.manifest-intro p { margin: 0; }
.manifest-intro p + p { margin-top: .35rem; }
.document-links {
  margin: 0;
  padding: 0;
  list-style: none;
}
.document-links li + li { border-top: 1px solid var(--line); }
.document-links a {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  min-height: 3.25rem;
  padding: .75rem 1.15rem;
  color: var(--text);
  text-decoration: none;
}
.document-links a:hover { background: rgba(167, 243, 208, .05); }
.document-links span {
  color: var(--accent);
  font: 700 .72rem ui-monospace, SFMono-Regular, Consolas, monospace;
}
.document-links code {
  min-width: 0;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace;
  overflow-wrap: anywhere;
}
.document-links small {
  color: var(--muted);
  font-size: .7rem;
  text-align: right;
}
.document-links .media-link {
  display: block;
  min-height: 0;
  padding: .35rem 1.15rem .85rem;
  color: var(--accent);
  font-size: .78rem;
  text-decoration: underline;
  text-underline-offset: .22em;
}
.manifest-pagination {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.15rem;
  border-top: 1px solid var(--line);
}
.manifest-pagination:empty { display: none; }
.manifest-pagination a {
  color: var(--accent);
  font-size: .8rem;
  text-underline-offset: .22em;
}
pre {
  margin: 0;
  padding: clamp(1rem, 2.5vw, 1.5rem);
  color: #d8dee9;
  background: #0c0f14;
  font: 12px/1.62 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  tab-size: 4;
}

@media (max-width: 40rem) {
  .workspace-actions { grid-template-columns: 1fr; }
  .snapshot-shell { width: min(100% - .75rem, 96rem); }
  .snapshot-header { align-items: start; flex-direction: column; }
  .snapshot-header nav { justify-content: flex-start; }
  .section-heading { align-items: start; }
  .document-links a { grid-template-columns: 4.5rem minmax(0, 1fr); gap: .35rem; }
  .document-links small { grid-column: 2; text-align: left; }
}
@media (hover: none) {
  #chooseFolder:hover {
    transform: none;
    border-color: rgba(193, 244, 225, .62);
    box-shadow:
      0 1rem 3.2rem rgba(0, 0, 0, .3),
      inset 0 1px rgba(255, 255, 255, .32);
  }
  .excluded-details summary:hover { background: transparent; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .idle-pet,
  .idle-pet-paws { display: none; }
}
@media (forced-colors: active) {
  .idle-pet,
  .idle-pet-paws { display: none; }
  #chooseFolder { background: ButtonFace; color: ButtonText; }
}

/* Reading and import surfaces share the existing lightweight system fonts. */
.picker-intro { text-align: center; margin-bottom: 2.25rem; }
.eyebrow { color: var(--accent); font-size: .8rem; font-weight: 750; letter-spacing: .15em; }
.picker-intro h1 { margin: .8rem 0; font-size: clamp(1.65rem, 6vw, 2.6rem); letter-spacing: -.04em; }
.picker-intro p, .sharing-note { color: var(--muted); font-size: .9rem; line-height: 1.65; }
.picker-intro p { max-width: 34rem; margin: 0 auto; }
.agent-entry { display: grid; gap: .35rem; padding: 1rem 1.25rem; border: 1px solid var(--line); border-radius: .85rem; color: var(--accent); text-decoration: none; }
.agent-entry span { color: var(--muted); font-size: .85rem; line-height: 1.5; }
.agent-entry:hover { border-color: var(--accent); }
.agent-shell { width: min(52rem, calc(100% - 2rem)); margin: 0 auto; padding: 2rem 0; line-height: 1.7; overflow-wrap: anywhere; }
.agent-shell a { color: var(--accent); }
.agent-nav { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.agent-shell > nav.agent-card ol { list-style: none; padding-left: 0; }
.agent-language { display: inline-flex; gap: .5rem; }
.agent-language a { padding: .5rem .75rem; border: 1px solid var(--line); border-radius: .5rem; text-decoration: none; }
.agent-language a[aria-current="page"] { background: var(--accent); color: var(--accent-ink); }
.agent-card table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.agent-card th, .agent-card td { padding: .5rem; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.agent-card .download-button { display: flex; align-items: center; justify-content: center; min-height: 2.75rem; padding: .6rem; border-radius: .5rem; background: var(--accent); color: var(--accent-ink); font-weight: 650; text-decoration: none; }
.agent-intro { margin: 2.5rem 0; }
.agent-intro h1 { font-size: clamp(1.8rem, 6vw, 2.8rem); line-height: 1.2; letter-spacing: -.035em; }
.agent-intro p { color: var(--muted); }
.agent-card { border: 1px solid var(--line); background: var(--surface); border-radius: 1rem; padding: clamp(1rem, 4vw, 2rem); margin: 1.25rem 0; }
.agent-card h2 { margin-top: 0; font-size: 1.3rem; line-height: 1.4; }
.agent-card li { margin: .75rem 0; }
.agent-card ol, .agent-card ul { padding-left: 1.4rem; }
.agent-modes { display: grid; gap: 1rem; }
.agent-modes dt { color: var(--accent); font-weight: 650; }
.agent-modes dd { margin: .3rem 0 0; }
.agent-note { color: var(--muted); font-size: .9rem; }
.agent-card pre { white-space: pre-wrap; overflow-wrap: anywhere; padding: 1rem; background: var(--background); border-radius: .5rem; font-size: .85rem; }
.agent-card code { overflow-wrap: anywhere; }
.agent-card summary { min-height: 2.75rem; padding: .6rem 0; cursor: pointer; color: var(--accent); }
.agent-card blockquote { margin: 1rem 0; border-left: 3px solid var(--accent); padding: .5rem 1rem; }
.sharing-note { text-align: center; margin: 0; font-size: .78rem; }
#loadProgress { width: min(100%, 20rem); height: .4rem; justify-self: center; accent-color: var(--accent); }
.snapshot-header > div, .snapshot-header nav { min-width: 0; }
.snapshot-header h1, .snapshot-header p { overflow-wrap: anywhere; }
.snapshot-header p, .snapshot-shell > p { color: var(--muted); line-height: 1.6; }
.source-content { font-size: .875rem; tab-size: 4; }
.chunk-links li { padding: .75rem 1rem; overflow-wrap: anywhere; }
.chunk-links a { display: inline-flex; padding: .5rem .75rem; min-height: 2.75rem; color: var(--accent); }
.chunk-links small { display: block; text-align: left; padding: .4rem .75rem; line-height: 1.6; }
