/* ==========================================================
   [폰트 변경 1/2] 웹폰트 주소
   다른 폰트를 쓰려면 아래 @import 줄의 주소만 바꾸세요.
   (@import는 반드시 파일 맨 위에 있어야 해요.)
   ========================================================== */
@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.css");
@font-face {
    font-family: 'DosGothic';
    src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_eight@1.0/DOSGothic.woff') format('woff');
    font-weight: normal;
    font-display: swap;
}

:root {
  /* [폰트 변경 2/2] 폰트 이름 (웹폰트의 font-family 이름으로 바꾸세요) */
  --font-main: "DosGothic", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;

  /* 글자 크기 */
  --fs-base: 13px;                                  /* 기본 글자 크기 */
  --emph-add: 2pt;                                  /* 강조 숫자는 기본보다 +4pt */
  --fs-emph: calc(var(--fs-base) + var(--emph-add));

  /* 색상 */
  --bg: #FDEB4D;       /* 배경 (개나리색) */
  --ticket: #FFF6B3;   /* 티켓 면 (더 옅은 노랑) */
  --ink: #1A1A1A;      /* 글자·선 */
  --accent: #E8341F;   /* 강조 숫자 (빨강) */
  --hold: #8A866B;     /* 판매보류석 글자 */
}

* { box-sizing: border-box; border-radius: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-main);
  font-size: var(--fs-base);
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}

button, a { font-family: inherit; }
button { cursor: pointer; }

.page { max-width: 480px; margin: 0 auto; padding: 16px 12px 40px; }

/* ---------- 티켓 ---------- */
.ticket { position: relative; }
.ticket-bg {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  overflow: visible; pointer-events: none;
}
.ticket-body { position: relative; padding: 30px 16px; }

/* ---------- 상단 ---------- */
.head { text-align: center; padding: 0px 0 12px; }
.logo { display: block; max-width: 28%; max-height: 70px; margin: 0 auto 8px; }
.title-fallback { margin: 0 0 8px; font-size: var(--fs-emph); }
.meta { margin: 0; font-wieight: 600; }

/* ---------- 강조 숫자 ---------- */
.emph {
  font-size: var(--fs-emph);
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

/* ---------- 총 관람 횟수 ---------- */
.total {
  text-align: center;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  padding: 12px 0;
  margin-bottom: 20px;
}
.total-label { margin: 0; font-weight: 600; }
.total-num { margin: 2px 0; }
.total-sub { margin: 0; }
.sep { margin: 0 6px; }
.notice {
  margin: 8px 0 0;
  font-size: 12px;
  white-space: pre-line;
  color: var(--accent);
}

/* ---------- 구역 ---------- */
.block { margin-bottom: 24px; }
h2 {
  margin: 0 0 10px;
  font-size: var(--fs-base);
  font-weight: 700;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--ink);
}

/* ---------- 캐스트 ---------- */
.cast-group { margin-bottom: 14px; }
.group-head {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--ink); color: var(--ticket);
  padding: 4px 10px; margin-bottom: 6px; font-weight: 600;
}
.group-head .emph { color: var(--ticket); }
.cast-row {
  display: grid;
  grid-template-columns: 1fr 30px 44px 30px;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  border-bottom: 1px dashed var(--ink);
}
.cast-who { display: flex; align-items: center; gap: 8px; min-width: 0; }
.cast-photo {
  width: 32px; height: 32px; flex: none;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--ink);
}
.cast-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cast-input {
  width: 100%; padding: 0;
  text-align: center;
  border: 0; 
  background: transparent;
  font-family: inherit;
  -moz-appearance: textfield;
}
.cast-input::-webkit-outer-spin-button,
.cast-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.cast-count { text-align: center; }
.btn-sq {
  width: 30px; height: 30px;
  border: 1px solid var(--ink);
  background: transparent; color: var(--ink);
  font-size: 16px; line-height: 1; padding: 0;
}
.btn-sq:active { background: var(--ink); color: var(--ticket); }

/* ---------- 좌석 도구 ---------- */
.tools { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.seg { display: flex; }
.seg-btn {
  height: 36px; padding: 0 12px;
  border: 1px solid var(--ink); background: transparent; color: var(--ink);
  font-size: 13px;
}
.seg-btn + .seg-btn { border-left: 0; }
.seg-btn[aria-pressed="true"] { background: var(--ink); color: var(--ticket); }
.btn-line {
  height: 36px; padding: 0 12px;
  border: 1px solid var(--ink); background: transparent; color: var(--ink);
  font-size: 13px;
}
.btn-line[aria-pressed="true"] { background: var(--ink); color: var(--ticket); }

/* ---------- 좌석표 ---------- */
.map-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
.map { min-width: 100%; }
.map-scroll.zoom .map { width: 200%; }

.stage {
  display: flex; justify-content: space-between; align-items: center;
  border: 1px solid var(--ink);
  background: rgba(26, 26, 26, 0.06);
  padding: 8px; margin-bottom: 12px;
}
.stage-label { font-weight: 700; letter-spacing: 0.3em; font-size: 13px; }
.vl-cluster { display: flex; gap: 4px; }
.vl-col { display: flex; flex-direction: column; gap: 4px; }
.vl-col.inner { margin-top: 14px; }

.map-row {
  display: grid;
  grid-template-columns: 14px repeat(16, minmax(0, 1fr)) 14px;
  column-gap: 2px;
  margin-bottom: 3px;
  align-items: center;
}
.map-row > * { grid-row: 1; }
.row-label { text-align: center; font-size: 10px; font-weight: 600; }

.seat {
  height: 22px; min-width: 0; padding: 0;
  border: 1px solid var(--ink);
  background: transparent; color: var(--ink);
  font-size: 9px; line-height: 1;
  font-variant-numeric: tabular-nums;
  touch-action: manipulation;
}
.stage .seat { width: 28px; height: 24px; font-size: 10px; }
.seat[data-level="1"] { background: rgba(26, 26, 26, 0.28); }
.seat[data-level="2"] { background: rgba(26, 26, 26, 0.58); color: var(--ticket); font-weight: 700; }
.seat[data-level="3"] { background: var(--ink); color: var(--ticket); font-weight: 700; }
.seat.hold, .sw.hold {
  border: 1px dashed var(--hold); color: var(--hold);
  background: repeating-linear-gradient(135deg, transparent 0 3px, rgba(26, 26, 26, 0.15) 3px 4px);
  cursor: not-allowed;
}

.seat-info { margin: 8px 0 0; min-height: 1.5em; font-size: 13px; }

.legend {
  display: flex; flex-wrap: wrap; gap: 4px 12px;
  list-style: none; margin: 8px 0 0; padding: 0; font-size: 12px;
}
.legend li { display: flex; align-items: center; gap: 4px; }
.sw { display: inline-block; width: 14px; height: 14px; border: 1px solid var(--ink); }
.sw[data-level="1"] { background: rgba(26, 26, 26, 0.28); }
.sw[data-level="2"] { background: rgba(26, 26, 26, 0.58); }
.sw[data-level="3"] { background: var(--ink); }

/* ---------- 하단 버튼 ---------- */
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn-main, .actions .btn-line {
  height: 46px; font-size: var(--fs-base); font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  text-decoration: none;
}
.btn-main {
  border: 1px solid var(--ink); background: var(--ink); color: var(--ticket);
}
.btn-main:disabled { opacity: 0.6; }

/*----- copyright 보기 -----*/
.copyright { margin: 16px 0 0; text-align: center; font-size: 12px; }

/* ---------- 미리보기 창 ---------- */
.modal {
  position: fixed; inset: 0; z-index: 10;
  background: rgba(26, 26, 26, 0.7);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.modal[hidden] { display: none; }
.modal-box {
  background: var(--ticket); border: 1px solid var(--ink);
  padding: 12px; width: 100%; max-width: 420px; max-height: 100%; overflow: auto;
}
.modal-box img { display: block; width: 100%; height: auto; border: 1px solid var(--ink); }
.modal-tip { margin: 10px 0; font-size: 13px; text-align: center; }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.modal-actions .btn-main, .modal-actions .btn-line { height: 44px; font-size: var(--fs-base); }

/* ==========================================================
   저장용 이미지 (4:5 = 1080 x 1350px)
   화면에는 보이지 않고, 저장할 때만 잠깐 만들어져요.
   ========================================================== */
.export {
  position: fixed; left: -10000px; top: 0;
  width: 1080px; height: 1350px;
  padding: 60px;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-main);
  --ex-base: 36px;
  --ex-emph: 48x;
  .ex-copy { margin: auto 0 0; padding-top: 20px; text-align: center; font-size: 24px; }
}
.ex-ticket { position: relative; width: 100%; height: 100%; }
.ex-body {
  position: relative; height: 100%;
  padding: 65px 80px 70px;
  display: flex; flex-direction: column;
  font-size: var(--ex-base); line-height: 1.4;
}
.ex-head { text-align: center; }
.ex-logo { display: block; max-width: 165px; max-height: 95px; margin: 0 auto 16px; }
.ex-title { margin: 0 0 12px; font-size: var(--ex-emph); }
.ex-meta { margin: 0; font-size: 32px; font-wieight: 600; }
.ex-total {
  text-align: center; margin: 34px 0 30px; padding: 24px 0;
  border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink);
}
.ex-total p { margin: 0; }
.ex-emph { font-size: var(--ex-emph); font-weight: 700; color: var(--accent); }
.ex-total-row { 
  display: flex; justify-content: center; align-items: baseline; gap: 40px;
}
.ex-sub { margin: 0 !important; font-size: 32px; }
.ex-groups { display: flex; flex-direction: column; gap: 26px; }
.ex-group-head {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--ink); color: var(--ticket);
  padding: 6px 20px; font-weight: 600; font-size: 32px;
}
.ex-group-head .ex-emph { color: var(--ticket); font-size: 40px; }
.ex-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 4px 20px; border-bottom: 2px dashed var(--ink); font-size: 32px;
}
.ex-who { display: flex; align-items: center; gap: 16px; }
.ex-photo {
  display: block; flex: none;
  width: 40px; height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--ink);
}
.ex-row .ex-emph { font-size: 40px; }
