/* Crave Games kit: the look.
   docs/STYLE.md made real: tokens, base styles, and every shared component.
   Every page that uses the kit loads this file. Components are built by
   client/kit/ui.js; the classes here (all prefixed k-) can also be used by hand.

   Contents
     1. Fonts            5. Buttons and key caps    9. Call sign and timer        13. Pick list, tiles, seats
     2. Tokens           6. Cards, chips, tags     10. Modal, lists, podium       14. Boards: line, pixels, pad,
     3. Base             7. Meters and text input  11. Effects and backgrounds        markers, race
     4. Utilities        8. Toasts                 12. Reduced motion                                          */

/* 1. Fonts. Unbounded for headings and numbers, Google Sans Flex for the rest.
      If the fonts cannot load (offline), the stacks fall back to Segoe UI. */
@import url('https://fonts.googleapis.com/css2?family=Unbounded:wght@400..900&family=Google+Sans+Flex:wght@400..700&display=swap');

/* 2. Tokens */
:root {
  /* palette */
  --bg: #000000;
  --card: #141414;
  --card-2: #262626;
  --rule: #3A3A3A;
  --text: #F6F3F0;
  --text-2: #CCCCCC;
  --muted: #8B8687;
  --lime: #DCFF00;
  --green: #37FE75;
  --purple: #6400F8;
  --lavender: #9580C8;
  --danger: #FF4D5E;
  --warn: #FFB020;

  /* player and group colours */
  --p-coral: #FF6B5E;
  --p-amber: #FFB020;
  --p-lime: #DCFF00;
  --p-green: #37FE75;
  --p-teal: #2FD6C3;
  --p-sky: #4DA8FF;
  --p-blue: #3B6BFF;
  --p-violet: #8A4DFF;
  --p-pink: #FF5EC4;
  --p-lavender: #9580C8;
  --p-sand: #E8D5A8;
  --p-white: #F6F3F0;

  /* each game sets its own accent on its root; everything else stays shared */
  --accent: var(--lime);

  /* type: sizes hold at 620 by 540 and grow with the smaller side of the window */
  --font-head: 'Unbounded', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Google Sans Flex', 'Segoe UI', system-ui, sans-serif;
  --fs-label: clamp(12px, calc(9.6px + 0.44vmin), 14px);
  --fs-body: clamp(14px, calc(9.2px + 0.89vmin), 18px);
  --fs-lead: clamp(16px, calc(10px + 1.11vmin), 22px);
  --fs-h3: clamp(16px, calc(8.8px + 1.33vmin), 24px);
  --fs-h2: clamp(20px, calc(8px + 2.22vmin), 34px);
  --fs-h1: clamp(26px, calc(6.8px + 3.55vmin), 52px);
  --fs-hero: clamp(40px, calc(4px + 6.67vmin), 96px);

  /* space */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: clamp(10px, 1.85vmin, 14px);
  --sp-4: clamp(12px, 2.4vmin, 20px);
  --sp-5: clamp(16px, 3.3vmin, 28px);
  --sp-6: clamp(24px, 4.8vmin, 44px);
  --gap: var(--sp-3);
  --pad: var(--sp-4);

  /* shape */
  --r-1: 8px;
  --r-2: 12px;
  --r-3: 16px;
  --r-4: 20px;
  --r-5: 24px;
  --r-pill: 999px;
  --lip: clamp(4px, 0.9vmin, 7px);
  --btn-h: clamp(40px, 7.4vmin, 52px);

  /* motion: arrive with a spring (250 to 450 ms), leave fast (120 to 200 ms) */
  --t-press: 60ms;
  --t-out: 150ms;
  --t-in: 380ms;
  --stagger: 40ms;
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --k-motion: 1;       /* multiplies every distance in the kit's keyframes; 0 with reduced motion */
  --k-loop: running;   /* idle loops; paused with reduced motion */

  /* layers */
  --z-modal: 1000;
  --z-toast: 1100;
  --z-wipe: 1200;
  --z-fx: 1300;
}

/* 3. Base */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  height: 100%;
  background: var(--bg);
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 var(--fs-body) / 1.4 var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
  /* a game is pressed, not read: fast clicks must not select text */
  -webkit-user-select: none;
  user-select: none;
}

h1,
h2,
h3,
h4,
p,
figure {
  margin: 0;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

input,
textarea,
.k-select {
  -webkit-user-select: text;
  user-select: text;
}

a {
  color: var(--lime);
}

:focus-visible {
  outline: 3px solid var(--lime);
  outline-offset: 3px;
}

:focus:not(:focus-visible) {
  outline: none;
}

k-life {
  display: none !important;
}

/* 4. Utilities */
.k-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  /* clip, not hidden: a clipped box cannot be scrolled by focus or scrollIntoView */
  overflow: hidden;
  overflow: clip;
}

.k-stack {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  min-width: 0;
}

.k-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--gap);
  min-width: 0;
}

.k-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(var(--min, 140px), 1fr));
  gap: var(--gap);
  min-width: 0;
}

.k-centre,
.k-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.k-fill {
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
}

.k-wrap {
  flex-wrap: wrap;
}

.k-between {
  justify-content: space-between;
}

.k-end {
  justify-content: flex-end;
}

.k-top {
  align-items: flex-start;
}

.k-stretch {
  align-items: stretch;
}

.k-gap-s {
  gap: var(--sp-2);
}

.k-gap-l {
  gap: var(--sp-5);
}

.k-pad {
  padding: var(--pad);
}

.k-scroll {
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--rule) transparent;
}

/* there is more below: the last lines fade out (ui.scrollFade keeps the class up to date) */
.k-scroll.is-more {
  -webkit-mask-image: linear-gradient(#000 calc(100% - 30px), transparent);
  mask-image: linear-gradient(#000 calc(100% - 30px), transparent);
}

.k-hide {
  display: none !important;
}

.k-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.k-clip {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.k-h1 {
  font: 800 var(--fs-h1) / 1.05 var(--font-head);
  letter-spacing: -0.035em;
}

.k-h2 {
  font: 700 var(--fs-h2) / 1.1 var(--font-head);
  letter-spacing: -0.03em;
}

.k-h3 {
  font: 700 var(--fs-h3) / 1.15 var(--font-head);
  letter-spacing: -0.02em;
}

.k-hero {
  font: 800 var(--fs-hero) / 1 var(--font-head);
  letter-spacing: -0.04em;
}

.k-lead {
  font-size: var(--fs-lead);
}

.k-small {
  font-size: var(--fs-label);
}

/* numbers, timers and scores: Unbounded, with digits that do not jiggle as they count */
.k-num {
  display: inline-block;
  font-family: var(--font-head);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.k-label {
  font: 600 var(--fs-label) / 1.2 var(--font-body);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.k-caps {
  text-transform: uppercase;
}

.k-dim {
  color: var(--text-2);
}

.k-muted {
  color: var(--muted);
}

.k-accent {
  color: var(--accent);
}

.k-good {
  color: var(--green);
}

.k-bad {
  color: var(--danger);
}

.k-warn {
  color: var(--warn);
}

.k-divider {
  height: 2px;
  margin: 0;
  border: 0;
  background: var(--rule);
}

.k-icon {
  flex: none;
  width: 1.2em;
  height: 1.2em;
  vertical-align: -0.22em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.k-shape {
  flex: none;
  width: 1em;
  height: 1em;
  vertical-align: -0.12em;
}

/* the server said no (fx.nope) */
.is-no {
  outline: 2px solid var(--danger);
  outline-offset: 2px;
}

/* 5. Buttons and key caps */
.k-btn {
  --btn-face: #303030;
  --btn-lip: #181818;
  --btn-ink: var(--text);
  --btn-edge: var(--rule);
  --btn-ring: var(--lime);
  --btn-lip-h: var(--lip);
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  display: inline-flex;
  flex: none;
  width: fit-content; /* never stretched by a stack or a grid: use wide for that */
  max-width: 100%;
  margin: 0;
  padding: 0 0 var(--btn-lip-h);
  border: 0;
  border-radius: var(--r-3);
  background: none;
  color: var(--btn-ink);
  font: 600 var(--fs-body) / 1.15 var(--font-body);
  vertical-align: middle;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

/* the lip the face lands on */
.k-btn::before {
  content: '';
  position: absolute;
  inset: var(--btn-lip-h) 0 0;
  border-radius: inherit;
  background: var(--btn-lip);
  box-shadow: inset 0 0 0 2px var(--btn-edge);
}

.k-btn__face {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  width: 100%;
  min-height: var(--btn-h);
  padding: 0.45em 1.05em;
  border-radius: inherit;
  background: var(--btn-face);
  box-shadow: inset 0 0 0 2px var(--btn-edge), inset 0 3px 0 -1px rgba(255, 255, 255, 0.1);
  transition: transform 240ms var(--ease-spring), filter 120ms ease-out, box-shadow 120ms ease-out;
}

.k-btn__label {
  min-width: 0;
  text-align: center;
}

.k-btn__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.k-btn__sub {
  font-size: var(--fs-label);
  font-weight: 500;
  opacity: 0.72;
}

@media (hover: hover) {
  .k-btn:hover:not(:disabled) .k-btn__face {
    filter: brightness(1.12);
    transform: translateY(-1px);
  }
}

/* pressing moves the face down onto the lip, fast; letting go springs back */
.k-btn:active:not(:disabled) .k-btn__face,
.k-btn.is-pressed:not(:disabled) .k-btn__face {
  transform: translateY(var(--btn-lip-h));
  filter: brightness(0.94);
  transition-duration: var(--t-press);
  transition-timing-function: ease-out;
}

.k-btn--primary {
  --btn-face: var(--lime);
  --btn-lip: #8FA600;
  --btn-ink: #000000;
  --btn-edge: transparent;
  --btn-ring: #FFFFFF;
  font-weight: 700;
}

.k-btn--primary .k-btn__face {
  box-shadow: inset 0 3px 0 -1px rgba(255, 255, 255, 0.55);
}

.k-btn--primary:not(:disabled)::before {
  box-shadow: 0 8px 26px -8px rgba(220, 255, 0, 0.55);
}

.k-btn--danger {
  --btn-face: var(--danger);
  --btn-lip: #A32636;
  --btn-ink: #000000;
  --btn-edge: transparent;
  --btn-ring: #FFFFFF;
  font-weight: 700;
}

.k-btn--danger .k-btn__face,
.k-btn--color .k-btn__face {
  box-shadow: inset 0 3px 0 -1px rgba(255, 255, 255, 0.35);
}

.k-btn--ghost {
  --btn-face: #0C0C0C;
  --btn-lip: #2C2C2C;
  --btn-ink: var(--text-2);
}

.k-btn--color {
  --btn-edge: transparent;
  --btn-ring: #FFFFFF;
  font-weight: 700;
}

.k-btn--big {
  --btn-h: clamp(52px, 9.6vmin, 72px);
  --btn-lip-h: calc(var(--lip) + 2px);
  border-radius: var(--r-4);
  font: 700 var(--fs-lead) / 1.1 var(--font-head);
  letter-spacing: -0.02em;
}

.k-btn--big .k-btn__face {
  padding: 0.5em 1.3em;
}

.k-btn--wide {
  display: flex;
  width: 100%;
}

.k-btn.is-selected .k-btn__face {
  transform: translateY(calc(var(--btn-lip-h) * 0.5));
  box-shadow: inset 0 0 0 3px var(--btn-ring), 0 0 20px -2px color-mix(in srgb, var(--btn-ring) 60%, transparent);
}

.k-btn.is-no .k-btn__face {
  box-shadow: inset 0 0 0 3px var(--danger);
}

.k-btn.is-no {
  outline: none;
}

.k-btn:disabled {
  cursor: default;
}

.k-btn:disabled::before {
  background: #111111;
  box-shadow: inset 0 0 0 2px #232323;
}

.k-btn:disabled .k-btn__face {
  transform: translateY(calc(var(--btn-lip-h) * 0.6));
  background: #1B1B1B;
  color: var(--muted);
  box-shadow: inset 0 0 0 2px #2A2A2A;
  filter: none;
}

.k-btn:disabled .k-key {
  opacity: 0.4;
}

.k-btn .k-key {
  margin-right: -0.3em;
}

/* a tile: the key cap sits in the top-left corner and the label keeps clear of it */
.k-btn--keycorner .k-btn__face {
  min-width: 5.6em;
  min-height: calc(var(--btn-h) * 1.5);
  padding: calc(var(--fs-label) * 1.9 + 13px) 0.9em 0.6em;
}

.k-btn--keycorner .k-key {
  position: absolute;
  top: 7px;
  left: 7px;
  margin: 0;
}

/* a key cap: a small rounded square with a lip */
.k-key {
  --key-face: var(--text);
  --key-lip: #A29D99;
  --key-ink: #0B0B0B;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: fit-content;
  min-width: 1.9em;
  height: 1.9em;
  margin: 0;
  padding: 0 0.4em;
  border-radius: 0.5em;
  background: var(--key-face);
  color: var(--key-ink);
  box-shadow: 0 0.22em 0 var(--key-lip);
  font: 700 var(--fs-label) / 1 var(--font-body);
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
  vertical-align: middle;
  transform: translateY(-0.11em);
  transition: transform 90ms ease-out, box-shadow 90ms ease-out;
}

.k-key--word {
  padding: 0 0.6em;
}

.k-key--sm {
  font-size: 12px;
}

.k-key .k-icon {
  width: 1.2em;
  height: 1.2em;
  stroke-width: 3;
  vertical-align: 0;
}

.k-key.is-down,
.k-btn.is-pressed .k-key,
.k-btn:active:not(:disabled) .k-key {
  transform: translateY(0.11em);
  box-shadow: 0 0 0 var(--key-lip);
}

/* on a bright face the key cap turns dark so it still reads as a key */
.k-btn--primary .k-key,
.k-btn--danger .k-key,
.k-btn--color .k-key {
  --key-face: #101010;
  --key-lip: rgba(0, 0, 0, 0.42);
  --key-ink: var(--text);
}

/* 6. Cards, chips, avatars, name tags */
.k-card {
  position: relative;
  min-width: 0;
  padding: var(--pad);
  border: 2px solid var(--rule);
  border-radius: var(--r-4);
  background: var(--card);
}

.k-card--raised {
  border-color: #4A4A4A;
  background: var(--card-2);
}

.k-card--tight {
  padding: var(--sp-3);
}

/* soft coloured glows instead of drop shadows */
.k-card--glow {
  --glow: var(--accent);
  border-color: var(--glow);
  box-shadow: 0 0 36px -8px color-mix(in srgb, var(--glow) 60%, transparent);
}

.k-panel {
  min-width: 0;
  padding: var(--sp-3);
  border: 2px solid var(--rule);
  border-radius: var(--r-3);
  background: var(--card);
}

.k-chip {
  --chip: var(--text-2);
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  width: fit-content;
  max-width: 100%;
  padding: 0.3em 0.75em;
  border: 1.5px solid color-mix(in srgb, var(--chip) 55%, transparent);
  border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--chip) 15%, transparent);
  color: color-mix(in srgb, var(--chip) 72%, white);
  font: 600 var(--fs-label) / 1.2 var(--font-body);
  white-space: nowrap;
  vertical-align: middle;
}

.k-chip--solid {
  border-color: transparent;
  background: var(--chip);
  color: var(--chip-ink, #000000);
}

.k-chip__dot {
  flex: none;
  width: 0.62em;
  height: 0.62em;
  border-radius: 50%;
  background: var(--chip);
}

.k-chip--solid .k-chip__dot {
  background: currentColor;
}

.k-chip__text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.k-avatar {
  --k-av: 40px;
  position: relative;
  display: inline-block;
  flex: none;
  width: var(--k-av);
  height: var(--k-av);
  vertical-align: middle;
}

/* idle screens are alive: every avatar breathes, each on its own beat */
.k-avatar__critter {
  display: block;
  width: 100%;
  height: 100%;
  transform-origin: 50% 94%;
  animation: k-breathe 3.6s ease-in-out infinite;
  animation-delay: var(--k-delay, 0s);
  animation-play-state: var(--k-loop);
}

.k-avatar__photo {
  display: block;
  width: 100%;
  height: 100%;
  border: 2px solid var(--rule);
  border-radius: 50%;
  object-fit: cover;
}

.k-avatar.is-away {
  opacity: 0.5;
  filter: grayscale(0.7);
}

@keyframes k-breathe {
  50% {
    transform: scale(calc(1 - 0.012 * var(--k-motion)), calc(1 + 0.032 * var(--k-motion)));
  }
}

.k-tag {
  --tag: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  width: fit-content;
  min-width: 0;
  max-width: 100%;
  padding: 3px 0.8em 3px 4px;
  border: 1.5px solid color-mix(in srgb, var(--tag) 45%, var(--rule));
  border-radius: var(--r-pill);
  background: var(--card-2);
  font-weight: 600;
  line-height: 1.15;
  vertical-align: middle;
}

.k-tag__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.k-tag__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.k-tag__sub {
  overflow: hidden;
  color: var(--muted);
  font-size: var(--fs-label);
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.k-tag__dot {
  flex: none;
  width: 0.8em;
  height: 0.8em;
  margin-left: 0.45em;
  border-radius: 50%;
  background: var(--tag);
}

.k-tag__you {
  flex: none;
  padding: 0.18em 0.5em;
  border-radius: var(--r-pill);
  background: var(--lime);
  color: #000000;
  font: 700 12px / 1.2 var(--font-body);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.k-tag.is-you {
  border-color: var(--lime);
}

.k-tag.is-away {
  border-style: dashed;
}

.k-tag.is-away .k-tag__name {
  color: var(--muted);
}

/* 7. Meters and text input */
.k-meter {
  --meter: var(--accent);
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.k-meter__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-2);
  color: var(--text-2);
  font-size: var(--fs-label);
  font-weight: 600;
}

.k-meter__value {
  color: var(--text);
  font-size: var(--fs-body);
}

.k-meter__track {
  position: relative;
  height: clamp(14px, 2.6vmin, 20px);
  overflow: hidden;
  border-radius: var(--r-pill);
  background: var(--card-2);
  box-shadow: inset 0 0 0 2px var(--rule);
}

.k-meter__fill {
  position: relative;
  width: 0;
  height: 100%;
  overflow: hidden;
  border-radius: inherit;
  background: linear-gradient(180deg, color-mix(in srgb, var(--meter) 78%, white), var(--meter) 55%, color-mix(in srgb, var(--meter) 78%, black));
  transition: width 520ms var(--ease-spring);
}

.k-meter__fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.6) 50%, transparent 70%);
  transform: translateX(-120%);
}

.k-meter.is-moving .k-meter__fill::after {
  animation: k-shine 640ms ease-out;
}

.k-meter.is-full .k-meter__track {
  box-shadow: inset 0 0 0 2px var(--meter), 0 0 16px -2px var(--meter);
}

.k-meter--thin .k-meter__track {
  height: 8px;
}

@keyframes k-shine {
  to {
    transform: translateX(120%);
  }
}

.k-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: var(--sp-2);
  width: 100%;
  min-width: 0;
}

.k-input--send {
  grid-template-columns: minmax(0, 1fr) auto;
}

.k-input__box {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
  height: calc(var(--btn-h) + var(--lip));
  border-radius: var(--r-3);
  background: #1D1D1D;
  box-shadow: inset 0 0 0 2px var(--lime), 0 0 0 4px rgba(220, 255, 0, 0.14);
  transition: box-shadow 140ms ease-out, background-color 140ms ease-out;
}

.k-input__el {
  flex: 1;
  align-self: stretch;
  min-width: 0;
  padding: 0 0.85em;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  caret-color: var(--lime);
  font: 500 var(--fs-lead) / 1.2 var(--font-body);
}

.k-input__el::placeholder {
  color: var(--muted);
  opacity: 1;
}

/* the keyboard is going somewhere else: say so */
.k-input.is-idle .k-input__box {
  background: var(--card-2);
  box-shadow: none;
  outline: 2px dashed var(--lime);
  outline-offset: -2px;
  animation: k-beckon 1.5s ease-in-out infinite;
}

.k-input.is-idle .k-input__el::placeholder {
  color: var(--lime);
}

.k-input.is-idle:not(.is-empty) .k-input__el {
  color: var(--text-2);
}

.k-input__hint {
  display: none;
  align-items: center;
  flex: none;
  gap: 0.3em;
  margin-right: 0.6em;
  padding: 0.3em 0.65em;
  border-radius: var(--r-pill);
  background: var(--lime);
  color: #000000;
  font: 700 var(--fs-label) / 1 var(--font-body);
  pointer-events: none;
}

.k-input.is-idle:not(.is-empty):not(.is-locked):not(.is-disabled) .k-input__hint {
  display: inline-flex;
}

.k-input__count {
  flex: none;
  margin-right: 0.85em;
  color: var(--muted);
  font: 600 var(--fs-label) / 1 var(--font-body);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

/* an empty field asking for a click needs its words whole: "0/24" says nothing yet */
.k-input.is-idle.is-empty .k-input__count {
  display: none;
}

.k-input.is-near .k-input__count {
  color: var(--warn);
}

.k-input.is-full .k-input__count {
  color: var(--danger);
}

.k-input__send {
  align-self: stretch;
}

/* nothing typed yet: the button waits as a ghost, with its key cap as bright as ever
   (the one key a newcomer needs must never be the faintest thing on the screen) */
.k-input__send.is-idle {
  --btn-face: #0C0C0C;
  --btn-lip: #2C2C2C;
  --btn-ink: var(--text-2);
  --btn-edge: var(--rule);
  font-weight: 600;
}

.k-input__send.is-idle .k-btn__face {
  box-shadow: inset 0 0 0 2px var(--btn-edge), inset 0 3px 0 -1px rgba(255, 255, 255, 0.1);
}

.k-input__send.is-idle::before {
  box-shadow: inset 0 0 0 2px var(--btn-edge);
}

.k-input__send.is-idle .k-key {
  --key-face: var(--text);
  --key-lip: #A29D99;
  --key-ink: #0B0B0B;
}

.k-input__send:disabled .k-key {
  opacity: 1;
}

/* sent: the press has landed, and the button says so for the rest of the phase */
.k-input__send.is-sent {
  --btn-face: #12301C;
  --btn-lip: #0B1D11;
  --btn-ink: var(--green);
  --btn-edge: var(--green);
  cursor: default;
  pointer-events: none;
}

.k-input__send.is-sent .k-btn__face {
  transform: translateY(calc(var(--btn-lip-h) * 0.6));
  background: var(--btn-face);
  box-shadow: inset 0 0 0 2px var(--green);
  color: var(--btn-ink);
}

.k-input__send.is-sent::before {
  background: var(--btn-lip);
  box-shadow: none;
}

.k-input__send.is-sent .k-key {
  display: none;
}

.k-input__send .k-input__sent {
  display: none;
}

.k-input__send.is-sent .k-input__sent {
  display: inline-block;
}

/* no Send button: the Enter key cap sits inside the field, and a click on it sends */
.k-input__enter {
  flex: none;
  margin-right: 0.6em;
  cursor: pointer;
}

.k-input.is-locked .k-input__enter,
.k-input.is-empty .k-input__enter {
  opacity: 0.55;
}

.k-input__msg {
  display: none;
  grid-column: 1 / -1;
  color: var(--text-2);
  font-size: var(--fs-label);
  font-weight: 600;
}

.k-input__msg.is-on {
  display: block;
}

.k-input__msg.is-bad {
  color: var(--danger);
}

.k-input__box.is-no {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--danger), 0 0 0 4px rgba(255, 77, 94, 0.18);
  animation: none;
}

.k-input.is-disabled {
  opacity: 0.5;
}

.k-input.is-disabled .k-input__box {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--rule);
  animation: none;
}

.k-input__lock {
  display: none;
  align-items: center;
  flex: 1;
  gap: 0.5em;
  min-width: 0;
  padding: 0 0.85em;
  color: var(--green);
  font: 600 var(--fs-lead) / 1.2 var(--font-body);
}

.k-input__locktext {
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.k-input.is-locked .k-input__lock {
  display: flex;
}

.k-input.is-locked .k-input__el,
.k-input.is-locked .k-input__count {
  display: none;
}

.k-input.is-locked .k-input__box {
  outline: none;
  background: color-mix(in srgb, var(--green) 9%, var(--card));
  box-shadow: inset 0 0 0 2px var(--green);
  animation: none;
}

@keyframes k-beckon {
  50% {
    outline-color: color-mix(in srgb, var(--lime) 35%, transparent);
  }
}

/* The last seconds show where the player is looking, not only on the clock: any text field
   inside an element marked data-urgent (the shell marks the play area) beats in amber. */
[data-urgent] .k-input:not(.is-locked):not(.is-disabled) .k-input__box {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--warn), 0 0 0 4px rgba(255, 176, 32, 0.18);
  animation: k-beat-soft 1s ease-out infinite;
}

[data-urgent] .k-input:not(.is-locked):not(.is-disabled) .k-input__el {
  caret-color: var(--warn);
}

@keyframes k-beat-soft {
  0%,
  45%,
  100% {
    transform: scale(1);
  }
  14% {
    transform: scale(calc(1 + 0.018 * var(--k-motion)));
  }
}

/* 8. Toasts. They hang just under the top bar, newest lowest, and never over the foot of the
      window, which is where a game puts the thing its players type in. */
.k-toasts {
  position: fixed;
  top: var(--k-toast-top, clamp(70px, 12vmin, 96px));
  left: 50%;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: max-content;
  max-width: min(92vw, 560px);
  pointer-events: none;
  transform: translateX(-50%);
}

.k-toast {
  --toast: var(--lavender);
  display: flex;
  align-items: center;
  gap: 0.55em;
  max-width: 100%;
  padding: 0.6em 1.05em 0.6em 0.8em;
  border: 2px solid var(--toast);
  border-radius: var(--r-pill);
  background: var(--card-2);
  box-shadow: 0 0 26px -6px var(--toast);
  color: var(--text);
  font-weight: 600;
  line-height: 1.2;
}

.k-toast .k-icon {
  color: var(--toast);
  stroke-width: 3;
}

.k-toast--good {
  --toast: var(--green);
}

.k-toast--bad {
  --toast: var(--danger);
}

.k-toast--warn {
  --toast: var(--warn);
}

/* 9. Call sign and timer */
.k-sign {
  --sign: var(--green);
  display: inline-flex;
  align-items: center;
  flex: none;
  gap: 0.55em;
  width: fit-content;
  height: clamp(28px, 5.2vmin, 38px);
  padding: 0 0.95em 0 0.75em;
  border-radius: var(--r-pill);
  background: var(--sign);
  box-shadow: 0 0 20px -4px var(--sign);
  color: #000000;
  font: 700 var(--fs-label) / 1 var(--font-head);
  letter-spacing: 0.01em;
  text-transform: uppercase;
  white-space: nowrap;
  vertical-align: middle;
}

.k-sign[data-sign='quiet'] {
  --sign: var(--lavender);
}

.k-sign[data-sign='onair'] {
  --sign: #FF6B5E;
}

.k-sign[data-sign='locked'] {
  --sign: var(--warn);
}

.k-sign--big {
  height: clamp(40px, 7.4vmin, 56px);
  padding: 0 1.1em 0 0.9em;
  font-size: var(--fs-h3);
}

.k-sign__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 1.3em;
  height: 1.3em;
}

.k-sign__mark .k-icon {
  width: 1.3em;
  height: 1.3em;
  stroke-width: 2.8;
  vertical-align: 0;
}

/* talk: three bars that move like voices. Quiet: the same bars, flat. */
.k-sign__bars {
  display: inline-flex;
  align-items: center;
  gap: 0.2em;
  height: 1.15em;
}

.k-sign__bars i {
  display: block;
  width: 0.26em;
  height: 100%;
  border-radius: 0.2em;
  background: currentColor;
  animation: k-bars 0.9s ease-in-out infinite;
  animation-play-state: var(--k-loop);
}

.k-sign__bars i:nth-child(1) {
  animation-delay: -0.2s;
}

.k-sign__bars i:nth-child(2) {
  animation-delay: -0.55s;
}

.k-sign__bars i:nth-child(3) {
  animation-delay: -0.85s;
}

.k-sign[data-sign='quiet'] .k-sign__bars i {
  animation: none;
  transform: scaleY(0.24);
}

.k-sign__dot {
  width: 0.72em;
  height: 0.72em;
  border-radius: 50%;
  background: #000000;
  animation: k-onair 1.2s ease-out infinite;
}

.k-sign__who {
  max-width: 16em;
  overflow: hidden;
  padding-left: 0.6em;
  border-left: 2px solid rgba(0, 0, 0, 0.3);
  font-family: var(--font-body);
  font-weight: 700;
  letter-spacing: 0;
  text-overflow: ellipsis;
  text-transform: none;
}

@keyframes k-bars {
  0%,
  100% {
    transform: scaleY(0.4);
  }
  50% {
    transform: scaleY(1);
  }
}

@keyframes k-onair {
  0% {
    box-shadow: 0 0 0 0 rgba(0, 0, 0, 0.6);
  }
  100% {
    box-shadow: 0 0 0 0.62em rgba(0, 0, 0, 0);
  }
}

.k-timer {
  --timer: clamp(48px, 9.6vmin, 68px);
  --timer-ink: var(--text);
  --timer-arc: var(--accent);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  color: var(--timer-ink);
  vertical-align: middle;
}

.k-timer--ring {
  width: var(--timer);
  height: var(--timer);
}

.k-timer__ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

circle.k-timer__track {
  fill: none;
  stroke: var(--card-2);
  stroke-width: 10;
}

.k-timer__arc {
  fill: none;
  stroke: var(--timer-arc);
  stroke-width: 10;
  stroke-linecap: round;
  transition: stroke 200ms ease-out;
}

.k-timer__spin {
  fill: none;
  stroke: var(--warn);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 16 28;
  opacity: 0;
  transform-origin: 50% 50%;
}

.k-timer__num {
  position: relative;
  font-size: calc(var(--timer) * 0.36);
  line-height: 1;
}

.k-timer.is-long .k-timer__num {
  font-size: calc(var(--timer) * 0.25);
}

.k-timer__plus {
  position: absolute;
  top: -5px;
  right: -8px;
  display: none;
  padding: 2px 5px;
  border-radius: var(--r-pill);
  background: var(--warn);
  color: #000000;
  font: 800 12px / 1 var(--font-head);
}

.k-timer.is-plus .k-timer__plus {
  display: block;
}

/* the clock has a pulse: calm until the last five seconds, then it beats */
.k-timer.is-urgent {
  --timer-ink: var(--warn);
  --timer-arc: var(--warn);
  animation: k-beat 1s ease-out infinite;
}

.k-timer.is-urgent .k-timer__ring {
  filter: drop-shadow(0 0 6px rgba(255, 176, 32, 0.65));
}

.k-timer.is-done {
  --timer-ink: var(--warn);
  --timer-arc: var(--warn);
}

.k-timer.is-empty .k-timer__arc {
  opacity: 0;
}

/* a hidden end: a restless "?" instead of a number */
.k-timer.is-mystery {
  --timer-ink: var(--warn);
}

.k-timer.is-mystery .k-timer__arc {
  opacity: 0;
}

.k-timer.is-mystery .k-timer__spin {
  opacity: 1;
  animation: k-spin 2.6s linear infinite;
  animation-play-state: var(--k-loop);
}

.k-timer.is-mystery .k-timer__num {
  animation: k-restless 2.1s ease-in-out infinite;
  animation-play-state: var(--k-loop);
}

.k-timer.is-paused {
  opacity: 0.5;
}

.k-timer.is-idle .k-timer__num {
  opacity: 0;
}

.k-timer--bar {
  display: flex;
  gap: 0.7em;
  width: 100%;
}

.k-timer--bar .k-timer__track {
  flex: 1;
  height: clamp(10px, 2vmin, 14px);
  overflow: hidden;
  border-radius: var(--r-pill);
  background: var(--card-2);
}

.k-timer__fill {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: var(--timer-arc);
  transform-origin: 0 50%;
  transition: background-color 200ms ease-out;
}

.k-timer--bar .k-timer__num {
  min-width: 2.4em;
  font-size: var(--fs-h3);
  text-align: right;
}

.k-timer--bar.is-long .k-timer__num {
  font-size: var(--fs-h3);
}

.k-timer--bar.is-urgent {
  animation: none;
}

.k-timer--bar.is-urgent .k-timer__track {
  box-shadow: 0 0 14px -2px var(--warn);
}

.k-timer--bar.is-mystery .k-timer__fill {
  background: repeating-linear-gradient(110deg, var(--warn) 0 12px, rgba(255, 176, 32, 0.25) 12px 24px);
  background-size: 200% 100%;
  animation: k-stripes 0.9s linear infinite;
  animation-play-state: var(--k-loop);
}

.k-timer--bar .k-timer__plus {
  position: static;
}

@keyframes k-beat {
  0%,
  45%,
  100% {
    transform: scale(1);
  }
  14% {
    transform: scale(calc(1 + 0.1 * var(--k-motion)));
  }
}

@keyframes k-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes k-restless {
  0%,
  44%,
  100% {
    transform: rotate(0deg) scale(1);
  }
  8% {
    transform: rotate(-14deg) scale(1.14);
  }
  18% {
    transform: rotate(11deg) scale(1.08);
  }
  28% {
    transform: rotate(-7deg) scale(1.04);
  }
  62% {
    transform: translateY(-9%) scale(1.1);
  }
  74% {
    transform: translateY(3%) scale(0.96);
  }
  84% {
    transform: translateY(0) scale(1.03);
  }
}

@keyframes k-stripes {
  to {
    background-position: -26px 0;
  }
}

/* 10. Modal, lists, podium */
.k-modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(12px, 3vmin, 32px);
  background: rgba(0, 0, 0, 0.76);
}

.k-modal.is-closing {
  pointer-events: none;
}

.k-modal__card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  width: min(100%, 520px);
  max-height: 100%;
  padding: var(--sp-5);
  border: 2px solid var(--accent);
  border-radius: var(--r-5);
  outline: none;
  background: var(--card);
  box-shadow: 0 0 70px -14px color-mix(in srgb, var(--accent) 65%, transparent);
}

.k-modal__card--wide {
  width: min(100%, 760px);
}

.k-modal__title {
  font: 800 var(--fs-h2) / 1.1 var(--font-head);
  letter-spacing: -0.03em;
}

.k-modal__body {
  min-height: 0;
  color: var(--text-2);
}

.k-modal__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--sp-3);
}

.k-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  min-width: 0;
}

/* things arrive with a spring, one after another */
.k-list__item {
  animation: k-rise var(--t-in) var(--ease-spring) both;
  animation-delay: calc(var(--i, 0) * var(--stagger));
}

@keyframes k-rise {
  from {
    opacity: 0;
    transform: translateY(calc(18px * var(--k-motion))) scale(calc(1 - 0.05 * var(--k-motion)));
  }
}

.k-score {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-width: 0;
  padding: 5px var(--sp-4) 5px 6px;
  border: 2px solid var(--rule);
  border-radius: var(--r-3);
  background: var(--card);
}

.k-score__place {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 2.2em;
  height: 2.2em;
  border-radius: 50%;
  background: var(--card-2);
  font-size: var(--fs-label);
}

.k-score .k-tag {
  flex: 1;
  padding-left: 0;
  border-color: transparent;
  background: none;
}

.k-score__value {
  flex: none;
  font-size: var(--fs-lead);
}

.k-score.is-you {
  border-color: var(--lime);
  background: color-mix(in srgb, var(--lime) 8%, var(--card));
}

.k-score.is-first .k-score__place {
  background: var(--lime);
  color: #000000;
}

.k-waiting {
  display: inline-flex;
  align-items: center;
  gap: 0.7em;
  width: fit-content;
  color: var(--text-2);
  font-weight: 500;
}

.k-dots {
  display: inline-flex;
  gap: 5px;
}

.k-dots i {
  display: block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: k-dot 1.2s ease-in-out infinite;
}

.k-dots i:nth-child(2) {
  animation-delay: 0.15s;
}

.k-dots i:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes k-dot {
  0%,
  60%,
  100% {
    opacity: 0.3;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(calc(-5px * var(--k-motion)));
  }
}

.k-podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(8px, 2vmin, 20px);
  width: 100%;
  min-width: 0;
}

.k-podium__col {
  display: flex;
  flex: 0 1 180px;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.k-podium__col.is-waiting {
  visibility: hidden;
}

.k-podium__who {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 0;
  max-width: 100%;
}

.k-podium__name {
  max-width: 100%;
  overflow: hidden;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.k-podium__note {
  color: var(--muted);
  font-size: var(--fs-label);
  text-align: center;
}

.k-podium__block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 100%;
  padding-top: clamp(6px, 1.6vmin, 14px);
  border: 2px solid var(--rule);
  border-bottom: 0;
  border-radius: var(--r-3) var(--r-3) 0 0;
  background: var(--card-2);
  transform-origin: 50% 100%;
}

.k-podium__col--1 .k-podium__block {
  height: clamp(92px, 21vmin, 190px);
  border-color: transparent;
  background: var(--lime);
  box-shadow: 0 0 44px -10px rgba(220, 255, 0, 0.7);
  color: #000000;
}

.k-podium__col--2 .k-podium__block {
  height: clamp(66px, 15vmin, 134px);
}

.k-podium__col--3 .k-podium__block {
  height: clamp(48px, 10.5vmin, 96px);
}

.k-podium__place {
  font-size: var(--fs-h1);
  font-weight: 800;
  line-height: 1;
}

.k-podium__col--3 .k-podium__place {
  font-size: var(--fs-h2);
}

.k-podium__score {
  font-size: var(--fs-label);
  opacity: 0.8;
}

/* the held breath before first place: nothing is written on the block until it lands */
.k-podium__block.is-held > * {
  opacity: 0;
}

/* more than three share the top places: one block for each place, with everyone tied on it */
.k-podium__col--group {
  flex: 1 1 0;
}

.k-podium__crowd {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: center;
  gap: 2px 3px;
  max-width: 100%;
}

.k-podium__more {
  align-self: center;
  padding: 0 0.3em;
  color: var(--text-2);
  font: 700 var(--fs-label) / 1 var(--font-head);
}

/* 11. Effects and backgrounds */
.k-stage {
  display: block;
}

.k-fx {
  z-index: var(--z-fx);
}

.k-wipe {
  z-index: var(--z-wipe);
}

.k-wipe__title {
  font: 800 clamp(30px, 8vmin, 84px) / 1.05 var(--font-head);
  letter-spacing: -0.035em;
  text-transform: uppercase;
}

.k-wipe__sub {
  margin-bottom: 0.5em;
  font: 700 var(--fs-body) / 1.2 var(--font-head);
  letter-spacing: 0.06em;
  opacity: 0.7;
  text-transform: uppercase;
}

/* the ribbon: the change of phase inside a game. A band across the middle; the scene stays
   in view above and below it. */
.k-wipe--ribbon .k-wipe__title {
  display: -webkit-box;
  overflow: hidden;
  max-width: 92vw;
  font-size: clamp(22px, 5.6vmin, 60px);
  text-wrap: balance;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.k-wipe--ribbon .k-wipe__sub {
  margin-bottom: 0.3em;
  font-size: var(--fs-label);
}

/* with reduced motion nothing sweeps: a card says what comes next, and goes */
.k-wipe__card {
  max-width: min(520px, 88vw);
  padding: var(--sp-4) var(--sp-5);
  border: 2px solid var(--accent);
  border-radius: var(--r-4);
  background: #141414;
  box-shadow: 0 0 60px -16px var(--accent);
  color: var(--text);
  text-align: center;
}

.k-wipe__card .k-wipe__title {
  font-size: var(--fs-h2);
  text-wrap: balance;
}

.k-wipe__card .k-wipe__sub {
  color: var(--accent);
  font-size: var(--fs-label);
  opacity: 1;
}

/* the held breath before a reveal: a shine that keeps crossing something not yet shown */
.k-shimmer {
  position: relative;
  overflow: hidden;
}

.k-shimmer::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.3) 50%, transparent 70%);
  pointer-events: none;
  transform: translateX(-120%);
  animation: k-shine 1.15s ease-in-out infinite;
  animation-play-state: var(--k-loop);
}

/* never flat black: a faint drifting grid and a soft vignette in the accent.
   The element clips its contents, so use it on a root, not on a small card. */
:where(.k-bg) {
  /* no weight, so k-screen (or your own rule) can still place the element */
  position: relative;
}

.k-bg {
  isolation: isolate;
  overflow: hidden;
  overflow: clip;
}

.k-bg::before {
  content: '';
  position: absolute;
  inset: -48px;
  z-index: -1;
  background-image: linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  animation: k-drift 16s linear infinite;
  animation-play-state: var(--k-loop);
}

.k-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(120% 75% at 50% 0%, color-mix(in srgb, var(--accent) 7%, transparent), transparent 62%);
  pointer-events: none;
}

.k-bg--dots::before {
  background-image: radial-gradient(rgba(255, 255, 255, 0.07) 1.5px, transparent 2px);
}

@keyframes k-drift {
  to {
    transform: translate3d(48px, 48px, 0);
  }
}

/* 13. Pick list, tiles, seats, the report button (ui.pickList, ui.tiles, ui.seatRing, ui.reportButton) */
.k-pick {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  width: 100%;
  min-width: 0;
  min-height: 0;
}

.k-pick__list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 0;
  max-height: var(--pick-h, 11.5em);
  padding: 2px;
}

.k-pick__row {
  display: flex;
  align-items: center;
  flex: none;
  gap: 0.6em;
  min-height: 34px;
  padding: 2px 0.7em 2px 5px;
  border: 2px solid transparent;
  border-radius: var(--r-2);
  background: var(--card-2);
  cursor: pointer;
}

.k-pick__row.is-at {
  border-color: var(--lime);
  background: color-mix(in srgb, var(--lime) 10%, var(--card-2));
}

.k-pick__row.is-off {
  cursor: default;
  opacity: 0.42;
}

.k-pick__text {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
}

.k-pick__label {
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.k-pick__label b {
  color: var(--lime);
}

.k-pick__sub {
  overflow: hidden;
  color: var(--muted);
  font-size: var(--fs-label);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.k-pick__none {
  padding: 0.7em;
  color: var(--muted);
  font-size: var(--fs-label);
  text-align: center;
}

/* a palette: the same list as tiles */
.k-pick--grid .k-pick__list {
  flex-flow: row wrap;
  align-content: flex-start;
  gap: 4px;
}

.k-pick--grid .k-pick__row {
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  width: var(--pick-tile, 66px);
  min-height: var(--pick-tile, 66px);
  padding: 4px;
  text-align: center;
}

.k-pick--grid .k-pick__text {
  flex: none;
  max-width: 100%;
}

.k-pick--grid .k-pick__label {
  font-size: 12px;
}

.k-pick--grid .k-pick__sub {
  display: none;
}

.k-tiles {
  display: grid;
  grid-template-columns: repeat(var(--cols, auto-fit), minmax(var(--min, 104px), 1fr));
  gap: var(--sp-2);
  width: 100%;
  min-width: 0;
}

.k-tile {
  display: flex;
  width: 100%;
}

.k-tiles--big .k-tile .k-btn__face {
  min-height: calc(var(--btn-h) * 2.1);
}

/* who is standing on a tile: small critters in its top right corner */
.k-tile__perch {
  position: absolute;
  top: 5px;
  right: 6px;
  display: flex;
  align-items: center;
}

.k-tile__perch .k-avatar {
  margin-left: -7px;
}

.k-tile__more {
  margin-left: 2px;
  font: 700 12px / 1 var(--font-head);
}

.k-ring {
  --seat: 54px;
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 150px;
}

.k-ring__seat {
  --cx: 0;
  --cy: 1;
  position: absolute;
  top: calc(50% + var(--cy) * (50% - var(--seat) / 2 - 12px));
  left: calc(50% + var(--cx) * (50% - var(--seat) / 2 - 18px));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  width: calc(var(--seat) + 32px);
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  translate: -50% -50%;
  transition: top 420ms var(--ease-spring), left 420ms var(--ease-spring), opacity 200ms ease-out;
}

button.k-ring__seat {
  cursor: pointer;
}

.k-ring__name {
  max-width: 100%;
  overflow: hidden;
  color: var(--text-2);
  font: 600 12px / 1.25 var(--font-body);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.k-ring--bare .k-ring__name {
  display: none;
}

.k-ring__seat.is-you .k-ring__name {
  color: var(--lime);
  font-weight: 700;
}

.k-ring__seat.is-away .k-ring__name {
  color: var(--muted);
}

.k-ring__seat.is-dim {
  opacity: 0.38;
}

/* whose go it is */
.k-ring__seat.is-turn .k-avatar {
  filter: drop-shadow(0 0 9px var(--lime));
  animation: k-hop 0.9s ease-in-out infinite;
  animation-play-state: var(--k-loop);
}

.k-ring__seat.is-turn .k-ring__name {
  color: var(--text);
}

.k-ring__mark {
  --mark: var(--lime);
  position: absolute;
  top: -5px;
  right: 2px;
  display: none;
  padding: 0.16em 0.5em;
  border-radius: var(--r-pill);
  background: var(--mark, var(--lime));
  color: #000000;
  font: 700 12px / 1.2 var(--font-head);
  white-space: nowrap;
}

.k-ring__mark.is-on {
  display: block;
}

.k-ring__centre {
  position: absolute;
  inset: calc(var(--seat) + 30px) calc(var(--seat) + 46px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  text-align: center;
}

@keyframes k-hop {
  0%,
  60%,
  100% {
    translate: 0 0;
  }
  30% {
    translate: 0 calc(-7px * var(--k-motion));
  }
}

.k-report {
  --btn-h: 30px;
  --btn-lip-h: 3px;
  border-radius: var(--r-pill);
  font-size: 12px;
}

.k-report .k-btn__face {
  gap: 0.35em;
  padding: 0.1em 0.8em;
}

.k-report .k-icon {
  width: 1.1em;
  height: 1.1em;
}

.k-report.is-armed {
  --btn-ink: var(--warn);
  --btn-edge: var(--warn);
}

.k-report__tick,
.k-report.is-done .k-icon:not(.k-report__tick) {
  display: none;
}

.k-report.is-done .k-report__tick {
  display: inline-block;
  color: var(--green);
}

/* 14. Boards (canvas.numberLine, canvas.pixels, canvas.pad, canvas.markers, canvas.raceTrack):
       the canvas on top, a row of buttons under it. They fill whatever they are put in. */
.k-board {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

.k-board__stage {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
  border-radius: var(--r-3);
  background: #0A0A0A;
  box-shadow: inset 0 0 0 2px var(--rule);
}

.k-board__bar {
  display: flex;
  align-items: center;
  flex: none;
  flex-wrap: wrap;
  gap: 5px 8px;
}

.k-board__bar:empty {
  display: none;
}

.k-board__bar .k-btn {
  --btn-h: 34px;
  --btn-lip-h: 4px;
  border-radius: var(--r-2);
  font-size: var(--fs-label);
}

.k-board__bar .k-btn__face {
  padding: 0.2em 0.75em;
}

.k-board__bar .k-input {
  flex: 1 1 160px;
  width: auto;
  --btn-h: 34px;
  --lip: 4px;
}

.k-board__bar .k-input__el {
  font-size: var(--fs-body);
}

.k-board__keys,
.k-board__group {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* a button that is only its key cap: an arrow */
.k-board__key .k-btn__face {
  padding: 0 0.55em;
}

.k-board__key .k-btn__label {
  display: none;
}

.k-board__key .k-key {
  margin: 0;
}

.k-board__swatch .k-btn__face {
  min-width: 30px;
  padding: 0;
}

.k-board__swatch .k-btn__label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.k-board__size .k-btn__label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.k-board__dot {
  display: block;
  border-radius: 50%;
  background: currentColor;
}

.k-board__pen {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  padding: 0 0.3em;
  color: var(--text-2);
  font: 600 var(--fs-label) / 1.1 var(--font-body);
  white-space: nowrap;
}

.k-board__pen.is-on {
  color: var(--lime);
}

/* 12. Reduced motion: a first-class mode. The player's own setting arrives as
       data-motion on <html> (set by fx.setReduced); the system's arrives here.
       Springs become plain eases, distances fall to zero, idle loops stop. */
@media (prefers-reduced-motion: reduce) {
  :root {
    --k-motion: 0;
    --k-loop: paused;
    --ease-spring: ease-out;
  }
}

:root[data-motion='reduced'] {
  --k-motion: 0;
  --k-loop: paused;
  --ease-spring: ease-out;
}
