/* Hero demo: Kelvin's desktop window (dark theme), Home then a request in Chat.
   Tokens and shapes are Kelvin's own (src/labharness/web/static/app.css, home.css). Sizes are in em so the
   window scales with its container like a screenshot; below 880px it switches to a compact, chat-first layout. */

.kd-home {
  --k-bg: #0f151c; --k-sidebar: #0b1016; --k-panel: #141c25; --k-raised: #19232e;
  --k-text: #e6edf4; --k-text-2: #c2ccd6; --k-muted: #8d9aa8;
  --k-line: #24303c; --k-line-strong: #3b4a5a;
  --k-accent: #5aa2e6; --k-accent-ink: #08111a; --k-accent-soft: rgba(90, 162, 230, 0.16);
  --k-user: #1c2836; --k-code: #0b1016;
  --k-ok: #3fb950; --k-ok-soft: #14301f; --k-warn: #e3b341; --k-warn-bg: #2b2412; --k-warn-line: #8f6f1c; --k-danger: #ef5350;
  --k-card: #17212b; --k-card-line: #2e3b49; --k-page: #0b1016; --k-muted-soft: #1c2631;
  --k-scan: #4f95ea; --k-step: #e0a52c; --k-exp: #2fc28d; --k-wait: #8c99a8;
  --k-s1: #3987e5; --k-fit: #d6dee6; --k-grid: #222b35;
  --k-sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --k-display: Georgia, Cambria, "Times New Roman", serif;
  --k-mono: ui-monospace, "SFMono-Regular", Consolas, monospace;

  position: relative;
  container-type: inline-size;
  color: var(--k-text);
  text-align: left;
}
.kd-home [hidden] { display: none !important; }
.kd-home svg { flex: none; }

/* ---------- the window ---------- */

.kd-home-win {
  position: relative;
  display: flex; flex-direction: column;
  aspect-ratio: 16 / 10.2;
  font: 400 clamp(9.5px, 1.18cqw, 14px) / 1.45 var(--k-sans);
  background: var(--k-bg);
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 1em;
  overflow: hidden;
  box-shadow: 0 2.5em 7em rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(0, 0, 0, 0.6);
  -webkit-font-smoothing: antialiased;
}
.kd-home-osbar {
  flex: none; display: flex; align-items: center; gap: 0.6em;
  height: 2.3em; padding: 0 0.4em 0 0.85em;
  background: var(--k-sidebar); border-bottom: 1px solid var(--k-line);
  font-size: 0.9em; color: var(--k-muted);
}
.kd-home-osbar img { width: 1.3em; height: 1.3em; border-radius: 0.3em; }
.kd-home-osctl { margin-left: auto; display: flex; }
.kd-home-osctl span { width: 3.2em; height: 2.3em; display: grid; place-items: center; }
.kd-home-osctl svg { width: 0.95em; height: 0.95em; stroke: var(--k-muted); stroke-width: 1.4; fill: none; }

/* app top bar: menu, mark, title | Chat Home | pills */
.kd-home-top {
  flex: none; position: relative; display: flex; align-items: center; gap: 0.7em;
  height: 3.6em; padding: 0 0.9em;
  border-bottom: 1px solid var(--k-line); background: var(--k-bg);
}
.kd-home-ico { width: 1.3em; height: 1.3em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.kd-home-top > .kd-home-ico { color: var(--k-muted); }
.kd-home-topmark { width: 1.55em; height: 1.55em; border-radius: 0.4em; }
.kd-home-ctitle { display: flex; align-items: center; gap: 0.4em; min-width: 0; max-width: 19em; white-space: nowrap; }
.kd-home-ctitle .kd-home-ico { width: 1.1em; height: 1.1em; color: var(--k-accent); }
.kd-home-crumb-proj { color: var(--k-muted); font-weight: 500; }
.kd-home-crumb-sep { color: var(--k-line-strong); }
.kd-home-crumb-chat { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.kd-home-seg {
  position: absolute; left: 50%; transform: translateX(-50%);
  display: flex; padding: 0.22em; gap: 0.2em; border-radius: 999px; background: var(--k-sidebar); border: 1px solid var(--k-line);
}
.kd-home-seg button {
  border: 0; background: none; color: var(--k-muted); cursor: pointer;
  font: 500 1em/1 var(--k-sans); padding: 0.5em 1.15em; border-radius: 999px;
  transition: background 0.2s, color 0.2s;
}
.kd-home-seg button:hover { color: var(--k-text); }
.kd-home-seg button[aria-selected="true"] { background: var(--k-raised); color: var(--k-text); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4); }
.kd-home-seg button:focus-visible { outline: 2px solid var(--k-accent); outline-offset: 1px; }
/* the panel buttons: one grey track of icon buttons (Incognito, Terminal, Team chat, Analysis, Runs, Lab) */
.kd-home-track { margin-left: auto; display: flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--k-sidebar); border: 1px solid var(--k-line); }
.kd-home-tb { position: relative; width: 2.35em; height: 2.05em; display: grid; place-items: center; border-radius: 999px; color: var(--k-muted); transition: background 0.2s, color 0.2s; }
.kd-home-tb .kd-home-ico { width: 1.15em; height: 1.15em; }
.kd-home-tb.on { background: var(--k-accent-soft); color: var(--k-accent); }
.kd-home-tb .kd-home-live { position: absolute; top: 0.28em; right: 0.32em; }
.kd-home-live { width: 0.5em; height: 0.5em; border-radius: 50%; background: var(--k-ok); box-shadow: 0 0 0 0.2em rgba(63, 185, 80, 0.2); }

/* body: sidebar | main | lab panel */
.kd-home-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 15.5em minmax(0, 1fr) 18em; }

.kd-home-side {
  display: flex; flex-direction: column; gap: 0.15em; min-height: 0;
  padding: 0.8em 0.6em; background: var(--k-sidebar); border-right: 1px solid var(--k-line);
}
.kd-home-new {
  display: flex; align-items: center; gap: 0.5em; padding: 0.55em 0.7em; margin-bottom: 0.6em;
  border: 1px solid var(--k-line); border-radius: 0.6em; color: var(--k-text); font-weight: 500;
}
.kd-home-label { display: flex; align-items: center; justify-content: space-between; padding: 0.35em 0.7em 0.35em; font-size: 0.85em; font-weight: 600; color: var(--k-muted); }
.kd-home-label .kd-home-ico { width: 1.05em; height: 1.05em; }
.kd-home-proj { display: flex; align-items: center; gap: 0.45em; padding: 0.5em 0.6em 0.3em; color: var(--k-text); font-weight: 500; }
.kd-home-proj .kd-home-ico { width: 1em; height: 1em; color: var(--k-muted); }
.kd-home-proj .kd-home-ico + .kd-home-ico { color: var(--k-accent); }
.kd-home-proj span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kd-home-proj em { margin-left: auto; font-style: normal; font-size: 0.85em; color: var(--k-muted); }
.kd-home-conv {
  padding: 0.42em 0.7em 0.42em 2.35em; border-radius: 0.5em; color: var(--k-text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kd-home-conv.on { background: rgba(255, 255, 255, 0.07); color: var(--k-text); }
.kd-home-sidefoot { margin-top: auto; display: flex; align-items: center; gap: 0.55em; padding: 0.5em 0.7em; font-size: 0.93em; color: var(--k-text-2); }
.kd-home-dot { width: 0.6em; height: 0.6em; border-radius: 50%; background: var(--k-line-strong); flex: none; }
.kd-home-dot.ok { background: var(--k-ok); }
.kd-home-dot.warn { background: var(--k-warn); }

.kd-home-main { position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.kd-home-view { flex: 1; min-height: 0; display: flex; flex-direction: column; animation: kd-home-in 0.35s var(--ease, ease) both; }
@keyframes kd-home-in { from { opacity: 0; transform: translateY(0.4em); } to { opacity: 1; transform: none; } }

/* ---------- Home ---------- */

.kd-home-hv { background: var(--k-page); padding: 1.5em 1.6em; gap: 1.1em; overflow: hidden; }
.kd-home-hello { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0.2em 1.1em; }
.kd-home-greet { margin: 0; font: 400 2.05em/1.15 var(--k-display); color: var(--k-text); letter-spacing: -0.005em; }
.kd-home-state { display: flex; align-items: baseline; gap: 0.5em; color: var(--k-text-2); }
.kd-home-state .kd-home-dot { align-self: center; }
.kd-home-state.ok b { color: var(--k-text); font-weight: 500; }
.kd-home-labname { color: var(--k-muted); }

.kd-home-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1em; }
.kd-home-tile {
  display: flex; flex-direction: column; gap: 0.55em; min-width: 0; padding: 1em 1.15em;
  background: var(--k-card); border: 1px solid var(--k-card-line); border-radius: 1.05em;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.32), 0 14px 30px -18px rgba(0, 0, 0, 0.7);
  transition: border-color 0.3s;
}
.kd-home-tile.live { border-color: var(--k-accent); }
.kd-home-tilehead { display: flex; align-items: center; gap: 0.5em; }
.kd-home-tilehead b { font: 600 1.08em/1.3 var(--k-display); }
.kd-home-chip {
  margin-left: auto; padding: 0.12em 0.6em; border-radius: 999px; font-size: 0.82em; font-weight: 600;
  background: var(--k-muted-soft); color: var(--k-text-2); border: 1px solid var(--k-line-strong);
}
.kd-home-chip.blue { background: var(--k-accent-soft); color: var(--k-accent); border-color: transparent; }
.kd-home-chip.ok { background: var(--k-ok-soft); color: var(--k-ok); border-color: transparent; }
.kd-home-kpi { display: flex; align-items: baseline; gap: 0.45em; }
.kd-home-kpi b { font: 600 2.35em/1.05 var(--k-display); letter-spacing: -0.01em; }
.kd-home-kpi span { color: var(--k-muted); font-size: 0.93em; }
.kd-home-bar { height: 0.42em; border-radius: 999px; background: var(--k-muted-soft); overflow: hidden; }
.kd-home-bar i { display: block; height: 100%; width: 0; background: var(--k-accent); border-radius: inherit; transition: width 0.6s var(--ease, ease); }
.kd-home-line { display: flex; justify-content: space-between; gap: 0.6em; color: var(--k-text-2); font-size: 0.95em; }
.kd-home-line span:last-child { color: var(--k-muted); font-variant-numeric: tabular-nums; }
.kd-home-mini { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.35em; font-size: 0.95em; }
.kd-home-mini li { display: flex; align-items: center; gap: 0.55em; min-width: 0; }
.kd-home-mini li > span:first-of-type { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kd-home-mini .t { margin-left: auto; color: var(--k-muted); font-variant-numeric: tabular-nums; }
.kd-home-mini .v { margin-left: auto; color: var(--k-text); font-variant-numeric: tabular-nums; font-family: var(--k-mono); font-size: 0.95em; }
.kd-home-mini li.fresh { animation: kd-home-flash 1.6s ease-out both; border-radius: 0.4em; }
@keyframes kd-home-flash { from { background: var(--k-accent-soft); } to { background: transparent; } }
.kd-home-spark { width: 100%; height: 2.6em; }
.kd-home-spark path { fill: none; stroke: var(--k-accent); stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.kd-home-spark path.fill { fill: rgba(90, 162, 230, 0.12); stroke: none; }

.kd-home-blocks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.9em; align-content: start; }
.kd-home-block {
  position: relative; padding: 0.85em 1em 0.9em 1.2em; min-width: 0;
  background: var(--k-card); border: 1px solid var(--k-card-line); border-radius: 0.9em; overflow: hidden;
}
.kd-home-block::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 0.28em; background: var(--kind, var(--k-wait)); }
.kd-home-block.result { --kind: var(--k-exp); }
.kd-home-block.next { --kind: var(--k-scan); }
.kd-home-block.watch { --kind: var(--k-step); }
.kd-home-block.note { --kind: var(--k-wait); }
.kd-home-block.check { --kind: #9a85f0; grid-column: 1 / -1; }
.kd-home-checks { list-style: none; margin: 0.5em 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4em 1.3em; }
.kd-home-checks li { display: inline-flex; align-items: center; gap: 0.5em; color: var(--k-text-2); }
.kd-home-checks li::before {
  content: ""; flex: none; width: 1em; height: 1em; border-radius: 0.28em; border: 1.5px solid var(--k-line-strong);
  transition: background-color 0.3s, border-color 0.3s;
}
.kd-home-checks li.on { color: var(--k-text); }
.kd-home-checks li.on::before {
  border-color: var(--k-exp);
  background: var(--k-exp) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5' fill='none' stroke='%230b1016' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 78% no-repeat;
}
.kd-home-block small { display: flex; align-items: center; gap: 0.45em; color: var(--kind); font-size: 0.82em; font-weight: 600; }
.kd-home-block small em { margin-left: auto; font-style: normal; font-weight: 400; color: var(--k-muted); }
.kd-home-block p { margin: 0.35em 0 0; color: var(--k-text); line-height: 1.4; }
.kd-home-block.fresh { animation: kd-home-glow 2.4s ease-out both; }
.kd-home-blockact { margin-top: 0.65em; display: flex; }
.kd-home-btn.small { font-size: 0.86em; padding: 0.45em 0.85em; }
.kd-home-added { display: inline-flex; align-items: center; gap: 0.4em; color: var(--k-ok); font-size: 0.88em; font-weight: 600; animation: kd-home-in 0.35s ease both; }
.kd-home-added .kd-home-ico { width: 1.05em; height: 1.05em; }
.kd-home-tile.fresh { animation: kd-home-ring 2.6s ease-out both; }
@keyframes kd-home-ring { from { border-color: var(--k-accent); box-shadow: 0 0 0 0.3em rgba(90, 162, 230, 0.4); } to { box-shadow: 0 0 0 0.3em rgba(90, 162, 230, 0); } }
@keyframes kd-home-glow { from { box-shadow: 0 0 0 0.25em rgba(47, 194, 141, 0.35); } to { box-shadow: 0 0 0 0.25em rgba(47, 194, 141, 0); } }

/* ---------- Chat ---------- */

.kd-home-cv { background: var(--k-bg); }
.kd-home-scroll { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; }
.kd-home-thread { width: 100%; max-width: 46em; margin: 0 auto; padding: 0.8em 1.6em 0.4em; display: flex; flex-direction: column; gap: 1.05em; }
.kd-home-empty { margin: auto; text-align: center; display: grid; justify-items: center; gap: 1em; padding-bottom: 1.5em; }
.kd-home-empty img { width: 3.7em; height: 3.7em; border-radius: 1.15em; }
.kd-home-empty h3 { margin: 0; font: 600 2.05em/1.2 var(--k-display); color: var(--k-text); }
.kd-home-sugg { display: grid; grid-template-columns: repeat(2, minmax(0, 13.5em)); gap: 0.65em; margin-top: 0.4em; }
.kd-home-sugg span { padding: 0.85em 1em; text-align: left; font-weight: 600; color: var(--k-text); background: var(--k-card); border: 1px solid var(--k-card-line); border-radius: 0.85em; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35); }

.kd-home-user { align-self: flex-end; max-width: 82%; background: var(--k-user); border-radius: 1.3em; padding: 0.7em 1.15em; animation: kd-home-in 0.3s ease both; }
.kd-home-ai { display: grid; gap: 0.55em; animation: kd-home-in 0.35s ease both; }
.kd-home-ai-head { display: flex; align-items: center; gap: 0.5em; color: var(--k-muted); font-size: 0.88em; }
.kd-home-ai-head img { width: 1.75em; height: 1.75em; border-radius: 0.5em; }
.kd-home-ai-body { display: grid; gap: 0.7em; min-width: 0; }
.kd-home-ai-body p { margin: 0; }
.kd-home-ai-body b { font-weight: 600; color: var(--k-text); }
.kd-home-ai-body code, .kd-home code { font-family: var(--k-mono); font-size: 0.92em; background: var(--k-code); border: 1px solid var(--k-line); padding: 0.05em 0.35em; border-radius: 0.35em; color: var(--k-text-2); }
.kd-home-meta { color: var(--k-muted); font-size: 0.92em; display: flex; align-items: center; gap: 0.45em; }
.kd-home-meta .kd-home-ico { width: 1.05em; height: 1.05em; color: var(--k-ok); }
.kd-home-spin { width: 0.95em; height: 0.95em; flex: none; border-radius: 50%; border: 2px solid var(--k-line-strong); border-top-color: var(--k-accent); animation: kd-home-rot 0.8s linear infinite; }
@keyframes kd-home-rot { to { transform: rotate(360deg); } }
.kd-home-typing { display: inline-flex; gap: 0.3em; padding: 0.6em 0; }
.kd-home-typing i { width: 0.45em; height: 0.45em; border-radius: 50%; background: var(--k-muted); animation: kd-home-blink 1.2s infinite ease-in-out; }
.kd-home-typing i:nth-child(2) { animation-delay: 0.15s; }
.kd-home-typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes kd-home-blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }

/* approval card: Kelvin's .approval */
.kd-home-appr {
  display: grid; gap: 0.55em; padding: 0.85em 1em;
  background: var(--k-warn-bg); border: 1px solid var(--k-warn-line); border-radius: 0.85em;
  animation: kd-home-in 0.35s ease both;
}
.kd-home-appr-title { display: flex; align-items: center; gap: 0.55em; font-weight: 600; }
.kd-home-appr-title .kd-home-ico { color: var(--k-warn); }
.kd-home-where { margin-left: auto; padding: 0.08em 0.6em; border-radius: 999px; font-size: 0.8em; font-weight: 650; letter-spacing: 0.01em; }
.kd-home-where.real { background: #b3261e; color: #fff; }
.kd-home-where.sim { background: var(--k-muted-soft); color: var(--k-text-2); border: 1px solid var(--k-line-strong); }
.kd-home-appr ul { margin: 0; padding-left: 1.35em; display: grid; gap: 0.15em; font-variant-numeric: tabular-nums; color: var(--k-text); }
.kd-home-appr-act { display: flex; align-items: center; gap: 0.55em; flex-wrap: wrap; }
.kd-home-btn {
  font: 500 0.95em/1 var(--k-sans); padding: 0.55em 1em; border-radius: 0.55em; cursor: default;
  border: 1px solid var(--k-line-strong); background: var(--k-raised); color: var(--k-text);
}
.kd-home-btn.primary { background: var(--k-accent); border-color: var(--k-accent); color: var(--k-accent-ink); font-weight: 600; }
.kd-home-btn.pressed { transform: scale(0.95); filter: brightness(1.15); }
.kd-home-count { color: var(--k-muted); font-size: 0.88em; font-variant-numeric: tabular-nums; }
.kd-home-appr.done { grid-template-columns: minmax(0, 1fr) auto; align-items: center; padding: 0.5em 0.85em; background: var(--k-card); border-color: var(--k-card-line); }
.kd-home-appr.done ul, .kd-home-appr.done .kd-home-count, .kd-home-appr.done .kd-home-btn { display: none; }
.kd-home-appr.done .kd-home-appr-title { font-weight: 550; min-width: 0; }
.kd-home-appr.done .kd-home-appr-title > span:first-of-type { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kd-home-appr.done .kd-home-appr-title .kd-home-ico { color: var(--k-ok); }
.kd-home-verdict { font-weight: 600; color: var(--k-ok); }

/* the run, live */
.kd-home-run { border: 1px solid var(--k-card-line); background: var(--k-card); border-radius: 0.85em; padding: 0.75em 0.9em 0.6em; animation: kd-home-in 0.35s ease both; }
.kd-home-runhead { display: flex; align-items: center; gap: 0.55em; font-size: 0.93em; color: var(--k-text-2); }
.kd-home-runhead b { color: var(--k-text); font-weight: 600; font-family: var(--k-mono); font-size: 0.95em; }
.kd-home-runhead .n { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--k-muted); }
.kd-home-plot { width: 100%; height: auto; display: block; margin-top: 0.35em; overflow: visible; }
.kd-home-plot .grid { stroke: var(--k-grid); stroke-width: 1; }
.kd-home-plot .axis { stroke: var(--k-line-strong); stroke-width: 1; }
.kd-home-plot text { fill: var(--k-muted); font: 10.5px var(--k-sans); }
.kd-home-plot .data { fill: none; stroke: var(--k-s1); stroke-width: 1.7; stroke-linejoin: round; stroke-linecap: round; }
.kd-home-plot .pts circle { fill: var(--k-s1); }
.kd-home-plot .fit { fill: none; stroke: var(--k-fit); stroke-width: 1.3; stroke-dasharray: 4 3; opacity: 0; transition: opacity 0.8s; }
.kd-home-plot .fit.on { opacity: 0.85; }
.kd-home-plot .peak { fill: var(--k-text-2); opacity: 0; transition: opacity 0.6s 0.3s; }
.kd-home-plot .peak.on { opacity: 1; }

/* composer */
.kd-home-composer { flex: none; width: calc(100% - 3.2em); max-width: 46em; margin: 0.5em auto 1.1em; border: 1px solid var(--k-line-strong); border-radius: 1.1em; background: var(--k-panel); padding: 0.7em 0.8em 0.55em 1em; }
.kd-home-input { min-height: 1.45em; color: var(--k-text); white-space: pre-wrap; overflow-wrap: anywhere; }
.kd-home-input.empty::before { content: "Ask Kelvin…"; color: var(--k-muted); }
.kd-home-caret { display: inline-block; width: 1px; height: 1.1em; margin-left: 1px; vertical-align: -0.15em; background: var(--k-accent); animation: kd-home-caret 1s steps(1) infinite; }
@keyframes kd-home-caret { 50% { opacity: 0; } }
.kd-home-crow { display: flex; align-items: center; gap: 0.5em; margin-top: 0.45em; color: var(--k-muted); font-size: 0.9em; }
.kd-home-crow > span { display: inline-flex; align-items: center; gap: 0.35em; padding: 0.3em 0.6em; border: 1px solid var(--k-line); border-radius: 999px; }
.kd-home-crow .kd-home-ico { width: 1.05em; height: 1.05em; }
.kd-home-send { margin-left: auto; width: 2.3em; height: 2.3em; border-radius: 50%; background: var(--k-accent); color: var(--k-accent-ink); display: grid; place-items: center; transition: transform 0.15s; }
.kd-home-send .kd-home-ico { width: 1.2em; height: 1.2em; stroke-width: 2.2; }
.kd-home-send.pressed { transform: scale(0.88); }

/* ---------- Lab panel ---------- */

.kd-home-lab { min-height: 0; overflow: hidden; display: flex; flex-direction: column; gap: 0.9em; padding: 1em 0.95em; background: var(--k-panel); border-left: 1px solid var(--k-line); }
.kd-home-lab h4 { margin: 0 0 0.45em; font: 600 1em/1.2 var(--k-display); color: var(--k-text); display: flex; align-items: baseline; gap: 0.5em; }
.kd-home-lab h4 span { margin-left: auto; font: 400 0.86em var(--k-sans); color: var(--k-muted); }
.kd-home-lab h4 .kd-home-prot { display: inline-flex; align-items: center; gap: 0.3em; color: var(--k-ok); font-weight: 600; }
.kd-home-prot .kd-home-ico { width: 1em; height: 1em; }
.kd-home-labhead { display: flex; align-items: center; gap: 0.6em; padding-bottom: 0.75em; border-bottom: 1px solid var(--k-line); }
.kd-home-labhead b { font: 600 1.15em/1.2 var(--k-display); }
.kd-home-sample { padding: 0.7em 0.8em; border: 1px solid var(--k-line); border-radius: 0.7em; background: var(--k-bg); }
.kd-home-sample p { margin: 0 0 0.6em; color: var(--k-text); }
.kd-home-sample p span { display: block; color: var(--k-muted); font-size: 0.88em; }
.kd-home-sample .kd-home-btn { font-size: 0.85em; padding: 0.45em 0.7em; }
.kd-home-insts { display: grid; gap: 0.35em; }
.kd-home-inst { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 0.15em 0.55em; padding: 0.5em 0.65em; border: 1px solid var(--k-line); border-radius: 0.6em; background: var(--k-bg); }
.kd-home-inst b { font-weight: 600; font-family: var(--k-mono); font-size: 0.92em; }
.kd-home-inst small { grid-column: 2 / 4; color: var(--k-muted); font-size: 0.82em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kd-home-inst .v { justify-self: end; font-family: var(--k-mono); font-size: 0.88em; color: var(--k-text-2); font-variant-numeric: tabular-nums; transition: color 0.3s; }
.kd-home-inst.busy { border-color: #33597f; }
.kd-home-inst.busy .v { color: var(--k-accent); }
.kd-home-inst .kd-home-dot { grid-row: 1; }

/* ---------- the pointer that clicks for the visitor ---------- */

.kd-home-cursor {
  position: absolute; left: 0; top: 0; z-index: 5; width: 22px; height: 22px; pointer-events: none;
  opacity: 0; transform: translate(var(--cx, 60%), var(--cy, 60%));
  transition: transform 0.9s cubic-bezier(0.45, 0.05, 0.25, 1), opacity 0.3s;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}
.kd-home-cursor.on { opacity: 1; }
.kd-home-cursor svg { width: 100%; height: 100%; transition: transform 0.12s; }
.kd-home-cursor.down svg { transform: scale(0.82); }

/* the visitor took over: offer to play it again */
.kd-home-replay {
  position: absolute; right: 0.9em; bottom: 0.9em; z-index: 6;
  display: inline-flex; align-items: center; gap: 0.4em;
  font: 500 12.5px/1 var(--font, system-ui); color: var(--text, #fff);
  padding: 0.55em 0.95em; border-radius: 999px; cursor: pointer;
  background: rgba(13, 16, 22, 0.82); border: 1px solid rgba(255, 255, 255, 0.16);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.kd-home-replay:hover { background: rgba(30, 36, 46, 0.92); }
.kd-home-replay svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- compact: phones and narrow columns ---------- */

@container (max-width: 880px) {
  .kd-home-win { aspect-ratio: 4 / 3.6; font-size: clamp(10.5px, 2.05cqw, 13.5px); }
  .kd-home-body { grid-template-columns: minmax(0, 1fr); }
  .kd-home-side, .kd-home-lab { display: none; }
  .kd-home-ctitle { display: none; }
  .kd-home-tb.incognito, .kd-home-tb.terminal { display: none; }
  .kd-home-seg { position: static; transform: none; margin-left: 0.2em; }
  .kd-home-hv { padding: 1.2em 1.1em; gap: 0.9em; }
  .kd-home-thread { padding: 0.6em 1em 0.3em; }
  .kd-home-composer { width: calc(100% - 2em); margin-bottom: 0.9em; }
}
@container (max-width: 560px) {
  .kd-home-win { aspect-ratio: 3 / 4.15; font-size: clamp(10.5px, 3.3cqw, 13px); }
  .kd-home-osbar span.kd-home-osname { display: none; }
  .kd-home-tb.team, .kd-home-tb.analysis { display: none; }
  .kd-home-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.7em; }
  .kd-home-tile.runs { display: none; }
  .kd-home-blocks { grid-template-columns: minmax(0, 1fr); gap: 0.7em; }
  .kd-home-block:nth-child(n + 3) { display: none; }
  .kd-home-greet { font-size: 1.75em; }
  .kd-home-sugg span:nth-child(n + 3) { display: none; }
  .kd-home-crow .model { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .kd-home *, .kd-home *::before, .kd-home *::after { animation: none !important; transition: none !important; }
}
