/* 문제 신고 위젯 전용 — **styles.css 와 따로 있는 이유**: 첫 화면(index.php,
   코드 한 칸)은 styles.css 를 안 쓰고 자기 <style> 만 씁니다. 그런데 코드가 안 되는
   학생이 서 있는 곳이 바로 거기라, 그 화면에도 단추가 있어야 합니다. 사본을 만드는
   대신 파일을 떼어 위젯이 직접 가져갑니다 (lib/bugs.php bug_report_widget).
   --------------------------------------------------------------------------- */
:root { --bug-line: var(--line, #e2e8f0); --bug-muted: var(--muted, #64748b);
        --bug-ink: var(--ink, #0f172a); --bug-red: var(--red, #dc2626); }
/* ===========================================================================
   문제 신고 (2026-09-18, lib/bugs.php)
   ===========================================================================
   강사에게도 학생에게도 연락할 길이 없습니다 — 그래서 화면마다 단추를 답니다.
   <details>/<summary> 로 지어서 **자바스크립트가 없어도** 열리고 보내집니다;
   여기서 하는 일은 열린 상태를 화면 가운데(좁으면 아래 시트)로 세우는 것입니다. */
.bug-wrap { position: fixed; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 58;
  transition: transform .22s ease, opacity .22s ease; }
/* 내려 읽는 동안은 비켜 줍니다 (2026-10-11) — 떠 있는 단추가 휴대폰에서 카드 오른쪽의
   「보기 →」·「마감됨」 글자를 덮고 있었습니다. 위로 조금만 올리거나 맨 아래에 닿으면
   다시 나옵니다(lib/bugs.php 의 스크립트). 열린 상자는 절대 숨기지 않습니다. */
.bug-wrap.is-tucked:not([open]) { transform: translateY(calc(100% + 28px)); opacity: 0; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .bug-wrap { transition: none; } }
.bug-wrap > summary { list-style: none; cursor: pointer; }
.bug-wrap > summary::-webkit-details-marker { display: none; }
.bug-fab { display: inline-flex; align-items: center; gap: 7px; background: #fff; color: var(--bug-muted);
  border: 1px solid var(--bug-line); border-radius: 999px; padding: 9px 14px 9px 12px;
  font-size: .8rem; font-weight: 800; box-shadow: 0 4px 14px rgba(15, 23, 42, .12); }
.bug-fab:hover { color: var(--bug-ink); border-color: var(--bug-muted); }
.bug-fab-ico { display: inline-flex; width: 16px; height: 16px; }
.bug-fab-ico svg { width: 100%; height: 100%; }
/* 열리면 화면을 덮습니다 — details 안에 있어도 자리는 여기서 새로 잡습니다 */
.bug-wrap[open] > .bug-sheet { position: fixed; inset: 0; z-index: 70; display: flex;
  align-items: center; justify-content: center; padding: 16px;
  background: rgba(15, 23, 42, .45); overflow-y: auto; }
.bug-wrap:not([open]) > .bug-sheet { display: none; }
.bug-card { width: 100%; max-width: 480px; background: #fff; border-radius: 16px;
  padding: 16px 16px 14px; box-shadow: 0 24px 60px rgba(15, 23, 42, .3); margin: auto; }
.bug-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.bug-head h2 { margin: 0; flex: 1 1 auto; font-size: 1.02rem; }
.bug-x { flex: none; border: 0; background: none; color: var(--bug-muted); font-size: 1.05rem;
  line-height: 1; padding: 6px; cursor: pointer; }
.bug-x:hover { color: var(--bug-ink); }
.bug-text { width: 100%; resize: vertical; }
.bug-lbl { display: block; margin: 12px 0 6px; }
.bug-drop { border: 1px dashed var(--bug-line); border-radius: 12px; padding: 10px; }
.bug-wrap.is-drag .bug-drop { border-color: var(--bug-red); background: #fff7f7; }
.bug-hint { margin: 8px 0 0; font-size: .76rem; color: var(--bug-muted); }
.bug-thumbs { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 10px 0 0; padding: 0; }
.bug-thumbs li { position: relative; width: 74px; height: 74px; border-radius: 8px; overflow: hidden;
  border: 1px solid var(--bug-line); }
.bug-thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bug-thumb-x { position: absolute; top: 2px; right: 2px; border: 0; border-radius: 999px;
  background: rgba(15, 23, 42, .72); color: #fff; font-size: .7rem; line-height: 1;
  width: 20px; height: 20px; cursor: pointer; }
.bug-auto { margin: 12px 0 0; font-size: .74rem; color: var(--bug-muted); line-height: 1.5; }
.bug-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.bug-flash { margin: 0 0 10px; padding: 9px 11px; border-radius: 10px; background: #ecfdf5;
  color: #047857; font-size: .82rem; font-weight: 700; }
.bug-flash.is-bad { background: #fef2f2; color: var(--bug-red); }
.bug-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* 휴대폰 — 아래에서 올라오는 시트. 단추는 글자를 접고 아이콘만 남깁니다
   (학생 화면 아래쪽에는 제출·탭이 있어서 큰 알약이 그 위를 덮습니다). */
@media (max-width: 560px) {
  .bug-wrap { right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); }
  .bug-fab { padding: 10px; }
  .bug-fab-t { position: absolute; left: -9999px; }
  .bug-wrap[open] > .bug-sheet { align-items: flex-end; padding: 0; }
  .bug-card { max-width: none; border-radius: 16px 16px 0 0; margin: 0;
    padding-bottom: calc(14px + env(safe-area-inset-bottom)); max-height: 92vh; overflow-y: auto; }
  .bug-actions .btn { flex: 1 1 0; }
}
/* 업로드 막대·묵은 화면 띠와 같은 구석이라 서로 비켜 줍니다 */
.up-bar:not([hidden]) ~ .bug-wrap { bottom: calc(76px + env(safe-area-inset-bottom)); }

/* 첫 화면(index.php)은 styles.css 를 안 씁니다 — 위젯 안의 입력칸 · 파일 고르기를 여기서 직접 (2026-10-11).
   없으면 그 화면에서만 13px 고정폭 글자의 칸과 영어 「Choose Files」 가 섰습니다 (iOS 는 16px 보다 작은
   칸을 누르면 화면을 확대하고 되돌리지 않습니다). 다른 화면에서는 styles.css 와 같은 값이라 달라지는 것이 없습니다. */
.bug-card .fld { display: block; width: 100%; box-sizing: border-box; margin: 0; border: 1px solid #cbd5e1; border-radius: 10px;
  padding: 11px 13px; font: inherit; font-size: 16px; color: var(--bug-ink); background: #fff; }
.bug-card .fld:focus { outline: none; border-color: var(--navy, #1e2a4a); }
.bug-card .filepick { position: relative; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  border: 1px solid #cbd5e1; border-radius: 10px; padding: 9px 12px; background: #fff; cursor: pointer; }
.bug-card .filepick input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 0; }
.bug-card .filepick-btn { flex: none; border-radius: 8px; background: var(--navy, #1e2a4a); color: #fff;
  font-size: .86rem; font-weight: 700; padding: 8px 14px; white-space: nowrap; }
.bug-card .filepick-name { flex: 1; min-width: 0; color: var(--bug-muted); font-size: .88rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 화면 아래에 붙은 주 단추 줄(.is-dock — 제출하기 · 반 추가 · 등록)이 있는 화면에서는 떠 있는 단추를 그 위로
   올립니다 — 휴대폰에서 둥근 단추가 「제출하기」 오른쪽 끝을 덮고 있었습니다. */
@media (max-width: 560px) { body:has(.is-dock) .bug-wrap { bottom: calc(84px + env(safe-area-inset-bottom)); } }
/* 로봇 덫 칸 — 화면 밖이라 사람에게는 안 보이지만, 초점이 가도 iOS 가 확대하지 않게 */
.bug-hp input { font-size: 16px; }
