/* 판서 → 문장만들기 (2026-11-12) — notes-sentence.js 짝. PPT 「어휘별 삽화 모음」 장(.yj-illu-gallery)과 같은 꼴.
   판서 창 바탕(어두운 판 · 화이트모드)이 무엇이든 칸은 미색 카드, 말풍선은 유자 100 + 600 테두리 + 먹 글자. */

/* 단추 — 판서 창 위쪽 왼쪽(진도 옆). 누를 것 = 부드러운 유자 */
.yj-ns-btn {
    display: inline-flex; align-items: center; gap: .35em; flex-shrink: 0;
    min-height: 40px; margin-left: 8px; padding: 0 14px; border: 0; border-radius: var(--yj-r-sm, 8px);
    background: var(--yj-yuja-300, #F9D75E); color: var(--yj-ink-deep, #16181A);
    font: inherit; font-size: 15px; font-weight: 700; white-space: nowrap; cursor: pointer;
    transition: background-color var(--yj-dur-fast, 120ms);
}
.yj-ns-btn:hover { background: var(--yj-yuja-500, #F5C800); }
.yj-ns-btn[aria-pressed="true"] { background: var(--yj-yuja-200, #FCEAAA); box-shadow: inset 0 0 0 2px var(--yj-yuja-600, #DDB400); }
.yj-ns-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.yj-ns-hide { display: none !important; }

/* 화면 */
.yj-ns { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: clamp(10px, 1.4vw, 24px); text-align: left; line-height: 1.4; }
.yj-ns[hidden] { display: none; }
.yj-ns__title { margin: 0; font-size: clamp(22px, 2.4vw, 44px); font-weight: 800; color: inherit; letter-spacing: -.01em; word-break: keep-all; }
.yj-ns__sub { font-weight: 600; opacity: .85; }
.yj-ns__grid { flex: 1; min-height: 0; display: grid; gap: clamp(10px, 1.3vw, 24px);
    grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); }
.yj-ns__grid[data-n="1"] { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); width: min(100%, 900px); margin: 0 auto; }
.yj-ns__grid[data-n="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: minmax(0, 1fr); }
.yj-ns__grid[data-n="3"] { grid-template-rows: minmax(0, 1fr); }
.yj-ns__grid[data-n="4"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.yj-ns__grid[data-n="5"] { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.yj-ns__grid[data-n="5"] .yj-ns__cell { grid-column: span 2; }
.yj-ns__grid[data-n="5"] .yj-ns__cell:nth-child(4) { grid-column: 2 / span 2; }

.yj-ns__cell {
    position: relative; margin: 0; min-height: 0; box-sizing: border-box; display: flex; flex-direction: column; align-items: center;
    background: var(--yj-card, #FFFDF7); border-radius: var(--yj-r-lg, 12px); box-shadow: var(--yj-sh-1, 0 1px 2px rgba(31, 28, 18, .05));
    padding: clamp(8px, .9vw, 16px); color: var(--yj-ink-deep, #16181A);
}
.yj-ns__no {
    position: absolute; top: clamp(8px, .8vw, 14px); left: clamp(8px, .8vw, 14px); z-index: 1;
    min-width: 1.8em; height: 1.8em; display: grid; place-items: center; border-radius: var(--yj-r-full, 9999px);
    background: var(--yj-card, #FFFDF7); color: var(--yj-ink-deep, #16181A); font-weight: 800; font-size: clamp(14px, 1.1vw, 22px);
    box-shadow: var(--yj-sh-1, 0 1px 2px rgba(31, 28, 18, .05));
}
.yj-ns__fig { flex: 1; min-height: 0; width: 100%; position: relative; }
.yj-ns__fig img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; border-radius: var(--yj-r-sm, 8px); }
/* 말풍선 — 학습어휘 낱말만, 크게 */
.yj-ns__bub {
    position: relative; margin: clamp(10px, 1vw, 16px) 0 0; padding: .3em 1em;
    background: var(--yj-yuja-100, #FDF1C8); border: 1px solid var(--yj-yuja-600, #DDB400); border-radius: var(--yj-r-lg, 12px);
    color: var(--yj-ink-deep, #16181A); font-size: clamp(24px, 2.4vw, 46px); font-weight: 800; line-height: 1.3; text-align: center;
    word-break: keep-all;
}
.yj-ns__bub::before {
    content: ""; position: absolute; top: -8px; left: 50%; margin-left: -7px; width: 14px; height: 14px; background: inherit;
    border-left: 1px solid var(--yj-yuja-600, #DDB400); border-top: 1px solid var(--yj-yuja-600, #DDB400); transform: rotate(45deg);
}
/* 그림이 없는 표제(아직 공개 안 한 권) — 낱말 카드만 가운데에 크게 */
.yj-ns__cell.is-noimg { justify-content: center; }
.yj-ns__cell.is-noimg .yj-ns__fig { display: none; }
.yj-ns__cell.is-noimg .yj-ns__bub { margin: 0; font-size: clamp(30px, 3.4vw, 64px); }
.yj-ns__cell.is-noimg .yj-ns__bub::before { display: none; }

/* 4칸(2×2) — 그림 왼쪽 · 말풍선 오른쪽 */
.yj-ns__grid[data-n="4"] .yj-ns__cell:not(.is-noimg) { flex-direction: row; gap: clamp(12px, 1.4vw, 24px); }
.yj-ns__grid[data-n="4"] .yj-ns__cell:not(.is-noimg) .yj-ns__fig { height: 100%; flex: 1.2; }
.yj-ns__grid[data-n="4"] .yj-ns__cell:not(.is-noimg) .yj-ns__bub { flex: 1; margin: 0; }
.yj-ns__grid[data-n="4"] .yj-ns__cell:not(.is-noimg) .yj-ns__bub::before { top: 50%; left: -8px; margin: -7px 0 0; transform: rotate(-45deg); }

@media (max-width: 767px) {
    .yj-ns { overflow-y: auto; }
    .yj-ns > * { flex-shrink: 0; }
    .yj-ns__grid, .yj-ns__grid[data-n] { flex: none; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: none; grid-auto-rows: auto; width: 100%; }
    .yj-ns__grid[data-n] .yj-ns__cell { grid-column: auto; flex-direction: column; }
    .yj-ns__fig { flex: none; aspect-ratio: 720 / 639; }
    .yj-ns__grid[data-n="4"] .yj-ns__cell:not(.is-noimg) .yj-ns__fig { height: auto; flex: none; }
    .yj-ns__bub { font-size: 20px; }
}

/* 화이트모드 판서(흰 판) — 미색 칸이 바탕에 묻히지 않게 가는 선을 두른다 */
#notes-popup-overlay[data-theme="light"] .yj-ns__cell { box-shadow: 0 0 0 1px var(--yj-line, #E8E2D3), var(--yj-sh-1, 0 1px 2px rgba(31, 28, 18, .05)); }
