/* The answer panel (js/panel.js): fixed above the bottom navigation, or at the screen edge where there is none. */
.pnl {
  --pnl-key: 3.1rem;
  --pnl-safe: env(safe-area-inset-bottom, 0px);
  position: fixed;
  left: var(--bg-left, 0px);
  right: 0;
  bottom: calc(var(--under-h, 0px) + var(--pnl-lift, 0px));
  z-index: 50;
  display: flex;
  justify-content: center;
  padding: .55rem .75rem calc(.55rem + var(--pnl-safe));
  background: color-mix(in srgb, var(--surface) 95%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  box-shadow: 0 -8px 20px rgb(30 42 71 / .07);
}
.pnl[hidden] { display: none; }
/* The bottom navigation already pads for the safe area. */
.area-dashboard:not(.page-question) .pnl { --pnl-safe: 0px; }
body.kb-open .pnl { bottom: var(--kb-h, 0px); }
body.has-panel { padding-bottom: calc(var(--under-h, 0px) + var(--panel-h, 0px) + .75rem); }

.pnl__inner { width: min(100%, 560px); display: grid; gap: .5rem; }

.pnl-row { display: grid; gap: .5rem; align-items: center; }
.pnl-row--keys { grid-template-columns: repeat(var(--cols, 5), minmax(0, 1fr)); justify-items: center; }
.pnl-row--tools { display: flex; justify-content: center; gap: .6rem; }
.pnl-row--action { display: flex; gap: .6rem; }
.pnl-row--action .pnl-key--pill { flex: 1; }
.pnl-row--text { justify-items: center; text-align: center; font-weight: 800; font-size: .95rem; color: var(--muted); }

.pnl-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  min-height: var(--pnl-key);
  padding: 0;
  border: 2px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 3px 0 var(--edge);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: transform .06s ease, box-shadow .06s ease, background-color .12s ease;
}
.pnl-key .icon { width: 1.35em; height: 1.35em; }
.pnl-key:active, .pnl-key.is-pressed { transform: translateY(3px); box-shadow: 0 0 0 var(--edge); }
.pnl-key:disabled { opacity: .4; pointer-events: none; }
.pnl-key:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.pnl-key--circle { width: 100%; max-width: var(--pnl-key); aspect-ratio: 1; min-height: 0; border-radius: 50%; }
.pnl-key--pill { width: 100%; border-radius: 999px; padding: 0 1.2rem; }
.pnl-key--square { width: var(--pnl-key); border-radius: 18px; }
.pnl-key--chip { width: 100%; min-height: 2.6rem; border-radius: 14px; font-size: 1.15rem; }
/* Long choice words get a smaller font instead of breaking mid-word (--len is the longest word, see panel.js). */
.pnl-key--pill { white-space: normal; text-align: center; line-height: 1.15; padding-block: .35rem; overflow-wrap: anywhere; }
.pnl-key[style*="--len"] { font-size: clamp(.78rem, calc(15rem / var(--len)), 1.2rem); }

.pnl-key--primary { background: var(--primary); border-color: var(--primary-edge); color: var(--primary-ink); box-shadow: 0 3px 0 var(--primary-edge); }
.pnl-key--good { background: var(--good); border-color: var(--good-edge); color: #fff; box-shadow: 0 3px 0 var(--good-edge); }
.pnl-key--danger { background: var(--bad-soft); border-color: var(--bad); color: var(--bad-ink); box-shadow: 0 3px 0 var(--bad-edge); }
.pnl-key--primary:active, .pnl-key--good:active, .pnl-key--danger:active { box-shadow: 0 0 0 transparent; }
.pnl-key[style*="--key-color"] { background: var(--key-color); border-color: transparent; color: #fff; box-shadow: 0 3px 0 rgb(0 0 0 / .22); }
.pnl-key.is-selected { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-text); box-shadow: 0 3px 0 var(--primary); }

@media (max-width: 420px) { .pnl { --pnl-key: 2.9rem; } }

/* Question pages: the panel measures itself (--panel-h), so the plane and the page leave room for exactly that. */
body.page-question.has-panel { padding-bottom: var(--kb-h, 0px); }
.page-question.has-panel .main { padding-bottom: calc(var(--panel-h, 0px) + 1rem); }
.page-question.has-panel.has-sheet .main { padding-bottom: calc(var(--sheet-h, 0px) + 1rem); }
/* iPhones: the bottom navigation also pads for the home indicator. */
.area-dashboard:not(.page-question) .pnl { bottom: calc(var(--under-h, 0px) + env(safe-area-inset-bottom, 0px) + var(--pnl-lift, 0px)); }
.page-question.has-panel { --q-chrome: calc(9.5rem + var(--panel-h, 0px)); }
