.mypage-container {
  margin: 70px;
}

.mypage-section-top {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  margin: 24px auto;
}

.note-section,
.todo-section,
.review-notes {
  flex: 1 1 360px;
  min-width: 320px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.06);
  background: #ffffff;
  border: 1px solid #e5e5e5;
  border-radius: 18px;
  padding: 20px;
}

.note-section h2,
.todo-section h2,
.review-notes h2 {
  margin-bottom: 16px;
  font-size: 18px;
  color: #333;
}

.review-notes-list {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 12px;
  scroll-snap-type: x mandatory;
  -ms-overflow-style: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(116, 118, 212, 0.55) transparent;
}

.review-notes-list::-webkit-scrollbar {
  display: block;
  height: 8px;
}

.review-notes-list::-webkit-scrollbar-track {
  background: transparent;
}

.review-notes-list::-webkit-scrollbar-thumb {
  background: rgba(116, 118, 212, 0.55);
  border-radius: 999px;
}

.review-note-card {
  flex: 0 0 280px;
  min-width: 280px;
  background: #f7f7ff;
  border: 1px solid #e5e5f0;
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.04);
  scroll-snap-align: start;
}

.review-note-card h4 {
  margin: 0 0 10px;
  font-size: 16px;
  color: #333;
}

.review-note-card p {
  margin: 8px 0;
  font-size: 13px;
  color: #555;
  line-height: 1.5;
}

.review-note-card .label {
  color: #666;
  font-weight: 600;
}

.review-note-empty {
  color: #888;
  font-size: 14px;
  line-height: 1.6;
}

#note-input {
  width: 100%;
  min-height: 140px;
  border: 1px solid #d9d9d9;
  border-radius: 12px;
  padding: 14px;
  font-size: 14px;
  resize: vertical;
  margin-bottom: 12px;
}

#save-note,
#add-todo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border: none;
  border-radius: 10px;
  background: #7476d4;
  color: #fff;
  cursor: pointer;
  font-size: 14px;
}

#save-note:hover,
#add-todo:hover,
.todo-delete:hover {
  opacity: 0.92;
}

.note-display {
  margin-top: 16px;
  white-space: pre-wrap;
  color: #555;
  line-height: 1.6;
}

.todo-input-row {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

#todo-input {
  flex: 1;
  padding: 12px 14px;
  border: 1px solid #d9d9d9;
  border-radius: 10px;
  font-size: 14px;
}

.todo-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.todo-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #f0f0f0;
}

.todo-item:last-child {
  border-bottom: none;
}

.todo-checkbox {
  width: 18px;
  height: 18px;
}

.todo-text {
  flex: 1;
  color: #333;
}

.todo-text.done {
  text-decoration: line-through;
  color: #999;
}

.todo-delete {
  padding: 6px 12px;
  border: 1px solid #dedede;
  border-radius: 10px;
  background: #fff;
  color: #666;
  cursor: pointer;
  font-size: 13px;
}

.bottom-link {
  display: flex;
  gap: 20px;
  font-size: 12px;
  margin-top: 80px;
  color: #ccc;
}

#logout-button {
  font-size: 12px;
  background-color: #fff;
  color: #ccc;
  border: none;
  cursor: pointer;
}

/* ===================================================
   ✅ 마이페이지 모바일 대응 반응형 스타일 (768px 이하)
   =================================================== */
@media (max-width: 768px) {
  .mypage-container {
    /* 기존 70px 마진은 모바일에서 너무 크므로 여백을 대폭 줄여 공간을 확보합니다. */
    margin: 30px 15px;
  }

  .mypage-container h1 {
    font-size: 24px; /* 모바일 화면에 맞춰 타이틀 크기 축소 */
    text-align: center; /* 중앙 정렬로 안정감 부여 */
  }

  #welcome {
    text-align: center;
    margin-bottom: 24px;
    font-size: 15px;
  }

  .mypage-section-top {
    /* flex-wrap이 있지만 모바일에서는 확실하게 세로(column)로 떨어지도록 강제합니다. */
    flex-direction: column;
    gap: 16px;
    margin: 16px auto;
  }

  .note-section,
  .todo-section,
  .review-notes {
    /* 고정된 최소 가로폭(320px)을 해제하여 스마트폰 너비에 유연하게 늘어나고 줄어들게 만듭니다. */
    flex: 1 1 100%;
    min-width: 0;
    padding: 16px; /* 내부 여백을 살짝 줄여 답답함을 해소합니다. */
  }

  /* 나의 메모 섹션 수정 */
  #note-input {
    min-height: 120px; /* 모바일 입력창 높이 최적화 */
    padding: 10px;
  }

  #save-note {
    width: 100%; /* 모바일에서는 버튼을 가득 채워 터치하기 쉽게 만듭니다. */
    padding: 12px;
  }

  /* 할 일 목록 섹션 수정 */
  .todo-input-row {
    gap: 8px;
  }

  #todo-input {
    padding: 10px 12px;
  }

  /* 오답 노트 가로 스크롤 카드 레이아웃 최적화 */
  .review-notes-list {
    gap: 12px;
    padding-bottom: 8px;
  }

  .review-note-card {
    /* 작은 모바일 화면(예: 320px~360px 가로폭 기기)에서도 카드가 잘리지 않고 꽉 차게 조절 */
    flex: 0 0 260px;
    min-width: 260px;
    padding: 14px;
  }

  /* 하단 링크 영역 정렬 */
  .bottom-link {
    margin-top: 50px; /* 과도한 상단 마진 줄임 */
    justify-content: center; /* 모바일 화면 중앙으로 배치 */
    gap: 30px;
  }
}
