:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-2: #efede6;
  --text: #1d1c1a;
  --muted: #6d6a63;
  --line: #e2dfd6;
  --line-strong: #8f8b82; /* 입력칸 테두리: 배경과 3:1 이상 */
  --on-warn: #ffffff;
  --on-ai: #ffffff;
  --accent: #2f6f5e;
  --accent-text: #ffffff;
  --accent-soft: #e1efe9;
  --warn: #b4472f;
  --warn-soft: #f8e6e0;
  --ai: #5b55b8;
  --ai-soft: #e9e8f8;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(30, 28, 24, 0.06), 0 6px 20px rgba(30, 28, 24, 0.05);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151614;
    --surface: #1f201d;
    --surface-2: #2a2b27;
    --text: #eeece6;
    --muted: #a09d94;
    --line: #34352f;
    --line-strong: #7f8178;
    --on-warn: #2b0f07; /* 어두운 화면에서는 배지 색이 밝아져서 글자를 어둡게 한다 */
    --on-ai: #121030;
    --accent: #6fc3a8;
    --accent-text: #0f1f1a;
    --accent-soft: #1f342d;
    --warn: #f0957d;
    --warn-soft: #3a231d;
    --ai: #7f79d6;
    --ai-soft: #2a2942;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR",
    "Malgun Gothic", "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.55;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
h1, h2, h3, p { margin: 0; }
button, input, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
[hidden] { display: none !important; }

.wrap { max-width: 640px; margin: 0 auto; padding: 0 16px 64px; }

/* ── 공통 요소 ── */
.brand { font-weight: 800; letter-spacing: -0.02em; text-decoration: none; color: var(--text); }
.brand span { color: var(--accent); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 16px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); cursor: pointer; font-weight: 600;
  transition: background 0.15s, transform 0.05s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.06); background: var(--accent); }
.btn.small { min-height: 34px; padding: 0 10px; font-size: 14px; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.input, textarea.input {
  width: 100%; padding: 12px 14px;
  border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--surface);
}
textarea.input { resize: vertical; min-height: 84px; display: block; }
.label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
  font-size: 14px; font-weight: 600; white-space: nowrap;
}

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  padding: 10px 16px; border-radius: 10px;
  background: var(--text); color: var(--bg);
  font-size: 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2); z-index: 50;
  display: flex; align-items: center; gap: 12px;
}
.toast-action {
  flex: none; min-height: 36px; padding: 0 12px; border: 1px solid currentColor; border-radius: 8px;
  background: transparent; color: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
}
.form-error {
  padding: 8px 12px; border-radius: 10px; background: var(--warn-soft); color: var(--warn);
  font-size: 14px; font-weight: 600;
}
.form-hint { margin-top: 8px; font-size: 14px; color: var(--warn); font-weight: 600; }

/* ── 첫 화면 ── */
.hero { padding: 56px 0 28px; }
.hero h1 { font-size: clamp(28px, 7vw, 40px); line-height: 1.2; letter-spacing: -0.03em; }
.hero p { margin-top: 12px; color: var(--muted); font-size: 17px; }
.stack { display: grid; gap: 14px; }
.row { display: flex; gap: 8px; }
.row > .input { flex: 1; min-width: 0; }
.code-input {
  text-transform: uppercase; letter-spacing: 0.3em; text-align: center;
  font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.code-input::placeholder { letter-spacing: 0.1em; font-weight: 500; font-size: 16px; }
.section-title { font-size: 17px; margin-bottom: 4px; }

/* ── 처음 화면: 캐릭터와 문구 ── */
.landing-hero { padding-top: 40px; }
/* 캐릭터 그림의 바탕이 흰색이라, 어두운 화면에서도 이 상자는 흰 바탕과 어두운 글자를 유지한다 */
.catch {
  display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1fr); align-items: center; gap: 8px 20px;
  margin-top: 18px; padding: 20px 28px;
  background: #fff; color: #1d1c1a; border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow);
}
.catch img { display: block; width: 100%; height: auto; }
.landing-hero .catch-phrase { display: grid; gap: 4px; font-size: clamp(19px, 3.3vw, 27px); line-height: 1.25; letter-spacing: -0.03em; white-space: nowrap; }
.catch-phrase span { font-weight: 700; }
.catch-phrase strong { font-size: 1.75em; font-weight: 800; color: #1a62b8; }
.landing-hero > p { margin-top: 16px; }
@media (max-width: 520px) {
  .catch { grid-template-columns: 1fr; padding: 16px 20px 22px; text-align: center; }
  .catch picture { max-width: 280px; margin: 0 auto; }
  .landing-hero .catch-phrase { font-size: clamp(20px, 6.6vw, 26px); }
}

/* ── 처음 화면: 학생 / 교수자 고르기 ── */
.who { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.who-card {
  display: grid; justify-items: center; gap: 8px; padding: 32px 16px 28px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow);
  color: var(--text); text-decoration: none; text-align: center;
  transition: transform 0.12s, border-color 0.12s, box-shadow 0.12s;
}
.who-card:hover, .who-card:focus-visible {
  transform: translateY(-3px); border-color: var(--accent);
  box-shadow: 0 10px 28px rgba(30, 28, 24, 0.12);
}
.who-icon {
  display: grid; place-items: center; width: 132px; height: 132px; margin-bottom: 6px;
  border-radius: 50%; background: var(--accent-soft); font-size: 76px; line-height: 1;
}
.who-title { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
.who-desc { font-size: 15px; color: var(--muted); }
/* 관리자는 덜 쓰는 입구라 아래에 낮은 카드로 둔다 */
.who-card.wide { grid-column: 1 / -1; grid-template-columns: auto 1fr; justify-items: start; text-align: left; column-gap: 16px; padding: 16px 20px; }
.who-card.wide .who-icon { grid-row: span 2; width: 64px; height: 64px; font-size: 36px; margin: 0; background: var(--surface-2); }
.who-card.wide .who-title { align-self: end; font-size: 20px; }
.who-card.wide .who-desc { align-self: start; }
@media (max-width: 520px) {
  .who { grid-template-columns: 1fr; }
  .who-card { grid-template-columns: auto 1fr; justify-items: start; text-align: left; column-gap: 16px; padding: 20px; }
  .who-icon { grid-row: span 2; width: 84px; height: 84px; font-size: 48px; margin: 0; }
  .who-title { align-self: end; }
  .who-desc { align-self: start; }
}
.hero.compact { padding: 32px 0 20px; }
.hero.compact h1 { margin-top: 14px; font-size: clamp(24px, 6vw, 32px); }
.hero.compact p { margin-top: 6px; font-size: 14px; }

/* ── 학생 보드 ── */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 640px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.room-title { font-size: 17px; font-weight: 700; line-height: 1.3; }
.room-sub { font-size: 13px; color: var(--muted); }

.composer { margin-top: 16px; }
.composer-top { display: flex; gap: 10px; align-items: flex-start; }
.composer-top .input { flex: 1; min-width: 0; min-height: 64px; resize: none; overflow: hidden; }
.composer-foot { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.composer-foot .spacer { flex: 1; }
.composer-foot #submit { margin-left: auto; } /* 좁은 화면에서 줄이 바뀌어도 오른쪽에 */
.counter { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.anon-note { margin-top: 10px; font-size: 13px; color: var(--muted); }

.list-head { display: flex; align-items: center; justify-content: space-between; margin: 28px 0 10px; }
.list-head h2 { font-size: 17px; }
.tabs { display: inline-flex; padding: 3px; background: var(--surface-2); border-radius: 10px; }
.tab {
  border: 0; background: transparent; min-height: 40px; padding: 6px 12px; border-radius: 8px;
  font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer;
}
.tab[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* ── 학생 화면 배치: 넓으면 오른쪽에 사이드메뉴, 좁으면 작성창 아래 ── */
body.room { --page-w: 980px; }
body.room .topbar-inner { max-width: var(--page-w); }
.room-layout {
  max-width: var(--page-w); margin: 0 auto; padding: 0 16px 64px;
  display: grid; gap: 0 20px;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "composer" "side" "feed";
}
.room-layout > .composer { grid-area: composer; }
.closed-note { grid-column: 1 / -1; margin-top: 16px; background: var(--warn-soft); color: var(--warn); font-weight: 600; }
.room-side { grid-area: side; margin-top: 12px; display: grid; gap: 12px; align-content: start; }
.room-feed { grid-area: feed; min-width: 0; }
.side-title { font-size: 15px; }
.stats.two { grid-template-columns: 1fr 1fr; }
.room-side details > summary {
  cursor: pointer; min-height: 40px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  list-style: none;
}
.room-side details > summary::-webkit-details-marker { display: none; }
.room-side details > summary::after { content: "▾"; margin-left: auto; color: var(--muted); }
.room-side details[open] > summary::after { content: "▴"; }
.side-line { font-size: 14px; color: var(--muted); }
.room-side details > * + * { margin-top: 12px; }
.room-side details .rank + .rank, .room-side details .badge-shelf + .rank { margin-top: 14px; }
.rank li.me { font-weight: 700; }
.rank-name .badge { margin-left: 6px; }
@media (min-width: 900px) {
  .room-layout {
    grid-template-columns: minmax(0, 1fr) 280px;
    grid-template-areas: "composer side" "feed side";
    grid-template-rows: auto 1fr;
  }
  .room-side { margin-top: 16px; position: sticky; top: 76px; align-self: start; }
  /* 넓은 화면에서는 항상 펼쳐 두므로 접는 표시와 한 줄 요약을 감춘다 */
  .room-side details > summary { pointer-events: none; min-height: 0; }
  .room-side details > summary::after, .side-line { display: none; }
}

/* ── 피드 ── */
.more { display: flex; width: 100%; margin-top: 12px; }
.host-main .more { max-width: 860px; }
.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.post {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px 6px;
}
.post.is-hidden { border-style: dashed; opacity: 0.6; }
.post-head { display: flex; align-items: center; gap: 10px; }
.post-who { flex: 1; min-width: 0; }
.name-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.name { font-weight: 700; font-size: 15px; }
.time { font-size: 13px; color: var(--muted); }
.post-text { margin-top: 10px; font-size: 16px; white-space: pre-wrap; }
.post-stats {
  display: flex; align-items: center; gap: 8px; margin-top: 10px;
  font-size: 14px; color: var(--muted);
}
.post-stats .spacer { flex: 1; }
.post-actions {
  display: flex; flex-wrap: wrap; gap: 2px; margin-top: 8px; padding: 4px 0;
  border-top: 1px solid var(--line);
}
.action {
  flex: 1 1 auto; min-height: 40px; padding: 0 10px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 8px; background: transparent; cursor: pointer;
  font-size: 14px; font-weight: 600; color: var(--muted); white-space: nowrap;
}
.action:hover { background: var(--surface-2); color: var(--text); }
.action[aria-pressed="true"] { color: var(--accent); }
.action.manage { flex: 0 1 auto; font-weight: 500; }

.avatar {
  flex: none; width: 40px; height: 40px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 22px; line-height: 1; background: hsl(var(--h) 60% 87%);
}
.avatar.small { width: 30px; height: 30px; font-size: 16px; }
.avatar.host { background: var(--accent-soft); }
.avatar.ai { background: var(--ai-soft); }
@media (prefers-color-scheme: dark) {
  .avatar { background: hsl(var(--h) 30% 28%); }
}

.badge { padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.badge.done, .badge.host { background: var(--accent-soft); color: var(--accent); }
.badge.mine { background: var(--surface-2); color: var(--text); }
.badge.off { background: var(--warn-soft); color: var(--warn); }
.link-btn {
  border: 0; background: none; padding: 0; cursor: pointer;
  color: var(--muted); font-size: 13px; font-weight: 600;
}
.link-btn:hover { text-decoration: underline; }
.link-btn.like[aria-pressed="true"] { color: var(--accent); }

.comments { display: grid; gap: 8px; padding: 10px 0; border-top: 1px solid var(--line); }
.comment-list { display: grid; gap: 8px; }
.comment-list > .link-btn { justify-self: start; }
.comment-list:empty, .comment-form-slot:empty, .ai-slot:empty, .thumb-slot:empty { display: none; }
.hidden-note {
  margin-top: 10px; padding: 8px 12px; border-radius: 10px;
  background: var(--warn-soft); color: var(--warn); font-size: 14px;
}
.post.is-hidden .post-top { padding-bottom: 10px; }
/* 댓글 아래의 작은 버튼들: 손가락으로 누르기 쉽게 높이를 넉넉히, 삭제는 좋아요에서 멀리 */
.comment-meta .link-btn, .post-stats .link-btn, .comment-list > .link-btn {
  min-height: 40px; padding: 0 8px; display: inline-flex; align-items: center;
}
.comment-meta .spacer { flex: 1; }
.edit-form { display: grid; gap: 8px; margin-top: 10px; }
.bubble .edit-form { margin-top: 6px; min-width: min(60vw, 420px); }
.edit-box { min-height: 44px !important; resize: none !important; overflow: hidden; }
.edit-foot { display: flex; justify-content: flex-end; gap: 8px; }
.post-text, .comment-text { tab-size: 4; }
.comment { display: flex; gap: 8px; align-items: flex-start; }
.comment-main { min-width: 0; }
.bubble { display: inline-block; max-width: 100%; padding: 8px 12px; border-radius: 14px; background: var(--surface-2); }
.bubble.host { background: var(--accent-soft); }
.bubble.ai { background: var(--ai-soft); }
.ai-note { margin-top: 6px; font-size: 12px; color: var(--muted); }
/* 진행자가 검토 중인 AI 초안 (학생에게는 보이지 않음) */
.ai-draft {
  display: grid; gap: 8px; margin: 4px 0 10px; padding: 12px;
  border: 1px dashed var(--ai); border-radius: 12px; background: var(--ai-soft);
}
.ai-draft-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.ai-draft-text { min-height: 120px; resize: vertical; font-size: 15px; line-height: 1.6; }
.ai-draft-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ai-draft-foot .spacer { flex: 1; }
.host-layout.present .ai-draft { display: none; }
.badge.ai { background: var(--ai); color: var(--on-ai); }
.action:disabled { opacity: 0.6; cursor: progress; }
.bubble .name { font-size: 13px; }
.comment-text { font-size: 15px; white-space: pre-wrap; }
.comment-meta { display: flex; align-items: center; gap: 4px; padding: 0 4px 0 12px; font-size: 13px; color: var(--muted); }
.comment-form { display: grid; gap: 6px; }
.comment-row { display: flex; gap: 6px; align-items: flex-end; }
.icon-btn {
  flex: none; width: 38px; height: 38px; border: 0; border-radius: 50%;
  background: transparent; font-size: 18px; cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); }

/* 첨부 이미지 */
.images { display: grid; gap: 4px; margin-top: 10px; border-radius: 12px; overflow: hidden; }
.images.n2, .images.n3, .images.n4 { grid-template-columns: 1fr 1fr; }
.images.n3 a:first-child { grid-column: 1 / -1; }
.images a { display: block; background: var(--surface-2); }
/* 한 장: 세로로 긴 화면 캡처도 읽을 수 있게 넉넉한 높이까지. 여러 장: 잘라 내지 않고 칸 안에 전체가 보이게 */
.images img { display: block; width: 100%; max-height: min(85vh, 760px); object-fit: contain; }
.images.n2 img, .images.n3 img, .images.n4 img { height: 100%; aspect-ratio: 4 / 3; object-fit: contain; }
.images.n3 a:first-child img { aspect-ratio: 2 / 1; }
.comment-main .images { max-width: 280px; margin-top: 6px; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.comment-form .thumbs { margin-top: 0; }
.thumb { position: relative; display: inline-block; }
.thumb img {
  display: block; width: 72px; height: 72px; object-fit: cover;
  border-radius: 10px; border: 1px solid var(--line);
}
.thumb button {
  position: absolute; top: -10px; right: -10px; width: 36px; height: 36px; padding: 0;
  border: 3px solid var(--surface) !important; /* 보이는 크기는 작게, 누르는 영역은 크게 */
  border: 0; border-radius: 50%; background: var(--text); color: var(--bg);
  font-size: 12px; line-height: 1; cursor: pointer;
}
.comment-input {
  flex: 1; min-width: 0; min-height: 38px !important; padding: 8px 12px !important;
  border-radius: 18px !important; resize: none !important; overflow: hidden; background: var(--surface-2) !important;
}

.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty strong { display: block; color: var(--text); font-size: 17px; margin-bottom: 4px; }

/* ── 내가 만든 방 목록 ── */
.prof-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.room-info { display: grid; min-width: 0; }
.room-info a { font-weight: 600; }
.room-list { display: grid; gap: 2px; margin: 10px 0; }
.room-row { display: flex; align-items: center; gap: 10px; padding: 6px 4px; border-radius: 8px; cursor: pointer; }
.room-row:hover { background: var(--surface-2); }
.room-row input { width: 18px; height: 18px; flex: none; accent-color: var(--warn); }
.btn.danger { color: var(--warn); border-color: var(--warn); }
.btn.danger:hover { background: var(--warn-soft); }

/* ── 수강생 명단 · 로그인 ── */
.roster-pick { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.roster-pick input[type="file"] { width: 100%; margin-bottom: 8px; font-size: 14px; }
.roster-summary { margin: 10px 0 8px; font-weight: 600; }
.roster-scroll { max-height: 220px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; }
.roster-scroll.tall { max-height: min(50vh, 420px); margin-bottom: 0; }
.roster-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.roster-table th, .roster-table td { padding: 6px 10px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.roster-table th { position: sticky; top: 0; background: var(--surface-2); font-weight: 600; }
.roster-table td.num { font-variant-numeric: tabular-nums; }
.roster-table tr:last-child td { border-bottom: 0; }
.roster-table td.nick { font-weight: 600; }
.roster-table td.count { text-align: right; font-weight: 700; }
.roster-table td.count.zero { font-weight: 400; color: var(--muted); }

.gate { padding-top: 24px; }
.gate .card { max-width: 420px; margin: 0 auto; }
button.chip { border: 0; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
button.chip:disabled { cursor: default; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.chip.pick { padding: 8px 14px; border: 1px solid transparent; }
.chip.pick[aria-pressed="true"] { border-color: var(--accent); }

.dialog {
  width: min(420px, calc(100vw - 32px)); padding: 20px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
}
.dialog.wide { width: min(940px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgba(0, 0, 0, 0.45); }

/* ── 알림 ── */
.topbar-right { display: flex; align-items: center; gap: 8px; min-width: 0; }
.topbar-right .chip { overflow: hidden; text-overflow: ellipsis; min-height: 40px; }
.chip.menu::after { content: "▾"; flex: none; }
.chip.menu:hover { filter: brightness(0.96); }
.side-head { display: flex; align-items: center; justify-content: space-between; }
.bell {
  position: relative; flex: none; width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 50%; background: var(--surface);
  font-size: 18px; cursor: pointer;
}
.bell:hover { background: var(--surface-2); }
.bell-badge {
  position: absolute; top: -4px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px; background: var(--warn); color: var(--on-warn);
  font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums;
  border: 2px solid var(--bg);
}
.notif-panel {
  position: fixed; top: 62px; z-index: 40;
  width: min(380px, calc(100vw - 24px)); max-height: min(70vh, 560px); overflow: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.18); padding: 6px;
}
.notif-panel.right { right: max(12px, calc((100vw - var(--page-w, 640px)) / 2)); }
.notif-panel.left { left: 20px; top: 70px; }
.notif-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; }
.notif-item {
  width: 100%; display: flex; gap: 10px; align-items: flex-start; text-align: left;
  padding: 10px; border: 0; border-radius: 10px; background: transparent; cursor: pointer;
}
.notif-item:hover { background: var(--surface-2); }
.notif-item.unread { background: var(--accent-soft); }
.notif-body { display: grid; gap: 1px; min-width: 0; }
.notif-title { font-size: 14px; font-weight: 700; }
.notif-text { font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-time { font-size: 12px; color: var(--muted); }
.notif-empty { padding: 20px 12px; font-size: 14px; color: var(--muted); text-align: center; }
.post.flash { outline: 3px solid var(--accent); outline-offset: 2px; }
@media (max-width: 820px) {
  .notif-panel.left { left: 12px; }
}

/* ── 진행자 화면 ── */
.host-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); min-height: 100vh; }
.host-side {
  position: sticky; top: 0; align-self: start; height: 100vh; overflow: auto;
  padding: 24px 20px; border-right: 1px solid var(--line); background: var(--surface);
  display: flex; flex-direction: column; gap: 16px;
}
.host-side h1 { font-size: 20px; line-height: 1.3; margin-top: 12px; }
.join-box { display: grid; gap: 2px; justify-items: start; }
.join-code { font-size: 30px; font-weight: 800; letter-spacing: 0.14em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.join-url { font-size: 13px; color: var(--muted); margin-bottom: 6px; overflow-wrap: anywhere; }
.host-layout.present .join-code { font-size: 34px; }
.check-row { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check-row input { width: 18px; height: 18px; margin-top: 3px; flex: none; }
.row-actions .link-btn { margin-right: 10px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--surface-2); border-radius: 10px; padding: 8px; text-align: center; }
.stat b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--muted); }
.rank h2 { font-size: 14px; margin-bottom: 6px; }
.rank h2 .muted { font-weight: 500; }
.rank ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.rank ol { grid-template-columns: minmax(0, 1fr); }
.rank li { display: flex; align-items: center; gap: 8px; font-size: 14px; min-width: 0; }
.host-side.no-rank .rank { display: none; }
.side-toggle { display: none; }
.host-layout.present .stats { grid-template-columns: 1fr; }
.host-layout.present .stat { display: flex; align-items: baseline; justify-content: space-between; padding: 6px 10px; }
.host-layout.present #stat-roster, .host-layout.present #rank-toggle { display: none; }
.rank-no { flex: none; width: 16px; text-align: center; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.rank-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-count { flex: none; font-weight: 700; font-variant-numeric: tabular-nums; }
.rank-empty { color: var(--muted); font-size: 13px; }
.host-side .grow { flex: 1; }
.host-main { padding: 24px 28px 64px; min-width: 0; }
.host-main .list-head { margin-top: 0; }
.host-main .feed { max-width: 860px; }
.host-layout.present .feed { max-width: none; }
.host-layout.present .post-text { font-size: clamp(20px, 2vw, 30px); font-weight: 600; line-height: 1.4; }
.host-layout.present .post-stats { font-size: clamp(16px, 1.3vw, 20px); }

.host-layout.present { grid-template-columns: 240px minmax(0, 1fr); }
.host-layout.present .post-actions,
.host-layout.present .comment-form,
.host-layout.present .comment-meta .link-btn,
.host-layout.present .host-only { display: none; }

@media (max-width: 820px) {
  .host-layout, .host-layout.present { grid-template-columns: 1fr; }
  .host-side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 16px; gap: 12px; }
  /* 휴대폰: 수업 코드·랭킹·관리 메뉴는 접어 두고 질문 목록이 바로 보이게 한다 */
  .side-toggle { display: inline-flex; }
  .host-side:not(.open) .side-extra, .host-side .grow { display: none; }
  .host-main { padding: 20px 16px 64px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* 나도 궁금해요 · 배지 */
.action.curious[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); }
.curious-count { font-weight: 600; }
.earned { font-size: 14px; line-height: 1; letter-spacing: 1px; cursor: default; white-space: nowrap; }
.earned-more { margin-left: 3px; font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: 0; }
.badge-shelf { min-width: 0; }
.badge-shelf h2 { font-size: 14px; margin-bottom: 6px; }
.badge-shelf h2 .muted { font-weight: 500; }
.badge-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.badge-chip {
  aspect-ratio: 1; min-height: 40px; padding: 0; border: 1px solid var(--line); border-radius: 12px;
  background: var(--accent-soft); font-size: 20px; line-height: 1; cursor: pointer;
}
.badge-chip.locked { background: var(--surface-2); filter: grayscale(1); opacity: 0.4; }
.badge-chip:hover { border-color: var(--accent); }
#badge-hint { margin-top: 8px; min-height: 2.6em; }
.badge-cell { white-space: nowrap; }

.joined-room { display: flex; align-items: center; gap: 8px; min-height: 40px; }
.badge.new-replies { background: var(--warn); color: var(--on-warn); }
.room-sub .brand { display: inline-block; padding: 8px 0; }
.badge.shadow { background: var(--warn-soft); color: var(--warn); }
.host-main .composer { margin: 0 0 16px; max-width: 860px; }
.host-main .composer .form-error { flex-basis: 100%; order: 9; }
.host-main .composer textarea { min-height: 64px; resize: none; overflow: hidden; }

/* ── 관리자 대시보드 ── */
.wrap.admin { max-width: 1080px; }
.admin-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.wrap.admin .stack { grid-template-columns: minmax(0, 1fr); }
#admin-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 640px) {
  #admin-tiles, .admin-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .day-labels span { white-space: nowrap; }
  .day-labels span:nth-child(even) { visibility: hidden; }
}
.admin-tiles .stat { padding: 14px 10px; }
.admin-tiles .stat b { font-size: 26px; }
.admin-tiles .stat span { font-size: 13px; }
.admin-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th, .admin-table td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.admin-table th { background: var(--surface-2); font-weight: 600; }
.admin-table th button { all: unset; cursor: pointer; font-weight: 600; }
.admin-table th button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.admin-table th[aria-sort] button::after { content: " ▾"; color: var(--accent); }
.admin-table th[aria-sort="ascending"] button::after { content: " ▴"; }
.admin-table td.n, .admin-table th.n { text-align: right; font-variant-numeric: tabular-nums; }
.admin-table td.zero { color: var(--muted); }
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table tbody tr.pick { cursor: pointer; }
.admin-table tbody tr.pick:hover td { background: var(--surface-2); }
.admin-table tbody tr[aria-selected="true"] td { background: var(--accent-soft); }
.admin-table td.title { max-width: 260px; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.admin-table .link-btn { font-weight: 600; }
.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.admin-head .section-title { margin: 0; }
.day-chart { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 4px; align-items: end; height: 150px; }
.day-col { display: flex; flex-direction: column; justify-content: flex-end; height: 100%; min-width: 0; }
.day-col .bar-q { background: var(--accent); border-radius: 3px 3px 0 0; }
.day-col .bar-c { background: var(--ai); margin-top: 2px; }
.day-col .bar-q:only-child, .day-col .bar-c:last-child { border-radius: 3px 3px 0 0; }
.day-col .day-n { font-size: 11px; text-align: center; color: var(--muted); font-variant-numeric: tabular-nums; }
.day-labels { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 4px; margin-top: 4px; font-size: 11px; color: var(--muted); text-align: center; border-top: 1px solid var(--line); padding-top: 4px; }
.day-legend { display: flex; gap: 14px; font-size: 13px; color: var(--muted); }
.day-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; }
.day-legend .lq { background: var(--accent); }
.day-legend .lc { background: var(--ai); }
