/* 조회 화면은 합격증과 같은 결로 맞춘다 — 흰 바탕, 남색 가는 선, 교표.
   화면 글꼴은 Pretendard(자체 호스팅, 글자 조각만 받음, font-display: swap — 받기 전엔 시스템 고딕).
   명조(나눔명조)·가라몬드는 합격증 인쇄물에만 쓴다. */
:root {
  --bg: #fff;
  --ink: #1d2433;
  --navy: #1b3160;
  --muted: #5f6470;
  --line: #d6dbe3;
  --pass: #1b3160;
  --fail: #5f6470;
  --danger: #a3261e;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  line-height: 1.5;
}
[hidden] { display: none !important; }

.page {
  max-width: 440px;
  margin: 0 auto;
  padding: 28px 20px 40px;
}
/* 머리: 위 남색 선 · 교표 · 학교명 · 제목 · 전형명 · 아래 가는 선 */
.head {
  text-align: center;
  padding: 30px 0 26px;
  margin-bottom: 30px;
  border-top: 1.5px solid var(--navy);
  border-bottom: 1px solid var(--line);
}
.head-emblem { display: block; width: 52px; height: 52px; object-fit: contain; margin: 0 auto 14px; }
.school {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .3em;
  text-indent: .3em;
  color: var(--navy);
}
.head h1 {
  margin: 8px 0 2px;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: .14em;
  text-indent: .14em;
  color: var(--navy);
}
.round { margin: 12px 0 0; color: var(--muted); font-size: 13px; }

.form label { display: block; margin-bottom: 18px; }
.form label span { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; letter-spacing: .04em; color: var(--ink); }
.form small { font-weight: 400; color: var(--muted); letter-spacing: 0; }
.form input {
  width: 100%;
  font: inherit;
  font-size: 17px;
  padding: 13px 12px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #fff;
}
.form input:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 1px var(--navy); }
button {
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: .12em;
  width: 100%;
  padding: 15px;
  border: 0;
  border-radius: 2px;
  background: var(--navy);
  color: #fff;
  cursor: pointer;
}
button:disabled { opacity: .6; cursor: default; }
button.link {
  background: none;
  color: var(--muted);
  font-weight: 400;
  font-size: 14px;
  letter-spacing: 0;
  margin-top: 10px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.error { color: var(--danger); margin: 0 0 14px; font-size: 14px; white-space: pre-line; word-break: keep-all; }

/* 결과 · 안내: 카드 대신 위아래 가는 선 */
.result, .notice {
  text-align: center;
  padding: 26px 0;
  border-bottom: 1px solid var(--line);
}
.notice { margin: 0; font-size: 16px; line-height: 1.8; color: var(--ink); white-space: pre-line; word-break: keep-all; }
.verdict { margin: 0 0 6px; font-size: 21px; font-weight: 800; letter-spacing: -.01em; }
.result.pass .verdict { color: var(--pass); }
.result.fail .verdict { color: var(--fail); }
.sub { color: var(--muted); margin: 0 0 20px; white-space: pre-line; font-size: 14px; word-break: keep-all; }
.actions { margin-bottom: 4px; }

.foot { color: var(--muted); font-size: 12.5px; text-align: center; margin-top: 26px; line-height: 1.7; word-break: keep-all; }

/* 합격 축하 색종이 — 누르기·스크롤을 막지 않고, 인쇄에는 찍히지 않는다. */
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 10; }
@media print { .confetti { display: none !important; } }

/* 진위 확인 화면 */
.verify-fields { margin: 0 0 16px; text-align: left; }
.verify-fields div { display: flex; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.verify-fields dt { width: 5.5em; color: var(--muted); flex: none; font-size: 14px; }
.verify-fields dd { margin: 0; font-weight: 600; word-break: break-all; }

/* ── 합격증 ─────────────────────────────────────────── */
/* 인쇄 전용 A4 한 장. 화면에는 그리지 않는다 — 결과 화면이 길어지고, 인쇄 버튼이 있으면 충분하다.
   시안은 .classic(1) / .modern(2). */
@media screen { .cert { display: none !important; } }
.cert {
  position: relative;
  width: calc(100% - 32px);
  max-width: 440px;
  margin: 0 auto 40px;
  background: #fff;
  color: #1b1f24;
  overflow: hidden;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
.cert-fields { margin: 0; }
.cert-fields dt, .cert-fields dd { margin: 0; }
.cert-body { white-space: pre-line; word-break: keep-all; }
.cert-date, .cert-issuer, .cert-head p { margin: 0; }

/* 직인은 발급자 이름의 끝 글자에 겹친다 — 관인을 찍는 자리, 문서의 마지막. */
.issuer-name { position: relative; display: inline-block; }
.issuer-name img {
  position: absolute;
  left: 100%;
  top: 50%;
  width: 72px;
  height: 72px;
  object-fit: contain;
  transform: translate(-45%, -50%);
}

/* 진위 확인 — 왼쪽 아래 QR 과 확인번호 */
.cert-verify { display: flex; align-items: center; gap: 10px; margin-top: 28px; font-size: 10px; line-height: 1.5; color: #555; }
.cert-verify img { width: 52px; height: 52px; flex: none; }
.cert-verify p { margin: 0; }
.cert-verify b { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .06em; color: #1b1f24; }
.cert-verify .v-label { color: #777; }

/* ── 시안 1: 명조 · 이중 테두리 ── */
.classic {
  border: 1px solid var(--line);
  padding: 32px 24px 20px;
  font-family: "Batang", "AppleMyungjo", "Nanum Myeongjo", serif;
}
/* 머리 묶음은 풀고 교표(워터마크)만 남긴다. 학교명·영문 부제는 시안 2 에서만. */
.classic .cert-head { display: contents; }
.classic .cert-school, .classic .cert-eyebrow, .classic .cert-certify, .classic .cert-round { display: none; }
.classic .cert-title { text-align: center; font-size: 30px; letter-spacing: .3em; margin: 0 0 28px; }
.classic .cert-fields { display: flex; flex-direction: column; width: max-content; margin: 0 auto 28px; font-size: 16px; }
/* 성명 → 생년월일 → 전형구분 → 입학번호, 네 줄. 수험번호는 시험 때의 번호라 합격증에는 입학번호만 둔다.
   입학번호가 없는 예전 명단(.no-admit)에서만 그 자리에 수험번호를 대신 찍는다. 시안 2 도 같다. */
.classic .cert-fields > div { display: flex; padding: 4px 0; }
.classic .cert-fields > .f-name { order: 0; }
.classic .cert-fields > .f-birth { order: 1; }
.classic .cert-fields > .f-type { order: 2; }
.classic .cert-fields > .f-admit, .classic .cert-fields > .f-exam { order: 3; }
.cert:not(.no-admit) .cert-fields > .f-exam { display: none; }
/* 비운 줄(입학번호 없음)은 시안별 줄 서식보다 앞서 숨긴다. */
.cert .cert-fields > [hidden] { display: none; }
.classic .cert-fields dt { width: 6em; }
.classic .cert-body { font-size: 17px; line-height: 2; margin: 0 0 32px; }
.classic .cert-date { text-align: center; font-size: 16px; margin-bottom: 28px; }
.classic .cert-issuer { text-align: center; font-size: 22px; font-weight: 700; letter-spacing: .15em; min-height: 72px; line-height: 72px; }

/* ── 시안 2: 유럽 대학 졸업장풍 ──
   흰 바탕, 테두리 없이 위아래 남색 선 두 줄, 가운데 정렬, 글자만으로 위계를 만든다.
   교표(주작)는 장 한가운데에 아주 옅게 깐다 — 글자와 겹쳐도 읽히는 농도, 종이에 비친 문장(紋章)처럼.
   학교명은 교표와 「…학교장」에 이미 있으므로 따로 찍지 않는다.
   영문은 EB Garamond, 한글은 나눔명조(Nanum Myeongjo). */
.modern {
  --ink: #1d2433;
  --navy: #1b3160;
  --soft: #5f6470;
  --paper: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 600px;
  background: var(--paper);
  color: var(--ink);
  font-family: "Nanum Myeongjo", "AppleMyungjo", "Batang", serif;
  text-align: center;
  padding: 44px 26px 24px;
  box-shadow: 0 1px 2px rgba(29, 36, 51, .08), 0 10px 30px rgba(29, 36, 51, .10);
}
/* 위아래 가는 남색 선 */
.modern::before, .modern::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  height: 0;
  border-top: 1.5px solid var(--navy);
}
.modern::before { top: 16px; }
.modern::after { bottom: 16px; }
.modern .cert-round, .modern .cert-certify, .modern .cert-school { display: none; }
/* 머리 묶음을 풀어 순서를 다시 잡는다: 합격증 → 영문 부제. 한국 학교 문서라 한글 제목이 가장 크다. */
.modern .cert-head { display: contents; }
.modern .cert-title { order: 1; }
.modern .cert-eyebrow { order: 2; }
.modern .cert-fields { order: 3; }
.modern .cert-body { order: 4; }
.modern .cert-foot { order: 5; }
.modern .cert-verify { order: 6; }

/* 교표 워터마크 — 두 시안 공통. 장 한가운데에 아주 옅게 깐다.
   글자가 섞이지 않은 문장(紋章)만 쓴다. 워드마크가 있으면 이름 뒤로 영문 글자가 비친다. */
.cert-emblem {
  position: absolute;
  left: 50%;
  top: 52%;
  width: 62%;
  max-height: 52%;
  object-fit: contain;
  transform: translate(-50%, -50%);
  opacity: .06;
  filter: grayscale(1);
  mix-blend-mode: multiply;
  pointer-events: none;
}
/* 글자는 워터마크 위에. 진위 확인 칸은 인쇄에서 absolute 라 빼 둔다. */
.cert > :not(.cert-head):not(.cert-verify), .cert .cert-head > :not(.cert-emblem) { position: relative; }

/* 제목은 설정값(「합 격 증」)의 띄어쓰기에 자간을 더해 넓게 벌린다. */
.modern .cert-title {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: .5em;
  text-indent: .5em;
  color: var(--navy);
  margin: 0;
}
.modern .cert-eyebrow {
  font-family: "EB Garamond", Georgia, serif;
  font-style: italic;
  font-size: 16px;
  letter-spacing: .04em;
  color: #56647f;
  margin-top: 6px;
}
/* 성명·생년월일 / 전형구분·입학번호 2×2 — 시안 1 의 순서를 왼쪽에서 오른쪽으로 읽는다.
   모두 같은 크기다(성명만 크게 키우면 다른 항목과 따로 논다). 칸마다 왼쪽 맞춤이라 표처럼 줄이 선다. */
.modern .cert-fields {
  display: grid;
  grid-template-columns: auto auto;
  justify-content: center;
  justify-items: start;
  column-gap: 44px;
  row-gap: 8px;
  margin: 36px 0 18px;
  font-size: 13px;
  text-align: left;
}
.modern .cert-fields > div { display: flex; gap: .8em; }
.modern .cert-fields dt { min-width: 4.4em; font-weight: 400; color: var(--soft); }
.modern .cert-fields dd { font-weight: 500; color: var(--ink); }
.modern .cert-fields .f-name { order: 0; }
.modern .cert-fields .f-birth { order: 1; }
.modern .cert-fields .f-type { order: 2; }
.modern .cert-fields .f-admit, .modern .cert-fields .f-exam { order: 3; }
.modern .cert-fields .f-name dd { font-weight: 700; }
.modern .cert-body { font-size: 14px; line-height: 2; margin: 0; max-width: 24em; }
/* 발급일 → 발급자·직인을 같은 가운데 축에 쌓는다. 위가 모두 가운데 정렬이라 아래만 양쪽으로 갈라지면 어색하다. */
.modern .cert-foot {
  margin-top: auto;
  padding-top: 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.modern .cert-date { font-size: 13px; color: var(--soft); }
.modern .cert-issuer { font-size: 17px; font-weight: 600; letter-spacing: .25em; min-height: 64px; line-height: 64px; }
.modern .issuer-name img { width: 60px; height: 60px; }
.modern .cert-verify { align-self: flex-start; margin-top: 8px; color: var(--soft); text-align: left; }
.modern .cert-verify b { color: var(--ink); }

@page { size: A4; margin: 0; }
@media print {
  body { background: #fff; }
  .page { display: none !important; }
  .cert {
    width: 210mm;
    max-width: none;
    height: 297mm;
    margin: 0;
    box-shadow: none;
    break-inside: avoid;
  }
  .issuer-name img { width: 28mm; height: 28mm; }
  /* 아래 테두리 안쪽 왼편. 발급자·직인 줄과 겹치지 않게 본문은 그 위에서 끝난다. */
  .cert-verify { position: absolute; left: 22mm; bottom: 17mm; margin: 0; font-size: 8.5pt; }
  .cert-verify img { width: 18mm; height: 18mm; }
  .cert-emblem { top: 52%; width: 120mm; max-height: 120mm; }

  .classic {
    border: 0;
    padding: 40mm 28mm 30mm;
    outline: 1.2mm double #333;
    outline-offset: -14mm;
  }
  .classic .cert-title { font-size: 40px; margin-bottom: 22mm; }
  .classic .cert-fields { font-size: 19px; margin-bottom: 18mm; }
  .classic .cert-body { font-size: 21px; margin-bottom: 26mm; }
  .classic .cert-date { font-size: 19px; margin-bottom: 18mm; }
  .classic .cert-issuer { font-size: 28px; min-height: 30mm; line-height: 30mm; }

  .modern { padding: 36mm 26mm 0; min-height: 0; }
  .modern::before { top: 14mm; left: 16mm; right: 16mm; border-top-width: .5mm; }
  .modern::after { bottom: 14mm; left: 16mm; right: 16mm; border-top-width: .5mm; }
  .modern .cert-title { font-size: 40pt; }
  .modern .cert-eyebrow { font-size: 15pt; margin-top: 3mm; }
  /* 시안 1 처럼 위에서부터 흐른다 — 제목 묶음 → 인적사항 → 본문 → 발급일 → 발급자·직인.
     발급란을 아래에 붙여 두면 영문 부제 밑이 크게 비어 위아래가 따로 논다.
     시안 1 보다 글자가 작아 같은 간격이면 장 아래가 비므로 조금씩 넓힌다(발급자가 시안 1 과 비슷한 높이에 오게). */
  .modern .cert-fields { font-size: 13pt; margin: 30mm 0 22mm; column-gap: 16mm; row-gap: 3.5mm; }
  .modern .cert-body { font-size: 14pt; }
  .modern .cert-foot { margin-top: 40mm; padding: 0; gap: 12mm; }
  .modern .cert-date { font-size: 13pt; }
  .modern .cert-issuer { font-size: 18pt; min-height: 26mm; line-height: 26mm; }
  .modern .issuer-name img { width: 26mm; height: 26mm; }
  .modern .cert-verify { position: absolute; left: 22mm; bottom: 19mm; margin: 0; }
}
