/* ============================================================
   css/kodle.css — Kodle (games/kodle.php)
   Design: Claude Design "Kodle Game" (Nov 2026). Scoped to .kd because
   style.css sets `* { font-family: Urbanist }`, `h1 span { Bricolage
   !important }` and letter-spacing/size on a, p and li, so every element
   here sets its own font and spacing.
   Tried letters that are not in the word turn the key RED; tiles keep
   green / yellow / grey. Correct tiles also carry a small check mark and
   present tiles a dashed ring for colour-blind players.
   ============================================================ */

.kd {
  --kd-ink: #0d2419;
  --kd-green: #0b6b43;
  --kd-green-dk: #08502f;
  --kd-mint: #e8f5ee;
  --kd-neon: #6ee7a8;
  --kd-text: #3f4a45;
  --kd-muted: #5a645f;
  --kd-line: #e4e7e5;
  --kd-term: #0e1311;
  --kd-term-2: #1a2320;
  --kd-term-mute: #8a9a92;
  --kd-term-text: #eef5f1;
  --kd-c: #0f8f5d;
  --kd-p: #b97a0f;
  --kd-a: #3a4541;
  --kd-grey: #5b6762;
  --kd-red-bg: #4a1d22;
  --kd-red-fg: #ff9e9e;
  --kd-red-bd: #7a2e35;
  --kd-sans: 'Outfit', system-ui, sans-serif;
  --kd-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  display: block;
  font-size: 16px;
  line-height: 1.5;
  background-color: #f5f6f3;
  background-image: radial-gradient(#e3e8e5 1px, transparent 1px);
  background-size: 22px 22px;
  color: var(--kd-ink);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
.kd, .kd * { font-family: var(--kd-sans); box-sizing: border-box; }
.kd h1 span, .kd h2 span, .kd h3 span { font-family: var(--kd-sans) !important; }
/* :where() keeps these resets at zero class weight so .kd-* sizes below win. */
:where(.kd) a, :where(.kd) p, :where(.kd) li { font-size: inherit; line-height: inherit; letter-spacing: normal; font-weight: inherit; }
:where(.kd) p, :where(.kd) h1, :where(.kd) h2, :where(.kd) ol, :where(.kd) ul, :where(.kd) dl, :where(.kd) dd { margin: 0; }
:where(.kd) ol, :where(.kd) ul { padding: 0; list-style: none; }
.kd .kd-mono, .kd .kd-mono * { font-family: var(--kd-mono); }
.kd [hidden] { display: none !important; }
.kd :focus-visible { outline: 3px solid var(--kd-neon); outline-offset: 3px; }

/* Language: both texts are in the page, the inactive one is hidden. */
.kd[data-lang="en"] [data-l="hn"],
.kd[data-lang="hn"] [data-l="en"] { display: none !important; }

.kd-wrap { max-width: 1200px; margin: 0 auto; padding: 56px 20px 120px; display: flex; flex-direction: column; gap: 28px; }

/* ---------- title + stat chips ---------- */
.kd-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.kd-titles { display: flex; flex-direction: column; gap: 8px; }
.kd-eyebrow { font-size: 13px; font-weight: 700; letter-spacing: .12em; color: var(--kd-green); }
.kd .kd-eyebrow a { color: var(--kd-green); text-decoration: none; }
.kd .kd-eyebrow a:hover { color: var(--kd-green-dk); text-decoration: underline; }
.kd-h1 { font-size: clamp(32px, 5vw, 52px); font-weight: 900; letter-spacing: -.04em; line-height: 1; color: var(--kd-ink); }
.kd-h1 span { color: var(--kd-green); }
.kd-chips { display: flex; gap: 10px; flex-wrap: wrap; }
.kd-chipbox { background: #fff; border: 1px solid var(--kd-line); border-radius: 14px; padding: 12px 18px; display: flex; flex-direction: column; gap: 4px; min-width: 84px; }
.kd-chipbox b { font-size: 24px; font-weight: 800; line-height: 1; color: var(--kd-ink); }
.kd-chipbox b.is-green { color: var(--kd-green); }
.kd-chipbox span { font-size: 14px; color: var(--kd-muted); }

/* ---------- layout ---------- */
.kd-layout { display: flex; gap: 24px; flex-wrap: wrap; align-items: flex-start; }
.kd-game { flex: 999 1 520px; min-width: 0; }
.kd-side { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 18px; }

/* ---------- game card ---------- */
.kd-game {
  position: relative;
  overflow: hidden;
  background: var(--kd-term);
  border-radius: 26px;
  padding: clamp(16px, 3vw, 28px);
  display: flex;
  flex-direction: column;
  gap: 22px;
  box-shadow: 0 0 0 1px #1d2622, 0 40px 80px -40px rgba(11, 107, 67, .65);
}
.kd-game__glow { position: absolute; inset: -40% -20% auto auto; width: 420px; height: 420px; background: radial-gradient(circle, rgba(20, 160, 106, .22), transparent 65%); pointer-events: none; }

.kd-head { position: relative; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.kd-meta { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--kd-term-mute); white-space: nowrap; }
.kd-meta strong { color: var(--kd-term-text); font-weight: 700; }
.kd-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--kd-neon); animation: kd-pulse 2s infinite; flex: 0 0 auto; }
.kd-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.kd-seg { display: flex; background: var(--kd-term-2); border-radius: 999px; padding: 3px; }
.kd .kd-seg a, .kd-seg button {
  border: 0; cursor: pointer; font-size: 13px; font-weight: 700; padding: 7px 14px; border-radius: 999px;
  background: transparent; color: var(--kd-term-mute); text-decoration: none; line-height: 1.2; transition: background .2s, color .2s;
}
.kd .kd-seg a:hover, .kd-seg button:hover { color: var(--kd-term-text); }
.kd .kd-seg a[aria-current="page"] { background: var(--kd-neon); color: #06251a; }
.kd-seg button { font-size: 12px; padding: 7px 10px; }
.kd-seg button[aria-pressed="true"] { background: var(--kd-term-text); color: var(--kd-term); }
.kd-statbtn {
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid #2a3430; background: var(--kd-term-2);
  cursor: pointer; display: flex; align-items: flex-end; justify-content: center; gap: 2px; padding: 10px 0; flex: 0 0 auto;
}
.kd-statbtn span { width: 3px; background: var(--kd-neon); border-radius: 1px; }
.kd-statbtn span:nth-child(1) { height: 6px; }
.kd-statbtn span:nth-child(2) { height: 12px; }
.kd-statbtn span:nth-child(3) { height: 9px; }

.kd-clue { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.kd-tagline { font-size: 15px; color: var(--kd-term-mute); line-height: 1.5; }
.kd-catpill { display: flex; align-items: center; gap: 8px; background: rgba(110, 231, 168, .1); border: 1px solid rgba(110, 231, 168, .3); padding: 7px 16px; border-radius: 999px; line-height: 1.3; }
.kd-catpill span { font-size: 15px; color: var(--kd-term-mute); }
.kd-catpill strong { font-size: 17px; font-weight: 800; color: var(--kd-neon); }
.kd-hint { font-size: 17px; color: #d6e1db; max-width: 480px; text-wrap: pretty; line-height: 1.45; }
.kd-hint__label { color: var(--kd-term-mute); }

/* ---------- grid ---------- */
.kd-board { position: relative; display: flex; flex-direction: column; align-items: center; perspective: 600px; }
.kd-grid {
  --len: 5;
  --tile-h: 70px; /* height cap per tile; tightened on phones below */
  width: min(100%, calc(var(--len) * 70px), calc(var(--len) * (var(--tile-h) + 8px) - 8px));
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.kd-row { display: flex; gap: 8px; }
.kd-tile {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 2px solid #26302c;
  background: transparent;
  color: var(--kd-term-text);
  font-weight: 800;
  font-size: clamp(20px, 6vw, 32px);
  line-height: 1;
  text-transform: uppercase;
  user-select: none;
}
.kd-tile.is-filled { background: #151c19; border-color: #6b7c75; }
.kd-tile[data-state] { color: #fff; }
.kd-tile[data-state="correct"] { background: var(--kd-c); border-color: var(--kd-c); box-shadow: 0 0 22px -6px rgba(18, 180, 110, .8); }
.kd-tile[data-state="present"] { background: var(--kd-p); border-color: var(--kd-p); }
.kd-tile[data-state="absent"]  { background: var(--kd-a); border-color: var(--kd-a); }
/* Second cue besides colour: check on correct, dashed ring on present. */
.kd-tile[data-state="correct"]::after { content: "✓"; position: absolute; top: 3px; right: 5px; font-size: 10px; line-height: 1; opacity: .7; }
.kd-tile[data-state="present"] { outline: 1.5px dashed rgba(255, 255, 255, .55); outline-offset: -6px; }

/* Flip reveal: colour lands half-way through each tile's flip. */
.kd-tile.is-flip { animation: kd-flip .3s ease-in-out var(--d, 0ms) both; }
.kd-tile.is-flip[data-state] { transition: background-color 0s, border-color 0s, color 0s, box-shadow .3s; transition-delay: calc(var(--d, 0ms) + 150ms); }
.kd-tile.is-flip::after { animation: kd-show 0s linear calc(var(--d, 0ms) + 150ms) both; }
.kd-tile.is-pop { animation: kd-pop .12s ease; }
.kd-tile.is-bounce { animation: kd-bounce .7s ease var(--d, 0ms) both; }
.kd-row.is-shake { animation: kd-shake .45s; }

@keyframes kd-flip { 0% { transform: rotateX(0); } 50% { transform: rotateX(90deg); } 100% { transform: rotateX(0); } }
@keyframes kd-show { from { opacity: 0; } to { opacity: .7; } }
@keyframes kd-pop { 50% { transform: scale(1.13); } }
@keyframes kd-shake { 10%, 90% { transform: translateX(-2px); } 20%, 80% { transform: translateX(4px); } 30%, 50%, 70% { transform: translateX(-8px); } 40%, 60% { transform: translateX(8px); } }
@keyframes kd-bounce { 0%, 20% { transform: translateY(0); } 40% { transform: translateY(-24px); } 50% { transform: translateY(4px); } 60% { transform: translateY(-10px); } 80% { transform: translateY(2px); } 100% { transform: translateY(0); } }
@keyframes kd-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(110, 231, 168, .5); } 50% { box-shadow: 0 0 0 6px rgba(110, 231, 168, 0); } }
@keyframes kd-in { from { opacity: 0; transform: translateY(16px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes kd-fade { from { opacity: 0; } to { opacity: 1; } }

.kd-toast {
  position: absolute;
  top: -6px;
  left: 50%;
  z-index: 3;
  transform: translate(-50%, -10px);
  background: var(--kd-term-text);
  color: var(--kd-ink);
  font-weight: 800;
  font-size: 15px;
  padding: 10px 18px;
  border-radius: 12px;
  white-space: nowrap;
  max-width: calc(100vw - 48px);
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .6);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.kd-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

.kd-sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- on-screen keyboard ---------- */
.kd-keys { position: relative; width: 100%; max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 8px; }
.kd-keyrow { display: flex; gap: 6px; justify-content: center; }
.kd-key {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  max-width: 52px;
  height: 56px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 10px;
  background: #3a4743;
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .25);
  touch-action: manipulation;
  user-select: none;
  transition: background .3s, transform 60ms ease;
}
.kd-key:active, .kd-key.is-press { transform: translateY(2px) scale(.96); }
.kd-key--wide { flex: 1.6 1 0; max-width: 92px; font-size: 12px; }
.kd-key[data-key="backspace"] { font-size: 20px; }
.kd-key[data-state="correct"] { background: var(--kd-c); }
.kd-key[data-state="present"] { background: var(--kd-p); }
.kd-key[data-state="absent"]  { background: var(--kd-red-bg); color: var(--kd-red-fg); border-color: var(--kd-red-bd); }

.kd-noscript { text-align: center; font-weight: 700; color: var(--kd-term-text); }

/* ---------- side cards ---------- */
.kd-card { background: #fff; border: 1px solid var(--kd-line); border-radius: 22px; padding: 24px; display: flex; flex-direction: column; gap: 10px; }
.kd-card__title { font-size: 20px; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; color: var(--kd-ink); }
.kd-card > p { font-size: 15px; line-height: 1.6; color: var(--kd-text); }

.kd-how { gap: 18px; }
.kd-how:not([open]) { gap: 0; } /* closed <details> still lays out an empty content slot */
.kd-how summary { display: flex; align-items: center; justify-content: space-between; cursor: pointer; list-style: none; }
.kd-how summary::-webkit-details-marker { display: none; }
.kd-how__chev { width: 28px; height: 28px; border-radius: 50%; background: #f0f2f1; display: flex; align-items: center; justify-content: center; font-size: 12px; color: var(--kd-text); transition: transform .2s; }
.kd-how:not([open]) .kd-how__chev { transform: rotate(-90deg); }
.kd-steps { display: flex; flex-direction: column; gap: 18px; font-size: 15px; line-height: 1.6; color: var(--kd-text); }
.kd-steps > li { display: grid; grid-template-columns: 28px 1fr; gap: 12px; align-items: start; }
.kd-steps > li > p { margin-top: 2px; }
.kd-step__n { width: 28px; height: 28px; border-radius: 8px; background: var(--kd-mint); color: var(--kd-green); font-weight: 800; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.kd-step__body { display: flex; flex-direction: column; gap: 12px; margin-top: 2px; }
.kd-sample { display: flex; gap: 6px; }
.kd-sample span { width: 40px; height: 40px; border-radius: 9px; color: #fff; font-weight: 800; font-size: 18px; display: flex; align-items: center; justify-content: center; }
.kd-sample .is-c, .kd-legend__tag.is-c { background: var(--kd-c); border-color: var(--kd-c); }
.kd-sample .is-p, .kd-legend__tag.is-p { background: var(--kd-p); border-color: var(--kd-p); }
.kd-sample .is-a, .kd-legend__tag.is-a { background: var(--kd-grey); border-color: var(--kd-grey); }
.kd-legend { display: flex; flex-direction: column; gap: 10px; background: #f7f8f6; border-radius: 14px; padding: 14px; }
.kd-legend li { display: grid; grid-template-columns: 76px 1fr; gap: 12px; align-items: center; font-size: 14.5px; line-height: 1.4; color: #2c3632; }
.kd-legend__tag { width: 76px; color: #fff; border: 1px solid transparent; font-weight: 700; font-size: 13px; padding: 4px 0; border-radius: 8px; text-align: center; line-height: 1.3; }
.kd-legend__tag.is-key { background: var(--kd-red-bg); color: var(--kd-red-fg); border-color: var(--kd-red-bd); }

.kd-cta {
  background-color: #0b1a13;
  background-image: radial-gradient(ellipse 80% 100% at 100% 0%, rgba(20, 160, 106, .4), transparent 60%);
  border-radius: 22px; padding: 24px; display: flex; flex-direction: column; gap: 10px; color: #fff;
}
.kd-cta__eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .12em; color: var(--kd-neon); }
.kd-cta__title { font-size: 22px; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; color: #fff; }
.kd-cta > p:not(.kd-cta__eyebrow) { font-size: 15px; line-height: 1.6; color: #d4ddd8; }

/* ---------- buttons ---------- */
.kd .kd-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 800; font-size: 15px; line-height: 1.2; border-radius: 999px; cursor: pointer;
  text-decoration: none; transition: background .2s, color .2s;
}
.kd .kd-btn--ghost { align-self: flex-start; margin-top: 4px; border: 2px solid var(--kd-green); background: #fff; color: var(--kd-green); padding: 10px 20px; }
.kd .kd-btn--ghost:hover { background: var(--kd-green); color: #fff; }
.kd .kd-btn--neon { align-self: flex-start; margin-top: 4px; border: 0; background: var(--kd-neon); color: #06251a; padding: 12px 22px; }
.kd .kd-btn--neon:hover { background: #8ff0bd; color: #06251a; }
.kd .kd-btn--solid { border: 0; background: var(--kd-green); color: #fff; font-size: 16px; padding: 14px; }
.kd .kd-btn--solid:hover { background: var(--kd-green-dk); color: #fff; }

/* ---------- result / stats dialog ---------- */
.kd-modal {
  position: fixed;
  inset: 0;
  margin: auto; /* style.css zeroes every margin, which pins <dialog> to the top-left */
  width: calc(100% - 32px);
  max-width: 440px;
  max-height: calc(100vh - 32px);
  overflow: auto;
  border: 0;
  border-radius: 26px;
  padding: 28px;
  background: #fff;
  color: var(--kd-ink);
}
@supports (height: 100dvh) { .kd-modal { max-height: calc(100dvh - 32px); } }
.kd-modal[open] { display: flex; flex-direction: column; gap: 20px; animation: kd-in .35s cubic-bezier(.2, .9, .3, 1.2) both; }
.kd-modal::backdrop { background: rgba(6, 14, 10, .65); backdrop-filter: blur(6px); animation: kd-fade .2s both; }
.kd-modal__close { position: absolute; top: 16px; right: 16px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: #f0f2f1; cursor: pointer; font-size: 16px; color: var(--kd-text); }
.kd-modal__head { display: flex; flex-direction: column; gap: 6px; align-items: center; text-align: center; padding: 0 30px; }
.kd-modal__eyebrow { font-size: 13px; font-weight: 700; letter-spacing: .12em; color: var(--kd-green); }
.kd-modal__title { font-size: 28px; font-weight: 900; letter-spacing: -.03em; line-height: 1.1; color: var(--kd-ink); }
.kd-modal__result { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.kd-ans-row { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.kd-ans { width: 44px; height: 44px; border-radius: 10px; background: var(--kd-ink); color: #fff; font-weight: 800; font-size: 20px; display: flex; align-items: center; justify-content: center; text-transform: uppercase; }
.kd-ans.is-won { background: var(--kd-c); }
.kd-modal__cat span { display: inline-block; font-size: 12px; font-weight: 800; color: var(--kd-green); background: var(--kd-mint); border-radius: 999px; padding: 3px 10px; }
.kd-modal__meaning { font-size: 15px; line-height: 1.55; color: var(--kd-text); text-align: center; text-wrap: pretty; }
.kd .kd-code {
  width: 100%; margin: 0; padding: 12px 14px; background: var(--kd-term); color: #d6e1db; border-radius: 12px;
  font: 13px/1.55 var(--kd-mono); white-space: pre-wrap; overflow-wrap: anywhere; overflow: hidden; border: 0;
}
.kd .kd-code code { font: inherit; color: inherit; background: none; padding: 0; white-space: inherit; }
.kd-iv { width: 100%; background: #f2faf5; border: 1px dashed #9fdcbc; border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.kd-iv__head { font-size: 12px; font-weight: 700; letter-spacing: .1em; color: var(--kd-green); }
.kd-iv__q { font-size: 15px; font-weight: 700; line-height: 1.4; color: var(--kd-ink); }
.kd .kd-iv__link { font-size: 14px; font-weight: 700; color: var(--kd-green); text-decoration: underline; text-underline-offset: 3px; }

.kd-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; }
/* dt comes first in the markup; column-reverse shows the number on top. */
.kd-stats div { display: flex; flex-direction: column-reverse; background: #f5f6f3; border-radius: 14px; padding: 12px 4px; }
.kd-stats div.is-hi { background: var(--kd-mint); }
.kd-stats dd { font-size: 24px; font-weight: 800; line-height: 1.2; }
.kd-stats div.is-hi dd, .kd-stats div.is-hi dt { color: var(--kd-green); }
.kd-stats dt { font-size: 13px; font-weight: 400; color: var(--kd-muted); }
.kd-dist__head { margin-top: 20px; margin-bottom: 6px; font-size: 13px; font-weight: 700; color: var(--kd-muted); letter-spacing: .04em; }
.kd-dist { display: flex; flex-direction: column; gap: 6px; }
.kd-dist__row { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.kd-dist__n { width: 12px; font-weight: 700; }
.kd-dist__track { flex: 1; }
.kd-dist__bar { display: block; width: var(--w); min-width: 28px; background: var(--kd-grey); color: #fff; font-weight: 700; text-align: right; padding: 3px 8px; border-radius: 6px; transition: width .6s; }
.kd-dist__bar.is-today { background: var(--kd-c); }

.kd-modal__btns { display: flex; gap: 10px; flex-wrap: wrap; }
.kd-modal__btns .kd-btn { flex: 1 1 140px; align-self: auto; margin-top: 0; font-size: 16px; }
.kd-modal__btns .kd-btn--ghost { padding: 12px; }
.kd-share-fallback { width: 100%; padding: 10px 12px; border: 1.5px solid var(--kd-line); border-radius: 12px; font: 14px/1.4 var(--kd-mono); resize: none; }
.kd-modal__note { text-align: center; font-size: 13px; color: var(--kd-muted); margin-top: -10px; }
.kd-modal__next { text-align: center; font-size: 14px; color: var(--kd-muted); }
.kd-modal__next strong { font-weight: 700; color: var(--kd-ink); margin-left: 4px; }

/* ---------- phones ----------
   Grid + keyboard should fit above the fold on a 390x750 phone, so tiles are
   capped by viewport height too. --chrome is everything on screen that is
   not the grid (site banner + nav, title, card header, clue, keyboard). */
@media (max-width: 700px) {
  .kd-wrap { padding: 12px 12px 72px; gap: 10px; }
  .kd-top { align-items: center; gap: 10px; }
  .kd-titles { gap: 4px; }
  .kd-eyebrow { font-size: 12px; }
  .kd-h1 { font-size: 24px; letter-spacing: -.03em; }
  .kd-chips { gap: 6px; }
  .kd-chipbox { padding: 4px 9px; min-width: 0; border-radius: 12px; flex-direction: row; align-items: baseline; gap: 5px; }
  .kd-chipbox b { font-size: 16px; }
  .kd-chipbox span { font-size: 13px; }
  .kd-game { border-radius: 20px; padding: 12px 12px 14px; gap: 10px; }
  .kd-meta { font-size: 13px; gap: 6px; }
  .kd-actions { gap: 6px; }
  .kd .kd-seg a { font-size: 12px; padding: 6px 10px; }
  .kd-seg button { font-size: 11px; padding: 6px 8px; }
  .kd-statbtn { width: 30px; height: 30px; padding: 8px 0; }
  .kd-clue { gap: 5px; }
  .kd-tagline { font-size: 13px; }
  .kd-catpill { padding: 4px 12px; }
  .kd-catpill span { font-size: 13px; }
  .kd-catpill strong { font-size: 15px; }
  .kd-hint { font-size: 15px; line-height: 1.4; }
  .kd-grid { --chrome: 516px; --tile-h: max(32px, calc((100vh - var(--chrome)) / 6 - 6px)); gap: 6px; }
  .kd-row { gap: 6px; }
  .kd-tile { border-radius: 10px; }
  .kd-keys { gap: 6px; }
  .kd-keyrow { gap: 5px; }
  .kd-key { height: 46px; border-radius: 8px; font-size: 15px; }
  .kd-key--wide { font-size: 11px; }
  .kd-card, .kd-cta { padding: 20px; }
  .kd-modal { padding: 22px 18px; }
  .kd-modal[open] { gap: 16px; }
}
@supports (height: 100dvh) {
  @media (max-width: 700px) {
    .kd-grid { --tile-h: max(32px, calc((100dvh - var(--chrome)) / 6 - 6px)); }
  }
}
@media (max-width: 700px) and (max-height: 700px) {
  .kd-key { height: 42px; }
}
/* Keep the card header on one row on phones; the grid already shows the length. */
@media (max-width: 480px) {
  .kd-meta [data-kd="len"] { display: none; }
  .kd-tagline { display: none; } /* decorative; frees ~25px so grid + keys fit */
}

@media (prefers-reduced-motion: reduce) {
  .kd *, .kd *::after, .kd-modal::backdrop { animation: none !important; transition: none !important; }
}
