/* =============================================================
   강의 포털 — 건국대 강의안 디자인 시스템 (크림 · 그린 · 골드 · 세리프 제목)
   ============================================================= */
:root {
  /* 면 — 따뜻한 크림 베이스 */
  --bg: #f8f4ee;
  --bg-soft: #f0e9de;
  --card: #ffffff;
  --card-soft: #faf7f2;

  /* 글자 */
  --ink: #1b1d19;
  --ink2: #585d54;
  --ink3: #8b9086;

  /* 선 */
  --line: #e8e4da;
  --line2: #d8d3c6;

  /* 건국대 브랜드 색 */
  --green: #005426;
  --green-deep: #00401d;
  --green-soft: #e7f0ea;
  --gold: #f9c66a;
  --gold-deep: #b07f21;
  --gold-soft: #fdf3db;
  --cream: #f5ead6;

  --accent: var(--green);
  --accent-soft: var(--green-soft);
  --pen: #c43d30;
  --pen-soft: #f7e6e3;
  --hl: rgba(249, 198, 106, .55);

  /* 모서리·그림자 */
  --r: 14px; --r-sm: 10px; --r-lg: 20px; --pill: 999px;
  --sh-sm: 0 1px 2px rgba(16,24,40,.04), 0 1px 3px rgba(16,24,40,.06);
  --sh: 0 2px 4px rgba(16,24,40,.04), 0 8px 20px rgba(16,24,40,.06);
  --sh-lg: 0 14px 40px rgba(16,24,40,.14);

  /* 폰트 — 본문·UI: Pretendard / 제목·강의명: Gowun Batang(세리프) */
  --sans: 'Pretendard Variable', 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  --serif: 'Gowun Batang', Georgia, 'Apple SD Gothic Neo', serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.65;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: clip; /* 풀블리드 히어로가 가로 스크롤을 만들지 않게 (sticky 헤더는 유지) */
}

[hidden] { display: none !important; }

.wrap { width: 100%; max-width: 960px; margin: 0 auto; padding: 0 24px; }
.content { flex: 1 0 auto; padding-top: 12px; padding-bottom: 64px; }

/* ---------- 헤더 ---------- */
.site-header {
  background: rgba(248, 244, 238, .82);
  backdrop-filter: saturate(150%) blur(12px);
  -webkit-backdrop-filter: saturate(150%) blur(12px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 62px; }
.site-title {
  font-family: var(--sans); font-size: 15px; font-weight: 400; margin: 0; letter-spacing: .01em;
  display: flex; align-items: center; gap: 9px; color: var(--ink2);
}
.site-title::before {
  content: ""; width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0;
  background: var(--green); box-shadow: 0 0 0 3px var(--green-soft);
}
.site-title em { font-style: normal; font-family: var(--sans); font-weight: 600; font-size: 12px; color: var(--ink3); padding-left: 9px; margin-left: 3px; border-left: 1px solid var(--line2); }
/* 헤더 명언 (학생) — 길면 한 줄로 말줄임 */
.site-quote { min-width: 0; }
.site-quote .st-text { font-style: normal; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-link {
  text-decoration: none; font-size: 16px; line-height: 1;
  width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--pill); border: 1px solid var(--line2); transition: .15s;
}
.icon-link:hover { background: var(--green-soft); border-color: var(--green); }
/* 덜 눈에 띄는 아이콘 링크 (관리자 진입 등) */
.icon-link.subtle {
  width: 34px; height: 34px; border: none; color: var(--ink3); opacity: .4;
  transition: opacity .15s, color .15s, background .15s;
}
.icon-link.subtle svg { width: 17px; height: 17px; display: block; }
.icon-link.subtle:hover { opacity: 1; color: var(--green); background: var(--green-soft); border: none; }

/* ---------- 푸터 ---------- */
.site-footer {
  flex-shrink: 0; background: transparent; border-top: 1px solid var(--line);
  color: var(--ink3); font-size: 12.5px; text-align: center; padding: 18px 0;
}
.site-footer .wrap { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
.footer-admin { width: 28px; height: 28px; }
.footer-admin svg { width: 15px; height: 15px; }

/* ---------- 히어로 (미니멀 화이트 · 건축적 · 동적) ---------- */
.hero {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  /* 풀블리드: 좌우를 화면 끝까지 확장 + 페이지 맨 위에 붙도록 위로 당김 */
  margin: -12px calc(50% - 50vw) 12px;
  /* 높이 고정 — 명언 길이와 무관하게 항상 같은 높이, 내용은 세로 가운데 정렬 */
  min-height: clamp(420px, 46vh, 500px);
  display: flex; align-items: center; justify-content: center;
  padding: 36px 0;
  background: radial-gradient(125% 96% at 50% -12%, #ffffff 0%, #fbfaf6 46%, #efe9de 100%);
  border-bottom: 1px solid var(--line);
}
/* 동심원 호 — 라인에 빨강·녹색·파랑 입체 색 (색 위에 라인 패턴을 마스크) */
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: conic-gradient(from 205deg at 50% 140%,
    #8497b1 0deg, #84a08c 120deg, #bd9189 240deg, #8497b1 360deg);
  -webkit-mask-image:
    repeating-radial-gradient(circle at 50% 140%, transparent 0 43px, #000 43px 45px),
    radial-gradient(120% 100% at 50% 140%, #000 42%, transparent 84%);
  -webkit-mask-composite: source-in;
  mask-image:
    repeating-radial-gradient(circle at 50% 140%, transparent 0 43px, #000 43px 45px),
    radial-gradient(120% 100% at 50% 140%, #000 42%, transparent 84%);
  mask-composite: intersect;
  opacity: .42;
  transform-origin: 50% 140%;
  animation: heroBreathe 6s ease-in-out infinite;
  will-change: transform;
}
@keyframes heroBreathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.07); } }
/* 비트: 펄스 두 번(lub-dub) 뛰고 정지 */
.hero.is-beat::after { animation: heroHeartbeat 4.5s ease-out infinite; }
@keyframes heroHeartbeat {
  0%   { transform: scale(1); }
  5%   { transform: scale(1.05); }   /* lub */
  11%  { transform: scale(1.008); }
  16%  { transform: scale(1.032); }  /* dub */
  22%  { transform: scale(1); }
  100% { transform: scale(1); }      /* 정지 */
}
/* 배경 변형: 물결 격자 (동심원 대신) — 호흡/비트 애니메이션은 그대로 적용 */
.hero.bg-grid::after {
  background: url("/wavy-grid.svg") center / cover no-repeat;
  -webkit-mask-image: radial-gradient(125% 110% at 50% 50%, #000 42%, transparent 88%);
          mask-image: radial-gradient(125% 110% at 50% 50%, #000 42%, transparent 88%);
  -webkit-mask-composite: source-over;
          mask-composite: add;
  opacity: .4;
  transform-origin: 50% 50%;
}
@media (prefers-reduced-motion: reduce) {
  .hero::after, .hero.is-beat::after { animation: none; }
}

.hero-inner {
  position: relative; z-index: 1;
  max-width: 820px; margin: 0 auto; padding: 0 24px;
  text-align: center;
}
/* 무작위 명언 */
.hero-quote { margin: 0; }
.hero-quote::before {
  content: "\201C"; display: block;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(54px, 9vw, 92px); line-height: .5; color: var(--gold);
  opacity: .55; margin-bottom: 10px;
}
.hero-quote-text {
  font-family: var(--sans); font-weight: 600;
  font-size: clamp(23px, 3.9vw, 42px); line-height: 1.3; letter-spacing: -.022em;
  color: #1f2e26; margin: 0; text-wrap: balance; /* 그린-블랙: 대비 유지 + 브랜드 톤 */
  transition: opacity .45s ease;
}
.hero-quote-author {
  display: block; margin-top: 22px; font-style: normal;
  font-size: clamp(13px, 1.6vw, 15px); font-weight: 700; letter-spacing: .06em; color: var(--green);
  transition: opacity .45s ease;
}
.hero-quote.q-fade .hero-quote-text,
.hero-quote.q-fade .hero-quote-author { opacity: 0; }

.section-title {
  font-family: var(--sans); font-size: 20px; font-weight: 800; color: var(--ink);
  margin: 36px 0 18px; letter-spacing: -.02em;
}
.muted { color: var(--ink3); }
.error { color: var(--pen); white-space: pre-line; }

/* ---------- 버튼 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--green); color: #fff; border: none; cursor: pointer; font-family: var(--sans);
  font-size: 15px; font-weight: 700; padding: 11px 20px; border-radius: var(--pill);
  box-shadow: var(--sh-sm); transition: background .15s, transform .12s, box-shadow .15s;
  white-space: nowrap;
}
.btn:hover { background: var(--green-deep); transform: translateY(-1px); box-shadow: var(--sh); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .5; cursor: default; box-shadow: none; transform: none; }
.btn.ghost { background: transparent; color: var(--green); border: 1px solid var(--line2); box-shadow: none; }
.btn.ghost:hover { background: var(--green-soft); border-color: var(--green); transform: none; box-shadow: none; }
.btn.small { padding: 8px 14px; font-size: 13.5px; }
.btn.full { width: 100%; }
.btn.danger { background: var(--pen); }
.btn.danger:hover { background: #a23329; }
.btn.danger.small { background: transparent; color: var(--pen); border: 1px solid var(--pen-soft); box-shadow: none; }
.btn.danger.small:hover { background: var(--pen-soft); }
/* 뒤로가기 — 보더리스 텍스트 버튼 */
.back-btn {
  display: inline-flex; align-items: center; gap: 4px;
  margin-bottom: 14px; padding: 6px 2px;
  background: transparent; border: none; box-shadow: none; cursor: pointer;
  font-family: var(--sans); font-size: 13.5px; font-weight: 600; color: var(--ink3);
  transition: color .14s ease, transform .14s ease;
}
.back-btn:hover { color: var(--ink2); transform: translateX(-2px); }
.back-btn:active { transform: translateX(-1px); }

/* 토픽 뷰 헤더 — 강의 제목 + 설명(옆) */
.topic-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 2px 0 16px; }
.topic-head .section-title { margin: 0; color: #33533f; font-weight: 700; }
.topic-head-desc { font-size: 14px; font-weight: 600; color: var(--ink3); }

/* ---------- 입력 ---------- */
label { display: block; font-size: 13px; color: var(--ink2); font-weight: 700; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=file] {
  width: 100%; margin-top: 6px; padding: 10px 13px; font-size: 15px;
  border: 1px solid var(--line2); border-radius: var(--r-sm); background: #fff;
  font-family: var(--sans); color: var(--ink); transition: border-color .15s, box-shadow .15s;
}
input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }

/* ---------- 카드 기본 ---------- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: var(--sh-sm); padding: 24px 26px;
}

/* 강의 목록 — 보더리스 리스트 (학생·관리자 공통, 모던 에디토리얼) */
.card-grid, .lecture-list { display: flex; flex-direction: column; gap: 0; border-top: 1px solid var(--line); }
.course-card {
  position: relative; text-align: left; cursor: pointer; width: 100%;
  display: flex; align-items: center; gap: 16px; padding: 18px 8px;
  background: transparent; border: none; border-bottom: 1px solid var(--line);
  border-radius: 0; box-shadow: none; font-family: var(--sans);
  transition: background .16s ease;
}
.course-card:hover { background: linear-gradient(90deg, rgba(0,84,38,.05), rgba(0,84,38,0) 72%); }
/* 책 아이콘 타일 */
.course-card-icon {
  flex-shrink: 0; width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--card-soft); border: 1px solid var(--line); color: var(--ink3);
  transition: border-color .16s ease, color .16s ease, background .16s ease;
}
.course-card-icon svg { width: 20px; height: 20px; display: block; }
.course-card:hover .course-card-icon { border-color: var(--green); color: var(--green); }
/* 제목 + 설명(같은 줄 오른쪽) */
.course-card-body { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 14px; }
.card-title {
  font-family: var(--sans); font-size: 19px; font-weight: 600; color: #33533f; /* 살짝 녹색톤 (차분한 다크 그린) */
  letter-spacing: -.02em; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: color .16s ease;
}
.course-card:hover .card-title { color: var(--green); }
.course-card-desc {
  margin-left: auto; min-width: 0; text-align: right; font-size: 13px; color: var(--ink3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.course-card-tail { flex-shrink: 0; display: flex; align-items: center; gap: 10px; }
.course-lock { display: flex; color: var(--ink3); opacity: .6; }
.course-lock svg { width: 16px; height: 16px; display: block; }
.course-card .card-arrow { flex-shrink: 0; font-size: 22px; }
.course-card:hover .card-arrow { color: var(--green); transform: translateX(3px); }

/* 관리자 전용: 핸들 / 메타 배지 / 숨김 */
.admin-course-card { gap: 12px; }
.admin-card-meta { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.lock-badge { flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: var(--ink3); opacity: .6; }
.lock-badge svg { width: 16px; height: 16px; display: block; }
.hidden-badge {
  flex-shrink: 0; font-size: 11.5px; font-weight: 700; color: var(--ink3);
  background: var(--bg-soft); border: 1px solid var(--line2); border-radius: var(--pill);
  padding: 3px 9px; letter-spacing: .02em;
}
.course-card.is-hidden { opacity: .5; }
.course-card.is-hidden:hover { opacity: .8; }

.course-detail { padding: 24px 26px; }

/* 리스트 행 제목 옆 [수정]·[링크 복사] 버튼 */
.c-edit, .c-link {
  flex-shrink: 0; background: transparent; border: 1px solid var(--line2);
  color: var(--ink3); font-family: var(--sans); font-size: 12.5px; font-weight: 600;
  padding: 4px 11px; border-radius: var(--pill); cursor: pointer;
  transition: border-color .14s, color .14s, background .14s;
}
.c-edit:hover, .c-link:hover { border-color: var(--green); color: var(--green); background: var(--green-soft); }

/* 토픽 뷰 헤더 (강의명 + 정보 수정) */
.ct-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding-bottom: 18px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.ct-titles { min-width: 0; }
.ct-title { font-family: var(--sans); font-weight: 800; font-size: 21px; letter-spacing: -.02em; margin: 0 0 2px; color: var(--ink); }
.ct-sub { font-size: 13.5px; }
.ct-edit { flex-shrink: 0; }

/* 드래그 앤 드롭 정렬 */
.sort-list { display: flex; flex-direction: column; gap: 12px; }
.drag-handle {
  flex-shrink: 0; cursor: grab; color: var(--ink3); padding: 6px 2px;
  display: flex; align-items: center; touch-action: none; font-size: 16px; line-height: 1;
}
.drag-handle:active { cursor: grabbing; }
[draggable="true"].dragging { opacity: .5; background: var(--card-soft); box-shadow: none; }
.admin-course-card { cursor: pointer; }

/* 학생: 토픽 리스트 — 강의 목록과 동일한 보더리스 리스트 */
.card-list { display: flex; flex-direction: column; gap: 0; border-top: 1px solid var(--line); }
.topic-card {
  display: flex; align-items: center; gap: 16px; width: 100%; text-align: left;
  padding: 18px 8px; cursor: pointer;
  background: transparent; border: none; border-bottom: 1px solid var(--line);
  border-radius: 0; box-shadow: none; font-family: var(--sans);
  transition: background .16s ease;
}
.topic-card:hover { background: linear-gradient(90deg, rgba(0,84,38,.05), rgba(0,84,38,0) 72%); }
.topic-index {
  flex-shrink: 0; width: 44px; height: 44px; border-radius: 12px;
  background: var(--card-soft); border: 1px solid var(--line); color: var(--ink3);
  display: grid; place-items: center; font-size: 15px; font-weight: 700;
  transition: border-color .16s ease, color .16s ease;
}
.topic-card:hover .topic-index { border-color: var(--green); color: var(--green); }
.topic-card .card-title { flex: 1; min-width: 0; font-size: 17px; font-weight: 500; color: var(--ink2); transition: color .16s ease; }
.topic-card:hover .card-title { color: var(--green); }
.card-arrow { color: var(--ink3); font-size: 20px; line-height: 1; transition: transform .14s, color .14s; }
.topic-card .card-arrow { font-size: 22px; }
.topic-card:hover .card-arrow { color: var(--green); transform: translateX(3px); }

/* 빈 상태 */
.empty-state {
  text-align: center; padding: 48px 24px; color: var(--ink3);
  border: 1px dashed var(--line2); border-radius: var(--r); background: var(--card-soft);
}
.empty-state .emoji { font-size: 30px; display: block; margin-bottom: 10px; opacity: .85; }

/* ---------- 설치 안내 (작고 눈에 띄지 않게) ---------- */
.install-note {
  margin: 44px auto 0; max-width: 560px; padding-top: 22px;
  border-top: 1px solid var(--line);
  font-size: 13px; color: var(--ink3); line-height: 1.7; text-align: left;
}
.install-note-head { margin: 0 0 10px; }
.install-note ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 7px; }
.install-note li { padding-left: 2px; }
.install-note strong { color: var(--ink2); font-weight: 700; }

/* ---------- 모달 ---------- */
.modal {
  position: fixed; inset: 0; background: rgba(27, 29, 25, .42);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px;
  backdrop-filter: blur(3px);
}
.modal-box { background: #fff; border-radius: var(--r-lg); padding: 28px; width: 100%; max-width: 380px; box-shadow: var(--sh-lg); }
.modal-box h3 { font-family: var(--sans); font-weight: 800; letter-spacing: -.02em; margin: 0 0 6px; font-size: 19px; display: flex; align-items: center; gap: 9px; }
.modal-box h3::before {
  content: ""; width: 30px; height: 30px; border-radius: var(--r-sm); flex-shrink: 0;
  background: var(--green-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23005426' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='11' width='18' height='11' rx='2'/%3E%3Cpath d='M7 11V7a5 5 0 0 1 10 0v4'/%3E%3C/svg%3E") center/16px no-repeat;
}
.modal-box input { margin-top: 16px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* 강의 정보 수정 팝업 */
.ce-box { max-width: 460px; }
.ce-box h3::before { content: none; }
.ce-box > label { display: block; margin-top: 14px; }
.ce-row { display: flex; align-items: flex-end; gap: 10px; margin-top: 14px; }
.ce-row .grow { flex: 1; margin-top: 0; }
.ce-vis { align-items: center; padding-top: 4px; }
.ce-vis .vis-state { flex: 1; font-size: 13px; font-weight: 700; color: var(--ink2); }
.ce-actions { align-items: center; }
.ce-spacer { flex: 1; }

/* ---------- 풀스크린 뷰어 ---------- */
.viewer-overlay { position: fixed; inset: 0; z-index: 200; background: #000; }
.viewer-frame-wrap { position: absolute; inset: 0; background: #fff; }
.viewer-frame { width: 100%; height: 100%; border: 0; display: block; background: #fff; }
.viewer-back-fab {
  position: absolute; top: calc(14px + env(safe-area-inset-top)); left: 14px; z-index: 5;
  width: 44px; height: 44px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(0, 64, 29, .58); color: #fff;
  backdrop-filter: saturate(140%) blur(8px); -webkit-backdrop-filter: saturate(140%) blur(8px);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 12px rgba(0, 0, 0, .35); transition: background .15s, transform .12s;
}
.viewer-back-fab:hover { background: rgba(0, 64, 29, .85); transform: scale(1.06); }
.viewer-back-fab:active { transform: scale(.97); }
.viewer-back-fab svg { width: 22px; height: 22px; }

.viewer-fs-fab {
  position: absolute; top: calc(14px + env(safe-area-inset-top)); right: 14px; z-index: 5;
  width: 44px; height: 44px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(0, 64, 29, .58); color: #fff;
  backdrop-filter: saturate(140%) blur(8px); -webkit-backdrop-filter: saturate(140%) blur(8px);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 12px rgba(0, 0, 0, .35); transition: background .15s, transform .12s;
}
.viewer-fs-fab:hover { background: rgba(0, 64, 29, .85); transform: scale(1.06); }
.viewer-fs-fab:active { transform: scale(.97); }
.viewer-fs-fab svg { width: 21px; height: 21px; }
.viewer-loading {
  position: absolute; inset: 0; display: flex; flex-direction: column; gap: 16px;
  align-items: center; justify-content: center; background: #fff; color: var(--ink2); z-index: 2;
}
.viewer-error {
  position: absolute; inset: 0; display: flex; flex-direction: column; gap: 10px;
  align-items: center; justify-content: center; text-align: center; padding: 24px;
  color: var(--pen); font-weight: 700;
}
.viewer-error small { color: var(--ink2); font-weight: 400; white-space: pre-line; }
.spinner {
  width: 38px; height: 38px; border: 3px solid var(--green-soft);
  border-top-color: var(--green); border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 관리자 ---------- */
.login-box { max-width: 400px; margin: 56px auto; padding: 32px; }
.login-box h2 { font-family: var(--serif); margin: 0 0 22px; font-size: 22px; }
.login-box label { margin-bottom: 14px; }
.dash-head { display: flex; justify-content: space-between; align-items: center; margin: 16px 0 22px; }
.new-course-card h3 { font-family: var(--serif); margin: 0 0 14px; font-size: 17px; }

.field-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.field-row > label { flex: 1 1 160px; }
.field-row > label.narrow { flex: 0 0 90px; }
.field-row > label.grow { flex: 3 1 240px; }

.pw-state { font-weight: 500; color: var(--ink3); }
.cp-top { display: flex; align-items: flex-end; gap: 10px; padding-bottom: 18px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.cp-fields { flex: 1; display: grid; grid-template-columns: 1fr 1.4fr; gap: 12px; min-width: 0; }
.cp-pw { display: flex; align-items: flex-end; gap: 10px; padding-bottom: 18px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.cp-pw label { flex: 1; }
.cp-vis { display: flex; align-items: center; gap: 10px; padding-bottom: 18px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.cp-vis .vis-state { flex: 1; font-size: 13px; font-weight: 700; color: var(--ink2); }
.icon-btn {
  flex-shrink: 0; width: 38px; height: 38px; border-radius: var(--r-sm); cursor: pointer;
  background: transparent; border: 1px solid var(--line2); font-size: 15px; transition: .15s;
}
.icon-btn.danger:hover { background: var(--pen-soft); border-color: var(--pen-soft); }

.topics-block h4 { font-family: var(--serif); margin: 0 0 14px; font-size: 16px; color: var(--ink); font-weight: 700; }

/* 토픽 행 (관리자) — 보더리스 + 차분한 텍스트 액션 */
.topic-row {
  display: flex; align-items: center; gap: 14px; padding: 14px 8px;
  background: transparent; border: none; border-bottom: 1px solid var(--line);
  transition: background .14s ease;
}
.topic-row:hover { background: var(--card-soft); }
.t-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.t-name-text { font-weight: 700; word-break: break-word; }
.t-meta { font-size: 12.5px; }
.t-actions { flex-shrink: 0; display: flex; gap: 2px; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.t-actions .btn.small { padding: 7px 11px; font-size: 12.5px; }
/* 텍스트 중심 액션 버튼 */
.t-act {
  background: transparent; border: none; cursor: pointer; white-space: nowrap;
  font-family: var(--sans); font-size: 13px; font-weight: 600; color: var(--ink2);
  padding: 6px 9px; border-radius: 8px; transition: background .12s, color .12s;
}
.t-act:hover { background: var(--bg-soft); color: var(--ink); }
.t-act:disabled { opacity: .45; cursor: default; }
.t-act.t-view { color: var(--green); }
.t-act.t-view:hover { background: var(--green-soft); color: var(--green-deep); }
.t-act.t-del { color: var(--ink3); }
.t-act.t-del:hover { background: var(--pen-soft); color: var(--pen); }
/* 토픽 이름 인라인 편집 */
.t-name-edit { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.t-name-edit .t-name-input { width: auto; flex: 1 1 180px; margin-top: 0; padding: 7px 11px; font-size: 14px; }

/* 접이식 (새 항목 추가) */
details.add-topic { border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--card-soft); overflow: hidden; }
details.add-topic > summary {
  cursor: pointer; padding: 14px 16px; font-weight: 700; font-size: 14px; color: var(--green);
  list-style: none; user-select: none; display: flex; align-items: center; gap: 8px; transition: background .12s;
}
details.add-topic > summary::-webkit-details-marker { display: none; }
details.add-topic > summary:hover { background: var(--green-soft); }
details.add-topic[open] > summary { border-bottom: 1px solid var(--line); background: var(--green-soft); }
.add-topic-form { display: flex; flex-direction: column; gap: 13px; padding: 16px; }
.t-info { font-size: 13px; }
.progress { height: 9px; background: var(--line); border-radius: var(--pill); overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: var(--green); transition: width .2s; }

/* ---------- 모바일 ---------- */
@media (max-width: 600px) {
  .wrap { padding: 0 18px; }
  .site-title { font-size: 12.5px; }
  .hero { min-height: clamp(300px, 42vh, 360px); padding: 26px 0; }
  .hero-inner { padding: 0 18px; }
  /* 강의 행: 좁은 화면에서는 설명을 제목 아래로 */
  .course-card-body { flex-direction: column; align-items: flex-start; gap: 2px; }
  .course-card-desc { margin-left: 0; text-align: left; max-width: 100%; }
  .card-title { white-space: normal; }
  .cp-top { flex-wrap: wrap; }
  .cp-fields { grid-template-columns: 1fr; }
  .field-row { gap: 10px; }
  .field-row > label, .field-row > label.narrow, .field-row > label.grow { flex: 1 1 100%; }
  .field-row .btn { width: 100%; }
  /* 토픽 행: 좁은 화면에서는 이름 위, 버튼 아래로 줄바꿈 */
  .topic-row { flex-wrap: wrap; }
  .t-main { flex: 1 1 100%; }
  .t-actions { flex: 1 1 100%; justify-content: flex-start; }
}
