/* ===== JDH English — 토스(Toss) 스타일 디자인 시스템 ===== */
:root {
  --bg: #f2f4f6;
  --surface: #ffffff;
  --surface-2: #f2f4f6;
  --surface-3: #edf0f2;
  --fg: #191f28;
  --fg-2: #4e5968;
  --muted: #8b95a1;
  --line: #e5e8eb;
  --primary: #3182f6;
  --primary-press: #1b64da;
  --primary-weak: #e8f1fe;
  --good: #12b76a;
  --good-weak: #e6f7ef;
  --bad: #f04452;
  --bad-weak: #fdecee;
  --streak: #ff7a2f;
  --radius: 16px;
  --radius-lg: 20px;
  --radius-sm: 12px;
  --shadow: 0 1px 3px rgba(23, 31, 40, .06), 0 1px 2px rgba(23, 31, 40, .04);
  --shadow-pop: 0 6px 20px rgba(23, 31, 40, .10);
  --content-max: 560px; /* 본문·헤더·탭바 공통 폭 (데스크탑에서 넓어짐) */
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17171c; --surface: #212127; --surface-2: #2a2a32; --surface-3: #31313a;
    --fg: #f4f5f7; --fg-2: #b0b8c1; --muted: #8b95a1; --line: #33343b;
    --primary: #4593fc; --primary-press: #3182f6; --primary-weak: #17273f;
    --good: #2bc076; --good-weak: #14301f; --bad: #ff6370; --bad-weak: #3a2226;
    --streak: #ff8a4c;
    --shadow: 0 1px 3px rgba(0,0,0,.4); --shadow-pop: 0 6px 20px rgba(0,0,0,.5);
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; overflow-x: hidden; max-width: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", "Segoe UI", Roboto, "Noto Sans KR", sans-serif;
  background: var(--bg); color: var(--fg);
  padding-bottom: calc(78px + env(safe-area-inset-bottom));
  line-height: 1.5; letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}
.ic { display: inline-block; vertical-align: -0.18em; flex: 0 0 auto; }

/* Header */
.app-header {
  padding: 20px 20px 10px; position: sticky; top: 0; z-index: 5;
  background: var(--bg);
}
.app-header h1 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -0.03em; }
.app-header .sub { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; font-weight: 500; }

/* 모든 탭 폭 제한 없이 화면 전체 사용 */
.view { padding: 4px 16px 24px; }

/* Cards */
.card {
  background: var(--surface); border-radius: var(--radius);
  padding: 20px; margin: 12px 0; box-shadow: var(--shadow);
}
.section-title { font-size: 13px; color: var(--muted); font-weight: 600; letter-spacing: -0.01em; margin: 20px 4px 8px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Buttons */
.btn {
  background: var(--primary); color: #fff; border: 0; border-radius: var(--radius-sm);
  padding: 14px 18px; font-size: 16px; font-weight: 700; cursor: pointer; font-family: inherit;
  letter-spacing: -0.01em; transition: background .12s, transform .06s;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn:active { background: var(--primary-press); transform: scale(.985); }
.btn.secondary { background: var(--surface-2); color: var(--fg); }
.btn.secondary:active { background: var(--surface-3); }
.btn.ghost { background: transparent; color: var(--primary); padding: 8px 12px; font-size: 14.5px; font-weight: 600; }
.btn.ghost:active { background: transparent; opacity: .6; }
.btn.block { width: 100%; }
.icon-btn {
  background: var(--surface-2); color: var(--fg-2); border: 0; border-radius: 10px;
  padding: 9px 13px; cursor: pointer; font-size: 14px; font-weight: 600; font-family: inherit;
  display: inline-flex; align-items: center; gap: 5px;
}
.icon-btn:active { background: var(--surface-3); }
.icon-btn.sq { padding: 9px; }

/* Segmented control (iOS/Toss) */
.seg { display: flex; gap: 0; background: var(--surface-2); padding: 4px; border-radius: var(--radius-sm); }
.seg button {
  flex: 1; border: 0; background: transparent; color: var(--muted);
  padding: 9px 6px; border-radius: 9px; font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: color .1s;
}
.seg button.active { background: var(--surface); color: var(--fg); box-shadow: var(--shadow); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: 0 0 auto; }
.dot.easy { background: var(--good); }
.dot.hard { background: var(--bad); }

/* Chips */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  background: var(--surface-2); border: 0; color: var(--fg-2);
  padding: 8px 14px; border-radius: 999px; font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.chip.active { background: var(--primary-weak); color: var(--primary); }

/* Inputs */
input[type=text], input[type=password], select, textarea {
  width: 100%; background: var(--surface-2); border: 1.5px solid transparent; color: var(--fg);
  border-radius: var(--radius-sm); padding: 14px; font-size: 15.5px; font-family: inherit; letter-spacing: -0.01em;
}
input::placeholder, textarea::placeholder { color: var(--muted); }
input[type=text]:focus, input[type=password]:focus, select:focus, textarea:focus { outline: 0; border-color: var(--primary); background: var(--surface); }
textarea { min-height: 72px; resize: vertical; }
select { appearance: none; background-image: none; }

/* Practice */
.prompt-label { color: var(--muted); font-size: 13px; font-weight: 500; margin-bottom: 10px; }
.prompt-ko { font-size: 23px; font-weight: 800; line-height: 1.4; margin-bottom: 16px; word-break: keep-all; letter-spacing: -0.02em; }
.hint-box { background: var(--primary-weak); border-radius: var(--radius-sm); padding: 12px 14px; margin: 12px 0 0; font-size: 14px; color: var(--fg-2); }
.hint-box b { color: var(--primary); }
.feedback { font-weight: 700; margin: 16px 0 8px; font-size: 15px; display: flex; align-items: center; gap: 6px; letter-spacing: -0.01em; }
.feedback.ok { color: var(--good); }
.feedback.bad { color: var(--bad); }
.model { background: var(--surface-2); border-radius: var(--radius-sm); padding: 14px; }
.model .en { font-size: 16px; line-height: 1.55; font-weight: 500; }
.model .en b { color: var(--primary); font-weight: 800; }
.model .ko { color: var(--muted); font-size: 13px; margin-top: 4px; display: block; }

/* Word builder */
.build-answer {
  min-height: 56px; background: var(--surface-2); border: 1.5px dashed var(--line);
  border-radius: var(--radius-sm); padding: 10px; display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 4px;
}
.build-answer:empty::before { content: "여기에 단어를 순서대로 놓으세요"; color: var(--muted); font-size: 13.5px; align-self: center; }
.build-source { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.wchip {
  background: var(--surface); border: 1.5px solid var(--line); color: var(--fg);
  padding: 9px 14px; border-radius: 10px; font-size: 16px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.wchip:active { transform: scale(.96); }
.build-answer .wchip { background: var(--primary); border-color: var(--primary); color: #fff; }

/* Quiz */
.flash {
  min-height: 200px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 12px; cursor: pointer; user-select: none;
}
.flash .big { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; }
.flash .hint { color: var(--muted); font-size: 13.5px; }
.opt {
  display: flex; align-items: center; width: 100%; text-align: left; margin: 9px 0; padding: 15px 16px;
  background: var(--surface-2); border: 1.5px solid transparent; border-radius: var(--radius-sm);
  color: var(--fg); font-size: 16px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.opt.correct { background: var(--good-weak); border-color: var(--good); color: var(--good); }
.opt.wrong { background: var(--bad-weak); border-color: var(--bad); color: var(--bad); }
.score { color: var(--muted); font-size: 13.5px; font-weight: 500; display: flex; align-items: center; justify-content: center; gap: 4px; }
.preview { font-size: 21px; font-weight: 800; line-height: 1.45; padding: 6px 2px 12px; word-break: break-word; letter-spacing: -0.02em; }

/* Reference */
.ref-item { border-bottom: 1px solid var(--line); padding: 14px 2px; }
.ref-item:last-child { border-bottom: 0; }
.ref-word { font-size: 17px; font-weight: 800; letter-spacing: -0.01em; }
.ref-ko { color: var(--primary); font-size: 14px; font-weight: 600; margin-left: 8px; }
.ref-uses { color: var(--muted); font-size: 13px; margin: 5px 0 7px; }
.ex { margin: 4px 0; font-size: 14.5px; }
.ex .en b { color: var(--primary); font-weight: 700; }
.ex .ko { color: var(--muted); font-size: 13px; }

/* My sentences */
.mine-item { display: flex; align-items: center; gap: 8px; padding: 13px 2px; border-bottom: 1px solid var(--line); }
.mine-item:last-child { border-bottom: 0; }
.mine-item .txt { flex: 1; font-size: 15.5px; font-weight: 500; word-break: break-word; }
.empty { color: var(--muted); text-align: center; padding: 48px 16px; font-size: 14.5px; white-space: pre-line; line-height: 1.7; }

/* Materials */
.mat-intro { color: var(--muted); font-size: 13.5px; margin: 8px 2px 14px; }
.mat { margin: 0 0 16px; }
.mat h3 { font-size: 15px; font-weight: 700; margin: 0 0 10px; }
.mat-img { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; font: inherit; }
.mat img { width: 100%; height: auto; display: block; border-radius: var(--radius); box-shadow: var(--shadow); background: #fff; }
.mat .cap { color: var(--muted); font-size: 12.5px; margin-top: 8px; text-align: center; }

/* 교재 권 선택 카드 */
.vol-card {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  padding: 18px 16px; margin: 0 0 12px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow); cursor: pointer; font: inherit; color: var(--fg);
}
.vol-card:active { background: var(--surface-3); }
.vol-num {
  flex: none; width: 46px; height: 46px; border-radius: 12px; background: var(--primary-weak);
  color: var(--primary); font-size: 15px; font-weight: 800; display: flex; align-items: center; justify-content: center;
}
.vol-info { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.vol-title { font-size: 16px; font-weight: 700; }
.vol-cap { font-size: 12.5px; color: var(--muted); }
.vol-go { flex: none; color: var(--muted); display: flex; }

/* 교재 리더 (권 상단 바 + 1쪽 리더) */
.vol-bar { display: flex; align-items: center; gap: 10px; margin: 2px 0 12px; }
.vol-back {
  display: inline-flex; align-items: center; gap: 2px; border: 0; background: none; cursor: pointer;
  color: var(--primary); font-size: 14px; font-weight: 600; font-family: inherit; padding: 4px 0;
}
.vol-bar-title { font-size: 14px; font-weight: 700; color: var(--fg-2); }
.book-hint { color: var(--muted); font-size: 12.5px; text-align: center; margin: 8px 2px 0; }
.book-page {
  display: block; width: 100%; padding: 0; border: 0;
  background: none; cursor: default; font: inherit;
}
.book-page img {
  width: 100%; height: auto; display: block; border-radius: var(--radius);
  box-shadow: var(--shadow); background: #fff;
}
.book-nav {
  position: sticky; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 5;
  display: flex; align-items: center; gap: 10px; margin: 14px 0 4px;
  padding: 8px; border-radius: 16px; background: var(--surface);
  border: 1px solid var(--line); box-shadow: 0 6px 20px rgba(0,0,0,.16);
}
.book-btn {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 4px;
  min-height: 46px; padding: 0 12px; border: 0; border-radius: var(--radius-sm);
  background: var(--primary); color: #fff; font-size: 15px; font-weight: 600; cursor: pointer;
  box-shadow: var(--shadow);
}
.book-btn:active { background: var(--primary-press); }
.book-btn:disabled { background: var(--surface-3); color: var(--muted); box-shadow: none; cursor: default; }
.book-jump {
  display: flex; align-items: center; gap: 6px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0 12px; min-height: 46px;
}
.book-jump input {
  width: 48px; text-align: center; border: 0; background: none; color: var(--fg);
  font-size: 15px; font-weight: 700; padding: 0; -moz-appearance: textfield;
}
.book-jump input::-webkit-outer-spin-button, .book-jump input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.book-total { color: var(--muted); font-size: 14px; font-weight: 600; }

/* Lightbox (이미지 팝업) */
.lightbox {
  position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.82);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 20px; opacity: 0; transition: opacity .18s; cursor: zoom-out;
}
.lightbox.show { opacity: 1; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 120px); object-fit: contain; border-radius: 10px; box-shadow: var(--shadow-pop); background: #fff; cursor: default; }
.lightbox .lb-close {
  position: absolute; top: max(14px, env(safe-area-inset-top)); right: 14px; width: 44px; height: 44px;
  border-radius: 999px; background: rgba(255,255,255,.16); color: #fff; border: 0;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.lightbox .lb-close:active { background: rgba(255,255,255,.28); }
.lightbox .lb-cap { color: #fff; font-size: 13px; margin-top: 14px; text-align: center; opacity: .9; }

/* Flashcard 뒷면 — 교재 2번(용법 + 모든 예문) */
.flash-uses { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 2px 0 2px; }
.flash-uses span { background: var(--primary-weak); color: var(--primary); font-size: 12.5px; font-weight: 600; padding: 4px 10px; border-radius: 999px; }
.flash-exs { width: 100%; text-align: left; margin-top: 2px; }
.flash-ex { display: flex; align-items: center; gap: 8px; padding: 9px 2px; border-top: 1px solid var(--line); }
.flash-ex:first-child { border-top: 0; }
.flash-ex .ex { flex: 1; margin: 0; }

/* Toast */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%) translateY(8px); bottom: 96px; z-index: 30;
  background: #191f28; color: #fff; padding: 13px 20px; border-radius: 14px; font-size: 14.5px; font-weight: 600;
  opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; box-shadow: var(--shadow-pop);
  max-width: 80%; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.ok { background: var(--good); }
.toast.bad { background: var(--bad); }

/* Tab bar */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(6, 1fr);
  background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  border: 0; background: transparent; color: var(--muted);
  padding: 9px 1px 10px; font-size: 10.5px; font-weight: 600; display: flex; flex-direction: column;
  align-items: center; gap: 4px; cursor: pointer; font-family: inherit; letter-spacing: -0.02em;
  min-width: 0;
}
.tab span:last-child { white-space: nowrap; }
.tab.active { color: var(--primary); }

/* ===== 데스크탑: 본문을 더 넓게, 탭바 버튼도 본문 폭에 맞춰 중앙 정렬 ===== */
@media (min-width: 700px) {
  :root { --content-max: 1100px; }
  /* 하단 탭바는 바(배경·상단선)는 화면 전체, 버튼 5개만 본문 폭 안으로 모음 */
  .tabbar { padding-left: max(0px, calc((100% - var(--content-max)) / 2)); padding-right: max(0px, calc((100% - var(--content-max)) / 2)); }
}

/* ===== Status (두 학생 참여 현황) ===== */
.me-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin: 8px 2px 2px; }
.me-bar .hello { font-size: 18px; font-weight: 800; letter-spacing: -0.02em; flex: 1; min-width: 0; }
.me-bar .hello b { color: var(--primary); }
.me-bar .btn.ghost { white-space: nowrap; flex: 0 0 auto; }

.duo { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; margin: 12px 0; max-width: 100%; }
.ucard { min-width: 0; background: var(--surface); border-radius: var(--radius); padding: 16px 14px; box-shadow: var(--shadow); }
.ucard.me { background: var(--primary-weak); }
.uhead { display: flex; align-items: center; gap: 6px; }
.ucard .uname { font-size: 15px; font-weight: 800; letter-spacing: 0.02em; }
.ucard .metag { font-size: 10.5px; color: #fff; background: var(--primary); font-weight: 700; padding: 2px 7px; border-radius: 999px; }
.streak { display: flex; align-items: center; gap: 5px; margin: 12px 0 2px; color: var(--streak); }
.streak .num { font-size: 30px; font-weight: 900; line-height: 1; letter-spacing: -0.03em; }
.streak .unit { font-size: 13px; font-weight: 600; color: var(--muted); align-self: flex-end; margin-bottom: 3px; }
.streak.zero { color: var(--muted); }
.streak.zero .ic { opacity: .5; }
.divlabel { font-size: 11.5px; color: var(--muted); font-weight: 600; margin: 14px 0 5px; }
.stat-row { display: flex; justify-content: space-between; align-items: center; font-size: 13.5px; margin-top: 7px; color: var(--fg-2); font-weight: 500; }
.stat-row b { color: var(--fg); font-weight: 800; font-size: 15px; }

.feed-item { display: flex; gap: 10px; align-items: center; padding: 12px 2px; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.feed-item:last-child { border-bottom: 0; }
.feed-item .fu { font-weight: 800; font-size: 11px; color: #fff; background: var(--fg-2); padding: 3px 8px; border-radius: 999px; min-width: 30px; text-align: center; letter-spacing: 0.02em; }
.feed-item .fu.JH { background: var(--primary); }
.feed-item .fu.DH { background: var(--streak); }
.feed-item .fi { color: var(--muted); display: inline-flex; }
.feed-item .ft { flex: 1; font-weight: 600; color: var(--fg); }
.feed-item .fw { color: var(--muted); font-size: 12.5px; white-space: nowrap; font-weight: 500; }

.who-pick { text-align: center; padding: 8px 4px 4px; }
.who-pick .q { font-size: 18px; font-weight: 800; margin-bottom: 16px; letter-spacing: -0.02em; }
.who-btns { display: flex; gap: 10px; justify-content: center; }
.who-btns .who {
  flex: 1; max-width: 160px; padding: 22px 16px; font-size: 22px; font-weight: 800; letter-spacing: 0.02em;
  border-radius: var(--radius); border: 2px solid var(--line); background: var(--surface-2); color: var(--fg);
  cursor: pointer; font-family: inherit; transition: transform .06s;
}
.who-btns .who:active { transform: scale(.97); border-color: var(--primary); color: var(--primary); }
.status-note { color: var(--muted); font-size: 12.5px; margin-top: 14px; line-height: 1.6; }
.login-card { margin-top: 12vh; }

/* 비밀번호 게이트 */
.gate-form { display: flex; flex-direction: column; gap: 12px; margin-top: 4px; }
.gate-err { color: var(--bad); font-size: 13px; font-weight: 600; }

/* 복습 — 수업에서 배운 문장 */
.ne-row { display: flex; align-items: center; gap: 10px; padding: 12px 2px; border-bottom: 1px solid var(--line); }
.ne-row:last-child { border-bottom: 0; }
.ne-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ne-txt .en { font-size: 15px; font-weight: 600; word-break: break-word; line-height: 1.55; }
.ne-txt .ko { color: var(--muted); font-size: 13px; word-break: break-word; }
/* 표현·단어 행 — 문장 행과 같은 리듬, 발음은 영어 헤드워드만 */
.ex-row { display: flex; align-items: center; gap: 10px; padding: 12px 2px; border-bottom: 1px solid var(--line); }
.ex-row:last-child { border-bottom: 0; }
.ex-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ex-txt .ex-en { font-size: 15px; font-weight: 700; word-break: break-word; line-height: 1.5; }
.ex-txt .ex-def { color: var(--muted); font-size: 13px; word-break: break-word; line-height: 1.5; }
/* 맞는 표현(O)=초록 / 틀린 표현(X)=빨강 */
.ox { border-radius: 5px; padding: 0 5px; }
.ox.ok { color: var(--good); background: color-mix(in srgb, var(--good) 15%, transparent); }
.ox.no { color: var(--bad); background: color-mix(in srgb, var(--bad) 13%, transparent); }
/* 문장 안 강조: 전치사(주황) / 중요 표현(파랑) */
.ne-hl { border-radius: 4px; padding: 0 2px; font-weight: 800; }
.ne-hl.prep { color: var(--streak); background: color-mix(in srgb, var(--streak) 16%, transparent); }
.ne-hl.key { color: var(--primary); background: color-mix(in srgb, var(--primary) 14%, transparent); }
/* 전치사별 필터 버튼(가로 스크롤) + 색상 안내 */
.ne-filter { display: flex; align-items: center; gap: 8px; margin: 2px 0 10px; padding-bottom: 2px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.ne-filter::-webkit-scrollbar { height: 0; }
.ne-filter .chip { flex: 0 0 auto; white-space: nowrap; }
.ne-legend { display: flex; gap: 8px; margin: 0 2px 12px; }
.ne-legend .ne-hl { font-size: 11.5px; font-weight: 700; padding: 2px 8px; }
/* 선택한 전치사의 교재 뜻 한 줄 */
.ne-prep-info { background: color-mix(in srgb, var(--streak) 10%, var(--surface)); border-radius: var(--radius-sm); padding: 10px 14px; margin: 0 2px 12px; font-size: 14.5px; line-height: 1.5; }
.ne-prep-info b { color: var(--streak); font-weight: 800; margin-right: 8px; }
.ne-prep-info .mean { color: var(--fg); font-weight: 600; }
.ne-prep-info .uses { display: block; color: var(--muted); font-size: 12.5px; margin-top: 3px; }

/* 빈칸 채우기 — 정답/오답 설명 */
.blank-result { margin-top: 2px; }
.explain { margin-top: 16px; background: var(--surface-2); border-radius: var(--radius-sm); padding: 4px 14px; }
.exp-row { display: flex; align-items: center; gap: 9px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.exp-row:last-of-type { border-bottom: 0; }
.exp-ic { color: var(--bad); display: inline-flex; flex: 0 0 auto; }
.exp-row.ok .exp-ic { color: var(--good); }
.exp-w { font-weight: 800; min-width: 42px; }
.exp-row.ok .exp-w { color: var(--good); }
.exp-m { flex: 1; color: var(--muted); font-size: 13px; min-width: 0; }
.exp-tag { font-size: 11px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.exp-row.ok .exp-tag { color: var(--good); }
.exp-note { font-size: 13.5px; color: var(--fg-2); margin: 12px 2px 6px; line-height: 1.65; }
.exp-note b { color: var(--primary); }

/* 학습 방식 난이도 뱃지 */
.mode-chip { display: inline-flex; align-items: center; }
.mode-chip .lvl { margin-left: 7px; font-size: 10px; font-weight: 800; padding: 1px 6px; border-radius: 999px; letter-spacing: 0; }
.lvl-easy { background: var(--good-weak); color: var(--good); }
.lvl-normal { background: var(--primary-weak); color: var(--primary); }
.lvl-hard { background: var(--bad-weak); color: var(--bad); }

/* 학습 진행바 */
.learn-prog { display: flex; align-items: center; gap: 10px; margin: 16px 4px 4px; }
.lp-bar { flex: 1; height: 8px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.lp-bar span { display: block; height: 100%; background: var(--primary); border-radius: 999px; transition: width .25s; }
.lp-num { font-size: 12.5px; font-weight: 700; color: var(--muted); white-space: nowrap; }

/* 학습 완료 카드 */
.done-card { text-align: center; padding: 34px 20px; }
.done-ic { color: var(--good); display: flex; justify-content: center; margin-bottom: 12px; }
.done-t { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.done-s { font-size: 16px; color: var(--fg-2); margin-top: 8px; font-weight: 600; }
.done-s b { color: var(--primary); font-weight: 800; }
.done-note { font-size: 13px; color: var(--muted); margin-top: 8px; }
.done-btns { display: flex; flex-direction: column; gap: 8px; margin-top: 20px; }

/* 복습 — 자주 틀리는 표현 */
.wrong-item { display: flex; align-items: center; gap: 10px; padding: 12px 2px; border-bottom: 1px solid var(--line); }
.wrong-item:last-child { border-bottom: 0; }
.wi-w { font-weight: 800; font-size: 16px; min-width: 52px; }
.wi-m { flex: 1; color: var(--muted); font-size: 13.5px; min-width: 0; }
.wi-c { font-size: 11.5px; font-weight: 700; color: var(--bad); background: var(--bad-weak); padding: 3px 9px; border-radius: 999px; white-space: nowrap; }

/* 노트 (수업 필기) — 넉넉하게 크고 시원하게 */
.note-head { margin: 14px 2px 4px; }
.note-date { font-size: 14.5px; font-weight: 700; color: var(--primary); }
.note-title { font-size: 25px; font-weight: 800; letter-spacing: -0.02em; margin-top: 3px; line-height: 1.3; }
.note-card { padding: 10px 20px; }
.note-sub { padding: 18px 0; border-bottom: 1px solid var(--line); }
.note-sub:last-child { border-bottom: 0; }
.note-w { font-size: 18px; font-weight: 800; color: var(--primary); letter-spacing: -0.01em; }
.note-p { font-size: 16.5px; color: var(--fg-2); margin-top: 9px; line-height: 1.65; }
.note-ex { margin-top: 11px; cursor: pointer; padding: 12px 15px; background: var(--surface-2); border-radius: 12px; }
.note-ex:active { background: var(--surface-3); }
.note-ex .en { display: block; font-size: 17.5px; font-weight: 600; line-height: 1.55; }
.note-ex .ko { display: block; font-size: 14.5px; color: var(--muted); margin-top: 4px; line-height: 1.5; }

/* 노트 목록 뷰 */
.note-topbar { display: flex; align-items: center; gap: 10px; margin: 4px 2px 10px; }
.note-topbar .mat-intro { margin: 0; flex: 1; }
.icon-btn.primary { background: var(--primary); color: #fff; flex: 0 0 auto; }
.icon-btn.primary:active { background: var(--primary-press); }
.note-list { display: flex; flex-direction: column; gap: 12px; }
.note-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: var(--surface); border: 0; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px 16px 20px 20px; cursor: pointer; font-family: inherit; color: inherit;
  transition: transform .06s;
}
.note-item:active { transform: scale(.99); background: var(--surface-2); }
.note-item-main { flex: 1; min-width: 0; }
.note-item-meta { font-size: 13.5px; font-weight: 700; color: var(--primary); display: flex; align-items: center; gap: 8px; }
.note-item-title { font-size: 19px; font-weight: 700; letter-spacing: -0.01em; margin-top: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note-item-chev { color: var(--muted); flex: 0 0 auto; display: inline-flex; }
.note-badge {
  font-size: 11.5px; font-weight: 700; color: var(--muted); background: var(--surface-2);
  padding: 3px 9px; border-radius: 999px; letter-spacing: 0;
}
.note-badge.mine { color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, transparent); }
.note-badge.ai { color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, transparent); }
.note-badge.raw { color: var(--streak); background: color-mix(in srgb, var(--streak) 15%, transparent); }

/* 항상 기억해야 할 것 — 목록 맨 위 고정 카드 */
.always-box {
  background: var(--surface); border: 1.5px solid var(--primary);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 6px 18px 8px; margin: 0 0 18px;
}
.always-title {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-size: 15px; font-weight: 800; color: var(--primary); letter-spacing: -0.01em;
  padding: 14px 0 4px;
}
.always-title-lbl { display: flex; align-items: center; gap: 7px; }
.always-edit-btn {
  display: inline-flex; align-items: center; gap: 4px; flex: 0 0 auto;
  background: var(--primary-weak); color: var(--primary); border: 0; cursor: pointer;
  font-family: inherit; font-size: 13px; font-weight: 700; padding: 6px 12px; border-radius: 999px;
}
.always-edit-btn:active { transform: scale(.97); }
.always-box .note-sub { padding: 14px 0; }
.always-box .note-w { font-size: 15.5px; color: var(--fg); }
.always-empty { color: var(--muted); font-size: 14.5px; padding: 4px 0 16px; line-height: 1.6; }
.always-edit { width: 100%; min-height: 220px; margin: 10px 0 0; font-size: 15.5px; line-height: 1.7; padding: 14px; }
.always-actions { display: flex; align-items: center; gap: 8px; margin: 12px 0 4px; }
.always-actions .btn.sm { flex: 0 0 auto; width: auto; padding: 10px 22px; }

/* 노트 상세·편집 상단바 */
.note-detail-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 4px 2px 6px; }
.note-detail-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.note-subhead { font-size: 17px; font-weight: 800; color: var(--fg); margin: 18px 0 4px; }
.note-subhead:first-child { margin-top: 4px; }
.note-mine-body .note-ex { margin-top: 10px; }
.note-p.muted { color: var(--muted); }

/* 날짜 상세: 좌 AI 요약 / 우 RAW를 '섹션 행'으로 짝지어 시작점 정렬 (CSS 그리드) */
.note-grid { display: grid; grid-template-columns: 1fr 1fr; column-gap: 16px; row-gap: 0; align-items: start; }
.gcell { min-width: 0; }
.note-col-head { font-size: 13px; font-weight: 800; margin: 6px 2px 8px; display: flex; align-items: center; gap: 6px; letter-spacing: 0.02em; }
.note-col-head::before { content: ""; width: 3px; height: 13px; border-radius: 2px; background: currentColor; }
.note-col-head.ai { color: var(--primary); }
.note-col-head.raw { color: var(--streak); }
.note-col-title { font-size: 15px; font-weight: 800; letter-spacing: -0.01em; margin: 2px 2px 6px; line-height: 1.35; }
.empty.sm { padding: 24px 10px; font-size: 13px; }
.note-split-seg { display: none; } /* 데스크탑에선 토글 숨김(좌우 동시) */
/* 섹션 시작점 정렬: 각 섹션 첫 제목의 상단 여백을 동일하게 */
.note-grid .note-sec > .section-title:first-child,
.note-grid .note-sec > .note-subhead:first-child { margin-top: 10px; }
.note-grid .note-detail-actions { margin-bottom: 8px; }
/* 모바일: 토글로 AI 요약/RAW 한 쪽씩 전체폭(단일 컬럼) */
@media (max-width: 699px) {
  .note-grid { grid-template-columns: 1fr; }
  .note-split-seg { display: flex; }
  .note-grid .note-col-head { display: none; }
  .note-grid.show-ai .raw-cell { display: none; }
  .note-grid.show-raw .ai-cell { display: none; }
}

/* 노트 편집기 */
.note-form { display: flex; flex-direction: column; gap: 16px; }
.note-field { display: flex; flex-direction: column; gap: 7px; }
.note-label { font-size: 13.5px; font-weight: 700; color: var(--muted); }
.note-form input[type=text], .note-form input[type=date], .note-form textarea { font-size: 16.5px; padding: 15px; }
.note-form textarea { min-height: 60vh; line-height: 1.7; resize: vertical; }
input[type=date] {
  width: 100%; background: var(--surface-2); border: 1.5px solid transparent; color: var(--fg);
  border-radius: var(--radius-sm); padding: 13px 14px; font-size: 15.5px; font-family: inherit;
}
input[type=date]:focus { outline: 0; border-color: var(--primary); background: var(--surface); }

/* ===== 모의고사(시험) ===== */
.exam-lead { font-size: 16px; color: var(--fg-2); line-height: 1.65; }
.exam-lead b { color: var(--fg); font-weight: 700; }
.exam-steps { margin: 14px 0 4px; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.exam-steps li { display: flex; gap: 9px; align-items: flex-start; font-size: 14.5px; color: var(--fg-2); line-height: 1.55; }
.exam-steps li b { flex: 0 0 auto; width: 22px; height: 22px; border-radius: 999px; background: var(--primary); color: #fff; font-size: 12.5px; font-weight: 800; display: flex; align-items: center; justify-content: center; margin-top: 1px; }
.exam-start-btns { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.exam-label { font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: -0.01em; }
.exam-word { font-size: 40px; font-weight: 800; letter-spacing: -0.02em; margin: 4px 0 2px; }
.exam-word .k { font-size: 15px; font-weight: 700; color: var(--muted); margin-left: 10px; letter-spacing: 0; }
.exam-ask { font-size: 14.5px; color: var(--muted); margin-bottom: 14px; line-height: 1.55; }
.exam-card textarea { min-height: 150px; font-size: 16.5px; line-height: 1.7; padding: 15px; }
.exam-ans { margin-top: 16px; background: var(--surface-2); border-radius: var(--radius-sm); padding: 16px; }
.exam-ans-label { font-size: 12.5px; font-weight: 800; color: var(--good); letter-spacing: 0.02em; }
.exam-ans-ko { font-size: 18px; font-weight: 800; margin-top: 6px; letter-spacing: -0.01em; }
.exam-uses { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 4px; }
.exam-use { background: var(--primary-weak); color: var(--primary); font-size: 13px; font-weight: 600; padding: 4px 11px; border-radius: 999px; }
.exam-ans .note-ex { margin-top: 10px; }
.exam-mark { display: flex; gap: 10px; margin-top: 4px; }
.exam-mark .btn { flex: 1; }
/* 단계 표시 (1단계 뜻 → 2단계 예문) */
.exam-stepline { font-size: 13px; font-weight: 700; color: var(--primary); margin: 2px 0 10px; }
.exam-ans.ref { background: var(--surface-3); }
.exam-ans.ref .exam-ans-label { color: var(--muted); }
/* 빈칸 채점 (뜻·예문 입력 + 채움 피드백) */
.exam-blank-row { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.exam-blank-row input { flex: 1; }
.exam-blank-row input.ok { border-color: var(--good); }
.exam-blank-row input.bad { border-color: var(--bad); }
.exam-blank-fb { flex: 0 0 auto; width: 22px; display: inline-flex; align-items: center; justify-content: center; }
.exam-blank-fb.ok { color: var(--good); }
.exam-blank-fb.bad { color: var(--bad); }
.exam-ex-field { margin: 12px 0; }
.exam-ex-label { font-size: 14.5px; font-weight: 700; color: var(--fg-2); margin-bottom: 6px; }
.exam-ex-field .exam-blank-row { margin: 0; }
.exam-fb-msg { font-size: 12.5px; color: var(--muted); margin-top: 5px; }
.exam-fb-msg.bad { color: var(--bad); }
/* 모범답안 출처 구분 (교재 / 수업) */
.exam-src { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 800; margin: 14px 0 6px; letter-spacing: 0.02em; }
.exam-src::before { content: ""; width: 3px; height: 12px; border-radius: 2px; background: currentColor; display: inline-block; }
.exam-src.book { color: var(--primary); }
.exam-src.class { color: var(--streak); }
.exam-ans-label + .exam-src { margin-top: 4px; }
.exam-src-line { font-size: 14.5px; color: var(--fg-2); line-height: 1.55; margin: 5px 0; }

/* AI 코치 (교정 챗봇) */
.coach-input {
  width: 100%; min-height: 96px; resize: vertical; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--fg); font: inherit; font-size: 15px; line-height: 1.5; padding: 12px 14px;
}
.coach-input:focus { outline: none; border-color: var(--primary); background: var(--surface); }
.coach-btn {
  width: 100%; margin-top: 10px; min-height: 48px; border: 0; border-radius: var(--radius-sm);
  background: var(--primary); color: #fff; font-size: 15px; font-weight: 700; cursor: pointer;
}
.coach-btn:active { background: var(--primary-press); }
.coach-btn:disabled { background: var(--surface-3); color: var(--muted); cursor: default; }
.coach-out { margin-top: 14px; }
.coach-loading { color: var(--muted); font-size: 14px; text-align: center; padding: 18px 0; }
.coach-err {
  color: var(--bad); background: var(--bad-weak); border-radius: var(--radius-sm);
  font-size: 14px; padding: 12px 14px; text-align: center;
}
.coach-result { padding: 16px; }
.coach-verdict { font-size: 12.5px; font-weight: 700; color: var(--muted); margin-bottom: 8px; }
.coach-verdict.good { display: flex; align-items: center; gap: 6px; color: var(--good); font-size: 14px; }
.coach-corrected {
  font-size: 17px; font-weight: 600; line-height: 1.5; color: var(--fg);
  background: var(--primary-weak); border-radius: var(--radius-sm); padding: 12px 14px;
}
.coach-copy {
  display: inline-flex; align-items: center; gap: 5px; margin-top: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--fg-2); font-size: 13px; font-weight: 600; font-family: inherit;
  border-radius: 999px; padding: 6px 12px; cursor: pointer;
}
.coach-copy:active { background: var(--surface-3); }
.coach-sec-title { font-size: 12.5px; font-weight: 700; color: var(--muted); margin: 16px 0 6px; }
.coach-notes ul { margin: 0; padding-left: 18px; }
.coach-notes li { font-size: 14.5px; line-height: 1.6; color: var(--fg-2); }
.coach-trend-body {
  font-size: 14.5px; line-height: 1.6; color: var(--fg-2);
  background: var(--surface-2); border-radius: var(--radius-sm); padding: 11px 13px;
}

/* AI 코치 기록(history) */
.coach-hist-head { display: flex; align-items: center; justify-content: space-between; margin: 22px 2px 10px; }
.coach-hist-title { font-size: 13px; font-weight: 700; color: var(--muted); }
.coach-hist-clear { border: 0; background: none; color: var(--muted); font-size: 12.5px; font-weight: 600; font-family: inherit; cursor: pointer; padding: 5px 8px; border-radius: 8px; }
.coach-hist-clear.armed { color: var(--bad); background: var(--bad-weak); }
.coach-item { padding: 14px 16px; margin-bottom: 10px; }
.coach-item-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.coach-item-time { font-size: 12px; color: var(--muted); font-weight: 600; }
.coach-item-del { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 4px; display: flex; border-radius: 8px; }
.coach-item-del:active { color: var(--bad); background: var(--bad-weak); }
.coach-item-orig { font-size: 14px; color: var(--muted); line-height: 1.5; margin-bottom: 8px; }

/* 알림(웹 푸시) 카드 — 홈 하단 */
.push-card { }
.push-row { display: flex; align-items: center; gap: 12px; }
.push-info { flex: 1; min-width: 0; }
.push-t { font-size: 15px; font-weight: 700; }
.push-s { color: var(--muted); font-size: 13px; margin-top: 3px; line-height: 1.5; }
.push-row .btn { flex: none; width: auto; }
.push-remind { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.push-remind-lbl { font-size: 14px; font-weight: 600; color: var(--fg-2); }
.push-remind-sel { font: inherit; font-size: 14.5px; font-weight: 600; color: var(--fg); background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; cursor: pointer; }
.push-remind-sel:disabled { opacity: .6; }
