/* lb-protocol playground. Vanilla CSS, no framework. Ported from the approved mockup (spec 001, T-000). */

:root {
  --bg: #0e1116;
  --panel: #161b22;
  --panel-raw: #12151b;
  --ink: #e6edf3;
  --ink-dim: #8b949e;
  --line: #232a33;
  --accent-pass: #2ea043;
  --accent-corrected: #d29922;
  --accent-blocked: #f85149;
  --accent-shaped: #58a6ff;
  --accent: var(--accent-corrected);
  --radius: 14px;
  --gap: 16px;
  --tap: 44px;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f8fa; --panel: #ffffff; --panel-raw: #f0f2f5;
    --ink: #1f2328; --ink-dim: #656d76; --line: #d8dee4;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  min-height: 100vh; display: flex; flex-direction: column;
  max-width: 1320px; margin: 0 auto; padding: 0 16px 0;
}

/* topbar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 2px; border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 600; letter-spacing: 0.2px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent-pass); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-pass) 22%, transparent); }
.mode { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-dim); }
.mode select {
  background: var(--panel); color: var(--ink); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 10px; min-height: var(--tap); font-size: 13px;
}

/* connected badge — the demo runs connected mode (governance server-side) */
.mode-badge {
  font-size: 12px; text-transform: lowercase; letter-spacing: 0.5px;
  color: var(--accent-pass); border: 1px solid color-mix(in srgb, var(--accent-pass) 35%, var(--line));
  background: color-mix(in srgb, var(--accent-pass) 10%, transparent);
  border-radius: 999px; padding: 4px 12px; font-weight: 600;
}

/* full-screen login — gates the whole interface before anything renders */
.login-overlay {
  position: fixed; inset: 0; z-index: 100; background: var(--bg);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.login-card {
  width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 12px;
  padding: 28px 26px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); box-shadow: 0 20px 60px -30px rgba(0,0,0,0.6);
}
.login-brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 17px; }
.login-sub { margin: 0 0 4px; color: var(--ink-dim); font-size: 14px; }
.login-card input {
  min-height: var(--tap); padding: 0 14px; font-size: 15px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink);
}
.login-card input:focus { outline: 2px solid var(--accent-corrected); outline-offset: 1px; }
.login-card button {
  min-height: var(--tap); border-radius: 10px; border: none; cursor: pointer;
  background: var(--ink); color: var(--bg); font-weight: 600; font-size: 15px; margin-top: 2px;
}
.gate-msg { font-size: 13px; color: var(--accent-blocked); min-height: 16px; }

/* rendered markdown inside the answer cards */
.answer > :first-child { margin-top: 0; }
.answer > :last-child { margin-bottom: 0; }
.answer p { margin: 0 0 10px; }
.answer h1, .answer h2, .answer h3, .answer h4 { font-weight: 700; line-height: 1.3; margin: 16px 0 6px; }
.answer h1 { font-size: 19px; }
.answer h2 { font-size: 17px; }
.answer h3, .answer h4 { font-size: 15px; }
.answer ul, .answer ol { margin: 6px 0 10px; padding-left: 22px; }
.answer li { margin: 3px 0; line-height: 1.5; }
.answer strong { font-weight: 700; }
.answer em { font-style: italic; }
.answer code {
  font-family: ui-monospace, SFMono-Regular, monospace; font-size: 0.88em;
  background: color-mix(in srgb, var(--ink) 9%, transparent); padding: 1px 5px; border-radius: 5px;
}

/* a quiet honest note when connected mode is chosen on the local app (M1) */
.mode-note {
  margin: 8px 0 0; padding: 8px 12px; border: 1px dashed var(--line); border-radius: 8px;
  font-size: 12px; color: var(--ink-dim); line-height: 1.5;
}

/* care frame */
.careframe {
  margin: 12px 0 4px; padding: 10px 14px; border: 1px solid var(--line);
  border-left: 3px solid var(--accent-blocked); border-radius: 10px;
  background: color-mix(in srgb, var(--accent-blocked) 7%, var(--panel));
  font-size: 13px; line-height: 1.5; color: var(--ink);
}
.careframe p { margin: 0; }

/* stage */
.stage { flex: 1; display: flex; flex-direction: column; justify-content: flex-start; padding: 20px 0; }

/* empty */
.empty { text-align: center; padding: 30px 10px; color: var(--ink-dim); margin: auto 0; }
.empty h1 { color: var(--ink); font-size: 26px; margin: 0 0 10px; }
.empty p { max-width: 460px; margin: 0 auto; line-height: 1.6; }

/* band: three cards — Nova, SoulOS, bare Claude */
.band { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--gap); align-items: start; }
.card {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 18px 16px; background: var(--panel);
}
/* the bare column is the baseline — recessed. SoulOS is the hero — lifted. */
.card-bare { background: var(--panel-raw); opacity: 0.82; filter: saturate(0.85); }
.card-soulos { box-shadow: 0 1px 0 var(--line), 0 8px 30px -18px color-mix(in srgb, var(--accent) 60%, transparent); }
.card-head { margin-bottom: 10px; }
.card-tag { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--ink-dim); }

/* conversation: a growing thread of turns, each a user message + two cards */
.convo { width: 100%; }
.turns { display: flex; flex-direction: column; gap: 24px; padding: 6px 0; }
.turn { display: flex; flex-direction: column; gap: 12px; }
.user-msg {
  align-self: flex-end; max-width: 82%; padding: 10px 14px;
  border-radius: 14px 14px 4px 14px; background: var(--ink); color: var(--bg);
  font-size: 15px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere;
}
.turn-cards { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--gap); align-items: start; }
.answer.pending { color: var(--ink-dim); font-style: italic; }
.answer.err { color: var(--accent-blocked); }
.reset {
  min-height: var(--tap); min-width: 56px; padding: 0 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink-dim);
  cursor: pointer; font-size: 13px;
}
.reset:hover { color: var(--ink); }
.answer { font-size: 17px; line-height: 1.6; margin: 0 0 14px; }

/* the verdict word is the only accent in the room */
.verdict { margin: 6px 0 0; }
.verdict-word { font-size: 13px; font-weight: 700; letter-spacing: 0.6px; text-transform: lowercase; }
.verdict-word[data-v="passed"] { color: var(--accent-pass); }
.verdict-word[data-v="shaped"] { color: var(--accent-shaped); }
.verdict-word[data-v="corrected"] { color: var(--accent-corrected); }
.verdict-word[data-v="blocked"] { color: var(--accent-blocked); }
.nochange, .miss { font-size: 13px; color: var(--ink-dim); margin: 8px 0 0; line-height: 1.5; }
.miss { color: var(--accent-blocked); }

/* resources rise into the protected card */
.resources {
  margin: 4px 0 10px; padding: 12px 14px; border-radius: 10px;
  background: color-mix(in srgb, var(--accent-corrected) 10%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--accent-corrected) 30%, var(--line));
  animation: rise 500ms ease both;
}
.resources-title { margin: 0 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--accent-corrected); }
.resources ul { margin: 0 0 8px; padding-left: 18px; font-size: 14px; line-height: 1.7; }
.handoff { margin: 0; font-size: 12px; color: var(--ink-dim); line-height: 1.5; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* flags as quiet chips */
.flags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chip {
  font-size: 11px; padding: 3px 8px; border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 8%, transparent);
  border: 1px solid var(--line); color: var(--ink-dim); font-family: ui-monospace, monospace;
}

/* latency + protocols whisper in mono */
.foot { margin-top: 12px; font-family: ui-monospace, SFMono-Regular, monospace; font-size: 11px; color: var(--ink-dim); }

/* loading skeleton that breathes */
.skel { background: color-mix(in srgb, var(--ink) 10%, transparent); border-radius: 6px; animation: pulse 1.3s ease-in-out infinite; }
.skel-tag { width: 70px; height: 11px; margin-bottom: 14px; }
.skel-line { height: 14px; margin-bottom: 10px; }
.skel-line.short { width: 55%; }
@keyframes pulse { 0%,100% { opacity: 0.45; } 50% { opacity: 0.9; } }

/* error */
.errorbox { text-align: center; padding: 24px; color: var(--accent-blocked); }
.retry { margin-top: 12px; min-height: var(--tap); padding: 0 18px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; }

/* examples */
.examples { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 0; }
.ex {
  min-height: 38px; padding: 0 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink); font-size: 13px;
}
.ex:hover { border-color: color-mix(in srgb, var(--ink) 30%, var(--line)); }
.ex-sample { display: inline-flex; align-items: center; gap: 6px; }
.sample-tag { font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--ink-dim); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; }

/* composer docked at bottom */
.composer { display: flex; gap: 8px; padding: 10px 0 18px; position: sticky; bottom: 0; background: linear-gradient(to top, var(--bg) 70%, transparent); }
.composer textarea {
  flex: 1; resize: none; min-height: var(--tap); padding: 11px 14px; font-size: 15px; line-height: 1.4;
  border-radius: 12px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font-family: inherit;
}
.composer textarea:focus, .ex:focus-visible, .retry:focus-visible, .mode select:focus-visible, #send:focus-visible {
  outline: 2px solid var(--accent-corrected); outline-offset: 2px;
}
#send { min-height: var(--tap); min-width: 64px; padding: 0 18px; border-radius: 12px; border: none; background: var(--ink); color: var(--bg); font-weight: 600; cursor: pointer; }
#send:disabled { opacity: 0.5; cursor: default; }

/* tablet: two up, so three columns never get cramped */
@media (max-width: 960px) and (min-width: 641px) {
  .band, .turn-cards { grid-template-columns: 1fr 1fr; }
}
/* mobile: stack the columns */
@media (max-width: 640px) {
  .band, .turn-cards { grid-template-columns: 1fr; }
  .empty h1 { font-size: 22px; }
  .answer { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .skel, .resources { animation: none; }
}
