/* ===== 기본 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg-grad: linear-gradient(135deg, #f5f7ff 0%, #fef2ff 50%, #f0fdff 100%);
  --primary: #7c5cff;
  --primary-light: #a594ff;
  --primary-soft: #ede9ff;
  --accent: #00d4d4;
  --accent-pink: #ff6dac;
  --text: #1a1a2e;
  --text-muted: #6b6b8a;
  --border: rgba(124, 92, 255, 0.15);
  --glass: rgba(255, 255, 255, 0.65);
  --glass-strong: rgba(255, 255, 255, 0.85);
  --shadow-sm: 0 4px 16px rgba(124, 92, 255, 0.08);
  --shadow-md: 0 8px 32px rgba(124, 92, 255, 0.12);
  --shadow-lg: 0 16px 48px rgba(124, 92, 255, 0.18);
  --radius-sm: 12px;
  --radius-md: 20px;
  --radius-lg: 32px;
}

html, body { height: 100%; }
body {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  font-feature-settings: 'tnum';
  background: var(--bg-grad);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* ===== 배경 데코 ===== */
.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.45;
  pointer-events: none;
  z-index: 0;
}
.orb1 { width: 600px; height: 600px; background: #b4a0ff; top: -200px; left: -200px; }
.orb2 { width: 500px; height: 500px; background: #ffb4dc; top: 30%; right: -200px; }
.orb3 { width: 400px; height: 400px; background: #a0e8e8; bottom: -100px; left: 30%; }

/* ===== 헤더 ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--glass-strong);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}
.logo { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); }
.logo-icon { font-size: 32px; }
.logo-text strong {
  display: block;
  font-size: 18px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.logo-text small { font-size: 12px; color: var(--text-muted); display: block; }
.search-wrap { position: relative; flex: 1; max-width: 480px; min-width: 220px; }
#search-input {
  width: 100%;
  padding: 12px 44px 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  background: var(--glass);
  font-family: inherit;
  font-size: 15px;
  color: var(--text);
  transition: all 0.2s;
}
#search-input:focus {
  outline: none;
  border-color: var(--primary);
  background: white;
  box-shadow: 0 0 0 4px rgba(124, 92, 255, 0.1);
}
.search-icon { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 8px;
  background: white;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  max-height: 480px;
  overflow-y: auto;
  z-index: 200;
}
.search-results .group-label {
  padding: 12px 16px 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-top: 1px solid var(--border);
}
.search-results .group-label:first-child { border-top: none; }
.search-results a {
  display: block;
  padding: 10px 16px;
  text-decoration: none;
  color: var(--text);
  border-radius: 0;
  font-size: 14px;
  transition: background 0.15s;
}
.search-results a:hover { background: var(--primary-soft); }
.search-results .meta { color: var(--text-muted); font-size: 12px; margin-top: 2px; }
.search-results .empty { padding: 24px; text-align: center; color: var(--text-muted); font-size: 14px; }

/* ===== 메인 ===== */
.main {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 24px 64px;
  min-height: calc(100vh - 200px);
}
.loading {
  text-align: center;
  padding: 80px 0;
  color: var(--text-muted);
  font-size: 16px;
}

/* ===== 홈 ===== */
.hero {
  text-align: center;
  padding: 60px 24px 40px;
  margin-bottom: 32px;
}
.hero h1 {
  font-size: clamp(28px, 4.5vw, 44px);
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 16px;
  background: linear-gradient(135deg, #7c5cff 0%, #ff6dac 50%, #00d4d4 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.25;
}
.hero p {
  color: var(--text-muted);
  font-size: 16px;
  max-width: 600px;
  margin: 0 auto;
}

.entry-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
  margin-bottom: 48px;
}
.entry-card {
  background: var(--glass-strong);
  backdrop-filter: blur(20px);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  text-decoration: none;
  color: var(--text);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.entry-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}
.entry-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-light);
}
.entry-card .card-icon { font-size: 48px; margin-bottom: 16px; display: block; }
.entry-card h2 { font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.entry-card .card-sub { color: var(--text-muted); font-size: 14px; margin-bottom: 16px; }
.entry-card .card-meta {
  display: inline-block;
  padding: 4px 12px;
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}

.notice-box {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.7;
}
.notice-box strong { color: var(--text); }
.notice-box ul { margin: 8px 0 0 20px; }

/* ===== 페이지 헤더 (PART 01/02) ===== */
.page-header {
  margin-bottom: 32px;
}
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.breadcrumb a {
  color: var(--primary);
  text-decoration: none;
  padding: 4px 10px;
  border-radius: 8px;
  transition: background 0.15s;
}
.breadcrumb a:hover { background: var(--primary-soft); }
.breadcrumb .sep { opacity: 0.4; }
.page-header h1 {
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 800;
  letter-spacing: -0.3px;
  margin-bottom: 8px;
}
.page-header p { color: var(--text-muted); font-size: 15px; }

/* ===== 카테고리/리스트 그리드 ===== */
.cat-section { margin-bottom: 40px; }
.cat-section h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.cat-section h2::before {
  content: '';
  width: 4px;
  height: 22px;
  background: linear-gradient(180deg, var(--primary), var(--accent));
  border-radius: 2px;
}
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.tile {
  background: var(--glass-strong);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px 20px;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 15px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.tile:hover {
  transform: translateY(-2px);
  border-color: var(--primary-light);
  box-shadow: var(--shadow-sm);
  color: var(--primary);
}
.tile .arrow { opacity: 0.4; transition: all 0.2s; }
.tile:hover .arrow { opacity: 1; transform: translateX(2px); }
.tile.empty { opacity: 0.4; pointer-events: none; }

/* ===== 도시·지역 칩 ===== */
.region-block { margin-bottom: 32px; }
.region-block h2 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--primary);
}
.city-block { margin-bottom: 20px; }
.city-block h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ===== 표 (매트릭스 / 학과별) ===== */
.table-wrap {
  background: white;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 24px;
  max-height: calc(100vh - 160px);
}
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
  min-width: 520px;
}
table th, table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  vertical-align: top;
}
table th:last-child, table td:last-child {
  border-right: none;
}
/* rowspan으로 묶인 셀: 텍스트는 첫 행에, 배경은 다른 셀과 동일 */
table td.merged {
  vertical-align: top;
  /* 큰 rowspan 셀이 옆 셀의 우측 border와 시각적으로 융합되어 좌측 경계가 사라지는 문제 방지 */
  border-left: 1px solid var(--border);
}
/* 좌측 옆 셀의 border-right를 제거해 1px 두께가 그대로 유지되도록 (인접 셀 충돌 방지) */
table td:has(+ td.merged) {
  border-right: none;
}
/* 비고 셀 공통 */
table td.note-cell {
  font-size: 13px;
  color: var(--text-muted);
  white-space: pre-line;
  line-height: 1.6;
}
/* 단과대 헤더 행 */
table tr.college-row td {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
  padding: 14px 12px;
  border-right: none;
}
table thead th {
  background: linear-gradient(135deg, #ede9ff 0%, #f5f2ff 100%);
  font-weight: 700;
  color: var(--primary);
  position: sticky;
  top: 0;
  z-index: 2;
  white-space: nowrap;
  box-shadow: 0 1px 0 var(--border);
}
table thead tr:nth-child(2) th { top: 41px; }
table .empty-cell { color: rgba(0,0,0,0.2); text-align: center; }
table .mark { color: var(--primary); font-weight: 600; }
table .subj-section {
  padding: 2px 0;
}
table .subj-section + .subj-section {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--border);
}
table .subj-label {
  display: inline-block;
  margin-right: 6px;
  padding: 1px 8px;
  background: rgba(124, 92, 255, 0.08);
  color: var(--primary);
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  vertical-align: 1px;
}
table .core-pill {
  display: inline-block;
  background: linear-gradient(135deg, #ff6dac, #ff9a9e);
  color: white;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  margin-right: 4px;
}
table .rec-pill {
  display: inline-block;
  background: var(--primary-soft);
  color: var(--primary);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  margin-right: 4px;
}
table.matrix th:first-child, table.matrix td:first-child {
  position: sticky;
  left: 0;
  background: white;
  z-index: 1;
  font-weight: 600;
  border-right: 1px solid var(--border);
}
table.matrix thead th:first-child {
  z-index: 3;
  background: linear-gradient(135deg, #ede9ff 0%, #f5f2ff 100%);
}
table.matrix thead tr:nth-child(2) th:first-child { z-index: 3; }

.empty-state {
  text-align: center;
  padding: 60px 24px;
  background: var(--glass);
  border-radius: var(--radius-md);
  color: var(--text-muted);
}

/* ===== 푸터 ===== */
.site-footer {
  position: relative;
  z-index: 1;
  background: var(--glass-strong);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  padding: 24px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.7;
}
.site-footer .copy { margin-top: 8px; opacity: 0.7; font-size: 12px; }

/* ===== 모바일 ===== */
@media (max-width: 720px) {
  .header-inner { padding: 12px 16px; gap: 12px; }
  .logo-icon { font-size: 28px; }
  .logo-text strong { font-size: 16px; }
  .logo-text small { display: none; }
  .main { padding: 20px 16px 48px; }
  .hero { padding: 32px 16px 24px; }
  .entry-card { padding: 28px 24px; }
  .tile-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
  .tile { padding: 14px 16px; font-size: 14px; }
}
