/* FINISH IN GLORY — trang check-in (mobile-first) */
:root {
  --green-900: #031a12;
  --green-800: #05241a;
  --green-700: #0b3b2c;
  --green-600: #11513c;
  --gold-100: #fbefc9;
  --gold-200: #f3dca0;
  --gold-300: #e6c682;
  --gold-400: #d9b46a;
  --gold-500: #b88e45;
  --gold-700: #7a5a24;
  --ink: #f6f1e3;
  --ink-2: #cfd9d2;
  --ink-3: #9db3a7;
  --gold-grad: linear-gradient(180deg, #fbe9b7 0%, #e9c983 38%, #c99b4f 72%, #a77a35 100%);
  --gold-line: linear-gradient(90deg, rgba(217,180,106,0) 0%, rgba(243,220,160,.95) 50%, rgba(217,180,106,0) 100%);
  --serif: "Cormorant Garamond", "Playfair Display", Georgia, "Times New Roman", serif;
  --sans: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --radius: 20px;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--green-800);
  line-height: 1.45;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
img { max-width: 100%; }
b { font-weight: 700; }

/* ---------- Nền ---------- */
.gl-backdrop, .gl-bg, .gl-pillar { position: fixed; pointer-events: none; z-index: 0; }
.gl-backdrop { display: none; }
.gl-pillar { display: none; }
.gl-bg {
  inset: 0;
  height: 100vh; height: 100lvh;
  background:
    linear-gradient(180deg, rgba(3,26,18,.55) 0%, rgba(3,26,18,.18) 30%, rgba(3,26,18,.12) 55%, rgba(3,26,18,.55) 100%),
    url("/glory/bg-mobile.jpg?v=20261021a") center bottom / cover no-repeat,
    var(--green-800);
}
.gl-poster { display: none; }

/* ---------- Khung ứng dụng ---------- */
.gl-app {
  position: relative; z-index: 1;
  width: 100%; max-width: 460px;
  margin: 0 auto;
  min-height: 100vh; min-height: 100svh;
  padding: calc(14px + var(--sat)) 16px calc(16px + var(--sab));
  display: flex; flex-direction: column;
}
.gl-stage { position: relative; isolation: isolate; text-align: center; }
.gl-side { display: flex; flex-direction: column; flex: 1; }

.gl-top { display: flex; justify-content: center; padding: 0 0 8px; }
.gl-logos { width: 168px; height: auto; display: block; filter: drop-shadow(0 2px 6px rgba(0,0,0,.35)); }

/* ---------- Hero ---------- */
.gl-hero { text-align: center; }
.gl-invite {
  margin: 0; font-family: var(--serif); font-style: italic; font-weight: 500;
  font-size: 15px; letter-spacing: .02em; color: var(--ink-2);
}
.gl-guest {
  margin: 2px 0 2px; font-family: var(--serif); font-weight: 700;
  font-size: 17px; line-height: 1.15; letter-spacing: .06em; text-transform: uppercase;
  background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 1px 0 rgba(0,0,0,.35));
}
.gl-rule { position: relative; height: 12px; margin: 8px auto 2px; width: 72%; max-width: 300px; }
.gl-rule::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--gold-line); }
.gl-rule i {
  position: absolute; left: 50%; top: 50%; width: 8px; height: 8px;
  transform: translate(-50%, -50%) rotate(45deg);
  background: var(--gold-grad); box-shadow: 0 0 10px rgba(243,220,160,.8);
  outline: 1px solid rgba(243,220,160,.55); outline-offset: 3px;
}
.gl-title { margin: 0 -6px; line-height: 0; }
.gl-title img { width: 100%; max-width: 400px; height: auto; display: inline-block; }
.gl-subtitle {
  margin: 4px 0 0; font-weight: 700; font-size: 11.5px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--ink);
  text-shadow: 0 1px 8px rgba(0,0,0,.6);
}
.gl-subtitle::after {
  content: ""; display: block; height: 1px; width: 82%; margin: 7px auto 0; background: var(--gold-line); opacity: .7;
}

.gl-info {
  list-style: none; margin: 10px 0 0; padding: 0;
  display: grid; grid-template-columns: 1.5fr 1fr 0.85fr; gap: 5px;
}
.gl-info li {
  display: flex; align-items: center; gap: 6px; min-width: 0;
  padding: 7px 6px; border-radius: 12px; text-align: left;
  background: rgba(3, 26, 18, .55);
  border: 1px solid rgba(217, 180, 106, .32);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.gl-info svg { flex: none; width: 17px; height: 17px; fill: var(--gold-300); }
.gl-info span { font-size: 10.5px; line-height: 1.25; color: var(--ink-2); min-width: 0; }
.gl-info b { display: block; font-size: 11px; letter-spacing: -.005em; color: var(--gold-100); font-weight: 700; }
.gl-audience { text-wrap: balance; margin: 8px 4px 0; font-size: 11px; line-height: 1.4; color: var(--ink-3); }
.gl-audience b { color: var(--ink); font-weight: 600; }

/* ---------- Thẻ (card) ---------- */
.gl-card {
  position: relative;
  margin-top: 14px;
  padding: 16px 16px 16px;
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(17, 81, 60, .62) 0%, rgba(5, 36, 26, .82) 100%);
  border: 1px solid rgba(217, 180, 106, .55);
  box-shadow:
    0 0 0 1px rgba(0,0,0,.25),
    inset 0 1px 0 rgba(251, 239, 201, .18),
    0 18px 40px -12px rgba(0,0,0,.65),
    0 0 36px -10px rgba(217, 180, 106, .35);
  -webkit-backdrop-filter: blur(14px) saturate(120%); backdrop-filter: blur(14px) saturate(120%);
  text-align: left;
}
.gl-card::before { /* viền sáng mảnh phía trên */
  content: ""; position: absolute; left: 18%; right: 18%; top: -1px; height: 1px; background: var(--gold-line);
}
.gl-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; min-width: 0; }
.gl-kicker {
  flex: none; font-family: var(--serif); font-weight: 700; font-size: 21px; line-height: 1;
  background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.gl-event {
  min-width: 0; font-size: 11px; font-weight: 500; letter-spacing: .04em; color: var(--ink-3);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.35;
  padding-left: 8px; align-self: center; border-left: 1px solid rgba(217,180,106,.4);
}
.gl-step {
  margin: 0 0 2px; font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--gold-300);
}
.gl-card-title {
  margin: 0 0 6px; font-family: var(--serif); font-weight: 700; font-size: 25px; line-height: 1.15; color: var(--gold-100);
}
.gl-card-sub { margin: 0 0 10px; font-size: 14px; color: var(--ink-2); }
.gl-label { display: block; margin: 0 0 7px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.gl-label b { color: var(--gold-300); }
.hello { margin: 0 0 12px; font-size: 14.5px; color: var(--ink-2); }
.hello b { color: var(--gold-100); }
.center { text-align: center; }
.small { font-size: 12px; color: var(--ink-3); }

.gl-field {
  position: relative; display: flex; align-items: center;
  border-radius: 14px;
  background: rgba(2, 18, 12, .62);
  border: 1px solid rgba(217, 180, 106, .45);
  transition: border-color .2s, box-shadow .2s;
}
.gl-field:focus-within { border-color: var(--gold-200); box-shadow: 0 0 0 3px rgba(243, 220, 160, .22); }
.gl-field svg { position: absolute; left: 14px; width: 21px; height: 21px; fill: var(--gold-300); pointer-events: none; }
.gl-field input {
  width: 100%; height: 52px; padding: 0 14px 0 46px;
  border: 0; outline: 0; background: transparent; color: var(--ink);
  font: 600 17px/1 var(--sans); letter-spacing: .08em;
}
.gl-field input::placeholder { color: #7f978a; font-weight: 400; letter-spacing: 0; font-size: 16px; }

.gl-consent {
  display: flex; gap: 10px; align-items: flex-start; margin: 12px 0 14px;
  font-size: 12.5px; line-height: 1.45; color: var(--ink-2); cursor: pointer;
}
.gl-consent input {
  flex: none; appearance: none; -webkit-appearance: none; margin: 1px 0 0;
  width: 22px; height: 22px; border-radius: 6px;
  border: 1.5px solid var(--gold-400); background: rgba(2,18,12,.6);
  display: grid; place-items: center; cursor: pointer; transition: background .15s, box-shadow .15s;
}
.gl-consent input::after {
  content: ""; width: 6px; height: 11px; margin-top: -2px;
  border: solid var(--green-900); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg) scale(0); transition: transform .15s;
}
.gl-consent input:checked { background: var(--gold-grad); border-color: var(--gold-200); }
.gl-consent input:checked::after { transform: rotate(45deg) scale(1); }
.gl-consent input:focus-visible { box-shadow: 0 0 0 3px rgba(243,220,160,.35); outline: none; }

/* ---------- Nút ---------- */
.nw-btn {
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 50px; margin-top: 10px; padding: 12px 18px;
  border-radius: 14px; border: 1px solid rgba(251, 239, 201, .7);
  background: var(--gold-grad);
  color: #1d1505; font: 700 16px/1.2 var(--sans); letter-spacing: .05em; text-transform: uppercase;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.55), inset 0 -2px 0 rgba(122,90,36,.45), 0 8px 22px -8px rgba(217,180,106,.7);
  cursor: pointer; transition: transform .12s, filter .2s, box-shadow .2s, opacity .2s;
}
.gl-consent + .nw-btn { margin-top: 0; }
.nw-btn::after { /* vệt sáng */
  content: ""; position: absolute; top: 0; bottom: 0; left: -40%; width: 30%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.45), transparent);
  transform: skewX(-20deg); animation: gl-shine 4.5s ease-in-out infinite;
}
.nw-btn:hover { filter: brightness(1.06); }
.nw-btn:active { transform: translateY(1px) scale(.99); }
.nw-btn:focus-visible { outline: 2px solid var(--gold-100); outline-offset: 3px; }
.nw-btn:disabled { opacity: .5; cursor: not-allowed; filter: saturate(.6); }
.nw-btn:disabled::after { display: none; }
.nw-btn.secondary {
  background: rgba(3, 26, 18, .45); color: var(--gold-100);
  border: 1px solid var(--gold-400); text-transform: none; letter-spacing: .01em; font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(251,239,201,.12);
}
.nw-btn.ghost {
  background: transparent; color: var(--gold-200);
  border: 1px dashed rgba(217, 180, 106, .5); text-transform: none; letter-spacing: .01em; font-weight: 600; font-size: 15px;
  box-shadow: none;
}
.nw-btn.secondary::after, .nw-btn.ghost::after { display: none; }
.nw-btn.secondary:hover, .nw-btn.ghost:hover { background: rgba(217,180,106,.12); filter: none; }
@keyframes gl-shine { 0%, 60% { left: -40%; } 100% { left: 130%; } }

/* ---------- Thông báo ---------- */
.msg {
  display: none; margin-top: 12px; padding: 10px 12px; border-radius: 12px;
  font-size: 13.5px; line-height: 1.5; border: 1px solid transparent;
}
.msg.show { display: block; }
.msg.err  { background: rgba(120, 18, 22, .55); border-color: rgba(255, 128, 118, .55); color: #ffd9d4; }
.msg.ok   { background: rgba(18, 110, 70, .5);  border-color: rgba(120, 230, 170, .5); color: #d4ffe6; }
.msg.info { background: rgba(120, 90, 30, .42); border-color: rgba(243, 220, 160, .45); color: var(--gold-100); }
.msg b { color: #fff; }
.spinner {
  display: inline-block; width: 15px; height: 15px; vertical-align: -2px; margin-right: 4px;
  border: 2px solid rgba(243, 220, 160, .3); border-top-color: var(--gold-200); border-radius: 50%;
  animation: gl-spin .8s linear infinite;
}
.nw-btn .spinner { border-color: rgba(29,21,5,.25); border-top-color: #1d1505; }
@keyframes gl-spin { to { transform: rotate(360deg); } }

/* ---------- Camera / ảnh ---------- */
.gl-frame { position: relative; }
.gl-frame:has(> :not(.hidden)) { margin: 4px 0 4px; }
#video, #preview, #preview2 {
  display: block; width: 100%; max-height: 56vh; object-fit: cover;
  border-radius: 16px; background: #000;
  border: 1.5px solid var(--gold-400);
  box-shadow: 0 0 0 4px rgba(3,26,18,.6), 0 0 0 5px rgba(217,180,106,.35), 0 12px 30px -10px rgba(0,0,0,.7);
}
#video { aspect-ratio: 3 / 4; }
#video, #preview { max-height: min(56vh, calc(100svh - 440px)); min-height: 200px; } /* giữ nút "Chụp ảnh" trong màn hình */
#preview2 { max-height: 40vh; }
#event-buttons .nw-btn { justify-content: flex-start; text-align: left; }

/* ---------- Hoàn tất ---------- */
.gl-done { text-align: center; overflow: hidden; padding-top: 26px; }
.gl-done-glow {
  position: absolute; left: 50%; top: -60px; width: 320px; height: 240px; transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(243,220,160,.38), rgba(243,220,160,0));
  pointer-events: none;
}
.success-icon {
  position: relative; width: 92px; height: 92px; margin: 0 auto 14px;
  display: grid; place-items: center; font-size: 44px; line-height: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, rgba(17,81,60,.95), rgba(3,26,18,.95));
  box-shadow: 0 0 0 2px var(--gold-300), 0 0 0 7px rgba(217,180,106,.18), 0 0 40px rgba(243,220,160,.55);
  animation: gl-pop .6s cubic-bezier(.2,1.4,.4,1) both;
}
.success-icon::before {
  content: ""; position: absolute; inset: -16px; border-radius: 50%;
  border: 1px solid rgba(243,220,160,.45); border-left-color: transparent; border-bottom-color: transparent;
  animation: gl-spin 6s linear infinite;
}
.gl-done .gl-card-title { font-size: 30px; background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
#done-msg { margin: 0; font-size: 15px; }
#done-msg b + br { display: none; }
#done-msg b { display: block; font-family: var(--serif); font-size: 24px; color: var(--ink); margin-bottom: 4px; }
.gl-done .gl-rule { margin-top: 16px; }
.gl-done-event {
  margin: 8px 0 0; font-family: var(--serif); font-weight: 700; font-size: 20px; letter-spacing: .16em;
  background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.gl-done-meta { margin: 2px 0 12px; font-size: 12px; color: var(--ink-2); }
@keyframes gl-pop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------- Chấm tiến trình ---------- */
.nw-dots { display: flex; justify-content: center; gap: 8px; margin: 14px 0 4px; }
.dot {
  width: 8px; height: 8px; transform: rotate(45deg);
  background: rgba(217, 180, 106, .22); border: 1px solid rgba(217,180,106,.5); transition: all .3s;
}
.dot.active { background: var(--gold-grad); border-color: var(--gold-200); box-shadow: 0 0 8px rgba(243,220,160,.7); }
.gl-card-note { display: none; margin: 14px 0 0; padding-top: 12px; border-top: 1px solid rgba(217,180,106,.22); font-size: 12px; line-height: 1.5; color: var(--ink-3); }
.gl-card-note b { color: var(--ink); font-weight: 600; }
.gl-card-note span { display: block; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-300); margin-bottom: 2px; }
.gl-foot { margin-top: auto; padding-top: 8px; text-align: center; }
.gl-foot .small { font-size: 11px; color: rgba(207, 217, 210, .7); }

/* ---------- Banner in-app ---------- */
.nw-banner {
  position: sticky; top: 0; z-index: 50;
  display: flex; gap: 10px; align-items: flex-start;
  padding: calc(10px + var(--sat)) 12px 10px 14px;
  background: linear-gradient(180deg, #2a2208, #1b1604);
  border-bottom: 1px solid var(--gold-400);
  color: var(--gold-100); font-size: 13px; line-height: 1.45;
}
.nw-banner b { color: #fff; }
.nw-banner button {
  flex: none; width: 36px; height: 36px; margin: -6px -4px 0 0; border: 0; border-radius: 50%;
  background: rgba(243,220,160,.12); color: var(--gold-100); font-size: 16px; cursor: pointer;
}

/* ---------- Các bước sau trên mobile: thu gọn hero ---------- */
@media (max-width: 899px), (max-aspect-ratio: 1/1) {
  .gl-app:has(#step-cccd.hidden) .gl-hero > :not(.gl-title):not(.gl-subtitle) { display: none; }
  .gl-app:has(#step-cccd.hidden) .gl-title img { max-width: 250px; }
}

/* ---------- Màn hình thấp (ví dụ iPhone SE) ---------- */
@media (max-width: 389px) { .gl-subtitle { letter-spacing: .1em; } }
@media (max-width: 374px) {
  .gl-subtitle { font-size: 10.5px; letter-spacing: .09em; }
  .gl-info { grid-template-columns: 1.45fr 1fr .8fr; gap: 4px; }
  .gl-info li { padding: 6px 5px; gap: 4px; }
  .gl-info svg { width: 14px; height: 14px; }
  .gl-info b { font-size: 10.5px; white-space: nowrap; }
  .gl-info span { font-size: 10px; }
  .gl-guest { font-size: 15.5px; }
}
@media (max-height: 760px) and (max-width: 899px) {
  .gl-audience { display: none; }
  .gl-title img { max-width: 300px; }
  .gl-guest { font-size: 15px; }
}

/* =========================================================
   DESKTOP / màn ngang rộng: bố cục poster + thẻ check-in
   ========================================================= */
@media (min-width: 900px) and (min-aspect-ratio: 1/1) {
  body { background: var(--green-900); }
  .gl-backdrop {
    display: block; inset: -40px;
    background:
      radial-gradient(ellipse 60% 70% at 50% 45%, rgba(17,81,60,.55), rgba(3,26,18,0) 70%),
      url("/glory/bg-mobile.jpg?v=20261021a") center / cover no-repeat;
    filter: blur(28px) brightness(.55) saturate(1.1);
  }
  .gl-bg {
    background:
      radial-gradient(ellipse 50% 60% at 50% 40%, rgba(11,59,44,.35), rgba(3,26,18,.0) 70%),
      linear-gradient(90deg, rgba(3,26,18,.0), rgba(3,26,18,.35) 50%, rgba(3,26,18,0));
  }
  .gl-pillar {
    display: block; top: 0; bottom: 0; width: auto; aspect-ratio: 470 / 2560; height: 100vh;
    background: center / cover no-repeat;
    opacity: .9;
  }
  .gl-pillar.l { left: 0; background-image: url("/glory/pillar-l.jpg?v=20261021a");
    -webkit-mask-image: linear-gradient(90deg, #000 55%, transparent); mask-image: linear-gradient(90deg, #000 55%, transparent); }
  .gl-pillar.r { right: 0; background-image: url("/glory/pillar-r.jpg?v=20261021a");
    -webkit-mask-image: linear-gradient(270deg, #000 55%, transparent); mask-image: linear-gradient(270deg, #000 55%, transparent); }

  .gl-app {
    max-width: none; width: auto;
    min-height: 100vh;
    padding: 0 40px;
    display: grid;
    grid-template-columns: auto minmax(380px, 430px);
    justify-content: center; align-items: center;
    column-gap: clamp(40px, 5vw, 96px);
  }
  /* Panel poster */
  .gl-stage {
    --ph: min(100vh, 1240px);
    height: var(--ph); width: calc(var(--ph) * 0.7281);
    display: flex; flex-direction: column; align-items: center;
    padding: calc(var(--ph) * .045) calc(var(--ph) * .1) 0;
  }
  .gl-poster {
    display: block; position: absolute; inset: 0; z-index: -1;
    background: url("/glory/bg-mobile.jpg?v=20261021a") center / cover no-repeat;
    box-shadow: 0 0 80px rgba(0,0,0,.6);
    -webkit-mask-image: linear-gradient(180deg, #000 0, #000 90%, transparent);
    mask-image: linear-gradient(180deg, #000 0, #000 90%, transparent);
  }
  .gl-poster::after { /* viền vàng mảnh hai bên */
    content: ""; position: absolute; inset: 0;
    box-shadow: inset 1px 0 0 rgba(217,180,106,.35), inset -1px 0 0 rgba(217,180,106,.35);
  }
  .gl-top { padding: 0 0 calc(var(--ph) * .02); }
  .gl-logos { width: calc(var(--ph) * .2); min-width: 150px; }
  .gl-hero { width: 100%; }
  .gl-invite { font-size: max(14px, calc(var(--ph) * .021)); }
  .gl-guest { font-size: max(16px, calc(var(--ph) * .026)); }
  .gl-title img { max-width: none; width: 100%; }
  .gl-title { margin: 0 -4%; }
  .gl-subtitle { font-size: max(11px, calc(var(--ph) * .0155)); }
  .gl-info { margin-top: calc(var(--ph) * .018); }
  .gl-info span { font-size: max(10.5px, calc(var(--ph) * .0138)); }
  .gl-info b { font-size: max(11.5px, calc(var(--ph) * .015)); }
  .gl-audience { font-size: max(11px, calc(var(--ph) * .0142)); }

  .gl-side { position: relative; flex: none; justify-content: center; padding: 32px 0; min-height: 100vh; }
  .gl-side::before {
    content: ""; position: absolute; z-index: -1; left: 50%; top: 50%; width: 160%; height: 90%;
    transform: translate(-50%, -50%);
    background: radial-gradient(closest-side, rgba(217,180,106,.16), rgba(17,81,60,.18) 55%, rgba(3,26,18,0));
    pointer-events: none;
  }
  .gl-card { margin-top: 0; padding: 24px 24px 22px; }
  .gl-card-head { margin-bottom: 16px; flex-direction: column; gap: 6px; align-items: flex-start; }
  .gl-kicker { font-size: 32px; }
  .gl-event { border-left: 0; padding-left: 0; white-space: normal; font-size: 12px; }
  .gl-card-head::after { content: ""; display: block; width: 64px; height: 1px; background: linear-gradient(90deg, var(--gold-300), transparent); }
  .gl-foot { margin-top: 6px; }
  #video, #preview { max-height: min(62vh, calc(100vh - 470px)); }
}
@media (min-width: 900px) and (min-aspect-ratio: 1/1) and (max-height: 1019px) {
  .gl-hero .gl-audience { display: none; }
  .gl-card-note { display: block; }
}

@media (min-width: 1400px) and (min-aspect-ratio: 1/1) and (min-height: 900px) {
  .gl-side { zoom: 1.22; min-height: calc(100vh / 1.22); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
