/* Party club: shared controls, readable cards and touch-sized targets. */
#mp-dialog,#skin-dialog {
  box-sizing:border-box;
  width:min(620px,94vw);
  max-height:92dvh;
  overflow:auto;
  padding:24px;
  border:1px solid #87b5ce77;
  border-radius:26px;
  color:#eefaff;
  background:radial-gradient(ellipse at 100% 0,#426c8655,transparent 50%),#16334b;
  box-shadow:0 22px 90px #061323aa}

#skin-dialog {
  position:fixed;
  inset:0;
  margin:auto;
  z-index:30}
#skin-dialog::backdrop {
  background:#081a31b8}
.party-heading {
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:14px}
.party-heading h2 {
  font-size:25px;
  line-height:1.3;
  margin:3px 0 18px;
  letter-spacing:-.4px}
.party-eyebrow {
  color:#92c9cd;
  font-size:10px;
  letter-spacing:2px;
  font-weight:750}
.party-close {
  border:1px solid #85a7ba77;
  border-radius:50%!important;
  min-width:38px!important;
  min-height:38px!important;
  padding:5px!important;
  background:#ffffff0a!important;
  color:#d2e6ee;
  cursor:pointer}
.party-tabs {
  display:grid;
  grid-template-columns:1fr 1fr;
  background:#0b2237;
  border-radius:14px;
  padding:4px;
  gap:5px;
  margin-bottom:15px}
#mp-dialog .party-tabs button {
  border:0;
  border-radius:11px;
  background:transparent;
  color:#afc6d7;
  min-height:43px;
  font-weight:700}
#mp-dialog .party-tabs button[aria-pressed=true] {
  color:#153343;
  background:#b2e8dd;
  box-shadow:0 3px 12px #04111d44}
#mp-dialog .party-tabs button:disabled {
  opacity:.55;
  cursor:default}
.party-hero {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  padding:5px 15px 2px 18px;
  border-radius:18px;
  background:linear-gradient(120deg,#9adbdc15,#c2a4f522);
  border:1px solid #b2d9eb22}
.party-hero h3 {
  font-size:19px;
  margin-bottom:7px;
  line-height:1.35}
.party-hero p {
  color:#b7d0e0;
  font-size:13px;
  line-height:1.65}
.party-hero-avatar {
  position:relative;
  width:100px;
  flex-shrink:0}
.party-hero-avatar canvas {
  display:block;
  width:100px;
  height:107px;
  background:none}
.party-orbit {
  position:absolute;
  right:0;
  top:12px;
  color:#ffe19a;
  font-size:25px;
  transform:rotate(15deg)}
.party-profile {
  display:grid;
  grid-template-columns:1fr 1fr;
  align-items:end;
  gap:12px;
  margin:16px 0}
.party-profile label {
  font-size:12px;
  color:#c5dbe6}
#mp-dialog .party-profile input {
  margin:6px 0 0;
  width:100%;
  min-height:53px;
  box-sizing:border-box;
  border-radius:12px;
  border-color:#7496ac66;
  background:#0d263b;
  color:#f5fcff;
  padding:12px;
  font-size:16px}
#mp-dialog #mp-wardrobe {
  display:flex;
  align-items:center;
  gap:7px;
  min-height:54px;
  border-radius:12px;
  text-align:left;
  background:#29485f;
  border:1px solid #7897ab55;
  padding:2px 8px}
#mp-wardrobe canvas {
  width:46px;
  height:49px;
  background:none}
#mp-wardrobe span:nth-child(2) {
  flex:1}
#mp-wardrobe small {
  display:block;
  color:#a9c6d8;
  font-size:10px}
#mp-wardrobe strong {
  font-size:12px;
  color:#ffe5ad}
.party-section-heading {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:8px;
  margin:18px 0 10px}
.party-section-heading h3 {
  font-size:15px}
.party-section-heading span {
  font-size:11px;
  color:#a5c2d4}
#mp-ai-count {
  display:flex;
  gap:8px}
#mp-dialog #mp-ai-count button {
  flex:1;
  min-width:0;
  background:#223f57;
  border-color:#63829955;
  padding:9px;
  border-radius:12px;
  color:#d8e9f4;
  font-size:16px;
  font-weight:700}
#mp-dialog #mp-ai-count button[aria-pressed=true] {
  background:#ffdf9b;
  color:#253c4d;
  border-color:#fff1bd;
  box-shadow:0 4px 15px #ffcf6f14}
#mp-ai-preview {
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(83px,1fr));
  gap:7px;
  list-style:none;
  margin:12px 0 0;
  padding:0}
#mp-ai-preview li {
  border:1px solid #b3b9e12e;
  background:#233d5577;
  border-radius:13px;
  text-align:center;
  padding:5px 4px 9px;
  min-width:0}
#mp-ai-preview canvas {
  display:block;
  width:64px;
  height:68px;
  margin:auto;
  background:none}
#mp-ai-preview strong {
  display:block;
  font-size:12px;
  color:#f0e4ff}
#mp-ai-preview small {
  display:block;
  font-size:10px;
  line-height:1.5;
  color:#a9c5d8;
  margin-top:3px}
.party-friendly {
  font-size:12px;
  line-height:1.65;
  color:#b8e8d8;
  border-left:2px solid #8bd7bb;
  padding-left:10px;
  margin-top:12px}
.party-map {
  background:#0c2539;
  border:1px solid #6689a333;
  padding:9px 12px;
  border-radius:11px;
  font-size:12px;
  color:#cce3ef;
  margin:15px 0 8px}
#mp-status {
  font-size:12px;
  min-height:19px;
  margin:8px 0}
#mp-people {
  gap:8px;
  margin:12px 0;
  padding:0}
#mp-people li {
  display:flex;
  align-items:center;
  gap:9px;
  flex:1 1 160px;
  padding:7px 11px;
  border:1px solid #67829944;
  border-radius:14px;
  background:#28445b}
#mp-people canvas {
  width:40px;
  height:43px;
  background:none;
  flex-shrink:0}
.party-person-name {
  font-size:13px;
  color:#edf7ff}
.party-person-note {
  display:block;
  font-size:10px;
  color:#aac8db;
  margin-top:3px}
.party-ai-badge {
  font-size:9px;
  background:#b99ae92b;
  color:#dbc7ff;
  border:1px solid #ba9ddd66;
  border-radius:5px;
  padding:2px 4px;
  margin-left:5px;
  vertical-align:middle}
#mp-dialog .mp-actions {
  gap:8px;
  padding-top:12px;
  border-top:1px solid #93b0c22b}
#mp-dialog .mp-actions button {
  border-radius:12px;
  min-height:45px}
#mp-dialog .party-primary {
  background:linear-gradient(135deg,#ffe3a4,#f3c978);
  border-color:#ffedbd;
  color:#283d4b;
  font-weight:750;
  flex:1}
#mp-dialog button:focus-visible,#skin-dialog button:focus-visible {
  outline:3px solid #a8e8ee;
  outline-offset:3px}
.skin-intro {
  font-size:13px;
  color:#b4cddc;
  line-height:1.6;
  margin:0 0 16px}
#skin-options {
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:11px}
.skin-card {
  min-height:120px;
  border:1px solid #7896ad66;
  border-radius:16px;
  background:linear-gradient(145deg,#38566b,#243e56);
  color:#e9f5ff;
  cursor:pointer;
  padding:4px 6px 12px;
  font:inherit}
.skin-card canvas {
  display:block;
  width:100px;
  height:107px;
  max-width:100%;
  margin:auto;
  background:none}
.skin-card span {
  font-size:12px;
  font-weight:650;
  line-height:1.5}
.skin-card[aria-pressed=true] {
  border-color:#ffe4a2;
  background:linear-gradient(145deg,#687064,#3d5257);
  box-shadow:0 0 0 2px #ffe4a222}
.skin-card:disabled {
  opacity:.6;
  cursor:default}
#skin-status {
  color:#ffcbaa;
  font-size:12px;
  margin-top:10px}
#mp-result .result {
  position:relative;
  overflow:hidden;
  width:min(460px,90vw);
  border:1px solid #b4d5e666;
  border-radius:26px;
  background:radial-gradient(ellipse at 50% 0,#8e76b459,transparent 70%),#19384e;
  padding:25px;
  box-shadow:0 15px 70px #071a35aa}
#mp-result .result h2 {
  font-size:26px;
  color:#ffe5a5;
  position:relative;
  z-index:1}
#mp-result-note {
  font-size:13px;
  color:#bce2db;
  margin:10px 0;
  line-height:1.6}
#mp-result .result button {
  position:relative;
  z-index:1;
  border:1px solid #a2bccb;
  border-radius:12px;
  background:#31566e;
  color:#edf8ff;
  padding:11px 16px;
  font-weight:650;
  cursor:pointer}
#mp-result #mp-again {
  background:#ffe0a0;
  color:#284052;
  border-color:#ffeabf;
  margin:0 7px 7px 0}
#mp-ranking li {
  display:flex;
  align-items:center;
  gap:9px;
  padding:7px 10px}
#mp-ranking canvas {
  width:35px;
  height:38px;
  background:none;
  flex-shrink:0}
#mp-ranking .party-rank {
  font-size:18px;
  font-weight:800;
  width:25px;
  color:#ffe4a2}
.party-rank-name {
  flex:1;
  min-width:0;
  overflow-wrap:anywhere}
.party-rank-time {
  font-size:11px;
  color:#adc8d9}
#mp-confetti {
  position:absolute;
  inset:0;
  pointer-events:none;
  overflow:hidden}
#mp-confetti i {
  position:absolute;
  width:7px;
  height:12px;
  border-radius:2px;
  left:var(--x);
  top:-20px;
  animation:party-fall 2.8s var(--delay) 2 ease-in-out both;
  transform:rotate(var(--spin))}
@keyframes party-fall {
  to {
  top:110%;
  transform:translateX(20px) rotate(calc(var(--spin) + 300deg));
  opacity:0}
}
.mp-on #info,.mp-on #difficulty-description,.mp-on #difficulty-description+span,.mp-on #settings label[for=difficulty] {
  display:none}
#skin-dialog button {
  touch-action:manipulation}
#wardrobe-open {
  background:#355d75;
  color:#ffebba;
  border:1px solid #9cbbc7;
  border-radius:9px;
  padding:6px 10px;
  min-height:32px;
  cursor:pointer}
.mp-on #wardrobe-open {
  opacity:.5}

@media(max-width:420px) {
  #mp-dialog,#skin-dialog {
  padding:17px;
  border-radius:22px}
.party-heading h2 {
  font-size:22px}
.party-hero {
  padding:8px 10px}
.party-hero h3 {
  font-size:17px}
.party-hero-avatar {
  width:76px}
.party-hero-avatar canvas {
  width:76px;
  height:81px}
.party-profile {
  grid-template-columns:1fr;
  gap:9px}
.party-profile #mp-wardrobe {
  max-width:none}
#mp-ai-preview {
  grid-template-columns:repeat(auto-fit,minmax(70px,1fr))}
.party-section-heading {
  align-items:flex-start;
  flex-direction:column;
  gap:3px}
#skin-options {
  gap:8px}
.skin-card {
  padding:4px 3px 9px;
  min-height:110px}
.skin-card span {
  font-size:11px}
}

@media(max-height:450px) {
  #mp-dialog,#skin-dialog {
  max-height:96dvh;
  padding:15px 20px}
.party-hero {
  display:none}
.party-profile {
  grid-template-columns:1fr 1fr;
  margin:10px 0}
.party-heading h2 {
  font-size:20px;
  margin-bottom:9px}
.party-tabs {
  margin-bottom:8px}
#mp-ai-preview canvas {
  width:48px;
  height:51px}
.skin-card canvas {
  width:65px;
  height:69px}
.skin-card {
  min-height:92px}
.party-section-heading {
  margin:10px 0 7px}
#wardrobe-open {
  min-height:26px;
  padding:3px 7px;
  font-size:11px}
}

@media(prefers-reduced-motion:reduce) {
  #mp-confetti i {
  animation:none;
  display:none}
}


.party-profile.waiting {
  grid-template-columns:1fr}
.party-profile.waiting label[hidden] {
  display:none}
#mp-dialog [hidden] {
  display:none!important}
#skin-dialog .skin-card:focus-visible {
  outline:3px solid #b5edf0;
  outline-offset:2px}

/* Keep the race focused on the course and the controls. */
.mp-on #restart,.mp-on #wardrobe-open,.mp-on #leaderboard-open,.mp-on #journey>label,.mp-on #map-progress {
  display:none}

#mp-result {
  padding:12px;
  overflow:auto}
#mp-result .result {
  max-height:94dvh;
  overflow-y:auto;
  flex-shrink:0;
  box-sizing:border-box}

@media(max-width:420px) {
#mp-ai-preview small {
  min-height:45px}
#mp-dialog .mp-actions {
  position:sticky;
  bottom:-17px;
  background:#16334bf5;
  margin-top:8px;
  padding-bottom:8px;
  z-index:2}
.mp-on #hint {
  font-size:11px}
.mp-on #controls .control {
  min-width:58px;
  min-height:58px}
}

#mp-dialog,#skin-dialog {
  overflow-wrap:anywhere}
#mp-dialog .party-tabs button,.party-heading>div,.party-hero>div:first-child,.party-profile>* {
  min-width:0}
#mp-dialog h3 {
  overflow-wrap:anywhere}
#mp-wardrobe strong {
  overflow-wrap:anywhere}

#mp-dialog .party-close,#skin-dialog .party-close {
  min-height:44px!important;
  min-width:44px!important}
#mp-dialog #mp-ai-count button {
  min-height:44px}

/* Companions use the ordinary campaign HUD and keep all puzzle controls. */
#adventure-status {display:flex;justify-content:center;align-items:center;gap:9px;flex-shrink:0;padding:3px 10px;font-size:12px;color:#bce5d9;flex-wrap:wrap}
#adventure-status[hidden],#adventure-ranking[hidden]{display:none!important}
#adventure-count{color:#ffe19a;font-weight:700}#adventure-status small{font-size:10px;color:#a9c9d9}
.adventure-on #overlay{position:fixed;z-index:15;inset:0;overflow:auto;background:#102944d9}
.adventure-on #overlay .result{position:relative;max-height:92dvh;overflow-y:auto;max-width:min(480px,94vw);width:100%;box-sizing:border-box}
.adventure-on #result-board{display:none}#adventure-ranking{list-style:none;padding:0;margin:10px 0;position:relative;z-index:1}
#adventure-ranking li{display:flex;align-items:center;gap:9px;text-align:left;border-bottom:1px solid #83b2c333;padding:2px 9px;font-size:13px}
#adventure-ranking canvas{background:none;width:30px;height:32px}
#adventure-confetti{position:absolute;inset:0;pointer-events:none;overflow:hidden}
#adventure-confetti i{position:absolute;width:7px;height:12px;border-radius:2px;left:var(--x);top:-20px;animation:party-fall 2.8s var(--delay) 2 ease-in-out both;transform:rotate(var(--spin))}
@media(max-height:450px){#adventure-status{padding:1px;font-size:10px}#adventure-status small{display:none}}
@media(prefers-reduced-motion:reduce){#adventure-confetti i{display:none}}

@media(max-width:600px){.adventure-on #info,.adventure-on #difficulty-description,.adventure-on #difficulty-description+span,#adventure-status small{display:none}}

.adventure-on #info,.adventure-on #leaderboard-open,.adventure-on #difficulty-description,.adventure-on #difficulty-description+span{display:none}

/* Editable companion names use touch-sized fields instead of squeezed captions. */
#mp-ai-preview {display:grid;grid-template-columns:repeat(auto-fit,minmax(112px,1fr))}
#mp-ai-preview label {display:block;margin:4px 0;color:#e0d5f6;font-size:11px}
#mp-ai-preview input {display:block;width:100%;min-width:0;min-height:40px;margin:4px 0 0;padding:8px 6px;font-size:16px;text-align:center;border-radius:8px}
#mp-ai-preview small {overflow-wrap:anywhere}
