/* Pretendard를 함께 넣어 와이파이 없이도 같은 글꼴로 보이게 한다 (SIL OFL) */
@font-face {
  font-family: "Pretendard";
  src: url("../vendor/fonts/PretendardVariable.woff2") format("woff2-variations");
  font-weight: 45 920;
  font-display: swap;
}

:root {
  --white: #ffffff;
  --gray50: #f9fafb;
  --gray100: #f2f4f6;
  --gray200: #e5e8eb;
  --gray300: #d1d6db;
  --gray400: #b0b8c1;
  --gray500: #8b95a1;
  --gray600: #6b7684;
  --gray700: #4e5968;
  --gray900: #191f28;
  --blue: #3182f6;
  --blue-press: #1b64da;
  --blue-soft: #e8f3ff;
  --red: #f04452;
  --red-soft: #ffeeee;
  --orange: #e5600a;
  --orange-soft: #fff3e6;
  --seat-w: 64px;
  --seat-h: 48px;
  --gap: 6px;
  font-family: "Pretendard", system-ui, "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  letter-spacing: -0.01em;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--white); color: var(--gray900); }
/* 두 번 탭해서 확대되지 않게 한다 */
html { touch-action: manipulation; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { -webkit-tap-highlight-color: transparent; user-select: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
h1, h2, h3 { letter-spacing: -0.02em; }

/* 상단 */
.topbar { height: 60px; display: flex; align-items: center; justify-content: space-between; padding: 0 32px; }
.topbar__title { font-size: 17px; font-weight: 600; color: var(--gray600); }
.topbar__right { display: flex; gap: 14px; align-items: center; }
.topbar__clock { font-size: 17px; font-weight: 600; color: var(--gray600); font-variant-numeric: tabular-nums; }
.topbar a.btn { text-decoration: none; }

/* 화면 */
.screen { display: none; height: calc(100% - 60px); }
.screen.is-active { display: flex; }

/* 버튼 */
.btn {
  height: 56px; padding: 0 24px; border-radius: 16px; font-size: 18px; font-weight: 600;
  background: var(--gray100); color: var(--gray700); display: inline-flex; align-items: center; justify-content: center;
  transition: background .12s, transform .12s;
}
.btn:active { transform: scale(.98); background: var(--gray200); }
.btn--primary { background: var(--blue); color: var(--white); }
.btn--primary:active { background: var(--blue-press); }
.btn--danger { background: var(--red-soft); color: var(--red); }
.btn--small { height: 40px; padding: 0 14px; border-radius: 10px; font-size: 15px; }
.btn--text { background: none; color: var(--gray600); height: 44px; font-size: 16px; font-weight: 500; }
.btn--text:active { background: var(--gray100); }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }
.btn-col { display: flex; flex-direction: column; gap: 10px; }
.btn:disabled { opacity: .45; pointer-events: none; }

/* 대기 */
.idle { padding: 8px 32px 32px; gap: 48px; }
.idle__main { flex: 1.1; display: flex; flex-direction: column; justify-content: center; gap: 28px; padding-left: 16px; }
.idle__main h1 { margin: 0; font-size: 44px; line-height: 1.3; font-weight: 700; }
.idle__main p { margin: 0; font-size: 20px; color: var(--gray600); line-height: 1.5; }
.idle__main .notice { font-size: 18px; font-weight: 600; color: var(--blue-press); background: var(--blue-soft); padding: 14px 18px; border-radius: 16px; align-self: flex-start; }
.idle__acts { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.idle__acts .btn--text { height: 48px; padding: 0 8px; font-size: 18px; color: var(--gray600); }
.idle.is-away .idle__main h1 { color: var(--blue-press); }
.reasons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; margin-top: 24px; }
.reasons .btn { width: 100%; }
.reasons .btn:only-child { grid-column: 1 / -1; }
.idle__main .btn--primary { align-self: flex-start; height: 64px; padding: 0 36px; font-size: 20px; border-radius: 18px; }
.idle__side { flex: 1; display: flex; flex-direction: column; gap: 12px; background: var(--gray50); border-radius: 28px; padding: 24px; }
.idle__side-title { font-size: 17px; font-weight: 600; color: var(--gray600); padding: 4px 6px 0; }
.idbox { height: 76px; display: flex; align-items: center; justify-content: center; font-size: 38px; font-weight: 700; letter-spacing: 8px; font-variant-numeric: tabular-nums; color: var(--gray900); }
.idbox.is-empty { color: var(--gray400); font-size: 24px; font-weight: 500; letter-spacing: 0; }
.numpad { flex: 1; display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: 1fr; gap: 8px; }
.numpad button { min-height: 52px; border-radius: 16px; font-size: 28px; font-weight: 600; color: var(--gray900); }
.numpad button:active { background: var(--gray200); }
.numpad .key-del { font-size: 18px; color: var(--gray600); }
.numpad .key-ok { background: var(--blue); color: var(--white); font-size: 20px; }
.numpad .key-ok:disabled { background: var(--gray200); color: var(--gray400); }

/* 바코드 찍기 */
.scan { flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 24px; background: #101114; }
.scan h2 { margin: 0; color: var(--white); font-size: 28px; font-weight: 700; }
.scan__view { position: relative; width: min(820px, 92%); aspect-ratio: 16 / 7; border-radius: 24px; overflow: hidden; background: #000; }
.scan__view video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan__view.is-mirror video { transform: scaleX(-1); }
.scan__view.is-error video { visibility: hidden; }
.scan__frame { position: absolute; left: 12%; right: 12%; top: 20%; bottom: 20%; border: 3px solid rgba(255,255,255,.95); border-radius: 16px; }
.scan__view.is-error .scan__frame { display: none; }
.scan__msg { margin: 0; color: #c9cdd2; font-size: 18px; text-align: center; max-width: 640px; line-height: 1.5; min-height: 27px; }
.scan .btn-row { width: min(520px, 92%); }
.scan .btn { background: #26282c; color: var(--white); }
.scan .btn:active { background: #33363b; }

/* 가운데 화면 (확인, 완료, 반납) */
.center { flex-direction: column; align-items: center; justify-content: center; padding: 32px; text-align: center; }
.center__inner { width: min(520px, 100%); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.center h2 { margin: 0; font-size: 34px; font-weight: 700; line-height: 1.35; }
.center p { margin: 0; font-size: 19px; color: var(--gray600); line-height: 1.5; }
.center .btn-row, .center .btn-col { width: 100%; margin-top: 28px; }
.btn-col .btn { width: 100%; }
.center .btn--text { margin-top: 6px; }

.check { width: 72px; height: 72px; border-radius: 50%; background: var(--blue); position: relative; margin-bottom: 12px; }
.check::after { content: ""; position: absolute; left: 25px; top: 18px; width: 18px; height: 30px; border: solid var(--white); border-width: 0 6px 6px 0; transform: rotate(45deg); }
.done__qr { display: flex; align-items: center; gap: 18px; margin-top: 22px; padding: 16px 20px; background: var(--gray50); border-radius: 20px; text-align: left; }
.done__qr p { font-size: 17px; }
.qr svg { display: block; width: 112px; height: 112px; }
.countdown { font-size: 15px; color: var(--gray500); margin-top: 14px; font-variant-numeric: tabular-nums; }

/* 자리 고르기 */
.pick { flex-direction: column; padding: 4px 32px 24px; gap: 12px; }
.pick__head { display: flex; justify-content: space-between; align-items: flex-end; }
.pick__head h2 { margin: 0; font-size: 30px; font-weight: 700; }
.pick__head p { margin: 6px 0 0; font-size: 17px; color: var(--gray600); }
.pick__body { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; }

/* 좌석 배치도 */
.seatmap { display: flex; flex-direction: column; gap: 18px; align-items: flex-start; }
.seat-block { display: flex; flex-direction: column; gap: var(--gap); }
.seat-row { display: flex; gap: var(--gap); align-items: center; }
.seat {
  width: var(--seat-w); height: var(--seat-h); border-radius: 10px; background: var(--gray100); color: var(--gray700);
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0; line-height: 1.15;
}
.seat__no { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.seat__name { font-size: 12px; margin-top: 2px; white-space: nowrap; }
.seat--taken { background: var(--white); color: var(--gray300); box-shadow: inset 0 0 0 1px var(--gray200); }
.seat--mine { background: var(--blue); color: var(--white); box-shadow: none; }
.seat--pillar { background: var(--gray200); color: var(--gray500); font-size: 13px; font-weight: 500; }
.seat__tag { font-size: 11px; font-weight: 600; margin-top: 1px; }
.seat--closed { background: repeating-linear-gradient(135deg, var(--gray100) 0 6px, var(--gray50) 6px 12px); color: var(--gray400); }
.seat--out { background: var(--orange-soft); color: var(--orange); box-shadow: none; }
.seatmap--pick .seat--reserved:not(button) { background: var(--gray50); color: var(--gray300); }
.seat--yours { background: var(--blue-soft); color: var(--blue); box-shadow: inset 0 0 0 2px var(--blue); }
.seat--gap { visibility: hidden; }
.seat-row__label { width: 26px; text-align: center; font-size: 13px; color: var(--gray400); font-variant-numeric: tabular-nums; }
.seatmap__door { align-self: flex-end; font-size: 13px; color: var(--gray500); padding: 2px 30px 0 0; }
.seatmap__door::before { content: ""; display: inline-block; width: 22px; height: 3px; border-radius: 2px; background: var(--gray400); vertical-align: middle; margin-right: 6px; }
.seatmap--pick button.seat--free:active { background: var(--blue-soft); color: var(--blue); }

/* 바텀 시트 */
.sheet-wrap { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: none; align-items: flex-end; justify-content: center; z-index: 20; }
.sheet-wrap.is-open { display: flex; }
.sheet { width: min(560px, 100%); background: var(--white); border-radius: 28px 28px 0 0; padding: 32px 28px 28px; display: flex; flex-direction: column; gap: 8px; animation: up .18s ease-out; }
.sheet h3 { margin: 0; font-size: 26px; font-weight: 700; }
.sheet p { margin: 0; font-size: 17px; color: var(--gray600); }
.sheet .btn-row { margin-top: 22px; }
@keyframes up { from { transform: translateY(30px); opacity: .5; } to { transform: none; opacity: 1; } }

/* 토스트 */
.toast {
  position: fixed; left: 50%; bottom: 36px; transform: translateX(-50%) translateY(16px);
  background: rgba(25,31,40,.92); color: var(--white); padding: 14px 22px; border-radius: 14px; font-size: 17px; font-weight: 500;
  opacity: 0; transition: .2s; z-index: 30; pointer-events: none; white-space: nowrap;
}
.toast.is-show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (orientation: portrait) {
  .idle { flex-direction: column; gap: 24px; }
  .idle__main { padding: 24px 8px 0; }
  .idle__main h1 { font-size: 36px; }
}
@media (max-height: 760px) { :root { --seat-h: 44px; } .seatmap { gap: 14px; } }
@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } .btn { transition: none; } }
