/* Short laptops, phones and touch devices (loaded last). zc-compact is on <body> during a lesson or the speed challenge,
   zc-touch on touch devices. */

/* Short laptop screens: the keyboard must fit without scrolling. */
@media (max-height: 820px) and (min-width: 821px) {
  .zc-text-box { height: 11rem; }
  .zc-k { width: 2.9rem; height: 2.9rem; }
  .zc-k .zy { font-size: 1.25rem; }
  .zc-k.space { height: 2.1rem; }
  .zc-c { font-size: 1.75rem; height: 2.5rem; min-width: 1.9rem; }
}

/* Narrow screens: keys sized on the screen's width. */
@media (max-width: 820px) {
  .zc-k { width: 8.2vw; height: 8.2vw; }
  .zc-k .zy { font-size: 4.2vw; }
  .zc-k .lt { font-size: .55rem; top: 0; left: .2rem; }
  .zc-k.space { width: 50vw; height: 6vw; }
  .zc-kb-row { gap: .8vw; } .zc-kb { gap: .8vw; padding: .6rem 0; }
  .zc-kb-row.r1 { margin-left: 3vw; } .zc-kb-row.r2 { margin-left: 5vw; } .zc-kb-row.r3 { margin-left: 8vw; }
  .zc-c { font-size: 1.6rem; min-width: 1.75rem; height: 2.5rem; }
}

/* Phones: the header stays on one line. */
@media (max-width: 575.98px) {
  header .nav-link { font-size: .875rem; }
  header .h4 { font-size: 1.15rem; }
}

/* Touch devices: no zoom on double tap, no letters on the keys, a visible press. */
body.zc-touch { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
body.zc-touch .zc-k { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: none; }
body.zc-touch .zc-k .lt, body.zc-touch .zc-k.home::after { display: none; }
body.zc-touch .zc-k.press { filter: brightness(.9); transform: translateY(2px) scale(.96); }

/* Touch devices, in a lesson or the challenge: the keyboard is docked at the bottom, full width. */
body.zc-touch.zc-compact .zc-kb-card {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; margin: 0 !important;
  border-radius: 1rem 1rem 0 0; border-bottom: 0; padding-bottom: env(safe-area-inset-bottom);
  box-shadow: var(--bs-box-shadow);
}
body.zc-touch.zc-compact .zc-kb { padding: .5rem .25rem .4rem; gap: .35rem; }
body.zc-touch.zc-compact .zc-kb-row { gap: 3px; margin-left: 0 !important; justify-content: center; }
body.zc-touch.zc-compact .zc-k { width: calc((100vw - 8px - 30px) / 11); max-width: 4rem; height: 3rem; }
body.zc-touch.zc-compact .zc-k .zy { font-size: min(5.4vw, 1.6rem); }
body.zc-touch.zc-compact .zc-k.space { width: 62vw; max-width: 26rem; height: 2.6rem; }
body.zc-touch.zc-compact .zc-k.space .zy { font-size: .85rem; }
body.zc-touch.zc-compact main { padding-bottom: calc(19rem + env(safe-area-inset-bottom)) !important; }
body.zc-touch.zc-compact .zc-lesson-hint { display: none; }

/* Phones, in a lesson or the challenge: everything smaller so it fits above the docked keyboard. */
@media (pointer: coarse) and (max-width: 820px) {
  body.zc-compact .zc-langs { display: none !important; }
  body.zc-compact .zc-lesson-meta, body.zc-compact .zc-retry-label, body.zc-compact .zc-new-keys-label { display: none; }
  body.zc-compact .zc-text-box { height: 9.5rem; }
  body.zc-compact .zc-text-inner { row-gap: .5rem; }
  body.zc-compact .zc-c { font-size: 1.5rem; min-width: 1.5rem; height: 2.1rem; }
  body.zc-compact .zc-c.sp { min-width: 1rem; font-size: .8rem; }
  body.zc-compact .zc-blk.word-end { margin-right: .5rem; }
  body.zc-compact .zc-blk .zc-hz { font-size: .95rem; height: 1.25rem; line-height: 1.25rem; }
  body.zc-compact .zc-arena { height: calc(100svh - 26rem - env(safe-area-inset-bottom)); min-height: 13rem; }
  body.zc-compact .zc-drop { width: 3rem; height: 3rem; margin-left: -1.5rem; font-size: 1.35rem; }
  body.zc-compact #screen-speed .row { --bs-gutter-y: .5rem; --bs-gutter-x: .35rem; }
  body.zc-compact .zc-stat { padding: .2rem 0 !important; }
  body.zc-compact .zc-stat .small { font-size: .65rem; }
  body.zc-compact .zc-stat .h4 { font-size: 1rem; }
  body.zc-compact .zc-lives { gap: .2rem; }
  body.zc-compact .zc-life { width: .7rem; height: .7rem; }
}
