/*
 * Kwhiz guided tour (KG) — base stylesheet.
 * Owned by the engine. Scene files never edit this file: they inject their
 * own CSS through KG.css(id, cssText) with classes prefixed by their scene id.
 *
 * Two token layers:
 *  - Raw Kwhiz DA v2 tokens (--snow, --text, --voltage...). They never change
 *    with the theme: product mockups (.kp-*) are always light, like the app.
 *  - Chrome tokens (--bg, --surface, --fg...). They flip in dark theme and are
 *    what anything drawn directly on the stage floor should use.
 */

/* ---------- Fonts (self-hosted Geist, no third-party font host) ---------- */
@font-face { font-family: 'Geist'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/Geist-Regular.woff2') format('woff2'); }
@font-face { font-family: 'Geist'; font-style: normal; font-weight: 500; font-display: swap; src: url('../fonts/Geist-Medium.woff2') format('woff2'); }
@font-face { font-family: 'Geist'; font-style: normal; font-weight: 600; font-display: swap; src: url('../fonts/Geist-SemiBold.woff2') format('woff2'); }
@font-face { font-family: 'Geist'; font-style: normal; font-weight: 700; font-display: swap; src: url('../fonts/Geist-Bold.woff2') format('woff2'); }
@font-face { font-family: 'Geist Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/GeistMono-Regular.woff2') format('woff2'); }
@font-face { font-family: 'Geist Mono'; font-style: normal; font-weight: 500; font-display: swap; src: url('../fonts/GeistMono-Medium.woff2') format('woff2'); }
@font-face { font-family: 'Geist Mono'; font-style: normal; font-weight: 600; font-display: swap; src: url('../fonts/GeistMono-SemiBold.woff2') format('woff2'); }

:root {
  /* Raw DA v2 tokens (light, theme-independent) */
  --snow: #FFFFFF;
  --mist: #FAFAFB;
  --fog: #F2F3F5;
  --cloud: #E8EAEE;
  --ink: #1A1C22;
  --graphite: #0E0F12;
  --text: #14161B;
  --text-2: #4A4D55;
  --text-3: #7E8189;
  --text-4: #A8ABB2;
  --hairline: rgba(14, 15, 18, .06);
  --hairline-2: rgba(14, 15, 18, .10);
  --hairline-3: rgba(14, 15, 18, .16);
  --voltage: #0A84FF;
  --voltage-2: #5BA8FF;
  --voltage-deep: #0058D6;
  --voltage-tint: rgba(10, 132, 255, .08);
  --voltage-glow: rgba(10, 132, 255, .18);
  --voltage-halo: rgba(10, 132, 255, .35);
  --success: #0FB871;
  --success-tint: rgba(15, 184, 113, .10);
  --warning: #F2A218;
  --warning-tint: rgba(242, 162, 24, .12);
  --danger: #E13E3E;
  --danger-tint: rgba(225, 62, 62, .10);
  --shadow-1: 0 1px 2px rgba(14, 15, 18, .04);
  --shadow-2: 0 2px 6px rgba(14, 15, 18, .05), 0 1px 2px rgba(14, 15, 18, .04);
  --shadow-3: 0 12px 32px rgba(14, 15, 18, .07), 0 2px 6px rgba(14, 15, 18, .04);
  --shadow-4: 0 32px 80px rgba(14, 15, 18, .10), 0 8px 24px rgba(14, 15, 18, .06);
  --shadow-glow: 0 0 0 4px rgba(10, 132, 255, .14);
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-2xl: 40px;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --ease-io: cubic-bezier(.65, 0, .35, 1);
  --font-sans: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;

  /* Team colours (maps, planning). Paired with a dash pattern, never colour alone. */
  --team-1: #0A84FF;
  --team-2: #14161B;
  --team-3: #0FB871;
  --team-4: #F2A218;
  --team-5: #7E8189;

  /* Chrome tokens (themeable) */
  color-scheme: light;
  --bg: #F4F5F7;
  --surface: #FFFFFF;
  --surface-2: #FAFAFB;
  --surface-3: #F2F3F5;
  --line: rgba(14, 15, 18, .08);
  --line-2: rgba(14, 15, 18, .14);
  --fg: #14161B;
  --fg-2: #4A4D55;
  --fg-3: #7E8189;
  --fg-4: #A8ABB2;
  --stage-bg: #EEF0F3;
  --stage-dot: rgba(14, 15, 18, .07);
  --dim: rgba(14, 15, 18, .42);
  --accent-fg: #0058D6;
  --chip-bg: rgba(255, 255, 255, .86);
  --elev: 0 1px 2px rgba(14, 15, 18, .04), 0 8px 24px rgba(14, 15, 18, .05);
  --integ-bg: #E9F6EF;
  --integ-fg: #0B6B43;
  --integ-line: rgba(15, 184, 113, .38);
  --integ-dot: #0FB871;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0B0C0F;
    --surface: #14161B;
    --surface-2: #1A1C22;
    --surface-3: #22252C;
    --line: rgba(255, 255, 255, .08);
    --line-2: rgba(255, 255, 255, .14);
    --fg: #F4F5F7;
    --fg-2: #A8ABB2;
    --fg-3: #7E8189;
    --fg-4: #5A5E66;
    --stage-bg: #101216;
    --stage-dot: rgba(255, 255, 255, .06);
    --dim: rgba(4, 5, 7, .62);
    --accent-fg: #5BA8FF;
    --chip-bg: rgba(20, 22, 27, .86);
    --elev: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .3);
    --integ-bg: rgba(15, 184, 113, .13);
    --integ-fg: #6FDDAE;
    --integ-line: rgba(15, 184, 113, .42);
    --integ-dot: #36C98B;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0B0C0F;
  --surface: #14161B;
  --surface-2: #1A1C22;
  --surface-3: #22252C;
  --line: rgba(255, 255, 255, .08);
  --line-2: rgba(255, 255, 255, .14);
  --fg: #F4F5F7;
  --fg-2: #A8ABB2;
  --fg-3: #7E8189;
  --fg-4: #5A5E66;
  --stage-bg: #101216;
  --stage-dot: rgba(255, 255, 255, .06);
  --dim: rgba(4, 5, 7, .62);
  --accent-fg: #5BA8FF;
  --chip-bg: rgba(20, 22, 27, .86);
  --elev: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .3);
  --integ-bg: rgba(15, 184, 113, .13);
  --integ-fg: #6FDDAE;
  --integ-line: rgba(15, 184, 113, .42);
  --integ-dot: #36C98B;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: -.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'ss01', 'cv11';
}
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; padding: 0; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--voltage); outline-offset: 2px; border-radius: 8px; }
.kg-num, .kp-num { font-variant-numeric: tabular-nums; }
.kg-mono, .kp-mono { font-family: var(--font-mono); }
.kg-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- App layout ---------- */
.kg-app {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}
.kg-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 0 16px 14px 0; }

/* Rail */
.kg-rail {
  display: flex; flex-direction: column; min-height: 0;
  padding: 18px 12px 14px 16px;
  background: var(--bg);
}
.kg-rail-head { display: flex; align-items: center; gap: 10px; padding: 4px 6px 18px; }
.kg-brand { display: inline-flex; align-items: center; gap: 8px; color: var(--fg); text-decoration: none; }
.kg-brand b { font-weight: 500; font-size: 18px; letter-spacing: -.04em; line-height: 1; }
.kg-brand-x { color: var(--fg-3); font-size: 13px; }
.kg-chapters { list-style: none; margin: 0; padding: 0 4px 0 0; overflow-y: auto; flex: 1; min-height: 0; scrollbar-width: thin; }
.kg-ch { margin: 0 0 2px; }
.kg-ch-btn {
  width: 100%; display: grid; grid-template-columns: 26px 1fr; gap: 8px; align-items: baseline;
  text-align: left; padding: 9px 10px; border-radius: 12px; color: var(--fg-2);
  transition: background .2s var(--ease), color .2s var(--ease);
}
.kg-ch-btn:hover { background: var(--surface-3); color: var(--fg); }
.kg-ch-num { font: 500 11px var(--font-mono); letter-spacing: .06em; color: var(--fg-3); }
.kg-ch-title { font-size: 13.5px; font-weight: 500; line-height: 1.35; }
.kg-ch.is-active > .kg-ch-btn { background: var(--surface); color: var(--fg); box-shadow: var(--elev); }
.kg-ch.is-active .kg-ch-num { color: var(--accent-fg); }
.kg-ch.is-done .kg-ch-num { color: var(--fg-2); }
.kg-ch.is-empty > .kg-ch-btn { opacity: .45; cursor: default; }
.kg-sc-list { list-style: none; margin: 6px 0 10px 34px; padding: 0; display: none; }
.kg-ch.is-active .kg-sc-list { display: block; }
.kg-sc { padding: 5px 0 7px; border-left: 1px solid var(--line); padding-left: 12px; }
.kg-sc-btn { text-align: left; font-size: 12.5px; line-height: 1.35; color: var(--fg-3); font-weight: 500; }
.kg-sc.is-active .kg-sc-btn { color: var(--fg); }
.kg-ticks { display: flex; gap: 3px; margin-top: 6px; }
.kg-tick { flex: 1; max-width: 26px; height: 4px; border-radius: 99px; background: var(--line-2); position: relative; overflow: hidden; }
.kg-tick i { position: absolute; inset: 0; background: var(--fg-2); transform-origin: 0 50%; transform: scaleX(0); border-radius: inherit; }
.kg-tick.is-done i { transform: scaleX(1); }
.kg-tick.is-current i { background: var(--voltage); }
.kg-st-list { list-style: none; margin: 8px 0 0; padding: 0; display: none; }
.kg-sc.is-active .kg-st-list { display: block; }
.kg-st {
  display: block; width: 100%; text-align: left; padding: 4px 8px; margin-left: -8px; border-radius: 8px;
  font-size: 12.5px; line-height: 1.35; color: var(--fg-3);
}
.kg-st:hover { background: var(--surface-3); color: var(--fg); }
.kg-st.is-current { color: var(--fg); font-weight: 500; background: var(--surface); box-shadow: var(--elev); }
.kg-rail-foot { padding: 12px 8px 0; font-size: 11.5px; color: var(--fg-3); display: flex; flex-wrap: wrap; gap: 6px 12px; }
.kg-kbd { font: 500 10.5px var(--font-mono); padding: 2px 6px; border-radius: 6px; border: 1px solid var(--line-2); color: var(--fg-2); background: var(--surface); }
.kg-scrim { display: none; }

/* Top bar */
.kg-top { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 10px 0 8px; }
.kg-top .kg-top-menu, .kg-top .kg-top-brand { display: none; }
.kg-top-title { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.kg-top-kicker { font: 500 10.5px var(--font-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--fg-3); }
.kg-top-name { font-size: 15px; font-weight: 600; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kg-iconbtn {
  width: 38px; height: 38px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); background: var(--surface); color: var(--fg-2); flex: none;
  transition: background .2s, color .2s;
}
.kg-iconbtn:hover { color: var(--fg); background: var(--surface-2); }
.kg-pillbtn {
  height: 38px; padding: 0 14px; border-radius: 999px; display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); background: var(--surface); color: var(--fg-2); font-size: 13px; font-weight: 500; flex: none;
}
.kg-pillbtn:hover { color: var(--fg); }

/* ---------- Cover ---------- */
.kg-cover { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 0 8px; }
.kg-app[data-state="play"] .kg-cover { display: none; }
.kg-app[data-state="cover"] .kg-stage, .kg-app[data-state="cover"] .kg-dock { display: none; }
.kg-cover-hero {
  position: relative; overflow: hidden; border-radius: var(--radius-xl);
  background: var(--graphite); color: var(--snow);
  padding: clamp(24px, 4vw, 52px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08), 0 24px 60px rgba(14, 15, 18, .16);
}
.kg-cover-hero::after {
  content: ''; position: absolute; right: -8%; top: -30%; width: 60%; height: 140%; pointer-events: none;
  background: radial-gradient(closest-side, rgba(10, 132, 255, .22), transparent 70%);
}
.kg-cover-lockup { position: relative; z-index: 1; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.kg-cover-lockup .kg-brand { color: var(--snow); }
.kg-cover-lockup .kg-brand b { font-size: 22px; }
.kg-cover-eyebrow { position: relative; z-index: 1; margin-top: clamp(28px, 5vw, 56px); font: 500 11px var(--font-mono); letter-spacing: .16em; text-transform: uppercase; color: var(--voltage-2); }
.kg-cover-title { position: relative; z-index: 1; margin: 12px 0 0; max-width: 18ch; font-size: clamp(34px, 5.2vw, 64px); font-weight: 600; letter-spacing: -.04em; line-height: 1.02; text-wrap: balance; }
.kg-cover-sub { position: relative; z-index: 1; margin: 16px 0 0; max-width: 60ch; font-size: clamp(15px, 1.4vw, 17px); line-height: 1.6; color: #C9CCD2; text-wrap: pretty; }
.kg-cover-cta { position: relative; z-index: 1; margin-top: 28px; display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; }
.kg-start {
  display: inline-flex; align-items: center; gap: 12px; height: 54px; padding: 0 24px 0 20px; border-radius: 999px;
  background: var(--snow); color: var(--graphite); font-weight: 600; font-size: 16px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .3);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.kg-start:hover { transform: translateY(-1px); box-shadow: 0 16px 40px rgba(0, 0, 0, .36); }
.kg-start .kg-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--voltage); box-shadow: 0 0 0 5px rgba(10, 132, 255, .2); animation: kg-breath 2.4s var(--ease) infinite; }
.kg-cover-hint { font-size: 13px; color: #A8ABB2; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.kg-cover-hint .kg-kbd { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .14); color: #E8EAEE; }
.kg-cover-list { list-style: none; margin: 18px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); gap: 10px; }
.kg-cover-list button {
  width: 100%; height: 100%; text-align: left; display: flex; flex-direction: column; gap: 8px;
  padding: 16px 16px 18px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--elev); transition: transform .25s var(--ease), border-color .25s var(--ease);
}
.kg-cover-list button:hover { transform: translateY(-2px); border-color: var(--line-2); }
.kg-cover-list small { font: 500 11px var(--font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--fg-3); }
.kg-cover-list span { font-size: 15px; font-weight: 600; letter-spacing: -.01em; line-height: 1.3; color: var(--fg); }
.kg-cover-list li.is-empty button { opacity: .5; cursor: default; }

/* ---------- Stage ---------- */
.kg-stage {
  position: relative; flex: 1; min-height: 0; overflow: hidden;
  border-radius: var(--radius-xl);
  background-color: var(--stage-bg);
  background-image: radial-gradient(var(--stage-dot) 1px, transparent 1.2px);
  background-size: 22px 22px;
  border: 1px solid var(--line);
  isolation: isolate;
}
.kg-world { position: absolute; left: 0; top: 0; width: 1280px; height: 720px; transform-origin: 0 0; }
.kg-scene { position: absolute; inset: 0; transform-origin: 50% 50%; }
.kg-cam { position: absolute; left: 0; top: 0; width: 1280px; height: 720px; transform-origin: 0 0; will-change: transform; }
.kg-fx { position: absolute; left: 0; top: 0; width: 1280px; height: 720px; pointer-events: none; z-index: 50; }
.kg-layer { position: absolute; left: 0; top: 0; width: 1280px; height: 720px; }
.kg-instant, .kg-instant * { transition: none !important; animation-duration: 0s !important; animation-delay: 0s !important; }

.kg-stage-ui { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.kg-etape-chip {
  position: absolute; left: 14px; top: 14px; display: inline-flex; align-items: center; gap: 10px;
  height: 34px; padding: 0 14px 0 6px; border-radius: 999px; background: var(--chip-bg); border: 1px solid var(--line);
  backdrop-filter: saturate(160%) blur(16px); -webkit-backdrop-filter: saturate(160%) blur(16px);
  font-size: 13px; font-weight: 500; color: var(--fg); box-shadow: var(--elev);
}
.kg-etape-chip b { display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 999px; background: var(--graphite); color: var(--snow); font: 600 11.5px var(--font-mono); letter-spacing: .04em; }
.kg-floats { position: absolute; right: 14px; top: 14px; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.kg-maq-float { box-shadow: var(--elev); }
.kg-sample-float { background: rgba(255, 255, 255, .92); box-shadow: var(--elev); }
.kg-maq-float[hidden], .kg-sample-float[hidden] { display: none; }
.kg-resume {
  pointer-events: auto; position: absolute; right: 14px; bottom: 14px;
  display: inline-flex; align-items: center; gap: 10px; height: 40px; padding: 0 16px 0 12px; border-radius: 999px;
  background: var(--graphite); color: var(--snow); font-size: 13.5px; font-weight: 500; box-shadow: 0 12px 30px rgba(14, 15, 18, .25);
}
.kg-resume .kg-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--voltage); box-shadow: 0 0 0 4px rgba(10, 132, 255, .25); }
.kg-inter {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  text-align: center; padding: 24px; background: var(--stage-bg); pointer-events: none;
}
.kg-inter-kicker { font: 500 12px var(--font-mono); letter-spacing: .18em; text-transform: uppercase; color: var(--accent-fg); }
.kg-inter-title { margin: 0; max-width: 22ch; font-size: clamp(26px, 4vw, 52px); font-weight: 600; letter-spacing: -.04em; line-height: 1.04; color: var(--fg); text-wrap: balance; }
.kg-inter-line { width: 56px; height: 2px; border-radius: 2px; background: var(--voltage); transform-origin: 0 50%; }

/* ---------- Dock ---------- */
.kg-dock { margin-top: 12px; border-radius: var(--radius-xl); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--elev); overflow: hidden; }
.kg-segs { display: flex; gap: 10px; padding: 0 18px; height: 16px; align-items: center; }
.kg-seg-group { display: flex; gap: 3px; flex: var(--n, 1) 1 0; min-width: 0; }
.kg-seg { flex: 1; height: 4px; border-radius: 99px; background: var(--line-2); position: relative; overflow: hidden; min-width: 4px; }
.kg-seg::before { content: ''; position: absolute; left: 0; right: 0; top: -6px; bottom: -6px; }
.kg-seg i { position: absolute; inset: 0; background: var(--fg-2); transform-origin: 0 50%; transform: scaleX(0); border-radius: inherit; }
.kg-seg.is-done i { transform: scaleX(1); }
.kg-seg.is-current { background: var(--line-2); }
.kg-seg.is-current i { background: var(--voltage); }
.kg-dock-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 20px 26px; padding: 6px 20px 16px 16px; align-items: start; }
.kg-dock.has-etape .kg-dock-row { grid-template-columns: auto minmax(0, .95fr) minmax(0, 1.5fr); }
.kg-controls { display: flex; align-items: center; gap: 6px; padding-top: 6px; }
.kg-ctrl {
  width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); color: var(--fg-2); background: var(--surface);
  transition: background .2s, color .2s, transform .2s var(--ease);
}
.kg-ctrl:hover { color: var(--fg); background: var(--surface-2); }
.kg-ctrl:active { transform: scale(.94); }
.kg-ctrl.is-play { width: 48px; height: 48px; background: var(--graphite); border-color: var(--graphite); color: var(--snow); }
:root[data-theme="dark"] .kg-ctrl.is-play { background: var(--snow); color: var(--graphite); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .kg-ctrl.is-play { background: var(--snow); color: var(--graphite); } }
.kg-ctrl .kg-i-pause { display: none; }
.kg-app.is-playing .kg-ctrl .kg-i-pause { display: block; }
.kg-app.is-playing .kg-ctrl .kg-i-play { display: none; }
.kg-caption { min-width: 0; padding-top: 4px; }
.kg-cap-kicker { font: 500 10.5px var(--font-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--fg-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kg-cap-title { margin: 4px 0 0; font-size: 18px; font-weight: 600; letter-spacing: -.02em; line-height: 1.25; color: var(--fg); text-wrap: balance; }
.kg-cap-text { margin: 6px 0 0; font-size: 14.5px; line-height: 1.55; color: var(--fg-2); text-wrap: pretty; max-width: 72ch; }
.kg-cap-text p { margin: 0; }
.kg-cap-text p + p { margin-top: 6px; }
.kg-cap-text strong { color: var(--fg); font-weight: 600; }
.kg-w { display: inline-block; opacity: 0; transform: translateY(4px); animation: kg-word .5s var(--ease) forwards; }
.kg-w.is-still { opacity: 1; transform: none; animation: none; }
.kg-etape { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; min-width: 0; padding-top: 4px; }
.kg-etape-col { min-width: 0; padding: 12px 14px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--line); }
.kg-etape-col h3 { margin: 0 0 8px; display: flex; align-items: center; gap: 8px; font: 600 10.5px var(--font-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--fg-3); }
.kg-etape-col h3 i { width: 7px; height: 7px; border-radius: 50%; background: var(--fg-2); }
.kg-etape-col.is-kwhiz h3 i { background: var(--voltage); box-shadow: 0 0 0 3px var(--voltage-glow); }
.kg-etape-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.kg-etape-col li { font-size: 13.5px; line-height: 1.45; color: var(--fg); display: flex; gap: 8px; align-items: baseline; }
.kg-etape-col li::before { content: ''; flex: none; width: 4px; height: 4px; border-radius: 50%; background: var(--fg-3); transform: translateY(-2px); }
.kg-who { flex: none; font: 500 10.5px var(--font-mono); letter-spacing: .04em; padding: 2px 7px; border-radius: 6px; background: var(--surface-3); color: var(--fg-2); border: 1px solid var(--line); white-space: nowrap; }

/* ---------- Shared markers ---------- */
.kg-sample {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 7px;
  border: 1px dashed var(--hairline-3); color: var(--text-2); background: rgba(255, 255, 255, .7);
  font: 500 10px var(--font-mono); letter-spacing: .12em; text-transform: uppercase; white-space: nowrap;
}
.kg-maquette {
  display: inline-flex; align-items: center; gap: 7px; height: 24px; padding: 0 10px 0 8px; border-radius: 999px;
  background: #FFF4DF; color: #7A4B00; border: 1px solid rgba(242, 162, 24, .45);
  font-size: 11.5px; font-weight: 600; letter-spacing: 0; white-space: nowrap;
}
.kg-maquette::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--warning); box-shadow: 0 0 0 3px rgba(242, 162, 24, .2); }
.kg-integrable {
  display: inline-flex; align-items: center; gap: 7px; height: 24px; padding: 0 10px 0 8px; border-radius: 999px;
  background: var(--integ-bg); color: var(--integ-fg); border: 1px solid var(--integ-line);
  font-size: 11.5px; font-weight: 600; letter-spacing: 0; white-space: nowrap;
}
.kg-integrable::before { content: ''; width: 7px; height: 7px; border-radius: 2px; background: var(--integ-dot); transform: rotate(45deg); }
.kp .kg-integrable, .kg-browser .kg-integrable, .kg-iphone .kg-integrable { background: #E9F6EF; color: #0B6B43; border-color: rgba(15, 184, 113, .38); }
.kp .kg-integrable::before, .kg-browser .kg-integrable::before, .kg-iphone .kg-integrable::before { background: #0FB871; }
.kg-stores { display: inline-flex; gap: 8px; }
.kg-store {
  display: inline-flex; flex-direction: column; justify-content: center; height: 40px; padding: 0 14px; border-radius: 10px;
  background: #0E0F12; color: #fff; border: 1px solid rgba(255, 255, 255, .18); line-height: 1.1; white-space: nowrap;
}
.kg-store small { font-size: 9.5px; font-weight: 500; opacity: .78; letter-spacing: .01em; }
.kg-store b { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.kg-stores.is-compact .kg-store { height: 32px; padding: 0 10px; border-radius: 8px; }
.kg-stores.is-compact .kg-store small { font-size: 8px; }
.kg-stores.is-compact .kg-store b { font-size: 12.5px; }
.kg-onstage { color: var(--fg); }
.kg-label-floor { font: 500 11px var(--font-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--fg-3); }
.kg-hide { opacity: 0; }
.kg-caret::after { content: ''; display: inline-block; width: 1.5px; height: 1.05em; margin-left: 1px; vertical-align: -0.15em; background: var(--voltage); animation: kg-caret 1s steps(1) infinite; }

/* ---------- FX: halo, cursor, ping, flight ---------- */
.kg-halo {
  position: absolute; left: 0; top: 0; width: 10px; height: 10px; border-radius: 16px; opacity: 0;
  box-shadow: 0 0 0 4000px var(--dim);
}
.kg-halo.no-dim { box-shadow: none; }
.kg-halo::after {
  content: ''; position: absolute; inset: -5px; border-radius: inherit; border: 2px solid var(--voltage-2);
  box-shadow: 0 0 0 6px rgba(10, 132, 255, .12); animation: kg-halo 2.2s var(--ease) infinite;
}
.kg-cursor { position: absolute; left: 0; top: 0; width: 30px; height: 30px; opacity: 0; z-index: 3; }
.kg-cursor svg { display: block; filter: drop-shadow(0 4px 10px rgba(14, 15, 18, .35)); }
.kg-cursor-ripple { position: absolute; left: -18px; top: -18px; width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--voltage); opacity: 0; }
.kg-ping { position: absolute; border-radius: 16px; border: 2px solid var(--voltage); opacity: 0; }
.kg-flight { position: absolute; left: 0; top: 0; transform-origin: 0 0; z-index: 4; box-shadow: var(--shadow-4); }

/* ---------- Device frames ---------- */
.kg-iphone {
  position: absolute; width: 300px; height: 620px; border-radius: 48px; padding: 10px;
  background: #0E0F12;
  box-shadow: inset 0 0 0 1.5px #3A3D45, inset 0 0 0 4px #0E0F12, 0 40px 80px rgba(14, 15, 18, .22), 0 10px 24px rgba(14, 15, 18, .14);
  transform-origin: 0 0;
}
.kg-phone-screen {
  position: relative; width: 280px; height: 600px; border-radius: 38px; overflow: hidden;
  background: var(--mist); color: var(--text); font-family: var(--font-sans); font-size: 13px; line-height: 1.45;
  display: flex; flex-direction: column;
}
.kg-phone-island { position: absolute; left: 50%; top: 9px; width: 84px; height: 24px; margin-left: -42px; border-radius: 20px; background: #000; z-index: 30; }
.kg-phone-status { flex: none; height: 42px; padding: 0 22px 0 28px; display: flex; align-items: center; justify-content: space-between; font-size: 13px; font-weight: 600; color: var(--text); position: relative; z-index: 20; }
.kg-phone-status svg { display: block; }
.kg-phone-status .kg-ps-icons { display: flex; gap: 5px; align-items: center; }
.kg-phone-body { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.kg-phone-home { position: absolute; left: 50%; bottom: 7px; width: 104px; height: 4px; margin-left: -52px; border-radius: 4px; background: rgba(14, 15, 18, .85); z-index: 30; }
.kg-iphone.is-dark .kg-phone-screen { background: #0E0F12; color: #F4F5F7; }
.kg-iphone.is-dark .kg-phone-status { color: #fff; }
.kg-iphone.is-dark .kg-phone-home { background: rgba(255, 255, 255, .8); }
.kg-urlbar { flex: none; margin: 0 10px 6px; height: 30px; border-radius: 10px; background: var(--fog); display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 11.5px; color: var(--text-2); }
.kg-urlbar svg { flex: none; }
.kg-phonebar { flex: none; display: flex; align-items: center; gap: 8px; padding: 6px 14px 10px; border-bottom: 1px solid var(--hairline); background: var(--snow); }
.kg-phonebar-title { font-size: 15px; font-weight: 600; letter-spacing: -.01em; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kg-phonebar-back { width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--fog); color: var(--text); flex: none; }
.kg-phone-chrome-pills { position: absolute; left: 50%; bottom: -34px; transform: translateX(-50%); display: flex; gap: 6px; white-space: nowrap; }

.kg-browser {
  position: absolute; width: 900px; height: 560px; border-radius: 16px; overflow: hidden;
  background: var(--snow); color: var(--text);
  box-shadow: 0 0 0 1px var(--hairline-2), 0 30px 70px rgba(14, 15, 18, .14), 0 8px 20px rgba(14, 15, 18, .06);
  display: flex; flex-direction: column; transform-origin: 0 0;
}
.kg-browser-chrome { flex: none; height: 40px; display: flex; align-items: center; gap: 12px; padding: 0 12px 0 14px; background: #F2F3F5; border-bottom: 1px solid var(--hairline-2); }
.kg-browser-dots { display: flex; gap: 6px; flex: none; }
.kg-browser-dots i { width: 10px; height: 10px; border-radius: 50%; background: #D5D8DE; display: block; }
.kg-browser-url { flex: 1; min-width: 0; max-width: 420px; margin: 0 auto; height: 26px; border-radius: 999px; background: var(--snow); border: 1px solid var(--hairline-2); display: flex; align-items: center; justify-content: center; gap: 6px; font: 11.5px var(--font-mono); color: var(--text-2); white-space: nowrap; overflow: hidden; }
.kg-browser-pills { flex: none; display: flex; gap: 6px; align-items: center; }
.kg-browser-body { position: relative; flex: 1; min-height: 0; overflow: hidden; background: var(--mist); }

/* App shell inside a browser */
.kg-shell { display: grid; grid-template-columns: 196px minmax(0, 1fr); height: 100%; }
.kg-shell-side { background: var(--mist); border-right: 1px solid var(--hairline); padding: 14px 10px; display: flex; flex-direction: column; gap: 2px; min-height: 0; }
.kg-shell-logo { display: flex; flex-direction: column; gap: 3px; padding: 2px 8px 12px; }
.kg-shell-logo b { font-size: 19px; font-weight: 600; letter-spacing: -.04em; line-height: 1; color: var(--text); }
.kg-shell-logo b em { font-style: normal; color: var(--voltage); }
.kg-shell-logo small { font: 500 8.5px var(--font-sans); letter-spacing: .32em; color: var(--text-2); text-transform: uppercase; }
.kg-shell-badge { margin: 0 6px 10px; font: 500 10px var(--font-mono); letter-spacing: .06em; color: var(--text-3); }
.kg-shell-item { display: flex; align-items: center; gap: 9px; height: 32px; padding: 0 10px; border-radius: 10px; font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.kg-shell-item svg { color: var(--text-3); flex: none; }
.kg-shell-item.is-active { background: var(--fog); color: var(--text); }
.kg-shell-item.is-active svg { color: var(--text); }
.kg-shell-new { margin: 10px 6px 0; height: 34px; border-radius: 12px; background: var(--graphite); color: var(--snow); font-size: 12.5px; font-weight: 500; display: flex; align-items: center; justify-content: center; gap: 6px; }
.kg-shell-main { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: var(--snow); }
.kg-perito-head { flex: none; height: 48px; display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--hairline); background: var(--snow); }
.kg-perito-head b { font-size: 14px; font-weight: 600; letter-spacing: -.01em; }
.kg-perito-head span { font: 500 10px var(--font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); }

/* ---------- Toasts and push ---------- */
.kg-toasts { position: absolute; top: 12px; right: 12px; display: flex; flex-direction: column; gap: 8px; z-index: 40; width: 300px; pointer-events: none; }
.kg-toast {
  display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: start;
  padding: 12px 14px; border-radius: 14px; background: var(--snow); color: var(--text);
  box-shadow: 0 0 0 1px var(--hairline-2), var(--shadow-3);
}
.kg-toast-ic { width: 28px; height: 28px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; background: var(--fog); color: var(--text); }
.kg-toast[data-tone="success"] .kg-toast-ic { background: var(--success-tint); color: #0A8A55; }
.kg-toast[data-tone="warning"] .kg-toast-ic { background: var(--warning-tint); color: #A06800; }
.kg-toast[data-tone="danger"] .kg-toast-ic { background: var(--danger-tint); color: var(--danger); }
.kg-toast[data-tone="live"] .kg-toast-ic { background: var(--voltage-tint); color: var(--voltage-deep); }
.kg-toast b { display: block; font-size: 13px; font-weight: 600; letter-spacing: -.005em; }
.kg-toast span { display: block; font-size: 12px; color: var(--text-2); line-height: 1.4; margin-top: 1px; }
.kg-push {
  position: absolute; left: 8px; right: 8px; top: 40px; z-index: 25; padding: 10px 12px; border-radius: 20px;
  background: rgba(246, 247, 249, .9); backdrop-filter: saturate(160%) blur(18px); -webkit-backdrop-filter: saturate(160%) blur(18px);
  box-shadow: 0 10px 30px rgba(14, 15, 18, .18); display: grid; grid-template-columns: 30px 1fr; gap: 9px; color: var(--text);
}
.kg-push-ic { width: 30px; height: 30px; border-radius: 8px; background: var(--graphite); display: flex; align-items: center; justify-content: center; }
.kg-push-top { display: flex; justify-content: space-between; gap: 6px; font-size: 10.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; }
.kg-push b { display: block; font-size: 12.5px; font-weight: 600; margin-top: 1px; }
.kg-push span.kg-push-body { display: block; font-size: 12px; line-height: 1.35; color: var(--text-2); }

/* ---------- Photos ---------- */
.kg-photo { position: relative; margin: 0; overflow: hidden; border-radius: 12px; background: #23262D; color: #fff; }
.kg-photo img { width: 100%; height: 100%; object-fit: cover; }
.kg-photo-ph {
  position: absolute; inset: 0; display: flex; align-items: flex-end; padding: 10px;
  background:
    repeating-linear-gradient(115deg, rgba(255, 255, 255, .035) 0 14px, transparent 14px 34px),
    linear-gradient(180deg, #3A3E46, #1F2228);
  font: 500 10px var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: rgba(255, 255, 255, .7);
}
.kg-photo-ill { position: absolute; top: 8px; right: 8px; font: 500 9px var(--font-mono); letter-spacing: .1em; text-transform: uppercase; padding: 3px 6px; border-radius: 5px; background: rgba(0, 0, 0, .55); color: rgba(255, 255, 255, .85); }
.kg-stamp {
  position: absolute; left: 8px; bottom: 8px; padding: 5px 7px; border-radius: 6px; background: rgba(0, 0, 0, .58);
  font: 500 9.5px/1.35 var(--font-mono); color: #FFE9A8; letter-spacing: .02em; text-shadow: 0 1px 0 rgba(0, 0, 0, .5);
}
.kg-stamp div { white-space: nowrap; }
.kg-viewfinder { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.kg-vf-corner { position: absolute; width: 22px; height: 22px; border: 2.5px solid #fff; opacity: .95; }
.kg-vf-corner:nth-child(1) { left: 12px; top: 12px; border-right: 0; border-bottom: 0; border-top-left-radius: 6px; }
.kg-vf-corner:nth-child(2) { right: 12px; top: 12px; border-left: 0; border-bottom: 0; border-top-right-radius: 6px; }
.kg-vf-corner:nth-child(3) { left: 12px; bottom: 12px; border-right: 0; border-top: 0; border-bottom-left-radius: 6px; }
.kg-vf-corner:nth-child(4) { right: 12px; bottom: 12px; border-left: 0; border-top: 0; border-bottom-right-radius: 6px; }
.kg-vf-focus { position: absolute; left: 50%; top: 50%; width: 64px; height: 64px; margin: -32px 0 0 -32px; border: 1.5px solid #FFD84D; border-radius: 4px; }
.kg-vf-mode { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); font: 600 9.5px var(--font-mono); letter-spacing: .16em; color: #FFD84D; }
.kg-flash { position: absolute; inset: 0; background: #fff; opacity: 0; z-index: 3; pointer-events: none; }

/* ---------- Signature ---------- */
.kg-sig { position: relative; background: var(--snow); border: 1px solid var(--hairline-2); border-radius: 14px; padding: 8px 10px 26px; color: var(--text); }
.kg-sig svg { display: block; width: 100%; height: auto; overflow: visible; }
.kg-sig path { fill: none; stroke: #13306B; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; }
.kg-sig.is-signed path { stroke-dashoffset: 0; }
.kg-sig-line { position: absolute; left: 14px; right: 14px; bottom: 24px; border-top: 1px dashed var(--hairline-3); }
.kg-sig-label { position: absolute; left: 14px; bottom: 6px; font-size: 10.5px; color: var(--text-3); }
.kg-sig-tip { position: absolute; left: 0; top: 0; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: rgba(10, 132, 255, .25); border: 2px solid var(--voltage); opacity: 0; }

/* ---------- Documents ---------- */
.kg-doc {
  position: absolute; width: 168px; height: 220px; border-radius: 10px; background: var(--snow); color: var(--text);
  box-shadow: 0 0 0 1px var(--hairline-2), var(--shadow-3); padding: 14px 13px 12px; display: flex; flex-direction: column; gap: 8px;
  overflow: hidden; transform-origin: 50% 80%;
}
.kg-doc-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.kg-doc-kind { font: 600 8.5px var(--font-mono); letter-spacing: .1em; padding: 2px 5px; border-radius: 4px; background: var(--fog); color: var(--text-2); }
.kg-doc-logo { display: flex; gap: 2px; flex-direction: column; width: 18px; }
.kg-doc-logo i { display: block; height: 2.5px; border-radius: 1px; background: var(--graphite); }
.kg-doc-logo i:last-child { width: 70%; }
.kg-doc-title { font-size: 12px; font-weight: 600; line-height: 1.25; letter-spacing: -.01em; transition: color .4s var(--ease); }
.kg-doc-sub { font-size: 9.5px; color: var(--text-3); line-height: 1.3; transition: color .4s var(--ease); }
.kg-doc-lines { display: flex; flex-direction: column; gap: 5px; margin-top: 2px; flex: 1; }
.kg-doc-lines i { display: block; height: 4px; border-radius: 3px; background: var(--cloud); transition: background .4s var(--ease); }
.kg-doc-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; font: 500 8px var(--font-mono); color: var(--text-3); }
.kg-doc-check { width: 20px; height: 20px; border-radius: 50%; background: var(--success); color: #fff; display: inline-flex; align-items: center; justify-content: center; opacity: 0; transform: scale(.4); }
.kg-doc.is-done .kg-doc-check { opacity: 1; transform: none; }
.kg-doc-sigmark { position: absolute; right: 12px; bottom: 30px; width: 54px; height: 20px; color: #13306B; opacity: 0; }
.kg-doc.is-signed .kg-doc-sigmark { opacity: 1; }
.kg-doc.is-skel .kg-doc-title, .kg-doc.is-skel .kg-doc-sub { color: transparent; background: var(--fog); border-radius: 4px; }
.kg-doc.is-skel .kg-doc-lines i { background: var(--fog); }
.kg-doc.is-skel .kg-doc-foot { opacity: 0; }
.kg-doc::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(10, 132, 255, .10) 50%, transparent 70%);
  transform: translateX(-100%);
}
.kg-doc.is-gen::after { opacity: 1; animation: kg-sweep .9s var(--ease-io) infinite; }
.kg-docstack { position: absolute; }

/* ---------- Map ---------- */
.kg-map { position: absolute; border-radius: 18px; overflow: hidden; background: #F7F8FA; box-shadow: 0 0 0 1px var(--hairline-2), var(--shadow-3); color: var(--text); }
.kg-map svg.kg-map-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.kg-map-land { fill: #FFFFFF; stroke: rgba(14, 15, 18, .16); stroke-width: 1.2; }
.kg-map-river { fill: none; stroke: #BFD9F5; stroke-width: 5; stroke-linecap: round; }
.kg-map-road { fill: none; stroke: #E3E6EB; stroke-width: 3; stroke-linecap: round; }
.kg-map-road.is-major { stroke: #D6DAE0; stroke-width: 4.5; }
.kg-map-town { font: 500 10px var(--font-sans); fill: #7E8189; }
.kg-map-towndot { fill: #A8ABB2; }
.kg-map-route { fill: none; stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; }
.kg-map-title { position: absolute; left: 14px; top: 12px; display: flex; gap: 8px; align-items: center; font-size: 12.5px; font-weight: 600; }
.kg-map-legend { position: absolute; left: 14px; bottom: 12px; display: flex; gap: 12px; flex-wrap: wrap; font-size: 11px; color: var(--text-2); }
.kg-map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.kg-map-legend i { width: 16px; height: 0; border-top: 3px solid currentColor; border-radius: 2px; }
.kg-pin { position: absolute; left: 0; top: 0; width: 0; height: 0; }
.kg-pin-dot {
  position: absolute; left: -9px; top: -9px; width: 18px; height: 18px; border-radius: 50%; background: var(--pin, #14161B);
  border: 2.5px solid #fff; box-shadow: 0 2px 6px rgba(14, 15, 18, .3); display: flex; align-items: center; justify-content: center;
  font: 600 9px var(--font-mono); color: #fff;
}
.kg-pin.is-big .kg-pin-dot { left: -13px; top: -13px; width: 26px; height: 26px; font-size: 11px; }
.kg-pin-label { position: absolute; left: 14px; top: -9px; white-space: nowrap; font-size: 10.5px; font-weight: 500; color: var(--text); background: rgba(255, 255, 255, .92); padding: 1px 6px; border-radius: 6px; box-shadow: 0 0 0 1px var(--hairline); }
.kg-pin.is-hl .kg-pin-dot { box-shadow: 0 0 0 6px rgba(10, 132, 255, .22), 0 2px 6px rgba(14, 15, 18, .3); }
.kg-map-vehicle { position: absolute; left: 0; top: 0; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: #fff; border: 3px solid var(--voltage); box-shadow: 0 2px 8px rgba(14, 15, 18, .3); opacity: 0; }

/* ---------- Board (at scale) ---------- */
.kg-board { position: absolute; display: flex; gap: 10px; padding: 12px; color: var(--text); }
.kg-board-col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; background: var(--fog); border-radius: 14px; padding: 8px; }
.kg-board-head { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; padding: 2px 4px 4px; }
.kg-board-head b { font-size: 11.5px; font-weight: 600; letter-spacing: -.005em; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kg-board-count { font: 600 12px var(--font-mono); font-variant-numeric: tabular-nums; color: var(--text-2); }
.kg-board-col.is-hl { background: var(--voltage-tint); box-shadow: inset 0 0 0 1.5px rgba(10, 132, 255, .35); }
.kg-board-col.is-hl .kg-board-count { color: var(--voltage-deep); }
.kg-board-list { display: flex; flex-direction: column; gap: 5px; min-height: 0; overflow: hidden; flex: 1; }
.kg-card {
  flex: none; display: grid; grid-template-columns: 1fr auto; gap: 1px 6px; align-items: center;
  padding: 6px 8px; border-radius: 9px; background: var(--snow); box-shadow: 0 0 0 1px var(--hairline), var(--shadow-1);
}
.kg-card-ref { font: 500 9.5px var(--font-mono); color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kg-card-town { font-size: 10.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; grid-column: 1; }
.kg-card-who { grid-row: 1 / span 2; grid-column: 2; width: 20px; height: 20px; border-radius: 50%; background: var(--fog); color: var(--text-2); font: 600 8.5px var(--font-sans); display: flex; align-items: center; justify-content: center; box-shadow: inset 0 0 0 1.5px var(--team, transparent); }
.kg-card.is-hl { box-shadow: 0 0 0 2px var(--voltage), var(--shadow-2); }
.kg-board-more { flex: none; text-align: center; font: 500 10px var(--font-mono); color: var(--text-3); padding: 3px; }

/* ---------- Tree (hierarchy) ---------- */
.kg-tree { position: absolute; }
.kg-tree svg.kg-tree-links { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.kg-tree-link { fill: none; stroke: var(--line-2); stroke-width: 1.6; stroke-dasharray: 1; stroke-dashoffset: 0; }
.kg-tree-link.is-locked { stroke: var(--voltage); stroke-width: 2; }
.kg-node {
  position: absolute; display: flex; align-items: center; gap: 9px; padding: 8px 12px 8px 8px; border-radius: 14px;
  background: var(--snow); color: var(--text); box-shadow: 0 0 0 1px var(--hairline-2), var(--shadow-2);
  transform-origin: 50% 0;
}
.kg-node-av { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--fog); display: flex; align-items: center; justify-content: center; font: 600 11px var(--font-sans); color: var(--text-2); }
.kg-node-txt { min-width: 0; display: flex; flex-direction: column; }
.kg-node-txt b { font-size: 12.5px; font-weight: 600; letter-spacing: -.005em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kg-node-txt span { font-size: 10.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kg-node-meta { margin-left: auto; font: 600 11px var(--font-mono); color: var(--text-2); font-variant-numeric: tabular-nums; }
.kg-node.is-org { background: var(--graphite); color: var(--snow); justify-content: center; padding: 12px 18px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .08), 0 18px 40px rgba(14, 15, 18, .24); }
.kg-node.is-org img { height: 40px; width: auto; }
.kg-node.is-org .kg-node-txt span { color: #A8ABB2; }
.kg-node.is-sub { padding: 6px 10px 6px 6px; border-radius: 12px; }
.kg-node.is-sub .kg-node-av { width: 24px; height: 24px; font-size: 9.5px; }
.kg-node.is-sub .kg-node-txt b { font-size: 11.5px; }
.kg-node-lock { position: absolute; right: -8px; top: -8px; width: 22px; height: 22px; border-radius: 50%; background: var(--graphite); color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 0 0 2px var(--snow); opacity: 0; transform: scale(.3); }
.kg-node.is-locked .kg-node-lock { opacity: 1; transform: none; }
.kg-node.is-org .kg-node-lock { background: var(--voltage); }
.kg-node.is-dim { opacity: .35; }

/* ---------- Product mock components (always light) ---------- */
.kp { font-family: var(--font-sans); font-size: 13px; line-height: 1.45; color: var(--text); letter-spacing: -.005em; }
.kp-pad { padding: 20px 22px; }
.kp-eyebrow { font-size: 10.5px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); }
.kp-eyebrow.is-accent { color: var(--voltage-deep); }
.kp-h1 { margin: 0; font-size: 24px; font-weight: 600; letter-spacing: -.03em; line-height: 1.12; }
.kp-h2 { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -.02em; line-height: 1.2; }
.kp-h3 { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: -.01em; line-height: 1.3; }
.kp-muted { color: var(--text-2); }
.kp-faint { color: var(--text-3); }
.kp-small { font-size: 11.5px; }
.kp-card { background: var(--snow); border: 1px solid var(--hairline); border-radius: var(--radius-lg); padding: 16px 18px; box-shadow: var(--shadow-1); }
.kp-card.is-flat { box-shadow: none; }
.kp-card.is-raised { box-shadow: var(--shadow-3); }
.kp-card.is-graphite { background: var(--graphite); color: var(--snow); border-color: rgba(255, 255, 255, .10); }
.kp-row { display: flex; align-items: center; gap: 10px; }
.kp-col { display: flex; flex-direction: column; gap: 10px; }
.kp-between { justify-content: space-between; }
.kp-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.kp-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.kp-divider { height: 1px; background: var(--hairline); border: 0; margin: 12px 0; }
.kp-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.kp-label { font-size: 11.5px; font-weight: 500; color: var(--text-2); }
.kp-input {
  height: 38px; border-radius: var(--radius-sm); border: 1px solid var(--hairline-2); background: var(--snow);
  padding: 0 12px; display: flex; align-items: center; font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden;
  transition: border-color .25s var(--ease), box-shadow .25s var(--ease);
}
.kp-input.is-placeholder { color: var(--text-4); }
.kp-input.is-focus { border-color: var(--voltage); box-shadow: var(--shadow-glow); }
.kp-input.is-auto { background: var(--mist); }
.kp-value { font-size: 14px; font-weight: 500; }
.kp-btn {
  height: 38px; padding: 0 16px; border-radius: var(--radius-md); display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-size: 13px; font-weight: 500; white-space: nowrap; border: 1px solid transparent; background: var(--snow); color: var(--text);
  border-color: var(--hairline-2);
}
.kp-btn.is-primary { background: var(--graphite); color: var(--snow); border-color: var(--graphite); }
.kp-btn.is-accent { background: var(--voltage); color: #fff; border-color: var(--voltage); }
.kp-btn.is-lg { height: 46px; font-size: 14px; border-radius: 14px; width: 100%; }
.kp-btn.is-sm { height: 30px; padding: 0 11px; font-size: 12px; border-radius: 10px; }
.kp-pill {
  display: inline-flex; align-items: center; gap: 7px; height: 24px; padding: 0 10px 0 8px; border-radius: 999px;
  background: var(--mist); border: 1px solid var(--hairline); color: var(--text); font-size: 11.5px; font-weight: 500; white-space: nowrap;
  transform-origin: 50% 50%;
}
.kp-pill > i { width: 6px; height: 6px; border-radius: 50%; background: var(--text-4); flex: none; transition: background .2s, box-shadow .2s; }
.kp-pill[data-tone="success"] > i { background: var(--success); box-shadow: 0 0 0 3px var(--success-tint); }
.kp-pill[data-tone="warning"] > i { background: var(--warning); box-shadow: 0 0 0 3px var(--warning-tint); }
.kp-pill[data-tone="danger"] > i { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-tint); }
.kp-pill[data-tone="live"] > i { background: var(--voltage); box-shadow: 0 0 0 3px var(--voltage-tint); }
.kp-alert { display: flex; gap: 10px; padding: 10px 12px; border-radius: var(--radius-md); background: var(--mist); border: 1px solid var(--hairline); font-size: 12.5px; line-height: 1.45; }
.kp-alert::before { content: ''; flex: none; width: 3px; border-radius: 3px; background: var(--text-4); }
.kp-alert[data-tone="success"]::before { background: var(--success); }
.kp-alert[data-tone="warning"]::before { background: var(--warning); }
.kp-alert[data-tone="danger"]::before { background: var(--danger); }
.kp-alert[data-tone="live"]::before { background: var(--voltage); }
.kp-kpi { background: var(--snow); border: 1px solid var(--hairline); border-radius: var(--radius-lg); padding: 12px 14px; }
.kp-kpi small { display: block; font-size: 10px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); }
.kp-kpi b { display: block; margin-top: 4px; font-size: 22px; font-weight: 600; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.kp-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.kp-table th { text-align: left; font-size: 10px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); background: var(--mist); padding: 8px 12px; border-bottom: 1px solid var(--hairline); }
.kp-table td { padding: 9px 12px; border-bottom: 1px solid var(--hairline); white-space: nowrap; }
.kp-table td.kp-mono { font-size: 11px; color: var(--text-2); }
.kp-avatar { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--fog); color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; font-size: 10.5px; font-weight: 600; }
.kp-progress { height: 6px; border-radius: 99px; background: var(--fog); overflow: hidden; }
.kp-progress i { display: block; height: 100%; width: 100%; background: var(--graphite); border-radius: inherit; transform-origin: 0 50%; transform: scaleX(var(--p, 0)); }
.kp-check { width: 18px; height: 18px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--success); color: #fff; flex: none; }
.kp-ring { position: relative; display: inline-block; }
.kp-ring svg { display: block; transform: rotate(-90deg); }
.kp-ring-track { fill: none; stroke: var(--fog); }
.kp-ring-bar { fill: none; stroke: var(--voltage); stroke-linecap: round; }
.kp-ring.is-warning .kp-ring-bar { stroke: var(--warning); }
.kp-ring-val { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 600; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }

/* ---------- Keyframes ---------- */
@keyframes kg-breath { 0%, 100% { box-shadow: 0 0 0 4px rgba(10, 132, 255, .22); } 50% { box-shadow: 0 0 0 8px rgba(10, 132, 255, .06); } }
@keyframes kg-word { to { opacity: 1; transform: none; } }
@keyframes kg-caret { 50% { opacity: 0; } }
@keyframes kg-halo { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .55; transform: scale(1.012); } }
@keyframes kg-sweep { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* ---------- Responsive ---------- */
@media (max-width: 1279px) {
  .kg-dock.has-etape .kg-dock-row { grid-template-columns: auto minmax(0, 1fr); }
  .kg-dock.has-etape .kg-etape { grid-column: 1 / -1; }
}
@media (max-width: 1023px) {
  .kg-app { grid-template-columns: minmax(0, 1fr); }
  .kg-main { padding: 0 12px 12px; }
  .kg-rail {
    position: fixed; left: 0; top: 0; bottom: 0; width: min(320px, 86vw); z-index: 60;
    background: var(--surface); border-right: 1px solid var(--line); box-shadow: var(--shadow-4);
    transform: translateX(-104%); transition: transform .35s var(--ease); visibility: hidden;
  }
  .kg-app.menu-open .kg-rail { transform: none; visibility: visible; }
  .kg-scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(14, 15, 18, .36); opacity: 0; pointer-events: none; transition: opacity .3s; }
  .kg-app.menu-open .kg-scrim { opacity: 1; pointer-events: auto; }
  .kg-top .kg-top-menu { display: inline-flex; }
  .kg-top .kg-top-brand { display: inline-flex; }
}
@media (max-width: 760px) {
  .kg-app { height: auto; min-height: 100vh; overflow: visible; }
  body { overflow-x: hidden; }
  .kg-main { padding: 0 16px calc(84px + env(safe-area-inset-bottom, 0px)); }
  .kg-top { position: sticky; top: 0; z-index: 30; background: var(--bg); min-height: 52px; gap: 8px; }
  .kg-top .kg-top-brand { display: none; }
  .kg-top-home span { display: none; }
  .kg-top-home { padding: 0 11px; }
  .kg-stage { flex: none; height: min(118vw, 60vh); min-height: 300px; margin: 0 -16px; border-radius: 0; border-left: 0; border-right: 0; }
  .kg-dock { margin-top: 10px; border-radius: 22px; overflow: visible; background: transparent; border: 0; box-shadow: none; }
  .kg-dock-row, .kg-dock.has-etape .kg-dock-row { display: flex; flex-direction: column; gap: 12px; padding: 0; }
  .kg-caption { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 14px 16px; width: 100%; }
  .kg-etape { grid-template-columns: 1fr; width: 100%; padding-top: 0; }
  .kg-controls {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; justify-content: center; gap: 10px;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
    background: var(--surface); border-top: 1px solid var(--line);
  }
  .kg-segs { position: fixed; left: 0; right: 0; bottom: calc(68px + env(safe-area-inset-bottom, 0px)); z-index: 41; padding: 0 16px; height: 10px; background: var(--surface); gap: 6px; }
  .kg-seg-group { gap: 2px; }
  .kg-cap-title { font-size: 17px; }
  .kg-cap-text { font-size: 14.5px; }
  .kg-etape-chip { left: 10px; top: 10px; height: 30px; font-size: 12px; max-width: calc(100% - 20px); }
  .kg-etape-chip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .kg-resume { display: none; }
  .kg-floats { right: 10px; top: 46px; gap: 4px; }
  .kg-etape-chip[hidden] ~ .kg-floats { top: 10px; }
  .kg-floats .kg-sample { height: 20px; font-size: 9px; padding: 0 7px; }
  .kg-floats .kg-maquette { height: 22px; font-size: 10.5px; }
  .kg-etape { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
  .kg-etape-col { padding: 10px 11px 11px; border-radius: 14px; }
  .kg-etape-col h3 { font-size: 9.5px; letter-spacing: .08em; line-height: 1.35; align-items: flex-start; margin-bottom: 7px; }
  .kg-etape-col h3 i { margin-top: 3px; flex: none; }
  .kg-etape-col ul { gap: 8px; }
  .kg-etape-col li { font-size: 12.5px; line-height: 1.38; flex-direction: column; align-items: flex-start; gap: 3px; }
  .kg-etape-col li::before { display: none; }
  .kg-who { font-size: 9.5px; padding: 1px 6px; }
  .kg-cover { overflow: visible; }
  .kg-cover-hero { border-radius: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0s !important; animation-delay: 0s !important; transition-duration: 0s !important; }
  .kg-w { opacity: 1; transform: none; }
}

/* Language switch (ES default, FR for review). */
.kg-lang { display: inline-flex; flex: none; height: 38px; padding: 3px; gap: 2px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); }
.kg-lang-btn { min-width: 34px; height: 30px; padding: 0 9px; border-radius: 999px; border: 0; background: transparent; color: var(--fg-3); font: 600 11.5px var(--font-mono); letter-spacing: .06em; cursor: pointer; }
.kg-lang-btn:hover { color: var(--fg); }
.kg-lang-btn.is-on { background: var(--fg); color: var(--bg); }
.kg-lang-btn:focus-visible { outline: 2px solid var(--voltage); outline-offset: 2px; }

/* ---------- Embed mode (?embed=1: an iframe of the kwhiz.es home drives the chapters) ----------
   The host sizes the frame as a fixed box (about 520 to 720px wide on a desktop, 315px on a
   phone), so one layout serves every width: the scene fills what the dock leaves, the dock is
   static under it (never fixed over the caption), and the two "what each side does" columns
   stay for the full page. These rules outrank the narrow and drawer blocks above by specificity. */
.kg-app.is-embed { grid-template-columns: minmax(0, 1fr); height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
.kg-app.is-embed .kg-rail, .kg-app.is-embed .kg-scrim, .kg-app.is-embed .kg-top, .kg-app.is-embed .kg-cover { display: none !important; }
.kg-app.is-embed .kg-main { display: flex; flex-direction: column; min-height: 0; padding: 12px; }
.kg-app.is-embed .kg-stage { flex: 1 1 auto; height: auto; min-height: 220px; margin: 0; border-radius: var(--radius-xl); border: 1px solid var(--line); }
.kg-app.is-embed .kg-dock { flex: none; margin-top: 10px; border-radius: var(--radius-xl); background: var(--surface); border: 1px solid var(--line); box-shadow: none; overflow: hidden; }
.kg-app.is-embed .kg-segs { position: static; height: 14px; padding: 0 14px; background: transparent; gap: 6px; }
.kg-app.is-embed .kg-dock .kg-dock-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 2px 14px 12px; }
.kg-app.is-embed .kg-caption { background: transparent; border: 0; border-radius: 0; padding: 0; width: auto; }
.kg-app.is-embed .kg-cap-title { font-size: 15px; }
.kg-app.is-embed .kg-cap-text { font-size: 13.5px; line-height: 1.5; max-width: none; }
.kg-app.is-embed .kg-controls { position: static; justify-content: flex-start; gap: 6px; padding: 0; background: transparent; border: 0; }
.kg-app.is-embed .kg-ctrl { width: 36px; height: 36px; }
.kg-app.is-embed .kg-etape { display: none; }
.kg-app.is-embed .kg-resume { display: inline-flex; }
