/* ================================================================ Configurações: abas novas, busca, temas,
   acessibilidade, chat e o painel ⚙ dos jogos (ver js/settings.js, js/controles.js e js/gamecfg.js) */

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------------------------------------------------------------- navegação e busca */
.settings-nav { overflow-y: auto; }
.settings-search { display: block; padding: 0 2px 8px; }
.settings-search input { width: 100%; padding: 8px 10px; border-radius: 8px; font-size: 13.5px; }
.settings-group { padding: 12px 10px 4px; font: 700 10.5px/1 var(--font-display); letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-3); }
.settings-tab { flex-shrink: 0; }

/* ---------------------------------------------------------------- linhas */
.cfg-intro { margin: -8px 0 0; }
.cfg-extra { display: flex; flex-direction: column; gap: 16px; }
.cfg-extra:empty { display: none; }
.cfg-row { scroll-margin: 40px; border-radius: 10px; transition: background 0.4s, box-shadow 0.4s; }
.cfg-row > label:not(.toggle), .cfg-label { font: 600 11.5px/1.2 var(--font-display); letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-2); }
.cfg-hint { display: block; font-size: 12.5px; line-height: 1.4; color: var(--text-2); }
.cfg-range-line { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cfg-range-line input[type="range"] { flex: 1; min-width: 0; }
.cfg-value { min-width: 46px; text-align: right; font: 700 13px/1 var(--font-display); color: var(--text); }
.cfg-test { flex-shrink: 0; }
.cfg-test .icon { width: 15px; height: 15px; }
.toggle.disabled { opacity: 0.5; cursor: default; }
.cfg-flash { background: rgba(var(--hot-rgb), 0.14); box-shadow: 0 0 0 6px rgba(var(--hot-rgb), 0.14); }
.cfg-reset { padding-top: 14px; border-top: 1px solid var(--line); }
.cfg-reset .icon, .cfg-row .btn .icon { width: 16px; height: 16px; }

/* botões lado a lado */
.cfg-seg { display: flex; flex-wrap: wrap; gap: 6px; }
.cfg-seg button { padding: 7px 12px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--bg-3); color: var(--text-2); font-weight: 600; font-size: 13.5px; }
.cfg-seg button:hover { color: var(--text); background: var(--bg-4); }
.cfg-seg button.active { color: #fff; background: rgba(var(--hot-rgb), 0.22); border-color: rgba(var(--hot-rgb), 0.7); }

/* sons por categoria */
.cfg-sound { display: grid; grid-template-columns: minmax(0, 1fr) minmax(200px, 300px); align-items: center; gap: 6px 18px; padding: 4px 0; }
.cfg-sound .toggle { padding: 2px 0; }

/* microfone: medidor com a marca da sensibilidade */
.cfg-mic-test { display: flex; align-items: center; gap: 10px; }
.cfg-meter { position: relative; flex: 1; height: 10px; overflow: visible; }
.cfg-meter i { border-radius: 99px; }
.cfg-meter i.closed { filter: grayscale(1) brightness(0.6); }
.cfg-meter-mark { position: absolute; top: -4px; bottom: -4px; width: 2px; background: #fff; box-shadow: 0 0 6px rgba(255, 255, 255, 0.8); transform: translateX(-1px); }

/* volume de cada pessoa */
.cfg-people { display: flex; flex-direction: column; gap: 8px; }
.cfg-person { display: grid; grid-template-columns: auto minmax(70px, 1fr) minmax(90px, 1.2fr) minmax(90px, 1.2fr) auto; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; background: var(--bg-3); }
.cfg-person strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cfg-person-vol { display: flex; flex-direction: column; gap: 2px; font-size: 11px; color: var(--text-3); min-width: 0; }
.cfg-person-vol input { width: 100%; }

/* não perturbe */
.cfg-time-line { display: flex; flex-wrap: wrap; gap: 12px; }
.cfg-time { display: flex; align-items: center; gap: 8px; color: var(--text-2); }
.cfg-time input { padding: 6px 8px; }

/* aparelhos conectados */
.cfg-devices { display: flex; flex-direction: column; gap: 6px; margin: 0 0 8px; }
.cfg-devices li { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 10px; background: var(--bg-3); }
.cfg-devices li.current { box-shadow: inset 3px 0 0 var(--green); }
.cfg-devices li > span { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.cfg-devices small { color: var(--text-3); }
.btn.danger { color: #fff; background: var(--red); }
.btn.danger:disabled { opacity: 0.6; }

/* resultados da busca */
.cfg-results { display: flex; flex-direction: column; gap: 4px; }
.cfg-result { width: 100%; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 10px; text-align: left; background: var(--bg-3); }
.cfg-result:hover, .cfg-result:focus-visible { background: rgba(var(--hot-rgb), 0.16); }
.cfg-result small { flex-shrink: 0; color: var(--text-3); font-size: 12px; }

/* teclas dos jogos (aba Jogos e painel ⚙) */
.cfg-keys { margin-top: 6px; }
.gp-keys { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 12px; margin: 8px 0; }
.gp-key-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--text-2); }
.gp-key-row.changed span { color: var(--yellow); }
.gp-key { min-width: 62px; padding: 4px 8px; border-radius: 6px; border: 1px solid var(--line-2); background: var(--bg-4); font: 700 12px/1.2 var(--font-display); color: var(--text); }
.gp-key.wait { border-color: var(--yellow); color: var(--yellow); }

@media (max-width: 760px) {
  .settings-search { flex-shrink: 0; width: 170px; padding: 0 4px 0 0; }
  .settings-group { display: none; }
  .cfg-sound { grid-template-columns: minmax(0, 1fr); }
  .cfg-person { grid-template-columns: auto minmax(0, 1fr) auto; }
  .cfg-person .cfg-person-vol { grid-column: 1 / -1; }
  .cfg-mic-test { flex-wrap: wrap; }
  .cfg-mic-test .cfg-meter { flex-basis: 100%; }
}

/* ---------------------------------------------------------------- temas */
:root[data-theme="amoled"] {
  --bg-0: #000000;
  --bg-1: #030304;
  --bg-2: #060609;
  --bg-3: #0b0c11;
  --bg-4: #121420;
  --bg-5: #1a1d2c;
  --line: rgba(255, 255, 255, 0.07);
}
:root[data-theme="grafite"] {
  --bg-0: #16171c;
  --bg-1: #1b1d23;
  --bg-2: #202229;
  --bg-3: #26282f;
  --bg-4: #2d3038;
  --bg-5: #373a44;
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.13);
  --text-3: #80859a;
}

/* ---------------------------------------------------------------- acessibilidade */
:root.high-contrast { --text: #ffffff; --text-2: #d6d9e6; --text-3: #aeb3c8; --line: rgba(255, 255, 255, 0.2); --line-2: rgba(255, 255, 255, 0.32); }
:root.high-contrast .msg-text { color: #ffffff; }
:root.high-contrast .btn, :root.high-contrast .icon-btn, :root.high-contrast .channel { outline: 1px solid transparent; }
:root.high-contrast :focus-visible { outline-width: 3px; }
:root.underline-links a, :root.underline-links .msg-text a { text-decoration: underline; }
:root.reduce-motion *, :root.reduce-motion *::before, :root.reduce-motion *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
:root.reduce-motion .spinner { animation: none !important; }
:root.button-labels .dock .round-btn { position: relative; margin-bottom: 16px; }
:root.button-labels .dock .round-btn::after { content: attr(title); position: absolute; top: calc(100% + 3px); left: 50%; transform: translateX(-50%); font-size: 10.5px; line-height: 1.1; white-space: nowrap; color: var(--text-2); pointer-events: none; }

/* cosméticos parados (molduras, anéis, banners, figurinhas chegando) */
:root.no-cosmetic-anim .avatar-wrap *, :root.no-cosmetic-anim .avatar-wrap::before, :root.no-cosmetic-anim .avatar-wrap::after,
:root.no-cosmetic-anim .avatar-wrap *::before, :root.no-cosmetic-anim .avatar-wrap *::after,
:root.no-cosmetic-anim .tile *, :root.no-cosmetic-anim .tile, :root.no-cosmetic-anim .profile-banner, :root.no-cosmetic-anim .profile-banner *,
:root.no-cosmetic-anim .fig-msg { animation: none !important; }

/* Resenha em segundo plano (jogo ou outra janela na frente, minimizado, aba escondida; ver foco.js): os enfeites param
   onde estão e voltam com o foco. Quem está falando continua animando. */
:root.app-fundo :is(#tico-dock, .avatar-wrap:not(.speaking, .speaking > *), .bn, .nm, .rar, .profile-banner, .fig-msg, .xp-track),
:root.app-fundo :is(#tico-dock, .avatar-wrap:not(.speaking, .speaking > *), .bn, .nm, .rar, .profile-banner, .fig-msg, .xp-track)::before,
:root.app-fundo :is(#tico-dock, .avatar-wrap:not(.speaking, .speaking > *), .bn, .nm, .rar, .profile-banner, .fig-msg, .xp-track)::after,
:root.app-fundo :is(#tico-dock, .avatar-wrap:not(.speaking, .speaking > *), .bn, .nm, .rar, .profile-banner, .fig-msg, .xp-track) *,
:root.app-fundo :is(#tico-dock, .avatar-wrap:not(.speaking, .speaking > *), .bn, .nm, .rar, .profile-banner, .fig-msg, .xp-track) *::before,
:root.app-fundo :is(#tico-dock, .avatar-wrap:not(.speaking, .speaking > *), .bn, .nm, .rar, .profile-banner, .fig-msg, .xp-track) *::after { animation-play-state: paused !important; }

/* ---------------------------------------------------------------- chat */
.msg-text { font-size: calc(15px * var(--msg-scale, 1) * var(--ui-text, 1)); }
.msg-author { font-size: calc(15px * var(--ui-text, 1)); }
.msg-text.jumbo { font-size: var(--jumbo-size, 42px); }
.fig-msg { width: var(--sticker-size, 160px); height: var(--sticker-size, 160px); }
:root.spoilers-open .spoiler { color: inherit; background: rgba(255, 255, 255, 0.08); }
:root.chat-compact .msg { padding-top: 2px; padding-bottom: 0; }
:root.chat-compact .msg.grouped { padding-top: 0; padding-bottom: 0; }
:root.chat-compact .msg-line { gap: 10px; }
:root.chat-compact .msg .avatar.md { --size: 28px; }
:root.chat-compact .msg-gutter { width: 28px; }
:root.chat-compact .msg-head { gap: 5px; }
:root.chat-compact .msg-author { font-size: calc(14px * var(--ui-text, 1)); }
:root.chat-compact .day-divider { margin-top: 6px; margin-bottom: 6px; }
body { font-size: calc(15px * var(--ui-text, 1)); }

/* modo compacto da interface: listas mais juntinhas */
:root.ui-compact .channel { padding-top: 4px; padding-bottom: 4px; margin: 1px 0; }
:root.ui-compact .member { padding-top: 3px; padding-bottom: 3px; }
:root.ui-compact .settings-pane { gap: 10px; }

/* ---------------------------------------------------------------- jogos: ⚙, FPS e painel */
.stage-gear .icon { width: 19px; height: 19px; }
.gp-fps { position: absolute; top: 8px; left: 8px; z-index: 30; padding: 3px 7px; border-radius: 6px; background: rgba(0, 0, 0, 0.6); color: #7dffb2; font: 700 12px/1.2 var(--font-mono); pointer-events: none; }
.gp-panel {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 40;
  width: min(380px, calc(100% - 16px));
  max-height: calc(100% - 16px);
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  border: 1px solid var(--line-2);
  background: rgba(10, 12, 18, 0.96);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
}
.gp-head { display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 14px; border-bottom: 1px solid var(--line); }
.gp-head strong { flex: 1; font: 700 13px/1.2 var(--font-display); letter-spacing: 0.08em; text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gp-body { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; overflow-y: auto; }
.gp-body .toggle { padding: 2px 0; }
.gp-body .toggle-text strong { font-size: 12px; }
.gp-foot { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); }
.gp-section summary { cursor: pointer; font: 600 11.5px/1.2 var(--font-display); letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-2); padding: 4px 0; }
.gp-panel .gp-keys { grid-template-columns: minmax(0, 1fr); }
.stage-root { position: relative; }

/* tamanho do minimapa do Andarilhos (Configurações → Jogos) */
.stage-game[data-minimap="pequeno"] .an-mini { width: 118px; height: 118px; }
.stage-game[data-minimap="grande"] .an-mini { width: 220px; height: 220px; }

/* ---------------------------------------------------------------- acessibilidade (js/acessibilidade.js) */
/* botão da barra da esquerda, logo acima da Ajuda */
.rail-btn.a11y { margin-top: auto; border-style: solid; border-color: var(--line-2); color: var(--text-2); position: relative; }
.rail-btn.a11y + .rail-btn.help { margin-top: 0; }
.rail-btn.a11y .icon { width: 24px; height: 24px; }
.rail-btn.a11y:hover, .rail-btn.a11y[aria-expanded="true"] { color: #fff; border-radius: 14px; background: color-mix(in srgb, var(--cyan, #29e6ff) 22%, var(--bg-4)); border-color: transparent; }
/* vozes de ajuda desligadas: um risquinho no canto */
.rail-btn.a11y.voices-off::after { content: ""; position: absolute; right: 2px; bottom: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--bg-0) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ff5c6c' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6 6 18'/%3E%3C/svg%3E") center / 9px no-repeat; box-shadow: 0 0 0 2px var(--bg-0); }

/* menu rápido */
.a11y-pop { position: fixed; z-index: 70; width: min(340px, calc(100vw - 16px)); max-height: calc(100vh - 16px); max-height: calc(100dvh - 16px); display: flex; flex-direction: column; border-radius: 14px; border: 1px solid var(--line-2); background: var(--bg-2); box-shadow: 0 18px 60px rgba(0, 0, 0, 0.6); }
.a11y-pop-head { display: flex; align-items: center; gap: 8px; padding: 10px 8px 10px 14px; border-bottom: 1px solid var(--line); }
.a11y-pop-head > .icon { width: 20px; height: 20px; color: var(--cyan, #29e6ff); }
.a11y-pop-head strong { flex: 1; font: 700 13px/1.2 var(--font-display); letter-spacing: 0.1em; text-transform: uppercase; }
.a11y-pop-body { display: flex; flex-direction: column; gap: 4px; padding: 8px 14px 10px; overflow-y: auto; min-height: 0; }
.a11y-pop-body .toggle { padding: 5px 0; gap: 12px; }
.a11y-pop-body .toggle-text strong { font-size: 12px; }
.a11y-pop-sep { height: 1px; margin: 6px 0; background: var(--line); }
.a11y-pop-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); }
.a11y-key { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-2); }
.a11y-key > span { margin-left: 4px; }
.a11y-more .icon { width: 15px; height: 15px; }
/* interruptor geral e os dois de baixo recuados */
.a11y-master .toggle-text strong { color: var(--text); }
.a11y-sub { padding-left: 22px !important; position: relative; }
.a11y-sub::before { content: ""; position: absolute; left: 8px; top: 2px; bottom: 50%; width: 9px; border-left: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); border-bottom-left-radius: 6px; }
.a11y-where { margin: -4px 0 0; }

/* jogos: botão de voz ao lado do ⚙, títulos do painel e legendas */
.stage-voice .icon { width: 20px; height: 20px; }
.stage-voice.off, .tp-voice.off { color: var(--red, #ff5c6c); }
.stage-voice.off:hover, .tp-voice.off:hover { color: #fff; background: color-mix(in srgb, var(--red, #ff5c6c) 30%, var(--bg-4)); }
.tp-voice .icon { width: 18px; height: 18px; }
.gp-title { display: flex; align-items: center; gap: 7px; margin-top: 4px; font: 700 11.5px/1.2 var(--font-display); letter-spacing: 0.14em; text-transform: uppercase; color: var(--text); }
.gp-title .icon { width: 16px; height: 16px; color: var(--cyan, #29e6ff); }
.gp-a11y-title { margin-top: 0; }
.gp-group { display: flex; flex-direction: column; gap: 10px; padding: 10px 12px; border-radius: 10px; background: rgba(255, 255, 255, 0.035); border: 1px solid var(--line); }
.gp-caption { position: absolute; left: 50%; bottom: 22%; z-index: 35; max-width: min(720px, calc(100% - 32px)); padding: 8px 14px; border-radius: 10px; background: rgba(0, 0, 0, 0.78); color: #fff; font-weight: 600; font-size: 15px; line-height: 1.4; text-align: center; pointer-events: none; opacity: 0; transform: translate(-50%, 6px); transition: opacity 0.2s, transform 0.2s; text-shadow: 0 1px 2px #000; }
.gp-caption.show { opacity: 1; transform: translate(-50%, 0); }
.gp-caption b { color: #ffd166; }
:root.reduce-motion .gp-caption, .gp-reduced ~ .gp-caption { transition: none; }

@media (max-width: 560px) {
  .a11y-pop-foot { flex-direction: column; align-items: stretch; }
  .a11y-more { justify-content: center; }
  .gp-caption { bottom: 18%; font-size: 13.5px; }
}
