/* KeyShadow site. Palette comes from the app icon: slate tile, frosted glass, and the
   mint-to-blue keycap that casts the 影. Amber marks initials and teal marks finals, as in the app. */
:root {
  --font-body: "Instrument Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --font-hanzi: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

:root,
:root[data-theme="graphite"] {
  color-scheme: dark;
  --bg: #0b1018;
  --bg-tail: #080c12;
  --surface: #131b28;
  --surface-soft: #1a2433;
  --ink: #eaf0f8;
  --muted: #8e9bb0;
  --muted-strong: #c3cddc;
  --line: rgba(234, 240, 248, 0.09);
  --line-strong: rgba(234, 240, 248, 0.2);
  --accent: #4c9dff;
  --accent-soft: rgba(76, 157, 255, 0.16);
  --accent-ink: #071222;
  --initial: #f2c27c;
  --initial-soft: rgba(242, 194, 124, 0.14);
  --initial-ink: #0b1018;
  --final: #7cf0d6;
  --shadow-from: #7cf0d6;
  --shadow-to: #3e95ff;
  --glow-top: rgba(43, 140, 255, 0.14);
  --keyboard-shadow: rgba(43, 140, 255, 0.34);
  --header-bg: rgba(11, 16, 24, 0.82);
  --shadow: 0 24px 70px rgba(2, 6, 12, 0.45);
}

:root[data-theme="cream"] {
  color-scheme: light;
  --bg: #eef2f7;
  --bg-tail: #e4e9f1;
  --surface: #ffffff;
  --surface-soft: #f4f7fb;
  --ink: #0b2447;
  --muted: #55657f;
  --muted-strong: #2d3e5c;
  --line: rgba(11, 36, 71, 0.1);
  --line-strong: rgba(11, 36, 71, 0.2);
  --accent: #1f6fe0;
  --accent-soft: rgba(31, 111, 224, 0.1);
  --accent-ink: #ffffff;
  --initial: #a86a12;
  --initial-soft: rgba(168, 106, 18, 0.12);
  --initial-ink: #ffffff;
  --final: #0e8a76;
  --shadow-from: #13b496;
  --shadow-to: #2b6fff;
  --glow-top: rgba(124, 240, 214, 0.22);
  --keyboard-shadow: rgba(43, 111, 255, 0.3);
  --header-bg: rgba(238, 242, 247, 0.85);
  --shadow: 0 18px 44px rgba(11, 36, 71, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition: none !important;
  }
}

body {
  display: flex;
  min-width: 320px;
  min-height: 100vh;
  min-height: 100svh;
  flex-direction: column;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(80% 50% at 50% -12%, var(--glow-top), transparent 70%),
    var(--bg);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

main {
  flex: 1 0 auto;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  text-wrap: balance;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.page-shell {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
}

.skip-link {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 20;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  transform: translateY(-160%);
}

.skip-link:focus-visible {
  transform: none;
}

/* Header */
.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--header-bg);
}

.nav {
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: space-between;
  gap: 10px 18px;
  flex-wrap: wrap;
}

/* Header proportions and controls follow the aix.uy homepage. */
.brand {
  display: inline-flex;
  min-width: 0;
  flex-shrink: 0;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.brand img {
  width: 26px;
  height: 26px;
  border-radius: 6px;
}

.brand-sub {
  color: var(--muted);
  font-weight: 500;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-right: 8px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.05em;
}

.language-trigger,
.control-button {
  display: inline-grid;
  width: 32px;
  height: 32px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted-strong);
  cursor: pointer;
  transition:
    color 160ms ease,
    background-color 160ms ease;
}

.language-trigger {
  font: 500 11.5px/1 var(--font-mono);
}

.language-trigger:hover,
.control-button:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.control-icon {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-moon,
:root[data-theme="cream"] .icon-sun {
  display: none;
}

:root[data-theme="cream"] .icon-moon {
  display: block;
}

.nav-links a {
  color: var(--muted-strong);
}

.nav-links a:hover,
.nav-links a:focus-visible {
  color: var(--accent);
}

.external-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
}

.external-icon {
  font-size: 0.9em;
  line-height: 1;
}

.segmented-control {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface);
}

.segmented-option {
  min-height: 30px;
  padding: 5px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted-strong);
  font: 500 12px/1 var(--font-mono);
  letter-spacing: 0.02em;
  cursor: pointer;
}

.segmented-option:hover {
  color: var(--ink);
}

.segmented-option.is-active {
  background: var(--accent);
  color: var(--accent-ink);
}

/* Platform: the head script sets html[data-platform] before first paint; macOS is the no-script default. */
:root:not([data-platform="windows"]) [data-platform="windows"],
:root[data-platform="windows"] [data-platform="mac"] {
  display: none !important;
}

:root:not([data-platform="windows"]) [data-platform-choice="mac"],
:root[data-platform="windows"] [data-platform-choice="windows"] {
  background: var(--accent);
  color: var(--accent-ink);
}

/* Hero: text, the live demo, then platform + download. Wide screens put the demo beside the text. */
.hero {
  display: grid;
  grid-template-areas:
    "text"
    "stage"
    "actions";
  gap: 28px;
  padding: clamp(28px, 4vw, 48px) 0 clamp(56px, 8vw, 96px);
}

.hero-text {
  grid-area: text;
  min-width: 0;
}

/* Under the demo the row is centered; beside it (wide screens) it lines up with the text. */
.hero-actions {
  grid-area: actions;
  justify-content: center;
}

/* The download button matches the platform toggle's height and corners. */
.hero-actions .button {
  min-height: 38px;
  padding: 0 18px;
  border-radius: 9px;
}

.github-icon {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

/* The demo keyboard floats over its own blue shadow. */
.hero-stage {
  position: relative;
  grid-area: stage;
  min-width: 0;
  isolation: isolate;
  container-type: inline-size;
}

/* The preview sits centered in a frame sized for the full-mode demo (the app window is 820 x 344,
   plus the 35 px status line), so switching views or compact mode never moves the buttons above
   or the download row below. */
.stage-frame {
  display: grid;
  align-items: center;
  min-height: calc(min(100cqw, 860px) * 0.422 + 37px);
}

/* Phones use the taller narrow keyboard, so the frame follows its measured height. */
@container (max-width: 560px) {
  .stage-frame {
    min-height: calc(100cqw * 0.92 + 37px);
  }
}

.hero-stage::before {
  position: absolute;
  z-index: -1;
  inset: 8% 0 -12%;
  background: radial-gradient(48% 52% at 50% 58%, var(--keyboard-shadow), transparent 72%);
  content: "";
  opacity: 0.6;
  pointer-events: none;
}

@media (min-width: 1160px) {
  .hero {
    grid-template-columns: minmax(0, 460px) minmax(0, 1fr);
    grid-template-areas:
      "text stage"
      "actions stage";
    /* Top-aligned so switching views or compact mode only grows the stage downward;
       the view bar and the text column never move. */
    grid-template-rows: auto 1fr;
    align-items: start;
    column-gap: 48px;
    row-gap: 30px;
  }

  .hero .hero-title-row {
    gap: 12px 16px;
  }

  .hero .hero-title-latin {
    font-size: 28px;
  }

  .hero-text {
    align-self: start;
  }

  .hero-actions {
    align-self: start;
    justify-content: flex-start;
  }

  .hero .hero-title {
    font-size: 92px;
  }
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 22px;
  color: var(--muted);
  font: 500 12px/1.4 var(--font-mono);
  letter-spacing: 0.04em;
}

.eyebrow::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--final);
  box-shadow: 0 0 0 4px var(--accent-soft);
  content: "";
}

.hero-title-row {
  display: flex;
  align-items: baseline;
  gap: 12px 22px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.hero-title {
  display: flex;
  align-items: baseline;
  gap: 0 0.2em;
  flex-wrap: wrap;
  margin: 0;
  font-size: clamp(64px, 10vw, 128px);
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0;
}

.hero-hanzi {
  display: flex;
  gap: 0.04em;
}

/* Each character carries the two keys that type it in the selected scheme. */
.glyph {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
}

.glyph-char {
  font-family: var(--font-hanzi);
  font-weight: 900;
}

/* 影 is 键's shadow: the same mint-to-blue as the icon's shadow keycap. */
.glyph-shadow {
  background: linear-gradient(140deg, var(--shadow-from) 10%, var(--shadow-to) 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.chord {
  display: flex;
  gap: 6px;
  margin-top: 18px;
  font-size: 13px;
}

.cap {
  display: inline-grid;
  min-width: 30px;
  height: 30px;
  place-items: center;
  margin: 0;
  padding: 0 7px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 3px;
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  font: 600 13px/1 var(--font-mono);
  transition:
    transform 110ms ease,
    border-bottom-width 110ms ease,
    background-color 110ms ease;
}

.cap-initial {
  border-bottom-color: var(--initial);
  color: var(--initial);
}

.cap-final {
  border-bottom-color: var(--final);
  color: var(--final);
}

/* Lit while the demo types this character's keys. */
.cap.is-lit {
  border-bottom-width: 1px;
  background: var(--accent-soft);
  transform: translateY(2px);
}

.hero-title-latin {
  color: var(--muted);
  font-family: var(--font-body);
  font-size: clamp(22px, 2.8vw, 38px);
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* 周抛软件: meant to be uninstalled once the layout sticks. */
.disposable-badge {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--initial);
  color: var(--initial-ink);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.hero-copy {
  max-width: 38em;
  margin-bottom: 0;
  text-wrap: pretty;
  color: var(--muted-strong);
  font-size: clamp(17px, 1.9vw, 20px);
  line-height: 1.65;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 12px 16px;
  flex-wrap: wrap;
}

.button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  transition:
    transform 140ms ease,
    box-shadow 140ms ease;
}

.button-primary {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 12px 30px -14px var(--keyboard-shadow);
}

.button-primary:hover {
  box-shadow: 0 18px 38px -14px var(--keyboard-shadow);
  transform: translateY(-1px);
}

.text-link {
  gap: 7px;
  color: var(--muted-strong);
  font-size: 15px;
  font-weight: 500;
}

.text-link:hover,
.text-link:focus-visible {
  color: var(--accent);
}

.view-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px 18px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.view-tabs {
  display: flex;
}

/* Compact mode applies to both the demo and the screenshot. */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 4px 2px;
  border: 0;
  background: none;
  color: var(--muted-strong);
  font: 500 12px/1 var(--font-mono);
  cursor: pointer;
}

.switch-track {
  position: relative;
  width: 30px;
  height: 18px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-soft);
  transition:
    background-color 150ms ease,
    border-color 150ms ease;
}

.switch-track::after {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--muted);
  content: "";
  transition:
    transform 150ms ease,
    background-color 150ms ease;
}

.switch[aria-pressed="true"] .switch-track {
  border-color: var(--accent);
  background: var(--accent);
}

.switch[aria-pressed="true"] .switch-track::after {
  background: var(--accent-ink);
  transform: translateX(12px);
}

.switch:hover {
  color: var(--ink);
}

.screen-figure {
  width: min(100%, 860px);
  margin: 0 auto;
  /* Same space as the demo's status line, so both previews center at the same height. */
  padding-bottom: 35px;
}

.screen-figure img {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 34px 60px rgba(2, 6, 12, 0.32));
}

/* Rows: a label in the margin, content beside it. */
.row {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  column-gap: 56px;
  padding: 56px 0;
  border-top: 1px solid var(--line);
}

.row-label {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.5;
}

.row-body {
  min-width: 0;
  margin: 0;
}

.feature-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 30px 56px;
}

.feature-list dt {
  margin-bottom: 6px;
  font-size: 16px;
  font-weight: 700;
}

.feature-list dd {
  margin: 0;
  color: var(--muted);
}

.usage {
  display: grid;
  max-width: 680px;
  gap: 18px;
}

.steps {
  display: grid;
  gap: 14px;
  margin: 0 0 6px;
  padding: 0;
  list-style: none;
  counter-reset: steps;
}

/* Step numbers are keycaps: these are the keys you would press next. */
.steps li {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 14px;
  align-items: baseline;
  counter-increment: steps;
}

.steps li::before {
  display: inline-grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-bottom-width: 3px;
  border-radius: 7px;
  background: var(--surface);
  color: var(--muted-strong);
  content: counter(steps);
  font: 600 13px/1 var(--font-mono);
}

.usage-note {
  margin: 0;
  color: var(--muted);
}

.usage-note a {
  color: var(--accent);
  font-weight: 600;
}

kbd {
  display: inline-block;
  min-width: 1.8em;
  padding: 1px 6px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface);
  color: var(--ink);
  font: 500 0.82em/1.5 var(--font-mono);
  text-align: center;
}

/* Changelog entries; site.js renders the same markup from docs/changelog.json. */
.release-list {
  display: grid;
  gap: 32px;
}

.release-card {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  column-gap: 28px;
}

.release-header {
  display: flex;
  grid-row: 1 / span 2;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.release-version {
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted-strong);
  font: 600 12px/1.4 var(--font-mono);
}

.release-card.is-current .release-version {
  background: var(--accent);
  color: var(--accent-ink);
}

.release-date {
  color: var(--muted);
  font: 500 12px/1.4 var(--font-mono);
}

.release-card h3 {
  margin: 0 0 10px;
  font-size: 18px;
  line-height: 1.35;
}

.release-card ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 1.1em;
  color: var(--muted);
}

.release-more {
  margin: 26px 0 0;
  font-size: 14px;
}

.release-more a {
  color: var(--muted-strong);
  font-weight: 500;
}

.release-more a:hover,
.release-more a:focus-visible {
  color: var(--accent);
}

.more-apps {
  padding-bottom: 72px;
}

.more-apps .row-body {
  grid-column: 2;
}

.more-apps a {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-size: clamp(20px, 2.4vw, 26px);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.more-apps img {
  width: 32px;
  height: 32px;
}

.more-apps .arrow {
  color: var(--accent);
  transition: transform 160ms ease;
}

.more-apps a:hover,
.more-apps a:focus-visible {
  color: var(--accent);
}

.more-apps a:hover .arrow,
.more-apps a:focus-visible .arrow {
  transform: translateX(4px);
}

/* Footer */
.site-footer {
  padding: 22px 0 30px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font: 500 12px/1.6 var(--font-mono);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.site-footer a {
  color: var(--muted-strong);
}

.site-footer a:hover,
.site-footer a:focus-visible {
  color: var(--accent);
}

/* Privacy and support documents */
.document-main {
  padding: 56px 0 80px;
}

.document-main .page-shell {
  width: min(760px, calc(100% - 40px));
}

.document {
  padding: clamp(24px, 4vw, 40px);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.document h1 {
  margin-bottom: 8px;
  font-size: clamp(32px, 5vw, 46px);
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.document h2 {
  margin: 34px 0 10px;
  font-size: 20px;
  line-height: 1.3;
}

.document p,
.document li {
  color: var(--muted);
}

.document ul {
  display: grid;
  gap: 8px;
  padding-left: 20px;
}

.document code {
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--surface-soft);
  color: var(--muted-strong);
  font-family: var(--font-mono);
  font-size: 0.86em;
  overflow-wrap: anywhere;
}

.contact {
  color: var(--accent);
  font-weight: 600;
}

.updated {
  margin-bottom: 26px;
  color: var(--muted);
  font: 500 12px/1.6 var(--font-mono);
}

/* ===== Keyboard demo =====
   Geometry follows the app: 70 x 58 keys on a 78 px pitch inside an 820 px panel.
   Rows are laid out on 20 half-key columns so every row offset stays exact at any width. */
.demo {
  --ks-background: #171f2b;
  --ks-ink: #edf4f6;
  --ks-muted: #9cadbc;
  --ks-final: #89e4d1;
  --ks-initial: #fac882;
  --ks-border: #3f4e5e;
  --ks-button: #24303e;
  --ks-button-hover: #3e4d5e;
  --ks-key: #232e3c;
  --ks-special-key: #303131;
  --ks-special-border: #705e44;
  --ks-active-key: #3d746a;
  --ks-next-key: #254342;
  --ks-key-border: #384757;
  --ks-guide: #1d2a36;
  width: min(100%, 860px);
  margin: 0 auto;
  container-type: inline-size;
}

.demo-panel {
  padding: 0.73cqw 2.93cqw 1.34cqw;
  border: 1px solid var(--ks-border);
  border-radius: clamp(12px, 2.2cqw, 18px);
  background: var(--ks-background);
  box-shadow: 0 48px 110px -48px var(--keyboard-shadow), var(--shadow);
  color: var(--ks-ink);
}

.demo-board {
  position: relative;
  border-radius: 10px;
  outline: none;
}

.demo-board:focus-visible {
  box-shadow: 0 0 0 3px var(--ks-final);
}

.demo-keys {
  display: grid;
  grid-template-columns: repeat(20, minmax(0, 1fr));
  row-gap: 0.73cqw;
  margin: 0 -0.49cqw;
}

.ks-key {
  position: relative;
  display: flex;
  min-width: 0;
  aspect-ratio: 70 / 58;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  grid-column: span 2;
  margin: 0 0.49cqw;
  padding: 0 0 0.9cqw;
  border: 1px solid var(--ks-key-border);
  border-radius: clamp(5px, 1.1cqw, 9px);
  background: var(--ks-key);
  color: var(--ks-ink);
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.ks-key.is-special {
  border-color: var(--ks-special-border);
  background: var(--ks-special-key);
}

.ks-key.is-next {
  border-color: var(--ks-final);
  background: var(--ks-next-key);
}

.ks-key.is-active {
  border-color: var(--ks-final);
  background: var(--ks-active-key);
}

.ks-letter {
  position: absolute;
  top: 0.5cqw;
  left: 1.35cqw;
  font-size: clamp(12px, 2.2cqw, 18px);
  font-weight: 800;
  line-height: 1.5;
}

.ks-initial {
  position: absolute;
  top: 0.85cqw;
  right: 0.6cqw;
  min-width: 3.4cqw;
  color: var(--ks-initial);
  font-size: clamp(9px, 1.46cqw, 12px);
  font-weight: 800;
  line-height: 1.5;
  text-align: center;
}

.ks-final {
  display: flex;
  max-width: 100%;
  justify-content: center;
  flex-wrap: wrap;
  color: var(--ks-final);
  font-size: clamp(9px, 1.46cqw, 12px);
  line-height: 1.25;
  white-space: nowrap;
}

.ks-final.is-long {
  font-size: clamp(9px, 1.22cqw, 10px);
}

.ks-final span + span::before {
  content: "/";
}

.demo-board.is-dimmed .ks-key:not(.is-next):not(.is-active) .ks-letter,
.demo-board.is-dimmed .ks-key:not(.is-next):not(.is-active) .ks-final {
  color: var(--ks-muted);
}

.ks-key.is-utility {
  justify-content: center;
  padding: 0;
  color: var(--ks-muted);
  font-size: clamp(10px, 1.46cqw, 12px);
  line-height: 1.3;
}

.ks-key.is-utility:hover,
.ks-key.is-utility:focus-visible {
  border-color: var(--ks-final);
  color: var(--ks-final);
  outline: none;
}

.ks-key.is-utility[aria-pressed="true"] {
  color: var(--ks-final);
}

.ks-utility-mark {
  display: block;
  font-size: 1.1em;
  line-height: 1;
}

.demo-guide {
  display: flex;
  min-height: 4.51cqw;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 1.46cqw;
  padding: 0 1.46cqw;
  border-radius: 8px;
  background: var(--ks-guide);
  font-size: clamp(11px, 1.46cqw, 12px);
}

.demo-prompt {
  min-width: 0;
  color: var(--ks-final);
  white-space: pre-wrap;
}

.demo-legend {
  display: flex;
  flex: 0 0 auto;
  gap: 2.4cqw;
}

.demo-legend .is-initial {
  color: var(--ks-initial);
}

.demo-legend .is-final {
  color: var(--ks-final);
}

.demo-legend .is-muted {
  color: var(--ks-muted);
}

.demo-toolbar {
  display: flex;
  gap: 0.98cqw;
  flex-wrap: wrap;
  margin-top: 0.49cqw;
}

.ks-control {
  position: relative;
  display: inline-flex;
  min-height: clamp(20px, 3.41cqw, 28px);
  align-items: center;
  flex: 1 1 auto;
  justify-content: center;
  padding: 0 clamp(6px, 1.2cqw, 12px);
  border: 0;
  border-radius: 7px;
  background: var(--ks-button);
  color: var(--ks-ink);
  font: inherit;
  font-size: clamp(10px, 1.34cqw, 12px);
  white-space: nowrap;
  cursor: pointer;
}

.ks-control:hover,
.ks-control:focus-within {
  background: var(--ks-button-hover);
}

.ks-control:focus-visible,
.ks-control:has(select:focus-visible) {
  outline: 2px solid var(--ks-final);
  outline-offset: 1px;
}

.ks-control select {
  position: absolute;
  inset: 0;
  width: 100%;
  opacity: 0;
  cursor: pointer;
}

.ks-control[aria-pressed="true"],
.ks-control[aria-expanded="true"] {
  color: var(--ks-final);
}

.demo-rules {
  margin: 0.98cqw 0 0;
  padding: 10px 1.46cqw;
  border-radius: 8px;
  background: var(--ks-guide);
  color: var(--ks-muted);
  font-size: clamp(11px, 1.34cqw, 12px);
  list-style: none;
}

.demo-rules li + li {
  margin-top: 4px;
}

.demo.is-collapsed .demo-board > :not(.demo-reveal),
.demo.is-collapsed .demo-toolbar,
.demo.is-collapsed .demo-rules {
  visibility: hidden;
}

.demo-reveal {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  border: 1px dashed var(--ks-border);
  border-radius: 10px;
  background: transparent;
  color: var(--ks-muted);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.demo-reveal[hidden] {
  display: none;
}

.demo-reveal:hover,
.demo-reveal:focus-visible {
  border-color: var(--ks-final);
  color: var(--ks-final);
  outline: none;
}

/* The app's top bar and settings that don't apply on a web page: shown, not clickable. */
.demo-topbar {
  display: flex;
  align-items: center;
  height: 6.34cqw;
  margin: 0 0 0.98cqw -0.73cqw;
  color: var(--ks-muted);
  font-size: clamp(9px, 1.22cqw, 10px);
  pointer-events: none;
  user-select: none;
}

.demo-logo {
  width: 6.34cqw;
  min-width: 26px;
  height: auto;
  flex: 0 0 auto;
}

.demo-stepper {
  display: flex;
  align-items: center;
  gap: 0.98cqw;
  margin-left: 4.4cqw;
}

.demo-stepper:first-of-type {
  margin-left: 13.9cqw;
}

.demo-topbar-value {
  min-width: 6.1cqw;
  color: var(--ks-ink);
  font-size: clamp(9px, 1.34cqw, 11px);
  text-align: center;
}

.demo-topbar-actions {
  display: flex;
  gap: 1.46cqw;
  margin-left: auto;
}

.ks-static {
  display: inline-grid;
  min-width: 3.4cqw;
  height: 3.4cqw;
  min-height: 22px;
  place-items: center;
  padding: 0 0.7cqw;
  border-radius: 0.85cqw;
  background: var(--ks-button);
  color: var(--ks-ink);
  font-size: clamp(9px, 1.34cqw, 11px);
}

.ks-static.is-wide {
  min-width: 6.8cqw;
}

.ks-control.is-static {
  cursor: default;
  pointer-events: none;
  user-select: none;
}

.ks-control.is-on {
  color: var(--ks-final);
}

.demo.is-collapsed .demo-topbar {
  visibility: hidden;
}

/* The compact window keeps only the keys, inset 12 px like the app's. */
.demo.is-compact .demo-panel {
  padding: 1.46cqw;
}

.demo.is-compact .demo-topbar,
.demo.is-compact .demo-guide,
.demo.is-compact .demo-toolbar,
.demo.is-compact .demo-rules {
  display: none;
}

.demo-status {
  min-height: 19px;
  margin: 16px 0 0;
  color: var(--muted);
  font: 500 12px/1.6 var(--font-mono);
  text-align: center;
}

.demo-status::before {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--muted);
  content: "";
  vertical-align: 0.1em;
}

.demo[data-state="autoplay"] .demo-status::before {
  background: var(--initial);
}

.demo[data-state="idle"] .demo-status::before {
  background: var(--muted);
}

.demo[data-state="listening"] .demo-status::before {
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

/* Narrow keyboards: taller keys with stacked alternatives so every label stays readable. */
@container (max-width: 560px) {
  .ks-key {
    aspect-ratio: 33 / 54;
    padding-bottom: 3px;
  }

  .ks-letter {
    top: 2px;
    left: 4px;
    line-height: 1.2;
  }

  .ks-initial {
    top: 3px;
    right: 2px;
    min-width: 0;
  }

  .ks-final,
  .ks-final.is-long {
    flex-direction: column;
    font-size: 9px;
    line-height: 1.05;
  }

  .ks-final span + span::before {
    content: none;
  }

  .ks-key.is-utility {
    font-size: 9px;
  }

  .demo-legend,
  .demo-stepper,
  .ks-control.is-static {
    display: none;
  }

  .demo-topbar {
    height: auto;
    margin: 4px 0 8px;
  }

  .demo-panel {
    padding: 2.9cqw;
  }

  .ks-control {
    min-height: 28px;
  }

  .demo-guide {
    padding: 6px 8px;
  }

  .ks-control {
    flex-basis: calc(50% - 4px);
  }
}

/* Responsive page layout */
@media (max-width: 860px) {
  .row {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 18px;
    padding: 40px 0;
  }

  .more-apps .row-body {
    grid-column: 1;
  }
}

@media (max-width: 620px) {
  .feature-list {
    grid-template-columns: minmax(0, 1fr);
    gap: 22px;
  }

  .release-card {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 10px;
  }

  .release-header {
    grid-row: auto;
    flex-direction: row;
    align-items: center;
  }

  .document {
    padding: 22px;
  }
}

@media (max-width: 420px) {
  /* Keeps the logo, the AiX.uy link, and both toggles on one row on phones. */
  .brand-sub {
    display: none;
  }

  .segmented-option {
    padding: 5px 8px;
  }

  .chord {
    gap: 4px;
    margin-top: 12px;
  }

  .cap {
    min-width: 26px;
    height: 26px;
    padding: 0 5px;
    font-size: 12px;
  }
}
