/* mobile-check.css — check.html 모바일(≤640px) 전용 화면. */
@media (max-width: 640px) {
  body { padding: 50px 12px 14px !important; }   /* 위 50px 은 체험 배지 자리 */
  .container { max-width: none; }

  /* Check Bot 띠: 화면 위에 붙어 있던 것을 본문 맨 위 한 줄로 */
  .guardian-route-pill {
    position: static !important; width: auto !important;
    margin: 0 0 12px; padding: 8px 10px 8px 14px;
    border-radius: 999px;
  }
  .guardian-info { text-align: left; margin-right: 8px; }
  .guardian-tag { font-size: 11px; }
  .guardian-msg { font-size: 12px; font-style: normal; }
  .guardian-avatar { width: 40px; height: 40px; flex-shrink: 0; }

  .back { font-size: 14px; padding: 6px 0; margin-bottom: 4px; }
  h1 { font-size: 24px !important; margin: 0 0 12px !important; letter-spacing: -0.02em !important; }

  /* 위 두 버튼: 반반 */
  .topbar { justify-content: stretch; gap: 8px; margin: 0 0 12px !important; }
  .btn-enhance { flex: 1; justify-content: center; margin: 0 !important; padding: 11px 8px !important; font-size: 14px !important; border-radius: 12px; }
  .topbar .btn { flex: 1; padding: 11px 8px; font-size: 14px; border-radius: 12px; }

  /* 과목·기간·기준일 */
  .toggles { gap: 8px; margin: 0 0 12px; }
  .pill { padding: 4px; gap: 2px; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .pill .tab { padding: 9px 13px; font-size: 14px; white-space: nowrap; }
  #periodPill { margin-left: auto; }
  .refdate { flex: 1 1 100%; justify-content: space-between; padding: 6px 8px 6px 14px; }
  .refdate label { font-size: 14px; font-weight: 800; color: #555; }
  .refdate input[type="date"] { flex: 1; margin-left: 8px; }

  /* 요약 두 칸 */
  .summary { gap: 10px; margin: 0 0 12px; }
  .card { padding: 14px 8px; font-size: 12px; line-height: 1.5; border-radius: 14px; }
  .card b { font-size: 22px; display: block; margin-top: 4px; }

  /* 나의 오답 지문: 제목 한 줄, 버튼 세 개는 아래 한 줄 */
  #rootProfileCard { padding: 14px !important; }
  #rootProfileCard > div:first-child > div:first-child { font-size: 15px !important; flex: 1 1 100%; }
  #rootProfileCard > div:first-child > div:last-child { flex: 1 1 100%; }
  #rootProfileCard > div:first-child > div:last-child .btn { flex: 1; font-size: 12px !important; padding: 9px 6px !important; }
  #rootStatement { font-size: 13px !important; }
  #rootChips > * { font-size: 12px !important; }

  /* 요약 카드와 원그래프를 짝지어 세운다: 실수 유형 카드 → 실수 유형 그래프 → 집중 파트 카드 → 집중 파트 그래프 */
  #lock-target-area { display: flex; flex-direction: column; gap: 12px; }
  #lock-target-area > * { margin: 0 !important; }
  .summary, .chart-grid { display: contents; }
  .topbar { order: 1; }
  .toggles { order: 2; }
  .summary .card:nth-child(1) { order: 3; }
  .chart-grid .chart-box:nth-child(1) { order: 4; }
  .summary .card:nth-child(2) { order: 5; }
  .chart-grid .chart-box:nth-child(2) { order: 6; }
  #rootProfileCard { order: 7; }
  #lock-target-area > .table-card:last-child { order: 8; }
  /* 카드와 그래프를 한 덩어리처럼 붙인다 */
  .summary .card { border-radius: 14px 14px 0 0; margin-bottom: -12px !important; padding-bottom: 12px; box-shadow: none; border-bottom: 1px dashed #f3d6dd; }
  .chart-box { height: 280px; border-radius: 0 0 14px 14px; flex-direction: column; justify-content: flex-start; padding: 12px 10px 10px; }
  .chart-box::before { font-size: 13px; font-weight: 900; color: #888; margin-bottom: 4px; }
  .chart-grid .chart-box:nth-child(1)::before { content: "🔍 실수 유형 비율"; }
  .chart-grid .chart-box:nth-child(2)::before { content: "⚠️ 집중 필요 파트 비율"; }
  .chart-box .donut-center { top: calc(50% + 12px); }
  .donut-label { font-size: 13px; }
  .donut-number { font-size: 24px; }

  /* ── 도구 대장간 창: 화면 안에 들어오게, 떠 있는 버튼보다 위에 ── */
  #forgeModal { z-index: 9300 !important; padding: 12px; }
  #forgeModal .lovely-modal {
    padding: 44px 18px 18px !important;
    max-height: calc(100vh - 24px); overflow-y: auto; -webkit-overflow-scrolling: touch;
    border-radius: 24px !important;
  }
  #forgeModal .modal-close-x { top: 8px !important; right: 8px !important; width: 40px; height: 40px; font-size: 20px; color: #bbb; }
  #forgeModal .modal-title { font-size: 20px !important; margin: 0 0 12px !important; }
  #forgeModal .tool-preview-box { width: 120px !important; height: 120px !important; font-size: 44px !important; margin: 0 auto 12px !important; border-radius: 28px; }
  #forgeModal .tool-preview-box img { max-width: 80%; max-height: 80%; }
  #forgeModal .stat-row { padding: 10px 0; }
  #forgeModal .stat-label { font-size: 14px; }
  #forgeModal .stat-badge { padding: 5px 12px; font-size: 14px; }
  #forgeModal .tool-footer-info { margin: 12px 0 0 !important; }
  #forgeModal .tool-footer-info h2 { font-size: 17px !important; }
  #forgeModal .tool-footer-info p { font-size: 12px !important; }
  #forgeModal .inner-enhance-btn { padding: 14px !important; font-size: 15px !important; margin-top: 12px !important; border-radius: 14px !important; }

  /* ── Check Bot·원인·상세·사진 창: 떠 있는 버튼보다 위에 ── */
  #checkBotModal, #causeModal, #rootDetailModal, #ocrModal { z-index: 9300 !important; }
  #checkBotModal > div { max-height: calc(100vh - 40px) !important; }
  /* 오답 원인 상세·예방 루트·회복 그래프 창: 흰 바탕에 흰 글씨로 나오던 것 */
  #rootDetailModal > div { background: #fff !important; color: #222 !important; padding: 16px 14px !important; }
  #rootDetailTitle { font-size: 17px !important; color: #222 !important; margin-bottom: 10px !important; }
  #rootDetailBody { font-size: 14px !important; color: #333 !important; line-height: 1.6 !important; }
  #rootDetailBody * { color: inherit; }
  #rootDetailBody table { width: 100%; border-collapse: collapse; font-size: 13px; }
  #rootDetailBody th, #rootDetailBody td { padding: 8px 4px !important; border-bottom: 1px solid #eee !important; text-align: center; font-size: 13px !important; }
  #rootDetailBody th { background: #fff0f3; color: #b23a48; font-weight: 800; }
  #rootDetailBody td:first-child, #rootDetailBody th:first-child { text-align: left; }
  #rootDetailClose { font-size: 15px !important; padding: 12px !important; }

  /* ── 기록 표 → 카드 줄 ── */
  .table-card > table { display: block; }
  .table-card > table > thead { display: none; }
  #checkBody { display: block; }
  #checkBody tr {
    display: flex; flex-wrap: wrap; gap: 8px;
    padding: 12px; border-bottom: 1px solid var(--line, #eee);
  }
  #checkBody tr:last-child { border-bottom: none; }
  #checkBody td { display: block; padding: 0 !important; border: none !important; text-align: left; }
  /* 1줄: 기록 이름 */
  #checkBody td:nth-child(1) { flex: 1 1 100%; font-size: 16px; font-weight: 800; padding: 6px 8px !important; border-radius: 8px; background: #faf9f7; min-height: 40px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
  #checkBody .row-day { font-size: 12px; color: #999; font-weight: 700; }
  /* 2줄: 중분류 · 소분류 반반 */
  #checkBody td:nth-child(2), #checkBody td:nth-child(3) { flex: 1 1 calc(50% - 4px); min-width: 0; }
  /* 3줄: 실수 원인 한 줄 */
  #checkBody td:nth-child(4) { flex: 1 1 100%; }
  #checkBody select { width: 100%; font-size: 15px !important; padding: 8px 10px !important; }
  /* 4줄: 관리 버튼 */
  #checkBody td:nth-child(5) { flex: 1 1 100%; display: flex; align-items: center; gap: 4px; margin-top: 2px; }
  #checkBody td:nth-child(5) button { font-size: 20px !important; width: 44px; height: 40px; margin: 0 !important; border-radius: 10px; }
  #checkBody td:nth-child(5) .del-btn { margin-left: auto !important; width: auto; font-size: 13px !important; padding: 0 14px !important; }
}
