/* =====================================================================
   v2.0 홍보 기능 스타일 — 공지사항 · 팝업 · 공유 버튼 · 관리자 화면(공지·팝업·링크 만들기)
   style.css의 색 변수(--ink, --gold, --card-bg …)를 그대로 써서 어두운 화면에서도 자연스럽게 바뀝니다.
   style.css는 건드리지 않고, 이 파일만 따로 불러옵니다(index.html · viewer.html · admin/index.html).
   ===================================================================== */

html.nt-lock,
html.pp-lock { overflow: hidden; }

/* ---------- 서재 맨 위 공지 줄 ---------- */
.notice-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 18px;
  background: var(--ink-2);
  color: var(--on-ink);
  border: 0;
  border-bottom: 1px solid rgba(201, 168, 106, 0.35);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}
.notice-bar:hover { background: var(--ink); }
.notice-bar:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }
.nb-tag {
  flex: none;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--gold);
  color: #1e2a3a;
  font-size: 12px;
  font-weight: 700;
}
.nb-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nb-new {
  flex: none;
  min-width: 18px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #d9534f;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}
.nb-new[hidden] { display: none; }
.nb-go { flex: none; color: var(--on-ink-muted); font-size: 13px; }

/* ---------- 공지 읽기 창 ---------- */
.nt-backdrop {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(15, 20, 27, 0.55);
}
.nt-backdrop[hidden] { display: none; }
.nt-dialog {
  display: flex;
  flex-direction: column;
  width: min(640px, 100%);
  max-height: min(86vh, 760px);
  background: var(--card-bg);
  color: var(--text);
  border-radius: var(--radius);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}
.nt-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 12px 12px 18px;
  border-bottom: 1px solid var(--border);
}
.nt-head h2 { flex: 1; margin: 0; font-family: var(--serif); font-size: 18px; }
.nt-back {
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 8px;
  padding: 5px 10px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.nt-scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.nt-list { list-style: none; margin: 0; padding: 0; }
.nt-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  padding: 14px 18px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.nt-item:hover { background: var(--surface-2); }
.nt-item-main { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.nt-item-title { font-weight: 600; font-size: 15px; line-height: 1.45; }
.nt-item-date { font-size: 12px; color: var(--text-muted); }
.nt-chip {
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.nt-chip.pin { background: var(--surface-2); color: var(--gold-text); border: 1px solid var(--border-strong); }
.nt-chip.new { background: #d9534f; color: #fff; }
.nt-detail { padding: 18px 20px 26px; }
.nt-detail[hidden] { display: none; }
.nt-detail-title { margin: 0 0 6px; font-family: var(--serif); font-size: 20px; line-height: 1.4; }
.nt-detail-date { margin: 0 0 16px; font-size: 12px; color: var(--text-muted); }
.nt-detail-body { font-size: 15px; line-height: 1.8; }
.nt-text { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0 0 12px; }
.nt-text a, .pp-text a { color: var(--gold-text); text-decoration: underline; }
.nt-figure { margin: 8px 0 14px; }
.nt-figure img { display: block; max-width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--border); }

/* ---------- 팝업 ---------- */
.pp-wrap {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  padding: 16px;
}
.pp-wrap.pp-dim { background: rgba(15, 20, 27, 0.55); }
.pp-wrap:not(.pp-dim) { pointer-events: none; } /* 구석 팝업은 뒤의 화면을 계속 쓸 수 있게 */
.pp-dialog {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  width: min(440px, 100%);
  max-height: 100%;
  outline: none;
}
.pp-pos-center { align-items: center; justify-content: center; }
.pp-pos-top { align-items: flex-start; justify-content: center; }
.pp-pos-bottom { align-items: flex-end; justify-content: center; }
.pp-pos-bottom-right { align-items: flex-end; justify-content: flex-end; }
.pp-pos-bottom-left { align-items: flex-end; justify-content: flex-start; }
.pp-slide {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--card-bg);
  color: var(--text);
  border-radius: var(--radius);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}
.pp-card { position: relative; }
.pp-x {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 2;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: rgba(15, 20, 27, 0.6);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.pp-preview-flag {
  padding: 8px 44px 8px 12px;
  background: #fff3cd;
  color: #7a5200;
  font-size: 12px;
  font-weight: 600;
}
.pp-img { display: block; width: 100%; height: auto; }
.pp-img.is-link { cursor: pointer; }
.pp-video { position: relative; width: 100%; padding-top: 56.25%; background: #000; }
.pp-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.pp-body { padding: 16px 18px 6px; }
.pp-title { margin: 0 0 8px; font-family: var(--serif); font-size: 18px; line-height: 1.45; padding-right: 30px; }
.pp-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; line-height: 1.7; }
.pp-linkrow { padding: 10px 18px 2px; }
.pp-link {
  width: 100%;
  padding: 11px 14px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: var(--on-accent);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.pp-link:hover { filter: brightness(1.06); }
.pp-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 4px 8px;
  padding: 10px 14px 14px;
}
.pp-dismiss {
  border: 0;
  background: none;
  color: var(--text-muted);
  font: inherit;
  font-size: 13px;
  text-decoration: underline;
  padding: 7px 6px;
  cursor: pointer;
}
.pp-close {
  padding: 7px 16px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.pp-skip-rest {
  display: block;
  width: 100%;
  padding: 8px 14px 12px;
  border: 0;
  background: none;
  color: var(--text-muted);
  font: inherit;
  font-size: 12px;
  text-decoration: underline;
  cursor: pointer;
}
.pp-nav {
  flex: none;
  align-self: center;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(15, 20, 27, 0.85);
  color: #fff;
  font-size: 13px;
}
.pp-nav[hidden] { display: none; }
.pp-nav button {
  width: 38px;
  height: 34px;
  border: 0;
  background: none;
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

@media (max-width: 820px) {
  .pp-wrap { padding: 10px 10px calc(10px + env(safe-area-inset-bottom, 0px)); }
  .pp-pos-bottom-right,
  .pp-pos-bottom-left { justify-content: center; }
  .pp-pos-top .pp-dialog,
  .pp-pos-bottom .pp-dialog,
  .pp-pos-bottom-right .pp-dialog,
  .pp-pos-bottom-left .pp-dialog { width: 100%; }
  .nt-backdrop { padding: 0; align-items: flex-end; }
  .nt-dialog { width: 100%; max-height: 88vh; border-radius: var(--radius) var(--radius) 0 0; }
}

/* ---------- 공유·링크 복사 (뷰어) ---------- */
.share-group[hidden],
.share-menu-item[hidden],
.share-btn[hidden] { display: none !important; }
.share-group .tb-btn + .tb-btn { margin-top: 6px; }

.promo-toast {
  position: fixed;
  left: 50%;
  bottom: calc(26px + env(safe-area-inset-bottom, 0px));
  z-index: 130;
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--on-ink);
  font-size: 14px;
  text-align: center;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 16px);
  transition: opacity 0.2s, transform 0.2s;
}
.promo-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* =====================================================================
   관리자 화면 (공지사항 · 팝업 · 홍보 링크 만들기)
   ===================================================================== */
.promo-help {
  margin: 4px 0 14px;
  padding: 10px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 13px;
  line-height: 1.65;
}
.promo-help summary { cursor: pointer; font-weight: 700; color: var(--gold-text); }
.promo-help ul { margin: 8px 0 4px; padding-left: 20px; }
.promo-help li { margin: 3px 0; }
.promo-help b { color: var(--text); }

.promo-switch-grid { display: grid; gap: 10px; margin-bottom: 12px; }
.promo-switch-grid label.switch-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  cursor: pointer;
}
.promo-switch-grid label.switch-row input { margin-top: 3px; }
.promo-switch-grid label.switch-row small { display: block; color: var(--text-muted); font-size: 12px; margin-top: 2px; }

.promo-two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.promo-three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 16px; }
@media (max-width: 820px) {
  .promo-two, .promo-three { grid-template-columns: 1fr; }
}
.form-row textarea.promo-textarea,
.form-row input[type="date"],
.form-row input[type="url"],
.form-row select.promo-select {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}
.form-row textarea.promo-textarea { min-height: 120px; line-height: 1.6; resize: vertical; }
.form-row .hint { margin: 4px 0 0; font-size: 12px; line-height: 1.55; color: var(--text-muted); }
.form-row .radio-line { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.form-row .radio-line label { font-weight: 400; display: inline-flex; align-items: center; gap: 6px; }
.promo-sub { margin: 18px 0 8px; font-size: 15px; font-family: var(--serif); }

.img-slots { display: flex; flex-wrap: wrap; gap: 12px; }
.img-slot {
  width: 168px;
  padding: 8px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  font-size: 12px;
}
.img-slot .img-slot-title { font-weight: 700; margin-bottom: 6px; }
.img-slot img { display: block; width: 100%; height: 100px; object-fit: contain; background: var(--surface-2); border-radius: 6px; margin-bottom: 6px; }
.img-slot img[hidden] { display: none; }
.img-slot input[type="file"] { width: 100%; font-size: 12px; }

.promo-table td.name { font-weight: 600; }
.promo-table .st { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.promo-table .st.on { background: #e3f4ea; color: #2f7a4a; }
.promo-table .st.off { background: #eee; color: #777; }
.promo-table .st.wait { background: #fff6e5; color: #7a5200; }
.promo-table .actions { display: flex; flex-wrap: wrap; gap: 4px; }
.promo-table .sub { display: block; font-size: 12px; color: var(--text-muted); font-weight: 400; }

.link-maker { display: grid; gap: 10px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--card-bg); }
.link-maker label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.link-maker input[type="text"],
.link-maker select {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}
.link-maker .lm-result-row { display: flex; gap: 8px; }
.link-maker .lm-result-row input { flex: 1; min-width: 0; background: var(--surface-2); }
.link-maker input[hidden] { display: none; }

/* ---------- v2.0 관리자 보정: 기존 관리자 화면(.form-row)과 같은 모양으로 ---------- */
.admin-section [hidden] { display: none !important; }
.admin-section .form-row textarea.promo-textarea { font-size: 14px; }
.admin-section .form-row input[type="date"] { width: 100%; box-sizing: border-box; }
.admin-section .form-row select[multiple] { padding: 6px; min-height: 160px; }
.admin-section .form-row .checkbox-group label { font-size: 14px; color: var(--text); margin: 0; display: inline-flex; align-items: center; gap: 6px; }
.admin-section .form-row .radio-line { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: 14px; }
.admin-section .promo-switch-grid .switch-row b { font-size: 14px; color: var(--text); }
.admin-section .promo-switch-grid .switch-row small { font-size: 12px; }
.admin-section form .btn { margin: 4px 6px 0 0; }
.lm-result-row { display: flex; gap: 8px; }
.lm-result-row input { flex: 1; min-width: 0; padding: 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px; background: var(--surface-2); }
.pp-admin-img { display: block; max-width: 260px; max-height: 180px; margin: 8px 0; border: 1px solid var(--border); border-radius: 6px; }
.promo-table .name { white-space: normal; }
.promo-table td { vertical-align: middle; }
.promo-table .actions .btn { margin: 0; }
