/* Choose your language (js/language-picker.js): the chat's window, also on the home page and the
   sign-in page. A window with search and two grids of languages, "Available" and "Coming soon"
   (greyed out), three columns on wide screens. Colours from the page's own tokens (base.css; the
   chat's palette in chat.css). */
.lang-dialog {
  width: min(720px, calc(100vw - 32px));
  height: min(560px, calc(100dvh - 48px));
  max-width: none;
  max-height: calc(100dvh - 48px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg);
  color: var(--text);
  box-shadow: 0 40px 120px -20px rgba(0, 0, 0, 0.55);
}
.lang-dialog[open] { display: flex; flex-direction: column; }
.lang-dialog::backdrop { background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(2px); }
.lang-head { display: flex; align-items: center; gap: 2px; padding: 14px 10px 6px 20px; }
.lang-title { flex: 1; min-width: 0; margin: 0; overflow: hidden; font-size: 1.35rem; font-weight: 600; letter-spacing: -0.01em; text-overflow: ellipsis; white-space: nowrap; }
.lang-close {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.lang-close:hover, .lang-close:focus-visible { background: color-mix(in srgb, var(--text) 7%, transparent); color: var(--text); }
.lang-close svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.lang-body { display: flex; flex: 1; flex-direction: column; min-height: 0; padding: 8px 20px 0; }
.lang-search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
}
.lang-search:focus-within { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); }
.lang-search svg { width: 16px; height: 16px; flex: none; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; }
.lang-search input { flex: 1; min-width: 0; padding: 8px 0; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; }
.lang-search input::placeholder { color: var(--muted); }
.lang-search input::-webkit-search-cancel-button { cursor: pointer; }
.lang-count { margin: 10px 2px 0; color: var(--muted); font-size: 0.78rem; }
.lang-count:empty { display: none; }
.lang-list { flex: 1; min-height: 0; margin: 4px -8px 0; padding: 0 8px 16px; overflow-y: auto; }
.lang-group { margin: 14px 2px 6px; color: var(--muted); font-size: 0.75rem; font-weight: 500; }
.lang-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; margin: 0; padding: 0; list-style: none; }
@media (max-width: 640px) { .lang-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 400px) { .lang-grid { grid-template-columns: minmax(0, 1fr); } }
.lang-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.lang-option:hover:not(:disabled), .lang-option:focus-visible { background: color-mix(in srgb, var(--text) 7%, transparent); }
.lang-option[aria-current="true"] { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.lang-option:focus-visible { outline-offset: -2px; }
.lang-option:disabled { cursor: default; }
.lang-option:disabled .lang-names { opacity: 0.45; }
.lang-names { display: flex; flex: 1; flex-direction: column; min-width: 0; line-height: 1.35; }
.lang-native, .lang-english { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lang-native { font-size: 0.92rem; font-weight: 600; }
.lang-english { color: var(--muted); font-size: 0.8rem; }
.lang-check { width: 16px; height: 16px; flex-shrink: 0; fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; visibility: hidden; }
.lang-option[aria-current="true"] .lang-check { visibility: visible; }
