:root {
  --navy: #14215b;
  --navy-2: #1e3a8a;
  --coral: #fb7185;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg-sky: #cfe8fb;
  --accent: #e11d48;
  --card: #ffffff;
  --danger: #e11d48;
  --radius: 14px;
  --font: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo',
    'Noto Sans KR', 'Malgun Gothic', sans-serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg-sky);
  line-height: 1.5;
  word-break: keep-all;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

/* 배경 일러스트: 스크롤해도 화면에 고정 (iOS는 background-attachment: fixed 미지원이라 가상 요소 사용) */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background-color: var(--bg-sky);
  background-image: url('/img/bg.png');
  background-image: image-set(url('/img/bg.webp') type('image/webp'), url('/img/bg.png') type('image/png'));
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* ---------- Header ---------- */
.site-header__bar {
  background: rgba(255, 255, 255, 0.82);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(20, 33, 91, 0.08);
  padding-top: env(safe-area-inset-top);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 960px;
  height: 60px;
  margin: 0 auto;
  padding: 0 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--navy);
  text-decoration: none;
}

.brand__mark {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  padding: 5px;
  color: #fff;
  background: linear-gradient(135deg, var(--navy-2), var(--navy));
  border-radius: 10px;
}

.brand__text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.brand__text strong { font-size: 15px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand__text small { font-size: 12px; color: var(--muted); }

/* ---------- Card / Form ---------- */
.main {
  flex: 1 0 auto;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 32px 16px 0;
}

.card {
  background: rgba(255, 255, 255, 0.94);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  padding: 28px 22px;
  box-shadow: 0 20px 50px -20px rgba(20, 33, 91, 0.35);
}

.card__head h2 { margin: 0; font-size: 20px; font-weight: 700; }
.card__desc { margin: 4px 0 22px; color: var(--muted); font-size: 14px; }

.field {
  margin: 0 0 18px;
  padding: 0;
  border: 0;
  min-width: 0;
}

.field > label,
.field > legend {
  display: block;
  padding: 0;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 600;
}

.field__hint { color: var(--muted); font-weight: 400; }

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

input[type='text'],
input[type='number'] {
  width: 100%;
  height: 50px;
  padding: 0 14px;
  font: inherit;
  font-size: 16px; /* iOS 확대 방지 */
  color: var(--ink);
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
}

input::placeholder { color: #94a3b8; }

input:focus {
  border-color: var(--navy-2);
  box-shadow: 0 0 0 4px rgba(30, 58, 138, 0.12);
}

input[type='number']::-webkit-inner-spin-button,
input[type='number']::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type='number'] { -moz-appearance: textfield; }

.input-suffix { position: relative; }
.input-suffix input { padding-right: 36px; }
.input-suffix span {
  position: absolute; right: 14px; top: 50%;
  transform: translateY(-50%);
  color: var(--muted); font-size: 15px;
}

/* 성별 세그먼트 버튼 */
.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: 50px;
  padding: 4px;
  background: #eef1f7;
  border-radius: var(--radius);
}

.segmented input { position: absolute; opacity: 0; pointer-events: none; }

.segmented label {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.segmented input:checked + label {
  background: #fff;
  color: var(--navy);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
}

.segmented input:focus-visible + label { outline: 2px solid var(--navy-2); outline-offset: 1px; }

/* 참가자 (여러 명) */
.participant-list { display: grid; gap: 14px; }

.participant {
  padding: 16px 16px 0;
  border: 1.5px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.participant__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.participant__title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--navy);
}

.participant__remove {
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font: inherit;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}
.participant__remove:hover { color: var(--danger); border-color: #fecdd3; }

.btn-add {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  height: 50px;
  margin: 14px 0 0;
  border: 1.5px dashed #94a3b8;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.6);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--navy-2);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn-add:hover { background: #eef2ff; border-color: var(--navy-2); }
.btn-add:focus-visible { outline: 2px solid var(--navy-2); outline-offset: 2px; }
.btn-add__count { font-size: 13px; font-weight: 500; color: var(--muted); }

.btn-add[hidden],
.participant__remove[hidden] { display: none; }

/* 동의 */
.consent {
  margin: 20px 0;
  padding: 14px 16px;
  background: #f8fafc;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
}

.checkbox {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 14px;
  cursor: pointer;
}

.checkbox input {
  width: 20px; height: 20px;
  margin: 0;
  flex-shrink: 0;
  accent-color: var(--navy-2);
}

.checkbox em { font-style: normal; color: var(--coral); font-weight: 600; }

.consent__detail { margin: 8px 0 0 30px; font-size: 13px; color: var(--muted); }
.consent__detail summary { cursor: pointer; text-decoration: underline; width: fit-content; }
.consent__detail ul { margin: 8px 0 0; padding-left: 16px; }
.consent__detail li { margin-bottom: 2px; }
.consent__detail strong { color: var(--ink); font-weight: 600; margin-right: 4px; }

/* 오류 */
.field__error,
.form__error {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--danger);
  min-height: 0;
}
.field__error:empty,
.form__error:empty { display: none; }

.has-error input[type='text'],
.has-error input[type='number'],
.has-error .segmented { border-color: var(--danger); box-shadow: 0 0 0 1.5px var(--danger) inset; }
.consent.has-error { border-color: var(--danger); }

.form__error { margin: 0 0 12px; text-align: center; }

/* 버튼 */
.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 56px;
  border: 0;
  border-radius: var(--radius);
  font: inherit;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--navy-2), var(--navy));
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.15s, opacity 0.15s;
  box-shadow: 0 10px 24px -10px rgba(20, 33, 91, 0.6);
}

.btn-primary:hover { box-shadow: 0 14px 28px -10px rgba(20, 33, 91, 0.7); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:focus-visible { outline: 3px solid var(--coral); outline-offset: 2px; }
.btn-primary__arrow { transition: transform 0.15s; }
.btn-primary:hover .btn-primary__arrow { transform: translateX(3px); }
.btn-primary:disabled { opacity: 0.6; cursor: progress; }

/* 로그인 상태 확인 중에는 폼을 잠깐 숨겨 깜빡임을 막는다 */
.is-checking-session .card { visibility: hidden; }

/* ---------- 참가자 정보 요약 ---------- */
.profile {
  margin: 0 0 20px;
  padding: 14px 16px;
  background: #f8fafc;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  font-size: 14px;
}
.profile + .profile { margin-top: -10px; }
.profile__title { margin: 0 0 8px; font-size: 14px; font-weight: 700; color: var(--navy); }
.profile dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0; }
.profile dt { color: var(--muted); }
.profile dd { margin: 0; font-weight: 600; }

.btn-text {
  display: block;
  margin: 14px auto 0;
  padding: 8px;
  border: 0;
  background: none;
  font: inherit;
  font-size: 14px;
  color: var(--muted);
  text-decoration: underline;
  cursor: pointer;
}

/* ---------- Footer ---------- */
.site-footer {
  margin-top: 48px;
  padding: 28px 20px calc(28px + env(safe-area-inset-bottom));
  background: rgba(20, 33, 91, 0.92);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  line-height: 1.6;
}

.site-footer__inner {
  max-width: 960px;
  margin: 0 auto;
}

.site-footer :where(p) { margin: 0; }

.site-footer__brand {
  margin-bottom: 4px;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}

.site-footer__notice {
  margin-top: 14px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.08);
  border-left: 3px solid var(--coral);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.85);
}
.site-footer__notice strong { display: block; margin-bottom: 2px; color: #fff; }
.site-footer__notice b { color: #fff; }

.site-footer__copy {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
}

@media (min-width: 640px) {
  .card { padding: 36px 32px; }
}

/* ---------- 부스 예약 페이지 ---------- */
.main--wide { max-width: 640px; }
.main > .card + .card { margin-top: 16px; }

.card--compact { padding: 20px 22px; }
.greeting { margin: 0 0 8px; font-size: 18px; font-weight: 700; }

.registered { font-size: 14px; }
.registered summary { cursor: pointer; color: var(--navy-2); font-weight: 600; width: fit-content; }
.registered[open] summary { margin-bottom: 10px; }
.card--compact .btn-text { margin: 6px 0 0; padding: 4px 0; }

.empty { margin: 0; color: var(--muted); font-size: 14px; }
.empty[hidden] { display: none; }

.rules {
  margin: -10px 0 18px;
  padding-left: 18px;
  font-size: 13px;
  color: var(--muted);
}

/* 내 예약 현황 */
.my-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }

.my-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: #eef4ff;
  border-radius: var(--radius);
}

.my-item__time {
  flex-shrink: 0;
  padding: 4px 8px;
  border-radius: 8px;
  background: var(--navy);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.my-item__body { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.35; }
.my-item__body strong { font-size: 14px; }
.my-item__body small { font-size: 13px; color: var(--muted); }

.my-item__cancel {
  flex-shrink: 0;
  padding: 6px 12px;
  border: 1px solid #fecdd3;
  border-radius: 999px;
  background: #fff;
  font: inherit;
  font-size: 13px;
  color: var(--danger);
  cursor: pointer;
}
.my-item__cancel:hover { background: #fff1f2; }

/* 부스 목록 */
.booth-list { display: grid; gap: 10px; }

.booth {
  border: 1.5px solid var(--line);
  border-radius: 16px;
  background: #fff;
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.booth.is-open { border-color: var(--navy-2); box-shadow: 0 8px 24px -14px rgba(20, 33, 91, 0.45); }

.booth__toggle {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas: 'no name chevron' 'no status chevron';
  align-items: center;
  column-gap: 12px;
  row-gap: 2px;
  width: 100%;
  padding: 14px 14px;
  border: 0;
  background: none;
  font: inherit;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
}
.booth__toggle:focus-visible { outline: 2px solid var(--navy-2); outline-offset: -2px; border-radius: 16px; }

.booth__no {
  grid-area: no;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--navy-2), var(--navy));
  color: #fff;
  font-weight: 800;
  font-size: 15px;
}

.booth__name { grid-area: name; font-size: 15px; font-weight: 700; line-height: 1.35; }

.booth__status { grid-area: status; font-size: 13px; font-weight: 500; }
.booth__status--open { color: #047857; }
.booth__status--full { color: var(--muted); }
.booth__status--mine { color: var(--navy-2); font-weight: 700; }
.booth__status--mine::before { content: '✓ '; }

.booth__chevron {
  grid-area: chevron;
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform 0.2s;
}
.booth.is-open .booth__chevron { transform: rotate(-135deg) translate(-2px, -2px); }

.booth__panel { padding: 4px 14px 16px; border-top: 1px solid var(--line); }
.booth__label { margin: 12px 0 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.booth__done { margin: 14px 0 2px; font-size: 14px; color: var(--navy-2); }

.slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 6px;
}

.slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 8px 4px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font: inherit;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.slot:hover:not(:disabled) { border-color: var(--navy-2); }
.slot:focus-visible { outline: 2px solid var(--navy-2); outline-offset: 1px; }
.slot__time { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.slot__left { font-size: 12px; color: #047857; }

.slot:disabled { background: #f1f5f9; color: #94a3b8; cursor: not-allowed; }
.slot:disabled .slot__left { color: #94a3b8; }
.slot.is-mine { border-color: #bfdbfe; background: #eff6ff; }
.slot.is-mine .slot__left { color: var(--navy-2); font-weight: 600; }
.slot.is-selected { border-color: var(--navy); background: var(--navy); color: #fff; }
.slot.is-selected .slot__left { color: rgba(255, 255, 255, 0.8); }

/* 참가자 선택 */
.who { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line); }
.who__title { margin: 0 0 8px; font-size: 14px; font-weight: 700; }

.who__item {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 10px;
  padding: 10px 12px;
  margin-bottom: 6px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}
.who__item input { width: 20px; height: 20px; margin: 0; accent-color: var(--navy-2); }
.who__name { font-weight: 600; }
.who__reason { font-size: 12px; color: var(--muted); }
.who__item.is-disabled { background: #f8fafc; cursor: not-allowed; }
.who__item.is-disabled .who__name { color: #94a3b8; }

.booth__reserve { margin-top: 10px; height: 52px; font-size: 16px; }

/* 토스트 */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 50;
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  border-radius: 12px;
  background: var(--navy);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 10px 30px -10px rgba(15, 23, 42, 0.5);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 0.2s, transform 0.2s;
}
.toast[data-kind='error'] { background: var(--danger); }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 운영자 페이지 ---------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.header-actions { display: flex; gap: 6px; flex-shrink: 0; }

.header-action {
  flex-shrink: 0;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
  cursor: pointer;
}
.header-action:hover { background: #f1f5f9; }
.header-action[hidden] { display: none; }

#login-view[hidden],
#dashboard[hidden],
#overview-view[hidden],
#booth-view[hidden] { display: none; }

#dashboard > .card + .card { margin-top: 16px; }

.op-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
}
.op-toolbar__select { flex: 1 1 260px; }
.op-toolbar__select select {
  height: 46px;
  width: 100%;
  padding: 0 40px 0 14px;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  color: var(--navy);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1.5l5 5 5-5' stroke='%2364748b' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 16px center;
  appearance: none;
}
.op-toolbar__meta { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.op-updated { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.op-refresh {
  padding: 8px 14px;
  border: 0;
  border-radius: 999px;
  background: var(--navy);
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

/* 전체 현황 */
.op-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}
.op-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 6px;
  border-radius: var(--radius);
  background: #eef4ff;
}
.op-stat strong { font-size: 22px; font-weight: 800; color: var(--navy); font-variant-numeric: tabular-nums; }
.op-stat span { font-size: 12px; color: var(--muted); }

.op-booths { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }

.op-booth {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: #fff;
  font: inherit;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
}
.op-booth:hover { border-color: var(--navy-2); }
.op-booth .booth__no { flex-shrink: 0; }
.op-booth__body { display: flex; flex-direction: column; gap: 5px; flex: 1; min-width: 0; }
.op-booth__name { font-size: 15px; font-weight: 700; }
.op-booth__meta { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.op-booth__chevron { flex-shrink: 0; transform: rotate(-45deg); }

.op-bar { display: block; height: 6px; border-radius: 999px; background: #e2e8f0; overflow: hidden; }
.op-bar__fill { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--navy-2), #3b82f6); }

/* 부스별 명단 */
.op-filter { margin: -8px 0 14px; }

.op-slots { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }

.op-slot {
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: #fff;
}
.op-slot.is-now { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(225, 29, 72, 0.12); }

.op-slot__head { display: flex; align-items: center; gap: 8px; }
.op-slot__time { font-size: 16px; font-weight: 800; color: var(--navy); font-variant-numeric: tabular-nums; }
.op-slot__badge {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}
.op-slot__count { margin-left: auto; font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.op-slot.is-full .op-slot__count { color: var(--accent); }
.op-slot__empty { margin: 6px 0 0; font-size: 13px; color: #94a3b8; }

.op-people { margin: 10px 0 0; padding-left: 22px; display: grid; gap: 6px; }
.op-people li { font-size: 14px; }
.op-people li::marker { color: var(--muted); font-variant-numeric: tabular-nums; }
.op-people__name { font-weight: 700; margin-right: 8px; }
.op-people__info { color: var(--muted); font-size: 13px; }
.op-people__family {
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 6px;
  background: #fef3c7;
  color: #92400e;
  font-size: 11px;
  font-weight: 600;
}
