/* mobile-exam.css — exam.html 모바일(≤640px) 전용 화면. */
@media (max-width: 640px) {
  body { padding: 14px 12px calc(96px + env(safe-area-inset-bottom)) !important; }
  .top-nav-wrapper { margin-bottom: 10px; }
  .back-btn { font-size: 14px; padding: 6px 0; }
  .page-title { font-size: 22px; }

  /* 모고/내신 토글: 화면 폭 전체 */
  .toggle-area { justify-content: stretch; margin-bottom: 12px; }
  .toggle-group { flex: 1; }
  .toggle-btn { flex: 1; font-size: 14px; padding: 10px 12px; }

  /* 그래프 카드와 점수 카드를 위아래로 */
  .dashboard-grid { grid-template-columns: 1fr !important; gap: 12px; margin-bottom: 12px; }
  .chart-container { padding: 16px 12px 12px; }
  .card-label { font-size: 15px; margin-bottom: 6px; }
  .legend { font-size: 12px; gap: 14px; margin-bottom: 8px; }
  .legend-dot { width: 10px; height: 10px; }
  .chart-wrap { min-height: 300px; }
  #gradeRangeControl { font-size: 13px !important; }
  #gradeRangeControl input { width: 56px !important; font-size: 16px !important; padding: 6px !important; }

  /* 과목 점수 6칸: 3열 2줄 */
  .score-grid-wrapper { grid-template-columns: repeat(3, 1fr); }
  .score-chip { padding: 14px 4px; border-right: 1.5px solid var(--border); border-bottom: 1.5px solid var(--border); }
  .score-chip:nth-child(2n) { border-right: 1.5px solid var(--border); }
  .score-chip:nth-child(3n) { border-right: none; }
  .score-chip:nth-last-child(-n+2) { border-bottom: 1.5px solid var(--border); }
  .score-chip:nth-last-child(-n+3) { border-bottom: none; }
  .score-chip .subj { font-size: 12px; }
  .score-chip .val { font-size: 26px; }
  .score-chip .gr { font-size: 12px; }

  /* 목표 등급 */
  .goal-toggle-btn { font-size: 14px; padding: 14px 16px; }
  .goal-content.open { max-height: 400px; }
  .goal-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 12px; }
  .goal-input-box label { font-size: 12px; }
  .goal-input-box input { font-size: 16px !important; padding: 8px 4px !important; min-height: 40px; }

  /* 아래 고정 메뉴: 손가락 높이 + 홈바 여백 */
  .bottom-nav { height: calc(64px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); }
  .nav-btn { font-size: 13px; gap: 2px; }
  .nav-icon { font-size: 20px; }

  /* 떠 있는 버튼은 아래 메뉴(64px) 위로 */
  html body #userFab  { bottom: calc(80px + env(safe-area-inset-bottom)) !important; }
  html body #magFab   { bottom: calc(128px + env(safe-area-inset-bottom)) !important; }
  html body #helpFab  { bottom: calc(176px + env(safe-area-inset-bottom)) !important; }
  /* 스크랩 버튼이 화면 위 가운데에 떠 있던 것을 오른쪽 줄로 */
  html body #scrapFab { top: auto !important; left: auto !important; transform: none !important; right: 8px !important; bottom: calc(224px + env(safe-area-inset-bottom)) !important; }
}
