/* mobile-record.css — record.html(내신 기록) 모바일(≤640px) 전용 화면. */
@media (max-width: 640px) {
  .page-wrap { padding: 14px 12px calc(96px + env(safe-area-inset-bottom)) !important; }
  .back { font-size: 14px; padding: 6px 0; margin-bottom: 8px; }
  h1 { font-size: 22px; }
  .rc-title-row { gap: 8px; }
  .lock-icon { font-size: 22px; min-width: 40px; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; }
  #secretOverlay { font-size: 20px; }
  .page-sub { font-size: 12px; margin-bottom: 14px; line-height: 1.5; }

  /* 학년 가중치: 제목 한 줄, 셀렉트 한 줄, 설명 한 줄 */
  .rc-preset { padding: 12px; gap: 8px; margin: 0 0 12px; }
  .rc-preset-label { font-size: 13px; flex: 1 1 100%; }
  .rc-preset-select { flex: 1 1 100%; min-width: 0; font-size: 16px !important; padding: 9px 10px !important; }
  .rc-preset-hint { font-size: 11px; line-height: 1.5; }

  /* 요약 4칸: 2×2 */
  .rc-summary { grid-template-columns: repeat(2, 1fr); gap: 10px 8px; padding: 14px 12px; margin-bottom: 12px; }
  .rc-stat .lbl { font-size: 12px; }
  .rc-stat .num { font-size: 28px; }
  .rc-stat .sub { font-size: 11px; }
  .rc-trend { height: 56px; }
  .rc-trend-label { font-size: 9px; }

  /* 교과조합·평가 구조: 버튼은 아래 줄에 같은 폭 */
  .rc-preset > div:first-child { font-size: 15px !important; }
  #naSubject { font-size: 14px !important; padding: 7px 10px !important; min-height: 38px; flex: 1 1 100%; }
  #naAddBtn, #naPlanBtn {
    flex: 1; min-height: 42px; font-size: 14px !important; font-weight: 800; padding: 9px 8px !important;
    background: var(--main, #ff8fa3) !important; color: #fff !important; border: none !important; border-radius: 12px !important;
  }
  #naPlanBtn { background: #fff !important; color: var(--main, #ff8fa3) !important; border: 1.5px solid var(--main, #ff8fa3) !important; }
  #comboBox, #naBox { font-size: 13px; }
  /* 교과조합 표(6열) → 조합마다: 왼쪽 이름 + 오른쪽에 가장 유리한(가장 낮은) 등급을 크게,
     그 아래 나머지 가중치 넷은 작은 글씨 한 줄 */
  #comboBox > div[style*="overflow-x"] { overflow: visible !important; }
  #comboBox table { display: block; width: 100% !important; min-width: 0 !important; font-size: 12px !important; }
  #comboBox table thead { display: none; }
  #comboBox table tbody { display: block; }
  #comboBox table tr { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; padding: 10px 0; border-bottom: 1px solid #f0e0e6; }
  #comboBox table tr:last-child { border-bottom: none; }
  #comboBox table td { display: block; padding: 0 !important; border: none !important; text-align: left !important; }
  /* 1줄: 이름 (왼쪽) */
  #comboBox table td:first-child { order: 1; flex: 1 1 0; min-width: 0; font-size: 15px; font-weight: 800; line-height: 1.3; }
  /* 1줄: 그 조합에서 가장 낮게 나오는 등급 (오른쪽, 크게) — 페이지가 굵게(900) 찍는 칸이 그것 */
  #comboBox table td[style*="font-weight:900"] { order: 2; flex: 0 0 auto; font-size: 24px !important; font-weight: 900 !important; color: var(--main, #ff8fa3); text-align: right !important; line-height: 1; }
  #comboBox table td[style*="font-weight:900"]::before { display: block; font-size: 10px; color: #aaa; font-weight: 800; margin-bottom: 2px; text-align: right; }
  /* 줄바꿈 */
  #comboBox table tr::after { content: ""; order: 3; flex-basis: 100%; height: 0; }
  /* 2줄: 나머지 가중치 넷 */
  #comboBox table td:not(:first-child):not([style*="font-weight:900"]) { order: 4; flex: 1 1 0; font-size: 13px; font-weight: 700; color: #666; white-space: nowrap; }
  #comboBox table td:not(:first-child):not([style*="font-weight:900"])::before { font-size: 10px; color: #aaa; font-weight: 800; margin-right: 4px; }
  #comboBox table td:nth-child(2)::before { content: "20:30:50"; }
  #comboBox table td:nth-child(3)::before { content: "20:40:40"; }
  #comboBox table td:nth-child(4)::before { content: "20:80"; }
  #comboBox table td:nth-child(5)::before { content: "30:30:40"; }
  #comboBox table td:nth-child(6)::before { content: "전학년"; }

  /* 학기 카드 */
  .rc-grid { gap: 10px; }
  .rc-card { padding: 14px; border-radius: 16px; }
  .rc-title { font-size: 16px; }
  .rc-grade-pill { font-size: 11px; padding: 3px 9px; }
  .rc-avg { font-size: 26px; }
  .rc-tip { font-size: 12px; }
  .rc-mode-toggle { justify-content: stretch; }
  .rc-mode-toggle-inner { display: flex; width: 100%; font-size: 12px; }
  .rc-mode-btn { flex: 1; padding: 9px 6px; }

  /* ── 과목 표 → 과목마다 카드 줄 ──
     시험별 입력(11칸): 1줄 과목·단위·최종·삭제, 2줄 가중치 3칸, 3줄 점수 3칸
     학기 종합(5칸): 1줄 과목·단위·등급·최종·삭제 */
  .rc-card .rc-detail > div[style*="overflow-x"] { overflow: visible !important; }
  .rc-subj-tbl, .rc-subj-tbl tbody { display: block; width: 100%; }
  .rc-subj-tbl thead { display: none; }
  .rc-subj-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px 5px; padding: 10px 0; border-bottom: 1px solid #f0e0e6; align-items: end; }
  .rc-subj-row:last-child { border-bottom: none; }
  .rc-subj-row td { display: block; padding: 0 !important; border: none !important; min-width: 0; }
  .rc-subj-row td::before { display: block; font-size: 10px; font-weight: 800; color: #aaa; margin-bottom: 3px; text-align: center; white-space: nowrap; }
  .rc-subj-row input { font-size: 16px !important; padding: 8px 4px !important; min-height: 40px; }
  .rc-subj-row .col-name-cell { grid-column: 1 / 4; grid-row: 1; }
  .rc-subj-row .col-name-cell::before { content: "과목"; text-align: left; }
  .rc-subj-row .rc-subj-name-input { text-align: left !important; }
  .rc-subj-row td:nth-child(2) { grid-column: 4 / 5; grid-row: 1; }
  .rc-subj-row td:nth-child(2)::before { content: "단위"; }
  .rc-subj-row .col-final { grid-column: 5 / 6; grid-row: 1; font-size: 18px !important; padding-bottom: 8px !important; }
  .rc-subj-row .col-final::before { content: "최종"; }
  .rc-subj-row .col-del { grid-column: 6 / 7; grid-row: 1; text-align: center; padding-bottom: 6px !important; }
  .rc-subj-row .col-del button { font-size: 18px; width: 40px; height: 40px; }
  /* 시험별 입력: 3~8번째 칸 */
  .rc-subj-row:has(> td:nth-child(10)) td:nth-child(3) { grid-column: 1 / 3; grid-row: 2; }
  .rc-subj-row:has(> td:nth-child(10)) td:nth-child(4) { grid-column: 3 / 5; grid-row: 2; }
  .rc-subj-row:has(> td:nth-child(10)) td:nth-child(5) { grid-column: 5 / 7; grid-row: 2; }
  .rc-subj-row:has(> td:nth-child(10)) td:nth-child(6) { grid-column: 1 / 3; grid-row: 3; }
  .rc-subj-row:has(> td:nth-child(10)) td:nth-child(7) { grid-column: 3 / 5; grid-row: 3; }
  .rc-subj-row:has(> td:nth-child(10)) td:nth-child(8) { grid-column: 5 / 7; grid-row: 3; }
  .rc-subj-row:has(> td:nth-child(10)) td:nth-child(3)::before { content: "가중치 중간 %"; }
  .rc-subj-row:has(> td:nth-child(10)) td:nth-child(4)::before { content: "가중치 기말 %"; }
  .rc-subj-row:has(> td:nth-child(10)) td:nth-child(5)::before { content: "가중치 수행 %"; }
  .rc-subj-row:has(> td:nth-child(10)) td:nth-child(6)::before { content: "중간 등급"; }
  .rc-subj-row:has(> td:nth-child(10)) td:nth-child(7)::before { content: "기말 등급"; }
  .rc-subj-row:has(> td:nth-child(10)) td:nth-child(8)::before { content: "수행 점수"; }
  /* 학기 종합: 3번째 칸이 등급 */
  .rc-subj-row:not(:has(> td:nth-child(10))) .col-name-cell { grid-column: 1 / 3; grid-row: 1; }
  .rc-subj-row:not(:has(> td:nth-child(10))) td:nth-child(2) { grid-column: 3 / 4; grid-row: 1; }
  .rc-subj-row:not(:has(> td:nth-child(10))) td:nth-child(3) { grid-column: 4 / 5; grid-row: 1; }
  .rc-subj-row:not(:has(> td:nth-child(10))) td:nth-child(3)::before { content: "등급"; }
  .rc-subj-row td[colspan] { grid-column: 1 / -1; }

  .rc-add-row { gap: 6px; }
  .rc-add-row button { font-size: 13px; padding: 9px 12px; min-height: 38px; }
  .rc-detail-foot { flex-wrap: wrap; font-size: 13px; }
  .rc-detail-foot .val { font-size: 20px; }
  .rc-close { font-size: 13px; padding: 8px 0; }
  .rc-source-note { font-size: 12px; }
  .rc-clear { font-size: 13px; padding: 10px 0; }

  #naModal { z-index: 9300 !important; }   /* 떠 있는 버튼보다 위 */
  #naModal > div { padding: 16px 14px !important; max-height: calc(100vh - 32px) !important; }
  #naTitle { font-size: 16px !important; }
  /* 시험 기록 창: 시험일·수행 제출일을 한 줄씩, 이름표는 12px */
  #naBody b { font-size: 12px !important; }
  #naBody div:has(> #naExamDate), #naBody div:has(> #naDueDate) { flex: 1 1 100% !important; }
  #naBody div[style*="display:flex"] { flex-wrap: wrap; }
  #naBody input[type="date"] { width: 100%; }
  #naBody { font-size: 14px !important; }
  /* 저장·닫기: 이 페이지에는 .btn 스타일이 없어 기본 회색 버튼으로 나오던 것 */
  #naSaveBtn, #naCloseBtn {
    font-size: 15px !important; font-weight: 800; min-height: 44px;
    border-radius: 12px !important; border: none !important; cursor: pointer;
  }
  #naSaveBtn { background: var(--main, #ff8fa3) !important; color: #fff !important; }
  #naCloseBtn { background: #fff !important; color: var(--main, #ff8fa3) !important; border: 1.5px solid var(--main, #ff8fa3) !important; }
}
