#titleCard, #resultCard {
  position: absolute;
  z-index: 6;
  width: min(440px, calc(100% - 24px));
  max-height: calc(100% - 16px);
  overflow: auto;
  background: var(--card);
  border: 3px solid var(--ink);
  border-radius: 22px;
  padding: 1rem 1.1rem 1.15rem;
  box-shadow: 0 10px 0 rgba(42, 29, 36, 0.25);
}

#lobbyCard {
  position: absolute;
  z-index: 6;
  width: min(800px, calc(100% - 24px));
  max-width: 800px;
  max-height: calc(100% - 16px);
  overflow: auto;
  background: var(--card);
  border: 3px solid var(--ink);
  border-radius: 22px;
  padding: 1rem 1.1rem 1.15rem;
  box-shadow: 0 10px 0 rgba(42, 29, 36, 0.25);
}

h1 { margin: 0 0 0.3rem; font-size: 2.4rem; line-height: 1; }

.customBox {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 0.55rem;
  align-items: center;
  margin: 0.35rem 0 0.55rem;
}

#preview {
  width: 140px;
  height: 140px;
  display: block;
  border: 3px solid var(--ink);
  border-radius: 18px;
  background: #8fd8ff;
}

.optGrid { display: flex; flex-wrap: wrap; gap: 0.28rem; margin-bottom: 0.35rem; }

.opt {
  border: 2px solid var(--ink);
  background: #fff;
  border-radius: 999px;
  font-family: "Jua", "Malgun Gothic", sans-serif;
  font-size: 0.78rem;
  padding: 0.15rem 0.45rem;
  cursor: pointer;
}

.opt.on { background: #ff8ab8; }

h2 { margin: 0 0 0.4rem; font-size: 2rem; }

.lead, .rules, #lanLine, #lobbyHint, #resultHint { margin: 0.4rem 0; line-height: 1.45; }

.rules { padding-left: 1.1rem; }

kbd {
  display: inline-block;
  border: 2px solid var(--ink);
  border-bottom-width: 3px;
  border-radius: 7px;
  padding: 0 0.35rem;
  background: #fff;
  font-family: inherit;
}

label { display: block; margin: 0.7rem 0 0.35rem; font-weight: 700; }

#name, #codeInput { width: 100%; }

#createBtn, #startBtn, #rematchBtn { width: 100%; margin-top: 0.7rem; background: var(--pink); color: white; }

.subtleBtn {
  width: 100%;
  margin-top: 0.45rem;
  background: #f1f5f9;
  color: #64748b;
  border-color: #94a3b8;
  box-shadow: 0 2px 0 #94a3b8;
  font-family: "Jua", "Malgun Gothic", sans-serif;
}
.subtleBtn:hover {
  background: #e2e8f0;
  color: var(--ink);
}

#resultCard .rowBtns {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.7rem;
}
#resultCard .rowBtns button {
  flex: 1;
  margin-top: 0;
}
#resultLeaveBtn {
  background: #f1f5f9;
  color: #475569;
}
#resultLeaveBtn:hover {
  background: #e2e8f0;
}

.soloLaunch {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.4rem;
  margin-top: 0.65rem;
  padding: 0.55rem;
  border: 2px dashed var(--ink);
  border-radius: 14px;
  background: rgba(183, 234, 217, 0.35);
}

#soloStageSelect {
  width: 100%;
  border: 2px solid var(--ink);
  border-radius: 10px;
  padding: 0.42rem 0.6rem;
  background: #fff;
  font: inherit;
  font-weight: 700;
}

#soloBtn {
  width: 100%;
  background: #38bdf8;
  color: #fff;
  font-family: "Jua", "Malgun Gothic", sans-serif;
  font-size: 1.05rem;
}

.joinRow, .rowBtns {
  display: flex;
  gap: 0.45rem;
  margin-top: 0.55rem;
}

.joinRow input { flex: 1; }

.eyebrow { margin: 0; letter-spacing: 0.08em; }

.mega {
  margin: 0;
  font-size: 3rem;
  letter-spacing: 0.18em;
  line-height: 1;
}

#roster, #ranks { list-style: none; padding: 0; margin: 0.7rem 0; }

#roster li, #ranks li {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.35rem 0.2rem;
  border-bottom: 2px dashed rgba(42, 29, 36, 0.2);
}

.lobbyCustomWrap {
  margin: 0.6rem 0 0.4rem;
  padding: 0.6rem;
  background: rgba(255, 255, 255, 0.65);
  border: 2px solid var(--ink);
  border-radius: 16px;
}

.lobbyCustomHeader {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.slotBadge {
  font-family: "Jua", "Malgun Gothic", sans-serif;
  font-size: 0.8rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: var(--pink);
  color: #fff;
  border: 1.5px solid var(--ink);
  box-shadow: 0 1.5px 0 var(--ink);
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.previewTitle {
  font-family: "Jua", "Malgun Gothic", sans-serif;
  font-size: 1rem;
  color: var(--ink);
  font-weight: 700;
}

.miniBtn {
  margin-left: auto;
  padding: 0.15rem 0.55rem;
  font-size: 0.75rem;
  font-family: "Jua", "Malgun Gothic", sans-serif;
  background: #fff;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  cursor: pointer;
}

.lobbyCustomBox {
  margin: 0;
}

#lobbyPreview {
  width: 130px;
  height: 130px;
  display: block;
  border: 3px solid var(--ink);
  border-radius: 16px;
  background: #8fd8ff;
}

.otherPlayerNote {
  padding: 0.5rem;
  text-align: center;
  font-family: "Jua", "Malgun Gothic", sans-serif;
  color: #475569;
  font-size: 0.9rem;
}

.rosterHint {
  margin: 0.6rem 0 0.25rem;
  font-size: 0.84rem;
  color: #475569;
  font-family: "Jua", "Malgun Gothic", sans-serif;
  font-weight: 700;
}

#roster {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.55rem;
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0.8rem;
}

@media (max-width: 680px) {
  #roster {
    grid-template-columns: repeat(2, 1fr);
  }
}

#roster li.rosterCardItem {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.4rem;
  background: #ffffff;
  border: 2px solid var(--ink);
  border-radius: 14px;
  box-shadow: 0 3px 0 rgba(42, 29, 36, 0.12);
  min-height: 165px;
  box-sizing: border-box;
  transition: transform 0.12s, box-shadow 0.12s;
  position: relative;
}

#roster li.rosterCardItem.me {
  background: #fffdf8;
  border-color: #ff5d8f;
  box-shadow: 0 3px 0 #ff5d8f;
}

#roster li.rosterCardItem.emptySlot {
  background: rgba(255, 255, 255, 0.4);
  border: 2px dashed rgba(42, 29, 36, 0.25);
  box-shadow: none;
  justify-content: center;
  gap: 0.35rem;
  color: #94a3b8;
}

.rosterSlotHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 0.25rem;
  font-family: "Jua", "Malgun Gothic", sans-serif;
}

.rosterTagGroup {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.rosterCanvasWrap {
  width: 86px;
  height: 86px;
  border-radius: 12px;
  border: 2px solid rgba(42, 29, 36, 0.16);
  background: radial-gradient(circle, #f0f9ff 0%, #e0f2fe 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0.25rem 0;
  overflow: hidden;
}

.rosterSlotCanvas {
  width: 86px;
  height: 86px;
  display: block;
}

.emptySlotPlaceholder {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px dashed rgba(42, 29, 36, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: #94a3b8;
  font-family: "Jua", "Malgun Gothic", sans-serif;
  margin: 0.3rem 0;
}

.emptySlotText {
  font-family: "Jua", "Malgun Gothic", sans-serif;
  font-size: 0.78rem;
  color: #94a3b8;
}

.rosterInfo {
  width: 100%;
  text-align: center;
  font-family: "Jua", "Malgun Gothic", sans-serif;
}

.rosterPlayerName {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  line-height: 1.2;
}

.rosterLookTags {
  display: flex;
  gap: 0.2rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 0.2rem;
}

.lookTag {
  font-size: 0.68rem;
  padding: 0.08rem 0.3rem;
  border-radius: 999px;
  background: #f1f5f9;
  border: 1px solid rgba(42, 29, 36, 0.2);
  color: #334155;
  font-family: "Jua", "Malgun Gothic", sans-serif;
  white-space: nowrap;
}

.statusTag {
  font-size: 0.7rem;
  padding: 0.08rem 0.35rem;
  border-radius: 999px;
  border: 1px solid rgba(42, 29, 36, 0.2);
  font-family: "Jua", "Malgun Gothic", sans-serif;
  white-space: nowrap;
}
.statusTag.ready { background: #bbf7d0; color: #166534; font-weight: 700; }
.statusTag.host { background: #fef08a; color: #854d0e; }
.statusTag.bot { background: #e2e8f0; color: #475569; }
.statusTag.me { background: #fce7f3; color: #be123c; font-weight: 700; }

.swatch {
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50%;
  border: 2px solid var(--ink);
  display: inline-block;
  margin-right: 0.35rem;
}

.error { color: #c42355; min-height: 1.2em; font-weight: 700; }
