/* multiplayer of the walk ("razem", js/mp.js): the HUD button, the join card, nick labels and speech bubbles
   over the other walkers, the chat (head, people list, log + line), the menu of a nick (teleport, mute), the
   shared sounds' pill and note. Same paper / ink look as the walk HUD. */
#hud .row > #mpBtn { display: inline-flex; align-items: center; gap: 5px; }
#hud .row > #mpBtn[hidden] { display: none; }
#mpBtn .mp-ico { display: block; image-rendering: pixelated; flex: 0 0 auto; }
#mpBtn.active { background: var(--accent); }
#mpBtn.wait { color: rgba(43, 36, 51, .6); }
#mpBtn.bad { background: #f1d5cd; }
#mpBtn .mp-n { font: 11px "Silkscreen", monospace; background: var(--ink); color: var(--paper); padding: 1px 4px; min-width: 17px; text-align: center; }
#mpBtn .mp-n[hidden] { display: none; }
/* phone: the walk's one-row HUD has room for the word only; joined = the two figures and the number; the
   rare answers ("pełno", "niedostępne") take a row of their own under the buttons */
@media (max-width: 600px) {
  #hud .row > #mpBtn { margin-left: 0; flex: 0 0 auto; padding: 0 5px; gap: 3px; }
  #mpBtn .mp-ico { display: none; }
  #mpBtn.active .mp-ico { display: block; }
  #mpBtn.active span { display: none; }
  body.walking #hud .row:has(> #mpBtn.bad) { flex-wrap: wrap; }
  #hud .row > #mpBtn.bad { flex: 1 1 100%; justify-content: center; order: 9; }
}
@media (max-width: 380px) { #hud .row > #mpBtn { padding: 0 4px; font-size: 13px !important; } }
@media (max-width: 340px) { #hud .row > #mpBtn { padding: 0 3px; font-size: 12px !important; } }

/* the join card (also: change the nick) */
#mpCard { position: fixed; left: 16px; top: 104px; z-index: 30; width: 330px; max-width: calc(100vw - 32px); background: var(--paper); border: 3px solid var(--ink);
  box-shadow: 5px 5px 0 var(--ink); padding: 10px 14px 12px; font-size: 15px; line-height: 1.3; font-variant-ligatures: none; font-feature-settings: "liga" 0, "clig" 0; }
#mpCard[hidden] { display: none; }
#mpCard .mp-x { position: absolute; right: 6px; top: 4px; border: 0; background: none; font: inherit; font-size: 18px; cursor: pointer; color: var(--ink); padding: 2px 6px; }
#mpCard .mp-title { display: block; font-size: 21px; margin: 0 24px 6px 0; }
#mpCard label { display: block; font-size: 13px; text-transform: uppercase; letter-spacing: 1px; opacity: .7; margin-bottom: 3px; }
#mpCard .mp-nickrow { display: flex; gap: 6px; }
#mpCard input { flex: 1 1 auto; min-width: 0; font: 600 17px "Pixelify Sans", monospace; color: var(--ink); background: #fff; border: 2px solid var(--ink); padding: 4px 8px; border-radius: 0; }
#mpCard input:focus { outline: 2px solid var(--accent); outline-offset: 0; }
#mpCard .mp-dice { font: 14px "Pixelify Sans", monospace; color: var(--ink); background: #fff; border: 2px solid var(--ink); padding: 0 9px; cursor: pointer; }
#mpCard .mp-rules { margin: 9px 0 10px; font-size: 14px; }
#mpCard .mp-err { margin: -4px 0 9px; font-size: 14px; color: #a3261e; font-weight: 600; }
#mpCard .mp-err[hidden] { display: none; }
#mpCard .mp-join { font: 600 17px "Pixelify Sans", monospace; color: var(--ink); background: var(--accent); border: 3px solid var(--ink); box-shadow: 3px 3px 0 var(--ink);
  padding: 4px 18px; cursor: pointer; }
#mpCard .mp-join:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
@media (max-width: 600px), (pointer: coarse) {
  #mpCard { left: 8px; right: 8px; top: 62px; width: auto; max-width: none; }
  #mpCard input { font-size: 18px; }   /* 16 px and up: a phone does not zoom the page on focus */
}

/* labels over the other walkers: the nick as the map names are drawn, the line said in a paper bubble
   (the layer is display: none while nobody is labelled - mp.js - so it costs the page nothing when alone) */
#mpLayer { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
#mpLayer[hidden] { display: none; }
.mp-tag { position: absolute; left: 0; top: 0; width: 0; height: 0; will-change: transform; }
.mp-tag[hidden] { display: none; }
.mp-tag.talk { z-index: 2; }   /* who speaks is drawn over the other labels */
.mp-tag > div { position: absolute; left: 0; bottom: 0; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 5px; width: max-content; max-width: 230px; }
.mp-nick { pointer-events: auto; font: 13px "Pixelify Sans", monospace; letter-spacing: .5px; color: #fff; background: none; border: 0; margin: 0; padding: 0 3px; cursor: pointer; white-space: nowrap;
  text-shadow: 1px 0 var(--ink), -1px 0 var(--ink), 0 1px var(--ink), 0 -1px var(--ink), 1px 1px var(--ink); }
.mp-tag.muted .mp-nick { text-decoration: line-through; opacity: .65; }
.mp-bub { position: relative; background: var(--paper); color: var(--ink); border: 2px solid var(--ink); box-shadow: 2px 2px 0 var(--ink); padding: 2px 8px 3px; margin-bottom: 4px;
  font-size: 14px; line-height: 1.2; text-align: center; max-width: 230px; overflow-wrap: anywhere; font-variant-ligatures: none; font-feature-settings: "liga" 0, "clig" 0; }
.mp-bub[hidden] { display: none; }
.mp-bub::after { content: ""; position: absolute; left: 50%; bottom: -11px; margin-left: -5px; border: 5px solid transparent; border-bottom-width: 0; border-top-color: var(--ink); }

/* the chat: desktop = a small panel bottom left (over the walk's hint line), phone = under the street pill at
   the top, folded to the last lines until "czat" is tapped (the keyboard never covers the line up there) */
#mpChat { position: fixed; left: 16px; bottom: 52px; z-index: 15; width: 330px; display: flex; flex-direction: column; gap: 4px; pointer-events: none;
  font-size: 14px; line-height: 1.25; font-variant-ligatures: none; font-feature-settings: "liga" 0, "clig" 0; }
#mpChat[hidden] { display: none; }
#mpChat > * { pointer-events: auto; }
#mpChat .mp-head { display: flex; align-items: center; gap: 6px; }
#mpChat .mp-head button { font: 13px "Pixelify Sans", monospace; color: var(--ink); background: rgba(244, 236, 216, .9); border: 2px solid var(--ink); padding: 1px 7px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#mpChat .mp-head button { flex: 0 0 auto; }
#mpChat .mp-head .mp-me { font-weight: 600 !important; flex: 0 1 auto; min-width: 0; max-width: 170px; }
#mpChat .mp-ppl b { font: 11px "Silkscreen", monospace; background: var(--ink); color: var(--paper); padding: 0 4px; margin-left: 2px; }
#mpChat .mp-ppl.active { background: var(--accent); }
#mpChat .mp-shut { display: none; margin-left: auto; }
/* who is online: nick, how far, "teleport", "wycisz" */
#mpChat .mp-people { display: flex; flex-direction: column; max-height: 190px; overflow-y: auto; background: var(--paper); border: 2px solid var(--ink); box-shadow: 3px 3px 0 var(--ink);
  padding: 2px 0; scrollbar-width: thin; }
#mpChat .mp-people[hidden] { display: none; }
#mpChat .mp-p { display: flex; align-items: center; gap: 6px; padding: 2px 7px; white-space: nowrap; }
#mpChat .mp-p + .mp-p { border-top: 1px solid rgba(43, 36, 51, .18); }
#mpChat .mp-p i { flex: 0 0 9px; width: 9px; height: 9px; border: 1px solid var(--ink); }
#mpChat .mp-p b { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
#mpChat .mp-p.muted b { text-decoration: line-through; opacity: .6; }
#mpChat .mp-pd { flex: 0 0 auto; font-variant-numeric: tabular-nums; opacity: .75; }
#mpChat .mp-p.none { white-space: normal; opacity: .75; font-size: 13px; }
#mpChat .mp-p button { flex: 0 0 auto; font: 600 13px "Pixelify Sans", monospace; color: var(--ink); background: #fff; border: 2px solid var(--ink); padding: 0 7px; cursor: pointer; }
#mpChat .mp-p .mp-tp { background: var(--accent); }
#mpChat .mp-p button:disabled { opacity: .4; cursor: default; background: #fff; }
/* a click anywhere on a person's row is the teleport (not on "wycisz") */
#mpChat .mp-p[data-id] { cursor: pointer; }
@media (hover: hover) { #mpChat .mp-p[data-id]:hover { background: rgba(232, 183, 48, .28); } }
/* the log of the town-wide channel: the last 30 lines, the newest at the bottom */
#mpChat .mp-log { display: flex; flex-direction: column; gap: 1px; max-height: 168px; overflow-y: auto; background: rgba(244, 236, 216, .88); border: 2px solid var(--ink); padding: 3px 7px;
  scrollbar-width: thin; }
#mpChat .mp-log:empty { display: none; }
#mpChat .mp-line { overflow-wrap: anywhere; }
#mpChat .mp-line[hidden] { display: none; }
#mpChat .mp-who { font: 600 14px "Pixelify Sans", monospace; color: #6a4a10; background: none; border: 0; margin: 0 5px 0 0; padding: 0; cursor: pointer; }
#mpChat .mp-who::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 4px; background: var(--c, #e8b730); border: 1px solid var(--ink); }
#mpChat .mp-who::after { content: ":"; }
#mpChat .mp-line.me .mp-who { color: var(--ink); cursor: default; }
/* a line of the page itself (the rules at the first join, a newcomer): quieter than a spoken one */
#mpChat .mp-line.info { color: rgba(43, 36, 51, .72); font-size: 13px; }
#mpChat .mp-line.info .mp-who { font-size: 13px; }
#mpChat .mp-line.info .mp-who::after { content: ""; }
#mpChat .mp-who:disabled { cursor: default; }
#mpChat .mp-note { background: var(--ink); color: var(--paper); padding: 2px 8px; font-size: 13px; }
#mpChat .mp-note[hidden] { display: none; }
#mpChat .mp-row { display: flex; gap: 5px; }
#mpChat .mp-in { flex: 1 1 auto; min-width: 0; font: 15px "Pixelify Sans", monospace; color: var(--ink); background: rgba(255, 255, 255, .92); border: 2px solid var(--ink); padding: 3px 8px; border-radius: 0; }
#mpChat .mp-in:focus { outline: 2px solid var(--accent); outline-offset: 0; background: #fff; }
#mpChat .mp-in::placeholder { color: rgba(43, 36, 51, .55); }
#mpChat .mp-send { font: 600 14px "Pixelify Sans", monospace; color: var(--ink); background: var(--accent); border: 2px solid var(--ink); padding: 0 10px; cursor: pointer; }
#mpChat.off .mp-log, #mpChat.off .mp-row, #mpChat.off .mp-note { display: none; }
#mpTalk { display: none; }
@media (max-width: 600px), (pointer: coarse) {
  #mpChat { left: 8px; right: 8px; top: 104px; bottom: auto; width: auto; z-index: 26; }
  #mpChat .mp-head, #mpChat .mp-row { display: none; }
  #mpChat.open .mp-head, #mpChat.open:not(.off) .mp-row { display: flex; }
  #mpChat .mp-shut { display: block; }
  #mpChat .mp-head button { font-size: 14px; padding: 3px 9px; }
  #mpChat .mp-head { gap: 5px; }
  #mpChat .mp-head .mp-me { max-width: none; }
  #mpChat:not(.open) .mp-people { display: none; }
  #mpChat .mp-people { max-height: 38vh; font-size: 15px; }
  #mpChat .mp-p { padding: 4px 8px; gap: 7px; }
  #mpChat .mp-p button { font-size: 15px; padding: 3px 9px; }
  #mpChat .mp-log { align-self: flex-start; max-width: 100%; }
  /* folded: the last three lines, each for 20 s; opened: the whole log, scrolled */
  #mpChat:not(.open) .mp-log { max-height: none; overflow: hidden; pointer-events: none; border-width: 0; background: rgba(244, 236, 216, .8); }
  #mpChat:not(.open) .mp-line.old, #mpChat:not(.open) .mp-line:nth-last-child(n + 4) { display: none; }
  #mpChat.open .mp-log { max-height: 30vh; align-self: stretch; }
  #mpChat .mp-in { font-size: 17px; padding: 6px 9px; }   /* 16 px and up: no page zoom on focus */
  #mpChat .mp-send { font-size: 16px; padding: 0 12px; }
  #mpTalk { display: block; position: fixed; left: 50%; transform: translateX(-50%); bottom: max(30px, env(safe-area-inset-bottom)); z-index: 15; height: 40px; min-width: 70px;
    font: 600 16px "Pixelify Sans", monospace; color: var(--ink); background: var(--paper); border: 3px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); padding: 0 12px;
    touch-action: manipulation; user-select: none; -webkit-user-select: none; }
  #mpTalk[hidden] { display: none; }
}

/* shared sounds (js/walk-spots.js with a server of revision 3): the spot's pill while its tune plays for
   everybody ("hejnał gra · 0:42": a tap does nothing - drawn as a plain paper label, not a button), and the note
   of a tune that reached the page before its first tap ("hejnał gra · dotknij, aby usłyszeć") */
#walkHud .wk-unveil.wk-busy { background: var(--paper); box-shadow: 3px 3px 0 rgba(43, 36, 51, .35); cursor: default; font-variant-numeric: tabular-nums; }
#walkHud .wk-unveil.wk-busy:active { transform: none; box-shadow: 3px 3px 0 rgba(43, 36, 51, .35); }
#walkHud .wk-tap { pointer-events: auto; font: 600 15px "Pixelify Sans", monospace; color: var(--paper); background: var(--ink); border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 rgba(43, 36, 51, .35); padding: 3px 11px; cursor: pointer; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
  font-variant-ligatures: none; font-feature-settings: "liga" 0, "clig" 0; }
#walkHud .wk-tap[hidden] { display: none; }
@media (max-width: 600px), (pointer: coarse) { #walkHud .wk-tap { font-size: 14px; padding: 4px 10px; } }

/* a click on a nick: how far he is, "teleport", "wycisz" */
#mpMenu { position: fixed; z-index: 31; display: flex; align-items: center; gap: 7px; background: var(--paper); border: 2px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); padding: 4px 6px 4px 9px;
  font-size: 14px; white-space: nowrap; }
#mpMenu[hidden] { display: none; }
#mpMenu .mp-md { opacity: .75; font-variant-numeric: tabular-nums; }
#mpMenu .mp-md:empty { display: none; }
#mpMenu button { font: 600 14px "Pixelify Sans", monospace; color: var(--ink); background: #fff; border: 2px solid var(--ink); padding: 1px 9px; cursor: pointer; }
#mpMenu .mp-tp { background: var(--accent); }
#mpMenu button:disabled { opacity: .4; cursor: default; background: #fff; }
@media (max-width: 600px), (pointer: coarse) { #mpMenu button { font-size: 15px; padding: 4px 10px; } }
