/* ===================================================
   polish.css — UI 다듬기 레이어 (2026-11)
   style.css 뒤에 불러온다. 색·분위기는 gyomu.css(교무수첩 테마)가 맡고, 여기서는
   읽기 쉬움·일관성·눌림 상태만 정리한다. 이 파일의 <link> 를 빼면 이전 모습으로 돌아간다.

   1. 토큰            5. 본문(작성 글) 표시     9. 필기·강의 뷰어
   2. 버튼·포커스      6. 카드·목록·탭          10. 생기부
   3. 입력창           7. 댓글·채팅             11. 토스트·빈 화면
   4. 모달·에디터      8. 파일 첨부             12. 모바일·접근성
   =================================================== */

/* ── 1. 토큰 ─────────────────────────────────────── */
:root {
  --pl-accent: #4f46e5;
  --pl-accent-soft: rgba(99, 102, 241, .16);
  --pl-ring: 0 0 0 3px rgba(99, 102, 241, .22);
  --pl-line: rgba(148, 163, 184, .38);
  --pl-line-soft: rgba(148, 163, 184, .24);
  --pl-field: rgba(255, 255, 255, .92);
  --pl-field-hover: #fff;
  --pl-surface: #fbfdff;
  --pl-surface-2: rgba(248, 250, 252, .9);
  --pl-text: #1e293b;
  --pl-text-2: #475569;
  --pl-text-3: #76839a;
  --pl-radius: 12px;
  --pl-shadow-1: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 1px rgba(15, 23, 42, .04);
  --pl-shadow-2: 0 6px 16px rgba(15, 23, 42, .10), 0 2px 4px rgba(15, 23, 42, .05);
  --pl-shadow-modal: 0 24px 64px rgba(15, 23, 42, .26), 0 8px 20px rgba(15, 23, 42, .10);
}
html.dark {
  --pl-accent: var(--ck-yellow-2);
  --pl-accent-soft: rgba(200, 168, 78, .18);
  --pl-ring: 0 0 0 3px rgba(200, 168, 78, .26);
  --pl-line: rgba(200, 168, 78, .26);
  --pl-line-soft: rgba(200, 168, 78, .14);
  --pl-field: rgba(18, 21, 14, .55);
  --pl-field-hover: rgba(18, 21, 14, .7);
  --pl-surface: #232a1a;
  --pl-surface-2: rgba(255, 255, 255, .04);
  --pl-text: #e6e1cd;
  --pl-text-2: var(--ck-3);
  --pl-text-3: var(--ck-4);
  --pl-shadow-1: 0 1px 2px rgba(0, 0, 0, .3);
  --pl-shadow-2: 0 6px 16px rgba(0, 0, 0, .38);
  --pl-shadow-modal: 0 24px 64px rgba(0, 0, 0, .6), 0 8px 20px rgba(0, 0, 0, .35);
}

/* 작은 보조 글씨: 회색이 너무 옅어 읽기 어려웠다 (대비 2.5:1 → 4:1 안팎) */
html:not(.dark) .text-gray-400 { color: var(--pl-text-3); }
html:not(.dark) .text-gray-300 { color: #a3adbd; }

/* 키보드로 이동할 때 어디에 있는지 보이게 */
:where(button, a, [role="button"], input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--pl-accent);
  outline-offset: 2px;
}
:where(input, select, textarea):focus-visible { outline: none; }
select { cursor: pointer; }
html:not(.dark) input::placeholder,
html:not(.dark) textarea::placeholder { color: #94a3b8; }

input[type=checkbox], input[type=radio] { accent-color: var(--pl-accent); cursor: pointer; }
input:disabled, select:disabled, textarea:disabled { opacity: .6; cursor: not-allowed; }

/* 모달 안 라벨 */
#modal-body label.block,
#auth-screen label.block { color: var(--pl-text-2); letter-spacing: -.005em; }
#modal-box > div:first-child { padding: 18px 24px 14px; border-bottom-color: var(--pl-line-soft); }
#modal-title { font-size: 1.0625rem; font-weight: 700; letter-spacing: -.01em; color: var(--pl-text); }
#modal-body { padding: 20px 24px; scrollbar-gutter: stable; overscroll-behavior: contain; }
#modal-box [data-action="close-modal"] {
  width: 32px; height: 32px; border-radius: 10px; color: var(--pl-text-3);
  transition: background-color .15s ease, color .15s ease;
}
#modal-box [data-action="close-modal"]:hover { background: var(--pl-accent-soft); color: var(--pl-text); }

/* 저장·취소 줄은 긴 양식에서도 항상 보이게 아래에 붙인다 (modal.js 가 .pl-modal-actions 표시) */
#modal-body .pl-modal-actions {
  position: sticky;
  bottom: -20px;
  z-index: 5;
  display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 10px;
  margin: 20px -24px -20px !important;
  padding: 14px 24px 18px !important;
  background: linear-gradient(180deg, rgba(251, 253, 255, .88), var(--pl-surface) 40%);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  border-top: 1px solid var(--pl-line-soft) !important;
}
html.dark #modal-body .pl-modal-actions {
  background: linear-gradient(180deg, rgba(35, 42, 26, .88), var(--pl-surface) 40%);
}
/* footerHTML 을 감싼 줄은 안쪽 버튼 줄이 고정되므로 자체 여백·선을 없앤다 */
#modal-body > div.border-t:last-child:has(.pl-modal-actions) { border-top: 0; padding-top: 0; margin-top: 0; }
#modal-body .pl-modal-actions > button,
#modal-body .pl-modal-actions > a {
  min-height: 40px; min-width: 76px; padding-left: 18px; padding-right: 18px;
  border-radius: 12px; font-weight: 600; flex: 0 0 auto;
  white-space: nowrap; word-break: keep-all;
}
#modal-body .pl-modal-actions > .flex-1 { flex: 1 1 0; }
/* 본문 안 별도 스크롤 상자에 들어 있는 버튼 줄: 고정하지 않고 모양만 맞춘다 */
#modal-body .pl-modal-actions-inline { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 10px; padding-top: 14px; border-top: 1px solid var(--pl-line-soft); }
#modal-body .pl-modal-actions-inline > button { min-height: 40px; min-width: 76px; padding-left: 18px; padding-right: 18px; border-radius: 12px; font-weight: 600; white-space: nowrap; }
/* 모달 안의 이중 스크롤 제거 (모달 본문이 스크롤을 맡는다) */
#modal-body > .relative > .max-h-\[70vh\].overflow-y-auto { max-height: none; overflow: visible; padding-right: 0; }

/* Quill 에디터: 도구 줄을 한 덩어리로, 버튼은 평평하게 */
.ql-toolbar.ql-snow {
  display: flex; flex-wrap: wrap; align-items: center; gap: 2px 0;
  padding: 6px 8px !important;
  background: var(--pl-surface-2) !important;
  border: 1px solid var(--pl-line) !important;
  border-bottom-color: var(--pl-line-soft) !important;
  border-radius: var(--pl-radius) var(--pl-radius) 0 0 !important;
}
.ql-toolbar.ql-snow .ql-formats {
  display: inline-flex; align-items: center; gap: 1px;
  margin: 0 4px 0 0 !important; padding-right: 4px;
  border-right: 1px solid var(--pl-line-soft);
}
.ql-toolbar.ql-snow .ql-formats:last-child { border-right: 0; margin-right: 0 !important; padding-right: 0; }
.ql-snow.ql-toolbar button {
  width: 28px; height: 28px; padding: 5px; border-radius: 7px;
  background: transparent; float: none;
  transition: background-color .12s ease;
}
.ql-snow.ql-toolbar button:hover,
.ql-snow.ql-toolbar .ql-picker-label:hover { background: var(--pl-accent-soft) !important; }
.ql-snow.ql-toolbar button.ql-active,
.ql-snow.ql-toolbar .ql-picker-label.ql-active { background: var(--pl-accent-soft) !important; }
.ql-snow.ql-toolbar .ql-picker-label { border-radius: 7px; border-color: transparent !important; }
.ql-snow .ql-picker.ql-size { width: 58px; }
.ql-container.ql-snow {
  border: 1px solid var(--pl-line) !important;
  border-top: 0 !important;
  border-radius: 0 0 var(--pl-radius) var(--pl-radius) !important;
  background: var(--pl-field);
  transition: box-shadow .15s ease, border-color .15s ease;
}
.ql-container.ql-snow:focus-within { border-color: var(--pl-accent) !important; box-shadow: var(--pl-ring); }
.ql-editor { padding: 14px 16px; line-height: 1.75; color: var(--pl-text); }
.ql-editor.ql-blank::before { left: 16px; right: 16px; color: var(--gy-ink-3); }
html.dark .ql-editor { background: transparent; }
/* 에디터를 감싼 상자의 이중 테두리 제거 */
.quill-init-pending, [data-quill-id] { border-color: transparent !important; background: transparent !important; box-shadow: none !important; overflow: visible !important; }
.ql-snow .ql-tooltip { border-radius: 10px; border-color: var(--pl-line); box-shadow: var(--pl-shadow-2); z-index: 20; }

/* ── 5. 본문(작성 글) 표시 ───────────────────────── */
.ql-rendered, .content-body { color: var(--pl-text); line-height: 1.8; font-size: .9375rem; overflow-wrap: anywhere; }
.ql-rendered p, html.dark .ql-rendered p { color: inherit; }
.ql-rendered h1, .ql-rendered h2, .ql-rendered h3 { color: var(--pl-text); letter-spacing: -.01em; line-height: 1.4; margin: 1.1em 0 .45em; }
.ql-rendered h1:first-child, .ql-rendered h2:first-child, .ql-rendered h3:first-child { margin-top: 0; }
.ql-rendered h1 { font-size: 1.35rem; } .ql-rendered h2 { font-size: 1.15rem; } .ql-rendered h3 { font-size: 1.02rem; }
.ql-rendered ul, .ql-rendered ol { padding-left: 1.4rem; margin: .4em 0 .7em; }
.ql-rendered li { margin: .15em 0; }
.ql-rendered a { color: var(--pl-accent); text-decoration: underline; text-underline-offset: 2px; }
.ql-rendered blockquote {
  margin: .8em 0; padding: .55em .9em;
  border-left: 3px solid var(--gy-line);
  background: var(--pl-accent-soft);
  border-radius: 0 10px 10px 0;
  color: var(--pl-text-2);
}
.ql-rendered pre, .ql-rendered pre.ql-syntax, .ql-editor pre.ql-syntax, .ln-lecture-pane pre {
  margin: .8em 0; padding: 12px 14px;
  background: var(--gy-ink) !important; color: var(--gy-line) !important;
  border-radius: 10px; border: 1px solid rgba(148, 163, 184, .2);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .8125rem; line-height: 1.65;
  overflow-x: auto; white-space: pre; tab-size: 2;
}
html.dark .ql-rendered pre, html.dark .ql-rendered pre.ql-syntax, html.dark .ql-editor pre.ql-syntax, html.dark .ln-lecture-pane pre {
  background: rgba(0, 0, 0, .42) !important; color: #e6e1cd !important; border-color: var(--pl-line-soft);
}
.ql-rendered code:not(pre code) {
  padding: .1em .38em; border-radius: 6px; font-size: .86em;
  background: var(--pl-accent-soft); color: var(--pl-text);
}
.ql-rendered img { border-radius: 12px; box-shadow: var(--pl-shadow-1); }
.ql-rendered table { border-collapse: collapse; margin: .8em 0; font-size: .875rem; }
.ql-rendered th, .ql-rendered td { border: 1px solid var(--pl-line); padding: 6px 10px; }
.ql-rendered th { background: var(--pl-surface-2); font-weight: 600; }

/* 펼치는 카드: 머리줄 hover, 펼친 본문 구분선 */
[data-action="toggle-item"] { transition: background-color .15s ease; }
[id^="detail-"] > div.border-t { border-top-color: var(--pl-line-soft) !important; }

/* 제출물 카드: 회색 머리 + 흰 상자 + 댓글이 3겹으로 보이던 것을 한 장으로 */
.submission-card { border: 1px solid var(--pl-line-soft); border-radius: 14px; background: rgba(255, 255, 255, .55); }
html.dark .submission-card { background: rgba(255, 255, 255, .03); }
.submission-card > .bg-gray-50,
html.dark .submission-card > .bg-gray-50 { background: transparent !important; padding-top: 14px; }
html:not(.dark) .submission-card .bg-white.rounded-lg { background: rgba(255, 255, 255, .9); border-color: var(--pl-line-soft); }
.submission-card .ql-snow.mb-4, .submission-card .ql-snow:last-child { margin-bottom: 0; }
.submission-card .comment-section { margin-top: .5rem; padding-top: .9rem; }

/* 수업 탭 */
.tab-btn { border-radius: 10px 10px 0 0; }
html:not(.dark) .tab-btn:hover { background: rgba(255, 255, 255, .45); }
html.dark .tab-btn:hover { background: rgba(255, 255, 255, .04); }

/* 알약 배지 줄맞춤 */
.record-tag-badge { letter-spacing: -.01em; }
.badge-edited { color: var(--pl-text-3); }

/* ── 7. 댓글·채팅 ────────────────────────────────── */
.comment-section { border-top-color: var(--pl-line-soft); }
.comment-section h5 { color: var(--pl-text-2); text-transform: none; letter-spacing: 0; font-size: .78rem; }
.comment-bubble,
.comment-bubble.teacher-bubble {
  border: 1px solid var(--pl-line-soft);
  border-radius: 4px 14px 14px 14px;
  padding: 9px 13px;
}
html:not(.dark) .comment-bubble { background: rgba(241, 245, 249, .85); }
html:not(.dark) .comment-bubble.teacher-bubble { background: rgba(238, 242, 255, .95); border-color: rgba(99, 102, 241, .18); }
.comment-bubble p { color: var(--pl-text); }
/* 좋아요·답글·수정·삭제: 누를 자리를 넓히고, 눌리는 곳임을 hover 로 알린다 */
.comment-bubble + .flex { gap: 2px; margin-top: 4px; margin-left: -5px; }
[data-action="react-comment"],
[data-action="toggle-reply-box"],
[data-action="start-edit-comment"],
[data-action="delete-comment"] {
  padding: 3px 7px; border-radius: 7px; line-height: 1.3;
  transition: background-color .12s ease, color .12s ease;
}
[data-action="react-comment"]:hover,
[data-action="toggle-reply-box"]:hover,
[data-action="start-edit-comment"]:hover { background: var(--pl-accent-soft); }
[data-action="delete-comment"]:hover { background: rgba(239, 68, 68, .12); }
.comment-input { min-height: 46px; line-height: 1.55; }
.btn-comment-submit { padding: .42rem 1rem; border-radius: 10px; }
html:not(.dark) .chat-header { background: rgba(255, 255, 255, .6); border-bottom-color: var(--pl-line-soft); }
html:not(.dark) .chat-bubble-other { background: #fff; border: 1px solid var(--pl-line-soft); color: var(--pl-text); }
.chat-bubble { line-height: 1.55; }
.chat-bubble-mine { background: linear-gradient(135deg, var(--gy-accent), var(--gy-accent)); box-shadow: 0 2px 6px rgba(44, 62, 158, .22); }
html.dark .chat-bubble-mine { background: var(--ck-2); color: var(--gy-on-ink); box-shadow: none; }
html:not(.dark) .chat-input-row { background: rgba(255, 255, 255, .7); border-top-color: var(--pl-line-soft); }
.chat-send-btn { border-radius: 20px; background: linear-gradient(135deg, var(--gy-accent), var(--gy-accent)); }
html.dark .chat-send-btn { background: var(--ck-2); }
.chat-send-btn:hover { opacity: 1; filter: brightness(1.06); }
.chat-meta { color: var(--pl-text-3); }

/* ── 8. 파일 첨부 ────────────────────────────────── */
.drop-zone {
  border-width: 1.5px !important;
  border-color: var(--pl-line) !important;
  background: var(--pl-surface-2);
  border-radius: 14px;
}
.drop-zone:hover { border-color: rgba(44, 62, 158, .5) !important; }
html.dark .drop-zone:hover { border-color: rgba(200, 168, 78, .5) !important; }
.drop-zone.drag-active { background: var(--pl-accent-soft) !important; border-color: var(--pl-accent) !important; }
.drop-zone .drop-hint { color: var(--pl-text-3); }

/* 기본 파일 선택창도 같은 모양의 점선 상자로 */
html body input[type=file]:not(.hidden) {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px dashed var(--pl-line) !important;
  border-radius: 12px;
  background: var(--pl-surface-2) !important;
  box-shadow: none !important;
  font-size: .8125rem;
  color: var(--pl-text-2);
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease;
}
html body input[type=file]:not(.hidden):hover { border-color: var(--pl-accent) !important; }
input[type=file]::file-selector-button {
  margin-right: 12px; padding: 6px 14px;
  border: 1px solid rgba(44, 62, 158, .28); border-radius: 9px;
  background: var(--gy-accent-soft); color: var(--gy-accent);
  font-weight: 600; font-size: .8125rem; cursor: pointer;
  transition: background-color .15s ease;
}
input[type=file]::file-selector-button:hover { background: var(--gy-accent-soft); }
html.dark input[type=file]::file-selector-button { background: rgba(200, 168, 78, .16); color: var(--ck-yellow); border-color: rgba(200, 168, 78, .35); }

/* 올릴 파일 목록 */
[id$="files-list"] > div {
  padding: 7px 10px; border-radius: 10px;
  background: var(--pl-surface-2) !important;
  border-color: var(--pl-line-soft) !important;
  color: var(--pl-text-2);
}
[id$="files-list"] > div [data-action="remove-queued-file"] {
  width: 22px; height: 22px; border-radius: 6px; color: var(--pl-text-3);
  display: inline-flex; align-items: center; justify-content: center;
}
[id$="files-list"] > div [data-action="remove-queued-file"]:hover { background: rgba(239, 68, 68, .12); color: var(--gy-red); }

.chat-row-mine .chat-avatar { display: none; }  /* 내 말풍선 옆 내 아바타는 군더더기 */
.chat-messages-list { gap: .7rem; }

/* 수업 카드 안 YouTube 미리보기: 카드 폭을 다 채우면 화면을 통째로 차지한다 */
[id^="detail-"] > .yt-wrapper,
[id^="detail-"] .yt-wrapper { max-width: 720px; padding-bottom: min(56.25%, 405px); margin-left: auto; margin-right: auto; }
.yt-wrapper .yt-overlay { background: linear-gradient(180deg, rgba(0, 0, 0, .05), rgba(0, 0, 0, .38)); }
.yt-label { color: rgba(255, 255, 255, .9); font-size: .75rem; }

/* ── 9. 필기·강의 뷰어 ───────────────────────────── */
.ln-bar { gap: 8px; padding: 8px 12px; border-bottom-color: var(--pl-line-soft); }
.ln-bar-title { font-size: 15px; letter-spacing: -.01em; }
.ln-bar-btn { border-color: var(--pl-line-soft); border-radius: 10px; }
.ln-pane-lecture { padding: 22px 26px 64px; }
.ln-pane-lecture > :is(h1, h2):first-child { letter-spacing: -.015em; }

/* 도구줄: 두 줄로 나눠 "무엇으로 쓸지 / 어떻게 쓸지" 를 구분한다 */
.ln-pane-scribble { container-type: inline-size; }
.ln-scribble-toolbar {
  gap: 2px; row-gap: 4px; padding: 6px 10px;
  border-bottom-color: var(--pl-line-soft);
  box-shadow: 0 1px 0 rgba(15, 23, 42, .02);
}
.ln-scribble-toolbar .ln-bar-group { gap: 2px; }
#ln-colors { gap: 7px; padding: 0 4px; }
.ln-tool { width: 34px; height: 34px; border-radius: 9px; font-size: 16px; }
.ln-tool:hover { background: var(--pl-accent-soft); }
.ln-tool.is-active {
  background: var(--pl-accent-soft);
  border-color: var(--pl-accent);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .6);
}
.ln-tool:disabled { opacity: .35; }
.ln-tool-sep { height: 20px; margin: 0 5px; background: var(--pl-line); }
.ln-tool[data-act="zoomreset"] { width: auto; min-width: 46px; padding: 0 6px; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--pl-text-2); }
.ln-toggle { padding: 4px 6px 4px 2px; border-radius: 9px; }
.ln-save-status { font-size: 11.5px; color: var(--pl-text-3); padding: 0 4px 0 8px; }
.ln-save-status.is-saved::before { content: '✓ '; }
@container (max-width: 1010px) {
  /* 색상 앞 구분선을 줄바꿈으로 쓴다 */
  .ln-scribble-toolbar .ln-tool-sep:has(+ #ln-colors) { flex-basis: 100%; height: 0; margin: 0; background: transparent; order: 2; }
  /* 윗줄: 도구 + 확대/축소,  아랫줄: 색·굵기·배경·되돌리기 */
  #ln-tb #ln-colors, #ln-tb #ln-colors ~ * { order: 3; }
  #ln-tb #ln-colors ~ [data-act^="zoom"], #ln-tb #ln-colors ~ .ln-tool-sep:has(+ [data-act="zoomout"]) { order: 1; }
}
/* 색상: 전역 버튼 그림자에 선택 표시가 지워지던 문제 */
html body button.ln-swatch {
  width: 22px; height: 22px;
  border: 0;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, .18) !important;
  transform: none !important;
  transition: box-shadow .12s ease;
}
html body button.ln-swatch:hover { box-shadow: 0 0 0 2px #fff, 0 0 0 3px rgba(15, 23, 42, .28) !important; }
html body button.ln-swatch.is-active { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--pl-accent) !important; }

/* 메모 패널 */
.ln-pane-memo .ql-toolbar.ql-snow { border: 0 !important; border-bottom: 1px solid var(--pl-line-soft) !important; border-radius: 0; background: var(--pl-surface) !important; }
.ln-pane-memo .ql-container.ql-snow { border: 0 !important; border-radius: 0; background: transparent; box-shadow: none !important; }
.ln-memo-foot { border-top-color: var(--pl-line-soft); }

/* 다크: 뷰어만 남색 계열이던 것을 사이트의 올리브 톤으로 */
html.dark .ln-viewer { background: var(--bd-0); }
html.dark .ln-bar, html.dark .ln-scribble-toolbar, html.dark .ln-mobile-tabs, html.dark .ln-mobile-tabs button { background: #232a1a; border-color: var(--bd-line-2); color: var(--ck-2); }
html.dark .ln-bar-title { color: #e6e1cd; }
html.dark .ln-bar-btn { background: rgba(255, 255, 255, .04); border-color: var(--bd-line-2); color: #cfc9ae; }
html.dark .ln-bar-btn:hover, html.dark .ln-bar-btn.is-active { background: rgba(200, 168, 78, .16); color: var(--ck-yellow); border-color: rgba(200, 168, 78, .4); }
html.dark .ln-pane-lecture { background: var(--bd-2); color: #e6e1cd; }
html.dark .ln-pane-scribble, html.dark .ln-pane-memo { background: var(--bd-0); border-color: var(--bd-line-2); }
html.dark .ln-tool { color: #cfc9ae; }
html.dark .ln-resizer { background: var(--bd-5); }
html.dark .ln-resizer-grip { background: var(--ck-5); }
html.dark .ln-toggle.is-on .ln-toggle-track { background: var(--ck-yellow-2); }
html.dark .ln-toggle.is-on .ln-toggle-label { color: var(--ck-yellow); }
html.dark .ln-width-dot { color: #cfc9ae; }

/* ── 10. 생기부 ──────────────────────────────────── */
/* AI 설정: 검은 통짜 막대 대신 조용한 설정 줄 (누르면 펼쳐짐) */
.sg-ai-toggle {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--pl-line-soft); border-radius: 14px;
  background: rgba(255, 255, 255, .6);
  color: var(--pl-text); font-size: .8125rem; text-align: left;
  transition: background-color .15s ease, border-color .15s ease;
}
html.dark .sg-ai-toggle { background: rgba(255, 255, 255, .04); }
.sg-ai-toggle:hover { background: rgba(255, 255, 255, .85); border-color: var(--pl-line); }
html.dark .sg-ai-toggle:hover { background: rgba(255, 255, 255, .07); }
.sg-ai-toggle__icon { font-size: .95rem; line-height: 1; }
.sg-ai-toggle__label { font-weight: 600; }
.sg-ai-toggle__summary {
  margin-left: 4px; padding: 2px 9px; border-radius: 999px;
  background: var(--pl-accent-soft); color: var(--pl-text-2);
  font-size: .72rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.sg-ai-toggle__chev { width: 16px; height: 16px; margin-left: auto; flex: 0 0 auto; color: var(--pl-text-3); }
.sg-ai-panel label { color: var(--pl-text-2); }

/* 동작 버튼: 이 학생(분석 → 초안 → 생성자료) | 필터 학생 일괄 */
.sg-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px 14px; }
.sg-actions__group { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.sg-actions__group--batch { padding-left: 14px; border-left: 1px solid var(--pl-line); }
.sg-act {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 34px; padding: 6px 12px;
  border: 1px solid var(--pl-line); border-radius: 11px;
  background: rgba(255, 255, 255, .8); color: var(--pl-text-2);
  font-size: .8125rem; font-weight: 600; white-space: nowrap;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.sg-act:hover { background: var(--gy-paper); color: var(--pl-text); }
.sg-act--analyze { background: var(--gy-green-soft); border-color: var(--gy-green-line); color: var(--gy-green); }
.sg-act--analyze:hover { background: var(--gy-green-soft); color: var(--gy-green); }
.sg-act--primary { background: var(--gy-accent); border-color: var(--gy-accent); color: #fff; }
.sg-act--primary:hover { background: var(--gy-accent); border-color: var(--gy-accent); color: #fff; }
.sg-act--quiet { background: transparent; border-color: var(--pl-line-soft); font-weight: 500; font-size: .78rem; min-height: 32px; padding: 5px 10px; }
.sg-act--danger { background: var(--gy-red-soft); border-color: var(--gy-red-line); color: var(--gy-red); }
html.dark .sg-act { background: rgba(255, 255, 255, .05); color: #cfc9ae; }
html.dark .sg-act:hover { background: rgba(255, 255, 255, .09); color: #e6e1cd; }
html.dark .sg-act--analyze { background: rgba(45, 212, 191, .10); border-color: rgba(45, 212, 191, .3); color: #7fd8c9; }
html.dark .sg-act--quiet { background: transparent; }
html.dark .sg-act--danger { background: rgba(239, 68, 68, .12); border-color: rgba(239, 68, 68, .35); color: #f0a0a0; }

/* 관찰 칸: 칸 제목과 빈 칸 안내를 또렷하게 */
#sg-board-slots { padding-right: 6px; scrollbar-width: thin; }
#sg-board-slots > div { border-color: var(--pl-line-soft); background: rgba(255, 255, 255, .5); border-radius: 14px; padding: 12px 14px; }
html.dark #sg-board-slots > div { background: rgba(255, 255, 255, .03); }
#sg-board-slots > div.border-dashed { background: rgba(44, 62, 158, .05); border-color: rgba(44, 62, 158, .3); }
#sg-board-slots > div > div:first-child > p { font-size: .8rem; color: var(--pl-text); }
#sg-board-slots p.italic { font-style: normal; color: var(--pl-text-3); }
#sg-board-slots [data-action="show-sg-manual-modal"] { padding: 3px 9px; border-radius: 8px; font-size: .75rem; }
#sg-board-slots [data-action="show-sg-manual-modal"]:hover { background: rgba(44, 62, 158, .12); }
#sg-board-slots [data-action="edit-sg-obs"], #sg-board-slots [data-action="delete-sg-obs"] { padding: 5px; border-radius: 7px; }
#sg-board-slots [data-action="edit-sg-obs"]:hover { background: var(--pl-accent-soft); }
#sg-board-slots [data-action="delete-sg-obs"]:hover { background: rgba(239, 68, 68, .12); }

/* 학생 목록 */
.sg-student-sidebar { border-right-color: var(--pl-line-soft) !important; }
html:not(.dark) #sg-student-buttons [data-action="select-sg-student"]:hover { background: rgba(255, 255, 255, .7); }

/* 초안 모달 */
#modal-body pre.whitespace-pre-wrap { background: var(--pl-surface-2); border: 1px solid var(--pl-line-soft); border-radius: 10px; padding: 10px 12px; color: var(--pl-text-2); line-height: 1.6; }
#modal-body [data-action="run-sg-generate"], #modal-body [data-action="assemble-sg-draft"] { min-height: 36px; padding: 7px 14px; border-radius: 10px; font-weight: 600; }
#modal-body [data-action="run-sg-generate"]:disabled, #modal-body [data-action="assemble-sg-draft"]:disabled { opacity: .45; }
#sg-draft-results textarea { line-height: 1.7; }

/* ── 11. 토스트·빈 화면 ──────────────────────────── */
#toast-container { bottom: 28px; display: flex; flex-direction: column; align-items: center; gap: 8px; width: max-content; max-width: calc(100vw - 32px); }
#toast-container > * + * { margin-top: 0 !important; }
.toast {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 11px 16px 11px 13px; border-radius: 14px;
  max-width: min(26rem, calc(100vw - 32px));
  text-align: left; line-height: 1.5; letter-spacing: -.005em;
  box-shadow: 0 12px 32px rgba(15, 23, 42, .28), 0 2px 6px rgba(15, 23, 42, .12);
  cursor: pointer;
}
.toast::before {
  content: '✓'; flex: 0 0 auto;
  width: 20px; height: 20px; margin-top: 1px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; line-height: 1;
  background: rgba(255, 255, 255, .2); color: #fff;
}
.toast--success { background: var(--gy-ink) !important; }
.toast--success::before { background: var(--gy-green); }
.toast--error { background: var(--gy-red) !important; }
.toast--error::before { content: '!'; }
.toast--info { background: var(--gy-accent) !important; }
.toast--info::before { content: 'i'; font-family: Georgia, 'Times New Roman', serif; font-style: italic; }
html.dark .toast--success { background: #2f3624 !important; color: #e6e1cd; border: 1px solid #4a5236; }
html.dark .toast--info { background: #6b5a1e !important; color: #fff8e1; }

/* 빈 목록 안내 */
.empty-state, [class*="empty-"] > p { color: var(--pl-text-3); }

/* 카드 위에 올려야만 보이던 관리 버튼: 흐리게라도 항상 보여 준다 (터치 기기·키보드에서는 hover 가 없다) */
.group > * .opacity-0.group-hover\:opacity-100,
.group > .opacity-0.group-hover\:opacity-100 { opacity: .4; }
.group:hover .opacity-0.group-hover\:opacity-100,
.group:focus-within .opacity-0.group-hover\:opacity-100,
.opacity-0.group-hover\:opacity-100:focus-visible { opacity: 1; }
@media (hover: none) { .group .opacity-0.group-hover\:opacity-100 { opacity: .75; } }

/* ── 12. 모바일·접근성 ───────────────────────────── */
@media (max-width: 640px) {
  /* 모달은 전체 화면 (기존 동작) — 본문이 남은 높이를 채워 버튼 줄이 항상 맨 아래에 온다 */
  #modal-backdrop { padding: 0 !important; }
  #modal-box > div:first-child { padding: 14px 16px 12px; }
  #modal-body { flex: 1 1 auto; padding: 16px; }
  #modal-body .pl-modal-actions {
    bottom: -16px;
    margin: 16px -16px -16px !important;
    padding: 12px 16px calc(14px + env(safe-area-inset-bottom)) !important;
  }
  #modal-body .pl-modal-actions > button,
  #modal-body .pl-modal-actions > a { flex: 1 1 0; min-height: 44px; }

  /* 생기부: 버튼 묶음을 줄 단위로 */
  .sg-actions { justify-content: flex-start; width: 100%; }
  .sg-actions__group { width: 100%; }
  .sg-actions__group--batch { padding-left: 0; border-left: 0; padding-top: 8px; border-top: 1px solid var(--pl-line-soft); }
  .sg-act { flex: 1 1 auto; justify-content: center; }
  .sg-ai-toggle__summary { display: none; }

  /* 댓글·채팅 */
  .comment-bubble { padding: 8px 11px; }
  .chat-bubble-wrap { max-width: 82%; }
  .ln-pane-lecture { padding: 16px 16px 56px; }
  #toast-container { bottom: calc(16px + env(safe-area-inset-bottom)); }
}

/* 손가락으로 누르는 기기: 작은 글자 버튼의 누를 자리를 넓힌다, 입력 시 화면이 확대되지 않게 16px */
@media (hover: none) and (pointer: coarse) {
  [data-action="react-comment"],
  [data-action="toggle-reply-box"],
  [data-action="start-edit-comment"],
  [data-action="delete-comment"] { padding: 7px 10px; }
  .comment-bubble + .flex { margin-left: -8px; }
  #sg-board-slots [data-action="show-sg-manual-modal"] { padding: 7px 12px; }
  #sg-board-slots [data-action="edit-sg-obs"], #sg-board-slots [data-action="delete-sg-obs"] { padding: 9px; }
  [id$="files-list"] > div [data-action="remove-queued-file"] { width: 32px; height: 32px; }
}
@media (hover: none) and (pointer: coarse) and (max-width: 640px) {
  html body input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]):not(.stu-grade-input):not(.stu-eval-weight),
  html body select:not(.stu-filter-select),
  html body textarea { font-size: 16px !important; }
}

/* 움직임 줄이기 설정을 켠 사용자 */
@media (prefers-reduced-motion: reduce) {
  .toast, .chat-row { animation: none !important; }
  * { scroll-behavior: auto !important; }
}

/* 고대비 설정 */
@media (prefers-contrast: more) {
  :root { --pl-line: rgba(71, 85, 105, .7); --pl-line-soft: rgba(71, 85, 105, .45); --pl-text-3: #475569; }
  html.dark { --pl-line: rgba(230, 210, 150, .6); --pl-line-soft: rgba(230, 210, 150, .4); --pl-text-3: #cfc9ae; }
}

/* ── 다크 모드 보정 ──────────────────────────────── */
/* 작은 보조 글씨가 배경에 묻히던 문제 (대비 2:1 → 4:1 안팎) */
html.dark .text-gray-400 { color: #948f72 !important; }
html.dark .text-gray-300 { color: #77735a !important; }
html.dark input::placeholder, html.dark textarea::placeholder, html.dark .ql-editor.ql-blank::before { color: #7d7960 !important; }
/* 반투명 파스텔 상자가 다크에서 뿌연 회색으로 뜨던 문제 */
html.dark .bg-indigo-50\/30, html.dark .bg-indigo-50\/40, html.dark .bg-indigo-50\/50,
html.dark .bg-violet-50\/40, html.dark .bg-violet-50\/50,
html.dark .bg-amber-50\/50, html.dark .bg-emerald-50\/50 { background: rgba(200, 168, 78, .06) !important; }
html.dark .bg-gray-50\/80 { background: rgba(255, 255, 255, .04) !important; }
html.dark .bg-white\/60, html.dark .bg-white\/70 { background: rgba(255, 255, 255, .05) !important; }
html.dark .border-violet-100, html.dark .border-violet-200, html.dark .border-indigo-200, html.dark .border-teal-200 { border-color: rgba(200, 168, 78, .26) !important; }
/* 태그 알약: 밝은 파스텔 그대로라 눈이 부셨다 → 채도만 살짝 낮춘다 */
html.dark .record-tag-badge { filter: saturate(.8) brightness(.9); }
html.dark #modal-title { color: var(--ck-1); }
html.dark .comment-bubble p { color: var(--ck-2); }
html.dark [id$="files-list"] > div { color: var(--ck-3); }

/* 휴대폰: 헤더 메뉴(대시보드·수업 목록…)가 폭 0 으로 눌려 사라지던 문제 → 둘째 줄로 내려 가로로 넘겨 본다 */
@media (max-width: 640px) {
  .app-header-inner { flex-wrap: wrap !important; overflow: visible !important; row-gap: 4px; }
  .app-header-inner > .hdr-nav {
    order: 10; flex: 1 0 100%; width: 100%; min-width: 0;
    overflow-x: auto; gap: 2px;
    padding: 4px 2px 2px; margin-top: 2px;
    border-top: 1px solid var(--pl-line-soft);
    -webkit-overflow-scrolling: touch;
  }
  .app-header-inner > .hdr-nav .hdr-nav-btn { font-size: 13px !important; padding: 7px 11px !important; flex: 0 0 auto; }
  .app-header-inner > .hdr-nav .hdr-support-btn { display: inline-flex !important; font-size: 12px !important; }
}
@media (max-width: 480px) {
  /* 꾸밈 설정 버튼은 좁은 화면에서 접어 로그아웃이 잘리지 않게 */
  .app-header-actions .glass-toggle { display: none; }
  .app-header-actions { gap: 3px; }
}
