[data-kb-item][hidden],
[data-popular-block][hidden] {
  display: none !important;
}

/* Keep branding intact and prevent grid content from widening mobile pages. */
.ww-brand {
  flex-shrink: 0;
  white-space: nowrap;
}

.ww-brand__mark {
  flex-shrink: 0;
}

.ww-tool-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
}

.ww-benefit-grid,
.ww-tool-grid--dense {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
}

.ww-tool-card {
  min-width: 0;
}

.ww-tool-card__meta strong {
  overflow-wrap: anywhere;
}

.kb-board-wrap {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}

/* Give every keyboard row the same width and physical-key proportions. */
.kb-board {
  grid-template-columns: minmax(0, 1fr);
}

.kb-row {
  justify-content: flex-start;
  align-items: stretch;
  width: 100%;
  min-width: 0;
}

.kb-key {
  flex: 1 1 0;
}

.kb-key.is-pressed,
.kb-key:active {
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.18);
}

.kb-key--wide {
  flex-grow: 1.5;
}

.kb-key--wide[data-code="CapsLock"] {
  flex-grow: 1.75;
}

.kb-key--back {
  flex-grow: 2;
}

.kb-key--enter {
  flex-grow: 2.1;
}

.kb-key--shift {
  flex-grow: 2.4;
}

.kb-key--mod,
.kb-key--emoji {
  flex-grow: 1.25;
}

.kb-key--space {
  flex-grow: 7;
}

/* Compact, neutral editor actions: Undo, Copy, Delete. */
.kb-editor {
  padding-bottom: 2.6rem;
}

.kb-editor-actions {
  position: absolute;
  left: auto;
  right: 0.55rem;
  bottom: 0.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.12rem;
  border: 1px solid rgba(31, 41, 55, 0.09);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

[dir="rtl"] .kb-editor-actions {
  right: auto;
  left: 0.55rem;
}

.kb-fab,
.kb-fab--accent,
.kb-fab--danger {
  -webkit-appearance: none;
  appearance: none;
  width: 1.55rem;
  height: 1.55rem;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.78rem;
  line-height: 1;
  box-shadow: none;
  transition: background 0.12s ease, color 0.12s ease;
}

.kb-fab:hover {
  background: rgba(31, 41, 55, 0.06);
  color: var(--ink);
}

.kb-fab:focus-visible {
  outline: 2px solid rgba(42, 115, 255, 0.55);
  outline-offset: 1px;
}

.kb-fab span {
  display: block;
  line-height: 1;
  font-weight: 500;
}

.kb-tool.is-dark .kb-editor-actions {
  background: rgba(17, 24, 39, 0.78);
  border-color: rgba(255, 255, 255, 0.14);
}

.kb-tool.is-dark .kb-fab {
  color: #cbd5e1;
}

.kb-tool.is-dark .kb-fab:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #f8fafc;
}

@supports not ((backdrop-filter: blur(6px)) or (-webkit-backdrop-filter: blur(6px))) {
  .kb-editor-actions {
    background: #fff;
  }

  .kb-tool.is-dark .kb-editor-actions {
    background: #111827;
  }
}

@media (max-width: 900px) {
  .ww-tool-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 480px) {
  .ww-tool-card {
    gap: 0.7rem;
    padding: 0.9rem;
  }

  .ww-tool-card__meta p {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .ww-tool-card__cta {
    font-size: 0.8rem;
  }
}

/* The sticky board must fully mask the toolbar it scrolls over. */
@media (max-width: 800px) {
  .kb-board-wrap {
    background: linear-gradient(180deg, rgba(232, 241, 251, 0), #e8f1fb 14px);
  }

  .kb-tool.is-dark .kb-board-wrap {
    background: linear-gradient(180deg, rgba(17, 24, 39, 0), #111827 14px);
  }
}

/* Tablets — keep the full keyboard visible with comfortable keys. */
@media (min-width: 601px) and (max-width: 1024px) {
  .kb-board {
    padding: 0.5rem;
    gap: 0.32rem;
  }

  .kb-row {
    gap: 0.26rem;
  }

  .kb-key {
    min-width: 0;
    min-height: 2.9rem;
    padding: 0.2rem 0.25rem;
  }

  .kb-key--wide,
  .kb-key--space,
  .kb-key--emoji,
  .kb-key--touch {
    min-width: 0;
  }

  .kb-key__main {
    font-size: 1rem;
  }

  .kb-key__hint {
    font-size: 0.6rem;
  }

  .ww-tool-grid,
  .ww-benefit-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Phones — the board fits the viewport instead of scrolling sideways. */
@media (max-width: 600px) {
  .kb-board-wrap {
    max-width: none;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    padding-left: max(0.3rem, env(safe-area-inset-left));
    padding-right: max(0.3rem, env(safe-area-inset-right));
  }

  /* Desktop-only modifiers never carry characters in any layout, so the
     remaining keys can grow into their space on touch screens. */
  .kb-key[data-code="Tab"],
  .kb-key[data-code="CapsLock"],
  .kb-key[data-code="ShiftRight"],
  .kb-key[data-code="ControlLeft"],
  .kb-key[data-code="ControlRight"],
  .kb-key[data-code="AltLeft"],
  .kb-key[data-code="AltRight"] {
    display: none;
  }

  .kb-board {
    padding: 0.3rem;
    gap: 0.22rem;
    border-radius: 12px;
  }

  .kb-row {
    gap: 0.16rem;
  }

  .kb-key {
    min-width: 0;
    min-height: 2.6rem;
    padding: 0.15rem 0.1rem;
    border-radius: 6px;
    overflow: hidden;
  }

  .kb-key--wide,
  .kb-key--space,
  .kb-key--emoji,
  .kb-key--touch {
    min-width: 0;
  }

  .kb-key__main {
    font-size: clamp(0.7rem, 3.1vw, 0.95rem);
    max-width: 100%;
    overflow: hidden;
  }

  .kb-key--wide .kb-key__main,
  .kb-key--back .kb-key__main,
  .kb-key--enter .kb-key__main,
  .kb-key--shift .kb-key__main,
  .kb-key--mod .kb-key__main {
    font-size: clamp(0.5rem, 2.1vw, 0.7rem);
  }

  .kb-key__hint {
    display: none;
  }
}
