/* ============================================================================
   Circle Orb — ONE shared stylesheet for every surface (the reader + the app).
   Ported from the reader's beloved orb (its glass-pin look is the source of
   truth) and made class-based + self-contained so any page can mount one via
   orb.js `mountCircleOrb()`. No dependency on host CSS vars; multiple mounts
   are safe (no IDs). Keep this + orb.js in lockstep — they ARE the orb now.
   ============================================================================ */

/* Self-contained palette (children inherit these custom props from each root). */
.co-orb, .co-stage, .co-sheet {
  --co-ink: #414D57;      /* Sambas ink */
  --co-oats: #FEF6E4;     /* paper */
  --co-ct: #F1DD01;       /* Happy — Circle Time LIVE + someone present (the beacon) */
  --co-bus: #ECAF21;      /* School Bus — the door's open, nobody here yet */
  --co-coral: #F75458;    /* Colorado — open issue / attention */
  --co-lazuli: #2496C9;   /* info / focus */
  --co-grass: #1CAB5B;    /* brand / makers */
  --co-grass-deep: #147a3f;/* deep grass for the Join button (AA with oats text) */
  --co-sh-sm: 3px 3px 0 var(--co-ink);
  --co-ui: "DM Mono", ui-monospace, "Courier New", monospace;
  --co-fd: "Bitter", Georgia, serif;
  --co-mg: "Patrick Hand", "Comic Sans MS", cursive;
  --co-body: "Bitter", Georgia, serif;
}

/* ── the glass-domed pilot lamp ─────────────────────────────────────────── */
.co-orb {
  position: relative; display: inline-grid; place-items: center; width: 46px; height: 46px; padding: 0;
  border-radius: 50%; border: 2px solid var(--co-ink); background: var(--co-oats);
  box-shadow: var(--co-sh-sm); cursor: pointer; overflow: visible; box-sizing: border-box;
  -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; touch-action: manipulation;
  transition: transform .14s ease, box-shadow .09s ease;
}
.co-cap { position: absolute; inset: 2px; border-radius: 50%; z-index: 2; pointer-events: none;
  background: radial-gradient(circle at 50% 28%, rgba(255,255,255,.55), rgba(255,255,255,.06) 52%, transparent 72%); }
.co-bloom { position: absolute; inset: 3px; border-radius: 50%; z-index: 1; pointer-events: none; opacity: 0; transition: opacity .4s, background .4s; }
.co-orb.co-on .co-bloom { opacity: 1; }
.co-ring { position: absolute; inset: calc(-3px - (var(--lvl,1) - 1)*1.5px); border-radius: 50%; z-index: 0; pointer-events: none; display: none;
  -webkit-mask: radial-gradient(circle, transparent 0 62%, #000 66% 100%); mask: radial-gradient(circle, transparent 0 62%, #000 66% 100%); }
.co-orb.co-on .co-ring { display: block; }
.co-spec { position: absolute; top: 9px; left: 12px; width: 7px; height: 5px; border-radius: 50%; background: rgba(255,255,255,.7); z-index: 3; transform: rotate(-22deg); pointer-events: none; }
.co-glyph { width: 22px; height: 22px; position: relative; z-index: 2; display: block; overflow: visible; }
.co-glyph circle { fill: none; stroke: rgba(65,77,87,.5); stroke-width: 2.6; stroke-linecap: round; transition: stroke .14s ease; }
.co-orb.co-on .co-glyph circle { stroke: var(--co-ink); }
.co-orb.co-on { box-shadow: var(--co-sh-sm), 0 0 calc(8px + (var(--lvl,1) - 1)*8px) calc((var(--lvl,1) - 1)*1px) var(--halo, transparent); }
.co-orb:hover { transform: translate(-1px,-1px); box-shadow: 4px 5px 0 var(--co-ink); }
.co-orb:active { transform: translate(2px,2px); box-shadow: 0 0 0 var(--co-ink); }
.co-orb:focus-visible { outline: 3px solid var(--co-lazuli); outline-offset: 2px; }

/* LIVE — the lamp warms with a slow amber breath + the glyph goes squigglevision */
.co-orb.co-live { animation: co-breath 4s ease-in-out infinite; }
@keyframes co-breath {
  0%,100% { box-shadow: var(--co-sh-sm), 0 0 calc(9px + (var(--lvl,1) - 1)*8px) 1px rgba(241,221,1, calc(.30 + (var(--lvl,1) - 1)*.07)); }
  50%     { box-shadow: var(--co-sh-sm), 0 0 calc(17px + (var(--lvl,1) - 1)*10px) 5px rgba(241,221,1, calc(.46 + (var(--lvl,1) - 1)*.08)); }
}
.co-orb.co-live .co-glyph circle { animation: co-squiggle 1.7s ease-in-out infinite; }
@keyframes co-squiggle { 0%,100% { filter: url(#rough); } 33% { filter: url(#rough2); } 66% { filter: url(#rough3); } }
/* "came alive" one-shot bloom when a belled circle newly lights */
.co-orb.co-alive { animation: co-alive 1.2s cubic-bezier(.2,.8,.3,1) 1; }
@keyframes co-alive {
  0%   { box-shadow: var(--co-sh-sm), 0 0 8px 1px rgba(241,221,1,.30); transform: scale(1); }
  22%  { box-shadow: var(--co-sh-sm), 8px 8px 0 var(--co-ct), 0 0 16px 4px rgba(241,221,1,.5); transform: scale(1.14); }
  100% { box-shadow: var(--co-sh-sm), 0 0 12px 3px rgba(241,221,1,.42); transform: scale(1); }
}
.co-orb.co-firing { opacity: .5; transition: opacity .12s ease; }
@media (prefers-reduced-motion: reduce) {
  .co-orb.co-live { animation: none; box-shadow: var(--co-sh-sm), 0 0 15px 3px rgba(241,221,1,.5); }
  .co-orb.co-live .co-glyph circle { animation: none; }
  .co-orb.co-alive { animation: none; box-shadow: var(--co-sh-sm), 6px 6px 0 var(--co-ct), 0 0 14px 4px rgba(241,221,1,.5); }
}

/* name + count caption — a small Happy chip ABOVE the pin, only when live */
.co-lbl { position: absolute; left: 50%; bottom: calc(100% + 7px); transform: translateX(-50%) rotate(-1.5deg);
  display: none; align-items: baseline; gap: 4px; white-space: nowrap; font-family: var(--co-ui); color: var(--co-ink);
  background: var(--co-ct); border: 1.6px solid var(--co-ink); border-radius: 6px; padding: 2px 7px; box-shadow: 2px 2px 0 var(--co-ink);
  max-width: 46vw; pointer-events: none; z-index: 4; }
.co-name { font-weight: 600; font-size: .62rem; letter-spacing: .05em; text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; }
.co-cnt { font-weight: 600; font-size: .58rem; opacity: .8; }
.co-orb.co-live .co-lbl { display: inline-flex; }

/* unread notifications pip — a flat coral scrap chip (no blur/gradient; DESIGN.md) */
.co-pip { position: absolute; top: -5px; right: -5px; z-index: 4; min-width: 16px; height: 16px; padding: 0 3px; display: none;
  place-items: center; box-sizing: border-box; font-family: var(--co-ui); font-weight: 600; font-size: .58rem; line-height: 1;
  color: var(--co-ink); background: var(--co-coral); border: 1.5px solid var(--co-ink); border-radius: 999px; box-shadow: 1px 1px 0 var(--co-ink); }
.co-orb.co-haspip .co-pip { display: grid; }

/* ── the comet stage: full-bleed Circle-Time takeover (fills the page, never a dark modal) ── */
.co-stage { position: fixed; inset: 0; z-index: 1200; display: none; }
.co-stage.co-stg-on { display: block; }
.co-stage::before { content: ""; position: absolute; inset: 0; opacity: 0; transition: opacity .3s ease; background: var(--co-oats);
  background-image: radial-gradient(circle at 18% 12%, rgba(36,150,201,.05), transparent 42%), repeating-linear-gradient(0deg, transparent 0 30px, rgba(65,77,87,.045) 30px 31px); }
.co-stage.co-veil::before { opacity: 1; }
.co-comet { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; display: grid; place-items: center; pointer-events: none;
  border-radius: 50%; background: var(--co-ct); border: 2.4px solid var(--co-ink); box-shadow: 0 0 22px 6px rgba(241,221,1,.75); z-index: 2;
  opacity: 0; will-change: transform; transform: translate(calc(-50% + var(--sx,0px)), calc(-50% + var(--sy,0px))) scale(.7); }
.co-comet svg { width: 26px; height: 26px; }
.co-comet svg circle { fill: none; stroke: var(--co-ink); stroke-width: 2.6; stroke-linecap: round; filter: url(#rough); }
.co-stage.co-fly .co-comet { animation: co-cometfly var(--flyms,620ms) cubic-bezier(.42,-0.25,.3,1) forwards; }
.co-trail { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.co-mg { position: absolute; left: 0; top: 0; opacity: 0; will-change: transform, opacity; transform: translate(-50%,-50%); }
.co-mg svg { display: block; }
.co-stage.co-fly .co-mg { animation: co-mgfire 760ms ease-out forwards; }
@keyframes co-cometfly {
  0%   { opacity: 1; transform: translate(calc(-50% + var(--sx,0px)), calc(-50% + var(--sy,0px))) scale(.7) rotate(0); }
  62%  { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%,-50%) scale(2.4) rotate(130deg); }
}
@keyframes co-mgfire {
  0%   { opacity: 0; transform: translate(-50%,-50%) scale(.3) rotate(0); }
  18%  { opacity: 1; }
  64%  { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--mx,0px)), calc(-50% + var(--my,0px))) scale(var(--ms,1)) rotate(var(--mr,200deg)); }
}
@media (prefers-reduced-motion: reduce) {
  .co-stage.co-fly .co-comet, .co-stage.co-fly .co-mg { animation: none; }
  .co-comet { display: none; }
}

/* the bearings ticket that blooms where the comet lands (a pinned admission ticket) */
.co-card { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-46%) rotate(-1.2deg); width: min(360px, calc(100vw - 36px)); z-index: 3;
  opacity: 0; pointer-events: none; }
.co-card::before { content: ""; position: absolute; inset: 0; z-index: -1; transform: translate(6px,7px); background: var(--co-ink); border-radius: 8px; }
.co-stage.co-showcard .co-card { opacity: 1; pointer-events: auto; animation: co-cardbloom .42s cubic-bezier(.3,1.2,.5,1) both; }
@keyframes co-cardbloom { from { opacity: 0; transform: translate(-50%,-40%) scale(.82) rotate(-1.2deg); } to { opacity: 1; transform: translate(-50%,-46%) scale(1) rotate(-1.2deg); } }
@media (prefers-reduced-motion: reduce) { .co-stage.co-showcard .co-card { animation: none; } }
.co-cc { position: relative; text-align: left; background: var(--co-oats); color: var(--co-ink);
  border: 2.6px solid var(--co-ink); border-radius: 8px; padding: 24px 22px 22px;
  -webkit-mask: radial-gradient(9px at 0 56%, transparent 98%, #000) left/100% 100% no-repeat, radial-gradient(9px at 100% 56%, transparent 98%, #000) right/100% 100% no-repeat;
  -webkit-mask-composite: source-in; mask: radial-gradient(9px at 0 56%, transparent 98%, #000) left/100% 100% no-repeat, radial-gradient(9px at 100% 56%, transparent 98%, #000) right/100% 100% no-repeat; mask-composite: intersect; }
.co-cc-tape { position: absolute; top: -12px; left: 50%; transform: translateX(-50%) rotate(-2.5deg); width: 118px; height: 25px;
  background: rgba(36,150,201,.32); border-left: 1px dashed rgba(65,77,87,.4); border-right: 1px dashed rgba(65,77,87,.4); }
.co-cc-x { position: absolute; top: 9px; right: 10px; width: 31px; height: 31px; border-radius: 50%; border: 2.2px solid var(--co-ink);
  background: var(--co-oats); display: grid; place-items: center; cursor: pointer; font-family: var(--co-ui); font-size: 1rem; line-height: 1; color: var(--co-ink); box-shadow: 2px 2px 0 0 var(--co-ink); z-index: 2; }
.co-cc-x:active { transform: translate(2px,2px); box-shadow: 0 0 0 0 var(--co-ink); }
.co-cc-head { display: flex; align-items: center; gap: 11px; margin: 4px 0 12px; }
.co-cc-glyph { flex: 0 0 auto; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 50%;
  background: var(--co-ct); border: 2.6px solid var(--co-ink); box-shadow: 2px 2px 0 0 var(--co-ink), 0 0 18px 3px rgba(241,221,1,.55); transform: rotate(-6deg); }
.co-cc-glyph svg { width: 24px; height: 24px; }
.co-cc-glyph svg circle { fill: none; stroke: var(--co-ink); stroke-width: 2.6; stroke-linecap: round; }
.co-cc-eyebrow { display: inline-flex; align-items: center; gap: 7px; font-family: var(--co-ui); font-weight: 500; font-size: .6rem; letter-spacing: .12em; text-transform: uppercase; color: var(--co-ink); margin: 0; }
.co-cc-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--co-ct); border: 1.5px solid var(--co-ink); box-shadow: 0 0 8px 1px rgba(241,221,1,.85); }
.co-cc-name { font-family: var(--co-fd); font-weight: 700; font-size: 1.95rem; line-height: 1.02; letter-spacing: -.01em; margin: 0; color: var(--co-ink); }
.co-cc-blurb { font-family: var(--co-body); font-weight: 300; font-size: .9rem; line-height: 1.4; color: var(--co-ink); opacity: .82; margin: 9px 0 0; max-width: 34ch; }
.co-cc-perf { border: 0; border-top: 2px dashed rgba(65,77,87,.42); margin: 18px -22px; }
.co-cc-here { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 16px; }
.co-cc-faces { display: inline-flex; }
.co-cc-face { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--co-ink); margin-left: -9px; display: grid; place-items: center;
  font-family: var(--co-ui); font-size: .62rem; color: var(--co-oats); background: var(--co-ink); box-shadow: 1.5px 1.5px 0 rgba(65,77,87,.4); overflow: hidden; }
.co-cc-face:first-child { margin-left: 0; }
.co-cc-face img { width: 100%; height: 100%; object-fit: cover; }
.co-cc-cnt { font-family: var(--co-ui); font-size: .7rem; color: var(--co-ink); opacity: .8; }
.co-cc-join { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; font-family: var(--co-ui); font-weight: 600;
  font-size: .92rem; letter-spacing: .03em; text-transform: uppercase; color: var(--co-oats); background: var(--co-grass-deep);
  border: 2.4px solid var(--co-ink); border-radius: 8px; padding: 14px 18px; cursor: pointer; text-decoration: none; box-shadow: var(--co-sh-sm);
  transition: transform .1s ease, box-shadow .1s ease; }
.co-cc-join:hover { transform: translate(-1px,-1px); box-shadow: 6px 7px 0 0 var(--co-ink); }
.co-cc-join:active { transform: translate(3px,3px); box-shadow: 0 0 0 0 var(--co-ink); }
.co-cc-hint { display: block; text-align: center; font-family: var(--co-ui); font-size: .54rem; letter-spacing: .08em; text-transform: uppercase; opacity: .5; margin-top: 10px; }

/* ── the hub sheet — a folded-paper list of one-tap teleports ── */
.co-sheet { position: fixed; left: 50%; right: auto; top: auto; bottom: max(74px, calc(env(safe-area-inset-bottom) + 70px)); z-index: 1210;
  display: none; flex-direction: column; gap: 1px; width: 304px; max-width: calc(100vw - 24px); padding: 7px;
  background: var(--co-oats); border: 2.2px solid var(--co-ink); border-radius: 9px; box-shadow: 5px 6px 0 rgba(65,77,87,.9);
  transform: translateX(-50%) rotate(-1deg) translateY(8px); opacity: 0; transition: opacity .14s ease, transform .14s ease; max-height: 70vh; overflow-y: auto; }
.co-sheet.co-show { display: flex; opacity: 1; transform: translateX(-50%) rotate(-1deg) translateY(0); }
/* below 560px it becomes a full-width bottom sheet (no off-screen sliver) */
@media (max-width: 560px) {
  .co-sheet { left: 0; right: 0; bottom: 0; width: 100%; max-width: 100%; transform: translateY(100%); border-radius: 9px 9px 0 0; }
  .co-sheet.co-show { transform: translateY(0); }
}
.co-cs-group { font-family: var(--co-ui); font-weight: 600; font-size: .54rem; text-transform: uppercase; letter-spacing: .12em; color: rgba(65,77,87,.55); margin: 7px 8px 2px; }
.co-cs-line { display: flex; gap: 4px; align-items: stretch; }
.co-cs-row { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 9px; min-height: 46px; box-sizing: border-box; padding: 8px 10px;
  background: transparent; border: 0; border-radius: 6px; cursor: pointer; color: var(--co-ink); text-decoration: none; font-family: var(--co-ui); text-align: left; }
.co-cs-row:hover { background: rgba(65,77,87,.09); }
.co-cs-row:focus-visible { outline: 3px solid var(--co-lazuli); outline-offset: -2px; }
.co-cs-dot { flex: 0 0 auto; width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--co-ink); }
.co-cs-dot.live { background: var(--co-ct); box-shadow: 0 0 7px 1px rgba(241,221,1,.6); }
.co-cs-dot.door { background: var(--co-bus); } .co-cs-dot.makers { background: var(--co-grass); } .co-cs-dot.issue { background: var(--co-coral); } .co-cs-dot.note { background: var(--co-lazuli); }
.co-cs-tx { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.co-cs-ti { font-weight: 500; font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.co-cs-sub { font-size: .62rem; color: rgba(65,77,87,.6); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.co-cs-faces { display: inline-flex; flex: 0 0 auto; }
.co-cs-face { width: 19px; height: 19px; border-radius: 50%; border: 1.5px solid var(--co-oats); margin-left: -5px; display: grid; place-items: center; font-size: .5rem; color: var(--co-oats); background: var(--co-ink); box-shadow: 1px 1px 0 rgba(65,77,87,.4); overflow: hidden; }
.co-cs-face.g { background: var(--co-grass); } .co-cs-face:first-child { margin-left: 0; }
.co-cs-face img { width: 100%; height: 100%; object-fit: cover; }
.co-cs-verb { flex: 0 0 auto; align-self: center; font-family: var(--co-ui); font-weight: 600; font-size: .58rem; text-transform: uppercase; letter-spacing: .04em; color: var(--co-ink);
  text-decoration: none; border: 2px solid var(--co-ink); border-radius: 5px; padding: 6px 8px; box-shadow: 1.5px 1.5px 0 var(--co-ink); white-space: nowrap; cursor: pointer; }
.co-cs-verb.join { background: var(--co-ct); } .co-cs-verb.door { background: var(--co-bus); } .co-cs-verb.sit { background: var(--co-grass); color: var(--co-oats); } .co-cs-verb.open { background: var(--co-oats); } .co-cs-verb.pick { background: var(--co-bus); }
.co-cs-resume { display: flex; align-items: center; gap: 9px; margin: 2px 1px 6px; padding: 9px 11px; border-radius: 6px; text-decoration: none; color: var(--co-ink);
  background: repeating-linear-gradient(135deg, rgba(241,221,1,.13) 0 9px, rgba(241,221,1,.04) 9px 18px); border: 2px solid var(--co-ink); box-shadow: 2px 2px 0 var(--co-ink); }
.co-cs-rk { font-size: .5rem; text-transform: uppercase; letter-spacing: .1em; color: rgba(65,77,87,.6); }
.co-cs-resume .co-cs-ti { font-weight: 600; font-size: .82rem; }
.co-cs-empty { padding: 18px 14px; text-align: center; font-family: var(--co-body); font-size: .86rem; color: var(--co-ink); }
.co-cs-cut { height: 0; margin: 8px 6px 4px; border: 0; border-top: 2px dashed rgba(65,77,87,.45); }
.co-cs-na { margin-left: auto; flex: 0 0 auto; align-self: center; font-size: .5rem; text-transform: uppercase; letter-spacing: .08em; color: rgba(65,77,87,.55); white-space: nowrap; }
.co-cs-seeall { display: block; text-align: center; font-family: var(--co-ui); font-weight: 600; font-size: .58rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--co-ink); text-decoration: none; padding: 7px; margin: 2px 2px 1px; border-radius: 6px; }
.co-cs-seeall:hover { background: rgba(65,77,87,.08); }
