/* Розыгрыши NiN: стекло в духе Portals и Кота-карт, но ярче. */
:root {
  --bg: #121212;
  --glass: rgba(255, 255, 255, .065);
  --glass-2: rgba(255, 255, 255, .11);
  --hi: inset 0 1px 0 rgba(255, 255, 255, .11);
  --text: #ffffff;
  --muted: rgba(255, 255, 255, .5);
  --blue: #1f8bff;
  --green: #2fd36b;
  --gold: #ffc23d;
  --pink: #ff4f9a;
  --good: #2fd36b;
  --bad: #ff5a5a;
  --radius: 30px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 600 15px/1.4 Geologica, system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
  padding: calc(14px + var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px)) 16px calc(112px + env(safe-area-inset-bottom));
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }

/* Цветные пятна под стеклом — от них стекло и «светится». */
.glow { position: fixed; width: 360px; height: 360px; border-radius: 50%; filter: blur(90px); opacity: .16; pointer-events: none; z-index: 0; }
.glow-a { background: #1f8bff; top: -180px; left: -140px; }
.glow-b { background: #7a4dff; bottom: -200px; right: -160px; opacity: .12; }
main { position: relative; z-index: 1; max-width: 480px; margin: 0 auto; }

.loading { display: flex; flex-direction: column; align-items: center; gap: 14px; padding-top: 38vh; color: var(--muted); }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--glass-2); border-top-color: var(--blue); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── верхние «таблетки» ── */
.topbar { display: flex; justify-content: space-between; gap: 10px; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 44px; padding: 0 18px; border-radius: 999px; font-weight: 800; font-size: 16px;
  background: rgba(44, 44, 48, .72); box-shadow: var(--hi); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  max-width: 60%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill-blue { background: linear-gradient(180deg, #1c3d66, #10243d); box-shadow: inset 0 1px 0 rgba(140, 190, 255, .28); }

.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: rgba(255, 255, 255, .62); }
h1 { font: 800 28px/1.12 Geologica, sans-serif; margin: 16px 0 6px; letter-spacing: -.02em; }
h2 { font: 800 21px/1.2 Geologica, sans-serif; margin: 0 0 4px; }
.lead { color: var(--muted); margin: 0 0 16px; font-weight: 500; }
.center { text-align: center; }

/* Стопка билетов на первом экране */
.stack { position: relative; height: 150px; margin: 14px auto 0; width: 230px; }
.stack .mini {
  position: absolute; inset: 22px 18px; border-radius: 22px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 18px 40px rgba(0, 0, 0, .5);
  -webkit-mask: radial-gradient(circle 10px at 0 62%, transparent 98%, #000) left / 51% 100% no-repeat,
                radial-gradient(circle 10px at 100% 62%, transparent 98%, #000) right / 51% 100% no-repeat;
          mask: radial-gradient(circle 10px at 0 62%, transparent 98%, #000) left / 51% 100% no-repeat,
                radial-gradient(circle 10px at 100% 62%, transparent 98%, #000) right / 51% 100% no-repeat;
}
.stack .mini:nth-child(1) { transform: rotate(-12deg) translate(-28px, 6px); background: linear-gradient(135deg, #2a7a52, #174a33); }
.stack .mini:nth-child(2) { transform: rotate(10deg) translate(26px, 2px); background: linear-gradient(135deg, #9a7130, #5e4119); }
.stack .mini:nth-child(3) { display: flex; flex-direction: column; justify-content: center; align-items: center;
  background: linear-gradient(135deg, #2f5fa8, #3d3f95 60%, #523c8c); animation: bob 3.2s ease-in-out infinite; }
.stack .mini b { font: 800 30px Unbounded, sans-serif; letter-spacing: .02em; text-shadow: 0 2px 10px rgba(0, 0, 0, .25); }
.stack .mini small { font-size: 10px; letter-spacing: .24em; color: rgba(255, 255, 255, .75); }
@keyframes bob { 50% { transform: translateY(-6px) rotate(-1deg); } }

/* ── стекло ── */
.card { background: var(--glass); box-shadow: var(--hi), 0 10px 30px rgba(0, 0, 0, .3); border-radius: var(--radius); padding: 18px; margin: 12px 0;
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }

/* Приз — яркий баннер, как акции у Portals */
.banner { position: relative; overflow: hidden; display: flex; align-items: center; min-height: 112px; margin: 12px 0; padding: 20px 22px; border-radius: var(--radius);
  background: linear-gradient(110deg, #1f4f94 0%, #173a70 45%, #10203d 100%);
  box-shadow: inset 0 1px 0 rgba(170, 210, 255, .2), 0 14px 36px rgba(0, 0, 0, .35); }
.banner::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle 2px at 20% 30%, #fff 50%, transparent 51%), radial-gradient(circle 1.5px at 62% 70%, #fff 50%, transparent 51%),
              radial-gradient(circle 1.5px at 78% 18%, #fff 50%, transparent 51%), radial-gradient(circle 1px at 40% 82%, #fff 50%, transparent 51%); opacity: .35; }
.banner-text { position: relative; z-index: 1; flex: 1; min-width: 0; }
.banner .eyebrow { color: rgba(200, 225, 255, .85); }
.banner-art { position: relative; z-index: 1; font-size: 64px; line-height: 1; margin-left: 10px; filter: drop-shadow(0 8px 16px rgba(0, 0, 0, .35)); transform: rotate(8deg); }
.prize-one { font-size: 24px; font-weight: 800; line-height: 1.15; margin-top: 4px; letter-spacing: -.01em; }
.banner-list { background: linear-gradient(110deg, #4a3594 0%, #33276e 50%, #1b163d 100%); box-shadow: inset 0 1px 0 rgba(210, 190, 255, .2), 0 14px 36px rgba(0, 0, 0, .35); }
.prizes { margin: 6px 0 0; padding: 0; list-style: none; }
.prizes li { display: flex; gap: 12px; align-items: center; padding: 5px 0; font-weight: 700; }
.prizes .place { flex: 0 0 auto; min-width: 30px; height: 30px; border-radius: 999px; background: rgba(255, 255, 255, .16); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25); display: grid; place-items: center; font-weight: 800; font-size: 13px; }

/* Счётчики — цветное стекло: зелёное, синее, золотое */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { border-radius: 26px; padding: 16px 8px 14px; text-align: center; background: var(--glass); box-shadow: var(--hi); }
.stat b { display: block; font: 800 22px Geologica, sans-serif; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.stat span { font-size: 12px; color: var(--muted); font-weight: 600; }
.stat.green { background: linear-gradient(160deg, rgba(47, 211, 107, .14), rgba(15, 80, 45, .18)); box-shadow: inset 0 1px 0 rgba(150, 255, 190, .14); }
.stat.green b { color: #8fe3ad; }
.stat.blue { background: linear-gradient(160deg, rgba(31, 139, 255, .15), rgba(15, 45, 100, .2)); box-shadow: inset 0 1px 0 rgba(150, 200, 255, .14); }
.stat.blue b { color: #9cc8f5; }
.stat.gold { background: linear-gradient(160deg, rgba(255, 194, 61, .13), rgba(110, 70, 10, .2)); box-shadow: inset 0 1px 0 rgba(255, 220, 140, .14); }
.stat.gold b { color: #ecd08f; }
.progress { height: 10px; border-radius: 999px; background: rgba(255, 255, 255, .08); overflow: hidden; margin-top: 8px; box-shadow: inset 0 1px 2px rgba(0, 0, 0, .4); }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, #2f7fd9, #4a6fe0); border-radius: 999px; transition: width .6s; }
.progress-cap { display: flex; justify-content: space-between; font-size: 13px; font-weight: 700; }
.progress-cap span:last-child { color: #9cc8f5; }

.cond-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 17px; }
.cond { display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin-top: 8px; border-radius: 22px; background: rgba(255, 255, 255, .05); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06); }
.cond .mark { flex: 0 0 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 15px; font-weight: 800; background: var(--glass-2); }
.cond.ok .mark { background: rgba(47, 211, 107, .2); color: var(--good); box-shadow: 0 0 14px rgba(47, 211, 107, .25); }
.cond.no .mark { background: rgba(255, 90, 90, .18); color: var(--bad); }
.cond .what { flex: 1; min-width: 0; font-weight: 700; }
.cond .what small { display: block; color: var(--muted); font-size: 12px; font-weight: 500; }
.chip-btn { height: 38px; padding: 0 16px; border-radius: 999px; background: var(--glass-2); box-shadow: var(--hi); font-size: 14px; font-weight: 800; white-space: nowrap; }
.chip-btn.hot { background: #2a7de1; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22); }

.note { font-size: 13px; color: var(--muted); font-weight: 500; padding: 0 6px; }

/* ── кнопки ── */
.cta-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, rgba(18, 18, 18, .92) 40%); }
.cta-bar > * { max-width: 480px; margin: 0 auto; }
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 58px; border-radius: 999px; font-weight: 800; font-size: 18px; transition: transform .12s, opacity .2s; }
.btn:active { transform: scale(.97); }
.btn-main { background: #2a7de1; color: #fff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 8px 22px rgba(0, 0, 0, .35); }
.btn-main[disabled] { opacity: .55; box-shadow: none; }
.btn-soft { background: rgba(44, 44, 48, .8); box-shadow: var(--hi); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
.link { color: #4aa3ff; font-weight: 800; font-size: 15px; }

.copy { display: flex; align-items: center; gap: 8px; background: var(--glass); box-shadow: var(--hi); border-radius: 999px; padding: 6px 6px 6px 18px; margin-top: 10px; }
.copy code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font: 600 13px ui-monospace, Menlo, monospace; }

/* ── билет: яркое стекло с вырезами ── */
.ticket-wrap { perspective: 900px; margin: 4px auto 0; max-width: 340px; }
.ticket {
  position: relative; color: #fff; border-radius: 30px;
  background: linear-gradient(140deg, #2d5ea6 0%, #3a4196 50%, #4f3a8a 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 26px 60px rgba(0, 0, 0, .5);
  -webkit-mask: radial-gradient(circle 15px at 0 calc(100% - 92px), transparent 97%, #000) left / 51% 100% no-repeat,
                radial-gradient(circle 15px at 100% calc(100% - 92px), transparent 97%, #000) right / 51% 100% no-repeat;
          mask: radial-gradient(circle 15px at 0 calc(100% - 92px), transparent 97%, #000) left / 51% 100% no-repeat,
                radial-gradient(circle 15px at 100% calc(100% - 92px), transparent 97%, #000) right / 51% 100% no-repeat;
}
.ticket.print { animation: print 1.1s cubic-bezier(.2,.8,.2,1) both; }
@keyframes print {
  0% { transform: translateY(-40px) rotateX(55deg); opacity: 0; clip-path: inset(0 0 100% 0); }
  60% { opacity: 1; }
  100% { transform: none; clip-path: inset(0 0 0 0); }
}
/* Блик, пробегающий по билету */
.ticket::before { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, .14) 45%, transparent 60%) -200% 0 / 200% 100% no-repeat;
  animation: shine 4s ease-in-out 1.2s infinite; }
@keyframes shine { 0%, 60% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
.ticket-top { padding: 22px 22px 18px; position: relative; }
.ticket-head { position: relative; display: flex; justify-content: space-between; font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: rgba(255, 255, 255, .75); }
.ticket-num { position: relative; font: 800 48px/1 Unbounded, sans-serif; margin: 18px 0 8px; letter-spacing: .01em; text-shadow: 0 4px 18px rgba(0, 0, 0, .2); }
.ticket-num small { font-size: 22px; vertical-align: 13px; margin-right: 4px; opacity: .8; }
.ticket-prize { position: relative; font-weight: 800; font-size: 17px; }
.ticket-holder { position: relative; margin-top: 10px; font-size: 13px; color: rgba(255, 255, 255, .72); font-weight: 500; }
.ticket-holder b { color: #fff; font-weight: 800; }
.holo { position: absolute; right: 18px; top: 48px; width: 56px; height: 56px; border-radius: 50%; opacity: .7;
  background: conic-gradient(from 0deg, #ffd6a5, #caffbf, #9bf6ff, #bdb2ff, #ffc6ff, #ffd6a5);
  animation: spin 8s linear infinite; box-shadow: 0 6px 18px rgba(0, 0, 0, .25); }
.holo::after { content: "NiN"; position: absolute; inset: 6px; border-radius: 50%; background: rgba(40, 30, 120, .55); backdrop-filter: blur(6px);
  display: grid; place-items: center; font: 800 12px Unbounded, sans-serif; color: #fff; animation: spin 8s linear infinite reverse; }
.ticket-cut { height: 0; border-top: 2px dashed rgba(255, 255, 255, .4); margin: 0 20px; }
.ticket-stub { height: 92px; display: flex; align-items: center; justify-content: space-between; padding: 0 22px; background: rgba(0, 0, 0, .14); border-radius: 0 0 30px 30px; }
.barcode { display: flex; align-items: stretch; height: 44px; gap: 2px; }
.barcode i { background: #fff; border-radius: 1px; }
.stub-info { text-align: right; font-size: 11px; color: rgba(255, 255, 255, .7); letter-spacing: .1em; text-transform: uppercase; font-weight: 700; }
.stub-info b { display: block; font: 800 15px Geologica, sans-serif; letter-spacing: 0; color: #fff; text-transform: none; }

.title-in { text-align: center; margin: 20px 0 4px; }
.title-in h1 { margin: 0 0 6px; }

.kv { display: flex; justify-content: space-between; align-items: baseline; padding: 11px 0; border-top: 1px solid rgba(255, 255, 255, .07); font-weight: 600; }
.kv:first-child { border-top: 0; padding-top: 0; }
.kv b { font-weight: 800; font-variant-numeric: tabular-nums; }
.kv .big { font: 800 26px Geologica, sans-serif; color: #8fe3ad; }

/* ── итоги ── */
.winner { display: flex; gap: 12px; align-items: center; padding: 10px 12px; margin-top: 8px; border-radius: 22px; background: rgba(255, 255, 255, .05); }
.winner .place { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(160deg, #d9b25c, #a8742a); color: #2a1a00; font-weight: 800; }
.winner.me { background: linear-gradient(90deg, rgba(31, 139, 255, .35), rgba(180, 77, 255, .2)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15); }
.winner .who { flex: 1; min-width: 0; font-weight: 700; }
.winner .who small { display: block; color: var(--muted); font-size: 12px; font-weight: 500; }

.big-emoji { font-size: 72px; text-align: center; margin-top: 18vh; filter: drop-shadow(0 10px 24px rgba(0, 0, 0, .4)); }

/* ── капча ── */
.sheet-wrap { position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, .5); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); display: flex; align-items: flex-end; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.sheet { width: calc(100% - 16px); max-width: 520px; margin: 0 auto 8px; background: rgba(34, 34, 38, .92); border-radius: 40px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), 0 20px 60px rgba(0, 0, 0, .55);
  padding: 10px 18px calc(20px + env(safe-area-inset-bottom)); animation: up .3s cubic-bezier(.2,.8,.2,1); text-align: center; }
@keyframes up { from { transform: translateY(110%); } }
.sheet-grip { width: 40px; height: 5px; border-radius: 5px; background: rgba(255, 255, 255, .2); margin: 0 auto 14px; }
.sheet p { margin: 0 0 14px; font-weight: 500; }
.puzzle { position: relative; width: 100%; aspect-ratio: 320 / 180; border-radius: 26px; overflow: hidden; background: rgba(255, 255, 255, .05); box-shadow: 0 0 0 2px rgba(255, 255, 255, .08); transition: box-shadow .25s; }
.puzzle.ok { box-shadow: 0 0 0 3px var(--good), 0 0 24px rgba(47, 211, 107, .4); }
.puzzle.bad { box-shadow: 0 0 0 3px var(--bad); animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.puzzle img { position: absolute; left: 0; top: 0; display: block; user-select: none; -webkit-user-drag: none; pointer-events: none; }
#pzBg { width: 100%; height: 100%; }
.pz-piece { filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .5)); }
.pz-loading { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(40, 40, 44, 1); }
.slider { position: relative; height: 56px; margin-top: 14px; border-radius: 999px; background: rgba(255, 255, 255, .07); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .35); touch-action: none; user-select: none; }
.slider-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; background: linear-gradient(90deg, rgba(31, 139, 255, .15), rgba(31, 139, 255, .45)); width: 56px; }
.slider-hint { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 13px; font-weight: 700; letter-spacing: .08em; pointer-events: none; }
.slider-knob { position: absolute; top: 3px; left: 3px; width: 50px; height: 50px; border-radius: 50%; background: #2a7de1; display: grid; place-items: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 6px 16px rgba(0, 0, 0, .4); }
.slider-knob svg { width: 22px; fill: #fff; }
.slider.lock .slider-knob { transition: left .3s; }
.pz-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; font-size: 13px; padding: 0 6px; }

.toast { position: fixed; left: 16px; right: 16px; bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 30; max-width: 448px; margin: 0 auto;
  background: rgba(255, 255, 255, .96); color: #111; border-radius: 999px; padding: 14px 20px; font-size: 15px; font-weight: 700; text-align: center;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .4); animation: up .25s; }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 40; width: 100%; height: 100%; }
