/* JonnyVroomVroom — CPU rivals stepper, multiplayer lobby and standings. */

#mp-intro {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 10px;
  margin-top: 10px;
}
#mp-intro + .specs { margin-top: 30px; }

.mp-cpu {
  display: inline-flex;
  align-items: center;
  border: 1px solid #ffffff55;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #f4f2ef;
}
.mp-cpu span { padding: 0 6px 0 16px; }
.mp-cpu button {
  width: 40px;
  height: 46px;
  background: #0000;
  border: 0;
  color: #f4f2ef;
  font-size: 18px;
  touch-action: manipulation;
}
.mp-cpu b { min-width: 18px; text-align: center; font-size: 15px; color: #ef7159; }
.mp-cpu.readonly b { padding-right: 16px; }

#mp-friends, .mp-primary, .mp-ghost {
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  padding: 16px 20px;
  text-align: left;
  border: 1px solid #ffffff55;
  background: #0000;
  color: #f4f2ef;
}
#mp-friends span, .mp-primary span, .mp-ghost span { margin-left: 14px; }
#mp-friends { border-color: #ef7159; }
#mp-car, #mp-lcar { font: inherit; font-size: 10px; font-weight: 700; letter-spacing: 2px; padding: 0 16px; min-height: 46px; border: 1px solid #ffffff55; background: #0000; color: #f4f2ef; }
#mp-car b, #mp-lcar b { color: #ef7159; margin-left: 6px; }
.mp-players em.car { color: #e0b22a; }
.mp-players em.away { color: #9aa3a8; }
.mp-primary { background: #f0ede8; color: #202124; border-color: #f0ede8; min-width: 210px; }
.mp-primary:disabled { opacity: .45; }

/* ---------- Lobby / join panel ---------- */
#mp-panel {
  position: absolute;
  top: 19%;
  left: 7%;
  width: min(480px, 86%);
  z-index: 5;
}
#mp-panel .eyebrow span { margin-left: 18px; }
.mp-code { color: #ef7159; font-size: 13px; letter-spacing: 4px; margin-left: 6px; }
.mp-title { font-size: clamp(54px, 6vw, 90px); letter-spacing: -4px; line-height: .9; margin: 18px 0 18px; font-weight: 900; }
.mp-title em { font-family: Georgia, serif; font-weight: 400; letter-spacing: -5px; }
#mp-panel p { color: #d6d5d3; font-size: 13px; line-height: 1.7; margin: 0 0 18px; }
#mp-panel label { display: block; font-size: 9px; letter-spacing: 2px; color: #d6d5d3; margin-bottom: 8px; }
#mp-name {
  width: 100%;
  max-width: 340px;
  font: inherit;
  font-size: 18px;
  color: #f4f2ef;
  background: #13212866;
  border: 1px solid #ffffff55;
  padding: 12px 14px;
  margin-bottom: 14px;
  border-radius: 0;
  -webkit-user-select: text;
  user-select: text;
}
#mp-name:focus { outline: 1px solid #ef7159; }
.mp-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.mp-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0 8px; }
.mp-link { font-size: 10px; letter-spacing: 1px; color: #c2c1bf; margin-bottom: 14px; word-break: break-all; }
.mp-status { font-size: 10px; letter-spacing: 2px; color: #d6d5d3; margin: 0 0 16px; }

.mp-players { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 18px; }
.mp-players li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  letter-spacing: 1px;
  padding: 8px 0;
  border-bottom: 1px solid #ffffff22;
  white-space: nowrap;
  overflow: hidden;
}
.mp-players i, #mp-standings i { width: 10px; height: 10px; border-radius: 50%; flex: none; box-shadow: 0 0 0 1px #fff4; }
.mp-players em { font-style: normal; font-size: 8px; letter-spacing: 1.6px; color: #ef7159; }

/* ---------- Finish standings ---------- */
body.mp #restart { display: none; }
body.mp-racing #finish h2 { margin-bottom: 8px; }
#mp-standings:empty { display: none; }
#mp-standings ol { list-style: none; padding: 0; margin: 4px 0 18px; max-width: 440px; }
#mp-standings li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 7px 0;
  font-size: 13px;
  letter-spacing: 1px;
  border-bottom: 1px solid #ffffff22;
}
#mp-standings li span { width: 18px; color: #c2c1bf; font-variant-numeric: tabular-nums; }
#mp-standings li b { margin-left: auto; font-weight: 400; font-variant-numeric: tabular-nums; }
#mp-standings li.me { color: #ef7159; }

#mp-toast {
  position: fixed;
  left: 50%;
  top: calc(16px + env(safe-area-inset-top, 0px));
  transform: translateX(-50%);
  z-index: 70;
  display: none;
  pointer-events: none;
  white-space: nowrap;
  max-width: 92vw;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 2px;
  font-size: 10px;
  font-weight: 700;
  color: #f4f2ef;
  background: #151619e6;
  border: 1px solid #ffffff55;
  padding: 12px 18px;
}
#mp-toast.show { display: block; }

/* ---------- Small and short screens ---------- */
@media (width <= 800px) {
  #mp-panel { top: 16%; width: 86%; }
  .mp-title { font-size: 56px; }
}
@media (max-height: 520px) {
  #mp-intro { margin-top: 8px; }
  #mp-intro .mp-cpu button { height: 40px; }
  #mp-friends { padding: 12px 16px; }
  #mp-car { min-height: 40px; }
  #mp-panel { top: calc(54px + env(safe-area-inset-top, 0px)); left: calc(6% + env(safe-area-inset-left, 0px)); width: min(620px, 88%); }
  #mp-panel .mp-title { font-size: 40px; letter-spacing: -2px; margin: 8px 0 10px; }
  #mp-panel .mp-title br { display: none; }
  #mp-panel .mp-title em { margin-left: 10px; letter-spacing: -3px; }
  #mp-panel p { margin-bottom: 10px; }
  .mp-players li { padding: 5px 0; }
  .mp-row { margin: 8px 0 4px; }
  .mp-link { margin-bottom: 8px; }
  .mp-status { margin-bottom: 10px; }
  .mp-primary, .mp-ghost { padding: 12px 16px; }
  #mp-name { padding: 9px 12px; margin-bottom: 10px; }
  #mp-standings ol { margin-bottom: 10px; }
  #mp-standings li { padding: 4px 0; font-size: 12px; }
}

/* ---------- Practice banner ---------- */
#mp-banner {
  position: fixed;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: calc(100vw - 32px);
  padding: 8px 8px 8px 16px;
  background: #151619d9;
  border: 1px solid #ffffff44;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.8px;
  white-space: nowrap;
  color: #f4f2ef;
}
#mp-banner[hidden] { display: none; }
#mp-banner b { color: #ef7159; }
#mp-banner span { overflow: hidden; text-overflow: ellipsis; color: #d6d5d3; }
#mp-banner button {
  font: inherit;
  letter-spacing: 1.6px;
  padding: 9px 12px;
  border: 1px solid #ffffff55;
  background: #0000;
  color: #f4f2ef;
  touch-action: manipulation;
}
#mp-banner button[data-b="start"] { background: #f0ede8; color: #202124; border-color: #f0ede8; }
body.touch-ui #mp-banner { top: calc(62px + env(safe-area-inset-top, 0px)); font-size: 9px; gap: 10px; }
body.mp-practice #finish { display: none; }

/* Medium-height screens (most laptops): the intro now has two rows of buttons, so tighten it. */
@media (min-height: 521px) and (max-height: 860px) {
  #intro { top: 15%; }
  #intro h1 { font-size: clamp(56px, 10.5vh, 110px); margin: 16px 0 14px; }
  #intro p { margin-bottom: 18px; line-height: 1.7; }
  #intro .specs { display: none; }
}
