/* The accent keyboard — see assets/ef-keyboard.js for why it exists.
   Reuses the --ef-* contract from ef-tokens.css, and the --surface/--ink theme
   variables anywhere the panel has to stay legible in dark mode. */

.ef-kb__btn {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center; gap: .2rem;
  height: 1.7rem; min-width: 1.7rem; margin-left: .3rem; padding: 0 .4rem;
  border-radius: 7px; cursor: pointer; vertical-align: middle;
  border: 1px solid var(--ef-border, #E5D4CE);
  background: var(--ef-surface, #fff); color: var(--ef-primary, #733428);
}
.ef-kb__btn-glyph { font-family: var(--ef-serif, Georgia, serif); font-size: .92rem; line-height: 1; }
/* A CSS-drawn chevron, not a glyph — it has to read as "opens a dropdown" at
   a glance, which a lone accented "é" doesn't, and a border-triangle stays
   crisp and on-color (currentColor) at any zoom instead of depending on
   whichever font renders "▾". */
.ef-kb__btn-chev {
  width: 0; height: 0; margin-top: .1rem; flex: 0 0 auto;
  border-left: 3.5px solid transparent; border-right: 3.5px solid transparent;
  border-top: 4px solid currentColor; opacity: .65;
  transition: transform .15s ease;
}
.ef-kb__btn:hover { background: var(--ef-secondary, #FFF0EE); }
.ef-kb__btn[aria-expanded="true"] {
  background: var(--ef-primary, #733428); border-color: var(--ef-primary, #733428); color: #fff;
}
.ef-kb__btn[aria-expanded="true"] .ef-kb__btn-chev { transform: rotate(180deg); opacity: 1; }
/* Higher specificity than .ef-kb__btn's own display so the [hidden] attribute
   actually wins — the base class already sets display, which would otherwise
   outrank the UA stylesheet's [hidden] rule and leave the button visible. */
.ef-kb__btn[hidden] { display: none; }

/* Fixed, so a field inside a scrolling board or an overflow-hidden card can
   still show its panel — an absolutely positioned one gets clipped by an
   ancestor that has no idea it exists.

   Above EVERYTHING, and that is not decoration. The panel is a sibling of the
   overlays it serves — it lives on <body>, not inside the field's card — so at
   999 it opened *behind* every full-screen surface on the site: the series
   player, the flashcards session and the audio recorder all sit at 100000, and
   the admin modals with them. The button worked, the panel appeared, and the
   student saw nothing happen. Anything that can hold a French text field can
   hold this, so it has to outrank the lot (toasts included, at 100001 — a
   toast is telling you something, this is what your finger is on). */
.ef-kb__panel {
  position: fixed; z-index: 100002;
  display: flex; flex-wrap: wrap; gap: .3rem .5rem;
  max-width: min(22rem, calc(100vw - 16px));
  padding: .5rem .55rem; border-radius: 12px;
  border: 1px solid var(--ef-border, #E5D4CE);
  background: var(--surface, #fff);
  box-shadow: 0 8px 26px rgba(74, 33, 25, .18);
}
.ef-kb__panel[hidden] { display: none; }

/* Grouped by base letter, with a hairline between groups so "the e ones" read
   as a set rather than as four of nineteen identical buttons. */
.ef-kb__group { display: flex; gap: .2rem; padding-right: .5rem; }
.ef-kb__group + .ef-kb__group { border-left: 1px solid var(--ef-border-light, #F0E4E0); padding-left: .5rem; }

.ef-kb__key {
  min-width: 2rem; height: 2.1rem; padding: 0 .35rem; cursor: pointer;
  border-radius: 8px; font-size: 1rem; line-height: 1;
  font-family: var(--ef-serif, Georgia, serif);
  border: 1px solid var(--ef-border-light, #F0E4E0);
  background: var(--ef-bg-soft, #FFFBF9); color: var(--ink, #4a3b35);
}
.ef-kb__key:hover { background: var(--ef-tint, #F6DED7); border-color: var(--ef-tint-strong, #EFC9BE); }
.ef-kb__key:active { background: var(--ef-primary, #733428); color: #fff; }

@media (max-width: 480px) {
  .ef-kb__panel { max-width: calc(100vw - 16px); }
  .ef-kb__key { min-width: 1.9rem; height: 2rem; }
}
