/* 프로토 승부식(G101) OMR 용지 82.4mm x 200mm — __Print_LT proto.css에서 용지 부분만 옮김
   모든 규칙은 .omr-print 안에서만 적용되어 사이트 스타일(style.css)과 섞이지 않습니다.
   화면: .preview 일 때만 보임 / 인쇄: 이 용지만 인쇄되고 나머지 화면은 모두 숨김 */

.omr-print {
  --sheet-width: 82.4mm;
  --sheet-height: 200mm;
  --omr-red: #c63b36;
  --omr-blue: #0077c8;
  --omr-light-blue: #00a4e4;
  --omr-bg: #fffdf9;

  --offset-x: 0mm; --offset-y: 0mm; --mark-w: 3.0mm; --mark-h: 1.7mm;
  --digits-offset-x: 0mm; --digits-offset-y: 0mm; --digits-right: 5.5mm;
  --digit-gap: 1.05mm; --digit-w: 3.3mm; --row-gap: 0.45mm;
  --slot-pitch: 14.85mm; --games-top: 14.5mm; --slot-height: 13.8mm;
  --outcome-offset-x: 0mm; --outcome-offset-y: 0mm; --outcome-right: 52.0mm; --outcome-gap: 4.33mm;
  --cancel-offset-x: 0mm; --cancel-offset-y: 0mm; --cancel-left: 1.2mm;
  --amount-offset-x: 0mm; --amount-offset-y: 0mm; --amount-bottom: 16.5mm; --amount-gap: 2.2mm;

  display: none;
  font-family: 'Malgun Gothic', sans-serif;
  font-size: 6pt;
  line-height: 1.2;
  color: #000;
}
.omr-print.preview { display: block; }
.omr-print *, .omr-print *::before, .omr-print *::after {
  box-sizing: border-box;
  -webkit-print-color-adjust: exact !important;
  print-color-adjust: exact !important;
}

.omr-print .omr-sheet-wrapper { position: relative; width: var(--sheet-width); background: #fff; box-shadow: 0 8px 24px rgba(0,0,0,.15); overflow: hidden; }
.omr-print .omr-sheet { position: relative; width: var(--sheet-width); height: var(--sheet-height); background: var(--omr-bg); overflow: hidden; }
.omr-print .omr-content-layer { position: absolute; inset: 0; width: 100%; height: 100%; transform: translate(var(--offset-x), var(--offset-y)); }

/* 타이밍 마크 */
.omr-print .timing-track { position: absolute; left: 1.5mm; top: 10mm; width: 2.2mm; height: 168mm; display: flex; flex-direction: column; justify-content: space-between; }
.omr-print .timing-mark { width: 100%; height: 1.1mm; background: #000; }

/* 상단 문구 · 오른쪽 파란 띠 */
.omr-print .omr-header { position: absolute; top: 4mm; left: 6mm; right: 6mm; text-align: center; color: #333; font-size: 5.5pt; line-height: 1.25; }
.omr-print .omr-header .caution { font-weight: 700; color: #000; font-size: 6pt; }
.omr-print .side-blue-bar { position: absolute; right: 1.2mm; top: 11mm; width: 3.8mm; height: 155mm; background: var(--omr-light-blue); color: #fff; writing-mode: vertical-rl; font-size: 4.8pt; font-weight: 700; display: flex; align-items: center; justify-content: center; }

/* 예상 1~10 */
.omr-print .games-container { position: absolute; top: var(--games-top); left: 5mm; width: 73mm; height: 155mm; }
.omr-print .game-slot { position: absolute; left: 0; right: 0; height: var(--slot-height); border: .25mm solid var(--omr-red); background: rgba(255,255,255,.4); }
.omr-print .slot-label { position: absolute; right: -.25mm; top: -.25mm; bottom: -.25mm; width: 4.8mm; background: var(--omr-red); color: #fff; font-size: 5pt; font-weight: 700; writing-mode: vertical-rl; display: flex; align-items: center; justify-content: center; }

/* 경기번호 천·백·십·일 x 0~9 */
.omr-print .number-matrix { position: absolute; right: var(--digits-right); top: .6mm; display: flex; flex-direction: column; gap: var(--row-gap); transform: translate(var(--digits-offset-x), var(--digits-offset-y)); }
.omr-print.row-anchor-bottom .number-matrix { top: auto; bottom: .6mm; }
.omr-print .digit-row { display: flex; align-items: center; height: 2.7mm; position: relative; }
.omr-print .digit-row-label { position: absolute; right: .2mm; width: 3.2mm; font-size: 5.2pt; font-weight: 700; color: var(--omr-red); text-align: center; }
.omr-print .digit-cells { position: absolute; right: 4mm; display: flex; flex-direction: row-reverse; gap: var(--digit-gap); }
.omr-print .cell-box { width: var(--digit-w); height: 2.5mm; position: relative; display: flex; align-items: center; justify-content: center; }
.omr-print .digit-num { font-size: 4.8pt; color: var(--omr-red); font-weight: 600; line-height: 1; z-index: 1; }
.omr-print .mark-outline { position: absolute; inset: .15mm; border: .2mm solid var(--omr-red); }

/* 마킹(검은 사각형) */
.omr-print .mark-svg { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: var(--mark-w); height: var(--mark-h); display: none; z-index: 10; }
.omr-print .cell-box.marked .mark-svg,
.omr-print.all-mark-test .cell-box .mark-svg { display: block; }

/* 승·무·패 */
/* 승·무·패: 가운데(무) 고정, 칸 중심 사이 간격 = --outcome-gap (기본 4.33mm = 예전 배치와 같음) */
.omr-print .outcome-matrix { position: absolute; right: var(--outcome-right); top: .4mm; bottom: .4mm; width: 9mm; display: flex; flex-direction: column; justify-content: center; gap: calc(var(--outcome-gap, 4.33mm) - 3.2mm); transform: translate(var(--outcome-offset-x), var(--outcome-offset-y)); }
.omr-print .outcome-item { display: flex; align-items: center; gap: 1mm; height: 3.2mm; flex: none; }
.omr-print .outcome-label { font-size: 5.2pt; font-weight: 700; color: var(--omr-red); width: 3.2mm; text-align: right; }
.omr-print .outcome-cell, .omr-print .cancel-cell { width: 4.5mm; height: 2.6mm; }
.omr-print .outcome-cell .mark-svg, .omr-print .cancel-cell .mark-svg { width: calc(var(--mark-w) * 1.25); height: var(--mark-h); }

/* 취소 */
.omr-print .cancel-matrix { position: absolute; left: var(--cancel-left); top: .4mm; bottom: .4mm; width: 6.5mm; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1mm; transform: translate(var(--cancel-offset-x), var(--cancel-offset-y)); }
.omr-print .cancel-label { font-size: 4.8pt; font-weight: 700; color: var(--omr-red); }

/* 개별투표금액 13칸 */
.omr-print .amount-section { position: absolute; bottom: var(--amount-bottom); left: 5mm; width: 73mm; height: 14mm; border: .25mm solid var(--omr-blue); background: rgba(255,255,255,.4); transform: translate(var(--amount-offset-x), var(--amount-offset-y)); }
.omr-print .amount-header { background: var(--omr-blue); color: #fff; font-size: 4.8pt; font-weight: 700; padding: .4mm 1.5mm; display: flex; justify-content: space-between; }
.omr-print .amount-note { font-size: 4.2pt; opacity: .9; }
.omr-print .amount-cells-container { display: flex; flex-direction: row-reverse; align-items: center; height: 9.8mm; padding: 0 1.2mm; gap: var(--amount-gap); }
.omr-print .amount-item { display: flex; flex-direction: column; align-items: center; gap: .6mm; }
.omr-print .amount-text { font-size: 4.5pt; font-weight: 700; color: var(--omr-blue); }
.omr-print .amount-cell { width: 3.4mm; height: 3.8mm; }
.omr-print .amount-cell .mark-svg { width: var(--mark-w); height: calc(var(--mark-h) * 1.5); }

/* 하단 로고 */
.omr-print .omr-footer { position: absolute; bottom: 2mm; left: 5mm; width: 73mm; height: 13.5mm; background: linear-gradient(135deg, #0099cc, #33b5e5); border-radius: 2px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #fff; }
.omr-print .omr-footer .logo-title { font-size: 13pt; font-weight: 900; letter-spacing: 2px; }
.omr-print .omr-footer .logo-sub { font-size: 7pt; font-weight: 700; opacity: .9; }

/* 가로 급지(프린터가 용지를 옆으로 넣는 경우) */
.omr-print.orientation-landscape .omr-content-layer { transform-origin: top left; transform: rotate(90deg) translate(var(--offset-x), calc(-1 * var(--sheet-width) + var(--offset-y))); }

/* ── 인쇄 ─────────────────────────────────────── */
@media print {
  html, body { margin: 0 !important; padding: 0 !important; background: #fff !important; }
  body > *:not(.omr-print) { display: none !important; }
  .omr-print { display: block !important; position: absolute; top: 0; left: 0; }
  .omr-print .omr-sheet-wrapper { box-shadow: none; }
  .omr-print.orientation-landscape .omr-sheet-wrapper,
  .omr-print.orientation-landscape .omr-sheet { width: var(--sheet-height); height: var(--sheet-width); }

  /* 실제 OMR 용지: 검은 마킹만 인쇄 (서식·테두리·글자는 투명) */
  .omr-print:not(.print-full) .omr-sheet { background: #fff !important; }
  .omr-print:not(.print-full) .omr-header,
  .omr-print:not(.print-full) .omr-footer,
  .omr-print:not(.print-full) .side-blue-bar,
  .omr-print:not(.print-full) .timing-track,
  .omr-print:not(.print-full) .slot-label,
  .omr-print:not(.print-full) .digit-row-label,
  .omr-print:not(.print-full) .digit-num,
  .omr-print:not(.print-full) .outcome-label,
  .omr-print:not(.print-full) .cancel-label,
  .omr-print:not(.print-full) .amount-header,
  .omr-print:not(.print-full) .amount-text { opacity: 0 !important; }
  .omr-print:not(.print-full) .game-slot,
  .omr-print:not(.print-full) .amount-section,
  .omr-print:not(.print-full) .mark-outline { border-color: transparent !important; background: transparent !important; }
}

/* A4 세로 한 장: 위쪽 끝(용지 시작)에서 시작, 가로 가운데 — 프로토 용지 82.4 x 200mm */
@media print {
  .omr-print .omr-sheet-wrapper { width: 210mm !important; height: 297mm !important; display: flex; align-items: flex-start; justify-content: center; background: #fff; }
  .omr-print .omr-sheet-wrapper > .omr-sheet { flex: none; }
}

/* 관리자 용지 편집용 배경 (로또와 같은 방식): 전체 레이어·예상 1~10 칸(.game-slot) 배경 회색 20%
   (셀 .cell-box 배경은 마킹 둘레에 테두리처럼 보여 쓰지 않음) */
.omr-print .omr-content-layer { background: rgb(0 0 0 / 20%); }
.omr-print .game-slot { background: rgb(0 0 0 / 20%); }
@media print {
  /* 이용자 실제 용지 인쇄(마킹만): 배경 없음 */
  .omr-print:not(.print-full) .omr-content-layer { background: transparent !important; }
  /* 관리자 페이지 시험 인쇄: 배경도 같이 출력 */
  body.admin-page .omr-print .omr-content-layer,
  body.admin-page .omr-print .game-slot { background: rgb(0 0 0 / 20%) !important; }
}
/* 관리자 · 배경 색상 끄기 (body.bg-off) — 화면과 인쇄 모두 */
body.admin-page.bg-off .omr-print .omr-content-layer,
body.admin-page.bg-off .omr-print .game-slot { background: transparent !important; }

/* 용지 180도 회전 (위아래 뒤집기) — 화면 미리보기·인쇄 모두. 크기가 같아 A4 위쪽 가운데 위치는 그대로 */
.omr-print .omr-sheet { transform: rotate(180deg); }
