/* Filo: finestra Preferenze, menu dell'avatar ed effetti delle preferenze (public/prefs.js). Solo token di style.css. */
.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; }

/* ---------- finestra ---------- */
.pf-back { position: fixed; inset: 0; z-index: 60; background: rgba(10, 16, 15, .45); display: grid; place-items: center; padding: 24px; }
.pf-win { width: min(920px, 100%); height: min(680px, 100%); background: var(--bg); color: var(--text); border-radius: 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; }
.pf-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 10px 22px; border-bottom: 1px solid var(--border); }
.pf-head h2 { margin: 0; font-size: 20px; }
.pf-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 230px 1fr; }
.pf-nav { overflow-y: auto; padding: 10px 8px; border-right: 1px solid var(--border); background: var(--bg-soft); display: flex; flex-direction: column; gap: 1px; }
.pf-tab { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 7px; text-align: left; font-size: 14px; color: var(--text); }
.pf-tab:hover { background: var(--bg-hover); }
.pf-tab.on { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.pf-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.pf-content { overflow-y: auto; padding: 18px 26px 32px; outline: 0; }
.pf-h { margin: 0 0 6px; font-size: 18px; }
.pf-block { padding: 14px 0; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; }
.pf-block:last-child { border-bottom: 0; }
.pf-block h3 { margin: 0 0 2px; font-size: 15px; }
.pf-block h4 { margin: 10px 0 2px; font-size: 13px; color: var(--muted); font-weight: 600; }
.pf-hint { margin: 0; color: var(--muted); font-size: 13px; }
.pf-check { display: flex; align-items: flex-start; gap: 9px; font-size: 14px; padding: 3px 0; cursor: pointer; }
.pf-check input { margin: 3px 0 0; accent-color: var(--accent); flex: none; }
.pf-check small, .pf-radios legend small { display: block; color: var(--muted); font-size: 12.5px; font-weight: 400; }
.pf-radios { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.pf-radios legend { font-size: 13px; font-weight: 600; padding: 0 0 4px; }
.pf-field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; }
.pf-field select, .pf-field input[type=text], .pf-field input[type=time], .pf-people-add input, .pf-day input[type=time] {
  padding: 7px 9px; border: 1px solid var(--border); border-radius: 7px; background: var(--bg); color: var(--text); font-size: 14px; font-weight: 400; max-width: 380px; }
.pf-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.pf-time { width: 140px; }
.pf-days { display: flex; flex-direction: column; gap: 4px; }
.pf-day { display: grid; grid-template-columns: 130px auto auto auto; gap: 8px; align-items: center; }
.pf-day input:disabled { opacity: .5; }
.pf-device { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); }
.pf-warn { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 8px; background: var(--mention-bg); color: var(--mention-text); font-size: 13.5px; margin: 6px 0; }
.pf-warn.soft { background: var(--accent-soft); color: var(--text); }
.pf-sound select { min-width: 180px; }
.pf-list { display: flex; flex-direction: column; gap: 2px; }
.pf-person { display: flex; align-items: center; gap: 10px; padding: 6px 4px; border-radius: 7px; font-size: 14px; text-align: left; width: 100%; }
.pf-person .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-pick:hover, .pf-pick:focus-visible { background: var(--bg-hover); }
.pf-people-add { position: relative; display: flex; flex-direction: column; gap: 4px; }
.pf-people-add input { width: 100%; }
.pf-navlist { display: flex; flex-direction: column; gap: 2px; max-width: 420px; }
.pf-nav-row { display: flex; align-items: center; gap: 8px; padding: 4px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); font-size: 14px; }
.pf-nav-row.fixed { background: var(--bg-soft); color: var(--muted); }
.pf-nav-row .pf-check { flex: 1; }
.pf-nav-row .grow { flex: 1; }
.pf-nav-row.dragging { opacity: .5; }
.pf-grip { cursor: grab; color: var(--muted); letter-spacing: -2px; }
.pf-move .icon-btn { width: 26px; height: 26px; border-radius: 6px; }
.pf-move .icon-btn:hover { background: var(--bg-hover); }
.pf-themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.pf-theme { display: flex; flex-direction: column; gap: 6px; padding: 6px; border: 2px solid var(--border); border-radius: 10px; text-align: left; font-size: 13px; }
.pf-theme.on { border-color: var(--accent); }
.pf-theme:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pf-sw { display: flex; gap: 5px; align-items: center; height: 34px; border-radius: 6px; padding: 0 8px; }
.pf-sw span { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(127, 127, 127, .5); }
.pf-tn small { display: block; color: var(--muted); font-size: 11.5px; }
.pf-colors input[type=color] { width: 64px; height: 34px; padding: 2px; border: 1px solid var(--border); border-radius: 7px; background: var(--bg); }
.pf-fonts { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 12px; }
.pf-font span { font-size: 15px; }
.pf-skins { display: flex; gap: 4px; }
.pf-skin, .pf-qe { width: 40px; height: 36px; border: 2px solid var(--border); border-radius: 8px; font-size: 20px; }
.pf-skin.on { border-color: var(--accent); }
.pf-qe:hover, .pf-skin:hover { background: var(--bg-hover); }
.pf-zoom input[type=range] { width: 220px; accent-color: var(--accent); }
.pf-zoom output { min-width: 48px; font-weight: 600; }
.pf-meter { width: 140px; height: 8px; border-radius: 4px; background: var(--border); overflow: hidden; align-self: center; }
.pf-meter span { display: block; height: 100%; width: 0; background: var(--success); transition: width .08s; }
.pf-cam { width: 260px; max-width: 100%; border-radius: 10px; background: #000; margin-top: 6px; }
.pf-keys { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; font-size: 14px; }
.pf-keys dd { margin: 0; }
.pf-keys kbd, .me-key { font: 12px ui-monospace, Menlo, monospace; border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; background: var(--bg-soft); color: var(--text); }

@media (max-width: 760px) {
  .pf-back { padding: 0; }
  .pf-win { width: 100%; height: 100%; border-radius: 0; }
  .pf-body { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .pf-nav { flex-direction: row; overflow-x: auto; overflow-y: hidden; border-right: 0; border-bottom: 1px solid var(--border); padding: 6px 8px; scrollbar-width: thin; }
  .pf-tab { flex: none; white-space: nowrap; }
  .pf-content { padding: 14px 16px 28px; }
  .pf-day { grid-template-columns: 1fr auto auto auto; }
}

/* ---------- menu dell'avatar ---------- */
.me-pop { min-width: 290px; }
.me-menu { display: flex; flex-direction: column; padding: 4px 0; }
.me-head { display: flex; gap: 10px; align-items: center; padding: 8px 16px 10px; }
.me-who { display: flex; flex-direction: column; min-width: 0; }
.me-who b { font-size: 15px; }
.me-pres { font-size: 13px; color: var(--muted); }
.me-menu button { display: flex !important; align-items: center; gap: 10px; }
.me-menu button > span:first-of-type:not(.me-emo) { flex: 1; }
.me-right { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13px; }
.me-menu button:hover .me-right, .me-menu button:focus .me-right, .me-menu button:hover .me-key { color: inherit; }
.me-key { margin-left: auto; }
.me-status-field { margin: 0 12px 6px; width: calc(100% - 24px) !important; border: 1px solid var(--border) !important; border-radius: 8px; padding: 7px 10px !important; color: var(--muted); }
.me-status-field .me-emo { font-size: 16px; display: inline-flex; }
.me-menu hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }

/* ---------- effetti nell'app ---------- */
body { font-family: var(--pf-font, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif); }
:root:not([data-pf-font="default"]) body { font-family: var(--pf-font); }
:root[data-pf-font="default"] body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
/* densità compatta: niente foto, nome e ora sulla stessa riga del testo */
:root[data-pf-density="compact"] .msg { grid-template-columns: 1fr; gap: 0; padding-top: 2px; padding-bottom: 2px; padding-left: 66px; }
:root[data-pf-density="compact"] .msg > .avatar, :root[data-pf-density="compact"] .msg > .pin-label + div:empty { display: none; }
:root[data-pf-density="compact"] .msg .time-side { position: absolute; left: 8px; top: 3px; width: 52px; text-align: right; }
:root[data-pf-density="compact"] .msg:not(.compact) .msg-head { display: inline-flex; margin-right: 6px; }
:root[data-pf-density="compact"] .msg:not(.compact) .msg-head + .msg-text, :root[data-pf-density="compact"] .msg:not(.compact) .msg-head ~ .msg-text { display: inline; }
.msg-handle { color: var(--muted); font-weight: 400; font-size: 13px; }
.msg-text.big-emoji { font-size: 34px; line-height: 1.25; }
.msg-text.big-emoji .cemoji { width: 36px; height: 36px; }
:root[data-pf-underline="on"] .msg-text a, :root[data-pf-underline="on"] .panel a, :root[data-pf-underline="on"] .pf-win a { text-decoration: underline; }
:root[data-pf-motion="off"] *, :root[data-pf-motion="off"] *::before, :root[data-pf-motion="off"] *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
:root[data-pf-linkimg="off"] .lp-img { display: none; }
:root[data-pf-md="on"] .composer .fmt-bar { display: none !important; }
:root[data-pf-actdm="off"] #view-page .act-item[data-kind="dm"] { display: none; }
#view-page .vp-body:has(> .act-item) { display: flex; flex-direction: column; }
/* colonna solo icone: niente testo, al posto dei numeri un pallino */
:root[data-pf-icons="only"] .rail-lb { display: none; }
:root[data-pf-icons="only"] .rail-badge.on { min-width: 0; width: 12px; height: 12px; padding: 0; right: 12px; top: 2px; font-size: 0; color: transparent; }
/* barra laterale chiara (temi Mare d'inverno, Carta o personalizzato chiaro) */
:root[data-pf-side-light="on"] .side-filter { border-color: rgba(0, 0, 0, .2); background: rgba(0, 0, 0, .05); }
/* persone nascoste */
.pf-hidden-msg { margin: 2px 20px; border-radius: 8px; background: var(--bg-soft); }
.pf-hidden-msg > summary { cursor: pointer; padding: 6px 10px; font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; list-style: none; }
.pf-hidden-msg > summary::-webkit-details-marker { display: none; }
.pf-hidden-msg .pf-show { margin-left: auto; color: var(--accent-strong); font-weight: 600; }
.pf-hidden-msg[open] .pf-show { display: none; }
/* menu dell'avatar aperto: niente riquadro dello stato al passaggio sopra il menu */
body:has(#me-btn.menu-open) .st-tip-me { display: none; }
.me-right .ic-svg { transform: rotate(-90deg); }
