/* 감자영어 숙제함 — 디자인 규칙은 .interface-design/system.md
   색은 교재 표지·로고에서 그대로: 표지 종이, 감자 노랑, 감자 파랑.
   표지처럼 파란 테두리 + 아래로 떨어지는 파란 그림자(입체 글자 느낌)를 버튼과 큰 숫자에만 쓴다.
   레이아웃: 휴대폰 한 줄. 학생 = 인사 → 완료율 두 개 → 감자 모으기 → 숙제 목록. 원장 = 학생 줄 목록. */
:root {
  --paper: #ffffff;        /* 바탕: 깨끗한 흰색 (표지 아이보리는 화면에선 칙칙해 보여서 뺌) */
  --card: #f1f5fa;         /* 카드: 감자 파랑을 아주 옅게 */
  --ink: #163d5c;          /* 본문 글자: 감자 파랑을 한 단계 어둡게 */
  --ink-soft: #5d7488;
  --blue: #1e5f8f;         /* 표지 감자 파랑: 테두리·주 버튼·그림자 */
  --blue-soft: #dce8f3;
  --sky: #9cc3e6;          /* 표지 하늘색 장식 */
  --yellow: #f8b50b;       /* 표지 감자 노랑 */
  --yellow-soft: #fff0c2;
  --brown: #a8784e;        /* 로고 '감자' 글자색 */
  --line: #d3dde8;
  --stamp: #b3313b;        /* 인주 빨강: '참 잘했어요' 도장에만 */
  --font: "Gothic A1", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  --r: 20px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0f1e2c; --card: #172b3e; --ink: #eaf1f7; --ink-soft: #9fb3c5;
    --blue: #5fa2d6; --blue-soft: #1d3a55; --sky: #4d7ea8; --yellow: #f8b50b; --yellow-soft: #3a3013;
    --brown: #d0a37a; --line: #2a4258; --stamp: #b3313b;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0f1e2c; --card: #172b3e; --ink: #eaf1f7; --ink-soft: #9fb3c5;
  --blue: #5fa2d6; --blue-soft: #1d3a55; --sky: #4d7ea8; --yellow: #f8b50b; --yellow-soft: #3a3013;
  --brown: #d0a37a; --line: #2a4258; --stamp: #b3313b;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--paper); color: var(--ink);
  border-top: 6px solid var(--yellow);
  font-family: var(--font); font-size: 16px; line-height: 1.5;
  -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; touch-action: manipulation; }
img { max-width: 100%; height: auto; display: block; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.app {
  max-width: 520px; margin: 0 auto;
  padding-block: 14px 40px;
  padding-left: max(18px, env(safe-area-inset-left, 0px));
  padding-right: max(18px, env(safe-area-inset-right, 0px));
  display: grid; gap: 22px;
}

/* 맨 위 */
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.logo { height: 52px; width: auto; border-radius: 10px; background: #fff; padding: 3px 6px; }
.link {
  border: 0; background: var(--card); border-radius: 99px; padding: 9px 15px; min-height: 42px;
  font-size: 14px; font-weight: 700; color: var(--blue); cursor: pointer;
}

/* 인사 */
.hello { display: grid; gap: 4px; }
.date { margin: 0; color: var(--ink-soft); font-size: 15px; font-weight: 500; }
h1 {
  margin: 0; font-size: 32px; line-height: 1.15; font-weight: 900; letter-spacing: -0.04em;
  text-wrap: balance; word-break: keep-all;
}

/* 완료율 두 개 */
.rates { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.rate {
  border-radius: var(--r); padding: 16px 16px 14px; display: grid; gap: 6px;
  border: 2.5px solid var(--blue); box-shadow: 0 5px 0 var(--blue);
}
.rate.hw { background: var(--yellow); color: #163d5c; }
.rate.vc { background: var(--card); }
.rate-label { font-size: 14px; font-weight: 700; }
.rate-num { font-size: 44px; font-weight: 900; letter-spacing: -0.05em; line-height: 1; font-variant-numeric: tabular-nums; }
.rate-num small { font-size: 20px; letter-spacing: 0; margin-left: 1px; }
.rate-sub { font-size: 13.5px; font-weight: 600; opacity: .8; font-variant-numeric: tabular-nums; }

/* 감자 모으기 */
.collect { background: var(--card); border-radius: var(--r); padding: 18px 16px; display: grid; gap: 14px; }
.collect-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.collect-title { font-weight: 800; font-size: 16px; }
.collect-sub { font-size: 14px; color: var(--ink-soft); font-weight: 600; }
.slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 10px; }
.slot { display: grid; justify-items: center; gap: 6px; min-width: 0; }
.pit {
  width: 100%; max-width: 92px; aspect-ratio: 1; border-radius: 50%;
  background: var(--paper); display: grid; place-items: center; position: relative;
  box-shadow: inset 0 0 0 2px var(--line);
}
.pit img { width: 78%; height: auto; }
.stamp-mark { width: 96%; color: var(--stamp); transform: rotate(-12deg); }
.stamp-mark.thunk { animation: thunk .42s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes thunk {
  0% { transform: rotate(-26deg) scale(1.7); opacity: 0; }
  100% { transform: rotate(-12deg) scale(1); opacity: 1; }
}
}
.pit img.pop { animation: pop .5s cubic-bezier(.2, 1.5, .4, 1) both; }
@keyframes pop { 0% { transform: translateY(14px) scale(.4); opacity: 0; } 100% { transform: none; opacity: 1; } }
.slot.is-done .pit { background: #fffbf2; box-shadow: none; }  /* 도장 찍힌 종이 */
.slot-name { font-size: 13px; color: var(--ink-soft); text-align: center; word-break: keep-all; line-height: 1.25; font-weight: 600; }
.slot.is-done .slot-name { color: var(--ink); }

/* 다 끝났을 때 */
.done-banner {
  background: var(--yellow); color: #163d5c; border-radius: var(--r);
  border: 2.5px solid #1e5f8f; box-shadow: 0 5px 0 #1e5f8f;
  padding: 16px; display: flex; align-items: center; gap: 14px;
}
.done-banner img { width: 64px; flex: none; }
.done-banner b { font-size: 21px; font-weight: 900; letter-spacing: -0.03em; display: block; line-height: 1.25; }
.done-banner span { font-size: 14px; font-weight: 600; }

/* 숙제 목록 */
.list { display: grid; gap: 12px; }
.list-title { margin: 4px 0 0; font-size: 17px; font-weight: 800; }
.item { background: var(--card); border-radius: var(--r); padding: 16px; display: grid; gap: 12px; }
.item.is-done { background: var(--yellow-soft); }
.item-head { display: flex; gap: 12px; align-items: flex-start; }
.kind {
  flex: none; width: 42px; height: 42px; border-radius: 14px; background: var(--blue-soft); color: var(--blue);
  display: grid; place-items: center;
}
.is-done .kind { background: var(--yellow); color: #163d5c; }
.kind svg { width: 22px; height: 22px; }
.item-text { min-width: 0; display: grid; gap: 1px; flex: 1; }
.item-title { font-weight: 800; font-size: 17px; letter-spacing: -0.02em; word-break: keep-all; }
.item-detail { color: var(--ink-soft); font-size: 14px; }
.check { flex: none; font-size: 13px; font-weight: 800; color: var(--blue); white-space: nowrap; padding-top: 3px; }
.needs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.needs li {
  font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 99px;
  background: var(--paper); color: var(--ink-soft);
}
.needs li.ok { background: var(--blue); color: #fff; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.btn {
  border: 2.5px solid var(--blue); border-radius: 99px; padding: 10px 18px; min-height: 48px;
  font-weight: 800; font-size: 15px; cursor: pointer;
  background: var(--blue); color: #fff; box-shadow: 0 4px 0 #123f63;
  display: inline-flex; align-items: center; gap: 7px;
  transition: transform .1s ease, box-shadow .1s ease;
}
.btn svg { width: 18px; height: 18px; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #123f63; }
.btn:disabled { opacity: .55; cursor: default; transform: none; }
.btn.quiet { background: var(--card); color: var(--blue); box-shadow: 0 4px 0 var(--blue); }
.btn.quiet:active { box-shadow: 0 1px 0 var(--blue); }
.btn.rec { background: var(--yellow); color: #163d5c; border-color: #1e5f8f; }
.btn:focus-visible, .link:focus-visible, .pick:focus-visible, .row:focus-visible {
  outline: 3px solid var(--yellow); outline-offset: 3px;
}
.note { margin: 0; font-size: 14.5px; font-weight: 600; line-height: 1.5; border-radius: 14px; padding: 10px 14px; background: var(--paper); color: var(--ink-soft); }
.note.todo { background: var(--blue-soft); color: var(--ink); }
.note.ok { background: var(--paper); color: var(--ink); }
.from-teacher { margin: 0; font-size: 14px; color: var(--ink-soft); display: flex; gap: 10px; align-items: center; }
.from-teacher img { width: 34px; flex: none; }

/* 학생 고르기 */
.picks { display: grid; gap: 12px; }
.pick {
  width: 100%; border: 2.5px solid var(--blue); background: var(--card); border-radius: var(--r);
  box-shadow: 0 5px 0 var(--blue);
  padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  cursor: pointer; text-align: left; min-height: 74px;
}
.pick:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--blue); }
.pick-name { font-size: 22px; font-weight: 900; letter-spacing: -0.03em; }
.pick-rate { font-size: 15px; font-weight: 800; color: var(--blue); font-variant-numeric: tabular-nums; }

/* 로그인 */
.login { display: grid; gap: 14px; background: var(--card); border-radius: var(--r); padding: 20px; }
.field { display: grid; gap: 6px; }
.field label { font-size: 15px; font-weight: 800; }
.field input {
  font: inherit; font-size: 18px; font-weight: 700; color: var(--ink);
  background: var(--paper); border: 2.5px solid var(--line); border-radius: 14px;
  padding: 12px 14px; min-height: 52px; width: 100%;
}
.field input:focus { outline: none; border-color: var(--blue); }
.field input::placeholder { color: var(--ink-soft); font-weight: 500; }
.btn.wide { width: 100%; justify-content: center; font-size: 17px; min-height: 54px; }
.side-link { justify-self: start; }

/* 오답노트 */
.wn { background: var(--card); border-radius: var(--r); padding: 16px; display: grid; gap: 10px; }
.wn-src { font-size: 13px; font-weight: 700; color: var(--blue); }
.wn-q { font-size: 17px; font-weight: 700; line-height: 1.45; word-break: keep-all; }
.wn-ans { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 15px; margin: 0; }
.wn-ans dt { color: var(--ink-soft); font-weight: 600; }
.wn-ans dd { margin: 0; font-weight: 700; }
.wn-ans dd.mine { text-decoration: line-through; text-decoration-color: var(--ink-soft); color: var(--ink-soft); }
.wn textarea {
  font: inherit; font-size: 15px; color: var(--ink); background: var(--paper);
  border: 2.5px solid var(--line); border-radius: 14px; padding: 10px 12px; min-height: 76px; resize: vertical; width: 100%;
}
.wn textarea:focus { outline: none; border-color: var(--blue); }
.wn label { font-size: 14px; font-weight: 800; }

/* 원장 화면: 캐릭터·장난 문구 없이 건조하게 */
.admin .logo { height: 40px; }
.rule { margin: 0; font-size: 15px; color: var(--ink-soft); }
.rule b { color: var(--ink); }
.rows { display: grid; gap: 10px; }
.row {
  width: 100%; border: 0; background: var(--card); border-radius: 16px;
  padding: 16px; display: grid; gap: 10px; cursor: pointer; text-align: left;
}
.row-top { display: flex; align-items: center; gap: 10px; }
.row-name { font-size: 18px; font-weight: 800; letter-spacing: -0.02em; }
.grade { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: var(--blue-soft); color: var(--blue); }
.state { margin-left: auto; font-size: 13px; font-weight: 800; padding: 5px 11px; border-radius: 99px; white-space: nowrap; }
.state.go { background: var(--blue); color: #fff; }
.state.mid { background: var(--yellow-soft); color: var(--ink); }
.state.none { background: var(--paper); color: var(--ink-soft); }
.bar-line { height: 8px; border-radius: 4px; background: var(--paper); overflow: hidden; }
.bar-line i { display: block; height: 100%; background: var(--blue); border-radius: inherit; }
.row-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; font-size: 13.5px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.row-meta b { color: var(--ink); }
.row-miss { font-size: 13.5px; color: var(--ink-soft); }
.panel { background: var(--card); border-radius: 16px; padding: 16px; display: grid; gap: 10px; }
.panel h2 { margin: 0; font-size: 16px; font-weight: 800; }
.panel ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.panel p { margin: 0; color: var(--ink-soft); font-size: 14.5px; }
.legend { display: flex; flex-wrap: wrap; gap: 8px; }
.legend span { font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 99px; }
.legend .before { background: var(--yellow-soft); color: var(--ink); }
.legend .after { background: var(--blue); color: #fff; }

.foot { margin: 0; font-size: 13px; color: var(--ink-soft); }

@media (prefers-reduced-motion: reduce) {
  .pit img.pop, .stamp-mark.thunk { animation: none; }
  .btn, .pick { transition: none; }
}
