/* Kairos (카이로스합격예측) 스타일시트
 * - 2026-11-25 사용자 승인으로 화면 뼈대를 개편함: 청록 브랜드 띠 헤더, 차가운 연회색 바탕, 밑줄 탭,
 *   굵기 600~700 제목·핵심 숫자. 최종 규칙은 파일 아래쪽 "화면 뼈대 개편" 구역에 있음.
 * - 서체 Pretendard. 모바일 입력칸(.ctrl-input, .ctrl-select)은 16px (iOS Safari 확대 방지)
 * - 상태 구분 딱지(안정/적정/소신/불가)는 채운 색 + 흰 글자
 */

:root {
  /* 소재 색 팔레트 */
  /* 2026-11-24 사용자 지시로 DESIGN.md 3번(바탕 흰색)에서 벗어남:
     페이지 바탕은 종이 톤(--page), 내용이 놓이는 면은 흰색(--bg)으로 층을 나눔 */
  --page: #f1efe9;
  --bg: #ffffff;
  --surface: #f7f6f3;
  --sunken: #e6e3db;
  --ink: #1f1f1f;
  --ink-muted: rgba(31, 31, 31, 0.84);
  --line: #dedbd3;

  /* 6번 예외: 상태 구분 데이터 색. 안정(초록)·적정(파랑)·소신(주황)이 한눈에 갈리도록 채도를 올림.
     딱지는 채운 색 + 흰 글자(대비 4.5:1 이상), 불가는 색을 빼고 회색 */
  --st-safe: #17794f;
  --st-safe-bg: #e2f2e9;
  --st-fit: #2557c7;
  --st-fit-bg: #e3ebfb;
  --st-reach: #c2540a;
  --st-reach-bg: #fcead9;
  --st-fail: #b0362f;
  --st-fail-bg: #f8e6e4;
  --st-off: #6f6a62;

  /* 타이포 토큰 (크기 4단계 고정) */
  --font-sans: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  --fs-xs: 13px;
  --fs-body: 14px;
  --fs-h2: 18px;
  --fs-h1: 20px;

  /* 모서리 (최대 6px / 컨테이너 8px) */
  --r-ctrl: 6px;
  --r-box: 8px;
  --r-tag: 4px;

  /* 모션 토큰 (DESIGN.md 4번 고정 변수) */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-spring: cubic-bezier(0.34, 1.3, 0.64, 1);
  --dur-micro: 180ms;
  --dur-reveal: 360ms;
  --dur-layer: 480ms;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  font-weight: 400;
  line-height: 1.6;
  word-break: keep-all;
  overflow-wrap: break-word;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: var(--fs-body);
  font-weight: 400;
  color: var(--ink);
}

.num {
  font-variant-numeric: tabular-nums;
}

/* 레이아웃 컨테이너 */
.wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* 상단 헤더 (모바일 노치/safe-area 포함 넉넉한 상하 여백) */
.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  padding-top: env(safe-area-inset-top, 0px);
}

/* 헤더 inner 패딩: 페이지 네비 하단 보더가 헤더 선에 딱 맞도록 */
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 60px;
  flex-wrap: wrap;
  padding-top: 10px;
  padding-bottom: 10px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 32px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.brand-title {
  margin: 0;
  font-size: var(--fs-h1);
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1.25;
}

.brand-sub {
  font-size: var(--fs-body);
  color: var(--ink-muted);
}

/* 상단 페이지 네비게이션: 과하지 않으면서 클릭 가능한 탭임이 분명히 느껴지는 세그먼트/필 스타일 */
.page-nav {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-box);
}

.page-nav-btn {
  position: relative;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-ctrl);
  padding: 6px 12px;
  font-size: var(--fs-body);
  font-weight: 400;
  color: var(--ink-muted);
  cursor: pointer;
  transition: opacity var(--dur-micro) var(--ease-out);
  white-space: nowrap;
}

.page-nav-btn:hover {
  color: var(--ink);
}

.page-nav-btn.active {
  background: var(--bg);
  color: var(--ink);
  font-weight: 500;
  border-color: var(--line);
}

.nav-count {
  margin-left: 5px;
  font-size: var(--fs-xs);
  font-variant-numeric: tabular-nums;
  color: var(--ink-muted);
}

/* 페이지 전환 컨테이너 */
.page-view {
  animation: fadeSlide var(--dur-reveal) var(--ease-out);
}

/* 합격 예측 / 관심 학과 페이지 상단: 내 성적 요약 1줄 띠 */
.score-context-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  margin-bottom: 24px;
  border: 1px solid var(--line);
  border-radius: var(--r-box);
  background: var(--bg);
  flex-wrap: wrap;
}

.score-context-items {
  display: flex;
  align-items: stretch;
  gap: 10px 0;
  flex-wrap: wrap;
  font-size: var(--fs-body);
}

/* 과목 한 칸: 위에 과목명, 아래에 값. 칸 사이는 세로선으로 나눔 */
.score-context-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 18px;
  border-left: 1px solid var(--line);
}

.score-context-item:first-child {
  padding-left: 0;
  border-left: 0;
}

.score-context-label {
  font-size: var(--fs-xs);
  color: var(--ink-muted);
}

.score-context-val {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.sc-pair {
  white-space: nowrap;
}

.sc-k {
  margin-right: 4px;
  font-size: var(--fs-xs);
  font-weight: 400;
  color: var(--ink-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.preset-label {
  font-size: var(--fs-xs);
  color: var(--ink);
  margin-right: 4px;
}

/* 버튼 체계: 채운 버튼은 한 화면에 하나만(주 실행 버튼), 나머지는 1px 테두리 또는 텍스트 링크 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--r-ctrl);
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  font-weight: 500;
  cursor: pointer;
  transition: opacity var(--dur-micro) var(--ease-out), transform 100ms var(--ease-out);
  white-space: nowrap;
}

.btn:hover {
  opacity: 0.78;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--ink);
  color: #ffffff;
  border-color: var(--ink);
}

.btn-link {
  border: none;
  background: transparent;
  padding: 0 6px;
  color: var(--ink-muted);
  font-weight: 400;
  height: 36px;
  cursor: pointer;
  transition: opacity var(--dur-micro) var(--ease-out);
}

.btn-link:hover {
  opacity: 0.65;
}

.btn-sm {
  height: 30px;
  padding: 0 10px;
  font-size: var(--fs-xs);
}

/* 메인 섹션 간격 (8의 배수) */
.main-content {
  padding-top: 40px;
  padding-bottom: 96px;
}

/* 영역 1: 비대칭 2단 (왼쪽 원점수 입력 7 : 오른쪽 예상 성적표 5) */
.top-grid {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 40px;
  align-items: start;
}

/* 입력 영역: 종이 톤 바탕 위의 흰 면 */
.input-panel {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-box);
  padding: 24px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.input-mode-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-box);
}

.input-mode-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-ctrl);
  padding: 5px 10px;
  font-size: var(--fs-xs);
  font-weight: 400;
  color: var(--ink-muted);
  cursor: pointer;
  transition: opacity var(--dur-micro) var(--ease-out);
  white-space: nowrap;
}

.input-mode-btn:hover {
  color: var(--ink);
}

.input-mode-btn.active {
  background: var(--ink);
  color: #ffffff;
  font-weight: 500;
}

.input-mode-hint {
  margin: 0 0 16px 0;
}

.direct-row {
  grid-template-columns: 76px minmax(136px, 1.25fr) minmax(0, 1fr) minmax(0, 1fr) 76px;
}

.direct-only-tag {
  display: none;
}

.direct-empty {
  text-align: right;
  color: var(--ink-muted);
}

.share-preview-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  margin-bottom: 16px;
  border: 1px solid var(--ink);
  border-radius: var(--r-box);
  background: var(--bg);
  flex-wrap: wrap;
}

.share-preview-text {
  font-size: var(--fs-body);
  color: var(--ink);
}

.share-preview-btns {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.section-title {
  margin: 0;
  font-size: var(--fs-h2);
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.panel-hint {
  font-size: var(--fs-xs);
  color: var(--ink);
}

/* 원점수 입력 테이블형 그리드 */
.score-rows {
  display: flex;
  flex-direction: column;
}

.score-row {
  display: grid;
  grid-template-columns: 76px minmax(136px, 1.25fr) minmax(0, 1fr) minmax(0, 1fr) 64px;
  gap: 8px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.score-row:first-child {
  padding-top: 0;
}

.score-row-head {
  font-size: var(--fs-xs);
  color: var(--ink);
  padding: 0 0 8px 0;
}

.score-label {
  font-weight: 500;
}

.field-group {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.field-group .ctrl-input {
  flex: 1 1 0;
  min-width: 0;
}

.field-tag {
  font-size: var(--fs-xs);
  color: var(--ink);
  white-space: nowrap;
}

/* 탐구 표준점수와 백분위를 두 줄로 나눠 적음 */
.hint-line {
  display: block;
  line-height: 1.3;
}

.ctrl-input,
.ctrl-select {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-ctrl);
  background: var(--bg);
  color: var(--ink);
  outline: none;
}

.ctrl-input:focus,
.ctrl-select:focus {
  border-color: var(--ink);
}

.ctrl-input-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
  appearance: textfield;
}

/* 숫자 칸의 위아래 화살표는 만점 표시와 겹치므로 숨김 */
.ctrl-input-num::-webkit-outer-spin-button,
.ctrl-input-num::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* 원점수 입력칸: 작은 입력칸 바로 오른쪽에 만점을 "/76"처럼 같은 크기로 적음 */
.num-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 1 1 0;
  min-width: 0;
}

.num-wrap .ctrl-input {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  padding: 0 6px;
  text-align: center;
}

.field-max {
  flex: 0 0 auto;
  min-width: 32px;
  font-size: var(--fs-body);
  font-variant-numeric: tabular-nums;
  color: rgba(20, 27, 29, 0.5);
}

.sum-cell {
  text-align: right;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.naesin-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0 0 0;
  flex-wrap: wrap;
}

.naesin-strip-text {
  font-size: var(--fs-body);
  color: var(--ink);
}

.naesin-strip-sub {
  font-size: var(--fs-xs);
  color: var(--ink);
  margin-left: 8px;
}

.input-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

/* 오른쪽: 올해 예상 성적표 (바탕 흰색, 1px 가로선으로만 구성) */
/* 예상 성적: 입력 영역과 같은 흰 면 */
.summary-panel {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-box);
  padding: 24px;
}

.summary-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
}

.summary-table th,
.summary-table td {
  padding: 9px 6px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  font-weight: 400;
}

.summary-table th:first-child,
.summary-table td:first-child {
  text-align: left;
  padding-left: 0;
}

.summary-table th:last-child,
.summary-table td:last-child {
  padding-right: 0;
}

.summary-table th {
  font-size: var(--fs-xs);
  color: var(--ink);
  font-weight: 500;
}

.summary-totals {
  display: flex;
  gap: 24px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.summary-total-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.summary-total-label {
  font-size: var(--fs-xs);
  color: var(--ink);
}

.summary-total-val {
  font-size: var(--fs-body);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* 예상 성적 아래 기준 정보: 항목(왼쪽)과 값(오른쪽) */
.summary-meta {
  margin: 12px 0 0 0;
  font-size: var(--fs-xs);
  color: var(--ink-muted);
}

.summary-meta-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 5px 0;
}

.summary-meta-row > span:last-child {
  color: var(--ink);
  text-align: right;
}

/* 섹션 분리 (별도 페이지로 분리되어 상단 여백 정리) */
.results-section {
  margin-top: 0;
}

/* 관심 학과 / 보기 탭 바: 눌리는 세그먼트 토글 + 아래 체크박스와 충분한 간격 */
.view-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
  flex-wrap: wrap;
}

.view-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  background: var(--sunken);
  border: 1px solid var(--line);
  border-radius: var(--r-box);
}

.view-tab {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-ctrl);
  padding: 7px 14px;
  font-size: var(--fs-body);
  font-weight: 400;
  color: var(--ink-muted);
  cursor: pointer;
  transition: opacity var(--dur-micro) var(--ease-out);
  white-space: nowrap;
}

.view-tab:hover {
  color: var(--ink);
}

.view-tab.active {
  background: var(--bg);
  color: var(--ink);
  font-weight: 500;
  border-color: var(--line);
}

.view-tab-count {
  font-size: var(--fs-xs);
  font-weight: 400;
  margin-left: 6px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-muted);
}

.view-tools {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.check-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}

/* 관심학과 가/나/다군 요약 스트립 (관심학과 탭에서만 표시) */
.saved-summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.saved-group-col {
  border-left: 1px solid var(--line);
  padding-left: 14px;
}

.saved-group-col:first-child {
  border-left: none;
  padding-left: 0;
}

.saved-group-title {
  font-size: var(--fs-xs);
  font-weight: 500;
  margin-bottom: 6px;
}

.saved-group-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.saved-mini-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: var(--fs-xs);
}

.saved-mini-empty {
  font-size: var(--fs-xs);
  color: var(--ink-muted);
}

/* 테마 선택 바 (의예/치의예/한의예/약학/수의예/계약학과/서울대/고려대/연세대) */
.theme-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 14px 0 4px 0;
  flex-wrap: wrap;
}

.theme-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: var(--r-ctrl);
  background: var(--bg);
  color: var(--ink);
  font-size: var(--fs-xs);
  cursor: pointer;
  transition: opacity var(--dur-micro) var(--ease-out);
}

.theme-btn:hover {
  opacity: 0.78;
}

.theme-btn.active {
  background: var(--ink);
  color: #ffffff;
  border-color: var(--ink);
  font-weight: 500;
}

/* 필터 바 */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 0 14px 0;
  align-items: center;
}

.filter-search {
  flex: 1 1 240px;
  min-width: 200px;
}

.filter-select {
  width: auto;
  min-width: 112px;
}

/* 지역 다중 선택 드롭다운 (토글이 길어지지 않게 팝오버 1개로 압축) */
.region-picker {
  position: relative;
}

.region-picker-btn {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 36px;
  min-width: 120px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-ctrl);
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
  transition: opacity var(--dur-micro) var(--ease-out);
}

.region-picker-btn:hover {
  opacity: 0.78;
}

.region-picker-btn.has-selection {
  border-color: var(--ink);
  font-weight: 500;
}

.region-popover {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 312px;
  padding: 16px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-box);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.06);
  z-index: 40;
  animation: fadeSlide var(--dur-micro) var(--ease-out);
}

.region-quick-row {
  display: flex;
  gap: 6px;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.region-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.region-chip {
  height: 30px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: var(--r-tag);
  background: var(--bg);
  color: var(--ink);
  font-size: var(--fs-xs);
  cursor: pointer;
  text-align: center;
  transition: opacity var(--dur-micro) var(--ease-out);
}

.region-chip:hover {
  opacity: 0.78;
}

.region-chip.selected {
  background: var(--ink);
  color: #ffffff;
  border-color: var(--ink);
  font-weight: 500;
}

.region-popover-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

/* 상태 필터 인라인 바 (큰 통계 카드 금지 -> 본문 14px 텍스트 버튼 + 1px 구분) */
.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0 16px 0;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.status-filters {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.status-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-ctrl);
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
  transition: opacity var(--dur-micro) var(--ease-out);
}

/* 상태 필터: 딱지와 같은 색 점을 앞에 두고, 고른 상태는 그 색으로 채움 */
.status-btn[data-status="safe"] { --st: var(--st-safe); }
.status-btn[data-status="fit"] { --st: var(--st-fit); }
.status-btn[data-status="reach"] { --st: var(--st-reach); }
.status-btn[data-status="fail"] { --st: var(--st-off); }

.status-btn:not([data-status="all"])::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--st);
  flex-shrink: 0;
}

.status-btn.active {
  border-color: var(--st, var(--ink));
  background: var(--st, var(--ink));
  color: #ffffff;
  font-weight: 500;
}

.status-btn.active::before {
  background: #ffffff;
}

.status-btn:hover {
  opacity: 0.78;
}

.status-cnt {
  font-variant-numeric: tabular-nums;
}

.sort-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 유료 이용권 안내 띠 (미결제 시 목록 상단에 담담하게 표시) */
.pass-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-box);
  background: var(--bg);
  flex-wrap: wrap;
}

.pass-notice-text {
  margin: 0;
  max-width: 720px;
}

/* 업데이트 한 줄 안내 (페이지 상단, 이용권 안내 띠와 같은 형식) */
.update-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-box);
  background: var(--bg);
  flex-wrap: wrap;
}

.update-notice-title {
  margin: 0;
  font-size: var(--fs-body);
  color: var(--ink);
}

.update-notice-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* 하단 이용 안내 링크와 사업자 정보 */
.legal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin-top: 12px;
}

.legal-strong {
  font-weight: 500;
}

.legal-biz {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 16px;
  margin: 8px 0 0;
  font-size: var(--fs-xs);
  color: var(--ink-muted);
  line-height: 1.7;
}

.legal-biz.hidden {
  display: none;
}

/* 약관·정책 본문 */
.legal-doc h3 {
  margin: 16px 0 4px;
  font-size: var(--fs-body);
  font-weight: 500;
}

.legal-doc h3:first-child {
  margin-top: 0;
}

.legal-doc p {
  margin: 0 0 8px;
  font-size: var(--fs-body);
  color: var(--ink-muted);
}

.legal-date {
  margin-top: 16px !important;
  font-size: var(--fs-xs) !important;
}

/* 결제 전 필수 동의, 판매자 표시 */
/* 이용권 가격: 한정가 기간에는 정가를 취소선으로 옆에, 끝나는 날짜는 아래 작은 줄 */
.price-regular {
  margin-right: 4px;
  font-size: var(--fs-xs);
  font-weight: 400;
  color: var(--ink-muted);
}

.promo-note {
  margin: -8px 0 12px;
  font-size: var(--fs-xs);
  line-height: 1.6;
  color: var(--brand, var(--ink));
  text-align: right;
}

/* 결제 동의: 체크박스를 첫 줄 가운데에 맞추고, 약관 링크는 글줄 안 밑줄 링크로 (버튼 높이·여백 없음) */
.legal-consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 12px;
  font-size: var(--fs-xs);
  color: var(--ink-muted);
  line-height: 1.6;
  cursor: pointer;
}

.legal-consent input {
  flex: none;
  width: 16px;
  height: 16px;
  font-size: inherit;
  margin: calc((1.6em - 16px) / 2) 0 0;
  accent-color: var(--brand, var(--ink));
  cursor: pointer;
}

.legal-consent .btn-link {
  display: inline;
  height: auto;
  padding: 0;
  font: inherit;
  line-height: inherit;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--line-strong, currentColor);
  text-underline-offset: 3px;
  vertical-align: baseline;
}

.legal-consent .consent-req {
  color: var(--ink);
  font-weight: 500;
}

/* 결제 버튼 아래 판매자·안내 줄: 동의 문구와 같은 크기·색·줄 간격 */
.legal-seller,
.legal-note {
  margin: 12px 0 0;
  font-size: var(--fs-xs);
  line-height: 1.6;
  color: var(--ink-muted);
}

.legal-seller {
  display: flex;
  flex-wrap: wrap;
  gap: 0 16px;
}

.legal-seller + .legal-note {
  margin-top: 2px;
}

/* 결제 창 위에서 약관을 열 수 있도록 약관·정책 모달을 한 층 위에 둠 */
#termsModal,
#refundModal,
#privacyModal {
  z-index: 110;
}

/* 업데이트 내역 모달: 글 사이는 아래쪽 1px 선만 */
.update-entry {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.update-entry:first-child {
  padding-top: 0;
}

.update-entry:last-child {
  border-bottom: 0;
}

.update-entry-date {
  margin: 0 0 4px;
  font-size: var(--fs-xs);
  color: var(--ink-muted);
}

.update-entry-title {
  margin: 0 0 8px;
  font-size: var(--fs-body);
  font-weight: 500;
}

.update-entry-text {
  margin: 0;
  font-size: var(--fs-body);
  color: var(--ink-muted);
}

/* 학과 목록 테이블형 리스트 (세로 배열, 아래쪽 1px 선) */
.dept-list-head,
.dept-row-main {
  display: grid;
  grid-template-columns: 40px 72px 40px minmax(180px, 1fr) 48px 48px 64px 88px 88px 88px 80px;
  gap: 12px;
  align-items: center;
}

/* 넓은 화면: 묶음(.dept-lead, .dept-facts)은 풀어서 안의 칸이 표의 열이 됨. 좁은 화면에서는 한 줄 묶음으로 씀 */
.dept-lead,
.dept-facts {
  display: contents;
}

.only-narrow {
  display: none;
}

/* 저장·판정·군 열: 머리글과 칸 내용을 모두 가운데에 맞춤. 판정 딱지는 열 너비에 맞춰 폭을 같게 함 */
.dept-list-head .align-c {
  text-align: center;
}

.dept-row-main .save-btn {
  justify-self: center;
}

.col-badge .badge {
  width: 100%;
}

.col-group {
  text-align: center;
}

.col-sido,
.col-track,
.col-quota {
  font-size: var(--fs-xs);
}

.col-quota {
  text-align: right;
}

/* 목록 전체를 종이 톤 바탕 위의 흰 면 하나로 묶음 */
.dept-table {
  margin-top: 16px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-box);
  overflow: hidden;
}

.dept-table .empty-state {
  padding: 48px 20px;
}

.dept-list-head {
  padding: 12px 16px 12px 19px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--ink);
}

.dept-list-head .align-r,
.dept-row-main .align-r {
  text-align: right;
}

.dept-item {
  position: relative;
  border-bottom: 1px solid var(--line);
}

.dept-item:last-child {
  border-bottom: 0;
}

/* 행 왼쪽 3px 띠: 같은 판정이 이어지는 구간이 색 띠로 보임 */
.dept-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: transparent;
}

.dept-item[data-status="safe"]::before { background: var(--st-safe); }
.dept-item[data-status="fit"]::before { background: var(--st-fit); }
.dept-item[data-status="reach"]::before { background: var(--st-reach); }
.dept-item[data-status="fail"]::before { background: var(--st-off); }

.dept-row-main {
  padding: 12px 16px 12px 19px;
  cursor: pointer;
  transition: opacity var(--dur-micro) var(--ease-out);
}

.dept-row-main:hover {
  opacity: 0.82;
}

.save-btn {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--r-tag);
  background: var(--bg);
  cursor: pointer;
  padding: 0;
  transition: opacity var(--dur-micro) var(--ease-out), transform 100ms var(--ease-out);
}

.save-btn:hover {
  opacity: 0.72;
}

.save-btn:active {
  transform: scale(0.95);
}

.save-btn.saved {
  border-color: var(--ink);
  background: var(--ink);
  color: #ffffff;
}

/* 상태 딱지 (6번 예외: 구분 기능이 있는 데이터 색) */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  height: 24px;
  padding: 0 6px;
  border-radius: var(--r-tag);
  font-size: var(--fs-xs);
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}

.badge-safe { color: #ffffff; background: var(--st-safe); }
.badge-fit { color: #ffffff; background: var(--st-fit); }
.badge-reach { color: #ffffff; background: var(--st-reach); }
.badge-fail { color: #ffffff; background: var(--st-off); }
.badge-ineligible,
.badge-unknown { color: var(--ink-muted); background: var(--sunken); }

/* 대학명(굵게)과 모집단위를 두 줄로 나눔 */
.dept-univ {
  font-weight: 600;
  line-height: 1.35;
}

.dept-title {
  line-height: 1.35;
  margin-top: 1px;
}

/* 일부 학과에만 붙는 꼬리표 (추정 컷, 합격선 없음, 응시 조건) */
.dept-notes {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
  margin-top: 5px;
}

.dept-note {
  padding: 1px 7px;
  border: 1px solid var(--line);
  border-radius: var(--r-tag);
  background: var(--surface);
  font-size: var(--fs-xs);
  line-height: 1.5;
  color: var(--ink-muted);
}

.dept-note.warn {
  border-color: transparent;
  background: var(--st-fail-bg);
  color: var(--st-fail);
}

.diff-pos { color: var(--st-safe); font-weight: 500; }
.diff-neg { color: var(--st-fail); }

/* 행 상세 확장 영역 */
.dept-detail {
  padding: 16px 16px 20px 71px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  animation: fadeSlide var(--dur-reveal) var(--ease-out);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

.detail-block-title {
  font-size: var(--fs-xs);
  font-weight: 500;
  margin: 0 0 8px 0;
}

.detail-kv {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0;
  font-size: var(--fs-xs);
  border-bottom: 1px solid var(--line);
}

.detail-kv:last-child {
  border-bottom: none;
}

/* 잠금(미결제) 행 */
.dept-item.locked .dept-row-main {
  cursor: pointer;
}

.locked-mask {
  color: var(--ink-muted);
  font-size: var(--fs-xs);
}

/* 페이지네이션 */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 0;
  flex-wrap: wrap;
}

.page-info {
  font-size: var(--fs-xs);
}

.page-btns {
  display: flex;
  gap: 6px;
}

/* 빈 상태 */
.empty-state {
  padding: 48px 0;
  color: var(--ink-muted);
  max-width: 640px;
}

/* 하단 안내문 */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 32px 0 48px 0;
}

.footer-text {
  margin: 0 0 8px 0;
  max-width: 720px;
  font-size: var(--fs-body);
  color: var(--ink);
  line-height: 1.65;
}

/* 모달 (DESIGN.md 2번·4번: 떠 있는 레이어에만 옅은 그림자, 배경은 opacity만, blur 금지) */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(31, 31, 31, 0.34);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-layer) var(--ease-out);
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

/* 모달 내부 횡스크롤 없는 세로형 이용권 레이아웃 */
.modal-box {
  width: 100%;
  max-width: 820px;
  max-height: 90vh;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-box);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.06);
  display: flex;
  flex-direction: column;
  transform: translateY(10px);
  transition: transform var(--dur-layer) var(--ease-out);
  overflow: hidden;
}

.modal-backdrop.open .modal-box {
  transform: translateY(0);
}

.modal-box-sm {
  max-width: 520px;
  max-height: 92vh;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1 1 auto;
}

.pass-action-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pass-action-stack .btn {
  width: 100%;
}

.pass-code-row {
  display: flex;
  gap: 8px;
}

.pass-code-row .ctrl-input {
  flex: 1 1 0;
  min-width: 0;
}

.pass-code-row .btn {
  flex-shrink: 0;
}

.modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--line);
}

.modal-foot .field-tag {
  white-space: normal;
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1.45;
}

.modal-foot .btn,
.modal-foot .btn-link {
  flex-shrink: 0;
  white-space: nowrap;
}

.modal-tabs {
  display: flex;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
}

.modal-tab {
  background: transparent;
  border: none;
  border-bottom: 1px solid transparent;
  padding: 8px 0;
  margin-bottom: -1px;
  cursor: pointer;
  color: var(--ink-muted);
}

.modal-tab.active {
  color: var(--ink);
  font-weight: 500;
  border-bottom-color: var(--ink);
}

/* 모달 내부 편집 표 */
.edit-table {
  width: 100%;
  border-collapse: collapse;
}

.edit-table th,
.edit-table td {
  padding: 8px 6px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.edit-table th {
  font-size: var(--fs-xs);
  font-weight: 500;
}

.edit-table input {
  width: 68px;
  height: 30px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: var(--r-tag);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.paste-area {
  width: 100%;
  min-height: 180px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-ctrl);
  resize: vertical;
  line-height: 1.5;
}

.form-msg {
  margin-top: 10px;
  font-size: var(--fs-body);
}

.hidden {
  display: none !important;
}

@keyframes fadeSlide {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 반응형 */
@media (max-width: 960px) {
  .top-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .saved-summary-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .saved-group-col:nth-child(odd) {
    border-left: none;
    padding-left: 0;
  }
  .detail-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

/* 학과 행: 표 열 11개가 들어가지 않는 폭에서는 카드형으로 바꿈
   1줄 판정·모집군·저장 / 2줄 대학명 / 3줄 모집단위 / 4줄 지역·계열·정원 / 5줄 점수 4칸(이름표 위, 값 아래) */
@media (max-width: 1040px) {
  .dept-list-head {
    display: none;
  }
  .dept-row-main {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px 0;
    padding: 14px 14px 14px 17px;
  }
  .dept-lead {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .dept-lead .save-btn {
    order: 3;
    margin-left: auto;
  }
  .only-narrow {
    display: inline;
  }
  .col-badge .badge {
    width: auto;
  }
  .col-group {
    font-size: var(--fs-xs);
    color: var(--ink-muted);
    text-align: left;
  }
  .col-name {
    grid-column: 1 / -1;
    min-width: 0;
  }
  .dept-facts {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 2px 12px;
    color: var(--ink-muted);
  }
  .col-quota {
    text-align: left;
  }
  .dept-row-main .col-score,
  .dept-row-main .col-safe,
  .dept-row-main .col-pass,
  .dept-row-main .col-diff {
    margin-top: 4px;
    padding-top: 8px;
    border-top: 1px solid var(--line);
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
  }
  .dept-row-main .col-score::before,
  .dept-row-main .col-safe::before,
  .dept-row-main .col-pass::before,
  .dept-row-main .col-diff::before {
    display: block;
    font-size: var(--fs-xs);
    font-weight: 400;
    color: var(--ink-muted);
  }
  .dept-row-main .col-score::before { content: "내 점수"; }
  .dept-row-main .col-safe::before  { content: "안정권"; }
  .dept-row-main .col-pass::before  { content: "합격권"; }
  .dept-row-main .col-diff::before  { content: "여유"; }
  /* 잠긴 행: 값이 없는 칸은 숨기고 "이용권 필요"만 한 줄로 둠 */
  .dept-item.locked .dept-row-main .col-score {
    grid-column: 1 / -1;
  }
  .dept-item.locked .dept-row-main .col-score::before { content: none; }
  .dept-item.locked .dept-row-main .col-safe,
  .dept-item.locked .dept-row-main .col-pass,
  .dept-item.locked .dept-row-main .col-diff { display: none; }
  .dept-detail {
    padding: 14px 14px 18px 17px;
  }
}

@media (max-width: 640px) {
  .wrap {
    padding-left: max(20px, env(safe-area-inset-left, 20px));
    padding-right: max(20px, env(safe-area-inset-right, 20px));
  }
  .main-content {
    padding-top: 24px;
    padding-bottom: max(64px, calc(48px + env(safe-area-inset-bottom, 0px)));
  }

  /* 헤더: .wrap 좌우 패딩(20px)을 절대 덮어쓰지 않도록 상하 패딩만 지정 */
  .header-inner {
    padding-top: 18px;
    padding-bottom: 6px;
    gap: 10px;
    flex-direction: column;
    align-items: stretch;
  }
  .header-left {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    width: 100%;
  }
  .brand {
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    padding: 2px 0;
  }
  .brand-title {
    white-space: nowrap;
  }
  .brand-sub {
    white-space: nowrap;
    flex-shrink: 0;
  }
  .page-nav {
    width: 100%;
    display: flex;
    gap: 4px;
    padding: 3px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .page-nav::-webkit-scrollbar {
    display: none;
  }
  .page-nav-btn {
    flex: 1 0 auto;
    padding: 8px 10px;
    font-size: var(--fs-xs);
    text-align: center;
  }
  .header-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    padding: 4px 0 12px 0;
    overflow: visible;
  }
  .header-actions .btn {
    width: 100%;
    height: 32px;
    padding: 0 4px;
    font-size: var(--fs-xs);
    min-width: 0;
  }
  .preset-label {
    display: none;
  }

  /* M11: 모바일 iOS Safari 입력 포커스 자동 확대 방지 */
  .ctrl-input,
  .ctrl-select {
    font-size: 16px;
  }
  /* 점수 입력 패널: 안쪽 여백 20px, 과목 라벨·합계 1줄, 선택과목 2줄, 원점수 3줄 50:50 */
  .input-panel,
  .summary-panel {
    padding: 20px;
  }
  .panel-head {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    margin-bottom: 10px;
  }
  .input-mode-tabs {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .input-mode-btn {
    text-align: center;
    padding: 7px 8px;
  }
  .score-row-head {
    display: none;
  }
  .score-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 10px;
    padding: 12px 0;
  }
  .score-row.direct-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .score-row.direct-row > .score-label {
    grid-column: 1 / 4;
    grid-row: 1;
  }
  .score-row.direct-row > .ctrl-select,
  .score-row.direct-row > .field-tag:nth-child(2) {
    grid-column: 1 / 4;
    grid-row: 2;
  }
  .score-row.direct-row > .field-group:nth-child(3) {
    grid-column: 1;
    grid-row: 3;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }
  .score-row.direct-row > .field-group:nth-child(4) {
    grid-column: 2;
    grid-row: 3;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }
  .score-row.direct-row > .field-group:nth-child(5) {
    grid-column: 3;
    grid-row: 3;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }
  .score-row.direct-row .direct-only-tag {
    display: block;
    color: var(--ink-muted);
  }
  .score-row.direct-row .direct-empty {
    display: none;
  }
  /* 1줄: 영역명(좌) + 합계(우) */
  .score-row > .score-label {
    grid-column: 1;
    grid-row: 1;
    white-space: nowrap;
    font-size: var(--fs-body);
  }
  .score-row > .sum-cell {
    display: block;
    grid-column: 2;
    grid-row: 1;
    font-size: var(--fs-body);
    text-align: right;
  }
  /* 2줄: 선택과목 드롭다운 또는 절대평가 안내 -> 왼쪽 시작선 맞춤 */
  .score-row > .ctrl-select,
  .score-row > .field-tag:nth-child(2) {
    grid-column: 1 / 3;
    grid-row: 2;
    justify-self: stretch;
  }
  .score-row > .field-tag:nth-child(2) {
    color: var(--ink-muted);
    line-height: 1.3;
  }
  /* 3줄: 국어/수학 공통(왼쪽 50%) + 선택(오른쪽 50%) — 라벨을 입력칸 위에 올려 좌측 끝선 완벽 일치 */
  .score-row > .field-group:nth-child(3) {
    grid-column: 1;
    grid-row: 3;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    width: 100%;
  }
  .score-row > .field-group:nth-child(4) {
    grid-column: 2;
    grid-row: 3;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    width: 100%;
  }
  .score-row > .field-group .field-tag {
    color: var(--ink-muted);
    min-width: 0;
  }
  .score-row > .field-group .ctrl-input {
    width: 100%;
    flex: none;
  }
  /* 3줄: 영어/한국사/탐구/제2외 원점수 입력칸(왼쪽 50%, 공통 입력칸과 완벽 동일 폭) + 등급/백분위(오른쪽 50%) */
  .score-row > .num-wrap:nth-child(3) {
    grid-column: 1;
    grid-row: 3;
    width: 100%;
  }
  .score-row > .field-tag:nth-child(4) {
    grid-column: 2;
    grid-row: 3;
    text-align: right;
    align-self: center;
  }

  /* 예상 성적표 셀 줄바꿈 방지 */
  .summary-table th,
  .summary-table td {
    padding: 8px 4px;
    white-space: nowrap;
    font-size: var(--fs-xs);
  }
  .summary-totals {
    gap: 16px;
  }

  /* 합격 예측 상단 성적 요약 띠: 모바일에서는 깔끔하게 요약 전체가 보이도록 2단 배치 */
  .score-context-bar {
    padding: 12px 14px;
    gap: 10px;
    flex-direction: column;
    align-items: stretch;
  }
  .score-context-items {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 12px;
  }
  .score-context-item {
    padding: 0;
    border-left: 0;
    font-size: var(--fs-xs);
  }
  .score-context-val {
    flex-wrap: wrap;
    gap: 0 8px;
  }
  #editScoreFromResultsBtn {
    align-self: flex-end;
  }

  /* 뷰 탭 & 토글: 전체/관심 세그먼트 2등분 + 아래 토글과 충분한 간격(16px) */
  .view-bar {
    gap: 16px;
    padding-bottom: 16px;
  }
  .view-tabs {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .view-tab {
    width: 100%;
    text-align: center;
    padding: 8px 10px;
  }
  .view-tools {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    overflow: visible;
    gap: 8px 14px;
    padding-top: 0;
  }
  .view-tools::-webkit-scrollbar {
    display: none;
  }
  .check-label {
    flex-shrink: 0;
    white-space: nowrap;
    font-size: var(--fs-xs);
  }

  /* 테마 바 & 상태 필터 바: 가로 스와이프 1줄 유지 (여러 줄 폭포 방지) */
  .theme-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 12px 0 6px 0;
  }
  .theme-bar::-webkit-scrollbar {
    display: none;
  }
  .theme-btn {
    flex-shrink: 0;
    white-space: nowrap;
  }

  /* 필터 바: 검색창 1줄 전체 + 드롭다운 2열 균등 그리드 */
  .filter-bar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 10px 0 12px 0;
  }
  .filter-search {
    grid-column: 1 / -1;
    min-width: 0;
  }
  .filter-select,
  .region-picker,
  .region-picker-btn {
    width: 100%;
    min-width: 0;
  }
  .region-popover {
    left: auto;
    right: 0;
    width: min(312px, calc(100vw - 32px));
  }
  #resetFilterBtn {
    grid-column: 1 / -1;
    justify-self: end;
    height: 28px;
  }

  /* 상태 필터: 5개(전체/안정/적정/소신/불가) 모두 잘림 없이 깔끔하게 1줄/균등 표시 */
  .status-bar {
    gap: 10px;
    padding: 6px 0 12px 0;
  }
  .status-filters {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
    overflow: visible;
  }
  .status-btn {
    width: 100%;
    height: 30px;
    padding: 0 2px;
    gap: 3px;
    font-size: var(--fs-xs);
    justify-content: center;
    white-space: nowrap;
  }
  .sort-wrap {
    width: 100%;
    justify-content: space-between;
  }
  .sort-wrap .filter-select {
    flex: 1 1 auto;
  }

  /* 학과 행 카드 배치는 위 1040px 구간 규칙을 그대로 씀. 여기서는 좌우 여백만 줄임 */
  .dept-row-main {
    padding: 12px 12px 12px 15px;
  }

  .saved-summary-strip {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 8px 0;
  }
  .saved-group-col {
    border-left: none;
    padding-left: 0;
    padding: 12px 0;
    border-top: 1px solid var(--line);
  }
  .saved-group-col:first-child {
    border-top: none;
    padding-top: 8px;
  }
  /* 좌우 여백은 위 .dept-row-main과 같게 둠. 0이면 글자 첫 자가 행 왼쪽 색 띠에 가려짐 */
  .dept-detail {
    padding: 12px 12px 16px 15px;
  }

  /* 모달 모바일 여백 정리: 세로 길게 쓰고 가로 스크롤 방지 */
  .modal-backdrop {
    padding: max(16px, env(safe-area-inset-top, 16px)) 16px max(16px, env(safe-area-inset-bottom, 16px)) 16px;
  }
  .modal-box,
  .modal-box-sm {
    max-height: calc(100dvh - 32px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  }
  .modal-head,
  .modal-body,
  .modal-foot {
    padding: 16px 18px;
  }
  .modal-foot {
    flex-wrap: wrap;
    gap: 8px;
  }
  .pass-code-row {
    flex-direction: column;
  }
  .pass-code-row .btn {
    width: 100%;
  }
  .modal-tabs {
    gap: 12px;
    overflow-x: auto;
    white-space: nowrap;
  }
  .site-footer {
    padding: 28px 0 max(48px, calc(32px + env(safe-area-inset-bottom, 0px))) 0;
  }
}

/* L13: 420px 이하 좁은 스마트폰에서 헤더 4개 버튼이 잘리지 않도록 2x2 균등 배치 */
@media (max-width: 420px) {
  .header-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* 관리자 코드 발급 페이지 */
.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
  gap: 40px;
  align-items: start;
}

.admin-form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.admin-form-row label {
  font-size: var(--fs-xs);
  font-weight: 500;
}

.admin-form-inline {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.code-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* 관심 학과 공유/PDF 액션 바 */
.saved-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.saved-action-btns {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.share-toast {
  font-size: var(--fs-xs);
  color: var(--ink);
}

/* 공유 리포트 인쇄 / PDF 전용 영역 (화면에서는 숨기고 print 시에만 노출) */
.print-report {
  display: none;
}

@media (max-width: 960px) {
  .admin-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }
}

/* =====================================================================
 * 2026-11-25 화면 뼈대 개편 (사용자 승인 시안)
 * 브랜드 띠 헤더(청록) + 밑줄 탭, 테두리 상자 줄이기, 큰 화면 제목과 굵은 핵심 숫자, 자료 표다운 학과 목록.
 * 위쪽의 옛 규칙을 이 구역이 덮어씀. 색·모서리 토큰도 여기 :root 값이 최종값.
 * ===================================================================== */
:root {
  --page: #f1f5f6;
  --surface: #f5f8f9;
  --sunken: #e6eced;
  --line: #dfe6e7;
  --line-strong: #cad4d6;
  --ink: #141b1d;
  --ink-muted: rgba(20, 27, 29, 0.68);
  --brand: #0b5563;
  --brand-hover: #11707f;
  --brand-soft: #e3f1f3;
  --r-tag: 6px;
  --r-ctrl: 8px;
  --r-box: 12px;
  --r-modal: 16px;
  --h-ctrl: 40px;
  --h-ctrl-sm: 32px;
}

.page-view { animation: none; }

/* ---------- 헤더: 브랜드 색 띠 ---------- */
.site-header {
  background: var(--brand);
  border-bottom: 0;
}

.header-inner {
  min-height: 56px;
  padding-top: 0;
  padding-bottom: 0;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 24px;
}

.header-left {
  gap: 40px;
  flex-wrap: nowrap;
  align-items: stretch;
}

.brand {
  align-items: center;
  gap: 9px;
}

.brand-mark {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  color: #ffffff;
}

.brand-title {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  color: #ffffff;
  white-space: nowrap;
}

.brand-kr {
  margin-left: 6px;
  font-weight: 500;
}

.brand-sub {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.66);
  white-space: nowrap;
}

/* 메뉴: 알약 모양 대신 밑줄 탭 */
.page-nav {
  align-items: stretch;
  gap: 4px;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 0;
}

.page-nav-btn {
  padding: 0 14px;
  border: 0;
  border-bottom: 3px solid transparent;
  border-top: 3px solid transparent;
  border-radius: 0;
  font-size: 15px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.72);
}

.page-nav-btn:hover { color: #ffffff; }

.page-nav-btn.active {
  background: none;
  border-color: transparent;
  border-bottom-color: #ffffff;
  font-weight: 600;
  color: #ffffff;
}

.nav-count {
  color: inherit;
  opacity: 0.8;
}

.header-actions { align-items: center; }

.site-header .header-actions .btn {
  height: 34px;
  background: #ffffff;
  border-color: #ffffff;
  font-weight: 600;
  color: var(--brand);
}

/* ---------- 글자 위계 ---------- */
.page-head { margin-bottom: 20px; }

.page-title {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.25;
}

.section-title { font-weight: 700; }

/* ---------- 버튼·입력칸: 테두리 버튼을 채운 버튼으로 ---------- */
.btn {
  border-color: transparent;
  background: var(--sunken);
}

.btn:hover {
  opacity: 1;
  background: #d9e1e3;
}

.btn-primary,
.btn-primary:hover {
  background: var(--brand);
  border-color: var(--brand);
  color: #ffffff;
}

.btn-primary:hover { background: var(--brand-hover); }

.ctrl-input,
.ctrl-select,
.region-picker-btn {
  border-color: var(--line-strong);
}

.ctrl-input:focus,
.ctrl-select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(11, 85, 99, 0.12);
}

/* 입력 방식 전환: 밑줄 탭 */
.input-mode-tabs {
  gap: 18px;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 0;
}

.input-mode-btn {
  padding: 6px 0;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  font-size: 14px;
}

.input-mode-btn.active {
  background: none;
  border-bottom-color: var(--brand);
  font-weight: 600;
  color: var(--brand);
}

.sum-cell,
.score-label { font-weight: 600; }

.summary-table th {
  font-weight: 600;
  color: var(--ink-muted);
}

.summary-total-val {
  font-size: 18px;
  font-weight: 700;
}

.summary-panel .panel-head { margin-bottom: 0; }

/* ---------- 예측 화면 ---------- */
.update-notice {
  border: 0;
  background: var(--brand-soft);
}

.score-context-bar { border-color: var(--line); }

/* 제목 줄. 전체/관심 전환은 헤더 메뉴와 겹치므로 숨김 */
.view-bar {
  padding-bottom: 0;
  border-bottom: 0;
}

.view-tabs { display: none; }

/* 모아보기: 칩 14개를 밑줄 탭 한 줄로 */
.theme-bar {
  display: flex;
  flex-wrap: nowrap;
  gap: 0;
  margin-top: 14px;
  padding: 0;
  border-bottom: 1px solid var(--line-strong);
  overflow-x: auto;
  scrollbar-width: none;
}

.theme-bar::-webkit-scrollbar { display: none; }

.theme-btn {
  flex-shrink: 0;
  height: auto;
  margin-bottom: -1px;
  padding: 10px 12px;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  font-size: 14px;
  color: var(--ink-muted);
  white-space: nowrap;
}

.theme-btn:hover {
  opacity: 1;
  color: var(--ink);
}

.theme-btn.active {
  background: none;
  border-color: transparent;
  border-bottom-color: var(--brand);
  font-weight: 600;
  color: var(--brand);
}

.filter-bar { padding: 16px 0 0 0; }

.filter-search {
  padding-left: 36px;
  background: #ffffff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23869597' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='M16 16l4.5 4.5'/%3E%3C/svg%3E") 11px center / 16px no-repeat;
}

/* 판정 필터: 상자 대신 글자와 색 점. 선택된 것만 옅게 채움 */
.status-bar { padding: 14px 0 0 0; }

.status-filters { gap: 2px; }

.status-btn {
  padding: 0 10px;
  background: none;
  border: 0;
  color: var(--ink-muted);
}

.status-btn:hover {
  opacity: 1;
  color: var(--ink);
}

.status-btn.active {
  background: var(--sunken);
  border: 0;
  font-weight: 600;
  color: var(--ink);
}

.status-btn.active::before { background: var(--st, var(--ink)); }

.status-cnt { font-weight: 600; }

.sort-wrap { gap: 16px; }

.sort-wrap .view-tools {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.pass-notice {
  border: 0;
  background: var(--brand-soft);
}

.pass-notice .btn {
  background: var(--brand);
  color: #ffffff;
}

/* ---------- 학과 표 ---------- */
.dept-table {
  margin-top: 14px;
  border-color: var(--line-strong);
}

.dept-list-head {
  padding-top: 10px;
  padding-bottom: 10px;
  background: #e9eeef;
  border-bottom-color: var(--line-strong);
  font-weight: 600;
  color: #434f51;
}

/* 행 왼쪽 색 띠 없앰 (판정은 딱지로 충분) */
.dept-item::before { display: none; }

.dept-row-main {
  padding-top: 10px;
  padding-bottom: 10px;
  transition: background var(--dur-micro) var(--ease-out);
}

.dept-row-main:hover {
  opacity: 1;
  background: #f3f8f9;
}

.dept-univ {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.dept-title { color: var(--ink-muted); }

.col-score { font-weight: 700; }

.col-safe,
.col-pass { color: #394546; }

.diff-pos,
.diff-neg { font-weight: 700; }

.badge { font-weight: 600; }

/* 저장: + 상자 대신 별 아이콘 */
.save-btn,
.save-btn.saved {
  width: 32px;
  height: 32px;
  border: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2396a5a7' stroke-width='1.7' stroke-linejoin='round'%3E%3Cpath d='M12 3.6l2.6 5.3 5.8.8-4.2 4.1 1 5.8-5.2-2.7-5.2 2.7 1-5.8-4.2-4.1 5.8-.8z'/%3E%3C/svg%3E") center / 21px no-repeat;
  font-size: 0;
}

.save-btn.saved {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%230b5563' stroke='%230b5563' stroke-width='1.7' stroke-linejoin='round'%3E%3Cpath d='M12 3.6l2.6 5.3 5.8.8-4.2 4.1 1 5.8-5.2-2.7-5.2 2.7 1-5.8-4.2-4.1 5.8-.8z'/%3E%3C/svg%3E");
}

.dept-detail { background: #f6f9f9; }

.region-chip.selected {
  background: var(--brand);
  border-color: var(--brand);
}

/* ---------- 팝업 ---------- */
.modal-backdrop {
  background: rgba(8, 30, 35, 0.5);
  transition-duration: 200ms;
}

.modal-box {
  border: 0;
  border-radius: var(--r-modal);
  box-shadow: 0 20px 48px rgba(8, 30, 35, 0.24);
  transition-duration: 200ms;
}

.modal-head { padding: 16px 16px 16px 24px; }

/* 닫기: 글자 대신 × 아이콘 (글자는 화면 낭독기용으로 남김) */
.modal-head .btn-link {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: var(--r-ctrl);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23566568' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E") center / 18px no-repeat;
  font-size: 0;
}

.modal-head .btn-link:hover {
  opacity: 1;
  background-color: var(--sunken);
}

.modal-foot { background: var(--surface); }

.modal-tabs {
  gap: 20px;
  border-bottom-color: var(--line-strong);
}

.modal-tab {
  padding: 9px 0;
  border-bottom-width: 2px;
}

.modal-tab.active {
  border-bottom-color: var(--brand);
  font-weight: 600;
  color: var(--brand);
}

.edit-table th {
  font-weight: 600;
  color: var(--ink-muted);
}

.edit-table input,
.paste-area {
  border-color: var(--line-strong);
}

.update-entry-title,
.legal-doc h3 { font-weight: 700; }

/* 상세 내역: 산식 이름은 제목 아래 작은 줄 */
.detail-block-title { font-weight: 700; }

.detail-block-sub {
  margin: -4px 0 8px 0;
  font-size: var(--fs-xs);
  color: var(--ink-muted);
}

.page-info {
  display: flex;
  gap: 14px;
}

/* ---------- 2차 손질: 테마 탭, 판정 줄, 보기 옵션, 추정 컷 표시 ---------- */
/* 테마 탭: 높이를 고정하고 세로 넘침을 막음 (iOS에서 글자 윗부분이 잘리던 문제). 밑줄은 안쪽 그림자로 그림 */
.theme-bar {
  align-items: stretch;
  height: 42px;
  overflow-y: hidden;
  touch-action: pan-x;
}

.theme-btn,
.theme-btn.active {
  align-items: center;
  height: 41px;
  margin-bottom: 0;
  padding: 0 12px;
  border-bottom: 0;
  line-height: 1.2;
  -webkit-appearance: none;
  appearance: none;
}

.theme-btn.active { box-shadow: inset 0 -2px 0 var(--brand); }

/* 판정 줄 아래 흐린 선과 간격을 둠 */
.status-bar { padding: 14px 0 14px 0; }

/* 보기 옵션(지역인재·예체능·응시 가능만): 체크 상자 대신 켜고 끄는 칩 */
.view-tools .check-label {
  position: relative;
  gap: 0;
}

.view-tools .check-label input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.view-tools .check-label span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 10px 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-ctrl);
  background: #ffffff;
  font-size: var(--fs-xs);
  color: var(--ink-muted);
  white-space: nowrap;
}

.view-tools .check-label span::before {
  content: "";
  width: 14px;
  height: 14px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23afbcbd' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 14px no-repeat;
}

.view-tools .check-label input:checked + span {
  border-color: var(--brand);
  background: var(--brand-soft);
  font-weight: 600;
  color: var(--brand);
}

.view-tools .check-label input:checked + span::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230b5563' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E");
}

.view-tools .check-label input:focus-visible + span {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}

.sort-wrap .view-tools { gap: 6px; }

/* 추정 컷·합격선 없음 표시: 모집단위 이름과 같은 줄에 붙여 행 높이를 늘리지 않음 */
.dept-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 6px;
}

.dept-note {
  padding: 0 6px;
  border: 0;
  background: var(--sunken);
  font-size: 12px;
  line-height: 18px;
  color: #485456;
}

/* ---------- 3차 손질: 조작 요소 통일 ----------
 * 규칙: 값을 고르는 것(입력칸·선택 상자·지역·판정·보기 옵션)은 흰 바탕 + 1px 테두리,
 *       동작 버튼은 옅게 채운 버튼, 가장 중요한 동작 하나만 청록 채움 */

/* 선택 상자와 지역 선택: 브라우저마다 다른 기본 화살표를 같은 꺾쇠로 통일 */
.ctrl-select,
.region-picker-btn {
  -webkit-appearance: none;
  appearance: none;
  padding: 0 32px 0 12px;
  background: #ffffff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23566568' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9.5l6 6 6-6'/%3E%3C/svg%3E") right 10px center / 14px no-repeat;
  font-size: var(--fs-body);
  font-weight: 400;
  color: var(--ink);
  text-align: left;
}

.region-picker-btn > span[aria-hidden="true"] { display: none; }

.region-picker-btn:hover { opacity: 1; }

.region-picker-btn.has-selection {
  border-color: var(--brand);
  font-weight: 600;
  color: var(--brand);
}

/* 판정 필터: 눌러서 고르는 것임이 보이게 칸이 이어진 버튼 묶음으로 */
.status-filters {
  gap: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-ctrl);
  background: #ffffff;
  overflow: hidden;
}

.status-btn,
.status-btn.active {
  height: 34px;
  padding: 0 13px;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: #ffffff;
  color: var(--ink);
}

.status-btn:last-child { border-right: 0; }

.status-btn:hover { background: var(--surface); }

.status-btn.active {
  background: var(--brand-soft);
  font-weight: 700;
  color: var(--brand);
}

.status-cnt {
  font-weight: 400;
  color: var(--ink-muted);
}

.status-btn.active .status-cnt {
  font-weight: 700;
  color: var(--brand);
}

.view-tools .check-label span { height: 34px; }

/* ---------- 관리자 화면(이용권 코드): 다른 화면과 같은 패널·표·입력칸 규칙 ---------- */
.admin-grid {
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
  gap: 24px;
}

.admin-form-row label {
  font-weight: 600;
  color: var(--ink-muted);
}

.admin-issued {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.admin-issued-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: var(--fs-xs);
  font-weight: 600;
}

.admin-issued .paste-area { min-height: 92px; }

.admin-list-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-table-wrap {
  margin-top: 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-box);
  overflow-x: auto;
}

.admin-table th,
.admin-table td { padding: 10px 12px; }

.admin-table thead th {
  background: #e9eeef;
  border-bottom-color: var(--line-strong);
  color: #434f51;
  white-space: nowrap;
}

.admin-table tbody tr:last-child td { border-bottom: 0; }

.admin-table .badge { min-width: 64px; }

.admin-date { font-size: var(--fs-xs); }

.admin-table .code-mono,
.admin-table .num { white-space: nowrap; }

.admin-row-actions {
  text-align: right;
  white-space: nowrap;
}

.table-empty {
  padding: 28px 12px;
  color: var(--ink-muted);
  text-align: center;
}

/* 헤더 고정: 스크롤을 내려도 로고와 메뉴가 위에 붙어 있음 (팝업 z-index 100보다 아래) */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
}

/* ---------- 4차 손질: 곡률·테두리·높이를 한 규칙으로 ----------
 * 곡률  꼬리표·딱지 6px / 조작 요소(입력칸·선택 상자·버튼·칩·묶음) 8px / 면(패널·표·안내 띠) 12px / 팝업 16px
 * 높이  조작 요소 40px, 작은 버튼 32px
 * 테두리 면은 1px --line, 조작 요소는 1px --line-strong. 버튼도 입력칸과 같은 흰 바탕 + 테두리(주 버튼만 브랜드 색 채움) */

/* 버튼: 입력칸·선택 상자와 같은 높이·곡률·테두리 */
.btn {
  height: var(--h-ctrl);
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-ctrl);
  background: #ffffff;
  font-weight: 500;
}

.btn:hover { background: var(--surface); }

.btn-sm {
  height: var(--h-ctrl-sm);
  padding: 0 12px;
}

.btn-primary,
.pass-notice .btn {
  border-color: var(--brand);
  background: var(--brand);
  color: #ffffff;
}

.btn-primary:hover,
.pass-notice .btn:hover { background: var(--brand-hover); }

.site-header .header-actions .btn {
  height: 36px;
  border-color: #ffffff;
}

/* 입력칸·선택 상자·지역 선택 */
.ctrl-input,
.ctrl-select,
.region-picker-btn {
  height: var(--h-ctrl);
  border-radius: var(--r-ctrl);
}

/* 판정 묶음과 보기 옵션 칩도 같은 높이 */
.status-filters {
  height: var(--h-ctrl);
  border-radius: var(--r-ctrl);
}

.status-btn,
.status-btn.active { height: 38px; }

.view-tools .check-label span {
  height: var(--h-ctrl);
  padding: 0 12px 0 10px;
  border-radius: var(--r-ctrl);
}

/* 면: 패널·표·안내 띠·성적 요약 */
.input-panel,
.summary-panel,
.score-context-bar,
.dept-table,
.admin-table-wrap,
.region-popover {
  border: 1px solid var(--line);
  border-radius: var(--r-box);
}

.update-notice,
.pass-notice { border-radius: var(--r-box); }

.modal-box { border-radius: var(--r-modal); }

/* 꼬리표·딱지 */
.badge { border-radius: var(--r-tag); }

.dept-note { border-radius: 4px; }

.region-chip {
  height: var(--h-ctrl-sm);
  border-color: var(--line-strong);
  border-radius: var(--r-tag);
}

.edit-table input {
  height: var(--h-ctrl-sm);
  border-radius: var(--r-tag);
}

.paste-area { border-radius: var(--r-ctrl); }

/* 원점수 입력칸: 과목에 상관없이 같은 크기(48px)로 두고, 열 너비를 넉넉히 나눔 */
#rawScoreRows .score-row {
  grid-template-columns: 68px minmax(112px, 1.25fr) minmax(0, 1fr) minmax(0, 1fr) 44px;
}

#rawScoreRows .field-group { gap: 4px; }

#rawScoreRows .num-wrap {
  flex: 0 0 auto;
  gap: 4px;
}

#rawScoreRows .num-wrap .ctrl-input {
  flex: 0 0 48px;
  width: 48px;
}

#rawScoreRows .field-max { min-width: 28px; }

/* ---------- 좁은 화면 ---------- */
@media (max-width: 1040px) {
  /* 점수 입력과 예상 성적을 한 단으로 (두 단이면 입력칸 열이 좁아짐) */
  .top-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .dept-row-main .col-score,
  .dept-row-main .col-safe,
  .dept-row-main .col-pass,
  .dept-row-main .col-diff { font-size: 15px; }
}

@media (max-width: 640px) {
  /* 헤더: 1줄 로고 + 이용권(화면 위에 고정), 2줄 메뉴 탭(스크롤하면 내용과 함께 올라감).
     로고 줄은 position: fixed로 띄우고, 헤더에는 그 높이만큼 위 여백을 둬서 자리를 비워 둠 */
  .site-header {
    position: static;
    padding-top: calc(48px + env(safe-area-inset-top, 0px));
  }
  .site-header .header-inner {
    display: block;
    min-height: 0;
    padding-top: 0;
    padding-bottom: 0;
  }
  .site-header .header-left { display: contents; }
  .site-header .brand {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 60;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    height: calc(48px + env(safe-area-inset-top, 0px));
    padding: env(safe-area-inset-top, 0px) 20px 0 20px;
    background: var(--brand);
  }
  .site-header .header-actions {
    position: fixed;
    top: env(safe-area-inset-top, 0px);
    right: 20px;
    z-index: 61;
    display: flex;
    align-items: center;
    height: 48px;
    padding: 0;
  }
  .site-header .header-actions .btn {
    width: auto;
    height: 32px;
    padding: 0 12px;
  }
  .site-header .page-nav {
    display: flex;
    width: 100%;
    gap: 0;
    padding: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.16);
  }
  .site-header .page-nav-btn {
    flex: 1 1 0;
    height: 40px;
    padding: 0 6px;
    font-size: 14px;
  }

  .page-title { font-size: 22px; }
  .page-head { margin-bottom: 14px; }

  .input-mode-tabs { gap: 0; }
  .input-mode-btn { padding: 8px 0; }

  .status-btn.active { background: var(--sunken); }
  .sort-wrap {
    flex-wrap: wrap;
    gap: 10px;
  }
  .sort-wrap .view-tools { width: 100%; }
  /* 보기 옵션 칩은 한 줄에 */
  .sort-wrap .view-tools { flex-wrap: nowrap; }

  /* 원점수 입력: 과목마다 1줄 과목명·합계(또는 등급), 2줄 선택과목, 3줄 공통·선택.
     입력칸은 작게 오른쪽에 두고 만점을 바로 옆에 같은 크기로 적음 */
  #rawScoreRows .score-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px 16px;
  }
  #rawScoreRows .score-row > .ctrl-select,
  #rawScoreRows .score-row > .field-tag:nth-child(2) {
    grid-column: 1;
    grid-row: 2;
    align-self: center;
  }
  #rawScoreRows .score-row-split > .ctrl-select { grid-column: 1 / -1; }
  #rawScoreRows .score-row > .field-group {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    grid-row: 3;
  }
  #rawScoreRows .num-wrap { flex: 0 1 auto; }
  #rawScoreRows .num-wrap .ctrl-input {
    flex: 0 1 56px;
    width: 56px;
    min-width: 40px;
  }
  #rawScoreRows .field-max {
    min-width: 36px;
    font-size: 16px;
  }
  #rawScoreRows .score-row > .num-wrap {
    grid-column: 2;
    grid-row: 2;
    width: auto;
    justify-self: end;
  }
  /* 영어·한국사·탐구: 합계는 입력값과 같으므로 숨기고, 그 자리에 등급(표준·백분위)을 둠 */
  #rawScoreRows .score-row > .field-tag:nth-child(4) {
    grid-column: 2;
    grid-row: 1;
    text-align: right;
    align-self: center;
  }
  #rawScoreRows .score-row > .num-wrap ~ .sum-cell { display: none; }
  #rawScoreRows .score-row-split > .sum-cell::before {
    content: "합계 ";
    font-size: var(--fs-xs);
    font-weight: 400;
    color: var(--ink-muted);
  }
  #rawScoreRows .hint-line { display: inline; }
  #rawScoreRows .hint-line + .hint-line { margin-left: 8px; }
  /* 판정 필터 묶음: 5칸 균등, 칸 사이 틈 없음 */
  .status-filters { gap: 0; }
  .status-btn,
  .status-btn.active {
    height: 38px;
    padding: 0 2px;
  }
  .ctrl-select,
  .region-picker-btn { font-size: 16px; }
}

@media (max-width: 960px) {
  .admin-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .admin-list-tools { flex-wrap: wrap; }
}

@media print {
  @page {
    size: A4 portrait;
    margin: 14mm;
  }
  /* 화면과 같은 규칙: 청록 제목, 옅은 회색 머리글, 굵은 대학명·내 점수·여유 점수, 판정색 */
  body {
    background: #ffffff !important;
    color: #141b1d !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .site-header,
  .site-footer,
  .update-notice,
  .modal-backdrop,
  #pageScore,
  #pageResults,
  #pageAdmin {
    display: none !important;
  }
  .print-report {
    display: block !important;
  }
  .print-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #0b5563;
    margin-bottom: 4px;
  }
  .print-brand {
    font-size: 13px;
    font-weight: 700;
    color: #0b5563;
  }
  .print-title {
    margin: 2px 0 0 0;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
  }
  .print-meta {
    margin: 0;
    font-size: 12px;
  }
  .print-meta > div {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
  }
  .print-meta dt { color: #596769; }
  .print-meta dd {
    margin: 0;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
  }
  .print-meta-inline {
    display: flex;
    gap: 18px;
  }
  .print-sec-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    margin: 18px 0 8px 0;
  }
  .print-sec-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
  }
  .print-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
  }
  .print-table th,
  .print-table td {
    padding: 6px 7px;
    border-bottom: 1px solid #dfe6e7;
    text-align: left;
  }
  .print-table th {
    background: #e9eeef;
    border-bottom-color: #cad4d6;
    font-weight: 600;
    color: #434f51;
    white-space: nowrap;
  }
  .print-table th.r,
  .print-table td.r {
    text-align: right;
    font-variant-numeric: tabular-nums;
  }
  .print-table td.univ,
  .print-table td.strong,
  .print-table td.st { font-weight: 700; }
  .print-table td.st-safe { color: #17794f; }
  .print-table td.st-fit { color: #2557c7; }
  .print-table td.st-reach { color: #c2540a; }
  .print-table td.st-fail,
  .print-table td.st-unknown,
  .print-table td.st-ineligible { color: #6f6a62; }
  .print-table tr { break-inside: avoid; }
  .print-foot {
    margin-top: 18px;
    font-size: 11.5px;
    color: #596769;
    line-height: 1.5;
  }
}

/* =====================================================================
   이용권 복구 코드, 기기 해제 안내, 앱 안 브라우저 결제 경고, 관리자 주문 조회
   ===================================================================== */
.pass-recovery {
  margin-top: 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-box);
  background: var(--surface);
}
.pass-recovery-paid {
  margin: 0 0 10px;
  font-weight: 600;
  color: var(--st-safe);
}
.pass-recovery-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-weight: 500;
}
.pass-recovery-code {
  margin: 8px 0 6px;
  font-size: 18px;
  letter-spacing: 0.06em;
  word-break: break-all;
  user-select: all;
}
.pass-recovery-note,
.pass-lost-help {
  margin: 0;
  font-size: var(--fs-xs);
  line-height: 1.6;
  color: var(--ink-muted);
}
.pass-lost-help {
  margin-top: 10px;
}
.pass-released {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: var(--r-ctrl);
  background: var(--st-reach-bg);
  color: var(--st-reach);
  font-size: var(--fs-body);
  line-height: 1.55;
}
.inapp-warn {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: var(--r-ctrl);
  background: var(--st-reach-bg);
}
.inapp-warn-text {
  margin: 0 0 8px;
  font-size: var(--fs-xs);
  line-height: 1.6;
  color: var(--st-reach);
}
.inapp-warn-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.admin-order-panel {
  margin-top: 24px;
  max-width: 560px;
}
.admin-order-result {
  margin-top: 12px;
}
