/* 꼬리말 v3 (2026-11-05, 뮤직 꼬리말 기준) — 풀다운 5개 + 한 줄 아래칸 + 눌러서 여는 말풍선.
 * 밝은(paper) 톤은 배경을 따로 칠하지 않고 페이지 종이색을 그대로 쓴다. 단추는 배경·테두리 없는 글자, 누르는 곳 48px. */
.xlf {
  --xlf-bg: #0a0a0f;
  --xlf-ink: rgba(255, 255, 255, 0.92);
  --xlf-muted: rgba(255, 255, 255, 0.66);
  --xlf-line: rgba(255, 255, 255, 0.1);
  --xlf-btn: rgba(255, 255, 255, 0.06);
  --xlf-btn-hover: rgba(255, 255, 255, 0.11);
  --xlf-pop: #16161f;
  --xlf-pop-line: rgba(255, 255, 255, 0.14);
  --xlf-accent: #8fb4ff;
  --xlf-note: #f3d48b;
  --xlf-shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
  position: relative;
  background: var(--xlf-bg);
  border-top: 1px solid var(--xlf-line);
  color: var(--xlf-ink);
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.xlf[data-tone="paper"] {
  --xlf-bg: transparent;
  --xlf-ink: #1d1b18;
  --xlf-muted: #4f483e;
  --xlf-line: rgba(29, 27, 24, 0.14);
  --xlf-btn: #fffdf8;
  --xlf-btn-hover: #ffffff;
  --xlf-pop: #ffffff;
  --xlf-pop-line: rgba(29, 27, 24, 0.14);
  --xlf-accent: #24508c;
  --xlf-note: #7a5a22;
  --xlf-shadow: 0 18px 44px rgba(52, 40, 20, 0.18);
}

/* 밝은 화면에서는 꼬리말에 배경색을 칠하지 않는다(머리말과 같은 종이 위). 다른 파일이 --xlf-bg를 덮어써도 여기서 막는다. */
.xlf[data-tone="paper"],
.xlf[data-auto-tone],
html[data-lab-theme="light"] .xlf {
  background: transparent;
}

/* 다른 앱(rem 기준이 15px인 DevHub 등)에서도 줄 높이·글자 크기가 같게 */
.xlf {
  font-size: 16px;
  line-height: 1.5;
  text-align: left;
}

.xlf-mail {
  display: inline-flex;
}

.xlf a,
.xlf button {
  color: inherit;
  font: inherit;
}

.xlf :focus-visible {
  outline: 3px solid var(--xlf-accent);
  outline-offset: 2px;
  border-radius: 10px;
}

.xlf-wrap {
  max-width: 72rem;
  margin: 0 auto;
  padding: 16px 16px 8px;
}

.xlf-top {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.xlf-logo {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  gap: 0.6rem;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.xlf-logo img {
  border-radius: 8px;
}

.xlf-tagline {
  margin: 0.25rem 0 0;
  color: var(--xlf-muted);
  font-size: 16px;
  line-height: 1.6;
}

/* ── 풀다운 ─────────────────────────────── */
.xlf-menus {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.xlf-menu {
  position: relative;
}

.xlf-menu-btn,
.xlf-bubble-btn {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  border: 1px solid var(--xlf-line);
  background: var(--xlf-btn);
  border-radius: 14px;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

/* 풀다운 단추: 헤더 글자 메뉴처럼 배경·테두리 없이, 누르는 곳만 48px */
.xlf-menu-btn {
  width: 100%;
  min-height: 48px;
  padding: 0 0.25rem;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font-size: 16px;
  font-weight: 700;
}

.xlf-menu-btn:hover,
.xlf-menu[data-open] > .xlf-menu-btn {
  background: transparent;
  color: var(--xlf-accent);
}

.xlf-chev {
  flex: none;
  color: var(--xlf-muted);
  transition: transform 0.25s ease;
}

[data-open] > button > .xlf-chev {
  transform: rotate(180deg);
}

.xlf-menu-panel:not([hidden]) {
  display: flex;
  flex-direction: column;
  padding: 0.35rem 0.35rem 0.5rem;
}

.xlf-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 48px;
  padding: 0 0.85rem;
  border-radius: 10px;
  font-size: 16px;
  text-decoration: none;
}

a.xlf-link:hover {
  background: var(--xlf-btn-hover);
  color: var(--xlf-accent);
}

.xlf-link-off {
  justify-content: space-between;
  color: var(--xlf-muted);
  cursor: not-allowed;
}

.xlf-chip {
  flex: none;
  white-space: nowrap;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--xlf-line);
  color: var(--xlf-muted);
  white-space: nowrap;
}

/* ── 아래칸: 한 줄 ─────────────────────────── */
.xlf-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1.1rem;
  margin-top: 12px;
  padding-top: 4px;
  border-top: 1px solid var(--xlf-line);
  color: var(--xlf-muted);
  font-size: 16px;
}

.xlf-bottom > a,
.xlf-bottom > .xlf-mail > a {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  text-decoration: none;
}

.xlf-bottom > a:hover,
.xlf-bottom > .xlf-mail > a:hover {
  color: var(--xlf-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.xlf-bottom > .xlf-strong {
  color: var(--xlf-ink);
  font-weight: 800;
}

.xlf-bubble-wrap {
  position: relative;
  display: inline-flex;
}

/* 사업자 정보·인증 안내: 배경·테두리 없이 아래칸 글자 링크처럼 (누르는 곳은 48px) */
.xlf-bubble-btn {
  min-height: 48px;
  padding: 0;
  gap: 0.3rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 16px;
  color: var(--xlf-muted);
}

.xlf-bubble-btn:hover,
.xlf-bubble-wrap[data-open] > .xlf-bubble-btn {
  background: transparent;
  color: var(--xlf-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* 말풍선: 휴대폰은 아래에서 올라오는 판, 넓은 화면은 단추 위 말풍선 */
.xlf-bubble:not([hidden]) {
  position: fixed;
  inset-inline: 12px;
  bottom: 12px;
  z-index: 60;
  display: block;
  max-height: 72vh;
  overflow: auto;
  padding: 1rem 1.15rem 1.15rem;
  border-radius: 18px;
  border: 1px solid var(--xlf-pop-line);
  background: var(--xlf-pop);
  color: var(--xlf-ink);
  box-shadow: var(--xlf-shadow);
  font-size: 16px;
  line-height: 1.7;
  animation: xlf-rise 0.22s ease-out;
}

.xlf-bubble p {
  margin: 0 0 0.6rem;
}

.xlf-bubble-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  font-size: 1.05rem;
}

.xlf-bubble-close {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-inline-end: -0.5rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
}

.xlf-bubble-close:hover {
  background: var(--xlf-btn-hover);
}

.xlf-note {
  color: var(--xlf-note);
}

.xlf-bubble-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin: 0.25rem 0 0 !important;
}

.xlf-bubble-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--xlf-accent);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

@keyframes xlf-rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (min-width: 768px) {
  .xlf-wrap {
    padding: 16px 32px 8px;
  }

  .xlf-top {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
  }

  .xlf-menus {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0 1.5rem;
  }

  .xlf-menu-btn {
    width: auto;
    justify-content: flex-start;
  }

  /* 넓은 화면: 단추 위로 펼쳐지는 메뉴 (꼬리말은 화면 맨 아래라 위로 연다) */
  .xlf-menu-panel:not([hidden]) {
    position: absolute;
    bottom: calc(100% + 10px);
    inset-inline-end: 0;
    z-index: 60;
    min-width: 15rem;
    width: max-content;
    max-width: min(24rem, calc(100vw - 32px));
    padding: 0.4rem;
    border-radius: 16px;
    border: 1px solid var(--xlf-pop-line);
    background: var(--xlf-pop);
    box-shadow: var(--xlf-shadow);
    animation: xlf-rise 0.2s ease-out;
  }

  .xlf-bubble:not([hidden]) {
    position: absolute;
    inset-inline: auto;
    inset-inline-start: 0;
    bottom: calc(100% + 12px);
    width: min(30rem, calc(100vw - 32px));
    max-height: min(70vh, 32rem);
    translate: var(--xlf-shift, 0px) 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .xlf-menu-panel:not([hidden]),
  .xlf-bubble:not([hidden]) {
    animation: none;
  }

  .xlf-chev {
    transition: none;
  }
}

/* 폰 홈의 어두운 라이브 데모 섬(#mobile-landing-tail) 안에서는 밝은 테마여도 어두운 꼬리말 색을 지킨다
   (lab-paper.css의 `html[data-lab-theme=light] #main-content .xlf` 종이 색보다 강하게). */
#mobile-landing-tail#mobile-landing-tail .xlf {
  --xlf-ink: rgba(255, 255, 255, 0.92);
  --xlf-muted: rgba(255, 255, 255, 0.66);
  --xlf-line: rgba(255, 255, 255, 0.1);
  --xlf-btn: rgba(255, 255, 255, 0.06);
  --xlf-btn-hover: rgba(255, 255, 255, 0.11);
  --xlf-pop: #16161f;
  --xlf-pop-line: rgba(255, 255, 255, 0.14);
  --xlf-accent: #8fb4ff;
  --xlf-note: #f3d48b;
  --xlf-shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
  background: transparent;
}
