/* Shared Cofactor keyboard: ONE component used by the hero phone and both race lanes.
   Light tokens mirror KeyboardPanelPalette (light) in
   ios/LocalFlowiOS/Sources/LocalFlowKeyboard/LocalFlowKeyboardViewController.swift:
   keys localKeyboardKey, toolbar and chips localKeyboardPanelControl, panels localKeyboardPanelBackground,
   mic localKeyboardButtonFill. The keyboard paints no background of its own: the host keyboard area
   (system gray) shows through. Only the Listening and tools panels paint the panel color. */
.cfkb{--k-key:#FDFEFF;--k-ctl:#EAEDF4;--k-panel:#F2F3F7;--k-stroke:rgba(0,0,0,.12);--k-edge:rgba(0,0,0,.22);--k-ink:#13161C;--k-ink2:#545F78;--k-accent:#1F5CDB;
  position:relative;height:262px;color:var(--k-ink);font-family:-apple-system,BlinkMacSystemFont,"SF Pro Text",var(--font);font-size:14px;line-height:1.3;text-align:left;user-select:none}
.cfkb svg{display:block;width:18px;height:18px;flex:none;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.cfkb .cfkb-p{display:none;position:absolute;inset:0}
.cfkb[data-pane="keys"] .cfkb-p-keys,.cfkb[data-pane="tools"] .cfkb-p-tools,.cfkb[data-pane="phrases"] .cfkb-p-phrases,.cfkb[data-pane="listen"] .cfkb-p-listen{display:flex;flex-direction:column}
.cfkb-p-keys{padding:0 4px}
.cfkb-p-tools,.cfkb-p-phrases,.cfkb-p-listen{background:var(--k-panel);padding:8px 12px 10px}
.cfkb .is-pressed{filter:brightness(.9)}

/* toolbar: icon-only mic, tone chip, Cofactor Tools (line.3.horizontal) */
.cfkb-bar{display:flex;align-items:center;gap:8px;height:44px;margin:8px 2px 0;flex:none}
.cfkb-mic{width:44px;height:44px;flex:none;border-radius:8px;background:var(--k-accent);color:#fff;display:grid;place-items:center;box-shadow:inset 0 0 0 1px rgba(255,255,255,.34),0 4px 10px rgba(31,92,219,.34)}
.cfkb-mic svg{width:19px;height:19px;fill:currentColor;stroke:none}
.cfkb-mic svg path{fill:none;stroke:currentColor;stroke-width:2.2}
.cfkb-tone{display:inline-flex;align-items:center;height:38px;padding:0 14px;border-radius:12px;background:var(--k-ctl);box-shadow:inset 0 0 0 1px var(--k-edge);font-size:14px;font-weight:600;white-space:nowrap}
.cfkb-ops{margin-left:auto;width:44px;height:44px;flex:none;border-radius:10px;background:var(--k-ctl);display:grid;place-items:center}
.cfkb-ops svg{width:18px;height:18px}

/* keys */
.cfkb-rows{display:flex;flex-direction:column;gap:10px;margin-top:10px}
.cfkb-row{display:flex;gap:6px}
.cfkb-row.ind{padding:0 18px}
.cfkb-k{flex:1 1 0;min-width:0;height:40px;border-radius:8px;background:var(--k-key);box-shadow:inset 0 0 0 1px var(--k-stroke);display:flex;align-items:center;justify-content:center;font-size:21px;line-height:1;color:var(--k-ink)}
.cfkb-k.fn{flex:1.45 1 0;font-size:15px;font-weight:600}
.cfkb-k.sp{flex:4.2 1 0}
.cfkb-k.ret{flex:2 1 0;font-size:14px;font-weight:600}
.cfkb-k svg{width:18px;height:18px}

/* Polished bar: the notice row above the keys (automatic-correction pattern in the keyboard source) */
.cfkb-polish{position:absolute;top:8px;left:8px;right:8px;height:44px;z-index:2;display:flex;align-items:center;gap:8px;padding:0 6px 0 12px;border-radius:12px;background:var(--k-key);box-shadow:inset 0 0 0 1px var(--k-stroke),0 3px 10px rgba(0,0,0,.14);opacity:0;visibility:hidden;transition:opacity .4s ease,visibility .4s ease}
.cfkb.polish-on .cfkb-polish{opacity:1;visibility:visible}
.cfkb-polish-msg{flex:1;min-width:0;display:flex;align-items:center;gap:5px;font-size:12px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.cfkb-polish-msg svg{width:15px;height:15px;color:var(--k-accent)}
.cfkb-undo{flex:none;padding:6px 4px;font-size:12.5px;font-weight:700;color:var(--k-accent)}
.cfkb-keep{flex:none;height:30px;padding:0 12px;border-radius:9px;background:var(--k-accent);color:#fff;font-size:12.5px;font-weight:700;display:flex;align-items:center}

/* tools and Saved Phrases panels */
.cfkb-head{position:relative;height:40px;flex:none;display:flex;align-items:center;justify-content:center;font-size:15px;font-weight:700}
.cfkb-head .cfkb-x,.cfkb-head .cfkb-back{position:absolute;top:0;width:40px;height:40px;border-radius:10px;background:var(--k-ctl);display:grid;place-items:center;font-size:14px;font-weight:700}
.cfkb-head .cfkb-x{right:0}
.cfkb-head .cfkb-back{left:0}
.cfkb-head .cfkb-back svg{width:18px;height:18px}
.cfkb-intro{margin:6px 2px 12px;font-size:12px;font-weight:500;color:var(--k-ink2)}
.cfkb-action{display:flex;align-items:center;gap:8px;height:50px;padding:0 12px;border-radius:10px;background:var(--k-ctl);font-size:12.5px;font-weight:600}
.cfkb-action svg{width:20px;height:20px}
.cfkb-phrase{display:flex;align-items:center;gap:8px;min-height:58px;margin-top:8px;padding:6px 4px 6px 12px;border-radius:10px;background:var(--k-ctl)}
.cfkb-phrase-body{flex:1;min-width:0;display:flex;flex-direction:column;gap:3px}
.cfkb-phrase-body b{font-size:13px;font-weight:700}
.cfkb-phrase-body span{font-size:11.5px;font-weight:500;color:var(--k-ink2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.cfkb-insert{width:44px;height:44px;flex:none;display:grid;place-items:center;color:var(--k-accent)}
.cfkb-insert svg{width:18px;height:18px}

/* Listening panel: cancel, mic source, tone, submit, waveform, live words */
.cfkb-lbar{display:flex;align-items:center;gap:8px;height:38px;flex:none}
.cfkb-pbtn{width:42px;height:34px;flex:none;border-radius:11px;background:var(--k-ctl);box-shadow:inset 0 0 0 1px var(--k-edge);display:grid;place-items:center;font-size:17px;font-weight:700}
.cfkb-src{flex:1 1 auto;min-width:0;height:38px;display:flex;align-items:center;gap:6px;padding:0 10px;border-radius:12px;background:var(--k-ctl);box-shadow:inset 0 0 0 1px var(--k-edge);font-size:11.5px;font-weight:500;color:var(--k-ink2);white-space:nowrap;overflow:hidden}
.cfkb-src svg{width:12px;height:12px}
.cfkb-status{margin-top:12px;text-align:center;font-size:17px;font-weight:600;letter-spacing:-.01em;line-height:1.2}
.cfkb-wave{height:34px;margin-top:10px;display:flex;align-items:center;justify-content:center;gap:5px}
.cfkb-wave i{display:block;width:6px;border-radius:3px;background:var(--k-accent);opacity:.85;transform:scaleY(.4);animation:cfkb-bar .85s ease-in-out infinite alternate}
.cfkb-wave i:nth-child(3n){animation-duration:.6s}
.cfkb-wave i:nth-child(4n+1){animation-duration:1.05s}
@keyframes cfkb-bar{from{transform:scaleY(.22)}to{transform:scaleY(1)}}
.cfkb-live{flex:1;min-height:0;margin-top:8px;padding:0 6px;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;align-content:flex-start;text-align:center;font-size:13px;line-height:1.4;color:var(--k-ink2)}

/* Apple keyboard (typing lane): iOS light keyboard, QuickType bar, white keys, gray modifiers, white callout */
.apk{position:relative;height:262px;display:flex;flex-direction:column;background:#D1D3D9;color:#000;font-family:-apple-system,BlinkMacSystemFont,"SF Pro Text",var(--font);text-align:left;user-select:none;padding:0 3px}
.apk-sugg{display:flex;height:44px;flex:none}
.apk-sugg span{position:relative;flex:1 1 0;min-width:0;display:flex;align-items:center;justify-content:center;font-size:16px;white-space:nowrap;overflow:hidden}
.apk-sugg span+span:before{content:'';position:absolute;left:0;top:10px;bottom:10px;width:1px;background:#B4B8C0}
.apk-rows{display:flex;flex-direction:column;gap:11px;padding-top:8px;flex:1}
.apk-row{display:flex;gap:6px}
.apk-row.ind{padding:0 16px}
.apk-k{flex:1 1 0;min-width:0;height:42px;border-radius:6px;background:#FFFFFF;box-shadow:0 1px 0 rgba(0,0,0,.32);display:flex;align-items:center;justify-content:center;font-size:22px;line-height:1}
.apk-k.fn{flex:1.45 1 0;background:#ADB3BE;font-size:16px}
.apk-k.sp{flex:4.2 1 0}
.apk-k.ret{flex:2 1 0;background:#ADB3BE;font-size:16px}
.apk svg{display:block;width:18px;height:18px;fill:none;stroke:#000;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.apk-callout{position:absolute;left:0;top:0;display:none;height:56px;border-radius:12px 12px 10px 10px;background:#FFFFFF;box-shadow:0 2px 8px rgba(0,0,0,.28),0 0 0 .5px rgba(0,0,0,.08);color:#000;font-size:30px;line-height:56px;text-align:center;pointer-events:none;z-index:3}
.apk-callout.show{display:block}

/* Gmail-style compose host (all three lanes) */
.gm{height:100%;display:flex;flex-direction:column;background:#FFFFFF;color:#202124;font-size:14px;line-height:1.4;text-align:left}
.gm-top{height:48px;flex:none;display:flex;align-items:center;justify-content:space-between;padding:0 14px 0 16px;border-bottom:1px solid #E3E5EA;font-size:15px;font-weight:600}
.gm-send{width:34px;height:34px;border-radius:50%;background:#E8F0FE;color:#0B57D0;display:grid;place-items:center}
.gm-send svg{width:17px;height:17px}
.gm-row{height:42px;flex:none;display:flex;align-items:center;gap:12px;padding:0 16px;border-bottom:1px solid #E3E5EA}
.gm-k{width:56px;flex:none;color:#5F6368}
.gm-v{min-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
.gm-body{flex:1;min-height:0;overflow:hidden;padding:12px 16px;font-size:15px;line-height:1.5;white-space:pre-wrap;overflow-wrap:anywhere;color:#202124}

/* race section layout */
.race .head{max-width:760px;margin:0 auto 40px}
.race-eyebrow{color:var(--accent-ink);font-weight:600}
.race-phones{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:clamp(16px,2.4vw,28px);max-width:1080px;margin:0 auto}
.race-lane{min-width:0;display:flex;flex-direction:column}
.race-label{display:flex;align-items:baseline;justify-content:space-between;flex-wrap:wrap;gap:6px 12px;margin-bottom:14px}
.race-label h3{font-size:1rem;font-weight:650;line-height:1.3}
.race-time{font:600 clamp(1.5rem,2.6vw,2.1rem) var(--mono);font-variant-numeric:tabular-nums;letter-spacing:-.04em;white-space:nowrap;color:var(--fg)}
.race-phone{border:6px solid var(--phone-edge);border-radius:30px;overflow:hidden;background:#FFFFFF;color:#000;box-shadow:0 16px 40px #00000012;display:flex;flex-direction:column}
.race-app{height:340px;flex:none}
.race-kb{height:262px;flex:none;background:#D1D3D9}
.race-progress{height:5px;background:var(--line-strong);margin-top:16px;overflow:hidden;border-radius:2px}
.race-progress-fill{display:block;width:0;height:100%;background:var(--muted)}
.race-lane[data-lane="phrase"] .race-progress-fill,.race-lane[data-lane="voice"] .race-progress-fill{background:#1F5CDB}
.race-lane.finished .race-time{color:var(--accent-ink)}
.race-stage{margin-top:14px;color:var(--muted);font-size:.9rem;line-height:1.45;min-height:2.9em}
.race-footer{max-width:1080px;margin:32px auto 0;display:flex;justify-content:space-between;align-items:flex-start;gap:24px}
.race-result{font-weight:600;font-size:clamp(1rem,2vw,1.25rem);line-height:1.4}
.race-result-times{margin-top:10px;display:flex;flex-direction:column;gap:4px;color:var(--muted);font:500 .95rem var(--mono)}
.race-result-times span{white-space:nowrap}
.race-footer button{cursor:pointer;font-family:inherit}
.race-controls{display:flex;flex-wrap:wrap;gap:16px}
.race-note{margin:24px auto 0;max-width:1080px;font-size:.875rem;color:var(--muted);line-height:1.6}
.race-accessible{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
@media (max-width:900px){.race-phones{grid-template-columns:1fr;max-width:420px;gap:48px}.race-footer{max-width:420px;flex-direction:column;align-items:flex-start}}
@media (max-width:600px){.race .head{margin-bottom:28px}.race-phone{border-width:4px;border-radius:24px}.race-app{height:340px}}

/* motion: reduced-motion and ?static=1 show the end state with no animation */
@media (prefers-reduced-motion:reduce){.cfkb-wave i{animation:none;transform:scaleY(.7)}.cfkb-polish{transition:none}}
.cfkb-wave i:nth-child(odd){transform:scaleY(.8)}
