/* 칠판 갤러리 (js/modules/gallery/boardGallery.js, gallery.html)
   - 중립 그래파이트 바탕: 초록·검정·흰 칠판 그림이 모두 돋보이게. 그림이 주인공 — 카드는 상자 없이 그림 + 짧은 글
   - 강의 모드 body 의 color: transparent 를 받지 않도록 색은 직접 준다 */
.gal-overlay {
  --gal-bg: #17191c;
  --gal-panel: #1f2226;
  --gal-line: rgba(255, 255, 255, 0.08);
  --gal-line-2: rgba(255, 255, 255, 0.14);
  --gal-text: #eef0f2;
  --gal-sub: #9aa3ad;
  --gal-faint: #6c747d;
  --gal-accent: #ffcf70;
  --gal-radius: 14px;
  position: fixed;
  inset: 0;
  z-index: 12500;
  display: none;
  background: rgba(8, 9, 11, 0.74);
  color: var(--gal-text);
  font-family: "Noto Sans KR", "Noto Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.gal-overlay.is-open { display: flex; align-items: center; justify-content: center; }
.gal-overlay.is-page { position: static; display: block; background: var(--gal-bg); }
.gal-overlay *, .gal-overlay *::before, .gal-overlay *::after { box-sizing: border-box; }
.gal-overlay button { font: inherit; }
.gal-overlay :focus-visible { outline: 2px solid var(--gal-accent); outline-offset: 2px; }

.gal-shell {
  position: relative;
  width: min(1320px, calc(100vw - 48px));
  height: min(900px, calc(100vh - 48px));
  display: flex;
  flex-direction: column;
  background: var(--gal-bg);
  border: 1px solid var(--gal-line);
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}
.gal-overlay.is-page .gal-shell { width: 100vw; height: 100vh; height: 100dvh; border: 0; border-radius: 0; box-shadow: none; }

/* ── 머리 영역: 로고 · 제목 · 한 줄 소개 · 숫자 / 탭 · 칠판 색 · 정렬 ── */
.gal-head {
  position: relative;
  padding: 22px clamp(18px, 3vw, 40px) 14px;
  background:
    radial-gradient(ellipse 60% 140% at 0% 0%, rgba(40, 110, 66, 0.22), transparent 70%),
    var(--gal-panel);
  border-bottom: 1px solid var(--gal-line);
}
.gal-brand { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding-right: 48px; }
.gal-logo { display: inline-flex; flex: none; border-radius: 12px; }
.gal-logo img { width: 44px; height: 44px; object-fit: contain; display: block; }
.gal-brand-text { min-width: 0; }
.gal-title { margin: 0; font-size: clamp(22px, 2.2vw, 28px); font-weight: 800; letter-spacing: -0.02em; color: var(--gal-text); line-height: 1.15; }
.gal-tagline { margin: 3px 0 0; font-size: 14px; color: var(--gal-sub); }
.gal-stats { display: flex; gap: 26px; margin-left: auto; color: var(--gal-sub); }
.gal-stat { display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
.gal-stat b { color: var(--gal-text); font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; }
.gal-stat small { margin-top: 4px; font-size: 12px; color: var(--gal-sub); letter-spacing: 0.02em; }
.gal-stat + .gal-stat { padding-left: 26px; border-left: 1px solid var(--gal-line); }
.gal-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 16px; }
.gal-tabs { display: flex; gap: 2px; padding: 3px; border-radius: 999px; background: rgba(255, 255, 255, 0.06); }
.gal-tabs[hidden] { display: none; }
.gal-tab { border: 0; border-radius: 999px; padding: 6px 15px; background: transparent; color: var(--gal-sub); font-size: 14px; cursor: pointer; }
.gal-tab.is-on { background: #3a4048; color: #fff; font-weight: 600; }
.gal-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.gal-chip {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--gal-line-2); border-radius: 999px; padding: 5px 12px;
  background: transparent; color: var(--gal-sub); font-size: 13px; cursor: pointer;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.gal-chip:hover { color: var(--gal-text); }
.gal-chip.is-on { border-color: rgba(255, 207, 112, 0.65); color: #fff; background: rgba(255, 207, 112, 0.1); }
.gal-swatch { width: 11px; height: 11px; border-radius: 3px; border: 1px solid rgba(255, 255, 255, 0.35); flex: none; }
.is-green > .gal-swatch { background: #163A1B; }
.is-dark > .gal-swatch { background: #262626; }
.is-white > .gal-swatch { background: #F1F1F1; }
.gal-seg { display: flex; margin-left: auto; padding: 3px; border-radius: 10px; background: rgba(255, 255, 255, 0.06); }
.gal-seg-btn { border: 0; border-radius: 8px; padding: 6px 12px; background: transparent; color: var(--gal-sub); font-size: 13px; cursor: pointer; white-space: nowrap; }
.gal-seg-btn.is-on { background: #3a4048; color: #fff; }
.gal-upload.control-button { margin: 0; padding: 7px 14px; font-size: 14px; white-space: nowrap; }
.gal-close.close-btn { position: absolute; top: 18px; right: 18px; }
/* 새 탭으로 열리는 갤러리 페이지에는 닫기가 필요 없다 (탭을 닫으면 된다) */
.gal-overlay.is-page .gal-close { display: none !important; }
.gal-overlay.is-page .gal-brand { padding-right: 0; }

/* ── 목록 ── */
.gal-body {
  flex: 1; overflow-y: auto; padding: 30px clamp(18px, 3vw, 40px) 0; scrollbar-color: #3a4048 transparent;
  /* 칠판들이 걸린 벽: 은은한 회벽 결 + 위쪽 조명 */
  background:
    radial-gradient(ellipse 70% 40% at 50% 0%, rgba(255, 236, 200, 0.05), transparent 70%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.01) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.04) 0 1px, transparent 1px 4px),
    var(--gal-bg);
}
/* 새 그림 알림: 목록 위에 떠 있는 알약 (누르면 새로 불러오고 맨 위로) */
.gal-fresh {
  position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: 8px;
  margin: -10px auto 16px; padding: 8px 18px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--gal-accent); color: #2a1e05; font-size: 14px; font-weight: 700;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45); animation: gal-fresh-in 0.35s ease;
}
.gal-fresh[hidden] { display: none; }
@keyframes gal-fresh-in { from { opacity: 0; transform: translateY(-10px); } }
.gal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 30px 24px;
  align-items: start;
}
.gal-card {
  display: flex; flex-direction: column; gap: 10px; padding: 0; text-align: left;
  border: 0; background: transparent; color: var(--gal-text); cursor: pointer; min-width: 0;
}
/* 마우스를 올려도 그림은 움직이지 않는다 (움직이면 그림을 다시 그리며 가는 분필 선이 끊겨 보였다) — 테두리 빛만 */
.gal-thumb {
  position: relative; display: block; width: 100%; aspect-ratio: 16 / 10; overflow: hidden;
  border-radius: var(--gal-radius); background: #22262b;
  /* 둘레의 가는 실선 (어두운 배경에서 그림의 경계가 또렷하게) */
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2), 0 14px 30px rgba(0, 0, 0, 0.4);
  transition: box-shadow 0.18s ease;
}
.gal-thumb.is-green { background: #163A1B; }
.gal-thumb.is-dark { background: #262626; }
.gal-thumb.is-white { background: #F1F1F1; }
.gal-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 0.35s ease; }
.gal-thumb.is-loaded img { opacity: 1; }
/* 카드 그림: 가장자리가 은은하게 어두운 입체감 + 마우스를 올리면 위에서 비추는 조명 (그림은 움직이지 않는다) */
.gal-thumb::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06), inset 0 0 40px rgba(0, 0, 0, 0.32);
}
.gal-thumb.is-white { box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12), 0 14px 30px rgba(0, 0, 0, 0.4); }
.gal-thumb.is-white::after { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08), inset 0 0 36px rgba(0, 0, 0, 0.12); }
.gal-thumb::before {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; opacity: 0; border-radius: inherit;
  background: radial-gradient(ellipse 75% 65% at 50% 0%, rgba(255, 240, 210, 0.2), transparent 72%);
  transition: opacity 0.25s ease;
}
.gal-card.is-skeleton .gal-thumb::after, .gal-card.is-skeleton .gal-thumb::before { display: none; }
.gal-card:hover .gal-thumb, .gal-card:focus-visible .gal-thumb { box-shadow: 0 0 0 2px rgba(255, 207, 112, 0.7), 0 18px 36px rgba(0, 0, 0, 0.5); }
.gal-card:hover .gal-thumb::before, .gal-card:focus-visible .gal-thumb::before { opacity: 1; }
.gal-card:focus-visible { outline: none; }
.gal-card.is-hidden .gal-thumb { opacity: 0.5; }
.gal-card-meta { display: flex; flex-direction: column; gap: 6px; padding: 0 2px; min-width: 0; }
.gal-card-title { font-size: 15.5px; font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gal-card-sub { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--gal-sub); min-width: 0; }
.gal-card-who { color: #c9ced4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40%; }
.gal-card-when { color: var(--gal-faint); white-space: nowrap; }
.gal-card-when::before { content: "·"; margin-right: 7px; }
.gal-card-counts { display: flex; align-items: center; gap: 10px; margin-left: auto; flex: none; }
.gal-card-react { display: inline-flex; align-items: center; gap: 5px; }
.gal-card-react:empty { display: none; }
.gal-emo-stack { display: inline-flex; }
.gal-emo-mini {
  display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; margin-left: -5px;
  border-radius: 50%; background: #2b3036; box-shadow: 0 0 0 2px var(--gal-bg); font-size: 11.5px; color: #fff;
}
.gal-emo-mini:first-child { margin-left: 0; }
.gal-card-cm { display: inline-flex; align-items: center; gap: 4px; }
.gal-badge {
  position: absolute; top: 10px; left: 10px; padding: 3px 9px; border-radius: 6px;
  background: rgba(60, 38, 12, 0.92); color: var(--gal-accent); font-size: 12px; font-weight: 600;
}
.gal-badge.is-inline { position: static; align-self: flex-start; }
.gal-avatar {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 36px; height: 36px; border-radius: 50%; color: #fff; font-size: 15px; font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}
.gal-avatar.is-sm { width: 22px; height: 22px; font-size: 11px; }

/* 불러오는 동안 자리 표시 (은은하게 깜빡임) */
.gal-card.is-skeleton { cursor: default; }
.gal-card.is-skeleton .gal-thumb, .gal-skel-line {
  background: linear-gradient(100deg, #202429 30%, #2a2f35 50%, #202429 70%) 0 0 / 300% 100%;
  animation: gal-shimmer 1.4s ease-in-out infinite;
}
.gal-skel-line { display: block; height: 13px; width: 70%; border-radius: 6px; }
.gal-skel-line.is-short { width: 42%; height: 11px; }
@keyframes gal-shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

.gal-empty { padding: 90px 20px; text-align: center; color: var(--gal-sub); }
.gal-empty i { font-size: 46px; color: #3b4148; margin-bottom: 14px; }
.gal-empty p { margin: 0 auto; max-width: 420px; font-size: 15px; line-height: 1.6; }
.gal-empty.is-error i { color: #6b4a2a; }
.gal-empty-all { margin-top: 16px; padding: 7px 18px; border-radius: 999px; border: 1px solid var(--gal-line-2); background: transparent; color: var(--gal-text); font-size: 14px; cursor: pointer; }
.gal-empty-all:hover { background: rgba(255, 255, 255, 0.07); }
.gal-empty-all[hidden] { display: none; }
.gal-empty[hidden], .gal-upload[hidden] { display: none !important; }
.gal-sentinel { height: 1px; }
.gal-foot {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px;
  margin: 56px 0 0; padding: 22px 0 28px; border-top: 1px solid var(--gal-line);
  color: var(--gal-faint); font-size: 12.5px;
}
.gal-foot-link { color: var(--gal-sub); text-decoration: none; font-weight: 600; }
.gal-foot-link:hover { color: var(--gal-text); }

/* ── 그림 하나 ── */
.gal-detail { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; background: var(--gal-bg); overflow: hidden; }
.gal-detail[hidden] { display: none; }
.gal-detail.is-busy .gal-exhibit { opacity: 0.45; }
.gal-detail-top {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 64px 12px 18px; border-bottom: 1px solid var(--gal-line); background: var(--gal-panel);
}
.gal-overlay.is-page .gal-detail-top { padding-right: 18px; }
.gal-back, .gal-act {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--gal-line-2); border-radius: 999px; padding: 6px 14px;
  background: transparent; color: var(--gal-text); font-size: 13.5px; cursor: pointer;
}
.gal-back:hover, .gal-act:hover { background: rgba(255, 255, 255, 0.07); }
.gal-act.is-danger { color: #ff9b9b; border-color: rgba(255, 120, 120, 0.35); }
.gal-counter { color: var(--gal-faint); font-size: 13px; font-variant-numeric: tabular-nums; }
.gal-detail-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.gal-detail-main { flex: 1; min-height: 0; display: flex; }
/* 벽: 어두운 교실 벽(은은한 회벽 결) + 위에서 비추는 조명 */
.gal-view {
  position: relative; flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center;
  padding: 18px 66px 14px; overflow: hidden;
  background:
    radial-gradient(ellipse 55% 48% at 50% -6%, rgba(255, 236, 200, 0.16), transparent 72%),
    radial-gradient(ellipse 80% 60% at 50% 45%, rgba(255, 255, 255, 0.035), transparent 75%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.012) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.05) 0 1px, transparent 1px 4px),
    linear-gradient(180deg, #2a2d31 0%, #1e2024 60%, #18191c 100%);
}
/* 아래 바닥 쪽은 조금 더 어둡게 (벽과 걸린 칠판의 깊이) */
.gal-view::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 18%; background: linear-gradient(0deg, rgba(0, 0, 0, 0.35), transparent); pointer-events: none; }
.gal-exhibit { position: relative; z-index: 1; display: inline-flex; flex-direction: column; align-items: stretch; max-width: 100%; opacity: 0; transition: opacity 0.35s ease; }
.gal-view.is-loaded .gal-exhibit { opacity: 1; }

/* 나무 틀 (초록·검정 칠판) — 칠판 화면(.board-modal)과 같은 나무 */
.gal-frame {
  --wood-hi: #8b633d; --wood: #6d482f; --wood-lo: #4a2f1b;
  position: relative; padding: 15px; border-radius: 5px;
  background-color: var(--wood);
  background-image:
    repeating-linear-gradient(0deg, rgba(60, 30, 10, 0.16) 0 1px, transparent 1px 5px, rgba(255, 220, 170, 0.05) 5px 6px, transparent 6px 11px),
    repeating-linear-gradient(90deg, transparent 0 140px, rgba(40, 20, 5, 0.06) 140px 220px, transparent 220px 380px),
    linear-gradient(180deg, var(--wood-hi) 0%, var(--wood) 18%, var(--wood) 70%, var(--wood-lo) 100%);
  box-shadow:
    0 34px 70px rgba(0, 0, 0, 0.62), 0 10px 22px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 232, 196, 0.35), inset 0 -1px 0 rgba(0, 0, 0, 0.4);
}
.gal-frame img {
  display: block; max-width: 100%;
  /* 세로 = 화면 높이 − (위 막대·틀·받침대·이름표). 예전 60vh 상한 때문에 낮은 화면에서 칠판이 작고 양옆 벽만 넓었다 */
  max-height: calc(100vh - 222px); max-height: calc(100dvh - 222px);
  border-radius: 1px; cursor: zoom-in;
  /* 틀 안쪽으로 들어가 보이는 칠판 면 */
  box-shadow: 0 0 0 1px rgba(30, 15, 5, 0.65), 0 1px 0 1px rgba(255, 232, 196, 0.18);
}
.gal-frame::after { /* 틀 안쪽 그늘 (위·왼쪽) */
  content: ""; position: absolute; inset: 15px; pointer-events: none;
  box-shadow: inset 0 8px 14px rgba(0, 0, 0, 0.45), inset 5px 0 10px rgba(0, 0, 0, 0.22), inset -3px 0 8px rgba(0, 0, 0, 0.18);
}
/* 전체 화면: 벽에 걸린 칠판이 화면을 꽉 채운다 (위 막대·오른쪽 칸·이름표 없음, 벽 여백 최소,
   이전·다음 화살표는 칠판 위에 반투명하게 겹친다 — 메뉴만 숨기면 칠판은 거의 그대로 커 보이지 않았다) */
.gal-detail:fullscreen { background: #17191c; }
.gal-detail.is-full .gal-detail-top, .gal-detail.is-full .gal-side { display: none; }
.gal-detail.is-full .gal-view { padding: 14px 18px 18px; }
.gal-detail.is-full .gal-frame img {
  max-height: calc(100vh - 78px); max-height: calc(100dvh - 78px);
  max-width: calc(100vw - 70px);
  cursor: zoom-out;
}
.gal-detail.is-full .gal-plaque { display: none; } /* 칠판만 크게 (모서리에 띄우면 받침대 지우개를 가렸다) */
.gal-detail.is-full .gal-nav { opacity: 0.35; z-index: 3; }
.gal-detail.is-full .gal-nav:hover { opacity: 1; }
.gal-detail.is-full .gal-nav.is-prev { left: 24px; }
.gal-detail.is-full .gal-nav.is-next { right: 24px; }

/* 분필 받침: 틀 아래에 붙어 앞으로 나온 선반 + 분필 몇 자루와 지우개 */
.gal-ledge {
  position: relative; height: 20px; margin: -7px -5px 0;
  border-radius: 2px 2px 6px 6px;
  background:
    repeating-linear-gradient(0deg, rgba(60, 30, 10, 0.14) 0 1px, transparent 1px 4px),
    linear-gradient(180deg, #4a2f1b 0%, #8a643f 34%, #9b744d 36%, #7b5534 52%, #613d24 82%, #482c1a 100%);
  box-shadow: inset 0 1px 0 rgba(255, 236, 205, 0.3), 0 10px 14px rgba(0, 0, 0, 0.5);
}
.gal-sticks { position: absolute; left: 7%; bottom: 11px; display: flex; align-items: flex-end; gap: 9px; }
.gal-stick {
  width: var(--w); height: 9px; border-radius: 2px 5px 5px 2px; transform: rotate(var(--t));
  background-color: color-mix(in srgb, var(--c) 86%, #f3eee2);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.5) 0%, transparent 40%, transparent 62%, rgba(0, 0, 0, 0.25) 100%);
  box-shadow: 0 2px 2px rgba(0, 0, 0, 0.35);
}
.gal-eraser {
  position: absolute; right: 7%; bottom: 10px; width: 74px; height: 16px; border-radius: 4px 4px 2px 2px; transform: rotate(-0.8deg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.28) 0%, transparent 18%),
    linear-gradient(180deg, #f0c98e 0%, #c08a4c 58%, #6b4524 62%, #dcd8cc 62%, #c4bfb1 85%, #aaa494 100%);
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.45);
}

/* 흰 칠판 = 화이트보드: 알루미늄 틀 + 모서리 덮개, 마커 받침, 파란 지우개 */
.gal-exhibit.is-white .gal-frame {
  padding: 12px; border-radius: 8px;
  background-color: #c9ced4;
  background-image:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.1) 0 1px, transparent 1px 3px),
    linear-gradient(180deg, #f4f6f8 0%, #d7dbe0 30%, #bfc4ca 62%, #9aa1a9 100%);
  box-shadow: 0 34px 70px rgba(0, 0, 0, 0.55), 0 10px 22px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.9), inset 0 -1px 0 rgba(60, 66, 74, 0.6);
}
.gal-exhibit.is-white .gal-frame::after { inset: 12px; box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.16); }
.gal-exhibit.is-white .gal-frame img { box-shadow: 0 0 0 1px rgba(60, 66, 74, 0.45), 0 0 0 2px rgba(255, 255, 255, 0.6); }
.gal-exhibit.is-white .gal-frame::before { /* 모서리 덮개 (위 두 곳) */
  content: ""; position: absolute; inset: -2px; pointer-events: none; border-radius: 9px;
  background:
    linear-gradient(145deg, #7b828a, #4a4f55) top left / 26px 26px no-repeat,
    linear-gradient(215deg, #7b828a, #4a4f55) top right / 26px 26px no-repeat,
    linear-gradient(35deg, #7b828a, #4a4f55) bottom left / 26px 26px no-repeat,
    linear-gradient(325deg, #7b828a, #4a4f55) bottom right / 26px 26px no-repeat;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  padding: 13px;
}
.gal-exhibit.is-white .gal-ledge {
  border-radius: 2px 2px 8px 8px;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 3px),
    linear-gradient(180deg, #6f767e 0%, #a9b0b7 30%, #f6f7f9 34%, #d3d8dd 50%, #aab1b8 80%, #7d848c 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 10px 14px rgba(0, 0, 0, 0.45);
}
.gal-exhibit.is-white .gal-stick { /* 보드마커: 흰 몸통 + 색 뚜껑 */
  height: 8px; border-radius: 2px 4px 4px 2px; transform: none; width: calc(var(--w) + 6px);
  background-color: #ececec;
  background-image: linear-gradient(90deg, var(--c) 0 8%, #3a3a3a 8% 16%, transparent 16% 74%, var(--c) 74% 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.85) 0%, transparent 40%, transparent 60%, rgba(0, 0, 0, 0.2) 100%);
  box-shadow: 0 2px 2px rgba(0, 0, 0, 0.35), inset 0 0 0 1px rgba(0, 0, 0, 0.22);
}
.gal-exhibit.is-white .gal-eraser {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.45) 0%, transparent 22%),
    linear-gradient(180deg, #7fb2f0 0%, #2f6fc4 58%, #1e4f94 62%, #e4e6e9 62%, #c9cdd2 85%, #aeb3b9 100%);
}

/* 작품 이름표: 칠판 아래 벽에 붙은 작은 카드 (미술관 설명 카드처럼) */
.gal-plaque {
  align-self: center; margin-top: 14px; padding: 7px 16px 8px; text-align: center;
  border-radius: 3px; background: linear-gradient(180deg, #f3efe6, #e2ddd2);
  color: #2a2622; box-shadow: 0 6px 14px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  max-width: min(520px, 90%);
}
.gal-plaque strong { display: block; font-size: 15px; font-weight: 800; letter-spacing: -0.01em; color: #1e1b18; overflow-wrap: anywhere; }
.gal-plaque span { display: block; margin-top: 2px; font-size: 12.5px; color: #6a625a; }
.gal-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--gal-line-2);
  background: rgba(20, 22, 25, 0.72); color: #fff; font-size: 16px; cursor: pointer;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  transition: background-color 0.15s;
}
.gal-nav:hover { background: rgba(50, 55, 62, 0.9); }
.gal-nav.is-prev { left: 10px; }
.gal-nav.is-next { right: 10px; }
.gal-nav[hidden] { display: none; }
.gal-side { width: 340px; flex: none; display: flex; flex-direction: column; gap: 16px; padding: 24px 22px; border-left: 1px solid var(--gal-line); overflow-y: auto; background: var(--gal-panel); }
.gal-detail-title { margin: 0; font-size: 23px; font-weight: 800; letter-spacing: -0.02em; color: var(--gal-text); line-height: 1.3; overflow-wrap: anywhere; }
.gal-detail-by { display: flex; align-items: center; gap: 11px; }
.gal-by-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.gal-who { color: var(--gal-text); font-weight: 700; }
.gal-by-line { display: flex; align-items: center; gap: 10px; color: var(--gal-sub); font-size: 13px; }
.gal-kind { display: inline-flex; align-items: center; gap: 5px; }
.gal-reacts { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.gal-react {
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 0 6px; border-radius: 12px;
  border: 1px solid var(--gal-line-2); background: rgba(255, 255, 255, 0.03); color: var(--gal-sub); font-size: 12.5px; cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}
.gal-react:hover { background: rgba(255, 255, 255, 0.07); }
.gal-react .gal-emo { font-size: 22px; line-height: 1; color: #fff; }
.gal-react .gal-n { font-variant-numeric: tabular-nums; }
.gal-react.is-mine { border-color: rgba(255, 207, 112, 0.8); background: rgba(255, 207, 112, 0.13); color: #fff; }
.gal-react.is-pop .gal-emo { animation: gal-pop 0.4s ease; }
@keyframes gal-pop { 40% { transform: scale(1.45); } }
.gal-comments h3, .gal-more-by h3 { margin: 4px 0 10px; font-size: 15px; font-weight: 700; color: var(--gal-text); }
.gal-comment-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.gal-comment { display: flex; gap: 10px; }
.gal-comment .gal-avatar { margin-top: 2px; }
.gal-comment.is-hidden { opacity: 0.5; }
.gal-comment-main { flex: 1; min-width: 0; }
.gal-comment-head { display: flex; align-items: baseline; gap: 8px; font-size: 13px; color: var(--gal-sub); }
.gal-comment-head .gal-who { font-size: 13.5px; }
.gal-comment-del { margin-left: auto; border: 0; background: transparent; color: var(--gal-faint); cursor: pointer; font-size: 13px; }
.gal-comment-del:hover { color: var(--gal-text); }
.gal-role { padding: 1px 7px; border-radius: 999px; background: rgba(120, 190, 255, 0.14); color: #9fd0ff; font-size: 11px; font-weight: 600; }
.gal-comment.is-student .gal-avatar { box-shadow: inset 0 0 0 1px rgba(159, 208, 255, 0.5); }
/* 댓글 공감 */
.gal-marks { display: flex; gap: 4px; margin-top: 4px; }
/* 👍 공감 · ❤️ 고마워요: 아이콘 + 숫자만 작게 (이름은 마우스 설명·aria-label) */
.gal-like {
  display: inline-flex; align-items: center; gap: 3px; padding: 1px 7px; min-height: 20px; border-radius: 999px;
  border: 1px solid transparent; background: rgba(255, 255, 255, 0.04); color: var(--gal-sub); font-size: 11px; cursor: pointer;
}
.gal-like:hover:not(:disabled) { color: var(--gal-text); background: rgba(255, 255, 255, 0.06); }
.gal-like:disabled { cursor: default; opacity: 0.75; }
.gal-like-icon { font-size: 11px; line-height: 1; color: #fff; filter: grayscale(0.7); opacity: 0.75; }
.gal-like.is-on .gal-like-icon { filter: none; opacity: 1; }
.gal-like.is-on { color: var(--gal-accent); border-color: rgba(255, 207, 112, 0.6); background: rgba(255, 207, 112, 0.1); }
.gal-like.is-thanks.is-on { color: #ff9fb3; border-color: rgba(255, 120, 150, 0.55); background: rgba(255, 120, 150, 0.1); }
.gal-like-n { font-variant-numeric: tabular-nums; font-size: 9.5px; opacity: 0.7; } /* 숫자는 덜 중요 — 더 작고 옅게 */
.gal-like.is-on .gal-like-n { opacity: 0.9; }
.gal-like-n:empty { display: none; }
.gal-like.is-pop .gal-like-icon { animation: gal-pop 0.4s ease; }
.gal-comment-body { margin-top: 3px; font-size: 14px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; color: #dde1e5; }
.gal-comment-none, .gal-comment-note { color: var(--gal-faint); font-size: 13.5px; margin: 0; }
.gal-comment-form { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.gal-comment-form textarea {
  width: 100%; resize: vertical; padding: 9px 11px; border-radius: 10px; border: 1px solid var(--gal-line-2);
  background: #171a1d; color: var(--gal-text); font: inherit; font-size: 14px;
}
.gal-comment-form .control-button { align-self: flex-end; margin: 0; padding: 6px 16px; }
.gal-more-by { border-top: 1px solid var(--gal-line); padding-top: 14px; }
.gal-more-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; } /* 2열: 3열(110px)은 판서가 너무 작았다 */
.gal-mini { padding: 0; border: 0; border-radius: 8px; overflow: hidden; aspect-ratio: 16 / 10; background: #22262b; cursor: pointer; box-shadow: 0 0 0 1px var(--gal-line); }
.gal-mini.is-green { background: #163A1B; }
.gal-mini.is-dark { background: #262626; }
.gal-mini.is-white { background: #F1F1F1; }
.gal-mini img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gal-mini:hover { box-shadow: 0 0 0 2px rgba(255, 207, 112, 0.75); }
.gal-loading { padding: 90px 20px; text-align: center; color: var(--gal-sub); }

/* ── 올리기 (강의 모드에서는 목록 없이 이 창만: .compose-only) ── */
.gal-compose { position: absolute; inset: 0; z-index: 3; display: flex; align-items: center; justify-content: center; background: rgba(8, 9, 11, 0.7); }
.gal-compose[hidden] { display: none; }
.gal-overlay.compose-only .gal-shell { background: transparent; border: 0; box-shadow: none; }
.gal-overlay.compose-only .gal-shell > :not(.gal-compose) { visibility: hidden; }
.gal-overlay.compose-only .gal-compose { background: transparent; }
.gal-compose-card {
  width: min(580px, calc(100% - 32px)); max-height: calc(100% - 32px); overflow-y: auto;
  display: flex; flex-direction: column; gap: 13px; padding: 22px 24px;
  border-radius: 18px; background: var(--gal-panel); border: 1px solid var(--gal-line-2); box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
}
.gal-compose-card h3 { margin: 0; font-size: 19px; font-weight: 800; color: var(--gal-text); }
.gal-compose-prev { border-radius: 12px; overflow: hidden; background: #163A1B; box-shadow: 0 0 0 1px var(--gal-line); }
.gal-compose-prev img { display: block; width: 100%; max-height: 290px; object-fit: contain; }
.gal-compose-label { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; color: var(--gal-sub); }
.gal-compose-label[hidden], .gal-compose-pick[hidden], .gal-compose-nick[hidden], .gal-nick-line[hidden] { display: none; }
.gal-compose-input, .gal-compose-select {
  padding: 9px 11px; border-radius: 10px; border: 1px solid var(--gal-line-2); background: #171a1d; color: var(--gal-text); font: inherit; font-size: 15px;
}
.gal-compose-hint { color: var(--gal-faint); font-size: 12px; }
.gal-nick-line { display: flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--gal-sub); }
.gal-nick-line b { color: var(--gal-text); }
.gal-link-btn { border: 0; background: transparent; color: var(--gal-accent); cursor: pointer; font-size: 13px; padding: 0 4px; text-decoration: underline; text-underline-offset: 3px; }
.gal-compose-note { margin: 0; font-size: 12.5px; color: var(--gal-sub); line-height: 1.5; }
.gal-compose-actions { display: flex; justify-content: flex-end; gap: 8px; }
.gal-compose-actions .control-button { margin: 0; }
.gal-compose-done { align-items: center; text-align: center; }
.gal-done-icon { width: 54px; height: 54px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: #2f8f57; color: #fff; font-size: 28px; font-weight: 700; }

/* ── 좁은 화면 ── */
@media (max-width: 820px) {
  .gal-shell { width: 100vw; height: 100vh; height: 100dvh; border-radius: 0; }
  .gal-stats { margin-left: 0; width: 100%; justify-content: flex-start; }
  .gal-seg { margin-left: 0; }
  .gal-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 20px 12px; }
  .gal-card-when { display: none; }
  .gal-detail-main { flex-direction: column; overflow-y: auto; }
  .gal-view { flex: none; min-height: 52vh; padding: 20px 48px 16px; }
  .gal-frame { padding: 9px; }
  .gal-frame::after { inset: 9px; }
  .gal-sticks { gap: 6px; }
  .gal-stick { width: calc(var(--w) * 0.6); }
  .gal-eraser { width: 48px; }
  .gal-frame img { max-height: 46vh; }
  .gal-nav { width: 38px; height: 38px; }
  .gal-nav.is-prev { left: 6px; }
  .gal-nav.is-next { right: 6px; }
  .gal-side { width: auto; border-left: 0; border-top: 1px solid var(--gal-line); overflow: visible; }
}
@media (prefers-reduced-motion: reduce) {
  .gal-thumb, .gal-thumb img, .gal-exhibit, .gal-chip, .gal-react { transition: none; }
  .gal-react.is-pop .gal-emo, .gal-card.is-skeleton .gal-thumb, .gal-skel-line, .gal-fresh { animation: none; }
}

/* ── 작가별 보기 ── */
.gal-author {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px 4px 5px; border-radius: 999px; cursor: pointer;
  border: 1px solid rgba(255, 207, 112, 0.6); background: rgba(255, 207, 112, 0.1); color: #fff; font-size: 13.5px;
}
.gal-author[hidden] { display: none; }
.gal-author:hover { background: rgba(255, 207, 112, 0.18); }
.gal-author i { font-size: 12px; opacity: 0.8; }
.gal-card-author { display: inline-flex; align-items: center; gap: 7px; min-width: 0; max-width: 45%; border-radius: 999px; }
.gal-card-author .gal-card-who { max-width: none; }
.gal-card-author:hover .gal-card-who { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.gal-who-link { border: 0; padding: 0; background: transparent; cursor: pointer; font: inherit; font-weight: 700; color: var(--gal-text); text-align: left; }
.gal-who-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.gal-more-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }

/* ── 새 댓글 알림 (교사) ── */
.gal-tab-badge {
  display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; margin-left: 6px; padding: 0 5px;
  border-radius: 999px; background: #e5484d; color: #fff; font-size: 11px; font-weight: 700; vertical-align: 1px;
}
.gal-new-badge {
  position: absolute; top: 10px; right: 10px; z-index: 2; padding: 3px 9px; border-radius: 999px;
  background: #e5484d; color: #fff; font-size: 12px; font-weight: 700; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
}
/* 시계 화면 도구 막대의 갤러리 버튼 (index.html, gallery.css 함께 불러옴) */
#galleryButton .gal-btn-badge {
  position: absolute; top: -2px; right: 6px; min-width: 15px; height: 15px; padding: 0 4px; border-radius: 999px;
  background: #e5484d; color: #fff; font: 700 9.5px/15px "Noto Sans KR", sans-serif; text-align: center; pointer-events: none;
}
#galleryButton .gal-btn-badge[hidden] { display: none; }
