/* Archipelego: component styles. Every colour, length, shadow and timing comes from tokens.css. */
[class^="ap-"], [class*=" ap-"] { box-sizing: border-box; }
.ap-glyph { display: inline-block; vertical-align: middle; flex: none; }

/* Presence colour modifiers, shared by cursors and nodes */
.ap-presence--signal { --presence-color: var(--signal); }
.ap-presence--rose   { --presence-color: var(--presence-rose); }
.ap-presence--amber  { --presence-color: var(--presence-amber); }
.ap-presence--teal   { --presence-color: var(--presence-teal); }
.ap-presence--violet { --presence-color: var(--presence-violet); }
.ap-presence--lime   { --presence-color: var(--presence-lime); }
.ap-presence--coral  { --presence-color: var(--presence-coral); }

/* Layer tints, shared by wells, chips and zones */
.ap-layer--1 { --layer-color: var(--layer-1); }
.ap-layer--2 { --layer-color: var(--layer-2); }
.ap-layer--3 { --layer-color: var(--layer-3); }
.ap-layer--4 { --layer-color: var(--layer-4); }
.ap-layer--security { --layer-color: transparent; }

/* ---------- Logo ---------- */
.ap-logo { display: inline-flex; align-items: center; gap: var(--space-3); color: var(--ink); text-decoration: none; }
.ap-logo-mark { display: block; overflow: visible; }
.ap-logo-island-a { fill: var(--ink); }
.ap-logo-island-b { fill: var(--signal); }
.ap-logo-island-c { fill: var(--ink-muted); }
.ap-logo-port { fill: var(--ground); }
.ap-logo--mono .ap-logo-island-a, .ap-logo--mono .ap-logo-island-b, .ap-logo--mono .ap-logo-island-c { fill: var(--on-signal); }
.ap-logo--mono .ap-logo-port { fill: var(--signal); }
.ap-logo-word { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.03em; line-height: 1; color: inherit; }
.ap-logo--animate .ap-logo-island-a, .ap-logo--animate .ap-logo-island-b, .ap-logo--animate .ap-logo-island-c { animation: ap-bob var(--duration-story) var(--ease-in-out) infinite alternate; transform-box: fill-box; }
.ap-logo--animate .ap-logo-island-b { animation-delay: 150ms; }
.ap-logo--animate .ap-logo-island-c { animation-delay: 300ms; }
@keyframes ap-bob { from { transform: translateY(0); } to { transform: translateY(-1.5px); } }

/* ---------- Button ---------- */
.ap-btn { -webkit-appearance: none; appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); height: 40px; padding: 0 var(--space-4); border-radius: var(--radius-sm); border: var(--stroke-hairline) solid transparent; font-family: var(--font-sans); font-size: 15px; line-height: 22px; font-weight: 600; cursor: pointer; user-select: none; touch-action: manipulation; white-space: nowrap;
  transition: transform var(--duration-fast) var(--ease-out), background-color var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out), border-color var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out); }
.ap-btn:active { transform: scale(0.97); }
.ap-btn:focus-visible { outline: var(--stroke-selection) solid var(--signal); outline-offset: 2px; }
.ap-btn--sm { height: 32px; padding: 0 var(--space-3); font-size: 13px; line-height: 16px; border-radius: var(--radius-xs); }
.ap-btn--lg { height: 56px; padding: 0 var(--space-6); font-size: 17px; border-radius: var(--radius-md); }
.ap-btn--icon { width: 40px; padding: 0; } .ap-btn--sm.ap-btn--icon { width: 32px; } .ap-btn--lg.ap-btn--icon { width: 56px; }
.ap-btn--primary { background: var(--signal); color: var(--on-signal); box-shadow: var(--shadow-tile); }
.ap-btn--primary:hover { background: var(--signal-deep); transform: translateY(-1px); box-shadow: var(--shadow-lift); }
.ap-btn--primary:active { transform: scale(0.97); box-shadow: var(--shadow-tile); }
.ap-btn--quiet { background: var(--surface); color: var(--ink); border-color: var(--hairline); box-shadow: var(--shadow-tile); }
.ap-btn--quiet:hover { border-color: var(--ink-faint); transform: translateY(-1px); box-shadow: var(--shadow-lift); }
.ap-btn--ghost { background: transparent; color: var(--ink-muted); }
.ap-btn--ghost:hover { background: var(--signal-soft); color: var(--signal-deep); }
.ap-btn--danger { background: transparent; color: var(--danger); border-color: var(--hairline); }
.ap-btn--danger:hover { background: var(--danger); color: var(--on-danger); border-color: var(--danger); }
.ap-btn[disabled] { opacity: 0.45; pointer-events: none; }

/* ---------- Toggle ---------- */
.ap-toggle { position: relative; display: inline-flex; align-items: center; gap: var(--space-3); cursor: pointer; font-family: var(--font-sans); color: var(--ink); font-size: 13px; line-height: 16px; font-weight: 600; letter-spacing: 0.02em; user-select: none; }
.ap-toggle-input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.ap-toggle-track { position: relative; width: 44px; height: 26px; border-radius: var(--radius-pill); background: var(--ink-faint); flex: none; transition: background-color var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out); }
.ap-toggle-thumb { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow-tile); transition: transform var(--duration-base) var(--ease-spring); }
.ap-toggle--on .ap-toggle-track { background: var(--signal); }
.ap-toggle--on .ap-toggle-thumb { transform: translateX(18px); }
.ap-toggle-input:focus-visible + .ap-toggle-track { box-shadow: var(--shadow-signal); }
.ap-toggle-text { display: flex; flex-direction: column; gap: 2px; }
.ap-toggle-desc { font-size: 12px; line-height: 16px; font-weight: 500; letter-spacing: 0; color: var(--ink-muted); }

/* ---------- Chip ---------- */
.ap-chip { display: inline-flex; align-items: center; gap: var(--space-1); height: 24px; padding: 0 var(--space-2); border-radius: var(--radius-xs); font-family: var(--font-sans); font-size: 12px; line-height: 16px; font-weight: 500; color: var(--ink-muted); background: var(--ground-sunken); border: var(--stroke-hairline) solid transparent; white-space: nowrap; }
.ap-chip--signal { color: var(--signal-deep); background: var(--signal-soft); }
.ap-chip--outline { background: transparent; border-color: var(--hairline); }
.ap-chip--layer { background: var(--layer-color); color: var(--ink); }
.ap-chip--layer.ap-layer--security { border-style: dashed; border-color: var(--ink-faint); }
.ap-chip--mono { font-family: var(--font-mono); }
.ap-chip-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---------- Panel ---------- */
.ap-panel { display: flex; flex-direction: column; background: var(--surface); border: var(--stroke-hairline) solid var(--hairline); border-radius: var(--radius-lg); box-shadow: var(--shadow-float); font-family: var(--font-sans); color: var(--ink); overflow: hidden; min-width: 240px; animation: ap-rise var(--duration-slow) var(--ease-out) both; }
.ap-panel--glass { background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: blur(16px) saturate(1.2); -webkit-backdrop-filter: blur(16px) saturate(1.2); }
.ap-panel-head { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4) var(--space-4) var(--space-3); }
.ap-panel-titles { display: flex; flex-direction: column; min-width: 0; }
.ap-panel-title { font-size: 15px; line-height: 22px; font-weight: 600; margin: 0; }
.ap-panel-sub { font-size: 12px; line-height: 16px; font-weight: 500; color: var(--ink-muted); margin: 0; }
.ap-panel-actions { margin-left: auto; display: flex; gap: var(--space-1); }
.ap-panel-body { padding: 0 var(--space-4) var(--space-4); }
@keyframes ap-rise { from { opacity: 0; transform: translateY(8px) scale(0.985); } to { opacity: 1; transform: none; } }

/* ---------- Well (glyph on a layer tint), shared by tiles and nodes ---------- */
.ap-well { width: 36px; height: 36px; border-radius: var(--radius-sm); display: grid; place-items: center; flex: none; background: var(--layer-color); color: var(--ink); }
.ap-layer--security .ap-well { border: var(--stroke-hairline) dashed var(--ink-faint); }

/* ---------- BlockTile ---------- */
.ap-tile { position: relative; display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; width: var(--tile-size); height: var(--tile-size); padding: var(--space-3); border-radius: var(--radius-md); background: var(--surface); border: var(--stroke-hairline) solid var(--hairline); box-shadow: var(--shadow-tile); color: var(--ink); font-family: var(--font-sans); cursor: grab; user-select: none; touch-action: none;
  transition: transform var(--duration-base) var(--ease-spring), box-shadow var(--duration-base) var(--ease-out), border-color var(--duration-fast) var(--ease-out); }
.ap-tile:hover { transform: translateY(-3px) rotate(-1deg); box-shadow: var(--shadow-lift); border-color: var(--ink-faint); }
.ap-tile:active, .ap-tile--dragging { cursor: grabbing; transform: scale(1.06) rotate(1.5deg); box-shadow: var(--shadow-lift); border-color: var(--signal); }
.ap-tile:focus-visible { outline: var(--stroke-selection) solid var(--signal); outline-offset: 2px; }
.ap-tile .ap-well { width: 32px; height: 32px; }
.ap-tile-label { font-size: 12px; line-height: 14px; font-weight: 600; text-align: left; }
.ap-tile--wall { width: 112px; height: 112px; padding: var(--space-4); }
.ap-tile--wall .ap-well { width: 44px; height: 44px; }
.ap-tile--wall .ap-tile-label { font-size: 14px; line-height: 16px; }

/* ---------- CanvasNode ---------- */
.ap-node { position: relative; width: var(--node-width); height: var(--node-height); border-radius: var(--radius-md); background: var(--surface); border: var(--stroke-hairline) solid var(--hairline); box-shadow: var(--shadow-tile); font-family: var(--font-sans); color: var(--ink); display: flex; gap: var(--space-3); padding: var(--space-3); align-items: flex-start; cursor: default;
  transition: box-shadow var(--duration-base) var(--ease-out), border-color var(--duration-fast) var(--ease-out), transform var(--duration-base) var(--ease-spring); animation: ap-place var(--duration-base) var(--ease-spring) both; }
.ap-node:focus-visible { outline: none; border-color: var(--signal); box-shadow: var(--shadow-signal); }
.ap-node--selected { border-color: var(--signal); box-shadow: var(--shadow-signal), var(--shadow-lift); }
.ap-node--presence { border-color: var(--presence-color); box-shadow: 0 0 0 4px color-mix(in srgb, var(--presence-color) 24%, transparent), var(--shadow-tile); }
.ap-node-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ap-node-kind { font-size: 11px; line-height: 14px; font-weight: 500; color: var(--ink-muted); letter-spacing: 0.02em; }
.ap-node-title { font-size: 13px; line-height: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-node-sub { font-size: 11px; line-height: 16px; color: var(--ink-muted); font-family: var(--font-mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-node-presence-tag { position: absolute; top: -10px; right: var(--space-3); padding: 0 var(--space-2); border-radius: var(--radius-pill); background: var(--surface); border: 1.5px solid var(--presence-color); color: var(--ink); font-size: 11px; line-height: 16px; font-weight: 600; }
.ap-port { position: absolute; width: var(--port-size); height: var(--port-size); border-radius: 50%; background: var(--surface); border: 2px solid var(--ink-faint); opacity: 0; transform: scale(0.6); cursor: crosshair;
  transition: opacity var(--duration-fast) var(--ease-out), transform var(--duration-base) var(--ease-spring), border-color var(--duration-fast) var(--ease-out); }
.ap-node:hover .ap-port, .ap-node--selected .ap-port, .ap-node--ports .ap-port { opacity: 1; transform: none; }
.ap-port:hover { border-color: var(--signal); transform: scale(1.5); }
.ap-port--n { top: -5px; left: 50%; margin-left: -4px; }
.ap-port--s { bottom: -5px; left: 50%; margin-left: -4px; }
.ap-port--w { left: -5px; top: 50%; margin-top: -4px; }
.ap-port--e { right: -5px; top: 50%; margin-top: -4px; }
@keyframes ap-place { from { transform: scale(0.9); opacity: 0; } 60% { transform: scale(1.03); opacity: 1; } to { transform: none; opacity: 1; } }

/* ---------- Connector ---------- */
.ap-connector { overflow: visible; display: block; }
.ap-connector-hit { fill: none; stroke: transparent; stroke-width: 16px; pointer-events: stroke; }
.ap-connector-path { fill: none; stroke: var(--ink-muted); stroke-width: var(--stroke-connector); stroke-linecap: round; transition: stroke var(--duration-fast) var(--ease-out); }
.ap-connector--async .ap-connector-path { stroke-dasharray: 2 6; }
.ap-connector--flow .ap-connector-path { stroke: var(--signal); stroke-dasharray: 6 8; animation: ap-flow 1s linear infinite; }
.ap-connector--selected .ap-connector-path { stroke: var(--signal); }
.ap-connector-head { fill: var(--ink-muted); }
.ap-connector--flow .ap-connector-head, .ap-connector--selected .ap-connector-head { fill: var(--signal); }
.ap-connector-label-bg { fill: var(--surface); stroke: var(--hairline); stroke-width: 1; }
.ap-connector--flow .ap-connector-label-bg, .ap-connector--selected .ap-connector-label-bg { stroke: var(--signal); }
.ap-connector-label { font-family: var(--font-mono); font-size: 11px; font-weight: 500; fill: var(--ink-muted); dominant-baseline: middle; text-anchor: middle; }
.ap-connector--flow .ap-connector-label, .ap-connector--selected .ap-connector-label { fill: var(--signal-deep); }
@keyframes ap-flow { to { stroke-dashoffset: -14; } }

/* ---------- Zone ---------- */
.ap-zone { position: relative; border-radius: var(--radius-lg); border: var(--stroke-hairline) dashed var(--ink-faint); background: var(--layer-color); font-family: var(--font-sans); padding: var(--space-12) var(--space-4) var(--space-4); color: var(--ink); }
.ap-zone--stack { border-style: solid; border-color: var(--hairline); background: var(--surface); box-shadow: var(--shadow-tile); }
.ap-zone--selected { border-style: solid; border-color: var(--signal); box-shadow: var(--shadow-signal); }
.ap-zone-head { position: absolute; top: var(--space-3); left: var(--space-4); right: var(--space-4); display: flex; align-items: center; gap: var(--space-2); }
.ap-zone-index { font-family: var(--font-mono); font-size: 11px; line-height: 16px; font-weight: 500; color: var(--ink-muted); padding: 0 6px; border-radius: var(--radius-xs); border: var(--stroke-hairline) solid var(--hairline); background: var(--surface); }
.ap-zone-title { font-size: 13px; line-height: 16px; font-weight: 600; letter-spacing: 0.02em; }
.ap-zone-count { margin-left: auto; font-family: var(--font-mono); font-size: 11px; line-height: 16px; color: var(--ink-muted); }
.ap-zone-body { display: flex; flex-wrap: wrap; gap: var(--space-6); }

/* ---------- Toolbar ---------- */
.ap-toolbar { display: inline-flex; align-items: center; gap: 2px; padding: var(--space-1); border-radius: var(--radius-pill); background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: blur(16px) saturate(1.2); -webkit-backdrop-filter: blur(16px) saturate(1.2); border: var(--stroke-hairline) solid var(--hairline); box-shadow: var(--shadow-float); font-family: var(--font-sans); animation: ap-rise var(--duration-slow) var(--ease-out) both; }
.ap-tool { position: relative; width: 40px; height: 40px; border-radius: var(--radius-pill); border: 0; background: transparent; color: var(--ink-muted); display: grid; place-items: center; cursor: pointer; padding: 0; touch-action: manipulation;
  transition: background-color var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out), transform var(--duration-base) var(--ease-spring); }
.ap-tool:hover { background: var(--ground-sunken); color: var(--ink); }
.ap-tool:active { transform: scale(0.9); }
.ap-tool:focus-visible { outline: var(--stroke-selection) solid var(--signal); outline-offset: -2px; }
.ap-tool--active { background: var(--signal); color: var(--on-signal); }
.ap-tool--active:hover { background: var(--signal-deep); color: var(--on-signal); }
.ap-tool--on { color: var(--signal); }
.ap-tool--on::after { content: ""; position: absolute; bottom: 5px; left: 50%; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--signal); }
.ap-toolbar-sep { width: 1px; height: 24px; background: var(--hairline); margin: 0 var(--space-1); }
.ap-toolbar-zoom { font-family: var(--font-mono); font-size: 12px; line-height: 16px; font-weight: 500; color: var(--ink); min-width: 48px; text-align: center; }
.ap-toolbar--touch { padding: var(--space-2); gap: var(--space-1); }
.ap-toolbar--touch .ap-tool { width: 64px; height: 64px; }
.ap-toolbar--touch .ap-tool .ap-glyph { width: 28px; height: 28px; }
.ap-toolbar--touch .ap-toolbar-sep { height: 32px; margin: 0 var(--space-2); }
.ap-toolbar--touch .ap-toolbar-zoom { font-size: 15px; min-width: 64px; }

/* ---------- PresenceCursor ---------- */
.ap-cursor { position: absolute; left: 0; top: 0; pointer-events: none; font-family: var(--font-sans); --presence-color: var(--signal); transition: transform var(--duration-base) var(--ease-out); will-change: transform; }
.ap-cursor-arrow { display: block; fill: var(--presence-color); stroke: var(--surface); stroke-width: 1.5; stroke-linejoin: round; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25)); }
.ap-cursor-tag { position: absolute; left: 14px; top: 18px; white-space: nowrap; display: inline-flex; align-items: center; gap: var(--space-1); padding: 2px var(--space-2); border-radius: var(--radius-pill); background: var(--surface); border: 1.5px solid var(--presence-color); color: var(--ink); font-size: 12px; line-height: 16px; font-weight: 600; box-shadow: var(--shadow-tile); animation: ap-pop var(--duration-base) var(--ease-spring) both; transform-origin: 0 0; }
.ap-cursor-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--presence-color); }
.ap-cursor-typing { color: var(--ink-muted); font-weight: 500; }
@keyframes ap-pop { from { transform: scale(0.6); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  [class^="ap-"], [class*=" ap-"] { transition-duration: var(--duration-instant) !important; }
  .ap-connector--flow .ap-connector-path, .ap-logo--animate .ap-logo-island-a, .ap-logo--animate .ap-logo-island-b, .ap-logo--animate .ap-logo-island-c { animation: none; }
  .ap-node, .ap-panel, .ap-toolbar, .ap-cursor-tag { animation-duration: var(--duration-instant); }
}

/* ---------- Avatar ---------- */
.ap-avatar { display: inline-flex; flex: none; border-radius: 50%; --presence-color: var(--signal); }
.ap-avatar svg { display: block; overflow: visible; }
.ap-avatar-bg { fill: var(--presence-color); }
.ap-avatar .f { fill: var(--surface); }
.ap-avatar .k { fill: var(--ink); }
.ap-avatar .s { fill: none; stroke: var(--ink); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.ap-avatar--ring { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--presence-color); }
button.ap-avatar, .ap-avatar[role="button"] { cursor: pointer; transition: transform var(--duration-base) var(--ease-spring); }
button.ap-avatar:hover { transform: scale(1.12) rotate(-6deg); }

/* ---------- StickyNote ---------- */
.ap-sticky {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-4) var(--space-3);
  border-radius: 4px 4px 4px 18px;
  background: var(--sticky-color);
  color: var(--ink);
  font-family: var(--font-sans);
  box-shadow: 0 1px 1px rgba(11, 12, 14, 0.08), 0 14px 24px -14px rgba(11, 12, 14, 0.45);
  transform: rotate(var(--sticky-tilt, -1.5deg));
  transition: transform var(--duration-base) var(--ease-spring), box-shadow var(--duration-base) var(--ease-out);
  animation: ap-place var(--duration-base) var(--ease-spring) both;
  cursor: grab;
}
.ap-sticky:hover { transform: rotate(0deg) translateY(-2px); box-shadow: 0 1px 1px rgba(11, 12, 14, 0.08), 0 20px 32px -14px rgba(11, 12, 14, 0.5); }
.ap-sticky:focus-visible, .ap-sticky--selected { outline: var(--stroke-selection) solid var(--signal); outline-offset: 3px; }
.ap-sticky--yellow { --sticky-color: var(--sticky-yellow); }
.ap-sticky--pink { --sticky-color: var(--sticky-pink); }
.ap-sticky--blue { --sticky-color: var(--sticky-blue); }
.ap-sticky--green { --sticky-color: var(--sticky-green); }
.ap-sticky--violet { --sticky-color: var(--sticky-violet); }
.ap-sticky-text { margin: 0; flex: 1; font-size: 15px; line-height: 21px; font-weight: 500; white-space: pre-wrap; overflow-wrap: anywhere; }
.ap-sticky-placeholder { color: var(--ink-muted); font-weight: 400; }
.ap-sticky-input { width: 100%; min-height: 96px; resize: none; border: 0; padding: 0; background: transparent; color: inherit; font: inherit; outline: none; cursor: text; }
.ap-sticky-author { display: flex; align-items: center; gap: 6px; font-size: 12px; line-height: 16px; font-weight: 600; color: var(--ink-muted); }
.ap-sticky-target { margin-left: auto; font-family: var(--font-mono); font-weight: 500; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 50%; }
.ap-sticky-pin { position: absolute; top: -7px; left: 50%; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; background: var(--signal); box-shadow: 0 0 0 3px var(--surface), 0 2px 4px rgba(0, 0, 0, 0.3); }
/* The tether from a pinned note to its block or connection, drawn by the host in canvas space. */
.ap-sticky-tether { fill: none; stroke: var(--signal); stroke-width: 1.5; stroke-dasharray: 3 5; stroke-linecap: round; opacity: 0.8; }
@media (prefers-reduced-motion: reduce) { .ap-sticky { animation-duration: var(--duration-instant); } }

/* ---------- Containers: nested capabilities and logical zones ---------- */
.ap-zone--zone { background: transparent; border-style: dashed; border-color: var(--ink-faint); }
.ap-zone--capability { border-style: solid; border-color: var(--hairline); background: color-mix(in srgb, var(--layer-1) 82%, var(--surface)); box-shadow: var(--shadow-tile); }
.ap-zone--capability .ap-zone-index { background: var(--layer-1); }
.ap-zone--depth-2.ap-zone--capability { background: color-mix(in srgb, var(--layer-2) 82%, var(--surface)); }
.ap-zone--depth-3.ap-zone--capability { background: color-mix(in srgb, var(--layer-4) 70%, var(--surface)); }
.ap-zone--depth-4.ap-zone--capability { background: var(--surface); }
.ap-zone--selected.ap-zone--zone, .ap-zone--selected.ap-zone--capability { border-color: var(--signal); box-shadow: var(--shadow-signal); }

/* ---------- Chat ---------- */
.ap-msg { display: flex; gap: var(--space-3); padding: var(--space-2); border-radius: var(--radius-md); font-family: var(--font-sans); color: var(--ink); animation: ap-msg-in var(--duration-base) var(--ease-out) both; }
.ap-msg--mine { background: color-mix(in srgb, var(--ground-sunken) 70%, transparent); }
.ap-msg-avatar { flex: none; padding-top: 2px; }
.ap-msg-main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.ap-msg-head { display: flex; align-items: center; gap: var(--space-2); min-height: 22px; }
.ap-msg-name { font-size: 13px; line-height: 16px; font-weight: 600; }
.ap-msg-time { margin-left: auto; font: 500 11px/16px var(--font-mono); color: var(--ink-muted); }
.ap-msg-body { font-size: 15px; line-height: 22px; overflow-wrap: anywhere; white-space: pre-wrap; }
.ap-msg-foot { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-1); }
.ap-msg--ai {
  padding: var(--space-3);
  margin: var(--space-1) 0;
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--signal-soft) 55%, var(--surface));
  border: var(--stroke-hairline) solid color-mix(in srgb, var(--signal) 28%, var(--hairline));
  box-shadow: var(--shadow-tile);
}
.ap-msg--ai .ap-msg-name { color: var(--signal-deep); }
@keyframes ap-msg-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.ap-architect { display: inline-grid; place-items: center; border-radius: 50%; background: var(--signal); color: var(--on-signal); flex: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--signal) 18%, transparent); }
.ap-architect--thinking { animation: ap-breathe 1.4s var(--ease-in-out) infinite; }
@keyframes ap-breathe { 0%, 100% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--signal) 18%, transparent); } 50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--signal) 10%, transparent); } }

.ap-wave { display: inline-flex; gap: 4px; padding: 6px 0; }
.ap-wave i { width: 7px; height: 7px; border-radius: 50%; background: var(--signal); animation: ap-wave 1s var(--ease-in-out) infinite; }
.ap-wave i:nth-child(2) { animation-delay: 120ms; }
.ap-wave i:nth-child(3) { animation-delay: 240ms; }
@keyframes ap-wave { 0%, 100% { transform: translateY(0); opacity: 0.35; } 40% { transform: translateY(-5px); opacity: 1; } }
.ap-caret { display: inline-block; width: 8px; height: 16px; margin-left: 2px; vertical-align: -2px; border-radius: 2px; background: var(--signal); animation: ap-caret 900ms steps(2, start) infinite; }
@keyframes ap-caret { to { visibility: hidden; } }

.ap-mention { display: inline-flex; align-items: center; height: 22px; padding: 0 6px; border-radius: var(--radius-xs); background: var(--signal-soft); color: var(--signal-deep); font-weight: 600; white-space: nowrap; }
.ap-mention--ai { background: var(--signal); color: var(--on-signal); }

.ap-ref {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px 0 3px;
  margin: 1px 0;
  border-radius: var(--radius-pill);
  border: var(--stroke-hairline) solid var(--hairline);
  background: var(--surface);
  color: var(--ink);
  font: 600 13px/16px var(--font-sans);
  vertical-align: middle;
  white-space: nowrap;
  box-shadow: var(--shadow-tile);
  transition: transform var(--duration-base) var(--ease-spring), border-color var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out);
}
button.ap-ref { cursor: pointer; }
button.ap-ref:hover { transform: translateY(-1px); border-color: var(--signal); }
.ap-ref--active { border-color: var(--signal); box-shadow: var(--shadow-signal); }
.ap-ref-n { display: grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: var(--radius-pill); background: var(--signal); color: var(--on-signal); font: 600 11px/1 var(--font-mono); }
.ap-ref-well { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; background: var(--layer-color); color: var(--ink); flex: none; }
.ap-ref-title { max-width: 180px; overflow: hidden; text-overflow: ellipsis; }

.ap-model { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px 0 3px; border-radius: var(--radius-pill); border: var(--stroke-hairline) solid var(--hairline); background: var(--surface); color: var(--ink-muted); font: 500 11px/16px var(--font-mono); white-space: nowrap; }
.ap-model-mark { display: grid; place-items: center; width: 16px; height: 16px; border-radius: 5px; background: var(--ink); color: var(--ground); font: 700 10px/1 var(--font-sans); }
.ap-model--auto .ap-model-mark { background: var(--signal); color: var(--on-signal); }
.ap-model--button { cursor: pointer; transition: border-color var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out); }
.ap-model--button:hover { border-color: var(--signal); color: var(--ink); }

.ap-composer { position: relative; font-family: var(--font-sans); }
.ap-composer-box {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3);
  border-radius: var(--radius-lg);
  border: var(--stroke-hairline) solid var(--hairline);
  background: var(--surface);
  box-shadow: var(--shadow-tile);
  transition: border-color var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out);
}
.ap-composer--focus .ap-composer-box, .ap-composer-box:focus-within { border-color: var(--signal); box-shadow: var(--shadow-signal); }
.ap-composer-text, .ap-composer-input { min-height: 44px; font-size: 15px; line-height: 22px; color: var(--ink); white-space: pre-wrap; }
.ap-composer-input { width: 100%; max-height: 160px; border: 0; padding: 0; background: transparent; resize: none; outline: none; font: inherit; }
.ap-composer-placeholder, .ap-composer-input::placeholder { color: var(--ink-faint); }
.ap-composer-bar { display: flex; align-items: center; gap: var(--space-2); }
.ap-composer-hint { font-size: 12px; line-height: 16px; color: var(--ink-muted); margin-right: auto; }
.ap-composer-send { width: 36px; height: 36px; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--signal); color: var(--on-signal); cursor: pointer; transition: transform var(--duration-base) var(--ease-spring), background-color var(--duration-fast) var(--ease-out); }
.ap-composer-send:hover { background: var(--signal-deep); transform: scale(1.06); }
.ap-composer-send:disabled { background: var(--ink-faint); cursor: default; transform: none; }
.ap-suggest {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 8px);
  margin: 0;
  padding: var(--space-1);
  list-style: none;
  border-radius: var(--radius-lg);
  border: var(--stroke-hairline) solid var(--hairline);
  background: var(--surface-raised);
  box-shadow: var(--shadow-float);
  max-height: 280px;
  overflow: auto;
  z-index: 5;
  animation: ap-rise var(--duration-base) var(--ease-out) both;
}
.ap-suggest-item { display: flex; align-items: center; gap: var(--space-2); padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer; font-size: 14px; line-height: 20px; }
.ap-suggest-item.is-active, .ap-suggest-item:hover { background: var(--signal-soft); }
.ap-suggest-label { font-weight: 600; }
.ap-suggest-sub { margin-left: auto; font: 500 11px/16px var(--font-mono); color: var(--ink-muted); }

/* ---------- Spotlight: the Architect points at the canvas ---------- */
.ap-spot {
  position: absolute;
  pointer-events: none;
  border-radius: calc(var(--radius-md) + 8px);
  border: 2px solid var(--signal);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--signal) 18%, transparent), 0 18px 40px -16px color-mix(in srgb, var(--signal) 55%, transparent);
  animation: ap-spot-in 640ms var(--ease-spring) both, ap-spot-pulse 2.2s var(--ease-in-out) 700ms infinite;
  z-index: 40;
}
.ap-spot--zone { border-style: dashed; border-radius: calc(var(--radius-lg) + 8px); }
.ap-spot-scan { position: absolute; inset: 0; border-radius: inherit; overflow: hidden; }
.ap-spot-scan::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -30%;
  width: 26%;
  background: color-mix(in srgb, var(--signal) 22%, transparent);
  transform: skewX(-18deg);
  animation: ap-spot-scan 1.2s var(--ease-out) 200ms both;
}
.ap-spot-n {
  position: absolute;
  top: -14px;
  left: -14px;
  display: grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  padding: 0 7px;
  border-radius: var(--radius-pill);
  background: var(--signal);
  color: var(--on-signal);
  font: 700 13px/1 var(--font-mono);
  box-shadow: 0 0 0 3px var(--surface), var(--shadow-lift);
  animation: ap-pop var(--duration-base) var(--ease-spring) 260ms both;
}
.ap-spot-label {
  position: absolute;
  left: 20px;
  top: -13px;
  height: 24px;
  padding: 0 10px 0 12px;
  border-radius: var(--radius-pill);
  background: var(--ink);
  color: var(--ground);
  font: 600 12px/24px var(--font-sans);
  white-space: nowrap;
  animation: ap-pop var(--duration-base) var(--ease-spring) 360ms both;
  transform-origin: left center;
}
@keyframes ap-spot-in { 0% { opacity: 0; transform: scale(1.35); } 60% { opacity: 1; transform: scale(0.97); } 100% { opacity: 1; transform: none; } }
@keyframes ap-spot-pulse { 0%, 100% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--signal) 18%, transparent), 0 18px 40px -16px color-mix(in srgb, var(--signal) 55%, transparent); } 50% { box-shadow: 0 0 0 12px color-mix(in srgb, var(--signal) 8%, transparent), 0 18px 40px -16px color-mix(in srgb, var(--signal) 55%, transparent); } }
@keyframes ap-spot-scan { from { left: -30%; } to { left: 110%; } }
/* Everything the Architect is not pointing at steps back. */
.ap-dimmed { opacity: 0.16; filter: grayscale(0.7); transition: opacity var(--duration-slow) var(--ease-out), filter var(--duration-slow) var(--ease-out); }
@media (prefers-reduced-motion: reduce) { .ap-spot, .ap-spot-scan::after, .ap-architect--thinking, .ap-wave i { animation: none; } }

/* ---------- Feature Architecture ---------- */
.ap-feature { display: flex; align-items: flex-start; gap: var(--space-3); width: 100%; padding: var(--space-3); border-radius: var(--radius-md); border: var(--stroke-hairline) solid var(--hairline); background: var(--surface); color: var(--ink); font-family: var(--font-sans); text-align: left; box-shadow: var(--shadow-tile); transition: transform var(--duration-base) var(--ease-spring), border-color var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out); }
button.ap-feature { cursor: pointer; }
button.ap-feature:hover { transform: translateY(-2px); border-color: var(--ink-faint); box-shadow: var(--shadow-lift); }
.ap-feature--active { border-color: var(--signal); box-shadow: var(--shadow-signal), var(--shadow-tile); }
.ap-feature-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--radius-sm); background: var(--ink); color: var(--ground); font: 700 15px/1 var(--font-display); flex: none; }
.ap-feature--active .ap-feature-mark { background: var(--signal); color: var(--on-signal); }
.ap-feature-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.ap-feature-name { font-size: 15px; line-height: 20px; font-weight: 600; }
.ap-feature-desc { font-size: 13px; line-height: 18px; color: var(--ink-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ap-feature-meta { font: 500 11px/16px var(--font-mono); color: var(--ink-muted); }
.ap-feature-live { align-self: center; height: 22px; padding: 0 8px; border-radius: var(--radius-pill); background: var(--signal-soft); color: var(--signal-deep); font: 600 11px/22px var(--font-sans); white-space: nowrap; }

.ap-stepper { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ap-step-dot { width: 10px; height: 10px; padding: 0; border: 0; border-radius: var(--radius-pill); background: var(--ink-faint); color: var(--on-signal); font: 700 11px/1 var(--font-mono); cursor: pointer; transition: width var(--duration-base) var(--ease-spring), background-color var(--duration-fast) var(--ease-out); }
.ap-step-dot.is-done { background: color-mix(in srgb, var(--signal) 45%, var(--ink-faint)); }
.ap-step-dot.is-current { width: 32px; height: 20px; background: var(--signal); }

.ap-narration { display: flex; flex-direction: column; gap: var(--space-2); width: 440px; max-width: 100%; padding: var(--space-5); border-radius: var(--radius-xl); background: var(--surface); border: var(--stroke-hairline) solid var(--hairline); box-shadow: var(--shadow-float); font-family: var(--font-sans); color: var(--ink); animation: ap-rise var(--duration-slow) var(--ease-out) both; }
.ap-narration-head { display: flex; align-items: center; gap: var(--space-2); }
.ap-narration-scenario { font-size: 12px; line-height: 16px; font-weight: 600; color: var(--signal-deep); }
.ap-narration-count { margin-left: auto; font: 500 11px/16px var(--font-mono); color: var(--ink-muted); }
.ap-narration-title { margin: 0; font-family: var(--font-display); font-size: 24px; line-height: 30px; font-weight: 600; letter-spacing: -0.015em; }
.ap-narration-text { margin: 0; font-size: 15px; line-height: 22px; color: var(--ink-muted); }
.ap-narration-gap { margin: 0; display: flex; align-items: center; gap: 6px; font-size: 12px; line-height: 16px; font-weight: 600; color: var(--warning); }
.ap-narration-foot { display: flex; align-items: center; gap: var(--space-1); margin-top: var(--space-2); }
.ap-narration-spacer { flex: 1; }

.ap-lens { display: inline-flex; align-items: center; gap: var(--space-3); padding: 6px 6px 6px 8px; border-radius: var(--radius-pill); background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(16px) saturate(1.2); -webkit-backdrop-filter: blur(16px) saturate(1.2); border: var(--stroke-hairline) solid color-mix(in srgb, var(--signal) 40%, var(--hairline)); box-shadow: var(--shadow-signal), var(--shadow-float); font-family: var(--font-sans); color: var(--ink); animation: ap-lens-in var(--duration-slow) var(--ease-spring) both; }
.ap-lens-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--signal); color: var(--on-signal); }
.ap-lens-text { display: flex; flex-direction: column; }
.ap-lens-kicker { font-size: 11px; line-height: 14px; font-weight: 600; color: var(--signal-deep); letter-spacing: 0.02em; }
.ap-lens-name { font-family: var(--font-display); font-size: 17px; line-height: 20px; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; }
@keyframes ap-lens-in { from { opacity: 0; transform: translateY(-12px) scale(0.96); } to { opacity: 1; transform: none; } }

/* A block that belongs to the feature being edited: a check badge on its corner. */
.ap-member-badge { position: absolute; top: -10px; right: -10px; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--signal); color: var(--on-signal); box-shadow: 0 0 0 3px var(--surface), var(--shadow-tile); animation: ap-pop var(--duration-base) var(--ease-spring) both; z-index: 2; }
.ap-member-add { position: absolute; top: -10px; right: -10px; width: 24px; height: 24px; border-radius: 50%; border: 2px dashed var(--ink-faint); background: var(--surface); z-index: 2; }
/* The pulse that travels along a connection during a story step (an SVG circle on the path). */
.ap-flow-pulse { fill: var(--signal); filter: drop-shadow(0 0 6px color-mix(in srgb, var(--signal) 70%, transparent)); }
.ap-flow-trail { fill: none; stroke: var(--signal); stroke-width: 4; stroke-linecap: round; opacity: 0.35; }

/* ---------- Docking ---------- */
.ap-dockable { transition: border-radius var(--duration-slow) var(--ease-spring), box-shadow var(--duration-slow) var(--ease-out); }
.ap-docked-left { border-radius: 0 var(--radius-lg) var(--radius-lg) 0; border-left: 0; box-shadow: 1px 0 0 var(--hairline), var(--shadow-float); }
.ap-docked-right { border-radius: var(--radius-lg) 0 0 var(--radius-lg); border-right: 0; box-shadow: -1px 0 0 var(--hairline), var(--shadow-float); }
.ap-floating { box-shadow: 0 2px 6px rgba(11, 12, 14, 0.08), 0 32px 64px -24px rgba(11, 12, 14, 0.4); }
.ap-drag-handle { cursor: grab; touch-action: none; }
.ap-drag-handle:active { cursor: grabbing; }
.ap-morphing { will-change: transform; }
.ap-morph-glow-left, .ap-morph-glow-right { position: absolute; top: 0; bottom: 0; width: 3px; background: var(--signal); box-shadow: 0 0 16px 2px color-mix(in srgb, var(--signal) 60%, transparent); animation: ap-edge-trace 700ms var(--ease-out) both; pointer-events: none; z-index: 60; }
.ap-morph-glow-left { left: 0; }
.ap-morph-glow-right { right: 0; }
@keyframes ap-edge-trace { 0% { opacity: 0; clip-path: inset(50% 0 50% 0); } 40% { opacity: 1; clip-path: inset(0 0 0 0); } 100% { opacity: 0; clip-path: inset(0 0 0 0); } }
.ap-dock-target { position: fixed; top: 76px; bottom: 16px; width: 96px; display: flex; align-items: center; justify-content: center; pointer-events: none; z-index: 70; opacity: 0; transition: opacity var(--duration-fast) var(--ease-out); }
.ap-dock-target--left { left: 0; background: linear-gradient(90deg, color-mix(in srgb, var(--signal) 22%, transparent), transparent); border-left: 3px solid var(--signal); }
.ap-dock-target--right { right: 0; background: linear-gradient(270deg, color-mix(in srgb, var(--signal) 22%, transparent), transparent); border-right: 3px solid var(--signal); }
.ap-dock-target.is-active { opacity: 1; animation: ap-dock-breathe 1.2s var(--ease-in-out) infinite; }
.ap-dock-target-label { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: var(--radius-pill); background: var(--signal); color: var(--on-signal); font: 600 12px/16px var(--font-sans); white-space: nowrap; writing-mode: vertical-rl; transform: rotate(180deg); }
.ap-dock-target--right .ap-dock-target-label { transform: none; }
@keyframes ap-dock-breathe { 0%, 100% { box-shadow: inset 0 0 0 0 transparent; } 50% { box-shadow: inset 0 0 24px 0 color-mix(in srgb, var(--signal) 30%, transparent); } }
@media (prefers-reduced-motion: reduce) { .ap-morph-glow-left, .ap-morph-glow-right, .ap-dock-target.is-active, .ap-lens { animation: none; } }

/* ---------- Rich UI in the chat (A2UI surfaces, MCP Apps) ---------- */
.ap-rich { margin-top: var(--space-2); border-radius: var(--radius-lg); border: var(--stroke-hairline) solid var(--hairline); background: var(--surface); box-shadow: var(--shadow-tile); overflow: hidden; font-family: var(--font-sans); color: var(--ink); animation: ap-rise var(--duration-slow) var(--ease-out) both; }
.ap-rich-head { display: flex; align-items: center; gap: var(--space-2); padding: 8px 8px 8px 12px; border-bottom: var(--stroke-hairline) solid var(--hairline); background: var(--ground-sunken); }
.ap-rich-kind { height: 20px; padding: 0 6px; border-radius: var(--radius-xs); background: var(--ink); color: var(--ground); font: 700 10px/20px var(--font-mono); letter-spacing: 0.04em; }
.ap-rich--app .ap-rich-kind { background: var(--signal); color: var(--on-signal); }
.ap-rich-title { font-size: 13px; line-height: 16px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-rich-origin { margin-left: auto; font: 500 11px/16px var(--font-mono); color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%; }
.ap-rich-body { padding: var(--space-3); display: flex; flex-direction: column; gap: var(--space-2); }
.ap-rich--app .ap-rich-body { padding: 0; }
.ap-rich--app iframe { display: block; width: 100%; border: 0; min-height: 120px; background: var(--surface); }
.ap-rich--expanded { position: fixed; inset: 48px; z-index: 90; margin: 0; box-shadow: var(--shadow-float); display: flex; flex-direction: column; }
.ap-rich--expanded .ap-rich-body { flex: 1; min-height: 0; overflow: auto; }
.ap-rich--expanded iframe { height: 100%; }
/* A2UI basic catalog mapped onto the design system */
.ap-a2-row { display: flex; gap: var(--space-2); }
.ap-a2-col { display: flex; flex-direction: column; gap: var(--space-2); }
.ap-a2-list { display: flex; flex-direction: column; gap: var(--space-1); }
.ap-a2-list--horizontal { flex-direction: row; overflow-x: auto; }
.ap-a2-card { padding: var(--space-3); border-radius: var(--radius-md); border: var(--stroke-hairline) solid var(--hairline); background: var(--surface); }
.ap-a2-text { margin: 0; font-size: 14px; line-height: 20px; }
.ap-a2-text--caption { font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.ap-a2-image { max-width: 100%; border-radius: var(--radius-sm); display: block; }
.ap-a2-image--avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.ap-a2-image--icon { width: 24px; height: 24px; }
.ap-a2-divider { border: 0; border-top: var(--stroke-hairline) solid var(--hairline); margin: var(--space-1) 0; width: 100%; }
.ap-a2-divider--vertical { border-top: 0; border-left: var(--stroke-hairline) solid var(--hairline); width: 0; align-self: stretch; margin: 0 var(--space-1); }
.ap-a2-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; letter-spacing: 0.02em; }
.ap-a2-field input, .ap-a2-field textarea, .ap-a2-field select { height: 36px; padding: 0 10px; border-radius: var(--radius-sm); border: var(--stroke-hairline) solid var(--hairline); background: var(--ground); color: var(--ink); font: 400 14px/20px var(--font-sans); letter-spacing: 0; }
.ap-a2-field textarea { height: auto; min-height: 72px; padding: 8px 10px; resize: vertical; }
.ap-a2-field input:focus, .ap-a2-field textarea:focus { outline: none; border-color: var(--signal); box-shadow: var(--shadow-signal); }
.ap-a2-check { display: flex; align-items: center; gap: var(--space-2); font-size: 14px; line-height: 20px; cursor: pointer; }
.ap-a2-check input { width: 18px; height: 18px; accent-color: var(--signal); }
.ap-a2-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ap-a2-chip { height: 28px; padding: 0 10px; border-radius: var(--radius-pill); border: var(--stroke-hairline) solid var(--hairline); background: var(--surface); color: var(--ink); font: 600 12px/26px var(--font-sans); cursor: pointer; }
.ap-a2-chip.is-on { background: var(--signal); border-color: var(--signal); color: var(--on-signal); }
.ap-a2-tabs { display: flex; gap: 4px; border-bottom: var(--stroke-hairline) solid var(--hairline); }
.ap-a2-tab { height: 32px; padding: 0 10px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--ink-muted); font: 600 13px/30px var(--font-sans); cursor: pointer; }
.ap-a2-tab.is-on { color: var(--ink); border-bottom-color: var(--signal); }
.ap-a2-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.ap-a2-missing { padding: 6px 10px; border-radius: var(--radius-sm); border: var(--stroke-hairline) dashed var(--ink-faint); color: var(--ink-muted); font: 500 12px/16px var(--font-mono); }
.ap-a2-sent { font-size: 12px; color: var(--success); font-weight: 600; }

/* ---------- Your own toolbox: BlockForge, born tiles, sections that unfold, tiles in flight ---------- */

/* A building block someone made: a small signal corner tells it apart from the built-in bricks. */
.ap-tile--custom::before { content: ''; position: absolute; top: 6px; right: 6px; width: 6px; height: 6px; border-radius: 50%; background: var(--signal); box-shadow: 0 0 0 3px var(--signal-soft); }

/* Born: the tile condenses out of a blur, overshoots once, its well spins into place, a signal ring
   ripples out and six sparks fly. 720 ms on the spring curve. */
.ap-tile--born { animation: ap-tile-born 720ms var(--ease-spring) both; }
.ap-tile--born .ap-well { animation: ap-well-spin 760ms var(--ease-spring) both; }
.ap-tile--born::after { content: ''; position: absolute; inset: -2px; border-radius: inherit; box-shadow: 0 0 0 2px var(--signal); pointer-events: none; animation: ap-tile-ring 900ms 180ms var(--ease-out) both; }
.ap-tile--born .ap-tile-label { animation: ap-label-rise 520ms 220ms var(--ease-out) both; }
.ap-tile--born.ap-tile--custom::before { animation: ap-spark 820ms 140ms var(--ease-out) both; width: 4px; height: 4px; top: 50%; left: 50%; right: auto; margin: -2px; background: transparent; }
@keyframes ap-tile-born {
  0% { opacity: 0; transform: translateY(12px) scale(0.55) rotate(-9deg); filter: blur(8px); }
  55% { opacity: 1; transform: translateY(-4px) scale(1.08) rotate(2deg); filter: blur(0); }
  100% { opacity: 1; transform: none; filter: none; }
}
@keyframes ap-well-spin { 0% { transform: rotate(-140deg) scale(0.3); } 100% { transform: none; } }
@keyframes ap-label-rise { 0% { opacity: 0; transform: translateY(6px); } 100% { opacity: 1; transform: none; } }
@keyframes ap-tile-ring { 0% { opacity: 0.95; transform: scale(1); } 100% { opacity: 0; transform: scale(1.4); } }
@keyframes ap-spark {
  0% { opacity: 1; box-shadow: 0 0 0 0 var(--signal), 0 0 0 0 var(--signal), 0 0 0 0 var(--signal), 0 0 0 0 var(--signal), 0 0 0 0 var(--signal), 0 0 0 0 var(--signal); }
  100% { opacity: 0; box-shadow: 0 -58px 0 -1px var(--signal), 50px -29px 0 -1px var(--signal), 50px 29px 0 -1px var(--signal), 0 58px 0 -1px var(--signal), -50px 29px 0 -1px var(--signal), -50px -29px 0 -1px var(--signal); }
}

/* A new section unfolds from its title: the clip opens top to bottom while the chip slides in and
   a signal underline draws itself under the name. */
.ap-section--born { animation: ap-section-unfold 680ms var(--ease-out) both; }
.ap-section--born > :first-child { animation: ap-chip-slide 520ms var(--ease-spring) both; }
.ap-section--born .ap-section-rule { transform-origin: left; animation: ap-rule-draw 700ms 160ms var(--ease-out) both; }
@keyframes ap-section-unfold { 0% { clip-path: inset(0 0 100% 0 round 12px); opacity: 0.2; } 100% { clip-path: inset(0 0 0 0 round 12px); opacity: 1; } }
@keyframes ap-chip-slide { 0% { opacity: 0; transform: translateX(-18px); } 100% { opacity: 1; transform: none; } }
@keyframes ap-rule-draw { 0% { transform: scaleX(0); } 100% { transform: scaleX(1); } }
.ap-section-rule { display: block; height: 2px; border-radius: 1px; background: linear-gradient(90deg, var(--signal), transparent); }

/* The slot that makes a new block: a dashed tile that breathes when hovered. */
.ap-tile--add { justify-content: center; align-items: center; gap: 6px; border-style: dashed; border-color: var(--ink-faint); background: transparent; box-shadow: none; color: var(--ink-muted); cursor: pointer; }
.ap-tile--add:hover { border-color: var(--signal); color: var(--signal); background: color-mix(in srgb, var(--signal-soft) 60%, transparent); transform: translateY(-2px); }
.ap-tile--add .ap-tile-label { text-align: center; }

/* The forge itself */
.ap-forge { width: 320px; max-width: calc(100vw - 32px); display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4); border-radius: var(--radius-lg); background: var(--surface); border: var(--stroke-hairline) solid var(--hairline); box-shadow: var(--shadow-float); color: var(--ink); font-family: var(--font-sans); animation: ap-forge-in 460ms var(--ease-spring) both; transform-origin: top left; }
@keyframes ap-forge-in { 0% { opacity: 0; transform: translateY(10px) scale(0.92); filter: blur(4px); } 100% { opacity: 1; transform: none; filter: none; } }
.ap-forge-head { display: flex; align-items: baseline; gap: var(--space-2); }
.ap-forge-title { font-family: var(--font-display); font-size: 20px; line-height: 26px; font-weight: 700; letter-spacing: -0.01em; }
.ap-forge-section { font: 500 12px/16px var(--font-mono); color: var(--ink-muted); }
.ap-forge-stage { position: relative; height: 132px; display: grid; place-items: center; border-radius: var(--radius-md); overflow: hidden; background-color: var(--ground-sunken); background-image: radial-gradient(var(--grid) 1.2px, transparent 1.3px); background-size: 16px 16px; perspective: 600px; }
.ap-forge-halo { position: absolute; width: 180px; height: 180px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--layer-color, var(--signal-soft)) 90%, var(--signal) 10%) 0%, transparent 68%); animation: ap-halo-breathe 2.8s ease-in-out infinite; transition: background 420ms var(--ease-out); }
.ap-layer--security .ap-forge-halo { background: radial-gradient(circle, color-mix(in srgb, var(--signal-soft) 70%, transparent) 0%, transparent 68%); }
@keyframes ap-halo-breathe { 0%, 100% { transform: scale(0.88); opacity: 0.75; } 50% { transform: scale(1.05); opacity: 1; } }
.ap-forge-turn { position: relative; animation: ap-forge-turn 560ms var(--ease-spring) both; transform-style: preserve-3d; }
@keyframes ap-forge-turn { 0% { transform: rotateY(-100deg) scale(0.86); opacity: 0.2; } 100% { transform: none; opacity: 1; } }
.ap-forge-preview { cursor: default; box-shadow: var(--shadow-lift); }
.ap-forge-preview:hover { transform: none; }
.ap-forge-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; line-height: 16px; font-weight: 600; color: var(--ink-muted); }
.ap-forge-field input, .ap-forge-field select { height: 38px; padding: 0 var(--space-3); border-radius: var(--radius-sm); border: var(--stroke-hairline) solid var(--hairline); background: var(--ground); color: var(--ink); font: 500 15px/22px var(--font-sans); }
.ap-forge-field input:focus, .ap-forge-field select:focus { outline: none; border-color: var(--signal); box-shadow: 0 0 0 3px var(--signal-soft); }
.ap-forge-label { font-size: 12px; line-height: 16px; font-weight: 600; color: var(--ink-muted); }
.ap-forge-glyphs { display: grid; grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); gap: 4px; max-height: 120px; overflow: auto; padding: 2px; }
.ap-forge-glyph { height: 34px; display: grid; place-items: center; border-radius: var(--radius-sm); border: var(--stroke-hairline) solid transparent; background: transparent; color: var(--ink-muted); cursor: pointer; transition: transform 160ms var(--ease-spring), background 160ms var(--ease-out), color 160ms var(--ease-out); }
.ap-forge-glyph:hover { background: var(--ground-sunken); color: var(--ink); transform: translateY(-2px); }
.ap-forge-glyph.is-on { color: var(--signal); border-color: var(--signal); background: var(--signal-soft); animation: ap-pick 340ms var(--ease-spring); }
@keyframes ap-pick { 0% { transform: scale(0.8); } 60% { transform: scale(1.15); } 100% { transform: none; } }
.ap-forge-tones { display: flex; gap: var(--space-2); }
.ap-forge-tone { width: 32px; height: 32px; padding: 0; display: grid; place-items: center; border-radius: 50%; border: 2px solid transparent; background: transparent; cursor: pointer; transition: transform 160ms var(--ease-spring); }
.ap-forge-tone:hover { transform: scale(1.1); }
.ap-forge-tone.is-on { border-color: var(--signal); }
.ap-forge-swatch { width: 22px; height: 22px; border-radius: 50%; background: var(--layer-color); border: 1.5px solid var(--ink-faint); }
.ap-forge-tone.ap-layer--security .ap-forge-swatch { border: 1.5px dashed var(--ink-faint); }
.ap-forge-actions { display: flex; align-items: center; gap: var(--space-2); }

/* In flight: a tile copied from a chat proposal travels to its place in the toolbox. The host
   animates transform along an arc; this class gives the travelling copy its look. */
.ap-flight { position: fixed; left: 0; top: 0; z-index: 1000; pointer-events: none; filter: drop-shadow(0 18px 24px rgba(11, 12, 14, 0.22)); }
.ap-flight .ap-tile { border-color: var(--signal); }
.ap-flight-trail { position: fixed; z-index: 999; width: 8px; height: 8px; margin: -4px; border-radius: 50%; background: var(--signal); pointer-events: none; animation: ap-trail 620ms var(--ease-out) forwards; }
@keyframes ap-trail { 0% { opacity: 0.6; transform: scale(1); } 100% { opacity: 0; transform: scale(0.2); } }

@media (prefers-reduced-motion: reduce) {
  .ap-tile--born, .ap-tile--born .ap-well, .ap-tile--born::after, .ap-tile--born .ap-tile-label, .ap-tile--born.ap-tile--custom::before,
  .ap-section--born, .ap-section--born > :first-child, .ap-section--born .ap-section-rule,
  .ap-forge, .ap-forge-halo, .ap-forge-turn, .ap-forge-glyph.is-on, .ap-flight-trail { animation: none; }
}

/* ---- Home: canvases as islands, groups as archipelagos ---- */
.ap-isle { position: relative; display: flex; flex-direction: column; min-width: 0; border-radius: var(--radius-lg); background: var(--surface); border: var(--stroke-hairline) solid var(--hairline); box-shadow: var(--shadow-tile); color: var(--ink); font-family: var(--font-sans); text-decoration: none; overflow: hidden; isolation: isolate;
  animation: ap-isle-rise 760ms var(--ease-spring) both; animation-delay: calc(var(--i, 0) * 55ms);
  transition: transform 360ms var(--ease-out), box-shadow 360ms var(--ease-out), border-color var(--duration-base), opacity var(--duration-base); }
@keyframes ap-isle-rise { 0% { opacity: 0; transform: translateY(24px) scale(0.95); filter: blur(6px); } 100% { opacity: 1; transform: none; filter: none; } }
.ap-isle:hover, .ap-isle:focus-within { transform: translateY(-6px); box-shadow: var(--shadow-lift); border-color: var(--ink-faint); }
.ap-isle-hit { position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.ap-isle-hit:focus-visible { outline: 2px solid var(--signal); outline-offset: -2px; }
.ap-isle-sea { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background-color: var(--ground-sunken); background-image: radial-gradient(var(--grid) 1.1px, transparent 1.2px); background-size: 14px 14px; border-bottom: var(--stroke-hairline) solid var(--hairline); transition: background-position 1200ms var(--ease-out); }
.ap-isle:hover .ap-isle-sea { background-position: 7px -7px; }
.ap-isle-sea::after { content: ''; position: absolute; inset: -40%; pointer-events: none; background: radial-gradient(closest-side, color-mix(in srgb, var(--signal) 16%, transparent), transparent); opacity: 0; transform: translate(-28%, 28%); transition: opacity 420ms var(--ease-out), transform 1100ms var(--ease-out); }
.ap-isle:hover .ap-isle-sea::after { opacity: 1; transform: translate(12%, -12%); }
.ap-isle-map { position: absolute; left: 12px; top: 12px; width: calc(100% - 24px); height: calc(100% - 24px); overflow: visible; transition: transform 900ms var(--ease-out); }
.ap-isle:hover .ap-isle-map { transform: scale(1.05) rotate(-0.6deg); }
/* Islands use a signal ramp per layer: the layer tints themselves are too quiet at this size. */
.ap-isle-map { --isle-1: color-mix(in srgb, var(--signal) 28%, var(--surface)); --isle-2: color-mix(in srgb, var(--signal) 58%, var(--surface)); --isle-3: color-mix(in srgb, var(--presence-violet) 62%, var(--surface)); --isle-4: color-mix(in srgb, var(--ink) 45%, var(--surface)); }
.ap-isle-map .ap-layer--1 { --isle: var(--isle-1); } .ap-isle-map .ap-layer--2 { --isle: var(--isle-2); } .ap-isle-map .ap-layer--3 { --isle: var(--isle-3); } .ap-isle-map .ap-layer--4 { --isle: var(--isle-4); } .ap-isle-map .ap-layer--security { --isle: var(--signal-deep); }
.ap-isle-tile { fill: var(--isle, var(--isle-2)); stroke: color-mix(in srgb, var(--isle, var(--isle-2)) 70%, var(--ink)); stroke-width: calc(var(--ap-isle-stroke, 1) * 0.6px); transform-box: fill-box; transform-origin: center;
  animation: ap-isle-pop 560ms var(--ease-spring) both, ap-isle-swell 2.6s var(--ease-in-out) infinite; animation-play-state: running, paused; }
.ap-isle-tile.ap-layer--security { fill: color-mix(in srgb, var(--signal-deep) 14%, var(--surface)); stroke: var(--signal-deep); stroke-dasharray: calc(var(--ap-isle-stroke, 1) * 4px) calc(var(--ap-isle-stroke, 1) * 3px); }
.ap-isle:hover .ap-isle-tile { animation-play-state: running, running; }
@keyframes ap-isle-pop { 0% { scale: 0.2; opacity: 0; } 65% { scale: 1.14; opacity: 1; } 100% { scale: 1; opacity: 1; } }
@keyframes ap-isle-swell { 0%, 100% { translate: 0 0; } 50% { translate: 0 calc(var(--ap-isle-stroke, 1) * -7px); } }
.ap-isle-zone { fill: color-mix(in srgb, var(--isle, var(--isle-2)) 12%, transparent); stroke: color-mix(in srgb, var(--isle, var(--isle-2)) 60%, var(--ink-faint)); stroke-width: calc(var(--ap-isle-stroke, 1) * 1px); stroke-dasharray: calc(var(--ap-isle-stroke, 1) * 5px) calc(var(--ap-isle-stroke, 1) * 4px); animation: ap-isle-fade 700ms var(--ease-out) both; }
.ap-isle-link { stroke: var(--ink-muted); stroke-width: calc(var(--ap-isle-stroke, 1) * 0.9px); stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; opacity: var(--ap-isle-link-opacity, 0.5); animation: ap-isle-draw 1000ms var(--ease-out) forwards; transition: stroke var(--duration-slow); }
.ap-isle:hover .ap-isle-link { stroke: color-mix(in srgb, var(--signal) 70%, var(--ink-faint)); }
@keyframes ap-isle-draw { to { stroke-dashoffset: 0; } }
@keyframes ap-isle-fade { from { opacity: 0; } to { opacity: 1; } }
.ap-isle-map.is-still * { animation: none !important; stroke-dashoffset: 0; }
.ap-isle-seed { fill: var(--signal); animation: ap-isle-fade 600ms both; }
.ap-isle-seed-ring { fill: none; stroke: var(--signal); stroke-width: 1.2; transform-box: fill-box; transform-origin: center; animation: ap-isle-seed 2.8s var(--ease-out) infinite; }
@keyframes ap-isle-seed { 0% { scale: 0.3; opacity: 0.9; } 100% { scale: 2.4; opacity: 0; } }
.ap-isle-live { position: absolute; left: 10px; top: 10px; z-index: 2; display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: var(--radius-pill); background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(8px); font: 600 12px/16px var(--font-sans); color: var(--ink); box-shadow: var(--shadow-tile); }
.ap-isle-live i { width: 8px; height: 8px; border-radius: 50%; background: var(--success); animation: ap-isle-beat 1.6s var(--ease-in-out) infinite; }
@keyframes ap-isle-beat { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 55%, transparent); } 50% { box-shadow: 0 0 0 5px transparent; } }
.ap-isle-badge { position: absolute; right: 10px; top: 10px; z-index: 2; height: 22px; padding: 0 8px; display: inline-flex; align-items: center; border-radius: var(--radius-pill); background: var(--ink); color: var(--ground); font: 600 11px/14px var(--font-mono); letter-spacing: 0.02em; }
.ap-isle-foot { position: relative; display: flex; align-items: center; gap: var(--space-3); padding: 12px 14px 14px; min-height: 64px; box-sizing: border-box; }
.ap-isle-foot::before { content: ''; align-self: stretch; width: 4px; flex: none; border-radius: 2px; background: var(--presence-color, var(--hairline)); transition: transform var(--duration-slow) var(--ease-spring); transform-origin: center; }
.ap-isle:hover .ap-isle-foot::before { transform: scaleY(1.2); }
.ap-isle:not([class*='ap-presence--']) .ap-isle-foot::before { display: none; }
.ap-isle-text { flex: 1; min-width: 0; }
.ap-isle-title { margin: 0; font-family: var(--font-display); font-size: 17px; line-height: 22px; font-weight: 650; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-isle-meta { margin: 3px 0 0; display: flex; flex-wrap: wrap; gap: 0 10px; font: 500 12px/16px var(--font-mono); color: var(--ink-muted); }
.ap-isle-meta span + span::before { content: '·'; margin-right: 10px; color: var(--ink-faint); }
.ap-isle-actions { position: relative; z-index: 2; display: flex; gap: 2px; opacity: 0; transform: translateX(6px); transition: opacity var(--duration-base), transform var(--duration-base) var(--ease-out); }
.ap-isle:hover .ap-isle-actions, .ap-isle:focus-within .ap-isle-actions, .ap-isle-actions:has([aria-expanded='true']) { opacity: 1; transform: none; }
@media (hover: none) { .ap-isle-actions { opacity: 1; transform: none; } }
.ap-isle.is-dragging { opacity: 0.45; transform: scale(0.96) rotate(-1deg); border-style: dashed; box-shadow: none; }
.ap-isle.is-selected { border-color: var(--signal); box-shadow: var(--shadow-signal), var(--shadow-lift); }
.ap-isle.is-born { animation: ap-isle-rise 760ms var(--ease-spring) both, ap-isle-born 1100ms var(--ease-out) 300ms; }
@keyframes ap-isle-born { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--signal) 55%, transparent), var(--shadow-tile); } 100% { box-shadow: 0 0 0 18px transparent, var(--shadow-tile); } }

/* The new-canvas card: rings spread from an island about to rise. */
.ap-isle--new { padding: 0; border: 1.5px dashed color-mix(in srgb, var(--signal) 45%, var(--hairline)); background: color-mix(in srgb, var(--surface) 60%, transparent); cursor: pointer; font: inherit; text-align: left; }
.ap-isle--new .ap-isle-sea { display: grid; place-items: center; background-color: color-mix(in srgb, var(--signal-soft) 45%, var(--ground-sunken)); }
.ap-isle--new:hover, .ap-isle--new:focus-visible { border-color: var(--signal); outline: none; }
.ap-isle-ripples { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.ap-isle-ripples i { grid-area: 1 / 1; width: 64px; height: 64px; border-radius: 50%; border: 1.5px solid var(--signal); opacity: 0; animation: ap-isle-ripple 3.6s var(--ease-out) infinite; }
.ap-isle-ripples i:nth-child(2) { animation-delay: 1.2s; }
.ap-isle-ripples i:nth-child(3) { animation-delay: 2.4s; }
.ap-isle--new:hover .ap-isle-ripples i { animation-duration: 1.8s; }
@keyframes ap-isle-ripple { 0% { transform: scale(0.6); opacity: 0.7; } 100% { transform: scale(3.2); opacity: 0; } }
.ap-isle-plus { position: relative; width: 64px; height: 64px; display: grid; place-items: center; border-radius: 22px; background: var(--signal); color: var(--on-signal); box-shadow: 0 14px 30px -12px color-mix(in srgb, var(--signal) 75%, transparent); transition: transform 520ms var(--ease-spring), border-radius 520ms var(--ease-spring); }
.ap-isle--new:hover .ap-isle-plus { transform: rotate(90deg) scale(1.08); border-radius: 50%; }
.ap-isle--new:active .ap-isle-plus { transform: rotate(90deg) scale(0.94); }

/* A group: its shoreline lights up while a canvas is dragged over it. */
.ap-archi { display: flex; flex-direction: column; gap: var(--space-3); min-width: 0; }
.ap-archi.is-born { animation: ap-section-unfold 620ms var(--ease-out) both; }
.ap-archi-head { display: flex; align-items: center; gap: 10px; min-height: 36px; }
.ap-archi-dot { width: 12px; height: 12px; flex: none; border-radius: 50%; background: var(--presence-color, var(--signal)); box-shadow: 0 0 0 4px color-mix(in srgb, var(--presence-color, var(--signal)) 20%, transparent); transition: transform var(--duration-slow) var(--ease-spring); }
.ap-archi-name { margin: 0; min-width: 0; font-family: var(--font-display); font-size: 22px; line-height: 28px; font-weight: 700; letter-spacing: -0.015em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.ap-archi-input { width: min(320px, 60vw); padding: 0 8px; border: var(--stroke-hairline) solid var(--signal); border-radius: var(--radius-sm); background: var(--surface); box-shadow: 0 0 0 3px var(--signal-soft); outline: none; }
.ap-archi-count { flex: none; min-width: 24px; height: 22px; padding: 0 7px; box-sizing: border-box; display: inline-grid; place-items: center; border-radius: var(--radius-pill); background: var(--ground-sunken); font: 600 12px/16px var(--font-mono); color: var(--ink-muted); }
.ap-archi-rule { flex: 1; height: 1px; min-width: 24px; background: var(--hairline); transform-origin: left; animation: ap-rule-draw 900ms var(--ease-out) both; }
.ap-archi-fold { width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--ink-muted); cursor: pointer; transform: rotate(90deg); transition: transform var(--duration-slow) var(--ease-spring), background var(--duration-fast); }
.ap-archi-fold:hover { background: var(--ground-sunken); color: var(--ink); }
.ap-archi.is-collapsed .ap-archi-fold { transform: none; }
.ap-archi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 248px), 1fr)); gap: 18px; padding: 10px; margin: -10px; border-radius: var(--radius-xl); transition: background var(--duration-slow) var(--ease-out), box-shadow var(--duration-slow) var(--ease-out); }
.ap-archi.is-dropping .ap-archi-grid { background: color-mix(in srgb, var(--presence-color, var(--signal)) 9%, transparent); animation: ap-archi-tide 1.4s var(--ease-in-out) infinite; }
.ap-archi.is-dropping .ap-archi-dot { transform: scale(1.5); }
@keyframes ap-archi-tide { 0%, 100% { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--presence-color, var(--signal)) 55%, transparent); } 50% { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--presence-color, var(--signal)) 20%, transparent), inset 0 0 36px color-mix(in srgb, var(--presence-color, var(--signal)) 16%, transparent); } }
.ap-archi-empty { grid-column: 1 / -1; min-height: 112px; display: grid; place-items: center; border: 1.5px dashed var(--hairline); border-radius: var(--radius-lg); font-size: 14px; color: var(--ink-muted); background-image: linear-gradient(100deg, transparent 30%, color-mix(in srgb, var(--presence-color, var(--signal)) 10%, transparent) 50%, transparent 70%); background-size: 250% 100%; animation: ap-archi-shimmer 3.4s linear infinite; }
@keyframes ap-archi-shimmer { from { background-position: 120% 0; } to { background-position: -120% 0; } }

/* Sign-in: one button per identity provider, cascading in. */
.ap-idp { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 10px 14px 10px 10px; box-sizing: border-box; border-radius: var(--radius-md); border: var(--stroke-hairline) solid var(--hairline); background: var(--surface); color: var(--ink); font-family: var(--font-sans); text-align: left; cursor: pointer; overflow: hidden;
  animation: ap-idp-in 620ms var(--ease-spring) both; animation-delay: calc(120ms + var(--i, 0) * 60ms);
  transition: transform var(--duration-base) var(--ease-out), border-color var(--duration-fast), box-shadow var(--duration-base); }
@keyframes ap-idp-in { 0% { opacity: 0; transform: translateX(-16px); } 100% { opacity: 1; transform: none; } }
.ap-idp:hover:not(:disabled), .ap-idp:focus-visible { transform: translateX(3px); border-color: var(--signal); box-shadow: var(--shadow-lift); outline: none; }
.ap-idp:disabled { cursor: default; opacity: 0.6; }
.ap-idp-mark { --idp: var(--signal); width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 10px; background: color-mix(in srgb, var(--idp) 16%, var(--surface)); color: color-mix(in srgb, var(--idp) 80%, var(--ink)); font: 700 13px/1 var(--font-mono); letter-spacing: -0.02em; transition: transform 420ms var(--ease-spring); }
.ap-idp:hover .ap-idp-mark { transform: rotate(-8deg) scale(1.08); }
.ap-idp--keycloak .ap-idp-mark { --idp: var(--presence-teal); }
.ap-idp--okta .ap-idp-mark { --idp: var(--presence-violet); }
.ap-idp--entra .ap-idp-mark { --idp: var(--layer-2); }
.ap-idp--google .ap-idp-mark { --idp: var(--presence-coral); }
.ap-idp--auth0 .ap-idp-mark { --idp: var(--presence-rose); }
.ap-idp--firebase .ap-idp-mark { --idp: var(--presence-amber); }
.ap-idp--proxy .ap-idp-mark, .ap-idp--oidc .ap-idp-mark { --idp: var(--ink-muted); }
.ap-idp-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ap-idp-text strong { font-size: 15px; line-height: 20px; font-weight: 600; }
.ap-idp-text small { font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.ap-idp-go { color: var(--ink-faint); transition: transform var(--duration-base) var(--ease-out), color var(--duration-fast); }
.ap-idp:hover .ap-idp-go { transform: translateX(4px); color: var(--signal); }
.ap-idp.is-busy::after { content: ''; position: absolute; left: 0; bottom: 0; height: 2px; width: 40%; background: var(--signal); animation: ap-idp-busy 1s var(--ease-in-out) infinite; }
@keyframes ap-idp-busy { from { transform: translateX(-100%); } to { transform: translateX(260%); } }

/* The sea behind the home page: dots that drift, lit by a slow tide. */
.ap-sea { position: relative; isolation: isolate; }
.ap-sea::before { content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none; background-image: radial-gradient(var(--grid) 1.2px, transparent 1.3px); background-size: var(--grid-step) var(--grid-step);
  -webkit-mask-image: radial-gradient(ellipse 60% 70% at var(--tide-x, 30%) var(--tide-y, 40%), #000 0%, rgba(0, 0, 0, 0.35) 55%, transparent 100%); mask-image: radial-gradient(ellipse 60% 70% at var(--tide-x, 30%) var(--tide-y, 40%), #000 0%, rgba(0, 0, 0, 0.35) 55%, transparent 100%);
  animation: ap-sea-drift 40s linear infinite; }
@keyframes ap-sea-drift { from { background-position: 0 0; } to { background-position: calc(var(--grid-step) * 8) calc(var(--grid-step) * 3); } }
.ap-drift { animation: ap-drift 7s var(--ease-in-out) infinite alternate; animation-delay: calc(var(--i, 0) * -1.7s); }
@keyframes ap-drift { from { transform: translate3d(0, 0, 0) rotate(var(--tilt, -2deg)); } to { transform: translate3d(0, -16px, 0) rotate(calc(var(--tilt, -2deg) * -1)); } }

@media (prefers-reduced-motion: reduce) {
  .ap-isle, .ap-isle.is-born, .ap-isle-tile, .ap-isle-zone, .ap-isle-seed-ring, .ap-isle-live i, .ap-isle-ripples i, .ap-archi.is-born, .ap-archi-rule, .ap-archi.is-dropping .ap-archi-grid, .ap-archi-empty, .ap-idp, .ap-sea::before, .ap-drift { animation: none !important; }
  .ap-isle-link { animation: none; stroke-dashoffset: 0; }
  .ap-isle:hover, .ap-isle:hover .ap-isle-map { transform: none; }
}

/* ---------- WorkshopJourney: a workshop in four moves, a voyage across the archipelago ---------- */
.ap-journey { font-family: var(--font-sans); color: var(--ink); }
.ap-journey-head { display: flex; flex-direction: column; gap: 10px; margin-bottom: 32px; max-width: 760px; }
.ap-journey-kicker { display: inline-flex; align-items: center; gap: 8px; font: 600 12px/16px var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--signal-deep); }
.ap-journey-kicker i { width: 8px; height: 8px; border-radius: 50%; background: var(--presence-violet); box-shadow: 0 0 0 4px color-mix(in srgb, var(--presence-violet) 18%, transparent); }
.ap-journey-title { margin: 0; font-family: var(--font-display); font-weight: 750; font-size: clamp(28px, 3.4vw, 44px); line-height: 1.08; letter-spacing: -0.03em; text-wrap: balance; }
.ap-journey-lede { margin: 0; font-size: 17px; line-height: 26px; color: var(--ink-muted); max-width: 620px; }
.ap-journey-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 32px; }
.ap-journey-step { position: relative; display: flex; flex-direction: column; gap: 10px; min-width: 0; animation: ap-journey-in 820ms var(--ease-spring) both; animation-delay: calc(140ms + var(--i, 0) * 130ms); }
@keyframes ap-journey-in { from { opacity: 0; transform: translateY(18px) scale(0.98); } to { opacity: 1; transform: none; } }
.ap-journey-frame { position: relative; }
/* The sea route from one island to the next. */
.ap-journey-step:not(:last-child) .ap-journey-frame::after {
  content: ""; position: absolute; top: 50%; right: -34px; width: 36px; height: 16px; transform: translateY(-50%);
  background: var(--signal); opacity: 0.55;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 36 16'%3E%3Cpath d='M2 10 C10 2 18 14 26 6' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-dasharray='1 5'/%3E%3Cpath d='M27 2 l6 4 -7 3' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 36 16'%3E%3Cpath d='M2 10 C10 2 18 14 26 6' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-dasharray='1 5'/%3E%3Cpath d='M27 2 l6 4 -7 3' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.ap-journey-scene {
  margin: 0; aspect-ratio: 280 / 200; border-radius: 22px; overflow: hidden; border: var(--stroke-hairline) solid var(--hairline);
  background:
    radial-gradient(120% 90% at 20% 0%, color-mix(in srgb, var(--signal) 14%, transparent) 0%, transparent 60%),
    linear-gradient(180deg, color-mix(in srgb, var(--signal) 7%, var(--surface)) 0%, color-mix(in srgb, var(--presence-teal) 13%, var(--surface)) 100%);
  box-shadow: var(--shadow-float); transition: transform var(--duration-base) var(--ease-spring), box-shadow var(--duration-base) var(--ease-out);
}
.ap-journey-scene--tell { background:
    radial-gradient(90% 80% at 85% 10%, color-mix(in srgb, var(--presence-violet) 22%, transparent) 0%, transparent 60%),
    linear-gradient(180deg, color-mix(in srgb, var(--presence-violet) 8%, var(--surface)) 0%, color-mix(in srgb, var(--signal) 12%, var(--surface)) 100%); }
.ap-journey-scene--keep { background:
    radial-gradient(90% 80% at 80% 0%, color-mix(in srgb, var(--presence-amber) 20%, transparent) 0%, transparent 60%),
    linear-gradient(180deg, color-mix(in srgb, var(--presence-amber) 7%, var(--surface)) 0%, color-mix(in srgb, var(--presence-teal) 12%, var(--surface)) 100%); }
.ap-journey-step:hover .ap-journey-scene { transform: translateY(-4px) rotate(-0.6deg); box-shadow: var(--shadow-lift); }
.ap-journey-scene svg { display: block; width: 100%; height: 100%; }
.ap-journey-step h3 { display: flex; align-items: center; gap: 10px; margin: 8px 0 0; font-family: var(--font-display); font-size: 19px; line-height: 24px; font-weight: 650; letter-spacing: -0.01em; }
.ap-journey-num { flex: none; display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--signal); color: var(--on-signal); font: 700 12px/1 var(--font-mono); }
.ap-journey-step p { margin: 0; font-size: 14.5px; line-height: 22px; color: var(--ink-muted); }

/* Inside the scenes */
.jw-wave { fill: none; stroke: var(--signal); stroke-opacity: 0.2; stroke-width: 1.6; stroke-linecap: round; animation: jw-drift 9s linear infinite; }
.jw-waves path:nth-child(2) { animation-duration: 12s; stroke-opacity: 0.14; }
@keyframes jw-drift { to { transform: translateX(60px); } }
.jw-shore { fill: color-mix(in srgb, var(--presence-teal) 20%, transparent); }
.jw-isle { fill: color-mix(in srgb, var(--presence-amber) 15%, var(--surface)); stroke: color-mix(in srgb, var(--presence-amber) 38%, var(--surface)); stroke-width: 1.5; }
.jw-card, .jw-plate, .jw-node, .jw-poster, .jw-bubble { fill: var(--surface-raised); stroke: var(--hairline); stroke-width: 1.2; filter: drop-shadow(0 4px 6px rgb(11 12 14 / 0.12)); }
.jw-card-bar { fill: var(--signal); }
.jw-blk { stroke: none; }
.jw-l1 { fill: color-mix(in srgb, var(--signal) 62%, var(--surface)); }
.jw-l2 { fill: color-mix(in srgb, var(--presence-violet) 62%, var(--surface)); }
.jw-l3 { fill: color-mix(in srgb, var(--presence-teal) 66%, var(--surface)); }
.jw-band { stroke: none; }
.jw-band1 { fill: color-mix(in srgb, var(--signal) 10%, var(--surface)); }
.jw-band2 { fill: color-mix(in srgb, var(--presence-violet) 10%, var(--surface)); }
.jw-band3 { fill: color-mix(in srgb, var(--presence-teal) 12%, var(--surface)); }
.jw-thread { fill: none; stroke: var(--ink-faint); stroke-width: 1.4; stroke-linecap: round; }
.jw-line { fill: var(--ink-faint); opacity: 0.45; }
.jw-line--ink { fill: var(--ink); opacity: 0.7; }
.jw-head { stroke: var(--surface-raised); stroke-width: 2; }
.jw-eye { fill: var(--ink); }
.jw-rose { fill: var(--presence-rose); } .jw-teal { fill: var(--presence-teal); } .jw-amber { fill: var(--presence-amber); } .jw-violet { fill: var(--presence-violet); }
.jw-hull { fill: var(--surface-raised); stroke: var(--ink-faint); stroke-width: 1.2; stroke-linejoin: round; }
.jw-wake { fill: none; stroke: var(--signal); stroke-opacity: 0.45; stroke-width: 1.6; stroke-linecap: round; stroke-dasharray: 2 5; }
.jw-boat { animation: jw-sail 7.5s var(--ease-in-out) infinite both; animation-delay: var(--d, 0s); }
@keyframes jw-sail { 0% { transform: translateX(-40px); opacity: 0; } 12% { opacity: 1; } 62% { transform: translateX(70px); opacity: 1; } 80%, 100% { transform: translateX(84px); opacity: 0; } }
.jw-float { animation: jw-bob 4.2s var(--ease-in-out) infinite; }
@keyframes jw-bob { 50% { transform: translateY(-3px); } }
.jw-badge { fill: var(--signal); }
.jw-badge-halo { fill: var(--signal); opacity: 0.18; transform-box: fill-box; transform-origin: center; animation: jw-ping 2.4s var(--ease-out) infinite; }
@keyframes jw-ping { 0% { transform: scale(0.7); opacity: 0.35; } 100% { transform: scale(1.5); opacity: 0; } }
.jw-chain { fill: none; stroke: var(--on-signal); stroke-width: 2; }
.jw-drop { animation: jw-drop 5.4s var(--ease-spring) infinite both; animation-delay: var(--d, 0s); }
@keyframes jw-drop { 0% { transform: translateY(-36px); opacity: 0; } 8% { opacity: 1; } 20% { transform: none; } 82% { transform: none; opacity: 1; } 94%, 100% { transform: none; opacity: 0; } }
.jw-arrow { stroke: var(--surface-raised); stroke-width: 1.2; stroke-linejoin: round; }
.jw-tag { stroke: none; }
.jw-tag-text { font: 700 9px/1 var(--font-sans); fill: #fff; text-anchor: middle; }
.jw-cur1 { animation: jw-cur1 6s var(--ease-in-out) infinite; }
.jw-cur2 { animation: jw-cur2 7s var(--ease-in-out) infinite; }
@keyframes jw-cur1 { 0%, 100% { transform: translate(150px, 40px); } 35% { transform: translate(176px, 96px); } 70% { transform: translate(120px, 70px); } }
@keyframes jw-cur2 { 0%, 100% { transform: translate(80px, 116px); } 40% { transform: translate(60px, 60px); } 75% { transform: translate(104px, 96px); } }
.jw-story { fill: none; stroke: var(--signal); stroke-width: 2.4; stroke-linecap: round; stroke-dasharray: 5 6; animation: jw-flow 1.6s linear infinite; }
@keyframes jw-flow { to { stroke-dashoffset: -22; } }
.jw-ring circle { fill: var(--surface-raised); stroke: var(--signal); stroke-width: 2; }
.jw-ring text { font: 700 10px/1 var(--font-mono); fill: var(--signal-deep); text-anchor: middle; }
.jw-pulse { fill: var(--signal); }
.jw-pulse-glow { fill: var(--signal); opacity: 0.22; }
.jw-spark { fill: var(--presence-violet); transform-box: fill-box; transform-origin: center; animation: jw-twinkle 3s var(--ease-in-out) infinite; }
.jw-spark--small { animation-delay: 1.1s; opacity: 0.8; }
@keyframes jw-twinkle { 0%, 100% { transform: scale(0.85) rotate(0deg); } 50% { transform: scale(1.12) rotate(45deg); } }
.jw-pole { stroke: var(--ink-muted); stroke-width: 2.2; stroke-linecap: round; }
.jw-flag { fill: var(--signal); }
.jw-flag-g { transform-box: fill-box; transform-origin: left center; animation: jw-flag 2.8s var(--ease-in-out) infinite; }
@keyframes jw-flag { 50% { transform: skewY(5deg) scaleX(0.96); } }
.jw-flag-text { font: 700 9px/1 var(--font-mono); fill: var(--on-signal); text-anchor: middle; }
.jw-sticky { stroke: color-mix(in srgb, var(--ink) 10%, transparent); stroke-width: 1; filter: drop-shadow(0 3px 4px rgb(11 12 14 / 0.14)); }
.jw-sticky--y { fill: var(--sticky-yellow); } .jw-sticky--p { fill: var(--sticky-pink); } .jw-sticky--b { fill: var(--sticky-blue); }
.jw-note { animation: jw-bob 3.6s var(--ease-in-out) infinite; animation-delay: var(--d, 0s); }
.jw-star { fill: none; stroke: var(--presence-amber); stroke-width: 2.2; stroke-linecap: round; transform-box: fill-box; transform-origin: center; animation: jw-star 2.4s var(--ease-in-out) infinite; animation-delay: var(--d, 0s); }
@keyframes jw-star { 0%, 100% { transform: scale(0.4); opacity: 0.2; } 50% { transform: scale(1); opacity: 1; } }

@media (max-width: 1100px) {
  .ap-journey-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 24px; }
  .ap-journey-step .ap-journey-frame::after { display: none; }
}
@media (max-width: 560px) {
  .ap-journey-steps { grid-template-columns: 1fr; }
  .ap-journey-head { margin-bottom: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  .ap-journey-step, .ap-journey-scene, .ap-journey-scene * { animation: none !important; transition: none !important; }
  .jw-boat { transform: translateX(40px); opacity: 1; }
  .jw-cur1 { transform: translate(176px, 96px); } .jw-cur2 { transform: translate(60px, 60px); }
}

/* ---------- Workshop rituals: timer, dot vote, parking lot, lock, follow me ----------
   Each ritual has its own accent so the room tells them apart at a glance: timer amber, vote rose,
   parking lot teal, lock ink, follow signal. Motion announces what changed for everyone; sound confirms it. */
.ap-ritual--timer, .ap-timer, .ap-timeup { --ritual: var(--presence-amber); }
.ap-ritual--vote, .ap-dottray, .ap-results { --ritual: var(--presence-rose); }
.ap-ritual--parking, .ap-park { --ritual: var(--presence-teal); }
.ap-ritual--lock { --ritual: var(--ink); }
.ap-ritual--follow { --ritual: var(--signal); }

.ap-rituals { display: flex; flex-direction: column; gap: var(--space-4); width: 420px; max-width: calc(100vw - 24px); padding: var(--space-5); border-radius: var(--radius-xl); background: var(--surface); border: var(--stroke-hairline) solid var(--hairline); box-shadow: var(--shadow-float); font-family: var(--font-sans); color: var(--ink); animation: ap-rsheet-in 420ms var(--ease-spring) both; }
.ap-rituals-head { display: flex; flex-direction: column; gap: 2px; }
.ap-rituals-kicker { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; line-height: 16px; font-weight: 600; color: var(--signal-deep); }
.ap-rituals-head h3 { margin: 0; font-family: var(--font-display); font-size: 22px; line-height: 28px; font-weight: 650; letter-spacing: -0.015em; }
.ap-rituals-head p { margin: 0; font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.ap-rituals-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-2); }
.ap-ritual { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-height: 124px; padding: 12px; border-radius: var(--radius-lg); border: var(--stroke-hairline) solid var(--hairline); background: var(--ground-sunken); color: var(--ink); font: inherit; text-align: left; cursor: pointer; transition: transform var(--duration-fast) var(--ease-spring), box-shadow var(--duration-fast) var(--ease-out), border-color var(--duration-fast); animation: ap-ritual-in 520ms var(--ease-spring) both; animation-delay: calc(var(--i, 0) * 55ms + 80ms); }
.ap-ritual:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); border-color: color-mix(in srgb, var(--ritual) 45%, var(--hairline)); }
.ap-ritual:hover .ap-ritual-well .ap-glyph { animation: ap-ritual-wiggle 520ms var(--ease-spring); }
.ap-ritual:active { transform: scale(0.97); }
.ap-ritual:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
.ap-ritual-well { position: relative; display: grid; place-items: center; width: 46px; height: 46px; margin-bottom: 4px; border-radius: 15px; background: color-mix(in srgb, var(--ritual) 16%, var(--surface)); color: color-mix(in srgb, var(--ritual) 85%, var(--ink)); }
.ap-ritual-title { font-weight: 650; font-size: 14px; line-height: 18px; }
.ap-ritual-text { font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.ap-ritual-count { position: absolute; top: -6px; right: -8px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--ritual); color: var(--surface); font-size: 11px; line-height: 20px; font-weight: 700; text-align: center; animation: ap-pop 300ms var(--ease-spring) both; }
.ap-ritual.is-active { border-color: var(--ritual); background: color-mix(in srgb, var(--ritual) 9%, var(--surface)); }
.ap-ritual-live { position: absolute; top: 12px; right: 12px; width: 9px; height: 9px; border-radius: 50%; background: var(--ritual); animation: ap-ritual-live 1.6s ease-out infinite; }
@keyframes ap-ritual-in { from { opacity: 0; transform: translateY(14px) scale(0.9); } to { opacity: 1; transform: none; } }
@keyframes ap-ritual-wiggle { 0% { transform: rotate(0); } 30% { transform: rotate(-14deg) scale(1.1); } 60% { transform: rotate(9deg) scale(1.05); } 100% { transform: none; } }
@keyframes ap-ritual-live { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ritual) 55%, transparent); } 100% { box-shadow: 0 0 0 9px transparent; } }

/* Timer */
.ap-timer { display: inline-flex; align-items: center; gap: 10px; padding: 5px 8px 5px 5px; border-radius: var(--radius-pill); background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: blur(16px) saturate(1.2); -webkit-backdrop-filter: blur(16px) saturate(1.2); border: var(--stroke-hairline) solid color-mix(in srgb, var(--ritual) 45%, var(--hairline)); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ritual) 10%, transparent), var(--shadow-float); font-family: var(--font-sans); color: var(--ink); animation: ap-timer-in 620ms var(--ease-spring) both; }
.ap-timer-dial { position: relative; display: grid; place-items: center; width: 44px; height: 44px; color: color-mix(in srgb, var(--ritual) 80%, var(--ink)); }
.ap-timer-dial .ap-timer-ring { position: absolute; inset: 0; overflow: visible; }
.ap-timer-track { fill: color-mix(in srgb, var(--ritual) 10%, transparent); stroke: color-mix(in srgb, var(--ritual) 22%, transparent); stroke-width: 4; }
.ap-timer-arc { fill: none; stroke: var(--ritual); stroke-width: 4; stroke-linecap: round; transform: rotate(-90deg); transform-origin: 24px 24px; transition: stroke-dashoffset 300ms linear, stroke 300ms; animation: ap-timer-wind 700ms var(--ease-out) both; }
.ap-timer-head { fill: var(--surface); stroke: var(--ritual); stroke-width: 2.5; transition: cx 300ms linear, cy 300ms linear; }
.ap-timer-text { display: flex; flex-direction: column; min-width: 58px; }
.ap-timer-label { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; line-height: 14px; font-weight: 600; color: var(--ink-muted); }
.ap-timer-clock { display: inline-block; font-family: var(--font-display); font-size: 24px; line-height: 26px; font-weight: 700; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.ap-timer-by { display: inline-flex; }
.ap-timer-actions { display: inline-flex; align-items: center; gap: 2px; padding-left: 4px; border-left: var(--stroke-hairline) solid var(--hairline); }
.ap-timer-add { height: 30px; padding: 0 10px; border: 0; border-radius: var(--radius-pill); background: color-mix(in srgb, var(--ritual) 14%, transparent); color: inherit; font: 700 12px/1 var(--font-mono); cursor: pointer; transition: transform var(--duration-fast) var(--ease-spring); }
.ap-timer-add:hover { transform: scale(1.08); }
.ap-timer-add:active { transform: scale(0.92); }
.ap-timer--paused .ap-timer-arc { stroke-dasharray: 3 5 !important; opacity: 0.55; }
.ap-timer--paused .ap-timer-clock { animation: ap-timer-blink 1.4s steps(2, jump-none) infinite; }
.ap-timer--ending { --ritual: var(--danger); animation: ap-timer-in 620ms var(--ease-spring) both, ap-timer-alarm 1s ease-in-out infinite; }
.ap-timer--ending .ap-timer-clock { color: var(--danger); animation: ap-timer-beat 420ms var(--ease-spring); }
.ap-timer--done { --ritual: var(--danger); background: color-mix(in srgb, var(--danger) 12%, var(--surface)); animation: ap-timer-shake 600ms var(--ease-out); }
.ap-timer--done .ap-timer-clock { font-size: 18px; color: var(--danger); }
.ap-timer--compact { gap: 6px; padding: 3px 6px 3px 3px; }
.ap-timer--compact .ap-timer-dial { width: 34px; height: 34px; }
.ap-timer--compact .ap-timer-ring { transform: scale(0.77); transform-origin: 0 0; width: 44px; height: 44px; }
.ap-timer--compact .ap-timer-clock { font-size: 18px; line-height: 20px; }
.ap-timer--compact .ap-timer-label, .ap-timer--compact .ap-timer-by { display: none; }
@keyframes ap-timer-in { 0% { opacity: 0; transform: translateY(-26px) scale(0.7); } 60% { opacity: 1; transform: translateY(3px) scale(1.04); } 100% { transform: none; } }
@keyframes ap-timer-wind { from { stroke-dashoffset: 120; } }
@keyframes ap-timer-blink { 50% { opacity: 0.35; } }
@keyframes ap-timer-beat { 0% { transform: scale(1.35); } 100% { transform: none; } }
@keyframes ap-timer-alarm { 0%, 100% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 14%, transparent), var(--shadow-float); } 50% { box-shadow: 0 0 0 10px color-mix(in srgb, var(--danger) 6%, transparent), var(--shadow-float); } }
@keyframes ap-timer-shake { 0%, 100% { transform: none; } 15% { transform: translateX(-6px) rotate(-2deg); } 35% { transform: translateX(5px) rotate(1.5deg); } 55% { transform: translateX(-3px); } 75% { transform: translateX(2px); } }

/* Ritual sheets: setup forms, results, parking lot */
.ap-rsheet, .ap-results, .ap-park { display: flex; flex-direction: column; gap: var(--space-4); width: 392px; max-width: calc(100vw - 24px); padding: var(--space-5); border-radius: var(--radius-xl); background: var(--surface); border: var(--stroke-hairline) solid var(--hairline); box-shadow: var(--shadow-float); font-family: var(--font-sans); color: var(--ink); animation: ap-rsheet-in 460ms var(--ease-spring) both; }
.ap-rsheet { --ritual: var(--signal); }
.ap-rsheet--timer { --ritual: var(--presence-amber); }
.ap-rsheet--vote { --ritual: var(--presence-rose); }
.ap-rsheet-head { display: flex; align-items: flex-start; gap: 12px; }
.ap-rsheet-mark { display: grid; place-items: center; flex: none; width: 42px; height: 42px; border-radius: 14px; background: color-mix(in srgb, var(--ritual) 16%, var(--surface)); color: color-mix(in srgb, var(--ritual) 85%, var(--ink)); animation: ap-mark-in 640ms var(--ease-spring) both 80ms; }
.ap-rsheet-titles { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.ap-rsheet-titles h3 { margin: 0; font-family: var(--font-display); font-size: 20px; line-height: 26px; font-weight: 650; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.ap-rsheet-titles p { margin: 0; font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.ap-rsheet-presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-2); }
.ap-preset { display: flex; align-items: baseline; justify-content: center; gap: 4px; padding: 12px 6px; border-radius: var(--radius-lg); border: var(--stroke-hairline) solid var(--hairline); background: var(--ground-sunken); color: var(--ink); font: inherit; cursor: pointer; transition: transform var(--duration-fast) var(--ease-spring), background var(--duration-fast); animation: ap-ritual-in 480ms var(--ease-spring) both; animation-delay: calc(var(--i, 0) * 40ms + 60ms); }
.ap-preset b { font-family: var(--font-display); font-size: 28px; line-height: 30px; font-weight: 700; }
.ap-preset span { font-size: 12px; color: var(--ink-muted); }
.ap-preset:hover { transform: translateY(-2px); }
.ap-preset.is-on { background: var(--ritual); border-color: var(--ritual); color: var(--surface); animation: ap-pick 360ms var(--ease-spring); }
.ap-preset.is-on span { color: inherit; opacity: 0.85; }
.ap-rsheet-row { display: flex; align-items: center; justify-content: center; gap: var(--space-3); }
.ap-rsheet-value { min-width: 84px; text-align: center; font-family: var(--font-display); font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ap-rsheet-value small { font-size: 13px; font-weight: 600; color: var(--ink-muted); }
.ap-rsheet-field { display: flex; flex-direction: column; gap: 6px; }
.ap-rsheet-field > span { font-size: 12px; line-height: 16px; font-weight: 600; color: var(--ink-muted); }
.ap-rsheet-field input, .ap-park-add input { height: 42px; padding: 0 12px; border-radius: var(--radius-md); border: var(--stroke-hairline) solid var(--hairline); background: var(--ground-sunken); color: var(--ink); font: 15px/1 var(--font-sans); outline: none; transition: border-color var(--duration-fast), box-shadow var(--duration-fast); }
.ap-rsheet-field input:focus, .ap-park-add input:focus { border-color: var(--signal); box-shadow: 0 0 0 3px var(--signal-soft); }
.ap-rsheet-dots { display: flex; align-items: center; gap: var(--space-3); }
.ap-rsheet-dotrow { display: inline-flex; gap: 6px; flex: 1; justify-content: center; }
.ap-rsheet-dotrow .ap-vdot { animation: ap-pop 380ms var(--ease-spring) both; animation-delay: calc(var(--i, 0) * 45ms); }
.ap-seg { display: flex; padding: 3px; border-radius: var(--radius-pill); background: var(--ground-sunken); border: var(--stroke-hairline) solid var(--hairline); }
.ap-seg button { flex: 1; height: 34px; padding: 0 10px; border: 0; border-radius: var(--radius-pill); background: transparent; color: var(--ink-muted); font: 600 13px/1 var(--font-sans); cursor: pointer; transition: background var(--duration-fast), color var(--duration-fast); }
.ap-seg button.is-on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-tile); }
.ap-rsheet-foot { display: flex; justify-content: flex-end; gap: var(--space-2); }
@keyframes ap-rsheet-in { 0% { opacity: 0; transform: translateY(12px) scale(0.94); filter: blur(3px); } 100% { opacity: 1; transform: none; filter: none; } }
@keyframes ap-mark-in { 0% { transform: scale(0.3) rotate(-90deg); } 100% { transform: none; } }

/* The bell */
.ap-timeup { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; pointer-events: none; overflow: hidden; }
.ap-timeup-wave { position: absolute; left: 50%; top: 64px; width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%; border: 3px solid var(--ritual); background: radial-gradient(closest-side, transparent 70%, color-mix(in srgb, var(--ritual) 18%, transparent)); animation: ap-timeup-wave 1.6s var(--ease-out) both; }
.ap-timeup-wave--2 { animation-delay: 380ms; }
.ap-timeup-card { pointer-events: auto; display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 260px; padding: 28px 32px 22px; border-radius: var(--radius-xl); background: var(--surface); border: var(--stroke-hairline) solid color-mix(in srgb, var(--ritual) 50%, var(--hairline)); box-shadow: 0 0 0 8px color-mix(in srgb, var(--ritual) 12%, transparent), var(--shadow-float); text-align: center; color: var(--ink); font-family: var(--font-sans); animation: ap-timeup-card 700ms var(--ease-spring) both 120ms; }
.ap-timeup-card strong { font-family: var(--font-display); font-size: 34px; line-height: 38px; font-weight: 750; letter-spacing: -0.02em; }
.ap-timeup-card > span:not(.ap-timeup-bell) { font-size: 15px; color: var(--ink-muted); }
.ap-timeup-bell { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: color-mix(in srgb, var(--ritual) 16%, var(--surface)); color: color-mix(in srgb, var(--ritual) 85%, var(--ink)); transform-origin: 50% 8%; animation: ap-bell-swing 1.4s var(--ease-out) both 200ms; }
@keyframes ap-timeup-wave { 0% { opacity: 0.9; transform: scale(0.3); } 100% { opacity: 0; transform: scale(18); } }
@keyframes ap-timeup-card { 0% { opacity: 0; transform: scale(0.6) translateY(20px); } 100% { opacity: 1; transform: none; } }
@keyframes ap-bell-swing { 0% { transform: rotate(0); } 12% { transform: rotate(22deg); } 28% { transform: rotate(-18deg); } 44% { transform: rotate(12deg); } 60% { transform: rotate(-7deg); } 76% { transform: rotate(3deg); } 100% { transform: none; } }

/* Dots */
.ap-vdot { display: inline-block; flex: none; border-radius: 50%; background: radial-gradient(circle at 34% 30%, rgba(255, 255, 255, 0.75) 0 14%, transparent 16%), var(--presence-color, var(--signal)); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.18), 0 2px 5px -1px rgba(0, 0, 0, 0.35); }
.ap-vdot--ready { animation: ap-vdot-bob 2.4s ease-in-out infinite alternate; animation-delay: calc(var(--i, 0) * -400ms); }
.ap-vdot--spent { background: transparent; box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--presence-color, var(--signal)) 55%, transparent); transform: scale(0.82); transition: transform var(--duration-base) var(--ease-spring); }
.ap-vdot--mine { box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.18), 0 0 0 2px var(--surface), 0 2px 6px -1px rgba(0, 0, 0, 0.4); }
.ap-vdot--drop { animation: ap-vdot-drop 620ms var(--ease-out) both; animation-delay: var(--d, 0ms); }
@keyframes ap-vdot-bob { from { transform: translateY(0); } to { transform: translateY(-3px); } }
@keyframes ap-vdot-drop { 0% { opacity: 0; transform: translateY(-64px) scale(0.6); } 45% { opacity: 1; transform: translateY(0) scale(1.22, 0.78); } 65% { transform: translateY(-7px) scale(0.94, 1.08); } 82% { transform: translateY(0) scale(1.05, 0.96); } 100% { transform: none; } }

.ap-dottray { display: flex; flex-direction: column; gap: var(--space-3); width: 460px; max-width: calc(100vw - 24px); padding: var(--space-4) var(--space-5); border-radius: var(--radius-xl); background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(18px) saturate(1.2); -webkit-backdrop-filter: blur(18px) saturate(1.2); border: var(--stroke-hairline) solid color-mix(in srgb, var(--ritual) 40%, var(--hairline)); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ritual) 9%, transparent), var(--shadow-float); font-family: var(--font-sans); color: var(--ink); animation: ap-tray-in 560ms var(--ease-spring) both; }
.ap-dottray-head { display: flex; flex-direction: column; gap: 2px; }
.ap-dottray-kicker { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; line-height: 16px; font-weight: 650; color: color-mix(in srgb, var(--ritual) 80%, var(--ink)); }
.ap-dottray-head h3 { margin: 0; font-family: var(--font-display); font-size: 19px; line-height: 24px; font-weight: 650; letter-spacing: -0.01em; }
.ap-dottray-mine { display: flex; align-items: center; gap: var(--space-3); }
.ap-dottray-dots { display: inline-flex; gap: 6px; }
.ap-dottray-hint { font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.ap-dottray-room { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 6px 10px; }
.ap-dottray-bar { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--ground-sunken); overflow: hidden; }
.ap-dottray-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, color-mix(in srgb, var(--ritual) 60%, var(--signal)), var(--ritual)); transition: width 600ms var(--ease-spring); }
.ap-dottray-count { font: 600 12px/16px var(--font-mono); color: var(--ink-muted); }
.ap-dottray-voters { display: inline-flex; justify-self: end; padding-left: 6px; }
.ap-dottray-voter { position: relative; display: inline-flex; margin-left: -6px; border-radius: 50%; box-shadow: 0 0 0 2px var(--surface); transition: transform var(--duration-base) var(--ease-spring); }
.ap-dottray-voter.is-done { transform: translateY(-2px); }
.ap-dottray-voter i { position: absolute; right: -3px; bottom: -3px; display: grid; place-items: center; width: 13px; height: 13px; border-radius: 50%; background: var(--success); color: var(--surface); box-shadow: 0 0 0 2px var(--surface); animation: ap-pop 320ms var(--ease-spring) both; }
.ap-dottray-voter i .ap-glyph { stroke-width: 3; }
.ap-dottray-foot { display: flex; justify-content: flex-end; gap: var(--space-2); }
@keyframes ap-tray-in { 0% { opacity: 0; transform: translateY(40px) scale(0.9); } 100% { opacity: 1; transform: none; } }

.ap-vbadge { position: relative; display: inline-flex; align-items: center; gap: 4px; padding: 3px 6px 3px 4px; border-radius: var(--radius-pill); background: color-mix(in srgb, var(--surface) 92%, transparent); box-shadow: var(--shadow-tile); }
.ap-vbadge-dots { display: inline-flex; }
.ap-vbadge-dots .ap-vdot + .ap-vdot { margin-left: -7px; }
.ap-vbadge-count { font: 700 12px/1 var(--font-mono); color: var(--ink); padding-left: 2px; animation: ap-pop 300ms var(--ease-spring) both; }
.ap-vbadge-medal { display: grid; place-items: center; width: 26px; height: 26px; margin-right: 2px; border-radius: 50%; font: 800 13px/1 var(--font-display); color: #3b2a00; background: radial-gradient(circle at 35% 30%, #fff6c8, #f5c542 55%, #c98a12); box-shadow: 0 0 0 2px var(--surface), 0 4px 10px -2px rgba(201, 138, 18, 0.6); animation: ap-medal-in 760ms var(--ease-spring) both; animation-delay: var(--medal-delay, 0ms); }
.ap-vbadge--r2 .ap-vbadge-medal { color: #2c3138; background: radial-gradient(circle at 35% 30%, #ffffff, #c9d1da 55%, #8b97a5); box-shadow: 0 0 0 2px var(--surface), 0 4px 10px -2px rgba(110, 125, 140, 0.55); }
.ap-vbadge--r3 .ap-vbadge-medal { color: #3a1d0a; background: radial-gradient(circle at 35% 30%, #ffe0c2, #d98c4a 55%, #9c5521); box-shadow: 0 0 0 2px var(--surface), 0 4px 10px -2px rgba(156, 85, 33, 0.55); }
.ap-vbadge--r1 { box-shadow: 0 0 0 3px color-mix(in srgb, #f5c542 45%, transparent), var(--shadow-float); }
@keyframes ap-medal-in { 0% { opacity: 0; transform: scale(0.2) rotate(-200deg); } 70% { opacity: 1; transform: scale(1.2) rotate(10deg); } 100% { transform: none; } }

.ap-results-list { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
.ap-results-row { display: grid; grid-template-columns: 26px 22px minmax(0, 1.1fr) minmax(60px, 1fr) 28px; align-items: center; gap: 8px; padding: 6px 8px; border-radius: var(--radius-md); background: var(--ground-sunken); animation: ap-row-in 520ms var(--ease-spring) both; animation-delay: calc(var(--i, 0) * 90ms + 150ms); }
.ap-results-rank { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--surface); font: 750 12px/1 var(--font-display); color: var(--ink-muted); }
.ap-results-row.is-r1 .ap-results-rank { color: #3b2a00; background: radial-gradient(circle at 35% 30%, #fff6c8, #f5c542 55%, #c98a12); }
.ap-results-row.is-r2 .ap-results-rank { color: #2c3138; background: radial-gradient(circle at 35% 30%, #ffffff, #c9d1da 55%, #8b97a5); }
.ap-results-row.is-r3 .ap-results-rank { color: #3a1d0a; background: radial-gradient(circle at 35% 30%, #ffe0c2, #d98c4a 55%, #9c5521); }
.ap-results-row.is-r1 { background: color-mix(in srgb, #f5c542 14%, var(--ground-sunken)); }
.ap-results-glyph { display: grid; place-items: center; color: var(--ink-muted); }
.ap-results-glyph--note::before { content: ''; width: 14px; height: 14px; border-radius: 3px; background: var(--sticky-yellow); transform: rotate(-4deg); }
.ap-results-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 600; }
.ap-results-bar { height: 10px; border-radius: 5px; background: color-mix(in srgb, var(--ritual) 10%, transparent); overflow: hidden; }
.ap-results-bar i { display: block; height: 100%; border-radius: inherit; background: var(--ritual); transform-origin: left; animation: ap-bar-grow 900ms var(--ease-out) both; animation-delay: calc(var(--i, 0) * 90ms + 320ms); }
.ap-results-n { text-align: right; font: 750 15px/1 var(--font-display); font-variant-numeric: tabular-nums; }
.ap-results-empty { margin: 0; color: var(--ink-muted); }
@keyframes ap-row-in { 0% { opacity: 0; transform: translateX(-16px); } 100% { opacity: 1; transform: none; } }
@keyframes ap-bar-grow { from { transform: scaleX(0); } }

/* Parking lot */
.ap-park { max-height: min(560px, calc(100vh - 160px)); transition: border-color var(--duration-fast), box-shadow var(--duration-fast), transform var(--duration-fast) var(--ease-spring); }
.ap-park.is-drop { border-color: var(--ritual); border-style: dashed; transform: scale(1.02); box-shadow: 0 0 0 6px color-mix(in srgb, var(--ritual) 16%, transparent), var(--shadow-float); }
.ap-park-add { display: flex; gap: var(--space-2); }
.ap-park-add input { flex: 1; min-width: 0; }
.ap-park-list { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; overflow-y: auto; min-height: 0; }
.ap-park-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px; border-radius: var(--radius-md); background: var(--ground-sunken); animation: ap-row-in 420ms var(--ease-spring) both; transition: opacity var(--duration-base); }
.ap-park-item.is-fresh { animation: ap-park-in 760ms var(--ease-spring) both; }
.ap-park-check { display: grid; place-items: center; flex: none; width: 24px; height: 24px; margin-top: 1px; padding: 0; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--ritual) 60%, var(--hairline)); background: transparent; color: transparent; cursor: pointer; transition: background var(--duration-fast), color var(--duration-fast), transform var(--duration-fast) var(--ease-spring); }
.ap-park-check:hover { color: var(--ritual); transform: scale(1.1); }
.ap-park-check .ap-glyph { stroke-width: 3; }
.ap-park-item.is-done .ap-park-check { background: var(--ritual); border-color: var(--ritual); color: var(--surface); animation: ap-pick 360ms var(--ease-spring); }
.ap-park-item.is-done .ap-park-text { text-decoration: line-through; color: var(--ink-muted); }
.ap-park-item.is-done { opacity: 0.7; }
.ap-park-body { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.ap-park-text { font-size: 14px; line-height: 20px; overflow-wrap: anywhere; }
.ap-park-meta { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--ink-muted); }
.ap-park-actions { display: inline-flex; opacity: 0.55; transition: opacity var(--duration-fast); }
.ap-park-item:hover .ap-park-actions, .ap-park-item:focus-within .ap-park-actions { opacity: 1; }
.ap-park-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: var(--space-4) 0; text-align: center; color: var(--ink-muted); font-size: 13px; }
.ap-park-empty p { margin: 0; max-width: 260px; }
.ap-park-empty svg { overflow: visible; }
.ap-park-empty .w { fill: none; stroke: color-mix(in srgb, var(--ritual) 55%, transparent); stroke-width: 2.5; stroke-linecap: round; animation: ap-park-wave 3.2s ease-in-out infinite alternate; }
.ap-park-empty .w + .w { animation-delay: -1.6s; opacity: 0.6; }
.ap-park-empty .p { fill: color-mix(in srgb, var(--ritual) 18%, var(--surface)); stroke: var(--ritual); stroke-width: 2.5; animation: ap-park-bob 2.8s ease-in-out infinite alternate; }
.ap-park-empty .k { fill: none; stroke: var(--ritual); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; animation: ap-park-bob 2.8s ease-in-out infinite alternate; }
.ap-park-empty .s { stroke: var(--ritual); stroke-width: 3; stroke-linecap: round; }
@keyframes ap-park-in { 0% { opacity: 0; transform: translateY(-18px) scale(0.85) rotate(-3deg); background: color-mix(in srgb, var(--ritual) 30%, var(--surface)); } 60% { opacity: 1; transform: translateY(2px) scale(1.02); } 100% { transform: none; } }
@keyframes ap-park-wave { from { transform: translateX(-6px); } to { transform: translateX(6px); } }
@keyframes ap-park-bob { from { transform: translateY(0); } to { transform: translateY(-4px); } }

/* Status pills, follow frame, lock frost */
.ap-rpill { display: inline-flex; align-items: center; gap: 8px; padding: 5px 6px 5px 5px; border-radius: var(--radius-pill); background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: blur(16px) saturate(1.2); -webkit-backdrop-filter: blur(16px) saturate(1.2); border: var(--stroke-hairline) solid color-mix(in srgb, var(--presence-color, var(--signal)) 45%, var(--hairline)); box-shadow: var(--shadow-float); font-family: var(--font-sans); font-size: 14px; color: var(--ink); animation: ap-timer-in 560ms var(--ease-spring) both; }
.ap-rpill-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--presence-color, var(--signal)); color: var(--surface); }
.ap-rpill-text { padding-right: 4px; white-space: nowrap; }
.ap-rpill-text b { font-weight: 650; }
.ap-rpill--lock { border-color: color-mix(in srgb, var(--ink) 30%, var(--hairline)); }
.ap-rpill--lock .ap-rpill-mark { background: var(--ink); color: var(--surface); animation: ap-lock-clamp 700ms var(--ease-spring) both 120ms; }
.ap-rpill--lead .ap-rpill-mark { animation: ap-lead-pulse 2s ease-out infinite; }
@keyframes ap-lock-clamp { 0% { transform: translateY(-8px) scale(1.3); } 50% { transform: translateY(2px) scale(0.92); } 100% { transform: none; } }
@keyframes ap-lead-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--presence-color, var(--signal)) 55%, transparent); } 100% { box-shadow: 0 0 0 12px transparent; } }

.ap-follow-frame { position: fixed; inset: 0; z-index: 60; pointer-events: none; box-shadow: inset 0 0 0 4px var(--presence-color, var(--signal)), inset 0 0 48px 4px color-mix(in srgb, var(--presence-color, var(--signal)) 30%, transparent); animation: ap-follow-in 700ms var(--ease-out) both, ap-follow-breathe 3.2s ease-in-out 700ms infinite; }
.ap-follow-frame-tag { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); padding: 3px 12px 4px; border-radius: 10px 10px 0 0; background: var(--presence-color, var(--signal)); color: var(--surface); font: 650 12px/16px var(--font-sans); }
@keyframes ap-follow-in { 0% { opacity: 0; box-shadow: inset 0 0 0 40px color-mix(in srgb, var(--presence-color, var(--signal)) 40%, transparent); } 100% { opacity: 1; } }
@keyframes ap-follow-breathe { 0%, 100% { box-shadow: inset 0 0 0 4px var(--presence-color, var(--signal)), inset 0 0 48px 4px color-mix(in srgb, var(--presence-color, var(--signal)) 30%, transparent); } 50% { box-shadow: inset 0 0 0 4px var(--presence-color, var(--signal)), inset 0 0 72px 8px color-mix(in srgb, var(--presence-color, var(--signal)) 20%, transparent); } }

.ap-lock-frost { position: absolute; inset: 0; z-index: 4; pointer-events: none; overflow: hidden; box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--ink) 18%, transparent), inset 0 0 90px 12px color-mix(in srgb, var(--signal-soft) 80%, transparent); background: radial-gradient(120% 80% at 0% 0%, color-mix(in srgb, var(--signal-soft) 55%, transparent), transparent 30%), radial-gradient(120% 80% at 100% 100%, color-mix(in srgb, var(--signal-soft) 55%, transparent), transparent 30%); animation: ap-frost-in 600ms var(--ease-out) both; }
.ap-lock-frost i { position: absolute; top: -20%; bottom: -20%; left: -40%; width: 30%; background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.45), transparent); transform: skewX(-18deg); animation: ap-frost-sweep 1.3s var(--ease-in-out) both 150ms; }
@keyframes ap-frost-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes ap-frost-sweep { from { left: -40%; } to { left: 130%; } }

@media (prefers-reduced-motion: reduce) {
  .ap-rituals, .ap-ritual, .ap-timer, .ap-timer-arc, .ap-timer-clock, .ap-rsheet, .ap-results, .ap-park, .ap-rsheet-mark, .ap-preset, .ap-timeup-card, .ap-timeup-bell,
  .ap-vdot, .ap-dottray, .ap-vbadge-medal, .ap-results-row, .ap-results-bar i, .ap-park-item, .ap-park-empty .w, .ap-park-empty .p, .ap-park-empty .k,
  .ap-rpill, .ap-rpill-mark, .ap-follow-frame, .ap-lock-frost, .ap-lock-frost i, .ap-ritual-live, .ap-rsheet-dotrow .ap-vdot { animation: none !important; }
  .ap-timeup-wave { display: none; }
}
.ap-timer--done .ap-timer-clock { white-space: nowrap; }

/* ---------- Sharing and access ----------
   Signal blue carries sharing (it is "live, yours"); the padlock and the gate use ink; members wear their presence colour. */

/* The link pill and its one-click copy */
.ap-linkpill { position: relative; display: flex; align-items: center; gap: 8px; height: 52px; padding: 5px 5px 5px 14px; border-radius: var(--radius-pill); background: var(--ground-sunken); border: var(--stroke-hairline) solid var(--hairline); transition: border-color var(--duration-base), background var(--duration-base), box-shadow var(--duration-base); }
.ap-linkpill:focus-within { border-color: var(--signal); box-shadow: 0 0 0 3px var(--signal-soft); }
.ap-linkpill-mark { display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--signal-soft); color: var(--signal-deep); }
.ap-linkpill.is-sealed .ap-linkpill-mark { background: var(--ink); color: var(--surface); animation: ap-lock-clamp 700ms var(--ease-spring) both; }
.ap-linkpill-url { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink); font: 500 14px/1 var(--font-mono); text-overflow: ellipsis; outline: none; }
.ap-linkpill-copy { position: relative; flex: none; display: grid; height: 42px; min-width: 132px; padding: 0 18px; border: 0; border-radius: var(--radius-pill); background: var(--signal); color: var(--on-signal); font: 650 15px/1 var(--font-sans); cursor: pointer; overflow: hidden; box-shadow: var(--shadow-signal); transition: transform var(--duration-fast) var(--ease-spring), background var(--duration-base); }
.ap-linkpill-copy:hover { transform: translateY(-1px) scale(1.02); }
.ap-linkpill-copy:active { transform: scale(0.95); }
.ap-linkpill-copy:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; }
.ap-linkpill-face { grid-area: 1 / 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: transform 380ms var(--ease-spring), opacity 200ms; }
.ap-linkpill-face--done { transform: translateY(120%); opacity: 0; }
.ap-linkpill.is-copied .ap-linkpill-copy { background: var(--success); }
.ap-linkpill.is-copied .ap-linkpill-face--idle { transform: translateY(-120%); opacity: 0; }
.ap-linkpill.is-copied .ap-linkpill-face--done { transform: none; opacity: 1; }
.ap-linkpill-check path { fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 22; stroke-dashoffset: 22; }
.ap-linkpill.is-copied .ap-linkpill-check path { animation: ap-check-draw 420ms var(--ease-out) 120ms forwards; }
.ap-linkpill.is-copied { border-color: color-mix(in srgb, var(--success) 50%, var(--hairline)); animation: ap-pill-flash 700ms var(--ease-out); }
.ap-linkpill-burst { position: absolute; right: 70px; top: 50%; width: 0; height: 0; pointer-events: none; }
.ap-linkpill-burst i { position: absolute; left: -3px; top: -3px; width: 6px; height: 6px; border-radius: 50%; background: var(--signal); transform: rotate(var(--a)) translateX(0); animation: ap-burst 620ms var(--ease-out) forwards; }
.ap-linkpill-burst i:nth-child(even) { background: var(--success); width: 5px; height: 5px; }
@keyframes ap-check-draw { to { stroke-dashoffset: 0; } }
@keyframes ap-pill-flash { 0% { background: color-mix(in srgb, var(--success) 18%, var(--ground-sunken)); } 100% { background: var(--ground-sunken); } }
@keyframes ap-burst { 0% { opacity: 1; transform: rotate(var(--a)) translateX(0) scale(1); } 100% { opacity: 0; transform: rotate(var(--a)) translateX(46px) scale(0.4); } }

/* QR code */
.ap-qr { display: inline-flex; flex-direction: column; align-items: center; gap: 6px; margin: 0; }
.ap-qr svg { display: block; border-radius: 12px; box-shadow: var(--shadow-tile); }
.ap-qr-bg { fill: #ffffff; }
.ap-qr rect:not(.ap-qr-bg) { fill: #0b1220; }
.ap-qr--draw rect:not(.ap-qr-bg) { transform-box: fill-box; transform-origin: center; animation: ap-qr-cell 420ms var(--ease-spring) both; animation-delay: var(--d, 0ms); }
.ap-qr[role="button"] { cursor: zoom-in; }
.ap-qr[role="button"]:hover svg { box-shadow: 0 0 0 3px var(--signal-soft), var(--shadow-lift); }
.ap-qr figcaption { font: 600 12px/16px var(--font-sans); color: var(--ink-muted); }
@keyframes ap-qr-cell { from { transform: scale(0); } to { transform: none; } }

.ap-qrwall { position: fixed; inset: 0; z-index: 95; display: grid; place-items: center; background: color-mix(in srgb, var(--ground) 82%, transparent); backdrop-filter: blur(10px); animation: ap-frost-in 300ms var(--ease-out) both; }
.ap-qrwall-card { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 32px 40px; border-radius: var(--radius-xl); background: var(--surface); box-shadow: var(--shadow-float); color: var(--ink); font-family: var(--font-sans); text-align: center; animation: ap-timeup-card 640ms var(--ease-spring) both; }
.ap-qrwall-kicker { display: inline-flex; align-items: center; gap: 8px; font-weight: 650; color: var(--signal-deep); }
.ap-qrwall-card h2 { margin: 0; font: 700 30px/36px var(--font-display); letter-spacing: -0.015em; }
.ap-qrwall-url { margin: 0; max-width: 520px; font: 500 14px/20px var(--font-mono); color: var(--ink-muted); overflow-wrap: anywhere; }
.ap-qrwall-code { margin: 0; font-size: 18px; }
.ap-qrwall-code b { font: 700 26px/1 var(--font-mono); letter-spacing: 0.06em; }

/* Access chips */
.ap-access { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: var(--radius-pill); font: 600 12px/1 var(--font-sans); background: var(--signal-soft); color: var(--signal-deep); white-space: nowrap; }
.ap-access--protected { background: color-mix(in srgb, var(--ink) 10%, var(--surface)); color: var(--ink); }
.ap-access--private { background: color-mix(in srgb, var(--presence-violet) 16%, var(--surface)); color: color-mix(in srgb, var(--presence-violet) 70%, var(--ink)); }
.ap-access--view { background: color-mix(in srgb, var(--presence-amber) 16%, var(--surface)); color: color-mix(in srgb, var(--presence-amber) 70%, var(--ink)); }

/* Code input: cells that pop */
.ap-codeinput { position: relative; display: flex; justify-content: center; cursor: text; }
.ap-codeinput-field { position: absolute; inset: 0; width: 100%; opacity: 0; border: 0; font-size: 16px; }
.ap-codeinput-cells { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.ap-codeinput-cells i { display: grid; place-items: center; width: 38px; height: 50px; border-radius: 12px; border: 2px solid var(--hairline); background: var(--surface); font: 700 22px/1 var(--font-mono); font-style: normal; color: var(--ink); transition: border-color var(--duration-fast); }
.ap-codeinput-cells i.is-filled { border-color: color-mix(in srgb, var(--signal) 45%, var(--hairline)); animation: ap-cell-pop 320ms var(--ease-spring) both; }
.ap-codeinput:focus-within .ap-codeinput-cells i.is-caret { border-color: var(--signal); box-shadow: 0 0 0 3px var(--signal-soft); }
.ap-codeinput:focus-within .ap-codeinput-cells i.is-caret::after { content: ''; width: 2px; height: 24px; background: var(--signal); animation: ap-caret 1s steps(2, jump-none) infinite; }
.ap-codeinput--wrong .ap-codeinput-cells { animation: ap-timer-shake 520ms var(--ease-out); }
.ap-codeinput--wrong .ap-codeinput-cells i.is-filled { border-color: var(--danger); color: var(--danger); }
.ap-codeinput--ok .ap-codeinput-cells i.is-filled { border-color: var(--success); background: color-mix(in srgb, var(--success) 12%, var(--surface)); animation: ap-cell-ok 500ms var(--ease-spring) both; animation-delay: calc(var(--i, 0) * 40ms); }
@keyframes ap-cell-pop { 0% { transform: scale(0.6) translateY(6px); } 100% { transform: none; } }
@keyframes ap-cell-ok { 0% { transform: none; } 40% { transform: translateY(-8px); } 100% { transform: none; } }

/* The gate */
.ap-gate { position: relative; min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; overflow: hidden; background: radial-gradient(120% 70% at 50% 0%, var(--signal-soft), var(--ground) 70%); font-family: var(--font-sans); color: var(--ink); }
.ap-gate-scene { position: relative; flex: none; width: min(460px, 100%); height: auto; aspect-ratio: 480 / 300; margin-bottom: -36px; -webkit-mask-image: radial-gradient(ellipse 50% 50% at 50% 52%, #000 62%, transparent 100%); mask-image: radial-gradient(ellipse 50% 50% at 50% 52%, #000 62%, transparent 100%); }
.ap-gate-scene .g-waves path { fill: none; stroke: color-mix(in srgb, var(--signal) 35%, transparent); stroke-width: 3; stroke-linecap: round; animation: ap-park-wave 4s ease-in-out infinite alternate; }
.ap-gate-scene .g-waves path + path { animation-delay: -2s; opacity: 0.6; }
.ap-gate-scene .g-sea { fill: color-mix(in srgb, var(--signal) 14%, transparent); }
.ap-gate-scene .g-sand { fill: color-mix(in srgb, var(--presence-amber) 30%, var(--surface)); }
.ap-gate-scene .g-land { fill: color-mix(in srgb, var(--presence-teal) 42%, var(--surface)); }
.ap-gate-scene .g-fog--c { animation: ap-fog-l 7s ease-in-out infinite alternate-reverse; }
.ap-gate--open .ap-gate-scene .g-fog--c { animation: none; transform: translateY(40px); opacity: 0; }
.ap-gate-scene .g-board { fill: var(--surface); stroke: var(--hairline); stroke-width: 2; }
.ap-gate-scene .g-b1 { fill: var(--layer-1); } .ap-gate-scene .g-b2 { fill: var(--layer-3); } .ap-gate-scene .g-b3 { fill: var(--signal-soft); }
.ap-gate-scene .g-line, .ap-gate-scene .g-post { fill: none; stroke: var(--ink-faint); stroke-width: 2.5; stroke-linecap: round; }
.ap-gate-scene .g-fog ellipse { fill: color-mix(in srgb, var(--surface) 70%, transparent); }
.ap-gate-scene .g-fog { transition: transform 1100ms var(--ease-in-out), opacity 1100ms; }
.ap-gate-scene .g-fog--l { animation: ap-fog-l 9s ease-in-out infinite alternate; }
.ap-gate-scene .g-fog--r { animation: ap-fog-r 11s ease-in-out infinite alternate; }
.ap-gate-scene .g-isle { transform-origin: 240px 190px; transition: transform 1200ms var(--ease-in-out); }
.ap-gate--open .ap-gate-scene .g-fog--l { animation: none; transform: translateX(-340px); opacity: 0; }
.ap-gate--open .ap-gate-scene .g-fog--r { animation: none; transform: translateX(340px); opacity: 0; }
.ap-gate--open .ap-gate-scene .g-isle { transform: scale(1.5); }
.ap-gate-card { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 12px; width: min(440px, 100%); padding: 28px 24px 24px; border-radius: var(--radius-xl); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px); border: var(--stroke-hairline) solid var(--hairline); box-shadow: var(--shadow-float); text-align: center; animation: ap-rsheet-in 600ms var(--ease-spring) both 150ms; transition: transform 700ms var(--ease-in-out), opacity 600ms; }
.ap-gate--open .ap-gate-card { transform: translateY(24px) scale(0.96); opacity: 0; transition-delay: 500ms; }
.ap-gate-kicker { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: var(--radius-pill); background: color-mix(in srgb, var(--ink) 8%, var(--surface)); font: 650 12px/1 var(--font-sans); }
.ap-gate-title { margin: 0; font: 700 26px/32px var(--font-display); letter-spacing: -0.015em; overflow-wrap: anywhere; }
.ap-gate-card > p { margin: 0; font-size: 15px; line-height: 22px; color: var(--ink-muted); }
.ap-gate-form { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; margin-top: 6px; }
.ap-gate-note { min-height: 20px; margin: 0; font-size: 13px; color: var(--danger); }
.ap-gate-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 4px; }
@keyframes ap-fog-l { from { transform: translateX(-10px); } to { transform: translateX(16px); } }
@keyframes ap-fog-r { from { transform: translateX(12px); } to { transform: translateX(-14px); } }

/* Members */
.ap-member { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-radius: var(--radius-md); animation: ap-row-in 420ms var(--ease-spring) both; }
.ap-member.is-fresh { animation: ap-park-in 700ms var(--ease-spring) both; --ritual: var(--signal); }
.ap-member-initial { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--signal-soft); color: var(--signal-deep); font: 700 13px/1 var(--font-sans); }
.ap-member-who { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.ap-member-who b { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-member-who span { font-size: 12px; color: var(--ink-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-member-pending { color: color-mix(in srgb, var(--presence-amber) 70%, var(--ink)) !important; }
.ap-member-role { font: 600 13px/1 var(--font-sans); color: var(--ink-muted); padding: 0 8px; }
.ap-member-select, .ap-share-inviteform select, .ap-share-linkrole select { height: 32px; padding: 0 8px; border-radius: var(--radius-sm); border: var(--stroke-hairline) solid var(--hairline); background: var(--surface); color: var(--ink); font: 600 13px/1 var(--font-sans); }

/* Folders */
.ap-folders-list { display: flex; flex-wrap: wrap; gap: 6px; }
.ap-folder { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: var(--radius-pill); border: var(--stroke-hairline) solid var(--hairline); background: var(--ground-sunken); color: var(--ink); font: 600 13px/1 var(--font-sans); cursor: pointer; transition: transform var(--duration-fast) var(--ease-spring), background var(--duration-fast); animation: ap-ritual-in 420ms var(--ease-spring) both; animation-delay: calc(var(--i, 0) * 35ms); }
.ap-folder .ap-glyph { color: var(--presence-color, var(--ink-muted)); }
.ap-folder small { font: 600 11px/1 var(--font-mono); color: var(--ink-muted); }
.ap-folder:hover { transform: translateY(-1px); }
.ap-folder.is-on { background: var(--signal-soft); border-color: var(--signal); color: var(--signal-deep); }
.ap-folder.is-on .ap-glyph { color: var(--signal-deep); animation: ap-folder-drop 480ms var(--ease-spring); }
.ap-folder--add { border-style: dashed; background: transparent; color: var(--ink-muted); }
.ap-folder-new { display: inline-flex; gap: 6px; }
.ap-folder-new input { height: 34px; padding: 0 10px; border-radius: var(--radius-pill); border: var(--stroke-hairline) solid var(--signal); background: var(--surface); color: var(--ink); font: 14px/1 var(--font-sans); outline: none; box-shadow: 0 0 0 3px var(--signal-soft); }
@keyframes ap-folder-drop { 0% { transform: translateY(-8px) rotate(-12deg); } 60% { transform: translateY(1px) scale(1.15); } 100% { transform: none; } }

/* The share sheet */
.ap-share { display: flex; flex-direction: column; gap: 16px; width: 520px; max-width: calc(100vw - 24px); padding: var(--space-5); border-radius: var(--radius-xl); background: var(--surface); border: var(--stroke-hairline) solid var(--hairline); box-shadow: var(--shadow-float); font-family: var(--font-sans); color: var(--ink); animation: ap-rsheet-in 460ms var(--ease-spring) both; }
.ap-share-head { display: flex; align-items: flex-start; gap: 12px; }
.ap-share-mark { display: grid; place-items: center; flex: none; width: 42px; height: 42px; border-radius: 14px; background: var(--signal-soft); color: var(--signal-deep); animation: ap-mark-in 640ms var(--ease-spring) both 80ms; }
.ap-share-titles { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }
.ap-share-titles h3 { margin: 0; font: 650 20px/26px var(--font-display); letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-share-status { display: flex; gap: 6px; flex-wrap: wrap; }
.ap-share-top { display: flex; gap: 16px; align-items: flex-start; }
.ap-share-link { display: flex; flex-direction: column; gap: 10px; flex: 1; min-width: 0; }
.ap-share-quick { display: flex; gap: 6px; flex-wrap: wrap; }
.ap-share-hint { margin: 0; font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.ap-share-sec { display: flex; flex-direction: column; gap: 10px; padding-top: 14px; border-top: var(--stroke-hairline) solid var(--hairline); animation: ap-row-in 480ms var(--ease-spring) both 120ms; }
.ap-share-sec > header { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ap-share-sec > header > span { font-size: 12px; color: var(--ink-muted); }
.ap-share-codeform { display: flex; gap: 6px; align-items: center; }
.ap-share-codefield, .ap-share-inviteform input { flex: 1; min-width: 0; height: 38px; padding: 0 12px; border-radius: var(--radius-md); border: var(--stroke-hairline) solid var(--hairline); background: var(--ground-sunken); color: var(--ink); font: 600 15px/1 var(--font-mono); letter-spacing: 0.04em; outline: none; }
.ap-share-inviteform input { font: 15px/1 var(--font-sans); letter-spacing: 0; }
.ap-share-codefield:focus, .ap-share-inviteform input:focus { border-color: var(--signal); box-shadow: 0 0 0 3px var(--signal-soft); }
.ap-share-codeform--inline { flex: 1; min-width: 220px; }
.ap-share-codeline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--ink-muted); }
.ap-share-linkrole { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.ap-share-mode button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.ap-share-invite { flex-direction: row; align-items: center; gap: 12px; padding: 14px; border: 0; border-radius: var(--radius-lg); background: linear-gradient(120deg, color-mix(in srgb, var(--signal) 12%, var(--surface)), color-mix(in srgb, var(--presence-violet) 10%, var(--surface))); }
.ap-share-invite b { font-size: 14px; }
.ap-share-invite p { margin: 2px 0 0; font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.ap-share-invite > div { flex: 1; }
.ap-share-invite-art { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 50%; background: var(--surface); color: var(--signal-deep); box-shadow: var(--shadow-tile); animation: ap-lead-pulse 2.4s ease-out infinite; --presence-color: var(--signal); }
.ap-share-owned { display: flex; align-items: center; gap: 6px; margin: 0; padding-top: 12px; border-top: var(--stroke-hairline) solid var(--hairline); font-size: 13px; color: var(--ink-muted); }
.ap-share-inviteform { display: flex; gap: 6px; }
.ap-share-list { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; max-height: 220px; overflow-y: auto; }
.ap-share-note { margin: 0; font-size: 12px; line-height: 17px; color: var(--ink-muted); }
.ap-share-textbtn { padding: 0; border: 0; background: none; color: var(--signal-deep); font: inherit; font-weight: 650; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

@media (max-width: 560px) {
  .ap-share-top { flex-direction: column-reverse; align-items: stretch; }
  .ap-share-top .ap-qr { align-self: center; }
  .ap-linkpill-copy { min-width: 110px; padding: 0 12px; }
  .ap-share-inviteform { flex-wrap: wrap; }
  .ap-codeinput-cells i { width: 32px; height: 44px; font-size: 19px; }
}

@media (prefers-reduced-motion: reduce) {
  .ap-linkpill, .ap-linkpill-mark, .ap-linkpill-burst i, .ap-linkpill-check path, .ap-qr--draw rect, .ap-qrwall, .ap-qrwall-card, .ap-codeinput-cells, .ap-codeinput-cells i,
  .ap-gate-scene *, .ap-gate-card, .ap-member, .ap-folder, .ap-folder .ap-glyph, .ap-share, .ap-share-mark, .ap-share-sec, .ap-share-invite-art { animation: none !important; }
  .ap-linkpill-check path { stroke-dashoffset: 0; }
  .ap-gate-scene .g-fog, .ap-gate-scene .g-isle, .ap-gate-card { transition: none; }
}

/* ---------- Connecting AI tools: the consent page and the share sheet's AI tools ---------- */
.ap-consent { position: relative; min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding: 24px 16px 40px; overflow-x: hidden; background: radial-gradient(120% 60% at 50% 0%, color-mix(in srgb, var(--presence-violet) 16%, var(--ground)), var(--ground) 70%); font-family: var(--font-sans); color: var(--ink); }
.ap-consent-scene { flex: none; width: min(440px, 100%); height: auto; aspect-ratio: 480 / 250; margin-bottom: -28px; }
.ap-consent-scene .b-sea { fill: color-mix(in srgb, var(--signal) 13%, transparent); }
.ap-consent-scene .b-waves path { fill: none; stroke: color-mix(in srgb, var(--signal) 35%, transparent); stroke-width: 3; stroke-linecap: round; animation: ap-park-wave 4s ease-in-out infinite alternate; }
.ap-consent-scene .b-waves path + path { animation-delay: -2s; }
.ap-consent-scene .b-sand { fill: color-mix(in srgb, var(--presence-amber) 30%, var(--surface)); }
.ap-consent-scene .b-land { fill: color-mix(in srgb, var(--presence-teal) 42%, var(--surface)); }
.ap-consent-scene .b-land--tool { fill: color-mix(in srgb, var(--presence-violet) 40%, var(--surface)); }
.ap-consent-scene .b-board { fill: var(--surface); stroke: var(--hairline); stroke-width: 2; }
.ap-consent-scene .b-c1 { fill: var(--layer-1); } .ap-consent-scene .b-c2 { fill: var(--signal-soft); } .ap-consent-scene .b-c3 { fill: var(--layer-3); }
.ap-consent-scene .b-post, .ap-consent-scene .b-antenna { fill: none; stroke: var(--ink-faint); stroke-width: 2.5; stroke-linecap: round; }
.ap-consent-scene .b-isle { animation: ap-isle-bob 5s ease-in-out infinite alternate; }
.ap-consent-scene .b-isle--tool { animation-delay: -2.5s; }
.ap-consent-scene .b-bot-head, .ap-consent-scene .b-bot-body { fill: var(--surface); stroke: color-mix(in srgb, var(--presence-violet) 70%, var(--ink)); stroke-width: 2.5; }
.ap-consent-scene .b-eye { fill: var(--ink); transform-box: fill-box; transform-origin: center; animation: ap-blink 4.6s infinite; }
.ap-consent-scene .b-spark { fill: var(--presence-violet); transform-box: fill-box; transform-origin: center; animation: ap-spark-pulse 1.8s ease-in-out infinite; }
.ap-consent-scene .b-bot { transform-box: fill-box; transform-origin: 50% 100%; }
.ap-consent-scene .b-bridge-shadow { fill: none; stroke: color-mix(in srgb, var(--ink) 12%, transparent); stroke-width: 6; stroke-linecap: round; stroke-dasharray: 3 9; }
.ap-consent-scene .b-bridge { fill: none; stroke: var(--presence-amber); stroke-width: 6; stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100; }
.ap-consent-scene .b-planks path { stroke: color-mix(in srgb, var(--presence-amber) 70%, var(--ink)); stroke-width: 3; stroke-linecap: round; opacity: 0; transform-box: fill-box; transform-origin: center; }
.ap-consent-scene .b-packets circle { fill: var(--signal); opacity: 0; offset-path: path("M196 166 Q244 134 292 166"); }
/* Choosing: the bridge is sketched, waiting. Allowing: it is built, plank by plank, and data starts to cross. */
.ap-consent--idle .b-bridge { stroke-dashoffset: 76; transition: stroke-dashoffset 900ms var(--ease-out); }
.ap-consent--sending .b-bridge { stroke-dashoffset: 30; transition: stroke-dashoffset 700ms var(--ease-out); }
.ap-consent--done .b-bridge { stroke-dashoffset: 0; transition: stroke-dashoffset 900ms var(--ease-spring); }
.ap-consent--done .b-planks path { animation: ap-plank 380ms var(--ease-spring) forwards; }
.ap-consent--done .b-planks path:nth-child(2) { animation-delay: 90ms; } .ap-consent--done .b-planks path:nth-child(3) { animation-delay: 180ms; } .ap-consent--done .b-planks path:nth-child(4) { animation-delay: 270ms; } .ap-consent--done .b-planks path:nth-child(5) { animation-delay: 360ms; } .ap-consent--done .b-planks path:nth-child(6) { animation-delay: 450ms; }
.ap-consent--done .b-packets circle { animation: ap-packet 1.6s var(--ease-in-out) 700ms infinite; }
.ap-consent--done .b-packets circle:nth-child(2) { animation-delay: 1.23s; } .ap-consent--done .b-packets circle:nth-child(3) { animation-delay: 1.76s; fill: var(--presence-violet); animation-direction: reverse; }
.ap-consent--done .b-bot { animation: ap-bot-wave 900ms var(--ease-spring) 400ms 2; }
.ap-consent--denied .b-bridge, .ap-consent--error .b-bridge { stroke-dashoffset: 100; transition: stroke-dashoffset 500ms var(--ease-in-out); }
.ap-consent--denied .b-isle--tool { animation: none; transform: translateX(40px); opacity: 0.4; transition: transform 900ms var(--ease-in-out), opacity 900ms; }
.ap-consent-card { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 14px; width: min(520px, 100%); padding: 26px 24px 20px; border-radius: var(--radius-xl); background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(14px); border: var(--stroke-hairline) solid var(--hairline); box-shadow: var(--shadow-float); animation: ap-card-rise 520ms var(--ease-spring) both; }
.ap-consent-card > .ap-gate-kicker { align-self: flex-start; }
.ap-consent-title { margin: 0; font: 700 25px/31px var(--font-display); letter-spacing: -0.015em; overflow-wrap: anywhere; }
.ap-consent-lead { margin: 0; font-size: 15px; line-height: 22px; color: var(--ink-muted); }
.ap-consent-lead a, .ap-consent-lead b { color: var(--ink); font-weight: 650; }
.ap-consent-lead code { font: 600 13px/1 var(--font-mono); padding: 2px 6px; border-radius: 6px; background: var(--ground-sunken); color: var(--ink); overflow-wrap: anywhere; }
.ap-consent-can { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ap-consent-can li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 20px; transition: opacity var(--duration-base); }
.ap-consent-can li > svg { flex: none; margin-top: 2px; color: var(--signal); }
.ap-consent-can li.is-off { opacity: 0.45; }
.ap-consent-boards { display: flex; flex-direction: column; gap: 6px; }
.ap-consent-boards > header { display: flex; align-items: baseline; justify-content: space-between; font-size: 13px; }
.ap-consent-boards > header small { color: var(--ink-faint); font-family: var(--font-mono); }
.ap-consent-boards ul { list-style: none; margin: 0; padding: 2px; display: flex; flex-direction: column; gap: 6px; max-height: 280px; overflow: auto; }
.ap-consent-board { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-md); border: var(--stroke-hairline) solid var(--hairline); background: var(--surface); animation: ap-row-in 420ms var(--ease-spring) both; animation-delay: calc(var(--i, 0) * 50ms); transition: border-color var(--duration-fast), background var(--duration-fast); }
.ap-consent-board.is-on { border-color: color-mix(in srgb, var(--signal) 55%, var(--hairline)); background: color-mix(in srgb, var(--signal) 6%, var(--surface)); }
.ap-consent-board.is-locked { opacity: 0.55; }
.ap-consent-board > label { position: relative; flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; cursor: pointer; }
.ap-consent-board input { position: absolute; opacity: 0; pointer-events: none; }
.ap-consent-check { flex: none; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--ink-faint); color: transparent; transition: background var(--duration-fast), border-color var(--duration-fast), color var(--duration-fast); }
.ap-consent-board.is-on .ap-consent-check { background: var(--signal); border-color: var(--signal); color: var(--on-signal); animation: ap-check-pop 300ms var(--ease-spring); }
.ap-consent-board input:focus-visible + .ap-consent-check { outline: 2px solid var(--signal); outline-offset: 2px; }
.ap-consent-board-name { min-width: 0; display: flex; flex-direction: column; }
.ap-consent-board-name b { font-size: 14px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-consent-board-name small { font-size: 12px; color: var(--ink-muted); }
.ap-consent-role { flex: none; display: flex; padding: 2px; border-radius: var(--radius-pill); background: var(--ground-sunken); }
.ap-consent-role button { height: 28px; padding: 0 10px; border: 0; border-radius: var(--radius-pill); background: transparent; color: var(--ink-muted); font: 600 12px/28px var(--font-sans); cursor: pointer; transition: background var(--duration-fast), color var(--duration-fast); }
.ap-consent-role button.is-on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-tile); }
.ap-consent-role button:disabled { cursor: default; opacity: 0.5; }
.ap-consent-empty { margin: 0; padding: 12px; border-radius: var(--radius-md); background: var(--ground-sunken); font-size: 13px; color: var(--ink-muted); }
.ap-consent-create { padding: 10px 12px; border-radius: var(--radius-md); border: var(--stroke-hairline) dashed var(--hairline); transition: border-color var(--duration-fast); }
.ap-consent-create.is-on { border-style: solid; border-color: color-mix(in srgb, var(--presence-violet) 55%, var(--hairline)); }
.ap-consent-error { margin: 0; font-size: 13px; color: var(--danger); }
.ap-consent-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.ap-consent-foot { margin: 0; font-size: 12px; color: var(--ink-faint); text-align: center; }
.ap-consent--done .ap-consent-card, .ap-consent--denied .ap-consent-card, .ap-consent--error .ap-consent-card { text-align: center; align-items: center; }
.ap-consent--done .ap-consent-card > .ap-gate-kicker, .ap-consent--denied .ap-consent-card > .ap-gate-kicker, .ap-consent--error .ap-consent-card > .ap-gate-kicker { align-self: center; }
@keyframes ap-packet { 0% { offset-distance: 0%; opacity: 0; } 15% { opacity: 1; } 85% { opacity: 1; } 100% { offset-distance: 100%; opacity: 0; } }
@keyframes ap-bot-wave { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(-9deg) translateY(-4px); } 60% { transform: rotate(7deg); } }
@keyframes ap-blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(0.1); } }
@keyframes ap-isle-bob { from { transform: translateY(0); } to { transform: translateY(-4px); } }
@keyframes ap-spark-pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.35); opacity: 0.7; } }
@keyframes ap-plank { from { opacity: 0; transform: scaleY(0.2); } to { opacity: 1; transform: scaleY(1); } }
@keyframes ap-card-rise { from { opacity: 0; transform: translateY(16px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes ap-check-pop { 0% { transform: scale(0.7); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }

.ap-agents { display: flex; flex-direction: column; gap: 10px; }
.ap-agents > header { display: flex; align-items: center; gap: 8px; }
.ap-agents > header small { margin-left: auto; font-size: 12px; color: var(--ink-faint); }
.ap-agents-lead { margin: 0; font-size: 13px; line-height: 19px; color: var(--ink-muted); }
.ap-agents-url { display: flex; align-items: center; gap: 8px; padding: 4px 4px 4px 12px; border-radius: var(--radius-pill); background: var(--ground-sunken); border: var(--stroke-hairline) solid transparent; transition: border-color var(--duration-fast), background var(--duration-fast); }
.ap-agents-url code { flex: 1; min-width: 0; font: 600 13px/1.2 var(--font-mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-agents-url.is-copied { border-color: color-mix(in srgb, var(--presence-teal) 60%, transparent); background: color-mix(in srgb, var(--presence-teal) 10%, var(--ground-sunken)); animation: ap-check-pop 320ms var(--ease-spring); }
.ap-agents-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.ap-agent { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: var(--radius-md); animation: ap-row-in 420ms var(--ease-spring) both; animation-delay: calc(var(--i, 0) * 60ms); }
.ap-agent.is-fresh { background: color-mix(in srgb, var(--presence-violet) 10%, transparent); }
.ap-agent-who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ap-agent-who b { font-size: 14px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-agent-who span { font-size: 12px; color: var(--ink-muted); }
.ap-agents-help { align-self: flex-start; font-size: 13px; font-weight: 600; color: var(--signal); text-decoration: none; }
.ap-agents-help:hover { text-decoration: underline; }
@media (prefers-reduced-motion: reduce) {
  .ap-consent-scene *, .ap-consent-card, .ap-consent-board, .ap-agent { animation: none !important; transition: none !important; }
  .ap-consent--done .b-bridge { stroke-dashoffset: 0; } .ap-consent--done .b-planks path { opacity: 1; }
}

/* ---------- Recipes: the cookbook, the recipe page, proofs, votes and the discussion ---------- */
.ap-recipe-card { position: relative; display: flex; flex-direction: column; border-radius: var(--radius-xl); background: var(--surface); border: var(--stroke-hairline) solid var(--hairline); box-shadow: var(--shadow-tile); overflow: hidden; animation: ap-recipe-rise 560ms var(--ease-spring) both; animation-delay: calc(var(--i, 0) * 55ms); transition: transform var(--duration-base) var(--ease-spring), box-shadow var(--duration-base), opacity var(--duration-base); }
.ap-recipe-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.ap-recipe-card-link { display: flex; flex-direction: column; color: inherit; text-decoration: none; flex: 1; }
.ap-recipe-card-link:focus-visible { outline: 2px solid var(--signal); outline-offset: -2px; border-radius: var(--radius-xl); }
.ap-recipe-card-map { position: relative; height: 128px; background: radial-gradient(120% 90% at 30% 20%, color-mix(in srgb, var(--signal) 10%, var(--surface)), var(--ground-sunken)); }
.ap-recipe-card:hover .ap-isle-map { transform: scale(1.05) rotate(-0.6deg); }
.ap-recipe-card-body { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px 10px; }
.ap-recipe-kicker { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; font: 650 11px/16px var(--font-sans); letter-spacing: 0.04em; text-transform: uppercase; color: var(--presence-color, var(--ink-muted)); }
.ap-recipe-kicker::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.ap-recipe-problem { margin: 0; font: 700 18px/24px var(--font-display); letter-spacing: -0.01em; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ap-recipe-problem mark, .ap-recipe-pattern mark { background: color-mix(in srgb, var(--presence-amber) 40%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.ap-recipe-pattern { margin: 0; display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-muted); }
.ap-recipe-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.ap-recipe-chip { height: 22px; padding: 0 8px; border-radius: var(--radius-pill); background: var(--ground-sunken); font: 600 11px/22px var(--font-sans); color: var(--ink-muted); }
.ap-recipe-card-foot { display: flex; align-items: center; gap: 8px; padding: 8px 12px 12px 16px; }
.ap-recipe-users { display: flex; }
.ap-recipe-user { display: grid; place-items: center; width: 22px; height: 22px; margin-left: -6px; border-radius: 50%; background: color-mix(in srgb, var(--presence-teal) 35%, var(--surface)); box-shadow: 0 0 0 2px var(--surface); font: 700 10px/1 var(--font-sans); animation: ap-pop 360ms var(--ease-spring) both; animation-delay: calc(300ms + var(--i, 0) * 60ms); }
.ap-recipe-user:first-child { margin-left: 0; }
.ap-grow { flex: 1; }
.ap-recipe-card.is-leaving { opacity: 0; transform: scale(0.94); }
@keyframes ap-recipe-rise { from { opacity: 0; transform: translateY(18px) scale(0.97); } to { opacity: 1; transform: none; } }

/* The vote pot */
.ap-pot { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px 0 8px; border-radius: var(--radius-pill); border: var(--stroke-hairline) solid var(--hairline); background: var(--surface); color: var(--ink); font: 700 14px/1 var(--font-mono); cursor: pointer; transition: background var(--duration-fast), border-color var(--duration-fast), transform var(--duration-fast) var(--ease-spring); }
.ap-pot:hover { transform: translateY(-1px); border-color: color-mix(in srgb, var(--presence-coral) 50%, var(--hairline)); }
.ap-pot:active { transform: scale(0.94); }
.ap-pot--sm { height: 30px; padding: 0 10px 0 6px; font-size: 13px; }
.ap-pot-art { width: 26px; height: 26px; overflow: visible; }
.ap-pot--sm .ap-pot-art { width: 22px; height: 22px; }
.ap-pot-body { fill: var(--surface); stroke: var(--ink-muted); stroke-width: 2; stroke-linejoin: round; transition: fill var(--duration-base); }
.ap-pot-rim { stroke: var(--ink-muted); stroke-width: 2.2; stroke-linecap: round; }
.ap-pot-steam path { fill: none; stroke: var(--ink-faint); stroke-width: 1.6; stroke-linecap: round; opacity: 0; }
.ap-pot-bubbles circle { fill: var(--surface); opacity: 0; }
.ap-pot.is-on { background: color-mix(in srgb, var(--presence-coral) 12%, var(--surface)); border-color: color-mix(in srgb, var(--presence-coral) 55%, var(--hairline)); }
.ap-pot.is-on .ap-pot-body { fill: var(--presence-coral); stroke: color-mix(in srgb, var(--presence-coral) 70%, var(--ink)); }
.ap-pot.is-on .ap-pot-rim { stroke: color-mix(in srgb, var(--presence-coral) 70%, var(--ink)); }
.ap-pot.is-on .ap-pot-art { animation: ap-pot-jiggle 520ms var(--ease-spring); }
.ap-pot.is-on .ap-pot-bubbles circle { animation: ap-pot-bubble 1.1s ease-out both; }
.ap-pot.is-on .ap-pot-bubbles circle:nth-child(2) { animation-delay: 140ms; } .ap-pot.is-on .ap-pot-bubbles circle:nth-child(3) { animation-delay: 260ms; }
.ap-pot.is-on .ap-pot-steam path { animation: ap-pot-steam 1.4s ease-out both; }
.ap-pot.is-on .ap-pot-steam path:nth-child(2) { animation-delay: 150ms; } .ap-pot.is-on .ap-pot-steam path:nth-child(3) { animation-delay: 300ms; }
.ap-pot-count { display: inline-block; min-width: 1ch; animation: ap-count-roll 380ms var(--ease-spring); }
@keyframes ap-pot-jiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-8deg) scale(1.1); } 55% { transform: rotate(6deg); } 80% { transform: rotate(-2deg); } }
@keyframes ap-pot-bubble { 0% { opacity: 0; transform: translateY(2px) scale(0.4); } 30% { opacity: 1; } 100% { opacity: 0; transform: translateY(-5px) scale(1.1); } }
@keyframes ap-pot-steam { 0% { opacity: 0; transform: translateY(3px); } 35% { opacity: 0.9; } 100% { opacity: 0; transform: translateY(-5px); } }
@keyframes ap-count-roll { from { transform: translateY(60%); opacity: 0; } to { transform: none; opacity: 1; } }

/* The proof stamp */
.ap-stamp { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 7px; font: 700 11px/24px var(--font-sans); letter-spacing: 0.02em; white-space: nowrap; }
.ap-stamp.is-proven { color: color-mix(in srgb, var(--presence-teal) 75%, var(--ink)); background: color-mix(in srgb, var(--presence-teal) 14%, var(--surface)); border: 1.5px solid color-mix(in srgb, var(--presence-teal) 55%, transparent); transform: rotate(-2deg); }
.ap-stamp.is-unproven { color: var(--ink-faint); background: var(--ground-sunken); }
.ap-stamp.is-fresh { animation: ap-stamp-drop 620ms var(--ease-spring); }
@keyframes ap-stamp-drop { 0% { transform: scale(2.4) rotate(-14deg); opacity: 0; } 55% { transform: scale(0.92) rotate(-2deg); opacity: 1; } 75% { transform: scale(1.06) rotate(-3deg); } 100% { transform: rotate(-2deg); } }

/* The dish */
.ap-dish { position: relative; width: 100%; border-radius: var(--radius-xl); background: var(--ground-sunken); border: var(--stroke-hairline) solid var(--hairline); overflow: hidden; }
.ap-dish svg { display: block; width: 100%; height: auto; max-height: 900px; }
.ap-dish.is-empty { padding: 40px; text-align: center; color: var(--ink-muted); }
.ap-dish-band rect.is-a { fill: var(--layer-1); } .ap-dish-band rect.is-b { fill: var(--layer-2); }
.ap-dish-band-name { font: 650 15px var(--font-sans); fill: var(--ink-muted); }
.ap-dish-link { fill: none; stroke: color-mix(in srgb, var(--ink) 38%, transparent); stroke-width: 3; stroke-dasharray: 100; stroke-dashoffset: 100; animation: ap-dish-draw 700ms var(--ease-out) forwards; animation-delay: calc(500ms + var(--i, 0) * 60ms); transition: stroke var(--duration-base), stroke-width var(--duration-base); }
.ap-dish-link.is-async { stroke-dasharray: 3 3; stroke-dashoffset: 0; opacity: 0; animation: ap-fade-in 700ms ease forwards; animation-delay: calc(500ms + var(--i, 0) * 60ms); }
.ap-dish-link.is-flow { stroke: color-mix(in srgb, var(--signal) 55%, transparent); }
.ap-dish-link.is-lit { stroke: var(--signal); stroke-width: 5; }
.ap-dish-frame rect { fill: color-mix(in srgb, var(--surface) 45%, transparent); stroke: color-mix(in srgb, var(--ink) 30%, transparent); stroke-width: 2; stroke-dasharray: 8 6; }
.ap-dish-frame-name { font: 650 15px var(--font-sans); fill: var(--ink-muted); }
.ap-dish-frame.is-lit rect { stroke: var(--signal); }
.ap-dish-block { opacity: 0; animation: ap-dish-plate 520ms var(--ease-spring) forwards; animation-delay: calc(var(--i, 0) * 45ms); transition: opacity var(--duration-base), filter var(--duration-base); }
.ap-dish-block rect { fill: var(--surface); stroke: var(--hairline); stroke-width: 2; transition: stroke var(--duration-base), stroke-width var(--duration-base); }
.ap-dish-block.is-pressable { cursor: pointer; }
.ap-dish-block.is-lit rect { stroke: var(--signal); stroke-width: 4; }
.ap-dish-block.is-lit { filter: drop-shadow(0 6px 14px color-mix(in srgb, var(--signal) 35%, transparent)); }
.has-focus .ap-dish-block.is-dim { opacity: 0.35 !important; }
.ap-dish-kind { font: 600 13px var(--font-sans); fill: var(--ink-faint); }
.ap-dish-title { font: 700 17px var(--font-sans); fill: var(--ink); }
.ap-dish-tech { font: 600 14px var(--font-mono); fill: var(--signal-deep, var(--signal)); transform-box: fill-box; transform-origin: 50% 50%; animation: ap-flap 480ms var(--ease-spring); }
@keyframes ap-dish-plate { from { opacity: 0; transform: translateY(-14px) scale(0.92); } to { opacity: 1; transform: none; } }
@keyframes ap-dish-draw { to { stroke-dashoffset: 0; } }
@keyframes ap-fade-in { to { opacity: 1; } }
@keyframes ap-flap { 0% { transform: scaleY(0); opacity: 0; } 60% { transform: scaleY(1.15); opacity: 1; } 100% { transform: scaleY(1); } }

/* The method */
.ap-method { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; counter-reset: step; }
.ap-method-step { animation: ap-row-in 420ms var(--ease-spring) both; animation-delay: calc(var(--i, 0) * 50ms); }
.ap-method-step button { display: flex; gap: 12px; align-items: flex-start; width: 100%; padding: 10px 12px; border: var(--stroke-hairline) solid transparent; border-radius: var(--radius-md); background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; transition: background var(--duration-fast), border-color var(--duration-fast); }
.ap-method-step button:hover { background: var(--ground-sunken); }
.ap-method-step.is-on button { background: color-mix(in srgb, var(--signal) 8%, var(--surface)); border-color: color-mix(in srgb, var(--signal) 45%, var(--hairline)); }
.ap-method-n { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--ground-sunken); font: 700 13px/1 var(--font-mono); transition: background var(--duration-fast), color var(--duration-fast), transform var(--duration-base) var(--ease-spring); }
.ap-method-step.is-on .ap-method-n { background: var(--signal); color: var(--on-signal); transform: scale(1.1); }
.ap-method-text { display: flex; flex-direction: column; gap: 2px; font-size: 14px; line-height: 20px; }
.ap-method-text span { color: var(--ink-muted); }

/* Variants */
.ap-variants { display: flex; gap: 8px; overflow-x: auto; padding: 2px; scrollbar-width: thin; }
.ap-variant { flex: none; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 150px; padding: 10px 14px; border-radius: var(--radius-md); border: var(--stroke-hairline) solid var(--hairline); background: var(--surface); color: inherit; font: inherit; text-align: left; cursor: pointer; animation: ap-row-in 400ms var(--ease-spring) both; animation-delay: calc(var(--i, 0) * 45ms); transition: border-color var(--duration-fast), background var(--duration-fast), transform var(--duration-fast) var(--ease-spring); }
.ap-variant:hover { transform: translateY(-1px); }
.ap-variant b { font-size: 14px; }
.ap-variant small { font-size: 12px; color: var(--ink-muted); }
.ap-variant.is-on { border-color: var(--signal); background: color-mix(in srgb, var(--signal) 8%, var(--surface)); box-shadow: inset 0 -3px 0 var(--signal); }

/* Proofs */
.ap-proof { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-radius: var(--radius-md); border: var(--stroke-hairline) solid var(--hairline); background: var(--surface); list-style: none; animation: ap-row-in 420ms var(--ease-spring) both; animation-delay: calc(var(--i, 0) * 60ms); }
.ap-proof.is-fresh { animation: ap-stamp-drop 620ms var(--ease-spring); border-color: color-mix(in srgb, var(--presence-teal) 60%, var(--hairline)); }
.ap-proof.is-hidden { opacity: 0.55; }
.ap-proof-logo { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: color-mix(in srgb, var(--presence-teal) 25%, var(--surface)); font: 800 18px/1 var(--font-display); }
.ap-proof-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; font-size: 14px; }
.ap-proof-serves { color: var(--ink-muted); }
.ap-proof-ev { min-width: 0; } .ap-proof-ev a { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; font-weight: 600; color: var(--signal); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .ap-proof-ev a svg { flex: none; }
.ap-proof-ev a:hover { text-decoration: underline; }
.ap-proof-by { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--ink-faint); }
.ap-proof-hidden { font-size: 12px; color: var(--danger); }
.ap-proof-actions { display: flex; flex-direction: column; gap: 2px; }

/* The discussion */
.ap-thread { display: flex; flex-direction: column; gap: 14px; }
.ap-thread-signin { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 12px 14px; border-radius: var(--radius-md); background: var(--ground-sunken); font-size: 14px; color: var(--ink-muted); }
.ap-thread-empty { margin: 0; color: var(--ink-muted); font-size: 14px; }
.ap-composer-c { display: flex; flex-direction: column; gap: 8px; }
.ap-composer-c textarea { width: 100%; box-sizing: border-box; resize: vertical; min-height: 64px; padding: 10px 12px; border-radius: var(--radius-md); border: var(--stroke-hairline) solid var(--hairline); background: var(--surface); color: var(--ink); font: 400 14px/20px var(--font-sans); transition: border-color var(--duration-fast), box-shadow var(--duration-fast); }
.ap-composer-c textarea:focus { outline: none; border-color: var(--signal); box-shadow: 0 0 0 3px var(--signal-soft); }
.ap-composer-c-foot { display: flex; justify-content: flex-end; gap: 6px; }
.ap-comment-kinds { display: flex; gap: 6px; }
.ap-comment-kind { height: 28px; padding: 0 12px; border-radius: var(--radius-pill); border: var(--stroke-hairline) solid var(--hairline); background: var(--surface); color: var(--ink-muted); font: 600 12px/26px var(--font-sans); cursor: pointer; transition: background var(--duration-fast), color var(--duration-fast), border-color var(--duration-fast); }
.ap-comment-kind.is-on.is-tip { background: color-mix(in srgb, var(--presence-teal) 16%, var(--surface)); border-color: var(--presence-teal); color: var(--ink); }
.ap-comment-kind.is-on.is-question { background: color-mix(in srgb, var(--signal) 14%, var(--surface)); border-color: var(--signal); color: var(--ink); }
.ap-comment-kind.is-on.is-experience { background: color-mix(in srgb, var(--presence-amber) 18%, var(--surface)); border-color: var(--presence-amber); color: var(--ink); }
.ap-comments, .ap-comment-replies { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.ap-comment-replies { margin-top: 10px; padding-left: 4px; border-left: 2px solid var(--hairline); }
.ap-comment { display: flex; gap: 10px; animation: ap-row-in 420ms var(--ease-spring) both; animation-delay: calc(var(--i, 0) * 40ms); }
.ap-comment.is-fresh { animation: ap-comment-in 520ms var(--ease-spring) both; }
.ap-comment.is-reply { padding-left: 10px; }
.ap-comment-body { flex: 1; min-width: 0; }
.ap-comment-body header { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; }
.ap-comment-body header time { margin-left: auto; color: var(--ink-faint); font-size: 12px; }
.ap-comment-tag { height: 20px; padding: 0 7px; border-radius: var(--radius-pill); background: var(--ground-sunken); font: 600 11px/20px var(--font-sans); color: var(--ink-muted); }
.ap-comment.is-question > .ap-comment-body > header .ap-comment-tag { background: color-mix(in srgb, var(--signal) 14%, var(--surface)); color: var(--signal-deep, var(--signal)); }
.ap-comment.is-experience > .ap-comment-body > header .ap-comment-tag { background: color-mix(in srgb, var(--presence-amber) 20%, var(--surface)); }
.ap-comment-author { height: 20px; padding: 0 7px; border-radius: var(--radius-pill); background: var(--ink); color: var(--surface); font: 700 11px/20px var(--font-sans); }
.ap-comment-answered { display: inline-flex; align-items: center; gap: 3px; color: color-mix(in srgb, var(--presence-teal) 70%, var(--ink)); font-size: 12px; font-weight: 650; }
.ap-comment-body p { margin: 4px 0 0; font-size: 14px; line-height: 21px; white-space: pre-wrap; overflow-wrap: anywhere; }
.ap-comment.is-author > .ap-comment-body > p { padding: 8px 10px; border-radius: var(--radius-md); background: color-mix(in srgb, var(--signal) 6%, var(--surface)); }
.ap-comment-actions { display: flex; gap: 12px; margin-top: 4px; }
.ap-comment-actions button { border: 0; padding: 0; background: none; color: var(--ink-muted); font: 600 12px var(--font-sans); cursor: pointer; }
.ap-comment-actions button:hover { color: var(--signal); }
@keyframes ap-comment-in { 0% { opacity: 0; transform: translateY(-10px) scale(0.98); background: color-mix(in srgb, var(--signal) 10%, transparent); } 100% { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .ap-recipe-card, .ap-dish-block, .ap-dish-link, .ap-dish-tech, .ap-method-step, .ap-variant, .ap-proof, .ap-comment, .ap-pot-art, .ap-pot-count, .ap-stamp { animation: none !important; opacity: 1 !important; stroke-dashoffset: 0 !important; }
}

/* ---------- What's new and guided tours ---------- */
.ap-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ap-wn { position: relative; display: inline-flex; }
.ap-wn-btn { position: relative; }
.ap-wn-btn.is-on { background: var(--signal-soft); color: var(--signal-deep); }
.ap-wn.has-nudge .ap-wn-btn .ap-glyph { animation: ap-gift-wiggle 620ms var(--ease-spring) 2; transform-origin: 50% 80%; }
.ap-wn-count { position: absolute; top: 2px; right: 2px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; background: var(--signal); color: var(--on-signal); font: 700 10.5px/17px var(--font-sans); text-align: center; box-shadow: 0 0 0 2px var(--surface); animation: ap-count-in 360ms var(--ease-spring) both; pointer-events: none; }
.ap-wn-nudge { position: absolute; top: calc(100% + 10px); right: -4px; z-index: 80; width: 280px; padding: 12px 14px; border-radius: var(--radius-lg); background: var(--surface-raised); border: var(--stroke-hairline) solid var(--hairline); box-shadow: var(--shadow-float); display: flex; flex-direction: column; gap: 6px; transform-origin: calc(100% - 22px) -10px; animation: ap-nudge-drop 420ms var(--ease-spring) both; text-align: left; }
.ap-wn-nudge::before { content: ''; position: absolute; top: -6px; right: 18px; width: 12px; height: 12px; background: inherit; border-left: var(--stroke-hairline) solid var(--hairline); border-top: var(--stroke-hairline) solid var(--hairline); transform: rotate(45deg); }
.ap-wn-nudge-kicker { display: inline-flex; align-items: center; gap: 4px; font: 700 11px/1 var(--font-sans); letter-spacing: 0.06em; text-transform: uppercase; color: var(--signal-deep); }
.ap-wn-nudge b { font: 600 15px/20px var(--font-display); color: var(--ink); }
.ap-wn-nudge-actions { display: flex; gap: 6px; margin-top: 4px; }
@keyframes ap-gift-wiggle { 0%, 100% { transform: none; } 25% { transform: rotate(-9deg) scale(1.08); } 60% { transform: rotate(8deg) scale(1.04); } }
@keyframes ap-count-in { 0% { transform: scale(0); } 70% { transform: scale(1.25); } 100% { transform: none; } }
@keyframes ap-nudge-drop { 0% { opacity: 0; transform: translateY(-10px) scale(0.9); } 100% { opacity: 1; transform: none; } }

.ap-wn-panel { width: min(420px, calc(100vw - 24px)); max-height: min(640px, calc(100vh - 96px)); display: flex; flex-direction: column; border-radius: var(--radius-xl); background: var(--surface); border: var(--stroke-hairline) solid var(--hairline); box-shadow: var(--shadow-float); overflow: hidden; transform-origin: calc(100% - 24px) 0; animation: ap-wn-unfold 260ms var(--ease-out) both; color: var(--ink); text-align: left; }
.ap-wn-panel > header { display: flex; align-items: center; gap: 12px; padding: 16px 16px 12px; border-bottom: var(--stroke-hairline) solid var(--hairline); }
.ap-wn-panel > header > div { flex: 1; min-width: 0; }
.ap-wn-panel h2 { margin: 0; font: 700 18px/22px var(--font-display); }
.ap-wn-panel header p { margin: 2px 0 0; font-size: 13px; color: var(--ink-muted); }
.ap-wn-panel-mark { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--signal-soft); color: var(--signal-deep); }
.ap-wn-list { overflow: auto; padding: 8px; display: flex; flex-direction: column; gap: 4px; }
@keyframes ap-wn-unfold { 0% { opacity: 0; transform: scale(0.96) translateY(-6px); } 100% { opacity: 1; transform: none; } }

.ap-release { position: relative; display: flex; gap: 12px; padding: 12px; border-radius: var(--radius-lg); animation: ap-rise 320ms var(--ease-out) both; animation-delay: calc(var(--i, 0) * 50ms + 60ms); }
.ap-release.is-unseen { background: color-mix(in srgb, var(--signal) 6%, transparent); }
.ap-release-art { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--ground-sunken); color: var(--ink); }
.ap-release.is-unseen .ap-release-art { background: var(--signal); color: var(--on-signal); }
.ap-release-body { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.ap-release-meta { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-faint); }
.ap-release-tag { padding: 2px 7px; border-radius: 999px; background: var(--signal-soft); color: var(--signal-deep); font-weight: 700; font-size: 11px; }
.ap-release-tag.is-improved { background: color-mix(in srgb, var(--presence-teal) 16%, transparent); color: var(--ink); }
.ap-release-dot { width: 8px; height: 8px; border-radius: 999px; background: var(--signal); box-shadow: 0 0 0 3px color-mix(in srgb, var(--signal) 22%, transparent); }
.ap-release h3 { margin: 0; font: 650 15.5px/20px var(--font-display); }
.ap-release-summary { margin: 0; font-size: 13.5px; line-height: 19px; color: var(--ink-muted); }
.ap-release ul { margin: 2px 0 0; padding-left: 18px; font-size: 13px; line-height: 19px; color: var(--ink-muted); }
.ap-release-actions { display: flex; align-items: center; gap: 12px; margin-top: 6px; }
.ap-release-docs { font-size: 13px; font-weight: 600; color: var(--signal-deep); }

/* The tour: veil with a cut-out, ring, coach card. */
.ap-tour { position: fixed; inset: 0; z-index: 1000; pointer-events: none; }
.ap-tour-veil { position: absolute; inset: 0; pointer-events: auto; background: color-mix(in srgb, #0b1220 44%, transparent); backdrop-filter: blur(4px) saturate(0.8); -webkit-backdrop-filter: blur(4px) saturate(0.8); animation: ap-veil-in 320ms var(--ease-out) both; }
[data-theme='dark'] .ap-tour-veil { background: color-mix(in srgb, #000 58%, transparent); }
.ap-tour-ring { position: absolute; pointer-events: none; border: 2px solid var(--signal); box-shadow: 0 0 0 4px color-mix(in srgb, var(--signal) 22%, transparent), 0 0 32px 4px color-mix(in srgb, var(--signal) 45%, transparent); animation: ap-ring-land 420ms var(--ease-spring) both; }
.ap-tour-ring.is-waiting { animation: ap-ring-land 420ms var(--ease-spring) both, ap-ring-breathe 1.6s var(--ease-in-out) 420ms infinite; }
.ap-tour.is-done .ap-tour-ring { animation: ap-ring-bloom 500ms var(--ease-out) both; }
.ap-tour.is-done .ap-tour-veil, .ap-tour.is-done .ap-tour-card { animation: ap-veil-out 420ms var(--ease-out) both; }
.ap-tour-card { position: absolute; pointer-events: auto; width: min(340px, calc(100vw - 24px)); padding: 14px 16px 12px; border-radius: var(--radius-xl); background: var(--surface-raised); color: var(--ink); border: var(--stroke-hairline) solid var(--hairline); box-shadow: 0 24px 64px -18px rgba(0, 0, 0, 0.45), var(--shadow-float); display: flex; flex-direction: column; gap: 8px; outline: none; transition: left 380ms var(--ease-out), top 380ms var(--ease-out); animation: ap-card-rise 320ms var(--ease-out) both; text-align: left; }
.ap-tour-card:focus-visible { box-shadow: 0 0 0 3px var(--signal), var(--shadow-float); }
.ap-tour-card.is-missing { animation: ap-card-shake 300ms var(--ease-out); }
.ap-tour-head { display: flex; align-items: center; gap: 10px; }
.ap-tour-count { font: 700 11px/1 var(--font-sans); letter-spacing: 0.05em; text-transform: uppercase; color: var(--signal-deep); white-space: nowrap; }
.ap-tour-dots { display: flex; gap: 4px; flex: 1; min-width: 0; overflow: hidden; }
.ap-tour-dots i { width: 6px; height: 6px; border-radius: 999px; background: var(--hairline); transition: width 260ms var(--ease-spring), background 200ms; }
.ap-tour-dots i.is-past { background: color-mix(in srgb, var(--signal) 45%, var(--hairline)); }
.ap-tour-dots i.is-now { width: 18px; background: var(--signal); }
.ap-tour-skip { border: 0; background: none; padding: 4px; white-space: nowrap; flex: none; font: 600 12.5px/1 var(--font-sans); color: var(--ink-muted); cursor: pointer; }
.ap-tour-skip:hover { color: var(--ink); }
.ap-tour-text { display: flex; flex-direction: column; gap: 6px; animation: ap-text-in 260ms var(--ease-out) both; }
.ap-tour-text h3 { margin: 0; font: 700 17px/22px var(--font-display); }
.ap-tour-text p { margin: 0; font-size: 14px; line-height: 20px; color: var(--ink-muted); }
.ap-tour-try { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; padding: 5px 10px; border-radius: 999px; background: var(--signal-soft); color: var(--signal-deep) !important; font-weight: 600; font-size: 13px !important; animation: ap-try-pulse 1.6s var(--ease-in-out) infinite; }
.ap-tour-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 4px; }
.ap-tour.is-sheet .ap-tour-card { left: 8px; right: 8px; bottom: 8px; top: auto; width: auto; border-radius: 22px; padding-bottom: calc(12px + env(safe-area-inset-bottom)); animation: ap-sheet-up 340ms var(--ease-out) both; }
@keyframes ap-veil-in { from { opacity: 0; backdrop-filter: blur(0); -webkit-backdrop-filter: blur(0); } to { opacity: 1; } }
@keyframes ap-veil-out { to { opacity: 0; } }
@keyframes ap-ring-land { 0% { opacity: 0; transform: scale(1.3); } 65% { opacity: 1; transform: scale(0.98); } 100% { opacity: 1; transform: none; } }
@keyframes ap-ring-breathe { 0%, 100% { transform: none; box-shadow: 0 0 0 4px color-mix(in srgb, var(--signal) 22%, transparent), 0 0 32px 4px color-mix(in srgb, var(--signal) 45%, transparent); } 50% { transform: scale(1.04); box-shadow: 0 0 0 9px color-mix(in srgb, var(--signal) 12%, transparent), 0 0 44px 8px color-mix(in srgb, var(--signal) 35%, transparent); } }
@keyframes ap-ring-bloom { to { opacity: 0; transform: scale(1.6); } }
@keyframes ap-card-rise { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes ap-sheet-up { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: none; } }
@keyframes ap-text-in { from { opacity: 0; transform: translateX(8px); } to { opacity: 1; transform: none; } }
@keyframes ap-card-shake { 0%, 100% { transform: none; } 25% { transform: translateX(-6px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-3px); } }
@keyframes ap-try-pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--signal) 30%, transparent); } 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--signal) 0%, transparent); } }
@media (prefers-reduced-motion: reduce) {
  .ap-wn.has-nudge .ap-wn-btn .ap-glyph, .ap-wn-count, .ap-wn-nudge, .ap-wn-panel, .ap-release, .ap-tour-ring, .ap-tour-ring.is-waiting, .ap-tour-card, .ap-tour-text, .ap-tour-try, .ap-tour.is-sheet .ap-tour-card { animation-duration: 120ms; animation-iteration-count: 1; }
  .ap-tour-card { transition: none; }
}
.ap-wn-btn:not(.ap-btn--icon) .ap-wn-count { position: static; margin-left: 2px; box-shadow: none; }

/* ---------- History: steps and named backups ---------- */
.ap-history { width: min(380px, calc(100vw - 24px)); max-height: min(560px, calc(100vh - 120px)); display: flex; flex-direction: column; border-radius: var(--radius-xl); background: var(--surface); border: var(--stroke-hairline) solid var(--hairline); box-shadow: var(--shadow-float); overflow: hidden; transform-origin: 50% 100%; animation: ap-history-rise 240ms var(--ease-out) both; color: var(--ink); text-align: left; }
.ap-history > header { display: flex; align-items: center; gap: 10px; padding: 14px 12px 10px 16px; }
.ap-history > header h2 { flex: 1; margin: 0; font: 700 17px/22px var(--font-display); }
.ap-history-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--signal-soft); color: var(--signal-deep); }
.ap-history-tabs { display: flex; gap: 4px; margin: 0 12px; padding: 3px; border-radius: var(--radius-pill); background: var(--ground-sunken); }
.ap-history-tabs button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 30px; border: 0; border-radius: var(--radius-pill); background: transparent; color: var(--ink-muted); font: 600 13px var(--font-sans); cursor: pointer; transition: background var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out); }
.ap-history-tabs button.is-on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-tile); }
.ap-history-count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--radius-pill); background: var(--signal-soft); color: var(--signal-deep); font: 700 11px/18px var(--font-mono); }
.ap-history-steps, .ap-history-backups, .ap-history-signin { display: flex; flex-direction: column; min-height: 0; overflow: auto; padding: 10px 8px 12px; }
.ap-history-empty { margin: 12px 8px; color: var(--ink-muted); font-size: 13px; line-height: 19px; }
.ap-history-foot { margin: 10px 8px 0; color: var(--ink-faint); font-size: 12px; line-height: 16px; }
.ap-history-error { margin: 6px 8px 0; color: var(--danger); font-size: 13px; }

/* The steps: a timeline, newest at the top. The dot column is the line. */
.ap-steps { position: relative; margin: 0; padding: 0; list-style: none; }
.ap-steps::before { content: ''; position: absolute; left: 17px; top: 14px; bottom: 14px; width: 2px; border-radius: 1px; background: var(--hairline); }
.ap-step { position: relative; }
.ap-step > button, .ap-step--now { display: grid; grid-template-columns: 20px 1fr auto; align-items: center; gap: 10px; width: 100%; min-height: 36px; padding: 6px 8px; border: 0; border-radius: var(--radius-md); background: transparent; color: var(--ink); font: 500 13px/18px var(--font-sans); text-align: left; }
.ap-step > button { cursor: pointer; transition: background var(--duration-fast) var(--ease-out); }
.ap-step > button:hover:not(:disabled) { background: var(--ground-sunken); }
.ap-step > button:focus-visible { outline: 2px solid var(--signal); outline-offset: -2px; }
.ap-step > button:disabled { cursor: default; }
.ap-step-dot { justify-self: center; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--ink-faint); position: relative; z-index: 1; }
.ap-step-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-step-time { color: var(--ink-faint); font: 500 11px var(--font-mono); white-space: nowrap; }
.ap-step--done .ap-step-dot { background: var(--signal); border-color: var(--signal); }
.ap-step--undone > button { color: var(--ink-faint); }
.ap-step--undone .ap-step-label { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--ink-faint) 60%, transparent); }
.ap-step--undone > button:hover .ap-step-label { text-decoration: none; color: var(--ink); }
.ap-step--now { font-weight: 700; color: var(--signal-deep); animation: ap-step-now 320ms var(--ease-spring) both; }
.ap-step--now .ap-step-dot { width: 14px; height: 14px; background: var(--signal); border: 3px solid var(--surface); box-shadow: 0 0 0 2px var(--signal), var(--shadow-signal); }
.ap-step--start .ap-step-dot { border-style: dashed; }
.ap-step--start .ap-step-label { color: var(--ink-muted); }

/* Backups */
.ap-backup-new { display: flex; gap: 8px; padding: 0 4px 4px; }
.ap-backup-new input, .ap-backup-rename input { flex: 1; min-width: 0; height: 32px; padding: 0 10px; border-radius: var(--radius-md); border: var(--stroke-hairline) solid var(--hairline); background: var(--ground); color: var(--ink); font: 500 13px var(--font-sans); }
.ap-backup-new input:focus, .ap-backup-rename input:focus { outline: 2px solid var(--signal); outline-offset: -1px; border-color: transparent; }
.ap-backups { margin: 6px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 2px; }
.ap-backup { display: grid; grid-template-columns: 32px 1fr auto; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius-md); transition: background var(--duration-fast) var(--ease-out); }
.ap-backup:hover, .ap-backup.is-confirming { background: var(--ground-sunken); }
.ap-backup.is-fresh { animation: ap-backup-in 520ms var(--ease-spring) both; }
.ap-backup.is-editing { display: block; }
.ap-backup-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--ground-sunken); color: var(--ink-muted); }
.ap-backup-text { display: flex; flex-direction: column; min-width: 0; }
.ap-backup-text b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 600 13px/18px var(--font-sans); }
.ap-backup-text span { color: var(--ink-muted); font-size: 12px; line-height: 16px; }
.ap-backup-actions { display: flex; align-items: center; gap: 2px; }
.ap-backup-confirm { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 6px 0 0 42px; }
.ap-backup-confirm p { flex: 1 1 160px; margin: 0; color: var(--ink-muted); font-size: 12px; line-height: 16px; }
.ap-backup-rename { display: flex; gap: 6px; }
.ap-history-signin { align-items: flex-start; gap: 10px; padding: 16px; }
.ap-history-signin p { margin: 0; color: var(--ink-muted); font-size: 13px; line-height: 19px; }
.ap-history-signin b { color: var(--ink); }

@keyframes ap-history-rise { 0% { opacity: 0; transform: scale(0.96) translateY(8px); } 100% { opacity: 1; transform: none; } }
@keyframes ap-step-now { 0% { transform: translateY(-6px); opacity: 0.4; } 100% { transform: none; opacity: 1; } }
@keyframes ap-backup-in { 0% { opacity: 0; transform: translateY(-8px); background: var(--signal-soft); } 60% { background: var(--signal-soft); } 100% { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .ap-history, .ap-step--now, .ap-backup.is-fresh { animation: none; } }

/* Recipes in your languages (docs/ux/recipe-languages.md) */
.ap-recipe-kickrow { display: flex; align-items: center; gap: 8px; }
.ap-recipe-lang { margin-left: auto; padding: 1px 7px; border-radius: 6px; background: color-mix(in srgb, var(--signal) 16%, var(--surface)); color: var(--signal); font: 700 11px/18px var(--font-mono); letter-spacing: 0.03em; }
.ap-recipe-also { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 0 16px 4px; font: 500 12px/18px var(--font-sans); color: var(--ink-muted); }
.ap-recipe-also a { padding: 1px 9px; border-radius: var(--radius-pill); border: var(--stroke-hairline) solid var(--hairline); color: var(--ink); text-decoration: none; transition: border-color var(--duration-fast), background var(--duration-fast); }
.ap-recipe-also a:hover { border-color: var(--signal); background: color-mix(in srgb, var(--signal) 10%, transparent); }
.ap-recipe-also a:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }

.ap-lp { position: relative; display: inline-flex; }
.ap-lp-button { display: inline-flex; align-items: center; gap: 8px; height: 36px; max-width: 320px; padding: 0 12px; border-radius: var(--radius-pill); border: var(--stroke-hairline) solid var(--hairline); background: var(--surface); color: var(--ink); font: 600 13px/1 var(--font-sans); cursor: pointer; transition: border-color var(--duration-fast), background var(--duration-fast); }
.ap-lp-button:hover, .ap-lp.is-open .ap-lp-button { border-color: var(--signal); background: color-mix(in srgb, var(--signal) 12%, var(--surface)); }
.ap-lp-button:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
.ap-lp-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-lp-caret { color: var(--ink-muted); transition: transform var(--duration-base) var(--ease-spring); }
.ap-lp.is-open .ap-lp-caret { transform: rotate(180deg); }
.ap-lp-scrim { display: none; }
.ap-lp-pop { position: absolute; top: calc(100% + 8px); left: 0; z-index: 40; width: 300px; padding: 10px; display: flex; flex-direction: column; gap: 2px; border-radius: var(--radius-xl); background: var(--surface); border: var(--stroke-hairline) solid var(--hairline); box-shadow: var(--shadow-lift); transform-origin: 20% 0; animation: ap-lp-pop 220ms var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1)) both; }
.ap-lp-grip, .ap-lp-title, .ap-lp-hint, .ap-lp-done { display: none; }
.ap-lp-item { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 6px 10px; border: 0; border-radius: 12px; background: transparent; color: var(--ink); font: 600 14px/20px var(--font-sans); text-align: left; cursor: pointer; animation: ap-lp-item 200ms var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1)) both; animation-delay: calc(var(--i, 0) * 30ms); }
.ap-lp-item:hover { background: var(--ground-sunken); }
.ap-lp-item:focus-visible { outline: 2px solid var(--signal); outline-offset: -2px; }
.ap-lp-item.is-none { opacity: 0.45; cursor: not-allowed; }
.ap-lp-box { display: grid; place-items: center; flex: none; width: 20px; height: 20px; border-radius: 6px; border: 1px solid var(--hairline-strong, var(--hairline)); color: var(--ground); transition: background var(--duration-fast), border-color var(--duration-fast), transform var(--duration-base) var(--ease-spring); }
.ap-lp-box.is-on { background: var(--signal); border-color: var(--signal); transform: scale(1.06); }
.ap-lp-name { flex: 1; }
.ap-lp-note { font: 500 11px/16px var(--font-sans); color: var(--ink-faint, var(--ink-muted)); }
.ap-lp-count { min-width: 22px; text-align: right; font: 500 12px/16px var(--font-mono); color: var(--ink-muted); }
.ap-lp-sep { height: 1px; margin: 6px 4px; background: var(--hairline); }
.ap-lp-reset { align-self: flex-start; margin: 4px 10px 2px; padding: 0; border: 0; background: none; color: var(--signal); font: 500 12px/18px var(--font-sans); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
@keyframes ap-lp-pop { 0% { opacity: 0; transform: scale(0.96) translateY(-4px); } 100% { opacity: 1; transform: none; } }
@keyframes ap-lp-item { 0% { opacity: 0; transform: translateY(-4px); } 100% { opacity: 1; transform: none; } }
@keyframes ap-lp-sheet { 0% { transform: translateY(40px); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes ap-lp-fade { 0% { opacity: 0; } 100% { opacity: 1; } }
@media (max-width: 560px) {
  .ap-lp-scrim { display: block; position: fixed; inset: 0; z-index: 60; background: rgba(6, 7, 8, 0.55); animation: ap-lp-fade 200ms ease both; }
  .ap-lp-pop { position: fixed; top: auto; left: 0; right: 0; bottom: 0; z-index: 61; width: auto; padding: 12px 18px calc(20px + env(safe-area-inset-bottom)); border-radius: 28px 28px 0 0; gap: 4px; animation: ap-lp-sheet 280ms cubic-bezier(0.16, 1, 0.3, 1) both; }
  .ap-lp-grip { display: block; align-self: center; width: 40px; height: 4px; border-radius: 2px; background: var(--hairline); margin-bottom: 8px; }
  .ap-lp-title { display: block; font: 700 22px/28px var(--font-display); }
  .ap-lp-hint { display: block; margin-bottom: 6px; font: 400 13px/18px var(--font-sans); color: var(--ink-muted); }
  .ap-lp-item { min-height: 52px; }
  .ap-lp-done { display: block; height: 48px; margin-top: 8px; border: 0; border-radius: 12px; background: var(--signal); color: var(--ground); font: 700 15px/1 var(--font-sans); cursor: pointer; }
  .ap-lp-button { max-width: 220px; }
}
@media (prefers-reduced-motion: reduce) {
  .ap-lp-pop, .ap-lp-item, .ap-lp-scrim { animation: none !important; }
  .ap-lp-caret, .ap-lp-box { transition: none; }
}

/* ---------- AI key journey (docs/ux/ai-keys.md §6) ---------- */
.ap-kj-back { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 16px; background: color-mix(in srgb, var(--ground-sunken) 62%, transparent); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); animation: ap-kj-fade var(--duration-base) var(--ease-out) both; }
.ap-kj { width: min(680px, 100%); max-height: min(720px, calc(100vh - 32px)); display: flex; flex-direction: column; border-radius: var(--radius-xl); background: var(--surface); border: var(--stroke-hairline) solid var(--hairline); box-shadow: var(--shadow-float); color: var(--ink); outline: none; transform-origin: 70% 100%; animation: ap-kj-rise 320ms var(--ease-out) both; overflow: hidden; }
.ap-kj-head { display: flex; flex-direction: column; gap: 14px; padding: 20px 22px 14px; border-bottom: var(--stroke-hairline) solid var(--hairline); }
.ap-kj-title { display: flex; align-items: center; gap: 10px; }
.ap-kj-title > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ap-kj-title b { font: 700 18px/22px var(--font-display); }
.ap-kj-intent { font-size: 12px; color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; animation: ap-kj-slide 360ms var(--ease-out) 120ms both; }
.ap-kj-badge { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--signal-soft); color: var(--signal-deep); }
.ap-kj-progress { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.ap-kj-progress li { display: flex; flex-direction: column; gap: 6px; }
.ap-kj-bar { height: 4px; border-radius: 2px; background: var(--hairline); overflow: hidden; }
.ap-kj-bar > span { display: block; height: 100%; width: 0; border-radius: 2px; background: var(--signal); transition: width 420ms var(--ease-spring); }
.ap-kj-progress li.is-done .ap-kj-bar > span { width: 100%; }
.ap-kj-progress li.is-now .ap-kj-bar > span { width: 50%; }
.ap-kj-label { font-size: 11px; font-weight: 600; color: var(--ink-faint); }
.ap-kj-progress li.is-done .ap-kj-label, .ap-kj-progress li.is-now .ap-kj-label { color: var(--ink); }
.ap-kj-body { flex: 1; min-height: 0; overflow: auto; padding: 20px 22px; }
.ap-kj-step { display: flex; flex-direction: column; gap: 16px; animation: ap-kj-step 280ms var(--ease-out) both; }
.ap-kj-step h2 { margin: 0; font: 700 24px/28px var(--font-display); letter-spacing: -0.01em; }
.ap-kj-hero { display: flex; align-items: center; gap: 18px; }
.ap-kj-hero p { margin: 6px 0 0; color: var(--ink-muted); font-size: 14px; line-height: 20px; }
.ap-kj-keyart { flex: none; color: var(--signal); animation: ap-kj-turn 700ms var(--ease-spring) 200ms both; }
.ap-kj-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.ap-kj-tile { display: flex; flex-direction: column; gap: 8px; padding: 16px; border-radius: 16px; background: var(--surface-raised); border: var(--stroke-hairline) solid var(--hairline); animation: ap-kj-tile 360ms var(--ease-out) both; }
.ap-kj-tile:nth-child(2) { animation-delay: 60ms; } .ap-kj-tile:nth-child(3) { animation-delay: 120ms; }
.ap-kj-tile b { font-size: 14px; } .ap-kj-tile span { font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.ap-kj-note { margin: 0; font-size: 13px; color: var(--ink-muted); }
.ap-kj-link { padding: 0; border: 0; background: none; color: var(--signal-deep); font: inherit; text-decoration: underline; cursor: pointer; }
.ap-kj-providers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ap-kj-provider { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 10px 12px; border-radius: 16px; border: var(--stroke-hairline) solid var(--hairline); background: var(--surface-raised); color: var(--ink); text-align: left; cursor: pointer; transition: transform 300ms var(--ease-spring), opacity 300ms var(--ease-out), border-color var(--duration-fast), background var(--duration-fast); }
.ap-kj-provider:hover { transform: translateY(-2px); }
.ap-kj-providers:has(.is-on) .ap-kj-provider:not(.is-on) { opacity: 0.55; }
.ap-kj-provider.is-on { background: var(--signal-soft); border-color: var(--signal); }
.ap-kj-mark { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--signal-soft); color: var(--signal-deep); font: 700 15px var(--font-mono); }
.ap-kj-ptext { display: flex; flex-direction: column; min-width: 0; } .ap-kj-ptext b { font-size: 14px; } .ap-kj-ptext span { font-size: 12px; color: var(--ink-muted); }
.ap-kj-how { padding: 14px 16px; border-radius: 16px; background: var(--signal-soft); font-size: 13px; line-height: 20px; }
.ap-kj-how ol { margin: 6px 0 8px; padding-left: 18px; } .ap-kj-how a { color: var(--signal-deep); font-weight: 600; }
.ap-kj-field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--ink-muted); }
.ap-kj-field input { height: 48px; padding: 0 14px; border-radius: 12px; border: var(--stroke-hairline) solid var(--hairline); background: var(--ground); color: var(--ink); font: 15px var(--font-mono); letter-spacing: 0.04em; transition: border-color var(--duration-fast); }
.ap-kj-field input:focus { outline: 2px solid var(--signal); outline-offset: -1px; }
.ap-kj-field input.is-ok { border-color: var(--success); }
.ap-kj-field input.is-fail { border-color: var(--danger); animation: ap-kj-shake 300ms ease-in-out; }
.ap-kj-wire { display: flex; align-items: center; gap: 12px; height: 72px; padding: 0 16px; border-radius: 16px; background: var(--surface-raised); border: var(--stroke-hairline) solid var(--hairline); }
.ap-kj-masked { font: 14px var(--font-mono); color: var(--ink-muted); }
.ap-kj-wire svg { flex: 1; height: 8px; } .ap-kj-wire path { stroke: var(--hairline); stroke-width: 2; fill: none; }
.ap-kj-wire.is-running path { stroke: var(--signal); stroke-dasharray: 6 6; animation: ap-kj-dash 900ms linear infinite; }
.ap-kj-wire.is-ok path { stroke: var(--success); }
.ap-kj-wire.is-ok .ap-kj-mark { animation: ap-kj-breathe 1.6s ease-in-out infinite; }
.ap-kj-result { display: flex; align-items: center; gap: 10px; min-height: 28px; font-size: 14px; color: var(--ink-muted); }
.ap-kj-result b { color: var(--success); }
.ap-kj-tickbg { fill: color-mix(in srgb, var(--success) 20%, transparent); }
.ap-kj-tick { fill: none; stroke: var(--success); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 30; animation: ap-kj-tickdraw 420ms var(--ease-out) both; }
.ap-kj-error { color: var(--danger); margin: 0; font-size: 13px; }
.ap-kj-levels { flex-direction: row; gap: 18px; }
.ap-kj-levellist { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.ap-kj-levellist h2 { margin-bottom: 4px; }
.ap-kj-level { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 12px; border-radius: 14px; border: var(--stroke-hairline) solid var(--hairline); background: var(--surface-raised); color: var(--ink); text-align: left; cursor: pointer; transition: transform 300ms var(--ease-spring), border-color var(--duration-fast), background var(--duration-fast); }
.ap-kj-level:hover:not(.is-off) { transform: translateY(-2px); }
.ap-kj-level.is-on { background: var(--signal-soft); border-color: var(--signal); }
.ap-kj-level.is-off { opacity: 0.6; cursor: default; }
.ap-kj-level-icon { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--surface); color: var(--ink-muted); transition: background var(--duration-fast), color var(--duration-fast); }
.ap-kj-level.is-on .ap-kj-level-icon { background: var(--signal); color: var(--on-signal); }
.ap-kj-level-text { flex: 1; min-width: 0; display: flex; flex-direction: column; } .ap-kj-level-text b { font-size: 14px; } .ap-kj-level-text span { font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.ap-kj-level-tag { font-size: 11px; font-weight: 700; color: var(--success); white-space: nowrap; } .ap-kj-level-tag.is-warn { color: var(--warning); }
.ap-kj-who { width: 200px; flex: none; display: flex; flex-direction: column; align-items: center; gap: 10px; padding-top: 36px; text-align: center; }
.ap-kj-who b { font-size: 14px; } .ap-kj-who span { font-size: 12px; line-height: 17px; color: var(--ink-muted); }
.ap-kj-ring { position: relative; width: 180px; height: 180px; border-radius: 50%; border: 1px dashed var(--hairline); animation: ap-kj-ring 500ms var(--ease-spring) both; }
.ap-kj-dot { position: absolute; border-radius: 50%; background: var(--presence-color, var(--signal)); border: 2px solid var(--surface); animation: ap-kj-pop 420ms var(--ease-spring) both; }
.ap-kj-ring-key { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: var(--signal); color: var(--on-signal); }
.ap-kj-done { align-items: center; justify-content: center; text-align: center; min-height: 300px; }
.ap-kj-done p { margin: 0; max-width: 420px; color: var(--ink-muted); font-size: 14px; line-height: 20px; }
.ap-kj-fly { position: relative; width: 300px; height: 110px; }
.ap-kj-padlock { position: absolute; left: 16px; top: 30px; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; background: var(--signal); color: var(--on-signal); animation: ap-kj-lock 650ms cubic-bezier(.34, 1.56, .64, 1) 150ms both; }
.ap-kj-home { position: absolute; right: 8px; top: 22px; display: grid; place-items: center; width: 64px; height: 64px; border-radius: 18px; background: var(--signal-soft); color: var(--signal-deep); border: var(--stroke-hairline) solid var(--signal); animation: ap-kj-receive 420ms var(--ease-spring) 700ms both; }
.ap-kj-foot { display: flex; align-items: center; gap: 10px; padding: 14px 22px 20px; border-top: var(--stroke-hairline) solid var(--hairline); }
.ap-kj-hint { flex: 1; min-width: 0; font-size: 12px; color: var(--ink-faint); }
.ap-kj-breathe { animation: ap-kj-breathe 1.6s ease-in-out infinite; }
@keyframes ap-kj-fade { 0% { opacity: 0; } 100% { opacity: 1; } }
@keyframes ap-kj-rise { 0% { opacity: 0; transform: translateY(18px) scale(0.97); } 100% { opacity: 1; transform: none; } }
@keyframes ap-kj-slide { 0% { opacity: 0; transform: translateY(-6px); } 100% { opacity: 1; transform: none; } }
@keyframes ap-kj-step { 0% { opacity: 0; transform: translateX(24px); } 100% { opacity: 1; transform: none; } }
@keyframes ap-kj-tile { 0% { opacity: 0; transform: translateY(12px); } 100% { opacity: 1; transform: none; } }
@keyframes ap-kj-turn { 0% { transform: rotate(-40deg); } 60% { transform: rotate(12deg); } 100% { transform: rotate(0); } }
@keyframes ap-kj-dash { 0% { stroke-dashoffset: 24; } 100% { stroke-dashoffset: 0; } }
@keyframes ap-kj-tickdraw { 0% { stroke-dashoffset: 30; } 100% { stroke-dashoffset: 0; } }
@keyframes ap-kj-shake { 0%, 100% { transform: none; } 25% { transform: translateX(-6px); } 50% { transform: translateX(6px); } 75% { transform: translateX(-3px); } }
@keyframes ap-kj-breathe { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--signal) 35%, transparent); } 50% { box-shadow: 0 0 0 8px transparent; } }
@keyframes ap-kj-ring { 0% { transform: scale(0.5); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes ap-kj-pop { 0% { opacity: 0; transform: scale(0); } 70% { transform: scale(1.25); } 100% { opacity: 1; transform: scale(1); } }
@keyframes ap-kj-lock { 0% { transform: none; } 55% { transform: translate(130px, -36px) scale(0.55); } 100% { transform: translate(226px, 0) scale(0.35); opacity: 0; } }
@keyframes ap-kj-receive { 0% { transform: scale(1); } 50% { transform: scale(1.12); } 100% { transform: scale(1); } }
@media (max-width: 639px) {
  .ap-kj-back { place-items: end stretch; padding: 0; }
  .ap-kj { width: 100%; max-height: 92vh; border-radius: var(--radius-xl) var(--radius-xl) 0 0; transform-origin: 50% 100%; }
  .ap-kj-tiles, .ap-kj-providers { grid-template-columns: minmax(0, 1fr); }
  .ap-kj-levels { flex-direction: column; } .ap-kj-who { display: none; }
  .ap-kj-label { display: none; } .ap-kj-hint { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .ap-kj, .ap-kj-back, .ap-kj-step, .ap-kj-tile, .ap-kj-keyart, .ap-kj-intent, .ap-kj-ring, .ap-kj-dot, .ap-kj-padlock, .ap-kj-home, .ap-kj-breathe, .ap-kj-wire.is-ok .ap-kj-mark, .ap-kj-field input.is-fail { animation: none; }
  .ap-kj-wire.is-running path { animation: none; }
}

/* ---------- Canvas art (docs/architecture/first-visit.md) ---------- */
.ap-art { overflow: visible; --art-1: color-mix(in srgb, var(--signal) 26%, var(--surface)); --art-2: color-mix(in srgb, var(--signal) 56%, var(--surface)); --art-3: color-mix(in srgb, var(--presence-violet) 58%, var(--surface)); --art-4: color-mix(in srgb, var(--ink) 38%, var(--surface)); }
.ap-art .ap-layer--1 { --art: var(--art-1); } .ap-art .ap-layer--2 { --art: var(--art-2); } .ap-art .ap-layer--3 { --art: var(--art-3); } .ap-art .ap-layer--4 { --art: var(--art-4); }
.ap-art-band { fill: color-mix(in srgb, var(--art) 16%, var(--surface)); transform-box: fill-box; transform-origin: left center; animation: ap-art-sweep 560ms var(--ease-out) both; }
.ap-art-tile { fill: var(--art); stroke: color-mix(in srgb, var(--art) 72%, var(--ink)); stroke-width: 1; transform-box: fill-box; transform-origin: center bottom; animation: ap-art-rise 560ms var(--ease-spring) both; }
.ap-art-pill { fill: var(--surface); fill-opacity: 0.85; animation: ap-art-fade 400ms ease-out both; }
.ap-art-sec { fill: color-mix(in srgb, var(--signal-deep, var(--signal)) 10%, var(--surface)); stroke: var(--signal-deep, var(--signal)); stroke-width: 1.2; stroke-dasharray: 4 3; transform-box: fill-box; transform-origin: center bottom; animation: ap-art-rise 560ms var(--ease-spring) both; }
.ap-art-flow { fill: none; stroke: var(--ink-muted); stroke-opacity: 0.45; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: ap-art-draw 760ms var(--ease-out) forwards; }
.ap-art-light { fill: none; stroke: var(--signal); stroke-width: 3.2; stroke-linecap: round; stroke-dasharray: 3 100; stroke-dashoffset: 3; opacity: 0; animation: ap-art-run 3.2s cubic-bezier(0.45, 0, 0.55, 1) infinite; }
.ap-isle:hover .ap-art-light, .ap-recipe-card:hover .ap-art-light, .ap-welcome-art:hover .ap-art-light { animation-duration: 1.6s; }
.ap-isle-map.ap-art { transform-origin: 50% 60%; }
.ap-art.is-still * { animation: none !important; }
.ap-art.is-still .ap-art-flow { stroke-dashoffset: 0; }
.ap-art.is-still .ap-art-light { display: none; }
@keyframes ap-art-sweep { from { transform: scaleX(0); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes ap-art-rise { from { transform: translateY(8px) scale(0.82); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes ap-art-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes ap-art-draw { to { stroke-dashoffset: 0; } }
@keyframes ap-art-run { 0% { stroke-dashoffset: 3; opacity: 0; } 8% { opacity: 1; } 85% { opacity: 1; } 100% { stroke-dashoffset: -100; opacity: 0; } }

/* ---------- Welcome card: the first visit (docs/ux/first-visit.md) ---------- */
.ap-welcome { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 24px; }
.ap-welcome-scrim { position: absolute; inset: 0; background: color-mix(in srgb, var(--ink) 28%, transparent); animation: ap-art-fade 320ms ease-out both; }
.ap-welcome.is-leaving .ap-welcome-scrim { animation: ap-welcome-fade-out 420ms ease-in both; }
.ap-welcome-card { position: relative; display: flex; flex-direction: row-reverse; width: min(920px, 100%); min-height: 520px; border-radius: 28px; background: var(--surface); color: var(--ink); box-shadow: 0 40px 90px -30px rgba(11, 12, 14, 0.5), 0 0 0 1px color-mix(in srgb, var(--ink) 6%, transparent); overflow: hidden; animation: ap-welcome-in 520ms var(--ease-out) both; }
.ap-welcome.is-leaving .ap-welcome-card { animation: ap-welcome-out 440ms cubic-bezier(0.7, 0, 0.84, 0) both; }
.ap-welcome-grip { display: none; }
.ap-welcome-art { position: relative; flex: 0 0 400px; display: grid; place-items: center; padding: 28px; background: radial-gradient(120% 90% at 30% 20%, color-mix(in srgb, var(--signal) 14%, var(--surface)), var(--ground-sunken)); }
.ap-welcome-art .ap-art { width: 100%; max-width: 344px; height: auto; aspect-ratio: 4 / 3; }
.ap-welcome-close { position: absolute; right: 16px; top: 16px; display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 12px; background: color-mix(in srgb, var(--surface) 80%, transparent); color: var(--ink); cursor: pointer; }
.ap-welcome-close:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
.ap-welcome-text { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 16px; padding: 40px 36px 32px 40px; }
.ap-welcome-text > *, .ap-welcome-promises li { animation: ap-welcome-rise 480ms var(--ease-out) both; animation-delay: calc(80ms + var(--i, 0) * 60ms); }
.ap-welcome-kicker { align-self: flex-start; padding: 5px 12px; border-radius: var(--radius-pill); background: var(--signal-soft); color: var(--signal); font: 600 11px/16px var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase; }
.ap-welcome-title { margin: 0; font: 800 46px/48px var(--font-display); letter-spacing: -0.03em; }
.ap-welcome-title em { font-style: normal; color: var(--signal); }
.ap-welcome-lede { margin: 0; font: 400 16px/24px var(--font-sans); color: var(--ink-muted); }
.ap-welcome-promises { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; animation: none !important; }
.ap-welcome-promises li { display: flex; gap: 12px; align-items: flex-start; }
.ap-welcome-promises li > span:last-child { display: flex; flex-direction: column; gap: 2px; }
.ap-welcome-promises b { font: 600 15px/20px var(--font-sans); }
.ap-welcome-promises small { font: 400 13px/18px var(--font-sans); color: var(--ink-muted); }
.ap-welcome-icon { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 10px; background: var(--ground-sunken); color: var(--ink); }
.ap-welcome-icon.is-signal { background: var(--signal-soft); color: var(--signal); }
.ap-welcome-icon.is-ai { background: color-mix(in srgb, var(--presence-violet) 14%, var(--surface)); color: var(--presence-violet); }
.ap-welcome-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: auto; }
.ap-welcome-more { font: 500 13px/18px var(--font-sans); color: var(--signal); }
@keyframes ap-welcome-in { 0% { opacity: 0; transform: translateY(18px) scale(0.97); } 100% { opacity: 1; transform: none; } }
@keyframes ap-welcome-out { 0% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translate(var(--fold-x, -40vw), var(--fold-y, -40vh)) scale(0.04); } }
@keyframes ap-welcome-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes ap-welcome-fade-out { to { opacity: 0; } }
@media (max-width: 720px) {
  .ap-welcome { place-items: end stretch; padding: 0; }
  .ap-welcome-card { flex-direction: column; min-height: 0; max-height: 92vh; overflow-y: auto; border-radius: 28px 28px 0 0; animation-name: ap-welcome-sheet; }
  .ap-welcome-grip { display: block; position: absolute; left: 50%; top: 8px; width: 40px; height: 4px; margin-left: -20px; border-radius: 2px; background: var(--hairline); z-index: 1; }
  .ap-welcome-art { flex: 0 0 auto; height: 172px; padding: 18px; }
  .ap-welcome-art .ap-art { height: 140px; width: auto; }
  .ap-welcome-text { padding: 16px 20px calc(24px + env(safe-area-inset-bottom)); gap: 12px; }
  .ap-welcome-title { font-size: 32px; line-height: 34px; }
  .ap-welcome-promises small { display: none; }
  .ap-welcome-promises li { align-items: center; }
  .ap-welcome-actions .ap-btn { flex: 1 1 100%; justify-content: center; }
  .ap-welcome.is-leaving .ap-welcome-card { animation: ap-welcome-sheet-out 320ms ease-in both; }
}
@keyframes ap-welcome-sheet { 0% { transform: translateY(60px); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes ap-welcome-sheet-out { to { transform: translateY(100%); } }
@media (prefers-reduced-motion: reduce) {
  .ap-art *, .ap-welcome-card, .ap-welcome-text > *, .ap-welcome-promises li, .ap-welcome-scrim { animation: none !important; }
  .ap-art-flow { stroke-dashoffset: 0; }
  .ap-art-light { display: none; }
  .ap-welcome.is-leaving { opacity: 0; transition: opacity 120ms; }
}
