/* ============================================================
   agentcamp-multiplayer-demo — multiplayer layer styles
   Scoped under .mp-ui + body classes; uses the site's tokens.
   ============================================================ */

/* ---------- status badge (fixed top right) ---------- */

.mp-badge {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 90;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem 0.4rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  box-shadow: 0 1px 6px rgba(17, 17, 17, 0.07);
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink);
  cursor: pointer;
}

.mp-badge:hover {
  border-color: var(--ink);
}

.mp-badge-avatars {
  display: inline-flex;
}

.mp-avatar {
  width: 1.35rem;
  height: 1.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--muted);
  color: #fff;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 2px solid var(--paper);
}

.mp-badge .mp-avatar + .mp-avatar {
  margin-left: -0.45rem;
}

.mp-avatar-sm {
  width: 1.1rem;
  height: 1.1rem;
  font-size: 0.5rem;
  border-width: 1px;
}

.mp-avatar-xs {
  width: 0.95rem;
  height: 0.95rem;
  font-size: 0.45rem;
  border-width: 1px;
}

.mp-namelist {
  position: fixed;
  top: 3.4rem;
  right: 1rem;
  z-index: 89;
  min-width: 11rem;
  padding: 0.4rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  box-shadow: 0 4px 14px rgba(17, 17, 17, 0.09);
  font-size: 0.8rem;
}

.mp-namelist-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.25rem 0.4rem;
}

.mp-namelist-row.is-self {
  color: var(--muted);
}

/* ---------- paragraph hover presence ---------- */

[data-mp] {
  transition: background-color 160ms ease;
  border-radius: 2px;
}

[data-mp].mp-my-hover {
  background: rgba(142, 164, 192, 0.13);
}

[data-mp].has-peer-hover {
  background: rgba(63, 123, 88, 0.10);
  outline: 1px dashed rgba(63, 123, 88, 0.35);
  outline-offset: 3px;
}

.mp-hover-chip {
  position: absolute;
  z-index: 80;
  display: flex;
  gap: 0.3rem;
  pointer-events: none;
}

.mp-chip-name {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.12rem 0.5rem 0.12rem 0.15rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.68rem;
  color: var(--ink);
  white-space: nowrap;
  animation: mp-chip-in 140ms ease-out;
}

@keyframes mp-chip-in {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .mp-chip-name { animation: none; }
}

/* ---------- persistent highlights ---------- */

mark.mp-hl {
  background: color-mix(in srgb, var(--hl-color, #8ea4c0) 22%, transparent);
  color: inherit;
  border-bottom: 2px solid color-mix(in srgb, var(--hl-color, #8ea4c0) 65%, transparent);
  padding: 0 1px;
  cursor: pointer;
}

mark.mp-hl:hover {
  background: color-mix(in srgb, var(--hl-color, #8ea4c0) 34%, transparent);
}

/* ---------- gutter marks ---------- */

.mp-line-wrap {
  position: relative;
  display: inline;
}

.mp-gutter {
  /* floats in the right margin of the paragraph */
  position: absolute;
  top: -0.15rem;
  right: -0.4rem;
  transform: translateX(100%);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.12rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 1px 5px rgba(17, 17, 17, 0.08);
}

.mp-gutter:hover {
  border-color: var(--ink);
}

.mp-gutter-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.05rem;
  height: 1.05rem;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  font-weight: 700;
  font-size: 0.62rem;
}

.mp-gutter-names {
  max-width: 9rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- floating selection launcher ---------- */

.mp-select-btn {
  position: absolute;
  z-index: 85;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 0.74rem;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(17, 17, 17, 0.22);
}

.mp-select-btn:hover {
  background: #333;
}

/* ---------- comments panel ---------- */

.mp-panel {
  position: fixed;
  top: 4rem;
  right: 1rem;
  z-index: 88;
  width: min(21rem, calc(100vw - 2rem));
  max-height: min(70vh, 42rem);
  overflow-y: auto;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  box-shadow: 0 10px 32px rgba(17, 17, 17, 0.16);
  padding: 0.9rem;
}

.mp-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.mp-panel-head h3 {
  margin: 0;
  font-size: 0.95rem;
}

.mp-close {
  border: none;
  background: none;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  padding: 0.2rem 0.35rem;
}

.mp-close:hover { color: var(--ink); }

.mp-typing {
  margin: 0 0 0.5rem;
  font-size: 0.72rem;
  color: var(--green);
  font-style: italic;
}

.mp-quote {
  margin: 0 0 0.5rem;
  padding: 0.35rem 0.6rem;
  border-left: 3px solid var(--blue);
  background: var(--panel);
  font-size: 0.76rem;
  color: var(--muted);
  border-radius: 0 0.3rem 0.3rem 0;
}

.q-inline { border-left-color: var(--note-accent, var(--blue)); }

.mp-composer-label {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.mp-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  padding: 0.5rem;
  font-family: var(--mono);
  font-size: 0.82rem;
  resize: vertical;
}

.mp-input:focus {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
  border-color: var(--blue);
}

.mp-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.mp-btn {
  padding: 0.35rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  font-family: var(--mono);
  font-size: 0.76rem;
  cursor: pointer;
}

.mp-btn.is-primary {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.mp-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.mp-add-hint {
  width: 100%;
  margin-bottom: 0.6rem;
  padding: 0.45rem;
  border: 1px dashed var(--line);
  border-radius: 0.4rem;
  background: none;
  font-family: var(--mono);
  font-size: 0.76rem;
  color: var(--muted);
  cursor: pointer;
}

.mp-add-hint:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.mp-thread {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.mp-note {
  --note-accent: var(--muted);
  border: 1px solid var(--line);
  border-left: 3px solid var(--note-accent);
  border-radius: 0.4rem;
  padding: 0.5rem 0.6rem;
  background: var(--paper);
}

.mp-note.is-resolved {
  opacity: 0.55;
}

.mp-note-head {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.25rem;
}

.mp-note-name {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  font-weight: 700;
  margin-right: auto;
}

.mp-note-time {
  font-size: 0.68rem;
  color: var(--muted);
}

.mp-note-text {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.45;
}

.mp-resolve {
  border: none;
  background: none;
  font-family: var(--mono);
  font-size: 0.66rem;
  color: var(--green);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.mp-empty {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0.2rem 0 0;
}

/* ---------- small screens ---------- */

@media (max-width: 860px) {
  .mp-gutter {
    position: static;
    transform: none;
    margin-top: 0.35rem;
  }
  .mp-panel {
    top: auto;
    bottom: 0.75rem;
    right: 0.75rem;
    left: 0.75rem;
    width: auto;
  }
}
