.server-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  max-width: 78px;
  min-height: 24px;
  padding: 0;
  background: none;
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}
.server-status > span {
  overflow: hidden;
  text-overflow: ellipsis;
}
.server-status i {
  width: 5px;
  height: 5px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--accent);
}
.server-status[data-status="online"] i {
  background: var(--green);
}
.server-status[data-status="offline"] i {
  background: var(--warning);
}
.friends-badge {
  position: absolute;
  right: 1px;
  top: 0;
  min-width: 15px;
  height: 15px;
  padding: 1px 3px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--solid);
  font-size: 9px;
  line-height: 13px;
}
.player-labels {
  position: absolute;
  inset: 0;
  z-index: 2;
  overflow: hidden;
  pointer-events: none;
}
.player-name,
.speech-bubble {
  position: absolute;
  top: 0;
  left: 0;
  max-width: 220px;
  transform: translate(-50%, -100%);
  will-change: transform;
}
.player-name {
  pointer-events: auto;
  padding: 5px 9px;
  border: 1px solid var(--edge);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 2px 8px #173c1e15;
  font-size: 11px;
  white-space: nowrap;
}
.speech-bubble {
  min-width: 40px;
  padding: 10px 13px;
  border: 1px solid var(--edge);
  border-radius: 10px;
  background: var(--solid);
  color: var(--ink);
  box-shadow: var(--shadow);
  text-align: center;
  overflow-wrap: anywhere;
  font-size: 12px;
  line-height: 1.5;
}
.speech-bubble:after {
  content: "";
  position: absolute;
  bottom: -5px;
  left: calc(50% - 5px);
  border-top: 5px solid var(--solid);
  border-right: 5px solid transparent;
  border-left: 5px solid transparent;
}
.speech-bubble b {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
}
.chat-compose {
  position: absolute;
  z-index: 6;
  bottom: calc(var(--hud-bottom) + var(--hud-height) + 12px);
  left: var(--hud-left);
  width: min(370px, calc(100vw - 40px));
  padding: 10px 12px;
  border: 1px solid var(--edge);
  border-radius: 10px;
  background: var(--solid);
  box-shadow: var(--shadow);
}
.chat-compose form {
  display: flex;
  align-items: center;
  gap: 8px;
}
.chat-compose label {
  color: var(--muted);
  font-size: 11px;
}
.chat-compose input {
  min-width: 0;
  width: 120px;
  min-height: 44px;
  flex: 1;
  padding: 0 2px;
  border: 0;
  border-radius: 2px;
  background: none;
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
}
.chat-compose button {
  min-height: 44px;
  padding: 5px;
  border-radius: 5px;
  background: none;
  color: var(--green);
  font-size: 12px;
}
.chat-compose #chat-close {
  min-width: 44px;
  padding: 3px;
  color: var(--muted);
  font-size: 22px;
}
.social-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  font-size: 13px;
}
.social-row > span {
  min-width: 0;
  flex: 1;
  overflow-wrap: anywhere;
}
.social-row small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
}
.row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.row-actions .small-button {
  padding: 8px 11px;
}
.text-action {
  min-height: 40px;
  min-width: 40px;
  padding: 6px;
  border-radius: 6px;
  background: none;
  color: var(--muted);
  font-size: 11px;
}
.text-action:hover {
  background: var(--selected);
}
.dialog-count {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}
.code-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: -7px 0 16px;
}
.code-row code,
.friend-code {
  color: var(--green);
  font-family: inherit;
  font-size: 12px;
  letter-spacing: 1.5px;
}
.add-friend {
  display: flex;
  gap: 8px;
  margin-bottom: 17px;
}
.add-friend input,
.social-form input {
  min-width: 0;
  width: 100%;
  min-height: 44px;
  padding: 10px 11px;
  border: 1px solid var(--input-line);
  border-radius: 7px;
  background: var(--raised);
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
}
.add-friend input {
  flex: 1;
}
.social-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-bottom: 18px;
}
.social-form label {
  grid-column: 1/-1;
  font-size: 12px;
  color: var(--muted);
}
.friend-list {
  max-height: none;
  overflow: visible;
}
.empty-state {
  padding: 23px 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}
.profile-tools {
  display: flex;
  gap: 8px;
  margin-top: 18px;
}
@media (max-width: 760px) {
  .server-status {
    max-width: 65px;
  }
  .chat-compose {
    position: fixed;
    top: calc(var(--hud-top) + 110px);
    left: var(--hud-left);
    bottom: auto;
    width: calc(100vw - 28px);
    padding: 8px 10px;
  }
  .chat-compose input {
    font-size: 16px;
  }
  .player-name {
    font-size: 10px;
  }
  .speech-bubble {
    max-width: 190px;
    font-size: 12px;
  }
  .social-row {
    gap: 8px;
  }
  .friend-list {
    max-height: none;
  }
}
@media (max-width: 380px) {
  .server-status {
    max-width: 61px;
  }
}

.hike-together { margin-top: 24px; display: grid; gap: 12px; }
.hike-together label { font-size: 13px; }
.hike-together select { width: 100%; min-height: 44px; padding: 8px; border: 1px solid var(--input-line); border-radius: 8px; background: var(--raised); color: var(--ink); font: inherit; }

/* Me: the same game character, with compact choices and a quiet portrait. */
#modal[data-surface="appearance"] { width: 650px; max-width: calc(100vw - 24px); }
.me-form { margin: 0; }
.me-layout { display: grid; grid-template-columns: 180px minmax(0,1fr); gap: 24px; }
.me-preview { align-self: start; position: sticky; top: 0; min-width: 0; text-align: center; border-radius: 16px; background: radial-gradient(ellipse at 50% 62%, var(--selected), transparent 72%); }
#me-preview { display: block; width: 100%; height: 290px; cursor: grab; touch-action: none; }
#me-preview:active { cursor: grabbing; }
#me-turn { min-height: 44px; gap: 6px; display: inline-flex; align-items: center; justify-content: center; padding: 0 12px; }
.me-controls { min-width: 0; }
.me-name { display: grid; grid-template-columns: auto minmax(0,1fr); align-items: center; gap: 12px; margin: 0 0 18px; }
.me-name label, .me-field legend { color: var(--muted); font-size: 12px; }
.me-name input { user-select: text; -webkit-user-select: text; width: 100%; min-width: 0; min-height: 42px; border: 1px solid var(--input-line); border-radius: 8px; background: var(--raised); color: var(--ink); padding: 8px 10px; font: inherit; font-size: 14px; }
.me-tabs { display: flex; border-bottom: 1px solid var(--line); margin-bottom: 17px; gap: 16px; }
.me-tabs button { flex: 1; min-height: 44px; padding: 0 2px; border: 0; border-radius: 0; background: transparent; color: var(--muted); border-bottom: 2px solid transparent; font-size: 13px; }
.me-tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--green); }
.me-field { min-width: 0; margin: 0 0 17px; padding: 0; border: 0; }
.me-field legend { padding: 0; margin-bottom: 8px; }
.me-options { display: grid; gap: 6px; grid-template-columns: repeat(min(var(--choices),4),minmax(0,1fr)); }
.me-choice { min-height: 48px; min-width: 0; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; padding: 7px 3px; border: 1px solid transparent; border-radius: 9px; background: var(--selected); color: var(--muted); font: inherit; font-size: 12px; }
.me-choice i { display: block; width: 11px; height: 11px; flex: 0 0 auto; border-radius: 50%; background: var(--swatch); box-shadow: inset 0 0 0 1px #172d2422; }
.me-choice[aria-pressed="true"] { background: var(--selected-hover); color: var(--ink); border-color: var(--button-line); box-shadow: inset 0 -2px 0 var(--green); }
.me-choice:hover { color: var(--ink); }
.me-footer { display: flex; justify-content: space-between; align-items: center; gap: 14px; border-top: 1px solid var(--line); padding: 13px 0 0; margin-top: 8px; }
.me-code { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; gap: 3px; }
.me-code > span { font-size: 10px; color: var(--muted); }
.me-code button { min-height: 44px; padding: 0; font-size: 12px; letter-spacing: .06em; }
#me-save { min-width: 92px; min-height: 44px; }
.me-error { font-size: 12px; color: var(--warning); margin: 8px 0; }
@media (max-width: 600px) {
 #modal[data-surface="appearance"] { padding: 20px 18px 18px; max-height: min(92dvh,900px); }
 .me-layout { grid-template-columns: minmax(0,1fr); gap: 8px; }
 .me-preview { position: relative; display: flex; justify-content: center; align-items: flex-end; }
 #me-preview { width: 190px; height: 190px; }
 #me-turn { position: absolute; right: 5px; bottom: 7px; }
 .me-name { margin: 0 0 8px; }
 .me-tabs { margin-bottom: 13px; }
 .me-field { margin-bottom: 13px; }
 .me-choice { padding: 7px 3px; min-width: 0; }
 .me-footer { position: sticky; bottom: -18px; background: var(--solid); padding: 12px 0 2px; z-index: 1; }
}
@media (max-height: 600px) and (min-width: 601px) {
 #me-preview { height: 225px; }
}

@media (max-width: 360px) {
 .me-options { grid-template-columns: repeat(min(var(--choices),3),minmax(0,1fr)); }
}
/* Keep the character and Save in view; only the current option panel scrolls. */
#modal[data-surface="appearance"] { height: min(650px,calc(100dvh - 40px)); }
#modal[data-surface="appearance"] #modal-content { height: 100%; max-height: none; overflow: hidden; }
#modal[data-surface="appearance"] .me-page { height: 100%; min-height: 0; display: flex; flex-direction: column; }
#modal[data-surface="appearance"] #modal-content > .me-page > h2 { position: static; flex: 0 0 auto; padding-bottom: 16px; }
.me-form { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.me-layout { flex: 1; min-height: 0; overflow: hidden; }
.me-controls { display: flex; flex-direction: column; min-height: 0; }
.me-name, .me-tabs { flex: 0 0 auto; }
.me-controls [role="tabpanel"] { overflow-y: auto; min-height: 0; flex: 1; padding: 2px 3px 0 0; overscroll-behavior: contain; scrollbar-width: thin; }
.me-footer { flex: 0 0 auto; position: static; }
@media (max-width: 600px) {
 #modal[data-surface="appearance"] { height: min(92dvh,760px); }
 .me-layout { grid-template-rows: 150px minmax(0,1fr); }
 .me-preview { height: 150px; }
 #me-preview { width: 170px; height: 150px; }
 .me-footer { padding-top: 9px; }
}
@media (max-width: 600px) and (max-height: 650px) {
 .me-layout { grid-template-rows: 110px minmax(0,1fr); }
 .me-preview, #me-preview { height: 110px; }
 #me-preview { width: 150px; }
 #modal[data-surface="appearance"] #modal-content > .me-page > h2 { padding-bottom: 6px; }
 .me-footer { margin-top: 4px; padding-top: 6px; }
}
