/* BALKANOPOLY — the room chat window (shared/js/chat.js, v9.8): a parchment note pinned under the top bar on
   desktops, a sheet from the bottom on phones. */

/* the chat button (top bar in the game, header in the lobby) and its count of new messages */
.chatbtn {
  position: relative;
}
.chatbtn .ii {
  width: 18px;
  height: 18px;
  display: block;
}
.chatbtn .cbadge {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 10px;
  background: var(--bad);
  color: #fff;
  border: 1.5px solid var(--paper3);
  font: 700 11px/16px var(--mono);
  text-align: center;
}

.chatbox {
  position: fixed;
  top: 58px;
  right: 12px;
  width: 360px;
  max-width: calc(100vw - 24px);
  height: min(480px, calc(100vh - 80px));
  z-index: 95;
  display: flex;
  flex-direction: column;
  background: var(--paper3);
  border: 1px solid var(--ink);
  box-shadow:
    4px 4px 0 rgba(59, 45, 29, 0.35),
    0 10px 30px rgba(0, 0, 0, 0.25);
  color: var(--ink);
  font-family: var(--body);
}
.chatbox.hidden {
  display: none;
}
.chead {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 8px 14px;
  border-bottom: 1px solid var(--rule);
  background: var(--paper2);
}
.chead b {
  font: 400 20px/1 var(--disp);
}
.chead .sp {
  flex: 1;
}
.cmutes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--light);
}
.cmutes.hidden {
  display: none;
}
.cmute {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 4px 10px;
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink);
  font: 600 15px var(--body);
  cursor: pointer;
}
.cmute span {
  font: 700 11px var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.cmute.on {
  background: var(--paper2);
  text-decoration: line-through;
}
.cmute.on span {
  color: var(--bad);
  text-decoration: none;
}
.clist {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cmsg {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.cdot {
  flex: none;
  width: 12px;
  height: 12px;
  margin-top: 4px;
  border-radius: 50%;
  background: var(--paper3);
  border: 3.5px solid var(--c);
  box-shadow: 0 0 0 1px var(--ink);
}
.cmute .cdot {
  margin-top: 0;
}
.cmsg b {
  font-weight: 700;
  font-size: 16px;
}
.cmsg .ct {
  font: 11px var(--mono);
  color: var(--muted);
}
.cmsg p {
  margin: 1px 0 0;
  font-size: 17px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.cmsg.me b {
  color: var(--accent);
}
.cempty {
  margin: auto;
  color: var(--muted);
  font-style: italic;
}
.cquick {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 8px 12px 2px;
  border-top: 1px solid var(--light);
  scrollbar-width: none;
}
/* with a mouse there is no swiping: the phrases wrap onto a second row so every one can be seen and clicked */
@media (pointer: fine) {
  .cquick {
    flex-wrap: wrap;
    overflow-x: visible;
  }
}
.cquick.hidden,
.cform.hidden,
.cnote.hidden {
  display: none;
}
.cq {
  flex: none;
  min-height: 34px;
  padding: 4px 11px;
  border: 1px solid var(--rule);
  border-radius: 17px;
  background: var(--paper);
  color: var(--ink);
  font: 600 15px var(--body);
  cursor: pointer;
  white-space: nowrap;
}
.cq:hover,
.cmute:hover {
  background: var(--paper2);
}
.cform {
  display: flex;
  gap: 8px;
  padding: 8px 12px 12px;
}
.cform .hfield {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  font-size: 17px;
  padding: 8px 12px;
}
.cform .btn {
  flex: none;
  width: 48px;
  min-height: 44px;
  padding: 0;
  display: grid;
  place-items: center;
}
.cform .btn .ii {
  width: 20px;
  height: 20px;
}
.cnote {
  padding: 10px 12px 14px;
  border-top: 1px solid var(--light);
  color: var(--muted);
  font-style: italic;
}

/* a new message while the chat is closed: a little note under the chat button */
.chatpeek {
  position: fixed;
  z-index: 96;
  max-width: min(320px, calc(100vw - 16px));
  padding: 7px 11px;
  border: 1px solid var(--ink);
  background: var(--paper3);
  box-shadow: 3px 3px 0 rgba(59, 45, 29, 0.35);
  color: var(--ink);
  font: 16px/1.25 var(--body);
  text-align: left;
  cursor: pointer;
  display: flex;
  gap: 6px;
  align-items: baseline;
  animation: cpeek 0.25s ease-out;
}
.chatpeek.hidden {
  display: none;
}
.chatpeek i {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 0 1px var(--ink);
  align-self: center;
}
.chatpeek b {
  flex: none;
}
@keyframes cpeek {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
}

/* phones: a sheet from the bottom of the screen */
@media (max-width: 900px), (max-aspect-ratio: 1/1) {
  .chatbox {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    max-width: none;
    height: min(70vh, 560px);
    height: min(70dvh, 560px);
    border-width: 1px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
}
@media (prefers-reduced-motion: reduce) {
  .chatpeek {
    animation: none;
  }
}
