/**
 * 🧩 블록 템플릿 「가져오기」 카드 — 무료 에디터 위에 뜨는 얹는 층. (2026-08-22)
 *
 * ⛔ 에디터 본체 클래스(`.b-el`·`.rq-tab`·`.tb-btn`…)를 건드리지 않는다 — 전부 `btp-` 접두.
 * ⛔ 캔버스를 가리지 않도록 오른쪽 아래에 띄운다(넣을 자리를 보면서 결정하게).
 */

.btp-card {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 2200000;               /* 미리보기·내보내기 모달(2100000)보다 위 */
    width: 340px;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 40px);
    overflow: auto;
    background: #16181d;
    color: #e8eaed;
    border: 1px solid #343841;
    border-radius: 12px;
    box-shadow: 0 18px 48px rgba(0, 0, 0, .5);
    font-family: "Pretendard Variable", Pretendard, "Noto Sans KR", system-ui, sans-serif;
    animation: btp-in .18s ease-out;
}

@keyframes btp-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: none; }
}

.btp-x {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 8px;
    background: rgba(0, 0, 0, .55);
    color: #fff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}
.btp-x:hover { background: rgba(0, 0, 0, .78); }

.btp-shot {
    background: #0f1114;
    border-radius: 12px 12px 0 0;
    overflow: hidden;
}
/* 🖼 2026-08-25 — 종전엔 감싼 상자에 `max-height:190px` 를 걸어 **아래를 잘라** 냈다.
   여기는 «살지 말지 정하는» 화면이라 통째로 보여야 한다(원본 확대는 「🖥 크게 보기」가 맡는다). */
.btp-shot img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 340px;
    object-fit: contain;
}

.btp-body { padding: 14px 16px 16px; }

/* ← 목록으로 (2026-08-25) — 여러 개를 견줘 보려면 돌아갈 길이 있어야 한다. */
.btp-back {
    background: #10131a; border: 1px solid #4a515c; border-radius: 7px;
    color: #cfd4dc; font: inherit; font-size: 12.5px; padding: 5px 11px;
    cursor: pointer; margin-bottom: 10px;
}
.btp-back:hover { background: #23272f; color: #fff; }

/* 🖥 크게 보기 · 📄 자세히 보기 — 넣기 «전»에 진짜 모습을 볼 두 갈래. */
.btp-links { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 12px; }
.btp-link {
    display: inline-flex; align-items: center;
    background: #10131a; border: 1px solid #4a515c; border-radius: 7px;
    color: #93c5fd; font-size: 12.5px; padding: 6px 12px; text-decoration: none;
}
.btp-link:hover { background: #23272f; color: #bfdbfe; }

.btp-group {
    margin: 0 0 4px;
    font-size: 11.5px;
    color: #8b93a1;
    letter-spacing: .01em;
}

.btp-name {
    margin: 0 0 6px;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.35;
    color: #fff;
}

.btp-desc {
    margin: 0 0 12px;
    font-size: 12.5px;
    line-height: 1.6;
    color: #aab1bd;
    word-break: keep-all;
    overflow-wrap: normal;
}

.btp-price {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin: 0 0 12px;
    padding: 10px 12px;
    background: #1e2128;
    border-radius: 8px;
}
.btp-price > b { font-size: 18px; font-weight: 800; color: #7dd3a0; }
.btp-price > b.btp-free { font-size: 13.5px; }
.btp-price > span { font-size: 11.5px; color: #8b93a1; }

.btp-msg {
    margin: 0 0 10px;
    padding: 9px 11px;
    border-radius: 7px;
    font-size: 12px;
    line-height: 1.55;
    word-break: keep-all;
    overflow-wrap: normal;
}
.btp-msg.is-warn  { background: #2e2312; color: #fbbf24; }
.btp-msg.is-error { background: #2e1616; color: #fca5a5; }

.btp-go {
    display: block;
    width: 100%;
    min-height: 46px;
    padding: 12px 14px;
    border: 0;
    border-radius: 9px;
    background: #2563eb;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}
.btp-go:hover:not(:disabled) { background: #1d4ed8; }
.btp-go:disabled { background: #3a3f4a; color: #8b93a1; cursor: not-allowed; }

.btp-note {
    margin: 10px 0 0;
    font-size: 11.5px;
    line-height: 1.6;
    color: #767d8a;
    word-break: keep-all;
    overflow-wrap: normal;
}

/* 좁은 화면 — 아래쪽 전폭 시트로. 캔버스를 최대한 남긴다. */
@media (max-width: 640px) {
    .btp-card {
        right: 8px;
        left: 8px;
        bottom: 8px;
        width: auto;
        max-height: 72vh;
    }
    .btp-shot { max-height: 130px; }
}

/* ══════════ 디자인 갤러리 (2026-08-22 · 우선순위 3번) ══════════
   ⛔ 왼쪽 좁은 패널이 아니라 전체 화면 — 301장을 «이미지로 고르려면» 크게 보여야 한다. */

.fe-cta-tpl { background: #0f766e; color: #fff; border-color: #0f766e; }
.fe-cta-tpl:hover { background: #0d5f59; }

.btg {
    position: fixed;
    inset: 0;
    z-index: 2380000;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .7);
    font-family: "Pretendard Variable", Pretendard, "Noto Sans KR", system-ui, sans-serif;
}
.btg.is-on { display: flex; }

/* 🖥 **전체 풀 사이즈** (사장님 지시 2026-08-25) — 종전 1180×820 가운데 상자였다.
      297장을 고르는 화면이라 창을 가득 채워야 한 번에 더 많이 보인다.
      코드빌더 「사이트템플릿 가져오기」(`#oe-skin`)와 같은 배치.
   ⛔ 바깥 여백이 사라져 «바깥 클릭으로 닫기»가 성립하지 않는다 → JS 에 Esc 를 함께 넣었다. */
.btg-panel {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #16181d;
    border: 0;
    border-radius: 0;
    overflow: hidden;
}

.btg-head {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 13px 16px;
    border-bottom: 1px solid #2a2f38;
    color: #e8eaed;
}
.btg-head > b { font-size: 15px; }
.btg-q {
    height: 32px;
    padding: 0 10px;
    border: 1px solid #4a515c;
    border-radius: 7px;
    background: #10131a;
    color: #e8eaed;
    font-size: 12.5px;
}
.btg-q { flex: 1 1 200px; min-width: 140px; }
.btg-count { font-size: 12px; color: #8b93a1; white-space: nowrap; }
.btg-x {
    /* ⛔ 고정 폭을 주지 않는다 — 2026-08-25 에 「✕」 한 글자에서 「✕ 닫기」로 바뀌었다. */
    height: 32px; padding: 0 13px;
    border: 0; border-radius: 7px;
    background: #2a2f38; color: #cfd4dc;
    font-size: 13px; line-height: 1; cursor: pointer; white-space: nowrap;
}
.btg-x:hover { background: #3a4049; }

/* 🏷 대분류 칩 (2026-08-25) — 세부 54개 드롭다운을 대신한다.
   코드빌더 `#oe-skin-groups` 와 같은 모양: 알약형, 선택된 것만 파랑 반전. */
.btg-chips {
    flex: 0 0 auto;
    display: flex; gap: 6px; flex-wrap: wrap;
    padding: 10px 16px;
    border-bottom: 1px solid #2a2f38;
    background: #14161b;
}
.btg-chips button {
    background: #10131a; border: 1px solid #4a515c; border-radius: 999px;
    color: #a9b1bd; font: inherit; font-size: 12.5px; padding: 5px 13px;
    cursor: pointer; white-space: nowrap;
}
.btg-chips button:hover { color: #e8eaed; border-color: #6b7280; }
.btg-chips button.on { background: #2563eb; border-color: #2563eb; color: #fff; font-weight: 700; }
.btg-chips button i { font-style: normal; opacity: .7; font-size: 11.5px; margin-left: 2px; }
.btg-chips button.on i { opacity: .85; }

.btg-grid {
    flex: 1;
    overflow-y: auto;
    display: grid;
    /* 풀 사이즈가 됐으니 카드도 키운다 — 220px 로는 블록 안 글자가 안 읽힌다. */
    grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
    gap: 14px;
    padding: 16px 18px;
    /* ⛔ minmax(0,1fr) 계열 — 자식 min-width:auto 로 트랙이 부푸는 것을 막는다 */
    align-content: start;
}
.btg-grid > * { min-width: 0; }

.btg-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0 0 9px;
    /* 🔴 2026-08-25 — 종전 `#2a2f38` 은 패널 배경과 **대비비 1.32**(사실상 안 보임)라
       카드 297장이 «한 덩어리 벽»으로 읽혔다(사장님 「다 찌그러져 있네요」).
       ⛔ 어두운 화면에서는 «배경색 차이»로 못 가른다 — 카드/패널 배경 대비가 1.06 이 한계다
          (어두운 쪽은 공식의 +0.05 항 때문에 아무리 벌려도 1.1 을 못 넘는다).
       ⇒ 가르는 일은 **테두리**가 한다. `#6b7280` = 패널 배경 대비 **3.67**(비문자 요소 기준 3.0 통과). */
    border: 1px solid #6b7280;
    border-radius: 10px;
    background: #1b1e25;
    color: #cfd4dc;
    text-align: start;
    cursor: pointer;
    /* 🔴🔴 2026-08-25 — **여기에 `overflow:hidden` 을 두면 안 된다.**
       카드가 `<button>` 이라 `overflow:hidden` 이 붙는 순간 «스크롤 상자»가 되고,
       그리드가 행 높이를 잴 때 **안쪽 그림(190px)을 세지 않는다**.
       실측: 행 트랙 65px · 카드 scrollHeight 238px ⇒ 그림 윗부분 65px 만 보이고 잘렸다
       (사장님이 보내신 «다 찌그러져 있네요» 화면의 진짜 원인).
       브라우저 실험으로 확정 — 이 한 줄을 `visible` 로 바꾸는 순간 행이 65 → **274px**.
       ⛔ `display:block` 으로 바꾸는 것으로는 안 고쳐진다(실험 C: 그대로 65px).
       ⇒ 모서리 다듬기는 아래 `.btg-shot` 이 맡는다. */
    overflow: visible;
}
.btg-card:hover { border-color: #2563eb; background: #1f2430; }

.btg-shot {
    display: block; background: #0f1114; line-height: 0;
    /* 카드에서 넘겨받은 모서리 다듬기 — ⛔카드 쪽에 두면 행 계산이 깨진다(위 주석). */
    overflow: hidden;
    border-radius: 9px 9px 0 0;
    /* 그림과 «이름·값» 사이를 한 줄 그어 준다 — 카드 한 장이 두 부분으로 읽히게. */
    border-bottom: 1px solid #2a2f38;
}

/* 🖼 **썸네일은 자르지 않는다** (사장님 지적 2026-08-25 「다 찌그러져 있네요」).
   종전: 전부 `height:124px` + `object-fit:cover` 한 칸에 강제 ⇒ 실측 비율이 1.60(섹션)~13.71(구분선)
        이라 섹션은 위아래 28%가, 헤더는 좌우 45%가 잘려 «무슨 블록인지 알 수 없었다».
   지금: `aspect-ratio` 를 **카드마다 인라인**으로 받는다(JS 가 서버의 w/h 로 만든다).
   ⛔ `contain` 인 이유 = 아래 min/max 로 «극단 비율만» 눌릴 때 잘리지 않고 여백으로 처리되게.
      비율이 맞는 보통 경우엔 여백이 생기지 않는다. */
.btg-shot img {
    width: 100%;
    /* 🔴🔴 2026-08-25 2차 — **높이는 «구체적 px»여야 한다.**
       1차에서 `aspect-ratio` + `width:100%` 로 카드마다 제 비율을 줬더니, 그리드가 «행 높이»를
       계산할 때 이 이미지의 높이를 **`min-height`(58px)로만** 셌다(퍼센트 폭이라 높이가
       미확정이기 때문). ⇒ 행 트랙이 **64.85px** 인데 카드는 150~256px = **카드끼리 겹쳤다**.
       사장님이 보신 「다 찌그러져 있네요」의 정체가 이 겹침이다(실측으로 확정).
       ⇒ 높이를 고정하고, **자르지 않는 일은 `contain` 이 맡는다**(둘은 별개의 문제였다). */
    height: 190px;
    object-fit: contain;            /* ⛔ `cover` 로 되돌리면 다시 잘린다 */
    object-position: center;
    display: block;
    background: #0f1114;
}

.btg-name {
    padding: 6px 10px 0;
    font-size: 12.5px;
    font-weight: 700;
    color: #e8eaed;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.btg-group-l {
    padding: 0 10px;
    font-size: 11px;
    color: #8b93a1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.btg-price { padding: 2px 10px 0; font-size: 12px; font-weight: 800; color: #7dd3a0; }
.btg-owned { padding: 2px 10px 0; font-size: 11.5px; font-weight: 700; color: #93c5fd; }

/* 🧱 판매 준비 중(목록 0종) — 「없다」가 아니라 「만드는 중」으로 읽히게. */
.btg-soon {
    grid-column: 1 / -1;
    max-width: 560px;
    margin: 48px auto;
    padding: 28px 26px;
    border: 1px solid #5a6376;   /* 경계는 «테두리»가 만든다 — 어두운 화면에서 배경끼리는 대비가 1.1 을 못 넘는다(비문자 대비 3.48) */
    border-radius: 14px;
    background: #171a20;
    text-align: center;
    line-height: 1.7;
}
.btg-soon b { display: block; margin-bottom: 10px; font-size: 17px; color: #e8ecf3; }
.btg-soon p { margin: 0 0 10px; color: #aab2c0; font-size: 14px; word-break: keep-all; overflow-wrap: normal; }
.btg-soon .btg-soon-alt { margin: 14px 0 0; padding-top: 14px; border-top: 1px solid #2a2f38; color: #8f98a8; }
.btg-soon .btg-soon-alt b { display: inline; margin: 0; font-size: inherit; color: #cfd6e2; }

.btg-empty { grid-column: 1 / -1; padding: 40px 0; text-align: center; color: #8b93a1; font-size: 13px; }

/* 📃 더보기 (2026-08-25 사장님 지시 — 30개씩) — 격자 «안»의 전폭 칸.
   ⛔ 격자 밖에 두면 목록을 끝까지 내려도 안 보인다(스크롤 영역이 격자다). */
.btg-more { grid-column: 1 / -1; display: flex; justify-content: center; padding: 14px 0 6px; }
.btg-more button {
    background: #1b1e25; border: 1px solid #3a4049; border-radius: 999px;
    color: #e8eaed; font: inherit; font-size: 13.5px; padding: 11px 26px; cursor: pointer;
}
.btg-more button:hover { background: #232833; border-color: #2563eb; }
.btg-more button b { color: #93c5fd; }
.btg-more button span { color: #8b93a1; font-size: 12px; }

.btg-foot {
    margin: 0;
    padding: 11px 16px;
    border-top: 1px solid #2a2f38;
    color: #8b93a1;
    font-size: 12px;
    line-height: 1.6;
    word-break: keep-all;
    overflow-wrap: normal;
}
.btg-foot b { color: #cfd4dc; }

@media (max-width: 640px) {
    .btg-panel { width: 100%; height: 100%; }
    .btg-grid { grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 9px; padding: 10px; }
    .btg-shot img { height: 132px; }   /* 좁은 화면 — `contain` 이라 여전히 안 잘린다 */
}

/* 권리 한 줄 — 눈에 띄되 무겁지 않게 (2026-08-22) */
.btp-lic { display: inline-block; margin-top: 4px; color: #8b93a1; }
.btp-lic b { color: #cfd4dc; }

/* ── 💳 충전금 상태 바 (2026-08-28) ────────────────────────────────────────
   블록·문서 「고르기」 카드가 함께 쓴다(문서 카드는 `.btp-card.dtp-card`).
   문구·버튼은 공용 `ai-credit-v1.css` 몫 — 여기서는 카드 폭에 맞추기만 한다.
   ⛔ 문구를 CSS 로 바꾸려 하지 말 것(content 삽입 금지) — 번역·수정이 불가능해진다. */
.btp-card .btp-credit.aicr { margin: 10px 0 0; font-size: 13.5px; text-align: left; }
.btp-card .btp-credit .aicr__head { font-size: 14px; }
.btp-card .btp-credit .aicr__msg { flex: 1 1 100%; }
.btp-card .btp-credit .aicr__link,
.btp-card .btp-credit .aicr__link--quiet { width: 100%; text-align: center; min-height: 42px; line-height: 26px; }
