/* 🎁 Бэлэглэх цонх — барааны хуудас + захиалгын маягт (gift.js) */
#tb-gift { position: fixed; inset: 0; z-index: 100000; pointer-events: none; }
#tb-gift .gs-bg { position: absolute; inset: 0; background: rgba(0,0,0,.45); opacity: 0; transition: opacity .25s; }
#tb-gift .gs { position: absolute; left: 0; right: 0; bottom: 0; background: #fff; border-radius: 24px 24px 0 0; padding: 10px 16px calc(16px + env(safe-area-inset-bottom));
  transform: translateY(100%); transition: transform .3s cubic-bezier(.2,.8,.2,1); max-height: 92vh; overflow-y: auto; }
#tb-gift.open { pointer-events: auto; }
#tb-gift.open .gs-bg { opacity: 1; }
#tb-gift.open .gs { transform: none; }
.gs-grip { width: 40px; height: 4px; border-radius: 2px; background: #ddd; margin: 0 auto 10px; }
.gs-x { position: absolute; right: 12px; top: 12px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: #f2f2f2; font-size: 15px; }
#tb-gift h3 { margin: 4px 0 4px; font-size: 20px; font-weight: 800; }
.gs-sub { margin: 0 0 14px; font-size: 13px; color: #666; line-height: 1.4; padding-right: 30px; }
.gs-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; max-height: 46vh; overflow-y: auto; padding: 2px; }
.gs-opt { position: relative; background: #fff; border: 1.5px solid #e8e4de; border-radius: 16px; padding: 5px 5px 8px; align-items: center; text-align: left; font-family: inherit; display: flex; flex-direction: column; gap: 3px; }
.gs-opt.on { border-color: #b8963e; background: #fffaf0; box-shadow: 0 0 0 2px rgba(184,150,62,.25); }
.gs-img { display: block; width: 100%; aspect-ratio: 1; border-radius: 12px; background: #f6efe6 center/cover no-repeat; margin-bottom: 5px; }
.gs-img i { font-style: normal; font-size: 34px; }
.gs-opt b { font-size: 12.5px; color: #111; }
.gs-opt small { font-size: 10px; color: #777; line-height: 1.3; }
.gs-opt strong { font-size: 13px; color: #111; font-weight: 800; margin-top: 2px; }
.gs-opt em { position: absolute; top: -8px; left: 50%; transform: translateX(-50%); background: #b8963e; color: #fff; font-style: normal; font-size: 9.5px; font-weight: 800; padding: 3px 8px; border-radius: 10px; white-space: nowrap; }
.gs-lbl { display: block; margin: 16px 0 6px; font-size: 13px; font-weight: 700; }
.gs-lbl span { font-weight: 400; color: #888; }
#gs-msg { width: 100%; box-sizing: border-box; border: 1.5px solid #e8e4de; border-radius: 14px; padding: 10px 12px; font-size: 16px; font-family: inherit; resize: none; }   /* ≥16px — iPhone томруулахгүй */
.gs-sum { display: flex; justify-content: space-between; align-items: baseline; margin: 14px 0 10px; font-size: 13px; color: #555; }
.gs-sum b { font-size: 20px; color: #111; }
.gs-go { width: 100%; height: 52px; border: 0; border-radius: 16px; background: #111; color: #fff; font-size: 15px; font-weight: 800; font-family: inherit; }
/* Сонгосон баглаа ТОД, бусад нь бүдгэрсэн (эзэн 2026-10-21) — үнэ картан дээр БАЙХГҮЙ, нийт дүн доор */
.gs-opt { padding: 4px !important; transition: filter .25s, opacity .25s, transform .25s; }
.gs-opt .gs-img { margin: 0 !important; }
#tb-gift.picked .gs-list .gs-opt:not(.on) { filter: blur(.3px); opacity: .85; transform: scale(.98); }
.gs-list .gs-opt.on { transform: scale(1); }
.gs-list .gs-opt.on::after { content: '✓'; position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; border-radius: 50%; background: #b8963e; color: #fff;
  font-size: 13px; font-weight: 800; display: grid; place-items: center; box-shadow: 0 2px 6px rgba(0,0,0,.2); }
.gs-sum b { transition: transform .2s; }
.gs-sum b.pop { transform: scale(1.12); }
#tb-gift h3 { margin: 6px 0 14px; font-size: 20px; font-weight: 800; color: #111; }
.gs-go:disabled { background: #ccc !important; }
#tb-gift { font-family: inherit; }
#tb-gift .gs { font-family: 'Noto Sans Display', -apple-system, sans-serif; }
html.tb-gift-open, html.tb-gift-open body { overflow: hidden; }

/* 🌙 */
html.m-app.m-dark #tb-gift .gs { background: #1C1C1F; color: #F2EFEA; }
html.m-app.m-dark .gs-opt { background: #232327; border-color: #2E2E31; }
html.m-app.m-dark #gs-msg { background: #232327; border-color: #2E2E31; color: #F2EFEA; }
html.m-app.m-dark .gs-sum, html.m-app.m-dark .gs-sum b { color: #F2EFEA; }
html.m-app.m-dark .gs-go { background: #F2EFEA; color: #111; }
html.m-app.m-dark .gs-x { background: #2E2E31; color: #F2EFEA; }
html.m-dark #tb-gift h3 { color: #F2EFEA; }
@media (min-width: 700px) { #tb-gift .gs { left: calc(50% - 280px); right: auto; width: 560px; border-radius: 24px; bottom: 24px; } }

/* Нүүр зураг «Хайртай хүндээ бэлэглэх багц» (эзэн 2026-10-21) — гарчиг + баглаа + уут харагдахаар дээд хэсгийг */
#tb-gift .gs-cover { margin: 2px -2px 12px; border-radius: 18px; overflow: hidden; height: auto; box-shadow: 0 8px 22px rgba(60,30,10,.25); }
#tb-gift .gs-cover img { width: 100%; height: auto; display: block; }   /* БҮТЭН зураг (эзэн: «зураг дутуу») — цонх бүхэлдээ гүйлгэгдэнэ */
#tb-gift.open .gs-cover img { animation: gsCover 6s ease-out both; }
@keyframes gsCover { from { transform: scale(1.08); } to { transform: scale(1); } }
#tb-gift .gs-x { z-index: 3; background: rgba(255,255,255,.9); color: #111; right: auto; left: 22px; top: 26px; }
#tb-gift .gs-list { max-height: none; overflow: visible; }
/* Нийт дүн + товч доор ТОГТМОЛ (цонх урт болсон тул) */
#tb-gift .gs-sum { position: sticky; bottom: 62px; z-index: 2; background: #fff; margin: 10px -16px 0; padding: 10px 16px 8px; box-shadow: 0 -8px 14px rgba(255,255,255,.9); }
#tb-gift .gs-go { position: sticky; bottom: 0; z-index: 2; box-shadow: 0 0 0 10px #fff; }
html.m-dark #tb-gift .gs-sum { background: #1C1C1F; box-shadow: 0 -8px 14px rgba(28,28,31,.9); }
html.m-dark #tb-gift .gs-go { box-shadow: 0 0 0 10px #1C1C1F; }

/* Мэндчилгээ заавал + бараа/цэцэг хамт */
.gs-lbl .req { color: #d4342c; font-size: 15px; }
#gs-msg.need { border-color: #d4342c !important; box-shadow: 0 0 0 3px rgba(212,52,44,.12); animation: gsShake .35s; }
@keyframes gsShake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.gs-hint { font-size: 11.5px; color: #8a6a1e; margin-top: 5px; line-height: 1.35; }
#tb-gift .gs-sum { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.gs-pair { display: flex; align-items: center; gap: 6px; }
.gs-pair i { width: 46px; height: 46px; border-radius: 12px; background: #fff center/cover no-repeat; border: 1px solid #eee; box-shadow: 0 2px 8px rgba(0,0,0,.1); }
.gs-pair i.p { background-size: contain; }
.gs-pair em { font-style: normal; font-weight: 800; color: #b8963e; font-size: 16px; }
.gs-sumt { text-align: right; }
.gs-sumt small { display: block; font-size: 11.5px; color: #777; }
.gs-sumt b { font-size: 20px; color: #111; }
html.m-dark .gs-sumt b { color: #F2EFEA; }

/* 🔍 Цэцгийн lightbox */
.gs-lb { position: fixed; inset: 0; z-index: 5; background: rgba(0,0,0,.92); display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity .25s; }
.gs-lb.open { opacity: 1; pointer-events: auto; }
.gs-lb img { max-width: 94vw; max-height: 80vh; border-radius: 16px; object-fit: contain; transform: scale(.9); transition: transform .3s cubic-bezier(.2,.8,.2,1); box-shadow: 0 20px 50px rgba(0,0,0,.5); }
.gs-lb.open img { transform: scale(1); }
.gs-lb-x { position: absolute; top: calc(16px + env(safe-area-inset-top)); left: 16px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,.95); color: #111; font-size: 18px; font-weight: 700; box-shadow: 0 4px 14px rgba(0,0,0,.3); }
.gs-lb-ok { position: absolute; bottom: calc(28px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); background: #b8963e; color: #fff; font-weight: 800; font-size: 14px; padding: 10px 20px; border-radius: 24px; box-shadow: 0 6px 18px rgba(0,0,0,.3); }
/* 📱 iPhone Safari-ийн доод хэрэгслийн мөрийн ард доод хэсэг нуугдаж, гүйлгэх зай дутаж байсан (эзэн 2026-10-21) */
#tb-gift .gs { max-height: 88vh; max-height: 88dvh; padding-bottom: calc(26px + env(safe-area-inset-bottom)); overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
#tb-gift .gs-go { margin-bottom: 4px; }
@media (min-width: 700px) { #tb-gift .gs { max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px); } }
/* Тайлбар бичиг товчны цагаан хүрээний ард нуугдаж байсан (эзэн 2026-10-21) — зай гаргана */
#tb-gift .gs-hint { margin-bottom: 22px; }
#tb-gift .gs-sum { margin-top: 0; }

/* Lightbox: ‹ › шилжих + доор нийт дүн */
.gs-lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,.9); color: #111; font-size: 28px; line-height: 40px; z-index: 2; box-shadow: 0 4px 14px rgba(0,0,0,.3); }
.gs-lb-nav.prev { left: 10px; } .gs-lb-nav.next { right: 10px; }
.gs-lb img.sl-r { animation: lbR .3s ease; } .gs-lb img.sl-l { animation: lbL .3s ease; }
@keyframes lbR { from { opacity: 0; transform: translateX(40px) scale(.96); } } @keyframes lbL { from { opacity: 0; transform: translateX(-40px) scale(.96); } }
.gs-lb-bar { position: absolute; left: 12px; right: 12px; bottom: calc(18px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 18px; padding: 10px 10px 10px 16px; box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.gs-lb-cnt { font-size: 12px; color: #888; font-weight: 700; white-space: nowrap; }
.gs-lb-sum { flex: 1; text-align: right; }
.gs-lb-sum small { display: block; font-size: 11px; color: #888; }
.gs-lb-sum b { font-size: 19px; color: #111; font-weight: 800; }
.gs-lb .gs-lb-ok { position: static; transform: none; left: auto; bottom: auto; border: 0; background: #b8963e; color: #fff; font-weight: 800; font-size: 14px; padding: 12px 14px; border-radius: 14px; white-space: nowrap; font-family: inherit; box-shadow: none; }
.gs-lb img { max-height: 70vh; }
