/* Hit Point & Click: party voice inside the chat window (js/voice.js renders it; js/chat.js gives it a place).
   .chat-vbtn  = the headset "join voice" button in the chat header (hidden while you're in voice)
   .chat-voice = the strip under the chat header while you're in voice: people, mute, settings, leave
   .chat-fab.voice-* = the round chat button showing you're in voice while the chat window is closed */

/* ---------- join button in the chat header ---------- */
/* same look as the round chat button (.chat-fab in chat.css): the theme's crimson with a white icon */
.chat-vbtn { width: 32px; height: 32px; flex: none; display: grid; place-items: center; padding: 0; border-radius: 50%; cursor: pointer;
  border: 1px solid var(--crimson3); background: linear-gradient(180deg, var(--crimson2), var(--crimson)); color: #fff; }
.chat-vbtn svg { width: 18px; height: 18px; }
.chat-vbtn:hover { filter: brightness(1.15); box-shadow: 0 0 0 3px rgba(0, 0, 0, .25); }
.chat-vbtn.busy { opacity: .6; cursor: progress; }
.chat-vbtn { position: relative; }
.chat-vbtn[data-n]::after { content: attr(data-n); position: absolute; top: -5px; right: -6px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: #3f9b5a; color: #fff; font: 700 10px/16px var(--sans); text-align: center; box-shadow: 0 0 0 2px var(--panel); }
.chat-online small { white-space: nowrap; }
.chat-online .chat-invoice { margin-left: 8px; color: #7fd497; }
.chat-online .chat-invoice::before { display: none; }
.chat-vbtn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- the strip ---------- */
/* The strip never takes more than 70% of the chat window; when settings are open they scroll inside it, so the
   people cards and controls stay put and the messages and typing box keep their room. */
.chat-voice { flex: none; display: flex; flex-direction: column; max-height: 70%; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, rgba(63, 155, 90, .10), transparent), var(--panel); padding: 6px 8px; }
.cv-bar { display: flex; align-items: center; gap: 6px; }
.cv-label { flex: 1; min-width: 0; font: 600 11px var(--sans); text-transform: uppercase; letter-spacing: .08em; color: #7fd497; padding: 0 2px; }
.cv-label::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #4cc26b; margin-right: 6px; vertical-align: 1px; }
.cv-label.warn { color: var(--gold); }
.cv-label.warn::before { background: var(--gold); }

/* Mini cards: portrait, first name, and a tag for "you" or a changed volume. Wraps; 8 players = 2 rows. */
.cv-people { display: grid; grid-template-columns: repeat(auto-fill, minmax(66px, 1fr)); gap: 6px; list-style: none; margin: 8px 0 2px; padding: 0;
  max-height: 172px; overflow-y: auto; scrollbar-width: thin; }
.cv-p { position: relative; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 7px 4px 6px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); cursor: pointer;
  transition: border-color .12s, box-shadow .12s, background .12s; }
.cv-p:hover { border-color: var(--gold-dim); background: var(--hover); }
.cv-p.me { cursor: default; }
.cv-p.me:hover { border-color: var(--line); background: var(--panel2); }
.cv-p.talking { border-color: #6fe08f; background: rgba(63, 155, 90, .16); box-shadow: 0 0 0 1px #6fe08f, 0 0 12px rgba(111, 224, 143, .35); }
.cv-p.on { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.cv-face { position: relative; display: block; }
.cv-p .cav { width: 44px; height: 44px; font-size: 18px; transition: box-shadow .12s; }
.cv-p.talking .cav { box-shadow: 0 0 0 2px #6fe08f; }
.cv-p.muted .cav { filter: saturate(.35) brightness(.75); }
.cv-p.muted .cv-name { color: var(--muted); }
.cv-mut { position: absolute; right: -4px; bottom: -3px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center;
  background: #8e2433; color: #fff; box-shadow: 0 0 0 2px var(--panel2); }
.cv-mut svg { width: 12px; height: 12px; }
.cv-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 600; line-height: 1.2; }
.cv-tag { position: absolute; top: 3px; right: 4px; font-size: 9.5px; line-height: 1; padding: 2px 4px; border-radius: 6px;
  color: var(--gold); background: var(--well); border: 1px solid var(--line2); }
.cv-p:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
/* connection quality dot, top-left of a card (good / fair / poor; hidden while unknown) */
.cv-q { position: absolute; top: 5px; left: 5px; width: 8px; height: 8px; border-radius: 50%; box-shadow: 0 0 0 2px var(--panel2); }
.cv-q.excellent { background: #4cc26b; }
.cv-q.good { background: #e3c14d; }
.cv-q.poor, .cv-q.lost { background: #e0504a; }

.cv-btn { flex: none; width: 44px; height: 44px; display: grid; place-items: center; padding: 0; border-radius: 11px; cursor: pointer;
  border: 1px solid var(--line2); background: var(--panel2); color: var(--text); }
.cv-btn svg { width: 24px; height: 24px; }
.cv-btn:hover { background: var(--hover); border-color: var(--gold-dim); }
.cv-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.cv-btn.mic.off { background: rgba(110, 29, 49, .55); border-color: var(--crimson2); color: #f6c9c9; }
.cv-btn.on { background: color-mix(in srgb, var(--gold) 72%, var(--panel2)); border-color: var(--gold); color: var(--bg);
  box-shadow: 0 0 0 1px var(--gold-dim), 0 0 8px color-mix(in srgb, var(--gold-dim) 70%, transparent); }
.cv-btn.on:hover { background: color-mix(in srgb, var(--gold) 85%, var(--panel2)); }
.cv-btn.deaf.off { background: rgba(110, 29, 49, .55); border-color: var(--crimson2); color: #f6c9c9; }
.cv-btn.leave { background: #7d2230; border-color: #a3304b; color: #fff; }
.cv-btn.leave:hover { background: #962a3a; }

.cv-note, .cv-err { margin: 2px 4px; font-size: 13px; color: var(--muted); }
.cv-err { color: #f3c2c2; margin: 6px 4px 2px; }
/* "Your mic isn't picking up any sound" */
.cv-warn { margin: 6px 4px 2px; padding: 8px 10px; border-radius: 8px; border: 1px solid rgba(234, 185, 108, .45); background: rgba(234, 185, 108, .10); }
.cv-warn p { margin: 0 0 6px; font-size: 13px; color: var(--text); }
.cv-warn .cv-row { margin: 0; }
.cv-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 6px 4px 2px; }
.cv-vol { display: flex; align-items: center; gap: 8px; margin: 6px 4px 2px; font-size: 12px; color: var(--muted); }
.cv-vol span { max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-weight: 600; }
.cv-vol input { flex: 1; min-width: 60px; accent-color: var(--gold); }
.cv-vol input:disabled { opacity: .35; }
/* "mute for me" in the per-person row; the card then shows a speaker-off badge and dims */
.cv-hush { flex: none; display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line2); background: var(--panel2); color: var(--text); font: 600 12px var(--sans); }
.cv-hush svg { width: 15px; height: 15px; }
.cv-hush:hover { border-color: var(--gold-dim); background: var(--hover); }
.cv-hush.on { background: rgba(110, 29, 49, .55); border-color: var(--crimson2); color: #f6c9c9; }
.cv-mut.hush { background: #5a4a6e; }
.cv-p.hushed .cav { filter: saturate(.35) brightness(.75); }
.cv-p.hushed .cv-name { color: var(--muted); }
.cv-vol b { width: 38px; text-align: right; font-variant-numeric: tabular-nums; color: var(--text); font-weight: 600; }
.cv-micvol { margin: 0; }
.cv-micvol span { color: var(--muted); font-weight: 400; }
.chat-voice > * { flex: none; }
/* Voice settings open: they take the whole chat window below the header (messages and typing box hide until closed) */
.chat-win:has(> .chat-voice .cv-settings) > :not(.chat-head, .chat-voice) { display: none !important; }
.chat-win:has(> .chat-voice .cv-settings) > .chat-voice { flex: 1 1 auto; min-height: 0; max-height: none; border-bottom: 0; }
.cv-settings { display: grid; gap: 6px; margin: 8px 0 2px; padding: 0 6px 4px 4px; }
.chat-voice > .cv-settings { flex: 0 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.cv-settings label { display: grid; gap: 3px; font-size: 12px; color: var(--muted); }
.cv-settings select { width: 100%; }
.cv-fine { margin: 0; color: var(--faint); font-size: 11.5px; }
.cv-set { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.cv-set b { font-weight: 400; color: var(--faint); }
/* noise filter: three-way segmented switch */
.cv-seg { display: flex; border: 1px solid var(--line2); border-radius: 9px; overflow: hidden; }
.cv-seg button { flex: 1; padding: 6px 4px; border: 0; background: var(--panel2); color: var(--text); font: 600 12px var(--sans); cursor: pointer; }
.cv-seg button + button { border-left: 1px solid var(--line2); }
.cv-seg button:hover { background: var(--hover); }
.cv-seg button.on { background: rgba(234, 185, 108, .18); color: var(--gold); }
/* sensitivity: live mic level bar with the threshold slider laid over it (the thumb is "the line") */
.cv-meter { position: relative; height: 22px; border-radius: 6px; background: var(--well); border: 1px solid var(--line2); overflow: hidden; }
.cv-meter i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: #59626a; transition: width .05s linear; }
.cv-meter i.open { background: #4cc26b; }
.cv-meter input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; background: transparent; -webkit-appearance: none; appearance: none; cursor: ew-resize; }
.cv-meter input::-webkit-slider-runnable-track { background: transparent; height: 100%; }
.cv-meter input::-moz-range-track { background: transparent; }
.cv-meter input::-webkit-slider-thumb { -webkit-appearance: none; width: 4px; height: 22px; background: var(--gold); border-radius: 2px; box-shadow: 0 0 0 1px rgba(0,0,0,.5); }
.cv-meter input::-moz-range-thumb { width: 4px; height: 22px; border: 0; background: var(--gold); border-radius: 2px; }
.cv-settings .cv-check { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); cursor: pointer; }
.cv-row .btn[disabled] { opacity: .6; cursor: default; }

/* ---------- the round chat button while you're in voice ---------- */
.chat-fab.voice-live { box-shadow: 0 0 0 3px #3f9b5a, 0 6px 20px rgba(0, 0, 0, .45); }
.chat-fab.voice-live.voice-talking { box-shadow: 0 0 0 3px #6fe08f, 0 0 18px 4px rgba(111, 224, 143, .45), 0 6px 20px rgba(0, 0, 0, .45); }
.chat-fab.voice-muted::before { content: ''; position: absolute; left: -2px; bottom: -2px; width: 18px; height: 18px; border-radius: 50%;
  background: #c0392b no-repeat center / 11px 11px; box-shadow: 0 0 0 2px var(--bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 5l14 14' stroke='white' stroke-width='3.5' stroke-linecap='round'/%3E%3C/svg%3E"); }

/* ---------- the chat pop-out: voice cards grow with the window (up to about twice the size) ---------- */
.chat-full .cv-people { grid-template-columns: repeat(auto-fill, minmax(clamp(66px, 16vw, 140px), 1fr)); gap: clamp(6px, 1.2vw, 10px); max-height: calc(45vh / var(--cz, 1)); }
.chat-full .cv-p { padding: clamp(7px, 1.4vw, 12px) 4px clamp(6px, 1.2vw, 10px); gap: clamp(4px, .8vw, 7px); border-radius: clamp(10px, 1.6vw, 14px); }
.chat-full .cv-p .cav { width: clamp(44px, 10vw, 92px); height: clamp(44px, 10vw, 92px); font-size: clamp(18px, 4vw, 38px); }
.chat-full .cv-name { font-size: clamp(12px, 2.2vw, 16px); }
.chat-full .cv-mut { width: clamp(18px, 3.4vw, 28px); height: clamp(18px, 3.4vw, 28px); }
.chat-full .cv-mut svg { width: 65%; height: 65%; }
.chat-full .cv-q { width: clamp(8px, 1.4vw, 12px); height: clamp(8px, 1.4vw, 12px); }
.chat-full .cv-tag { font-size: clamp(9.5px, 1.6vw, 12px); }
/* text size buttons in the pop-out header */
.chat-zoom { flex: none; }
.chat-zoom .btn.small { padding: 3px 7px; min-width: 0; }
.chat-zoom .zoom-pct { min-width: 34px; font-size: 11px; }

@media (prefers-reduced-motion: reduce) { .cv-p .cav, .cv-meter i { transition: none; } }
/* narrow pop-out: keep the header on one line (the % reading goes; the buttons stay) */
.chat-full .chat-title b { white-space: nowrap; }
@media (max-width: 500px) { .chat-zoom .zoom-pct { display: none; } .chat-zoom { gap: 2px; } }
/* pop-out at a big text size in a narrow window: the header controls wrap onto a second row instead of
   overlapping the title (they keep their order; the title row stays first) */
.chat-full .chat-head { flex-wrap: wrap; row-gap: 6px; }
.chat-full .chat-title { min-width: max-content; }
