/* People: the player menu (static/hub/people.js), complaints, private messages (messages.js), the privacy and avatar
   sections of the settings (settings.js, avatar-editor.js). Loaded by the hub and by the match, so it carries its own
   small button styles instead of relying on either page's. Warm Monochrome: paper, ink, square markers. */

.person-trigger { cursor: pointer; border-radius: var(--r-s); }
.person-trigger:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) {
  .person-trigger.av, .person-trigger .av { transition: transform var(--t-press) var(--ease-out), filter var(--t-ui) ease; }
  .person-trigger:hover .av, .person-trigger.av:hover { transform: translateY(-1px); }
  .person-name.person-trigger:hover { text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
}
.person-trigger:active .av, .person-trigger.av:active { transform: scale(.96); }
.person-name { font: inherit; color: inherit; text-align: inherit; min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- the menu ---------- */
.person-menu { position: fixed; z-index: 60; width: 272px; max-width: calc(100vw - 16px); padding: 6px; border-radius: var(--r-l);
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-pop), inset 0 0 0 1px var(--line);
  font: 400 15px/1.4 var(--ui); outline: 0;
  transform-origin: var(--origin, 0 0); animation: pm-in 160ms var(--ease-out) both; }
.person-menu.out { animation: pm-out 110ms ease-in both; pointer-events: none; }
@keyframes pm-in { from { opacity: 0; transform: scale(.96); } }
@keyframes pm-out { to { opacity: 0; transform: scale(.98); } }
.pm-head { display: flex; align-items: center; gap: 12px; padding: 10px 10px 12px; }
.pm-head .av { width: 44px; height: 44px; font-size: 20px; }
.pm-who { display: grid; gap: 1px; min-width: 0; }
.pm-who b { font-weight: 500; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-who small { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-presence { display: inline-flex; align-items: center; gap: 6px; }
.pm-presence i { width: 7px; height: 7px; border-radius: 1px; box-shadow: inset 0 0 0 1.5px var(--line-2); }
.pm-presence i.on { background: var(--open); box-shadow: none; }
.pm-body { display: grid; gap: 1px; padding-top: 4px; border-top: 1px solid var(--line); }
.pm-item { display: grid; gap: 1px; width: 100%; min-height: 40px; padding: 9px 10px; border-radius: var(--r-s); text-align: left;
  color: var(--ink); font-weight: 500; font-size: 15px; transition: background-color 120ms ease; }
.pm-item small { color: var(--muted); font-size: 13px; font-weight: 400; }
.pm-item:focus-visible { outline: 0; background: var(--surface-2); box-shadow: inset 0 0 0 1.5px var(--ink); }
.pm-item:disabled { color: var(--muted); cursor: default; }
.pm-item.danger span { color: var(--bad); }
.pm-item.quiet span { color: var(--muted); }
@media (hover: hover) { .pm-item:hover:not(:disabled) { background: var(--surface-2); } }
.pm-sep { height: 1px; margin: 4px 6px; background: var(--line); }
.pm-note { margin: 0; padding: 8px 10px; color: var(--muted); font-size: 14px; line-height: 1.45; }
.pm-confirm { display: grid; gap: 4px; padding: 6px 4px 4px; }
.pm-confirm p { margin: 0; padding: 0 6px; }
.pm-confirm b { font-weight: 500; }
.pm-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 8px 6px 4px; }
.pm-scrim { position: fixed; inset: 0; z-index: 59; background: var(--scrim); animation: pm-fade 160ms ease both; }
@keyframes pm-fade { from { opacity: 0; } }
/* phones: the menu is a bottom sheet with full-width rows */
.person-menu.sheet-like { left: 8px !important; right: 8px; top: auto !important; bottom: calc(8px + env(safe-area-inset-bottom)); width: auto;
  max-width: none; max-height: 80dvh; overflow: auto; transform-origin: 50% 100%; animation-name: pm-up; }
.person-menu.sheet-like.out { animation-name: pm-down; }
@keyframes pm-up { from { transform: translateY(24px); opacity: 0; } }
@keyframes pm-down { to { transform: translateY(24px); opacity: 0; } }
.person-menu.sheet-like .pm-item { min-height: 48px; }

/* small buttons for menus and dialogs, the same in the hub and in the match */
.person-menu .btn, .report-dialog .btn, .msg-dialog .btn, .set-section .btn.small, .set-panel .btn.small, .avatar-editor .btn { display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; height: 40px; padding: 0 14px; border-radius: var(--r-s); font: 500 15px/1 var(--ui); white-space: nowrap;
  background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-2);
  transition: transform var(--t-press) var(--ease-out), background-color var(--t-ui) ease, box-shadow var(--t-ui) ease; }
.person-menu .btn.small, .set-section .btn.small, .set-panel .btn.small { height: 36px; padding: 0 12px; font-size: 14px; }
.person-menu .btn.ghost, .report-dialog .btn.ghost, .msg-dialog .btn.ghost, .avatar-editor .btn.ghost { background: transparent; box-shadow: none; }
.person-menu .btn.primary, .report-dialog .btn.primary, .msg-dialog .btn.primary, .avatar-editor .btn.primary { background: var(--ink); color: var(--on-ink); box-shadow: none; }
.person-menu .btn.danger, .sheet .btn.danger { background: var(--bad); color: #FDFCFC; box-shadow: none; }
.person-menu .btn:active, .report-dialog .btn:active, .msg-dialog .btn:active, .avatar-editor .btn:active { transform: scale(.97); }
.report-dialog .btn:disabled, .msg-dialog .btn:disabled, .avatar-editor .btn:disabled { cursor: not-allowed; opacity: .5; }
@media (hover: hover) {
  .person-menu .btn.ghost:hover, .report-dialog .btn.ghost:hover, .msg-dialog .btn.ghost:hover, .avatar-editor .btn.ghost:hover { background: var(--surface-2); }
}
.btn.busy { pointer-events: none; opacity: .7; }

/* ---------- complaint ---------- */
.report-reasons { display: grid; gap: 2px; }
.report-reason { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 4px; border-radius: var(--r-s); cursor: pointer; }
.report-reason input { width: 18px; height: 18px; margin: 0; accent-color: var(--ink); }
@media (hover: hover) { .report-reason:hover { background: var(--surface-2); } }
.report-text, .msg-input { width: 100%; padding: 10px 12px; border: 0; border-radius: var(--r-s); background: var(--surface); color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line-2); font: 400 15px/1.45 var(--ui); resize: vertical; }
.report-text:focus, .msg-input:focus { outline: none; box-shadow: inset 0 0 0 1.5px var(--ink); }
.set-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }

/* ---------- private messages ---------- */
.msg-dialog { width: min(520px, calc(100vw - 24px)); height: min(640px, calc(100dvh - 24px)); display: none; }
.msg-dialog[open] { display: flex; flex-direction: column; overflow: hidden; }
.msg-dialog .set-head { position: static; }
.msg-dialog .set-head .pm-head { padding: 0; gap: 10px; min-width: 0; }
.msg-dialog .set-head .pm-head .av { width: 36px; height: 36px; font-size: 17px; }
.msg-list { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 6px; padding: 16px 20px; }
.msg { max-width: 82%; padding: 8px 12px; border-radius: var(--r-l); background: var(--bg-2); white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.4; }
.msg.mine { align-self: flex-end; background: var(--ink); color: var(--on-ink); }
.msg time { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }
.msg.mine time { color: color-mix(in srgb, var(--on-ink) 70%, transparent); text-align: right; }
.msg-day { align-self: center; margin: 8px 0 2px; color: var(--muted); font-size: 12px; }
.msg-empty { margin: auto; max-width: 30ch; text-align: center; color: var(--muted); font-size: 14px; }
.msg-form { display: flex; gap: 8px; align-items: flex-end; padding: 12px 16px 16px; box-shadow: 0 -1px 0 var(--line); }
.msg-form .msg-input { min-height: 44px; max-height: 140px; resize: none; }
.msg-form .btn { height: 44px; }
.msg-closed { margin: 0; padding: 14px 20px 18px; color: var(--muted); font-size: 14px; box-shadow: 0 -1px 0 var(--line); }
.conv-list { display: grid; gap: 2px; padding: 8px; overflow: auto; }
.conv { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 10px; border-radius: var(--r-s); text-align: left; width: 100%; }
.conv .av { width: 40px; height: 40px; font-size: 18px; }
.conv b { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv small { display: block; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv .unread { min-width: 22px; height: 22px; padding: 0 6px; border-radius: var(--r-s); background: var(--ink); color: var(--on-ink); font-size: 12px; font-weight: 500; display: grid; place-items: center; }
@media (hover: hover) { .conv:hover { background: var(--surface-2); } }
.badge-count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 3px; background: var(--ink); color: var(--on-ink);
  font: 500 11px/1 var(--ui); font-variant-numeric: tabular-nums; }

/* ---------- blocked players in the settings ---------- */
.set-person { display: flex; align-items: center; gap: 12px; }
.set-rows > .set-person { padding: 10px 0; }
.set-person .av { width: 36px; height: 36px; font-size: 16px; }
.set-person .set-label { flex: 1; }
.set-person .set-label b, .set-person .set-label small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- own avatar in the settings ---------- */
.avatar-row { display: flex; align-items: center; gap: 16px; }
.avatar-row .av { width: 72px; height: 72px; font-size: 32px; }
.avatar-pick { position: relative; flex: none; border-radius: var(--r-s); transition: transform var(--t-press) var(--ease-out); }
.avatar-pick:active:not(:disabled) { transform: scale(.96); }
.avatar-pick:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
/* a small ink camera cell on the plate's corner says «this is clickable»; it fills on hover */
.avatar-pick-hint { position: absolute; right: -6px; bottom: -6px; width: 28px; height: 28px; display: grid; place-items: center;
  border-radius: var(--r-s); background: var(--ink); color: var(--on-ink); box-shadow: 0 0 0 2px var(--surface); }
.avatar-pick-hint svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.avatar-pick:disabled { cursor: default; }
.avatar-pick:disabled .avatar-pick-hint { display: none; }
@media (hover: hover) and (pointer: fine) { .avatar-pick:hover:not(:disabled) .av { filter: brightness(.92); } }
.avatar-row .set-actions { justify-content: flex-start; }
.avatar-editor { display: grid; gap: 14px; }
.crop-stage { position: relative; width: min(280px, 100%); aspect-ratio: 1; margin: 0 auto; overflow: hidden; border-radius: var(--r-l);
  background: var(--bg-2); touch-action: none; cursor: grab; user-select: none; }
.crop-stage:active { cursor: grabbing; }
.crop-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
/* the avatar's own outline over the picture: the area outside it is dimmed, the corner cell shown as cut */
.crop-mask { position: absolute; inset: 0; pointer-events: none; }
.crop-mask path { fill: rgba(13, 13, 13, .55); fill-rule: evenodd; }
.crop-zoom { display: flex; align-items: center; gap: 12px; }
.crop-zoom input { flex: 1; accent-color: var(--ink); }
.crop-zoom svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
