/* 1. 나눔바른고딕(NanumBarunGothic) 폰트 불러오기 (Naver CDN) */
@import url("https://hangeul.pstatic.net/hangeul_static/css/nanum-barun-gothic.css");

/* [핵심 수정] 모든 요소의 너비 계산에 테두리와 여백을 포함시킴 (넘침 방지) */
*, *::before, *::after {
  box-sizing: border-box;
}

:root {
  /* 메인 컬러 팔레트 */
  --primary-color: #4f46e5;
  --primary-hover: #4338ca;
  --bg-color: #f3f4f6;
  --card-bg: #ffffff;
  
  /* 텍스트 컬러 */
  --text-main: #1f2937;
  --text-sub: #6b7280;
  --text-placeholder: #9ca3af;

  /* 상태 컬러 */
  --danger-bg: #fee2e2;
  --danger-text: #ef4444;
  --warning-bg: #fef3c7;
  --warning-text: #f59e0b;
  --info-bg: #e0f2fe;
  --info-text: #0ea5e9;
  --success-bg: #d1fae5;
  --success-text: #059669;
  
  /* 버튼용 소프트 컬러 (빨강) */
  --soft-red-bg: #fff1f2;
  --soft-red-text: #be123c;
  --soft-red-border: #fda4af;

  /* 버튼용 소프트 컬러 (초록 - 메모 저장용) */
  --soft-green-bg: #f0fdf4;       
  --soft-green-text: #15803d;     
  --soft-green-border: #86efac;   
  --soft-green-hover: #dcfce7;    

  /* UI 요소 */
  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow-soft: 0 10px 40px -10px rgba(0,0,0,0.05);
  --shadow-hover: 0 20px 40px -10px rgba(0,0,0,0.1);
}

body {
  font-family: 'NanumBarunGothic', -apple-system, BlinkMacSystemFont, system-ui, Roboto, 'Helvetica Neue', 'Segoe UI', 'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px;
  min-height: 100vh;
  margin: 0;
  width: 100%;
  line-height: 1.5;
  letter-spacing: 0;
  
  /* PC 기본: 단어 단위 줄바꿈 유지 (가독성) */
  word-break: keep-all; 
  -webkit-font-smoothing: antialiased;
  
  /* 가로 스크롤 방지 안전장치 */
  overflow-x: hidden; 
}

a {
  color: var(--text-sub);
  transition: color 0.2s;
}
a:hover {
  color: var(--primary-color);
}

h2 {
  color: var(--text-main);
  font-weight: 800;
  margin-bottom: 25px;
  text-align: center;
  letter-spacing: -0.5px;
  /* [수정] 한글 제목 줄바꿈 정책 */
  word-break: keep-all;
}

/* ─── 박스 공통 스타일 ─── */
.login-box, .result-box {
  background-color: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.login-box {
  padding: 40px;
  width: 100%;
  max-width: 480px;
  /* [수정] 모바일 화면(stretch 정렬)에서도 중앙에 오도록 margin: auto 적용 */
  margin: 20px auto 0;
}
.login-box:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-hover);
}

.result-box {
  margin-top: 20px;
  width: 100%;
  max-width: 1300px; 
  padding: 40px;
}

/* ─── 입력 필드 ─── */
input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 14px 16px;
  margin: 10px 0;
  border: 1px solid #e5e7eb;
  background-color: #f9fafb;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: all 0.2s ease;
}

input[type="text"]:focus,
input[type="password"]:focus {
  border-color: var(--primary-color);
  background-color: #fff;
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

/* ─── 버튼 스타일 ─── */
button {
  border: none;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
  font-family: inherit;
}

.login-box button,
.upload-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
  color: white;
  border-radius: var(--radius-md);
  font-size: 16px;
  margin-top: 15px;
  box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.2);
}

.login-box button:hover,
.upload-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 12px -1px rgba(79, 70, 229, 0.3);
}

.header-btn, .back-btn {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  background-color: white;
  color: var(--text-sub);
  border: 1px solid #e5e7eb;
}

.header-btn:hover, .back-btn:hover {
  background-color: #f3f4f6;
  color: var(--text-main);
  border-color: #d1d5db;
}

.change-btn {
  background-color: var(--primary-color);
  color: white;
}
.change-btn:hover {
  background-color: var(--primary-hover);
}

/* ─── 상단 헤더 영역 ─── */
.top-box {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 40px;
  width: 100%;
  max-width: 1300px;
}

.title-box {
  text-align: center;
  width: 100%;
  /* [수정] 모바일에서 긴 제목이 잘리지 않고 줄바꿈 되도록 수정 */
  white-space: normal; 
  word-break: keep-all;
}

.title-text {
  cursor: pointer;
  margin: 0;
  display: inline-block;
}

/* ─── 내부 헤더 ─── */
.header-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  border-bottom: 2px solid #f3f4f6;
  padding-bottom: 15px;
}

.greeting {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
}

.header-actions {
  display: flex;
  gap: 10px;
}

.info-text {
  margin-top: 30px;
  font-size: 15px;
  color: #555;
  text-align: center;
}

.error-msg {
  color: var(--danger-text);
  text-align: center;
  padding: 20px;
  background-color: var(--danger-bg);
  border-radius: var(--radius-sm);
}

/* ─── 공지사항 ─── */
.notices-row {
  /* [수정] Grid 대신 Flexbox 사용하여 마지막 요소가 꽉 차게 변경 */
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 30px;
}

.notice-box {
  /* [수정] Flex 아이템 설정: flex-grow: 1, flex-basis: 300px (최소 너비) */
  flex: 1 1 300px;
  padding: 20px;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
}

.notice-box strong {
  font-size: 17px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.notice-box p {
  font-size: 16px;
  line-height: 1.6;
  color: #4b5563;
  margin: 0;
}

.notice-box.red { background-color: var(--danger-bg); }
.notice-box.red strong { color: var(--danger-text); }
.notice-box.yellow { background-color: var(--warning-bg); }
.notice-box.yellow strong { color: var(--warning-text); }
.notice-box.blue { background-color: var(--info-bg); }
.notice-box.blue strong { color: var(--info-text); }


/* ─── 점수 영역 ─── */
.score-section {
  background-color: white;
  border: 1px solid #f3f4f6;
  border-radius: var(--radius-md);
  padding: 25px;
  margin-bottom: 30px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}

.score-title {
  font-size: 18px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.score-section-title {
  font-size: 18px;
  font-weight: bold;
  color: #2c3e50;
}

.score-summary-badge {
  margin-left: 12px;
  display: flex;
  align-items: center;
  background-color: #fff;
  padding: 6px 16px;
  border-radius: 30px;
  border: 1px solid #e0e0e0;
  box-shadow: 0 2px 5px rgba(0,0,0,0.03);
}

.score-summary-text {
  font-size: 16px;
  color: #555;
  font-weight: 500;
  display: flex;
  align-items: center;
}

.score-total-val { color: #2c3e50; font-weight: bold; }
.score-max-val { color: #aaa; font-size: 0.9em; }

.score-divider {
  width: 1px;
  height: 12px;
  background: #ddd;
  margin: 0 12px;
}

.grade-circle {
  margin-left: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  color: white;
  font-size: 14px;
  font-weight: bold;
}

.grade-A { background-color: #27ae60; }
.grade-B { background-color: #2980b9; }
.grade-C { background-color: #f39c12; }
.grade-D { background-color: #d35400; }
.grade-E { background-color: #e74c3c; }

.score-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
}

.score-item {
  background-color: #f9fafb;
  padding: 15px 20px;
  border-radius: var(--radius-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid transparent;
}

.score-name {
  font-weight: 600;
  color: var(--text-main);
  width: 80px;
  flex-shrink: 0;
}

.score-desc {
  flex: 1;
  color: #555;
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 15px;
}

.score-value {
  font-weight: 500;
  color: var(--primary-color);
  width: 90px;
  text-align: right;
  flex-shrink: 0;
}

/* ─── 계정/메모/파일 섹션 ─── */
.account-section {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-top: 30px;
  align-items: stretch;
}

/* [NEW] 진급생 등 3개 항목일 때 꽉 차게 표시 */
.account-section.promoted {
  grid-template-columns: repeat(3, 1fr);
}

.account-box, .memo-box, #downloadArea, .admin-box {
  background-color: #f9fafb;
  padding: 20px;
  border-radius: var(--radius-md);
  border: 1px solid #f3f4f6;
  display: flex;
  flex-direction: column;
  justify-content: flex-start; 
  gap: 10px;
  min-height: 240px; /* 기존 최소 높이 */
  min-width: 0; 
}

/* [NEW] 학생용 파일 다운로드 영역 고정 높이 */
#downloadArea {
    height: auto;
    max-height: 320px;
    overflow: hidden; /* 내부 스크롤을 위해 컨테이너 오버플로우 숨김 */
}

/* 관리자 섹션 스타일 (4분할) */
.admin-grid-section {
  margin-bottom: 30px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.admin-box {
    background-color: #fff;
    border: 1px solid #e5e7eb;
    height: 280px; /* [NEW] 고정 높이 부여하여 확장 방지 */
}
.box-title {
    margin: 0 0 10px 0; 
    font-size: 16px;
    font-weight: bold;
    color: var(--text-main);
    border-bottom: 2px solid #f3f4f6;
    padding-bottom: 10px;
}

.field-header {
  margin-bottom: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 32px;
}

.field-label {
  font-size: 16px;
  color: var(--text-main);
  font-weight: bold;
}

.entry-btn-group, .google-btn-group {
  display: flex;
  gap: 5px;
  align-items: center;
}

.entry-btn-group .copy-btn,
.entry-btn-group .link-button,
.google-btn-group .copy-btn,
.google-btn-group .link-button {
  font-size: 13px;
  padding: 10px 10px;
  height: 30px;
  line-height: 15px;
  border: 1px solid #e5e7eb;
  background-color: white;
  color: var(--text-sub);
  border-radius: var(--radius-sm);
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  box-sizing: border-box;
}

.entry-btn-group .copy-btn:hover,
.entry-btn-group .link-button:hover,
.google-btn-group .copy-btn:hover,
.google-btn-group .link-button:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.field-group { margin-bottom: 15px; }
.field-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-sub);
  margin-bottom: 6px;
  display: block;
}

.editable-wrap { display: flex; gap: 8px; }

#not-edit{
    font-size:12px;
}
.editable {
  background-color: white;
  border: 1px solid #e5e7eb;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-main);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.02);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  word-break: break-all;
}

.editable:empty::before {
  content: attr(data-placeholder);
  color: var(--text-placeholder);
}

.copy-btn {
  background-color: white;
  border: 1px solid #e5e7eb;
  color: var(--text-sub);
  border-radius: var(--radius-sm);
  font-size: 12px;
  padding: 0 12px;
  white-space: nowrap;
}
.copy-btn:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.account-box .change-btn.red {
  background-color: var(--soft-red-bg);
  color: var(--soft-red-text);
  border: 1px solid var(--soft-red-border);
  margin-top: auto;
  width: 100%;
  padding: 10px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  box-shadow: none;
}

.account-box .change-btn.red:hover {
  background-color: #ffe4e6;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

#memoCell {
    margin-top: 0;
    font-size:15px;
    height: 100%; 
}

.save-btn {
  margin-top: 15px;
  width: 100%;
  padding: 10px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 13px;
  background-color: var(--soft-green-bg);
  color: var(--soft-green-text);
  border: 1px solid var(--soft-green-border);
  box-shadow: none;
}

.save-btn:hover { 
    background-color: var(--soft-green-hover);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* 파일 다운로드 목록 */
.download-header { 
    font-size: 16px;
    color: var(--text-main);
    font-weight: bold;
}

/* [NEW] 내부 목록을 감싸는 wrapper 스타일 (JS에서 클래스 추가됨) */
.file-list-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0; /* 내부 스크롤을 위해 필수 */
    overflow: hidden;
}

.download-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  
  /* [수정] 200px 제한 해제하고 flex 컨테이너에 맞춰 늘어나게 함 */
  overflow-y: auto;
  max-height: none; 
  flex: 1;
  width: 100%; 
  min-height: 0;
}

.download-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: white;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid #e5e7eb;
  font-size: 13px;
  gap: 10px;
  overflow: hidden; 
  max-width: 100%;
  flex-shrink: 0; /* 리스트 아이템이 찌그러지지 않게 */
}

.download-item a {
  text-decoration: none;
  color: var(--text-main);
  /* Flexbox로 스마트 파일명 구조 적용 */
  flex: 1;
  display: flex; /* 내부를 Flex로 만들어 이름/확장자 분리 */
  align-items: center;
  min-width: 0; /* 부모 넘침 방지 */
}

.download-item:hover { border-color: var(--primary-color); }

/* [NEW] 스마트 파일명 구조 스타일 */
.smart-filename-wrap {
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0; /* [중요] Flex 컨테이너가 부모보다 커지는 것 방지 */
}

.smart-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 0 1 auto;       /* 남은 공간 차지 */
  min-width: 0;  /* [중요] 텍스트가 길어도 강제로 줄어들게 함 */
}

.smart-ext {
  white-space: nowrap;
  flex-shrink: 0; /* 확장자는 절대 줄어들지 않음 */
}

.download-item:hover .smart-name,
.download-item:hover .smart-ext {
    color: var(--primary-color);
}

.delete-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  margin-left: 0;
  padding: 4px;
  flex-shrink: 0; 
}

/* 파일 아이콘 등 */
.file-list-area {
    display: flex;
    flex-direction: column;
    flex: 1; 
}

.empty-file-msg {
  text-align: center;
  color: #9ca3af;
  font-size: 14px;
  margin: 0;
  flex: 1; 
  display: flex; 
  flex-direction: column; 
  align-items: center;
  justify-content: center; /* 중앙 정렬 */
  padding-bottom: 20px;
}

/* 드롭존 (관리자용 - small) */
.drop-zone.small-drop {
  border: 2px dashed #d1d5db;
  border-radius: var(--radius-md);
  background-color: #f9fafb;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  position: relative;
  
  /* [수정] 높이 유연하게 */
  flex: 1; 
  min-height: 80px;
  
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden; 
}

.drop-zone.small-drop:hover, .drop-zone.small-drop.dragover {
  border-color: var(--primary-color);
  background-color: #eff6ff;
  color: var(--primary-color);
}

.drop-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: var(--text-sub);
    max-width: 100%;
    width: 100%;
    min-width: 0; /* [중요] Flex Item 축소 허용 */
}

.drop-message .icon { font-size: 20px; flex-shrink: 0; }

/* [수정] 드롭존 파일명 텍스트 영역 */
.drop-message .text {
    width: 100%;
    padding: 0 10px;
    display: block; 
    min-width: 0; /* [중요] */
}

/* 드롭존 내 스마트 파일명 처리 */
.drop-message .smart-filename-wrap {
    justify-content: center; /* 드롭존은 중앙 정렬 */
}

.file-input {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  opacity: 0;
  cursor: pointer;
}

.upload-btn.small-btn {
    width: 100%;
    margin-top: 10px;
    padding: 10px;
    font-size: 14px;
    flex-shrink: 0; /* 버튼 크기 고정 */
}

/* 즐겨찾기 섹션 */
.fav-box {
    background-color: #fffbeb; 
    border-color: #fcd34d;
}
.add-fav-btn {
    background-color: white;
    border: 1px solid #f59e0b;
    color: #f59e0b;
    border-radius: var(--radius-sm);
    padding: 4px 10px;
    font-size: 12px;
}
.add-fav-btn:hover {
    background-color: #f59e0b;
    color: white;
}
.fav-list {
    list-style: none;
    padding: 0;
    margin: 2px 0 0 0;
    flex: 1;
    overflow-y: auto;
    /* [수정] 즐겨찾기도 고정 높이 안에서 스크롤 */
    max-height: none; 
    display: flex;
    flex-direction: column;
}
.fav-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 0; /* 패딩 조정 */
    border-bottom: 1px solid #f3f4f6; 
}
.fav-item:last-child { border-bottom: none; }

/* [수정] 즐겨찾기 링크 스타일 개선 (버튼형 호버) */
.fav-link {
    text-decoration: none;
    font-size: 14px;
    color: var(--text-main);
    display: block;
    
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0; 
    
    padding: 8px 10px; /* 클릭 영역 확보 및 호버 배경용 */
    border-radius: 8px; /* 둥근 모서리 */
    transition: all 0.2s ease;
    margin-right: 8px;
    
    /* 기존 밑줄(after) 제거를 위해 position 초기화 */
    position: static; 
}

/* 기존 밑줄 제거 */
.fav-link::after {
    display: none;
}

/* 호버 시: 배경색 + 글자색 진하게 */
.fav-link:hover {
    background-color: rgba(0,0,0,0.05); /* 연한 회색 배경 */
    color: var(--primary-color);
    font-weight: 600; /* 살짝 강조 */
    transform: translateX(2px); /* 살짝 오른쪽 이동 효과 */
}

.fav-delete-btn {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: #fee2e2;
    color: #ef4444;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    padding: 0;
    flex-shrink: 0; 
    margin-right: 5px; /* 우측 여백 확보 */
}
.fav-delete-btn:hover { background-color: #ef4444; color: white; }
.empty-fav { 
    font-size: 13px; 
    color: #9ca3af; 
    text-align: center; 
    margin: 0;
    flex: 1; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    padding-bottom: 10px;
}

/* 모달 및 토스트 (기존 유지) */
.modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
}
.modal-content {
    background-color: white;
    padding: 30px;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.modal-content h3 { margin: 0 0 10px 0; text-align: center; }
.modal-content input { margin: 0; } 
.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

/* [추가] 모달 액션 수직 정렬 */
.modal-actions.vertical {
    flex-direction: column;
    gap: 10px;
}

.confirm-btn {
    flex: 1;
    background-color: var(--primary-color);
    color: white;
    padding: 12px;
    border-radius: var(--radius-sm);
}

/* [추가] 위험/기본 버튼 색상 */
.confirm-btn.danger { background-color: #ef4444; }
.confirm-btn.danger:hover { background-color: #dc2626; }
.confirm-btn.primary { background-color: var(--primary-color); }
.confirm-btn.primary:hover { background-color: var(--primary-hover); }

.cancel-btn {
    flex: 1;
    background-color: #e5e7eb;
    color: var(--text-main);
    padding: 12px;
    border-radius: var(--radius-sm);
}
.confirm-btn:hover { background-color: var(--primary-hover); }
.cancel-btn:hover { background-color: #d1d5db; }

/* [추가] 중복 확인 메시지 스타일 */
.conflict-msg {
    text-align: center;
    font-size: 15px;
    color: #4b5563;
    margin-bottom: 5px;
}
.conflict-msg strong {
    color: var(--danger-text);
    display: block;
    margin-bottom: 5px;
    word-break: break-all;
}

#toast-container {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast-msg {
    background-color: #333;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    opacity: 0;
    transform: translateY(20px);
    animation: toastFadeIn 0.3s forwards;
    pointer-events: auto;
    max-width: 300px;
}
.toast-msg.success { background-color: #10b981; }
.toast-msg.error { background-color: #ef4444; }

.toast-actions {
    margin-top: 10px;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}
.toast-btn {
    padding: 6px 12px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    transition: background 0.2s;
}
.toast-btn.confirm { background: #fff; color: #333; }
.toast-btn.confirm:hover { background: #f3f4f6; }
.toast-btn.cancel { background: #555; color: #fff; }
.toast-btn.cancel:hover { background: #666; }

@keyframes toastFadeIn {
    to { opacity: 1; transform: translateY(0); }
}

.toast-msg.hide {
    opacity: 0;
    transition: opacity 0.5s ease;
}

@media (max-width: 1300px) {
  body { min-width: 0; }
  /* [수정] width: 95% -> 100% 변경. 
     body에 이미 padding(20px)이 있으므로 박스는 100%로 설정해야 상단 제목과 라인이 맞습니다. */
  .result-box { padding: 25px 20px; width: 100%; }
  /* [수정] promoted 클래스도 반응형 적용 */
  .account-section, .account-section.promoted { grid-template-columns: repeat(2, 1fr); }
  
  /* [NEW 수정] 2열(2x2) 배치 시 진급생의 마지막 '메모' 박스는 2칸을 모두 차지하여 중앙 정렬 효과 */
  .account-section.promoted .memo-box {
      grid-column: span 2;
  }

  .admin-grid-section { grid-template-columns: repeat(2, 1fr); }
}

/* [수정] 모바일 반응형 스타일 개선 */
@media (max-width: 900px) {
  body {
    /* 중앙 정렬 강제 해제 -> 내용이 넘쳐도 왼쪽이 잘리지 않음 */
    align-items: stretch; 
    padding: 15px; /* 여백 확보 */
    
    /* 글자 넘침 방지를 위한 강제 줄바꿈 허용 */
    word-break: break-all;
    overflow-wrap: break-word;
    height: auto; /* 높이 유동적으로 변경 */
  }

  /* 제목 강제 줄바꿈 허용 */
  h2 {
    font-size: 22px; /* 폰트 사이즈 조절 */
    margin-bottom: 20px;
    
    /* keep-all은 모바일에서 너비 초과 원인이 되므로 해제 */
    word-break: keep-all; 
    overflow-wrap: anywhere; /* 단어가 길면 중간에서라도 끊어서 줄바꿈 */
    line-height: 1.3;
  }

  .title-box {
    width: 100%;
    padding: 0 5px; /* 내부 여백 */
  }

  .result-box {
    padding: 20px 15px;
    width: 100%;
    max-width: 100%;
    margin-top: 10px;
    
    /* 박스 그림자 약간 축소 (선택사항) */
    box-shadow: 0 5px 15px -5px rgba(0,0,0,0.05);
  }

  /* 내부 박스 패딩 축소 */
  .score-section, .notice-box {
    padding: 15px;
  }

  /* 점수 요약 배지 줄바꿈 허용 */
  .score-summary-badge {
    margin-left: 0; margin-top: 10px;
    width: 100%; box-sizing: border-box;
    justify-content: center;
    flex-wrap: wrap;
    height: auto;
    padding: 8px 10px;
    gap: 5px;
  }

  /* 그리드 1단 배열 */
  /* [수정] promoted 클래스도 반응형 적용 */
  .account-section, .account-section.promoted { grid-template-columns: 1fr; }
  
  /* [NEW 수정] 모바일(1열)에서는 메모 박스가 다시 1칸만 차지하도록 초기화 (중요) */
  .account-section.promoted .memo-box {
      grid-column: auto;
  }

  .admin-grid-section { grid-template-columns: 1fr; }

  /* 헤더 정리 */
  .top-box { 
      flex-direction: column; 
      gap: 10px; 
      position: static; 
      margin-bottom: 10px;
  }
  
  .header-box { flex-direction: column; align-items: flex-start; gap: 15px; }
  .header-actions { width: 100%; justify-content: space-between; }

  .header-btn, .back-btn, .change-btn { flex: 1; text-align: center; }
  .score-list { grid-template-columns: 1fr; }

  /* 공지사항 박스 강제 1열 */
  .notices-row {
    /* grid-template-columns: 1fr; */
    flex-direction: column; /* [수정] Grid 해제 후 Flex 세로 정렬 */
  }

  /* [추가] 수행평가 점수 리스트: 1줄로 변경 */
  .score-list {
    grid-template-columns: 1fr;
  }

  /* [추가] 점수 박스 내부 패딩 축소 및 넘침 방지 */
  .score-item {
    padding: 12px 10px; /* 좌우 패딩을 20px -> 10px로 축소 */
    gap: 8px; /* 내부 요소 간격 축소 */
  }

  /* [핵심] 설명 텍스트가 길어도 화면 밖으로 밀지 않고 말줄임(...) 처리되도록 강제 */
  .score-desc {
    min-width: 0; /* Flexbox 자식이 부모보다 커지는 것 방지 */
    flex: 1;      /* 남은 공간 차지 */
  }

  /* 모바일에서 이름/점수 영역 너비 조금 줄이기 */
  .score-name {
    width: 60px; /* PC 80px -> 모바일 60px */
    font-size: 14px;
    letter-spacing: -0.5px; /* 자간 좁힘 */
  }

  .score-value {
    width: 75px; /* PC 90px -> 모바일 75px */
    font-size: 14px;
    text-align: right;
  }

  /* [추가] 모바일 토스트 알림 넓게 펴기 */
  .toast-msg {
    width: max-content;    /* 텍스트 길이에 맞춰 늘어남 */
    max-width: 90vw;       /* 화면 너비의 90%까지 허용 (기존 300px 제한 해제) */
    min-width: 250px;      /* 내용이 짧아도 너무 좁아지지 않게 최소 폭 확보 */
    white-space: nowrap;   /* 웬만하면 줄바꿈 없이 한 줄로 표시 */
    text-align: center;    /* 텍스트 중앙 정렬 */
    padding: 12px 20px;    /* 내부 여백 조정 */
  }
  
  /* [추가] 토스트 컨테이너 위치 살짝 위로 (모바일 하단 바 간섭 방지) */
  #toast-container {
    bottom: 50px; 
    width: 100%;       /* 컨테이너 가로 꽉 채움 */
    pointer-events: none; /* 클릭 통과 */
    display: flex;        /* 내부 아이템 정렬용 */
    flex-direction: column;
    align-items: center;  /* 가운데 정렬 확실하게 */
    left: 0;              /* 기존 left: 50% 해제하고 */
    transform: none;      /* transform 해제하여 전체 너비 사용 */
  }
}

@media (max-width: 480px) {
  .field-header { flex-wrap: wrap; gap: 10px; }
  .entry-btn-group, .google-btn-group { width: 100%; justify-content: flex-end; }

  /* 1. 점수 박스 내부 여백을 확 줄임 */
  .score-item {
    padding: 10px 8px; /* 위아래 10px, 좌우 8px */
    gap: 5px;          /* 이름-설명-점수 사이 간격 좁힘 */
  }

  /* 2. 글자 크기 일괄 축소 (기존 약 15~16px -> 13px) */
  .score-name, 
  .score-desc, 
  .score-value {
    font-size: 13px; 
  }

  /* 3. 이름 영역 너비 줄임 (수행1, 수행2... 들어갈 정도만) */
  .score-name {
    width: 45px; /* 기존보다 더 좁게 */
    white-space: nowrap;
  }

  /* 4. 점수 영역 너비 줄임 (20/20 들어갈 정도만) */
  .score-value {
    width: 60px; /* 기존 90px -> 60px로 대폭 축소 */
    text-align: right;
  }
  
  /* 5. 가운데 설명이 길면 자동으로 줄어들게 설정 (필수) */
  .score-desc {
    flex: 1;       /* 남은 공간 다 차지 */
    min-width: 0;  /* [중요] 내용이 길어도 박스를 뚫고 나가지 않게 함 */
  }

  .account-box .field-header { 
    display: flex;
    flex-wrap: nowrap; /* 절대 줄바꿈 하지 않음 */
    align-items: center;
    justify-content: space-between; /* 양쪽 끝 정렬 */
    gap: 5px; 
  }

  /* 버튼 그룹이 공간 부족으로 찌그러지거나 내려가는 것 방지 */
  .entry-btn-group, .google-btn-group { 
    width: auto; 
    flex-shrink: 0; /* [핵심] 공간이 좁아도 절대 줄어들지 않음 */
    display: flex;
    gap: 5px;
  }

  /* 모바일 공간 확보를 위해 버튼 내부 패딩 미세 축소 */
  .entry-btn-group .link-button,
  .entry-btn-group .copy-btn,
  .google-btn-group .link-button,
  .google-btn-group .copy-btn {
     padding: 6px 8px; /* 패딩 축소 */
     font-size: 12px;
  }
}

/* [추가] 로그인/비밀번호 변경 결과 메시지 중앙 정렬 */
#result {
  text-align: center !important; /* 강제 중앙 정렬 */
  width: 100%;                   /* 가로 영역 꽉 채우기 */
  margin-top: 20px;
  display: flex;                 /* Flexbox 사용 */
  flex-direction: column;        /* 세로로 쌓기 */
  align-items: center;           /* 아이템 가로축 중앙 정렬 */
  justify-content: center;
}

/* 메시지 내부 문단 스타일 */
#result p {
  text-align: center;
  margin: 5px 0;
  word-break: keep-all; /* 단어 단위 줄바꿈 */
  width: 100%;
}