/* 과학쌤과수업 — 어두운 남색 + 호박색(amber). 휴대폰 먼저, 데스크톱에서도 깨지지 않게 */
:root {
  --bg: #0b1220; --bg2: #0f1a2e; --surface: #131f36; --surface2: #1a2945; --border: #26385a;
  --text: #e6edf7; --muted: #93a4bf; --accent: #d97706; --accent-hi: #fbbf24; --on-accent: #1a1203;
  --good: #34d399; --warn: #fbbf24; --bad: #f87171; --info: #60a5fa;
  --r: 14px; --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --font: 'Noto Sans KR', system-ui, -apple-system, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; overflow-x: clip; }
body { background: radial-gradient(1000px 500px at 85% -10%, #3a2a0e 0%, transparent 60%), var(--bg); color: var(--text); font: 16px/1.6 var(--font); min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; -webkit-text-size-adjust: 100%; }
a { color: var(--accent-hi); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { line-height: 1.3; margin: 0 0 .5em; }
h1 { font-size: clamp(24px, 6vw, 34px); font-weight: 900; letter-spacing: -.3px; }
h2 { font-size: 20px; } h3 { font-size: 16px; }
p { margin: 0 0 .8em; }
.muted { color: var(--muted); } .small { font-size: 13px; }
:focus-visible { outline: 3px solid var(--accent-hi); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--accent-hi); color: var(--on-accent); padding: 8px 14px; z-index: 100; }
.skip:focus { left: 8px; top: 8px; }

.top { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--border); background: rgba(11, 18, 32, .88); position: sticky; top: 0; z-index: 20; backdrop-filter: blur(8px); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.logo { flex: none; width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, var(--accent), var(--accent-hi)); display: grid; place-items: center; color: var(--on-accent); }
.logo svg { width: 20px; height: 20px; display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-sub { font-size: 11px; font-weight: 700; color: var(--muted); }
.brand-name { font-size: 17px; font-weight: 900; white-space: nowrap; }
main { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 20px 16px 48px; outline: none; }
main.wide { max-width: 1040px; }
.foot { display: flex; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; padding: 14px 16px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12.5px; }
.loading { color: var(--muted); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card.flat { box-shadow: none; background: var(--bg2); }
.card h2 { margin-bottom: .4em; }
.band { border-radius: 12px; padding: 10px 14px; margin-bottom: 14px; font-size: 14px; border: 1px solid var(--border); background: var(--surface2); }
.band.mock { background: rgba(96, 165, 250, .12); border-color: rgba(96, 165, 250, .5); }
.band.warn { background: rgba(251, 191, 36, .12); border-color: rgba(251, 191, 36, .5); }
.band.bad { background: rgba(248, 113, 113, .12); border-color: rgba(248, 113, 113, .5); }
.band.good { background: rgba(52, 211, 153, .12); border-color: rgba(52, 211, 153, .5); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--border); background: var(--surface2); border-radius: 12px; padding: 11px 16px; min-height: 44px; cursor: pointer; font-weight: 700; text-decoration: none; color: var(--text); }
.btn:hover { border-color: var(--accent-hi); }
.btn.primary { background: linear-gradient(135deg, var(--accent), #f59e0b); border-color: transparent; color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: rgba(248, 113, 113, .15); border-color: rgba(248, 113, 113, .5); color: #fecaca; }
.btn.big { font-size: 18px; padding: 16px 20px; min-height: 60px; width: 100%; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.stack { display: grid; gap: 12px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.actions .btn { flex: 1 1 140px; }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > label, .legend { font-weight: 700; font-size: 14.5px; }
.hint { color: var(--muted); font-size: 13px; }
.err { color: #fecaca; font-size: 13.5px; font-weight: 700; }
input[type=text], textarea, select { width: 100%; background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; padding: 11px 12px; min-height: 44px; }
textarea { min-height: 120px; resize: vertical; }
.counter { text-align: right; font-size: 12.5px; color: var(--muted); }
.counter.over { color: var(--bad); font-weight: 700; }
fieldset { border: 0; padding: 0; margin: 0 0 14px; min-width: 0; }
.seg { display: grid; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); gap: 8px; }
.chip { border: 1px solid var(--border); background: var(--bg2); border-radius: 999px; padding: 8px 14px; min-height: 40px; cursor: pointer; font-weight: 700; font-size: 14.5px; }
.chip[aria-pressed=true] { border-color: var(--accent-hi); background: rgba(251, 191, 36, .2); color: #fff; }
.chip:disabled { opacity: .45; cursor: not-allowed; }
.seg .chip { border-radius: 10px; text-align: center; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg2); cursor: pointer; }
.check input { width: 22px; height: 22px; margin-top: 2px; flex: none; accent-color: var(--accent-hi); }

.badge { display: inline-block; font-size: 12px; padding: 2px 10px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface2); color: var(--muted); font-weight: 700; white-space: nowrap; }
.badge.done, .badge.good { color: var(--good); border-color: rgba(52, 211, 153, .5); }
.badge.partial, .badge.warn, .badge.changed { color: var(--warn); border-color: rgba(251, 191, 36, .5); }
.badge.missing, .badge.bad { color: var(--bad); border-color: rgba(248, 113, 113, .5); }
.badge.info { color: var(--info); border-color: rgba(96, 165, 250, .5); }

.bar { height: 12px; border-radius: 99px; background: var(--bg2); overflow: hidden; border: 1px solid var(--border); }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-hi)); transition: width .3s; }
.bar.split { display: flex; }
.bar.split > i { background: var(--info); }
.bar.split > i:first-child { background: var(--accent-hi); }
.big-num { font-size: 40px; font-weight: 900; color: var(--accent-hi); line-height: 1.1; }

.steps { display: flex; gap: 6px; margin: 0 0 14px; padding: 0; list-style: none; }
.steps li { flex: 1; text-align: center; font-size: 13px; padding: 6px 2px; border-radius: 8px; border: 1px solid var(--border); color: var(--muted); }
.steps li.now { border-color: var(--accent-hi); color: var(--text); background: rgba(251, 191, 36, .15); font-weight: 700; }
.steps li.done { color: var(--good); border-color: rgba(52, 211, 153, .4); }

.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.item { display: flex; gap: 10px; align-items: center; justify-content: space-between; border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; background: var(--bg2); }
.item .t { min-width: 0; }
.item .t strong { display: block; overflow-wrap: anywhere; }
.photos { display: flex; gap: 10px; flex-wrap: wrap; }
.photos figure { margin: 0; position: relative; }
.photos img { width: 96px; height: 72px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); display: block; }
.photos button { position: absolute; top: -8px; right: -8px; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface2); cursor: pointer; }

dialog { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--r); padding: 18px; max-width: min(92vw, 420px); }
dialog::backdrop { background: rgba(0, 0, 0, .6); }

/* 촬영 */
.cam { background: #000; border-radius: var(--r); overflow: hidden; aspect-ratio: 16 / 9; display: grid; place-items: center; position: relative; }
.cam video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.rec-dot { position: absolute; top: 10px; left: 10px; background: rgba(0, 0, 0, .6); border-radius: 99px; padding: 3px 10px; font-size: 13px; font-weight: 700; }
.rec-dot.on::before { content: ''; display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--bad); margin-right: 6px; }
.clock { font-size: 30px; font-weight: 900; font-variant-numeric: tabular-nums; }

/* 리포트 */
.rp-head h1 { margin-bottom: 4px; }
.rp-sec { margin-top: 22px; }
.rp-sec > h2 { padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.tbl-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; overflow-wrap: anywhere; }
th { background: var(--surface2); font-size: 13px; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
.tchip { display: inline-block; border: 1px solid var(--accent); background: rgba(251, 191, 36, .12); color: var(--accent-hi); border-radius: 8px; padding: 2px 8px; min-height: 30px; font-weight: 700; font-variant-numeric: tabular-nums; cursor: pointer; font-size: 13.5px; white-space: nowrap; }
.tchip:disabled { cursor: default; opacity: .7; }
.tchip:hover:not(:disabled) { background: rgba(251, 191, 36, .28); }
.q { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; background: var(--bg2); }
.q blockquote { margin: 6px 0; padding-left: 10px; border-left: 3px solid var(--accent); }
.cols { display: grid; gap: 12px; }
.sg { border: 1px solid var(--border); border-radius: 12px; padding: 12px; background: var(--bg2); }
.sg .next { margin-top: 6px; padding: 8px 10px; border-radius: 8px; background: rgba(251, 191, 36, .12); }
.strip { position: relative; height: 34px; border-radius: 8px; background: var(--bg2); border: 1px solid var(--border); overflow: hidden; }
.strip > span { position: absolute; top: 0; bottom: 0; border-right: 1px solid var(--bg); display: grid; place-items: center; font-size: 11.5px; font-weight: 700; color: var(--on-accent); overflow: hidden; white-space: nowrap; }
.strip .w-front { background: #fbbf24; } .strip .w-roaming { background: #34d399; } .strip .w-desk { background: #93c5fd; } .strip .w-offscreen { background: #6b7280; color: #fff; }
.mini { position: sticky; top: 56px; z-index: 15; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 8px; margin-bottom: 14px; display: flex; gap: 10px; align-items: center; box-shadow: var(--shadow); }
.mini video { width: 132px; max-width: 38%; border-radius: 8px; background: #000; flex: none; }
.mini .meta { min-width: 0; font-size: 13px; }
.printbar { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 24px; }

/* 칠판 사진 고르기 — 기본 파일 입력은 화면에서만 숨긴다(키보드·스크린리더는 그대로) */
.sr-file { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.file-row { display: flex; align-items: center; gap: 12px; margin-top: 10px; position: relative; }
.sr-file:focus-visible + .btn { outline: 3px solid var(--accent-hi); outline-offset: 2px; }
.btn.disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }

/* 올린 뒤 진행 막대: 남은 정도를 모르니 좌우로 오간다 */
.bar.indet > i { width: 35%; animation: indet 1.4s ease-in-out infinite; transition: none; }
@keyframes indet { 0% { transform: translateX(-100%); } 100% { transform: translateX(286%); } }
@media (prefers-reduced-motion: reduce) { .bar.indet > i { animation: none; width: 100%; opacity: .35; } }

/* 수업 흐름표: 좁은 화면에서는 한 단계를 카드처럼 쌓는다 */
@media screen and (max-width: 640px) {
  .flow-tbl { border: 0; overflow: visible; }
  .flow-tbl table, .flow-tbl tbody { display: block; }
  .flow-tbl thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .flow-tbl tr { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; row-gap: 4px; align-items: center; border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; background: var(--bg2); }
  .flow-tbl td { display: block; padding: 0; border: 0; }
  .flow-tbl td.f-stage { font-weight: 700; }
  .flow-tbl td:nth-child(n+3) { grid-column: 1 / -1; }
  .flow-tbl td:nth-child(n+3)::before { content: attr(data-label); display: block; font-size: 12px; font-weight: 700; color: var(--muted); }
  .flow-tbl td:nth-child(3) { margin-top: 4px; }
}

@media (min-width: 700px) {
  .cols.two { grid-template-columns: 1fr 1fr; }
  main { padding-top: 28px; }
}

@media print {
  body { background: #fff; color: #000; font-size: 11.5pt; }
  .top, .foot, .mini, .printbar, .noprint, .skip { display: none !important; }
  .tchip { border: 0; background: none; color: #000; padding: 0; min-height: 0; }
  main { max-width: none; padding: 0; }
  .card, .q, .sg { box-shadow: none; background: #fff; border-color: #999; color: #000; }
  .muted, .hint { color: #444; }
  table, tr, .q, .sg, .card, figure { break-inside: avoid; page-break-inside: avoid; }
  th { background: #eee; color: #000; }
  td, th { border-color: #999; }
  .tbl-wrap { overflow: visible; border-color: #999; }
  .badge { background: none; color: #000; border-color: #666; }
  .band { background: #fff; color: #000; border-color: #666; }
  .bar { border-color: #666; background: #eee; }
  .rp-sec > h2 { border-color: #666; }
  a { color: #000; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
