/* Agent Second Brain v2.1 — design system copied from meu2cerebro decode
 * (styles.css intel sweep 2026-09-24). Fonts: Newsreader/Hanken Grotesk/JetBrains Mono.
 * Neutrals + typography: exact. Accent: lilac derivates (#9F8AC4/#C2B5D9 over #502B93).
 * Perf doctrine: NO backdrop-filter over live video (their comment, line 125 of original). */
:root {
  color-scheme: dark;
  --background: hsl(0 0% 4%);
  --card: hsl(0 0% 7%);
  --foreground: hsl(0 0% 93%);
  --muted-foreground: hsl(0 0% 55%);
  --border: hsl(0 0% 14%);
  --brand: #502B93;
  --primary: #9F8AC4;
  --primary-light: #C2B5D9;
  --primary-foreground: hsl(0 0% 96%);
  --paper: #FAF8F3;
  --hairline: rgb(159 138 196 / 0.18);
  --hairline-strong: rgb(159 138 196 / 0.5);
  --destructive: hsl(356 72% 58%);
  --font-serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --font-sans: 'Hanken Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace;
  /* legacy vars our JS still writes */
  --bg: var(--background);
  --panel: hsl(0 0% 7% / 0.88);
  --accent: var(--primary);
  --accent-soft: var(--primary-light);
  --ink: var(--foreground);
  --muted: var(--muted-foreground);
  --camera-filter: saturate(112%) contrast(108%) brightness(0.82);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  width: 100%; height: 100%; overflow: hidden;
  background: var(--background); color: var(--foreground);
  font-family: var(--font-sans); letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  touch-action: none; overscroll-behavior: none; user-select: none;
}
.serif { font-family: var(--font-serif); font-weight: 400; }

/* L0 camera: exact reference treatment */
#cam {
  position: fixed; inset: 0; width: 100%; height: 100%;
  object-fit: cover; transform: scaleX(-1);
  opacity: 0; filter: var(--camera-filter);
  z-index: 0; transition: opacity .5s;
}
body.camera-on #cam { opacity: 0.72; }

/* functional vignette so the graph reads over any video (not decorative) */
.camera-tint {
  position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: 0;
  background:
    radial-gradient(circle at 52% 42%, transparent 0 28%, rgba(10,10,10,0.58) 78%),
    linear-gradient(180deg, rgba(10,10,10,0.42), rgba(10,10,10,0.18) 42%, rgba(10,10,10,0.62));
  transition: opacity .5s;
}
body.camera-on .camera-tint { opacity: 1; }

/* L1 graph — screen blend over video */
#stage { position: fixed; inset: 0; z-index: 2; mix-blend-mode: screen; }
#stage canvas { display: block; background: transparent !important; }

/* L2 hands */
#overlay { position: fixed; inset: 0; pointer-events: none; z-index: 3; opacity: 0.86;
  width: 100vw; height: 100vh; }

/* shared panel: hairline border, 6px radius, NO blur (perf over video) */
.panel-card {
  border: 1px solid var(--hairline-strong);
  border-radius: 6px;
  background: hsl(0 0% 7% / 0.88);
}

/* eyebrow (mono, tracked, uppercase) — the reference's signature detail */
.eyebrow {
  margin: 0; font-family: var(--font-mono); font-size: 10px; font-weight: 500;
  letter-spacing: 0.22em; text-transform: uppercase; color: var(--primary);
}

/* top bar */
#hud {
  position: fixed; top: 0; left: 0; right: 0; z-index: 6;
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 14px 18px; pointer-events: none;
}
#brand { display: flex; gap: 10px; align-items: center; pointer-events: auto;
  padding: 9px 14px; }
#brand .dot { width: 8px; height: 8px; border-radius: 50%; background: #4ADE80;
  box-shadow: 0 0 10px #4ADE80; }
#brand h1 { font-family: var(--font-serif); font-weight: 400; font-size: 17px; }
#brand p { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--muted-foreground); margin-top: 2px; }
#hud-right { display: flex; gap: 8px; pointer-events: auto; flex-wrap: wrap; justify-content: flex-end; }

/* buttons: pill, mono eyebrow style */
button.pill, .pill {
  background: hsl(0 0% 4% / 0.5); color: var(--foreground);
  border: 1px solid hsl(0 0% 93% / 0.2);
  padding: 8px 14px; border-radius: 999px;
  font-family: var(--font-mono); font-size: 10px; font-weight: 500;
  letter-spacing: 0.14em; text-transform: uppercase; cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
button.pill:hover { border-color: #fff; }
button.pill.primary { background: var(--brand); border-color: var(--primary); }
button.pill.primary:hover { background: #623AAE; }
button.pill.active { background: var(--primary); color: var(--primary-foreground); border-color: var(--primary-light); }
button.pill.sm { padding: 6px 10px; font-size: 10px; }
button.ghost, button.link {
  min-height: 0; padding: 4px 0; border: 0; background: none;
  font-family: var(--font-serif); font-style: italic; font-size: 0.95rem;
  letter-spacing: 0; text-transform: none; color: var(--muted-foreground); cursor: pointer;
}
button.link:hover { color: var(--primary-light); }

/* coach panel: exact reference geometry — right, vertically centered, 380px */
#coach {
  position: fixed; right: 22px; top: 50%; transform: translateY(-50%);
  width: 380px; padding: 18px 20px 16px; z-index: 8;
}
#coach.hidden { display: none; }
#handPreview { width: 100%; aspect-ratio: 4/3; background: var(--background);
  border-radius: 4px; overflow: hidden; margin-bottom: 12px; }
#handCanvas { width: 100%; height: 100%; display: block; }
#coach .eyebrow { font-size: 13px; }
#coach h2 { margin: 8px 0 0; font-family: var(--font-serif); font-weight: 400;
  font-size: 2.1rem; line-height: 1.08; }
#coach p.coach-text-p { margin: 10px 0 0; color: hsl(0 0% 93% / 0.9);
  font-size: 1.22rem; line-height: 1.42; }
#coach .coach-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px;
  justify-content: space-between; align-items: center; }
#coach .coach-actions button { min-height: 44px; padding: 10px 16px; font-size: 13px; }
#coach.done { border-color: var(--primary-light); }
#coach.done h2 { color: var(--primary-light); }

/* node card: bottom-left, serif headline (their exact placement) */
#card {
  position: fixed; left: clamp(16px, 3vw, 40px); bottom: clamp(56px, 9vh, 96px);
  width: min(400px, calc(100% - 32px)); padding: 16px 18px 18px; z-index: 6;
  opacity: 0; transform: translateY(8px);
  transition: opacity 240ms ease-out, transform 240ms ease-out; pointer-events: none;
}
#card.visible { opacity: 1; transform: none; pointer-events: auto; }
#card.hidden { display: none; }
#card h3 { margin: 8px 0 0; font-family: var(--font-serif); font-weight: 400;
  font-size: clamp(1.35rem, 2.4vw, 1.9rem); line-height: 1.08; }
#card .meta { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--muted-foreground); margin-top: 6px; }
#card .excerpt { margin-top: 10px; color: hsl(0 0% 93% / 0.78); font-size: 0.95rem; line-height: 1.46; }
#card .derived { margin-top: 10px; font-family: var(--font-mono); font-size: 10px;
  color: var(--muted-foreground); border-top: 1px solid var(--hairline); padding-top: 8px; }
#card .ok { color: #4ADE80; } #card .fail { color: var(--destructive); }

/* legend: mono mini panel, left top under brand */
#legend { position: fixed; left: 18px; top: 86px; width: 220px; padding: 12px 14px;
  z-index: 6; font-size: 12px; }
#legend .eyebrow { font-size: 10px; }
#legendAgents { display: flex; flex-wrap: wrap; gap: 4px 10px; margin: 8px 0; }
#legendAgents span { display: inline-flex; align-items: center; gap: 5px; cursor: pointer;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; }
#legendAgents i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
#legend .note { color: var(--muted-foreground); font-size: 11px; line-height: 1.4; }

/* rec dock: their exact FAB morph (circle → rounded square while recording) */
#dock {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 14px; z-index: 7;
}
#btnRecord.rec-fab {
  width: 66px; height: 66px; min-height: 0; padding: 0; display: grid; place-items: center;
  border: 2px solid hsl(0 0% 93% / 0.92); border-radius: 50%;
  background: hsl(0 0% 4% / 0.5);
}
#btnRecord.rec-fab:hover { border-color: #fff; }
.rec-dot {
  width: 46px; height: 46px; border-radius: 50%; background: var(--destructive);
  transition: width 150ms ease-out, height 150ms ease-out, border-radius 150ms ease-out;
}
#btnRecord.recording .rec-dot { width: 24px; height: 24px; border-radius: 4px; }
#recLabel.rec-badge {
  min-width: 74px; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.14em;
  text-transform: uppercase; text-align: center; color: hsl(0 0% 93% / 0.9);
  text-shadow: 0 1px 8px rgba(0,0,0,0.8);
}
#recLabel.recording { color: var(--destructive); }

/* toast */
#toast {
  position: fixed; left: 50%; top: 76px; transform: translateX(-50%);
  padding: 8px 16px; z-index: 30;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  transition: opacity .3s;
}
#toast.hidden { display: none; }

/* intro (landing) — reference layout: headline, two cards, privacy, mood picker */
#intro {
  position: fixed; inset: 0; z-index: 40; display: grid; place-items: center;
  background: hsl(0 0% 4% / 0.92); padding: 20px; overflow-y: auto;
}
#intro.hidden { display: none; }
.intro-inner { max-width: 760px; width: 100%; text-align: center; padding: 20px 0 40px; }
.intro-headline { font-family: var(--font-serif); font-weight: 300;
  font-size: clamp(2rem, 4.6vw, 3.4rem); line-height: 1.06; margin: 0; }
.intro-sub { color: hsl(0 0% 93% / 0.78); font-size: 1.08rem; line-height: 1.45; margin: 14px auto 0; max-width: 560px; }
.intro-cards { display: flex; gap: 14px; margin-top: 28px; }
.intro-card {
  flex: 1; display: grid; gap: 8px; text-align: left; padding: 18px 20px;
  border: 1px solid var(--border); border-radius: 6px; background: var(--card);
  cursor: pointer; transition: border-color .15s ease-out, transform .15s ease-out;
  font-family: var(--font-sans); color: var(--foreground);
}
.intro-card:hover { border-color: var(--primary-light); transform: translateY(-2px); }
.intro-card.primary-card { background: var(--brand); border-color: var(--primary); }
.intro-card.primary-card:hover { border-color: var(--primary-light); }
.card-eyebrow { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--primary-light); }
.primary-card .card-eyebrow { color: var(--primary-light); }
.card-title { font-family: var(--font-serif); font-weight: 400; font-size: 1.5rem; line-height: 1.1; }
.card-desc { font-size: 0.92rem; line-height: 1.4; color: hsl(0 0% 93% / 0.72); }
.intro-privacy { font-size: 0.85rem; line-height: 1.5; color: var(--muted-foreground); margin: 22px auto 0; max-width: 600px; }
.intro-moods { margin-top: 26px; }
.mood-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 10px; }
.mood {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border: 1px solid var(--border); border-radius: 999px;
  background: hsl(0 0% 4% / 0.6); color: var(--foreground); cursor: pointer;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
  transition: border-color .15s ease-out;
}
.mood:hover { border-color: #fff; }
.mood.sel { border-color: var(--primary-light); color: var(--primary-light); }
.mood i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
#tutorial {
  position: fixed; inset: 0; z-index: 41; display: grid; place-items: center;
  background: hsl(0 0% 4% / 0.92); padding: 20px;
}
#tutorial.hidden { display: none; }
#tutorialCard { padding: 36px 40px; max-width: 480px; text-align: center; }
#tutorialStep { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--primary); }
#tutorialCard h2 { margin: 8px 0 0; font-family: var(--font-serif); font-weight: 400; font-size: 2rem; line-height: 1.08; }
#tutorialCard p { margin: 10px 0 0; color: hsl(0 0% 93% / 0.9); font-size: 1.1rem; line-height: 1.42; }
#tutorialHint { margin-top: 12px; font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted-foreground); }
#tutorialCard > div:last-child { margin-top: 18px; display: flex; gap: 12px; justify-content: center; }

/* countdown (serif, huge — reference detail) */
#countdown {
  position: fixed; inset: 0; z-index: 9; display: none; place-items: center;
  font-family: var(--font-serif); font-weight: 300;
  font-size: clamp(7rem, 26vh, 15rem); color: #fff;
  text-shadow: 0 4px 40px rgba(0,0,0,0.7); pointer-events: none;
}
#countdown.on { display: grid; }

/* 9:16 vertical stage (reference geometry) */
body.vertical .stage {
  width: min(100vw, calc(100dvh * 9 / 16));
  left: 50%; margin-left: calc(min(100vw, 100dvh * 9 / 16) / -2);
  outline: 1px solid var(--hairline);
}
body.vertical #dock {
  left: calc(50% + min(50vw, 100dvh * 9 / 32) + 28px);
  bottom: 50%; transform: translateY(50%); flex-direction: column;
}
body.vertical #coach { right: auto; left: calc(50% - min(50vw, 100dvh * 9 / 32) - 400px); }

/* clean screen */
body.clean #hud, body.clean #legend, body.clean #card, body.clean #coach,
body.clean #dock, body.clean #toast { display: none !important; }

@media (max-width: 720px) {
  #legend { display: none; }
  #coach { width: calc(100vw - 44px); right: 22px; }
}

/* audience=customer: hide marketing-only dock controls */
.hidden { display: none !important; }
