/* ==========================================================================
   HEEL & TOE — Group Drive (multiplayer): menus, chat overlay, name tags
   ========================================================================== */

/* ---------------------------------------------------------------- menu screens */
.mp-panel { display: flex; flex-direction: column; gap: 1rem; }
.mp-chip { align-self: flex-start; padding: 0.2rem 0.7rem; border-radius: 999px; font-size: 0.82rem; border: 1px solid var(--line2); }
.mp-chip.good { color: var(--green); border-color: rgba(74, 208, 122, 0.45); }
.mp-chip.bad { color: var(--red); border-color: rgba(255, 90, 67, 0.5); }
.mp-notice { padding: 0.8rem 1rem; border-radius: 10px; background: rgba(232, 162, 58, 0.08); border: 1px solid rgba(232, 162, 58, 0.35); font-size: 0.9rem; line-height: 1.45; }
.mp-notice p { margin: 0 0 0.5rem; }
.mp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 0.8rem 1.2rem; }
.mp-label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.85rem; color: var(--ink2); }
.mp-field { min-height: 2.4rem; padding: 0.35rem 0.7rem; border-radius: 8px; border: 1px solid var(--line2); background: rgba(0, 0, 0, 0.35); color: var(--ink); font: inherit; font-size: 1rem; }
.mp-field:focus { outline: 2px solid var(--teal); outline-offset: 1px; }
/* text fields: no select chevron (realism.css styles every text input like a select) */
input.mp-field[type='text'], input.mp-input[type='text'] { background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02)); padding-right: 0.7rem; max-width: none; }
.mp-field.small { min-height: 2.2rem; }
.mp-code-in { width: 9.5rem; font-family: var(--cond); font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }
.mp-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1rem; }
.mp-card { padding: 0.9rem 1rem; border-radius: 12px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.22); display: flex; flex-direction: column; gap: 0.6rem; }
.mp-card h3 { margin: 0; font-family: var(--cond); letter-spacing: 0.08em; text-transform: uppercase; font-size: 0.95rem; color: var(--amber2); }
.mp-card p { margin: 0; font-size: 0.88rem; }
.mp-hint { min-height: 1.2em; margin: 0; color: var(--amber2); font-size: 0.9rem; }
.mp-codebox { display: flex; flex-wrap: wrap; gap: 0.8rem 1.4rem; align-items: center; justify-content: space-between; }
.mp-code { font-family: var(--cond); font-weight: 700; font-size: clamp(1.8rem, 5vw, 2.6rem); letter-spacing: 0.16em; color: var(--ink); }
.mp-qr { width: 10rem; height: 10rem; image-rendering: pixelated; border-radius: 8px; background: #fff; }
.mp-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1rem; }
.mp-members { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.mp-mem { display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem; font-size: 0.95rem; }
.mp-mem .mp-st { color: var(--muted); font-size: 0.82rem; margin-right: auto; }
.mp-star { color: var(--amber2); }
.mp-set { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; font-size: 0.9rem; }
.mp-warn { color: var(--amber2); }
.btn.danger { color: var(--red); }
.mp-foot { margin-top: 0.2rem; }
.mp-chatcard .mp-field { flex: 1 1 12rem; min-width: 0; }
.mp-gfeed { list-style: none; margin: 0; padding: 0.4rem 0.6rem; max-height: 12rem; overflow-y: auto; border-radius: 8px; background: rgba(0, 0, 0, 0.25); font-size: 0.92rem; }
.mp-modal .modal-box { display: flex; flex-direction: column; gap: 0.7rem; }
.mp-modal .modal-box h3 { margin: 0; }
.mp-modal .modal-box p { margin: 0; }
.mp-pause-btn { border-color: rgba(63, 208, 201, 0.5); }

/* ---------------------------------------------------------------- shared: dots, lines, chips */
.mp-dot { display: inline-block; flex: none; width: 0.6rem; height: 0.6rem; border-radius: 50%; background: #e0e0e0; box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.55); }
.mp-line { display: flex; align-items: baseline; gap: 0.4rem; padding: 0.12rem 0; line-height: 1.35; word-break: break-word; overflow-wrap: anywhere; }
.mp-line .mp-dot { transform: translateY(-0.05rem); }
.mp-line .mp-name { flex: none; font-weight: 600; }
.mp-line.sys .mp-text { color: var(--muted); font-style: italic; }
.mp-line.quick .mp-text { color: var(--teal); }
.mp-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.mp-chip { padding: 0.2rem 0.6rem; min-height: 1.9rem; border-radius: 999px; border: 1px solid var(--line2); background: rgba(10, 13, 17, 0.78); color: var(--ink); font: inherit; font-size: 0.82rem; cursor: pointer; }
.mp-chip:hover, .mp-chip:focus-visible { border-color: var(--teal); outline: none; }

/* ---------------------------------------------------------------- chat overlay (inside the HUD, in a group drive only)
   mpchat.js puts the overlay and the 💬 button into the HUD only in a group drive (anywhere else they
   are not in the page) and sets the top under the top-left HUD as it is drawn (the value here is the
   fallback): the overlay is the band between that and the map, its lines sit at the bottom. Content
   taller than the band overflows downwards (`safe`), never up over the top-left HUD. */
.mp-chat { position: absolute; left: calc(1rem + var(--safe-l)); top: calc(5.6rem + var(--safe-t)); bottom: calc(17.6rem + var(--safe-b)); width: min(25rem, 44vw); display: flex; flex-direction: column; justify-content: flex-end; justify-content: safe flex-end; gap: 0.4rem; pointer-events: none; z-index: 3; }
.mp-chat[hidden], .mp-chat-btn[hidden], .mp-box[hidden] { display: none !important; }
/* shut: the newest lines at the bottom; a short band cuts the oldest off at the top */
.mp-feed { list-style: none; margin: 0; padding: 0; flex: 0 1 auto; min-height: 0; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; font-size: 0.9rem; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85); }
.mp-feed .mp-line { flex: none; transition: opacity 0.6s; }
.mp-feed .mp-line.gone { opacity: 0; }
.mp-chat.open .mp-feed { justify-content: flex-start; padding: 0.45rem 0.6rem; border-radius: 10px; background: rgba(10, 13, 17, 0.72); max-height: 16rem; overflow-y: auto; pointer-events: auto; }
.mp-chat.open .mp-feed .mp-line.gone { opacity: 1; }
/* no lines yet (a group just made): no empty dark strip between the top-left HUD and the chips */
.mp-chat.open .mp-feed:empty { padding: 0; background: none; }
.mp-box { display: none; flex: none; flex-direction: column; gap: 0.4rem; pointer-events: auto; }
.mp-chat.open .mp-box { display: flex; }
/* a screen too short for the open chat above the map: it drops over the map (the car coasts while
   the chat is open), the 💬 under it gives way to the ✕ */
.mp-chat.open.low { bottom: calc(1rem + var(--safe-b)); }
.mp-chat.open.low ~ .mp-chat-btn { display: none; }
/* the PHONE button (drawn over the HUD: on a short screen it lands on the chat's chips and input)
   steps aside while the chat is open; shut, mpchat.js keeps the feed clear of it */
body.mp-chatting .ph-fab:not(.in-walk) { visibility: hidden; }
/* shorter still (a browser window a few hundred pixels high): the chips are one row that scrolls
   sideways (wheel, swipe, Alt+1…0), so the input and a few lines still fit under the top-left HUD */
.mp-chat.open.tight .mp-chips { flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; }
.mp-chat.open.tight .mp-chips::-webkit-scrollbar { display: none; }
.mp-chat.open.tight .mp-chip { flex: none; white-space: nowrap; }
.mp-row { display: flex; gap: 0.35rem; }
.mp-input { flex: 1 1 auto; min-width: 0; min-height: 2.3rem; padding: 0.3rem 0.7rem; border-radius: 8px; border: 1px solid var(--teal); background: rgba(8, 10, 13, 0.9); color: var(--ink); font: inherit; font-size: 0.95rem; }
.mp-input:focus { outline: none; box-shadow: 0 0 0 2px rgba(63, 208, 201, 0.35); }
.mp-input.bad { animation: mp-shake 0.3s; border-color: var(--red); }
.mp-send, .mp-close { min-height: 2.3rem; padding: 0 0.8rem; border-radius: 8px; border: 1px solid var(--line2); background: rgba(10, 13, 17, 0.88); color: var(--ink); font: inherit; cursor: pointer; }
.mp-chat.quick .mp-row { display: none; }
@keyframes mp-shake { 0%, 100% { transform: none; } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.mp-chat-btn { position: absolute; left: calc(7.6rem + var(--safe-l)); bottom: calc(14.4rem + var(--safe-b)); width: 2.5rem; height: 2.5rem; border-radius: 50%; border: 1px solid var(--line2); background: rgba(10, 13, 17, 0.8); color: var(--ink); display: grid; place-items: center; font-size: 1.15rem; pointer-events: auto; cursor: pointer; z-index: 3; }
.mp-chat-btn.on { border-color: var(--teal); }
.mp-chat-btn .mp-unread { position: absolute; top: -0.25rem; right: -0.25rem; min-width: 1.1rem; padding: 0 0.25rem; border-radius: 999px; background: var(--amber); color: #111; font-size: 0.7rem; line-height: 1.1rem; text-align: center; }
.mp-chat-btn .mp-unread:empty { display: none; }
.hud.hud-off .mp-chat-btn { display: none; }

/* ---------------------------------------------------------------- name tags (inside the HUD) */
.mp-tags { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 1; }
.mp-tag { position: absolute; left: 0; top: 0; display: flex; flex-direction: column; align-items: center; gap: 0.25rem; transform-origin: 50% 100%; will-change: transform; }
.mp-tag-row { display: flex; align-items: center; gap: 0.35rem; padding: 0.15rem 0.55rem; border-radius: 999px; background: rgba(10, 13, 17, 0.72); font-size: 0.85rem; white-space: nowrap; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8); }
.mp-tag.car .mp-tag-row { font-size: 0.75rem; background: rgba(10, 13, 17, 0.55); }
.mp-tag-meta { color: var(--ink2); font-size: 0.78rem; }
.mp-bubble { max-width: 15rem; padding: 0.3rem 0.65rem; border-radius: 12px; background: rgba(236, 232, 225, 0.94); color: #111; font-size: 0.85rem; line-height: 1.3; text-align: center; overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- phones */
body.touch-device .mp-chat { width: min(20rem, 52vw); }
/* the map is at the top right on a touch screen (app.css): the 💬 sits left of it, level with its top
   and clear of the speed-limit sign on its corner — never under the touch wheel or pedals (mpchat.js
   moves it if something is there all the same) */
body.touch-device .mp-chat-btn { left: auto; right: calc(6.9rem + var(--safe-r)); top: calc(5.3rem + var(--safe-t)); bottom: auto; }
body.touch-device .hud.on-foot .mp-chat-btn { right: calc(7.7rem + var(--safe-r)); top: calc(0.5rem + var(--safe-t)); }
/* the open chat: the touch driving controls step aside (the car coasts while it is open), so its chips
   and input are never under the wheel or the pedals; the 💬 stays to shut it */
body.mp-chatting #touch { visibility: hidden; }
body.touch-device .mp-chat.open.low ~ .mp-chat-btn { display: grid; }
@media (max-height: 520px) {
  /* the map is 8.5rem here (app.css): the 💬 and the chat come down with it */
  .mp-chat { bottom: calc(13.2rem + var(--safe-b)); }
  .mp-chat-btn { left: calc(6.2rem + var(--safe-l)); bottom: calc(10.2rem + var(--safe-b)); }
  .mp-chat.open .mp-feed { max-height: 8rem; }
}
