/* 로비 전체 배경과 기본 색상 */
#listScreen {
  --lobby-ink: #17152b;
  --lobby-muted: #78768d;
  --lobby-violet: #765cf6;
  --lobby-coral: #ff8a7a;
  --lobby-cream: #fffdf8;
  min-height: 100vh;
  height: auto;
  display: block;
  overflow-x: hidden;
  overflow-y: auto;
  position: relative;
  color: var(--lobby-ink);
  background:
    radial-gradient(circle at 75% 22%, rgba(110,85,235,.24), transparent 27%),
    radial-gradient(circle at 8% 38%, rgba(255,137,122,.08), transparent 20%),
    linear-gradient(155deg, #17123c 0%, #100d2a 48%, #0c0922 100%);
}

/* 별빛과 궤도 배경 */
#listScreen .lobby-stars {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: .7;
  background-image:
    radial-gradient(circle, #fff 0 1px, transparent 1.5px),
    radial-gradient(circle, #9e8cff 0 1px, transparent 1.5px);
  background-position: 9% 15%, 21% 28%;
  background-size: 130px 130px, 190px 190px;
}

#listScreen .lobby-stars::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .32;
  background-image: radial-gradient(circle, #fff 0 1px, transparent 1.5px);
  background-position: 30% 40%;
  background-size: 83px 83px;
  animation: lobbyStarsDrift 28s linear infinite;
}

#listScreen .lobby-orbit {
  position: absolute;
  z-index: 0;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 50%;
  pointer-events: none;
}

#listScreen .lobby-orbit-one {
  width: 540px;
  height: 540px;
  right: -170px;
  top: 80px;
  transform: rotate(-14deg);
}

#listScreen .lobby-orbit-two {
  width: 280px;
  height: 280px;
  left: -165px;
  top: 310px;
}

/* 상단 브랜드와 로그인 영역 */
#listScreen #loginHeader {
  position: relative;
  top: auto;
  left: auto;
  right: auto;
  z-index: 6;
  width: min(1180px, calc(100% - 48px));
  height: 84px;
  margin: 0 auto;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: #fff;
  background: transparent;
}

#listScreen .lobby-brand {
  color: #fff;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 19px;
  font-weight: 760;
  letter-spacing: -.04em;
}

#listScreen .lobby-brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: #241d57;
  background: #fff3cc;
  transform: rotate(-8deg);
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
}

#listScreen .lobby-brand small {
  margin-left: 2px;
  padding-left: 12px;
  border-left: 1px solid rgba(255,255,255,.25);
  color: #aba4d7;
  font-size: 9px;
  font-weight: 650;
  letter-spacing: .16em;
  text-transform: uppercase;
}

#listScreen .lobby-account-area,
#listScreen #loginStatus,
#listScreen #loginButtons {
  display: flex;
  align-items: center;
  gap: 8px;
}

#listScreen #connectedAppsBarLobby {
  position: absolute;
  top: 72px;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  padding: 0;
}

/* 연결된 AI 상태 표시 */
#listScreen #connectedAppsBarLobby::before {
  content: none;
}

#listScreen #connectedAppsBarLobby.hidden { display: none; }

#listScreen .connected-app-row {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 10px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px;
  color: #eeeaff;
  background: rgba(24,19,61,.72);
  box-shadow: 0 8px 22px rgba(0,0,0,.16);
  backdrop-filter: blur(10px);
  font-size: 9px;
  font-weight: 750;
}

#listScreen .connected-app-dot {
  width: 5px;
  height: 5px;
  order: -1;
  background: #63e0a8;
  box-shadow: 0 0 7px rgba(99,224,168,.8);
}

#listScreen #loginHeader button {
  height: 40px;
  padding: 0 13px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 20px;
  color: #fff;
  background: rgba(255,255,255,.07);
  font-size: 11px;
  backdrop-filter: blur(10px);
}

#listScreen #loginHeader button:hover { background: rgba(255,255,255,.14); }
#listScreen #loginUserName { color: #fff; font-size: 11px; font-weight: 700; }

#listScreen #magicLinkEmailInput {
  height: 40px;
  width: 175px;
  padding: 0 12px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 20px;
  color: #fff;
  background: rgba(255,255,255,.08);
  outline: none;
}

#listScreen #magicLinkEmailInput::placeholder { color: #aaa4c8; }
#listScreen #magicLinkSent { color: #d7d0ff; font-size: 11px; }

/* 로비 소개 영역 */
#listScreen .lobby-hero {
  width: min(1080px, calc(100% - 48px));
  min-height: 470px;
  margin: 18px auto 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  position: relative;
  z-index: 2;
  color: #fff;
}

#listScreen .lobby-hero-copy {
  position: relative;
  z-index: 2;
  padding: 20px 0 70px 44px;
}

#listScreen .lobby-eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: #aaa4d5;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .14em;
}

#listScreen .lobby-eyebrow::before {
  content: "";
  width: 28px;
  height: 1px;
  background: var(--lobby-coral);
}

#listScreen .lobby-hero h1 {
  margin: 21px 0 20px;
  color: #fff;
  font-size: clamp(43px, 5vw, 66px);
  line-height: 1.13;
  letter-spacing: -.065em;
  font-weight: 760;
  text-align: left;
}

#listScreen .lobby-hero h1 em {
  color: #c7baff;
  font-style: normal;
  position: relative;
}

#listScreen .lobby-hero h1 em::after {
  content: "";
  position: absolute;
  left: 3px;
  right: -3px;
  bottom: -6px;
  height: 8px;
  border-radius: 50%;
  border-top: 2px solid var(--lobby-coral);
  transform: rotate(-2deg);
}

#listScreen .lobby-description {
  color: #aaa6c7;
  font-size: 15px;
  line-height: 1.8;
}

#listScreen .lobby-hero-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 24px;
}

#listScreen .lobby-primary,
#listScreen .lobby-connect {
  height: 48px;
  padding: 0 19px;
  border-radius: 15px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

#listScreen .lobby-primary {
  border: 0;
  color: #241c52;
  background: #fff3cc;
  box-shadow: 0 10px 30px rgba(0,0,0,.18);
}

#listScreen .lobby-connect {
  border: 1px solid rgba(184,170,255,.35);
  color: #d9d2ff;
  background: rgba(118,92,246,.12);
}

#listScreen .lobby-connect::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 8px;
  border-radius: 50%;
  background: #8cf0c0;
  box-shadow: 0 0 0 4px rgba(140,240,192,.1), 0 0 12px rgba(140,240,192,.5);
}

/* 마스코트 배치 영역 */
#listScreen .lobby-mascot-stage {
  height: 440px;
  position: relative;
  z-index: 0;
  display: grid;
  place-items: center;
  overflow: visible;
  pointer-events: none;
}

#listScreen .lobby-mascot-position {
  position: relative;
  top: 100px;
  left: -20px;
  z-index: 0;
  width: 355px;
  height: 465px;
}

/* 마스코트 크기: 533 × 698px */
#listScreen .lobby-mascot-size {
  position: absolute;
  top: -116px;
  left: -89px;
  width: 533px;
  height: 698px;
  max-width: none;
}

/* 마스코트 이미지와 부유 애니메이션 */
#listScreen .lobby-mascot {
  position: relative;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 22px 28px rgba(0,0,0,.28));
  animation: lobbyFloat 7.2s ease-in-out infinite;
}

#listScreen .lobby-mascot-glow {
  position: absolute;
  z-index: -2;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(148,120,255,.34), rgba(106,71,226,.08) 50%, transparent 72%);
  filter: blur(10px);
}

#listScreen .lobby-planet {
  position: absolute;
  z-index: -1;
  border-radius: 50%;
}

#listScreen .lobby-planet-one {
  width: 18px;
  height: 18px;
  left: 45px;
  top: 110px;
  background: var(--lobby-coral);
  box-shadow: 0 0 24px rgba(255,138,122,.5);
}

#listScreen .lobby-planet-two {
  width: 8px;
  height: 8px;
  right: 40px;
  bottom: 90px;
  background: #fff3cc;
  box-shadow: 0 0 18px rgba(255,243,204,.7);
}

/* 마스코트 위에 표시되는 마인드맵 목록 */
#listScreen .list-card {
  position: relative;
  z-index: 4;
  width: min(1180px, calc(100% - 48px));
  max-width: none;
  max-height: none;
  margin: -25px auto 0;
  padding: 32px 34px 28px;
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 30px 30px 0 0;
  background: var(--lobby-cream);
  box-shadow: 0 -12px 50px rgba(0,0,0,.18);
}

#listScreen .lobby-section-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  margin-bottom: 20px;
}

#listScreen .lobby-section-kicker {
  margin: 0 0 4px;
  color: var(--lobby-violet);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .18em;
}

#listScreen .list-card h1 {
  margin: 0;
  color: var(--lobby-ink);
  font-size: 24px;
  letter-spacing: -.05em;
  text-align: left;
}

#listScreen .lobby-sort {
  border: 0;
  padding: 8px;
  color: var(--lobby-muted);
  background: transparent;
  font-size: 11px;
}

#listScreen .lobby-connection-hub {
  margin-bottom: 18px;
  padding: 17px 18px;
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 20px;
  border: 1px solid #ded8fb;
  border-radius: 18px;
  background: linear-gradient(105deg, #f1edff 0%, #faf8ff 52%, #fff7ee 100%);
}

#listScreen .lobby-connection-copy {
  display: flex;
  align-items: center;
  gap: 13px;
}

#listScreen .lobby-connection-icon {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: #fff;
  background: #201a4b;
  font-size: 23px;
}

#listScreen .lobby-connection-copy p {
  margin: 0 0 2px;
  color: var(--lobby-violet);
  font-size: 8px;
  font-weight: 850;
  letter-spacing: .15em;
}

#listScreen .lobby-connection-copy h2 { margin: 0; font-size: 14px; }
#listScreen .lobby-connection-copy span { color: #858094; font-size: 10px; }

#listScreen .lobby-protocols { display: flex; gap: 7px; }
#listScreen #lobbyPriceListPrice { text-decoration: line-through; opacity: .6; }
#listScreen #lobbyPriceDiscountBadge { color: #fff; background: var(--lobby-coral); border-color: var(--lobby-coral); }

#listScreen .lobby-protocols span {
  padding: 7px 9px;
  border: 1px solid #d9d3ed;
  border-radius: 9px;
  color: #4d4666;
  background: rgba(255,255,255,.72);
  font-size: 9px;
  font-weight: 850;
}

#listScreen .lobby-connection-button {
  height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: 11px;
  color: #fff;
  background: var(--lobby-violet);
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}

#listScreen #mapList {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 15px;
  max-height: none;
  overflow: visible;
}

#listScreen #mapList .map-item {
  min-width: 0;
  min-height: 92px;
  padding: 18px;
  border: 1px solid #ebe8f2;
  border-radius: 16px;
  background: #fff;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

#listScreen #mapList .map-item:hover {
  transform: translateY(-3px);
  border-color: #c9bfff;
  background: #fff;
  box-shadow: 0 13px 26px rgba(46,36,88,.1);
}

#listScreen #mapList .map-item-title { font-weight: 750; }
#listScreen #mapList .map-list-empty { grid-column: 1 / -1; padding: 28px; }

#listScreen #createRow { margin-top: 15px; }

#listScreen #showCreateBtn {
  width: 100%;
  min-height: 52px;
  border: 1px dashed #cfc8e5;
  color: #5f5873;
  background: #fff;
}

#listScreen #showCreateBtn:hover { color: var(--lobby-violet); background: #faf8ff; }

#listScreen .lobby-footer-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 20px;
  color: #938ea2;
  font-size: 10px;
}

#listScreen #glossaryRow,
#listScreen #legalFooter,
#listScreen #supportFooter { margin: 0; }

#listScreen #glossaryBtn { color: var(--lobby-violet); font-size: 10px; }
#listScreen #legalFooter, #listScreen #supportFooter { font-size: 10px; }

/* 마스코트 상하 이동 */
@keyframes lobbyFloat {
  0%, 100% { transform: translateY(-5px) rotate(-.45deg); }
  50% { transform: translateY(7px) rotate(.45deg); }
}

@keyframes lobbyStarsDrift {
  to { transform: translate(40px, 24px); }
}

/* 태블릿 화면 */
@media (max-width: 900px) {
  #listScreen .lobby-hero { grid-template-columns: 1fr .85fr; }
  #listScreen .lobby-hero-copy { padding-left: 0; }
  /* 태블릿·모바일에서는 데스크톱 위치보다 마스코트를 오른쪽으로 15px 이동 */
  #listScreen .lobby-mascot-position { left: -5px; }
  #listScreen .lobby-protocols { display: none; }
  #listScreen #mapList { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #listScreen #loginButtons #magicLinkEmailInput { display: none; }
}

/* 모바일 화면 */
@media (max-width: 680px) {
  #listScreen #loginHeader,
  #listScreen .lobby-hero,
  #listScreen .list-card { width: min(calc(100% - 28px), 540px); }
  #listScreen #loginHeader { height: 70px; }
  #listScreen .lobby-brand small,
  #listScreen #connectedAppsBarLobby,
  #listScreen #loginUserName { display: none; }
  #listScreen #loginHeader button { padding: 0 10px; font-size: 10px; }
  #listScreen .lobby-hero {
    min-height: auto;
    grid-template-columns: 1fr;
    margin-top: 5px;
    text-align: center;
  }
  #listScreen .lobby-hero-copy { padding: 32px 0 4px; }
  #listScreen .lobby-eyebrow,
  #listScreen .lobby-hero-actions { justify-content: center; }
  #listScreen .lobby-hero h1 { font-size: 42px; text-align: center; }
  #listScreen .lobby-description { font-size: 13px; }
  #listScreen .lobby-mascot-stage { height: 350px; }
  #listScreen .lobby-mascot-position { width: 235px; height: 340px; }
  #listScreen .lobby-mascot-size { top: -85px; left: -59px; width: 353px; height: 510px; }
  #listScreen .list-card { margin-top: -4px; padding: 27px 18px 25px; border-radius: 24px 24px 0 0; }
  #listScreen .lobby-connection-hub { grid-template-columns: 1fr; }
  #listScreen .lobby-connection-button { width: 100%; }
  #listScreen #mapList { grid-template-columns: 1fr; }
  #listScreen .lobby-footer-row { flex-wrap: wrap; }
}

/* 동작 줄이기 설정 */
@media (prefers-reduced-motion: reduce) {
  #listScreen *, #listScreen *::before, #listScreen *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* API 키 · AI 연결 팝업 */
/* 왼쪽 로봇 카드, 오른쪽 API 설정 */
#apiKeyPanelBackdrop {
  background: rgba(7,5,24,.76);
  backdrop-filter: blur(10px);
}

#apiKeyPanelBox {
  width: 760px;
  min-height: 470px;
  padding: 30px 30px 30px 285px;
  border: 1px solid #e5e0f5;
  border-radius: 24px;
  color: #29243f;
  background:
    radial-gradient(circle at 95% 10%, rgba(146,119,255,.12), transparent 33%),
    #fffdf8;
  box-shadow: 0 30px 90px rgba(7,5,24,.42);
}

#apiKeyPanelBox h2 {
  margin-bottom: 8px;
  color: #211b47;
  font-size: 22px;
  letter-spacing: -.04em;
}

#apiKeyPanelHelp {
  margin-bottom: 18px;
  color: #77718c;
  font-size: 12px;
}

#apiKeyStatus {
  padding: 11px 13px;
  border: 1px solid #e3def2;
  border-radius: 11px;
  color: #4e4765;
  background: #f8f6fd;
}

#apiKeyValue {
  border: 1px solid #e2deec;
  background: #f8f7fb;
}

#apiKeyGenerateBtn {
  background: #765cf6;
}

#apiKeyGenerateBtn:hover { background: #644ce0; }

#apiKeyPanelBox .connect-guide {
  margin-top: 20px;
  border-top-color: #e4dfef;
}

#apiKeyPanelBox .connect-guide-toggle { color: #684fe3; }

/* 정비공 로봇 카드 */
#apiKeyMascot {
  position: absolute;
  top: 20px;
  left: 20px;
  bottom: 20px;
  width: 235px;
  padding: 16px 16px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 19px;
  overflow: hidden;
  text-align: center;
  color: #fff;
  background:
    radial-gradient(circle at 50% 35%, rgba(125,98,244,.3), transparent 45%),
    linear-gradient(155deg, #211a50, #100d2a);
}

#apiKeyMascot::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .35;
  pointer-events: none;
  background-image: radial-gradient(circle, #fff 0 1px, transparent 1.5px);
  background-size: 43px 43px;
}

#apiKeyMascot > * { position: relative; z-index: 1; }

#apiKeyMascot img {
  width: 190px;
  height: 230px;
  margin: -14px 0 -15px;
  object-fit: contain;
  filter: drop-shadow(0 16px 24px rgba(0,0,0,.28));
}

#apiKeyMascot h3 {
  margin: 4px 0;
  font-size: 16px;
  letter-spacing: -.03em;
}

#apiKeyMascot p {
  margin: 0;
  color: #aba4d1;
  font-size: 10px;
  line-height: 1.5;
}

.api-mascot-label {
  color: #a99cff;
  font-size: 7px;
  font-weight: 850;
  letter-spacing: .16em;
}

.api-mascot-badges {
  display: flex;
  gap: 5px;
  margin-top: 10px;
}

.api-mascot-badges span {
  padding: 4px 6px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 6px;
  color: #d9d4f4;
  background: rgba(255,255,255,.06);
  font-size: 7px;
  font-weight: 800;
}

/* 모바일 API 팝업 */
@media (max-width: 680px) {
  #apiKeyPanelBox {
    width: min(94vw, 430px);
    padding: 22px;
  }

  #apiKeyMascot {
    position: relative;
    inset: auto;
    width: 100%;
    height: 150px;
    margin-bottom: 20px;
    display: grid;
    grid-template-columns: 120px 1fr;
    grid-template-rows: auto auto auto;
    column-gap: 6px;
    text-align: left;
  }

  #apiKeyMascot img {
    width: 120px;
    height: 140px;
    margin: 0;
    grid-row: 1 / 4;
  }

  #apiKeyMascot h3,
  #apiKeyMascot p,
  #apiKeyMascot .api-mascot-label,
  #apiKeyMascot .api-mascot-badges { justify-self: start; }
}
