*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--on-dark);
  background: var(--espresso);
  min-height: 100vh; min-height: 100dvh;
  line-height: 1.55;
  overflow-x: hidden;
}
/* 힉스필드 생성 배경 — 모바일은 세로 와인바 벽(램프), 넓은 화면은 바 전경 */
body::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    linear-gradient(180deg, rgba(26,19,16,0) 0%, rgba(26,19,16,.25) 55%, rgba(21,15,12,.6) 100%),
    url('../assets/bg-mobile.webp') center top / cover no-repeat,
    linear-gradient(180deg, #2A1E17 0%, var(--espresso) 45%, #150F0C 100%);
}
@media (min-width: 761px) {
  body::before {
    background:
      radial-gradient(ellipse 60% 70% at 50% 45%, rgba(21,15,12,.82), rgba(21,15,12,.6) 70%, rgba(21,15,12,.75)),
      url('../assets/stage-bg.webp') center / cover no-repeat,
      var(--espresso);
  }
}
img { max-width: 100%; display: block; }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }
::selection { background: var(--brass); color: var(--espresso); }

.app { min-height: 100vh; min-height: 100dvh; }
.page {
  max-width: 460px;
  margin: 0 auto;
  /* 노치·홈 인디케이터(가로 모드 포함)에 가리지 않게 */
  padding: calc(28px + env(safe-area-inset-top)) max(22px, env(safe-area-inset-right)) calc(36px + env(safe-area-inset-bottom)) max(22px, env(safe-area-inset-left));
  min-height: 100vh; min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
.page-center { justify-content: center; }
@media (min-width: 700px) and (min-height: 900px) { .page { max-width: 520px; } }

/* ---- 타이포 ---- */
.eyebrow {
  font-family: var(--font-display); font-style: italic; font-weight: 500;
  font-size: 17px; letter-spacing: .08em; color: var(--brass-2);
}
h1.title {
  font-family: var(--font-serif-kr); font-weight: 700; font-size: 32px; line-height: 1.2;
  margin: 6px 0 6px; letter-spacing: -0.01em; color: var(--on-dark); text-wrap: balance;
}
.subtitle { color: var(--on-dark-2); margin: 0; font-size: 14px; letter-spacing: .02em; }
.rule { height: 30px; margin: 14px 0; font-size: 0; background: url('../assets/ornament.webp') center / contain no-repeat; filter: drop-shadow(0 2px 6px rgba(0,0,0,.5)); }

/* ---- 버튼 ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 56px; padding: 14px 22px;
  border: 0; border-radius: 999px; cursor: pointer;
  font-size: 16px; font-weight: 700; letter-spacing: .01em;
  transition: transform .15s ease, box-shadow .2s ease, opacity .2s, filter .2s;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation; text-decoration: none;
}
.btn:active { transform: translateY(1px) scale(.995); filter: brightness(.92); }
/* 힉스필드 생성 버튼 스킨 — 양 끝 캡은 고정, 가운데만 늘어나는 3-슬라이스 */
.btn-primary, .btn-secondary, .btn-wine {
  border: 0 solid transparent;
  border-image-slice: 0 88 fill; border-image-width: 0 calc(var(--btn-h, 56px) * .524); border-image-repeat: stretch;
}
.btn-primary { border-image-source: url('../assets/btn-brass.webp'); }
.btn-secondary { border-image-source: url('../assets/btn-walnut.webp'); }
.btn-wine { border-image-source: url('../assets/btn-wine.webp'); }
@media (hover: hover) { .btn-primary:hover, .btn-secondary:hover, .btn-wine:hover { filter: brightness(1.08); } }
.btn:disabled, .btn.disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn .ico { width: 20px; height: 20px; flex: none; }
.btn-primary {
  background: linear-gradient(180deg, var(--brass-2), var(--brass) 55%, #B58E3E);
  color: #2A1C0C; text-shadow: 0 1px 0 rgba(255,236,180,.45);
  box-shadow: 0 10px 28px rgba(0,0,0,.45), 0 0 34px rgba(201,162,77,.22);
}
.btn-secondary {
  background: linear-gradient(180deg, #5A3A26, #3A2417); color: var(--cream); text-shadow: 0 1px 2px rgba(0,0,0,.6);
  box-shadow: 0 10px 28px rgba(0,0,0,.45);
}
.btn-wine { background: linear-gradient(180deg, var(--wine-2), var(--wine)); color: var(--cream); text-shadow: 0 1px 2px rgba(0,0,0,.5); box-shadow: 0 10px 28px rgba(0,0,0,.45); }
.btn-ghost { background: transparent; color: var(--on-dark-2); min-height: 44px; font-weight: 600; box-shadow: none; }
.btn-ghost:hover { color: var(--on-dark); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { --btn-h: 40px; min-height: 40px; padding: 8px 18px; font-size: 13px; width: auto; }
.btn-stack { display: grid; gap: 12px; }

/* 크림 카드 안에서의 버튼 */
.card .btn-primary, .card .btn-secondary, .card .btn-wine { box-shadow: 0 8px 18px rgba(36,26,21,.28); }
.card .btn-ghost { color: var(--ink-2); }

.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(0,0,0,.2); border-top-color: currentColor;
  animation: spin .8s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- 카드(메뉴판 같은 크림 종이) / 폼 ---- */
.card {
  background: var(--cream) url('../assets/tex-paper.webp') center / 384px; color: var(--ink);
  border-radius: var(--radius); padding: 22px 20px;
  box-shadow: var(--shadow-soft), inset 0 0 0 1px rgba(201,162,77,.35);
  position: relative;
}
.card::before {
  content: ''; position: absolute; inset: 7px; border-radius: calc(var(--radius) - 6px);
  border: 1px solid rgba(201,162,77,.45); pointer-events: none;
}
.card > * { position: relative; }
.card .subtitle { color: var(--ink-2); }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-weight: 700; font-size: 13px; color: var(--ink); letter-spacing: .02em; }
.field label .req { color: var(--wine-2); margin-left: 2px; }
.field label .opt { color: var(--muted); font-weight: 500; font-size: 12px; margin-left: 6px; }
.field .hint { font-size: 12px; color: var(--muted); margin: 0; }
.field .error { font-size: 12px; color: var(--danger); margin: 0; display: none; }
.field.invalid .error { display: block; }
.field.invalid .input { border-color: var(--danger); }
.input {
  width: 100%; min-height: 50px; padding: 12px 14px;
  border: 1px solid var(--line-cream); border-radius: 12px; background: #FBF7EE; color: var(--ink);
  font-size: 16px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: #B5A692; }
.input:focus { border-color: var(--brass); box-shadow: 0 0 0 3px rgba(201,162,77,.22); }
.input-prefix { position: relative; }
.input-prefix .prefix { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 700; }
.input-prefix .input { padding-left: 32px; }
.hp { position: absolute; left: -9999px; opacity: 0; height: 0; width: 0; }

.notice {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--wine); color: var(--cream);
  border-radius: 12px; padding: 12px 14px; font-size: 13.5px; font-weight: 600; line-height: 1.5;
  box-shadow: inset 0 0 0 1px rgba(201,162,77,.5);
}
.notice .ico { width: 18px; height: 18px; flex: none; margin-top: 2px; color: var(--brass-2); }
.consent { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--ink-2); margin: 14px 0 18px; }
.consent input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--wine); flex: none; }
.consent details { margin-top: 4px; }
.consent summary { cursor: pointer; color: var(--brass-3); font-weight: 600; }
.consent ul { margin: 6px 0 0; padding-left: 16px; }

.topbar { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; color: var(--on-dark); }
.back { background: none; border: 0; color: var(--on-dark); padding: 6px 8px 6px 0; cursor: pointer; display: inline-flex; }
.back svg { width: 22px; height: 22px; }
.topbar .title-sm { font-family: var(--font-serif-kr); font-weight: 700; font-size: 17px; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; font-size: 11.5px; font-weight: 700; letter-spacing: .04em; }
.badge-open { background: rgba(111,165,124,.18); color: #9ED0AA; box-shadow: inset 0 0 0 1px rgba(111,165,124,.45); }
.badge-closed { background: rgba(200,72,78,.18); color: #F0A0A4; box-shadow: inset 0 0 0 1px rgba(200,72,78,.45); }
.badge-brass { background: rgba(201,162,77,.16); color: var(--brass-2); box-shadow: inset 0 0 0 1px rgba(201,162,77,.45); }
.badge-wine { background: rgba(142,53,68,.2); color: #F1B7C0; box-shadow: inset 0 0 0 1px rgba(142,53,68,.5); }
.badge-gray { background: rgba(243,235,221,.08); color: var(--on-dark-2); box-shadow: inset 0 0 0 1px var(--line-dark); }
.card .badge-open { background: rgba(111,165,124,.15); color: #3E7A4E; }
.card .badge-closed { background: rgba(200,72,78,.12); color: #A93A3F; }
.card .badge-gray { background: rgba(36,26,21,.06); color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line-cream); }

/* ---- 랜딩 ---- */
.p-landing .page { padding-top: max(calc(28px + env(safe-area-inset-top)), 13vh); padding-top: max(calc(28px + env(safe-area-inset-top)), 13dvh); }
.hero { text-align: center; margin-bottom: 8px; }
.mirror {
  position: relative; width: min(74%, 270px, 33vh); aspect-ratio: 3 / 4; margin: 0 auto 22px; border-radius: 50%; overflow: hidden;
  background: #0E0A08;
  box-shadow: 0 0 0 7px #17110E, 0 0 0 8.5px var(--brass), 0 0 0 9.5px #17110E, 0 30px 60px rgba(0,0,0,.55), var(--glow-amber);
}
.mirror img { width: 100%; height: 100%; object-fit: cover; }
.mirror::after { content: ''; position: absolute; inset: 0; border-radius: 50%; box-shadow: inset 0 0 40px rgba(0,0,0,.45), inset 0 0 0 1px rgba(201,162,77,.35); pointer-events: none; }
.mirror .emoji-fallback { width: 100%; height: 100%; display: grid; place-items: center; font-size: 96px; }
/* 세로가 짧은 화면(아이폰 SE · 소형 갤럭시 · 가로 아이패드): 한 화면에 들어오게 촘촘히 */
@media (max-height: 940px) {
  .p-landing .page { padding-top: max(calc(20px + env(safe-area-inset-top)), 8vh); padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
  .mirror { width: min(74%, 270px, 25vh); margin-bottom: 14px; }
  .p-landing .rule { margin: 8px 0; }
  .p-landing h1.title { font-size: 28px; }
  .p-landing .foot { padding-top: 12px; }
  .p-landing .landing-count { margin-top: 10px; }
}
.landing-count { text-align: center; color: var(--on-dark-2); font-size: 13px; margin-top: 18px; }
.landing-count b { color: var(--brass-2); font-weight: 700; }
.my-ticket-link { margin-top: 12px; text-align: center; }
.foot { margin-top: auto; padding-top: 28px; text-align: center; color: var(--on-dark-3); font-size: 12px; font-family: var(--font-display); font-style: italic; letter-spacing: .06em; }

/* ---- 티켓 ---- */
.ticket-wrap { display: flex; justify-content: center; margin: 12px 0 20px; }
.ticket {
  position: relative; width: min(320px, 100%); background: var(--cream) url('../assets/tex-paper.webp') center / 384px; color: var(--ink);
  border-radius: 18px; overflow: hidden;
  box-shadow: 0 30px 60px rgba(0,0,0,.5), 0 0 0 1px rgba(201,162,77,.6);
  font-family: var(--font-body);
}
.ticket::before {
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background: radial-gradient(circle at 20% 10%, rgba(255,255,255,.5), transparent 40%), repeating-linear-gradient(0deg, rgba(0,0,0,.012) 0 2px, transparent 2px 4px);
}
.ticket-top {
  position: relative; background: var(--wine); color: var(--cream); padding: 18px 20px 16px;
  background-image: radial-gradient(ellipse at 90% 10%, rgba(241,180,98,.25), transparent 45%);
  box-shadow: inset 0 -1px 0 rgba(201,162,77,.6);
}
.ticket-top .ev-name { font-family: var(--font-display); font-style: italic; font-size: 15px; letter-spacing: .1em; color: var(--brass-2); }
.ticket-top .ev-title { font-family: var(--font-serif-kr); font-size: 21px; font-weight: 700; margin-top: 2px; letter-spacing: -0.01em; }
.ticket-top .mascot { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); width: 62px; height: 62px; border-radius: 50%; overflow: hidden; background: #150F0C; box-shadow: 0 0 0 2px var(--brass), 0 0 0 4px #150F0C; }
.ticket-top .mascot img { width: 100%; height: 100%; object-fit: cover; }
.ticket-top .mascot .emoji-fallback { display: grid; place-items: center; width: 100%; height: 100%; font-size: 30px; }
.ticket-perf { position: relative; height: 0; border-top: 1.5px dashed var(--brass-3); margin: 0 16px; opacity: .8; }
.ticket-perf::before, .ticket-perf::after {
  content: ''; position: absolute; top: -12px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--espresso); box-shadow: inset 0 0 0 1px rgba(201,162,77,.5);
}
.ticket-perf::before { left: -28px; } .ticket-perf::after { right: -28px; }
.ticket-body { position: relative; padding: 18px 20px 14px; text-align: center; }
.ticket-body .label { font-family: var(--font-display); font-style: italic; font-size: 14px; letter-spacing: .12em; color: var(--brass-3); }
.ticket-oval {
  margin: 8px auto 10px; width: 210px; height: 120px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(ellipse at 50% 35%, #2B1F19, #120D0A 75%);
  box-shadow: 0 0 0 3px #1A1310, 0 0 0 4.5px var(--brass), inset 0 0 30px rgba(0,0,0,.6), 0 10px 24px rgba(0,0,0,.25);
}
.ticket-oval { max-width: 78%; }
.ticket-body .no { font-family: var(--font-display); font-weight: 700; font-size: 64px; line-height: 1; letter-spacing: .02em; color: var(--cream); font-variant-numeric: tabular-nums; text-shadow: 0 0 24px rgba(241,180,98,.35); }
.ticket-body .no small { font-size: 20px; color: var(--brass-2); vertical-align: 16px; margin-right: 4px; font-style: italic; font-weight: 600; }
.ticket-meta { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line-cream); padding-top: 12px; margin-top: 6px; text-align: left; }
.ticket-meta b { display: block; color: var(--ink); font-size: 15px; font-weight: 700; margin-top: 1px; }
.ticket-meta .r { text-align: right; }
.ticket-foot { position: relative; background: var(--cream-2); padding: 9px 20px; font-size: 11.5px; color: var(--ink-2); text-align: center; font-weight: 600; line-height: 1.4; }
.ticket-foot .issued { font-size: 10px; color: var(--muted); font-weight: 500; }
.ticket-won { position: absolute; top: 16px; left: -44px; background: var(--brass); color: var(--espresso); font-weight: 800; padding: 5px 50px; transform: rotate(-25deg); font-size: 12px; z-index: 3; letter-spacing: .1em; }
.ticket-actions { display: grid; gap: 12px; }
.ticket-note { text-align: center; font-size: 13px; color: var(--on-dark-2); margin: 0 0 14px; }
.ticket-note b { color: var(--brass-2); font-weight: 700; }
.img-modal { position: fixed; inset: 0; background: rgba(14,10,8,.9); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; z-index: 50; gap: 14px; }
.img-modal img { max-height: 70vh; border-radius: 16px; }
.img-modal p { color: var(--cream); font-weight: 600; text-align: center; margin: 0; }

.result-head { text-align: center; margin-bottom: 6px; }
.result-head .big { font-family: var(--font-serif-kr); font-size: 24px; font-weight: 700; margin: 4px 0 4px; color: var(--on-dark); }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  background: var(--cream) url('../assets/tex-paper.webp') center / 384px; color: var(--ink); padding: 12px 18px; border-radius: 12px; font-size: 14px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: .2s; z-index: 100; max-width: calc(100% - 40px); text-align: center;
  box-shadow: 0 12px 30px rgba(0,0,0,.4), inset 0 0 0 1px rgba(201,162,77,.5);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); color: #fff; box-shadow: 0 12px 30px rgba(0,0,0,.4); }
.toast.success { background: var(--olive); color: #fff; box-shadow: 0 12px 30px rgba(0,0,0,.4); }

.img-wrap img { width: 100%; height: auto; }
.emoji-fallback { display: inline-block; }

