:root {
  --bg: #000000;
  --card: #141416;
  --ink: #f4f4f6;
  --soft: rgba(244, 244, 246, 0.56);
  --line: rgba(244, 244, 246, 0.12);
  --accent: #8f9dff;
  --warn: #ff7a66;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Mona Sans Variable", "Mona Sans", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.stage {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  padding: 10px 12px;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; outline: none; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.kr { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; width: min(348px, 100%); padding: 18px 16px 16px; border-radius: 26px; background: var(--card); box-shadow: inset 0 0 0 1px var(--line), inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 30px 50px -30px rgba(0, 0, 0, 0.9); }
.kr__head { display: grid; gap: 2px; padding: 0 2px; }
.kr__head strong { font-size: 17px; line-height: 21px; font-weight: 740; letter-spacing: -0.012em; }
.kr__head span { font-size: 12.500px; line-height: 16px; font-weight: 600; color: var(--soft); }

/* the field: the keycaps in the middle, or the invitation to type while it listens; the mark sits on the right */
.kr__field { --turn: 0deg; --lit: 0; position: relative; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; height: 60px; border-radius: 18px; background: rgba(0, 0, 0, 0.36); box-shadow: inset 0 0 0 1.500px var(--line), inset 0 2px 6px rgba(0, 0, 0, 0.5); cursor: pointer; transition: box-shadow 0.3s ease; }
.kr__field.is-listening { box-shadow: inset 0 0 0 1.500px color-mix(in srgb, var(--accent) 55%, transparent), inset 0 2px 6px rgba(0, 0, 0, 0.5), 0 0 0 4px color-mix(in srgb, var(--accent) 14%, transparent); }
.kr__field.is-taken { box-shadow: inset 0 0 0 1.500px color-mix(in srgb, var(--warn) 70%, transparent), inset 0 2px 6px rgba(0, 0, 0, 0.5), 0 0 0 4px color-mix(in srgb, var(--warn) 14%, transparent); }
/* a light running round the border while the field listens */
.kr__glow { position: absolute; inset: 0; border-radius: inherit; padding: 1.500px; background: conic-gradient(from var(--turn), transparent 0deg, transparent 250deg, var(--accent) 330deg, #ffffff 352deg, transparent 360deg); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); mask-composite: exclude; opacity: var(--lit); pointer-events: none; }
.kr__keys, .kr__ask { grid-area: 1 / 1; }
.kr__keys { display: flex; justify-content: center; align-items: center; gap: 6px; max-width: 100%; padding: 0 40px; }
.kr__ask { font-size: 13.500px; font-weight: 640; color: var(--soft); white-space: nowrap; opacity: 0; pointer-events: none; }
.kr__key { position: relative; display: block; }
.kr__cap { display: grid; place-items: center; min-width: 34px; height: 32px; padding: 0 10px; border-radius: 9px; background: linear-gradient(180deg, #3a3a40 0%, #2a2a2f 100%); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), inset 0 0 0 1px rgba(255, 255, 255, 0.05), 0 3px 0 #0b0b0d, 0 6px 8px -2px rgba(0, 0, 0, 0.6); font-size: 13px; line-height: 1; font-weight: 700; white-space: nowrap; transition: background 0.25s ease, color 0.25s ease; }
.kr__key.is-held .kr__cap { background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 42%, #2a2a2f) 0%, color-mix(in srgb, var(--accent) 28%, #2a2a2f) 100%); }
.is-taken .kr__cap { background: linear-gradient(180deg, color-mix(in srgb, var(--warn) 46%, #2a2a2f) 0%, color-mix(in srgb, var(--warn) 30%, #2a2a2f) 100%); }
.kr__mark { position: absolute; right: 14px; top: 50%; width: 20px; height: 20px; margin-top: -10px; fill: none; stroke-width: 2.200; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.kr__mark path { stroke-dasharray: 1; stroke-dashoffset: 1; }
.kr__ok { stroke: var(--accent); }
.kr__no { stroke: var(--warn); }

.kr__status { padding: 0 2px; }
.kr__clip { display: block; height: 16px; line-height: 16px; overflow: hidden; white-space: nowrap; }
.kr__clip span { display: block; overflow: hidden; text-overflow: ellipsis; }
.kr__status .kr__clip { font-size: 12.500px; font-weight: 620; color: var(--soft); transition: color 0.25s ease; }
.kr__status.is-warn .kr__clip { color: var(--warn); }
.kr__status.is-good .kr__clip { color: var(--accent); }

.kr__others { display: grid; grid-template-columns: minmax(0, 1fr); list-style: none; border-radius: 14px; background: rgba(244, 244, 246, 0.04); box-shadow: inset 0 0 0 1px rgba(244, 244, 246, 0.05); }
.kr__others li { display: flex; justify-content: space-between; align-items: center; gap: 10px; height: 36px; padding: 0 10px 0 12px; font-size: 13px; font-weight: 640; box-shadow: inset 0 -1px 0 rgba(244, 244, 246, 0.06); }
.kr__others li:last-child { box-shadow: none; }
.kr__others li > span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kr__mini { flex: none; display: flex; gap: 4px; }
.kr__mini kbd { display: grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 6px; background: rgba(244, 244, 246, 0.09); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 1.500px 0 rgba(0, 0, 0, 0.6); font: inherit; font-size: 11px; line-height: 1; font-weight: 700; color: var(--soft); transition: background 0.3s ease, color 0.3s ease; }
.kr__others li.is-clash kbd { background: color-mix(in srgb, var(--warn) 34%, transparent); color: #ffffff; }

.kr__acts { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.kr__btn { display: grid; place-items: center; height: 44px; border-radius: 22px; font-size: 14px; font-weight: 720; white-space: nowrap; }
.kr__btn--main { background: var(--ink); color: #0c0c0e; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.12), 0 14px 20px -12px rgba(244, 244, 246, 0.3); }
.kr__btn--ghost { padding: 0 20px; box-shadow: inset 0 0 0 1.500px rgba(244, 244, 246, 0.2); }
.kr__btn:focus-visible { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--ink); }

.ghost { position: absolute; left: 0; top: 0; width: 24px; height: 24px; margin: -3px 0 0 -5px; transform-origin: 20% 15%; pointer-events: none; opacity: 0; fill: #ffffff; stroke: #0c0c0e; stroke-width: 1.300; stroke-linejoin: round; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5)); z-index: 6; }

@media (hover: hover) { .kr__btn--ghost:hover { box-shadow: inset 0 0 0 1.500px var(--ink); } }
@media (max-width: 350px) { .kr { padding: 16px 13px 14px; } .kr__cap { min-width: 30px; padding: 0 8px; font-size: 12.500px; } .kr__keys { padding: 0 34px; gap: 5px; } }
@media (max-height: 400px) { .kr { gap: 8px; } .kr__field { height: 54px; } }
@media (prefers-reduced-motion: reduce) { .kr__field, .kr__cap, .kr__mini kbd, .kr__status .kr__clip { transition: none; } }
