/* ══════════════════════════════════════════════════════════════════════════
   GLASS LAGOON — Voices nav tab + selection sheet (additive pair with
   voices-sheet.js). Loaded after every base stylesheet; styles ONLY the new
   #voices* / .voices-* elements + the #dockVoicesItem dock slot, and hides the
   retired #dockAccountItem. No base selector is redefined.

   Sheet chrome recipe + z-slots mirror the options sheet (#slideMenu) and the
   Accounts hub sheet: scrim 1490 < header 1500 < sheet 1600 < dock 1700, so the
   sheet rises from BEHIND the dock and the dock stays tappable. ≥769px it is a
   centred modal on the full-modal tier (z 2000+). Brand blue = --gl-blue*.
   ══════════════════════════════════════════════════════════════════════════ */

/* ── retire the old Purchase / Accounts dock slot (Family Pack now lives only
      in the avatar menu). Kept in the DOM so accounts-hub.js keeps all its
      wiring (its profile-menu entry point is untouched); just never shown. ── */
#dockAccountItem {
  display: none !important;
}

/* ════════════════ avatar + flag badge (shared: nav icon + rows) ════════════ */
.voices-av {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  border-radius: 50%;
}
.voices-av-img,
.voices-av-ini {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.voices-av-ini {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #35507e;
  letter-spacing: 0.02em;
  font-family: var(--gl-font-display, inherit);
}
.voices-av-flag {
  position: absolute;
  right: -2px;
  bottom: -2px;
  border-radius: 3px;
  background: #fff;
  box-shadow: 0 0 0 1.5px #fff, 0 1px 2px rgba(6, 24, 70, 0.3);
  object-fit: cover;
}

/* nav (dock) size — 32px circle, flag badge bottom-right overlapping the edge */
.voices-av-nav { width: 32px; height: 32px; }
.voices-av-nav .voices-av-ini { font-size: 12px; }
.voices-av-nav .voices-av-flag { width: 17px; height: 12px; }

/* row size — 38px circle */
.voices-av-row { width: 38px; height: 38px; }
.voices-av-row .voices-av-ini { font-size: 14px; }
.voices-av-row .voices-av-flag { width: 17px; height: 12px; }

/* ════════════════ dock Voices tab ════════════════ */
#dockVoicesItem .gl-dock-icon {
  /* the avatar is a raster/vector image, not a lucide <svg> — size the slot */
  width: 32px;
  height: 32px;
}
#dockVoicesAvatarSlot {
  display: inline-flex;
  line-height: 0;
}
/* active tab: a soft brand ring around the avatar (the label already goes blue
   via the base .gl-dock-item.gl-active rule) */
#dockVoicesItem.gl-active .voices-av-img,
#dockVoicesItem.gl-active .voices-av-ini {
  box-shadow: 0 0 0 2px var(--gl-blue, #4281F2);
}

/* ════════════════ scrim ════════════════ */
.voices-scrim {
  position: fixed;
  inset: 0;
  background: rgba(6, 20, 59, 0.45);
  opacity: 0;
  transition: opacity 0.26s ease;
  z-index: 1490;
}
.voices-scrim.is-open { opacity: 1; }
.voices-scrim[hidden] { display: none; }

/* ════════════════ sheet (≤768px bottom sheet) ════════════════ */
.voices-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  top: auto;
  display: flex;
  flex-direction: column;
  max-height: 82vh;
  max-height: 82dvh;
  background: linear-gradient(180deg, #ffffff, #f2f8ff);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.22);
  padding: 0 0 calc(var(--mc-dock-space, 60px) + 8px); /* clear the dock riding above */
  z-index: 1600; /* below the dock (1700): the sheet pops up from behind it */
  transform: translateY(100%);
  transition: transform 0.26s cubic-bezier(0.22, 0.9, 0.34, 1);
  font-family: "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;
}
.voices-sheet.is-open { transform: translateY(0); }
.voices-sheet[hidden] { display: none; }

/* grab-handle pill, same recipe as the options + accounts sheets */
.voices-sheet::before {
  content: "";
  flex: 0 0 auto;
  align-self: center;
  width: 44px;
  height: 5px;
  margin: 8px 0 2px;
  border-radius: 999px;
  background: rgba(27, 36, 64, 0.22);
}

/* ── header ── */
.voices-sheet-head {
  flex: 0 0 auto;
  position: relative;
  padding: 8px 20px 12px;
  text-align: center;
}
.voices-titlerow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
.voices-titlerow h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  color: #1b2440;
  font-family: var(--gl-font-display, inherit);
}
.voices-help {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  background: none;
  padding: 2px;
  cursor: pointer;
  color: #8a93a8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.voices-help svg { width: 20px; height: 20px; }
.voices-close {
  position: absolute;
  right: 12px;
  top: 4px;
  appearance: none;
  -webkit-appearance: none;
  border: none;
  background: rgba(27, 36, 64, 0.06);
  color: #51608a;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.voices-close:hover { background: rgba(27, 36, 64, 0.12); }
.voices-sub {
  margin: 8px 0 0;
  font-size: 14px;
  color: #51608a;
}
.voices-sub-muted {
  margin: 3px 0 0;
  font-size: 12.5px;
  color: #9aa3b5;
}

/* ── list ── */
.voices-list {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── row ── */
.voices-row {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid rgba(27, 36, 64, 0.12);
  border-radius: 16px;
  cursor: pointer;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.voices-row:active { transform: scale(0.995); }

.voices-row-text {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.voices-row-name {
  font-size: 17px;
  font-weight: 700;
  color: #1b2440;
  line-height: 1.2;
}
.voices-row-default {
  font-size: 13px;
  font-weight: 600;
  color: #9aa3b5;
}
.voices-row-lang {
  font-size: 14px;
  color: #6b7488;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.voices-row-trail {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  color: #b3bac8; /* muted speaker for unselected rows */
}
.voices-row-trail svg { width: 22px; height: 22px; }

/* selected row — 2px blue border + blue text + tick (same brand-blue treatment
   as the table chips / game-mode cards) */
.voices-row.is-selected {
  border: 2px solid var(--gl-blue, #4281F2);
  padding: 11px 13px; /* keep height stable when the border thickens */
  box-shadow: 0 2px 10px rgba(66, 129, 242, 0.14);
}
.voices-row.is-selected .voices-row-name { color: var(--gl-blue-deep, #2563EB); }
.voices-row.is-selected .voices-row-trail { color: var(--gl-blue-deep, #2563EB); }

/* ════════════════ ≥769px: centred modal (full-modal tier) ════════════════ */
@media (min-width: 769px) {
  .voices-scrim { z-index: 2000; }
  .voices-sheet {
    left: 50%;
    top: 50%;
    right: auto;
    bottom: auto;
    transform: translate(-50%, -50%) scale(0.96);
    width: min(460px, calc(100vw - 48px));
    max-height: 86vh;
    border-radius: 22px;
    padding-bottom: 12px;
    box-shadow: 0 24px 70px rgba(5, 18, 58, 0.4);
    opacity: 0;
    z-index: 2001;
    transition: opacity 0.2s ease, transform 0.2s ease;
  }
  .voices-sheet.is-open {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  .voices-sheet::before { display: none; } /* no drag handle in modal form */
  .voices-sheet-head { padding-top: 18px; }
}

/* ── Languages modal cleanup ──
   The voice picker moved to the dock Voices tab/sheet. Hide the modal's Voices
   section on mobile (the dock owns it there); keep it ≥769px where there is no
   bottom dock, so the desktop top-nav still has a voice picker. */
@media (max-width: 768px) {
  .gl-voices-modal-section { display: none !important; }
  /* Hide the "About voices" info icon after the title on mobile. */
  .voices-help { display: none !important; }
}

/* ── reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .voices-scrim,
  .voices-sheet { transition: none; }
}
