@font-face { font-family: "Forum"; font-weight: 400; font-display: swap; src: url(fonts/forum-cyrillic.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Forum"; font-weight: 400; font-display: swap; src: url(fonts/forum-latin.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Manrope"; font-weight: 200 800; font-display: swap; src: url(fonts/manrope-cyrillic.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Manrope"; font-weight: 200 800; font-display: swap; src: url(fonts/manrope-latin.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "JetBrains Mono"; font-weight: 100 800; font-display: swap; src: url(fonts/jbmono-latin.woff2) format("woff2"); }

:root {
  --bg: #0B0A08; --bg-2: #0F0D0A; --surface: #14120E; --surface-2: #1C1914; --surface-3: #25211A;
  --line: #FFFFFF14; --line-2: #FFFFFF26;
  --text: #F1EBDF; --text-2: #D9D2C4; --muted: #A39C8E;
  --gold: #E2AE4A; --gold-hi: #F3C977; --gold-dk: #B8862F; --on-gold: #1A1206;
  --red: #FF8F86; --green: #4ADE80;
  --f-display: "Forum", Georgia, serif;
  --f-body: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --r: 18px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 500 15px/1.45 var(--f-body);
  min-height: 100vh; min-height: var(--tg-viewport-stable-height, 100dvh);
  overflow-x: hidden;
  background:
    radial-gradient(120% 60% at 50% 22%, #E2AE4A1F 0%, #E2AE4A08 40%, transparent 70%),
    radial-gradient(80% 50% at 50% 100%, #B8862F14 0%, transparent 70%),
    var(--bg);
  background-attachment: fixed;
}
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.app { max-width: 480px; margin: 0 auto; padding: 14px 16px calc(28px + var(--safe-b)); }

/* ---------- шапка */
.top { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.logo { width: 40px; height: 40px; border-radius: 10px; flex: none; }
.titles { flex: 1; min-width: 0; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); }
h1 { margin: 0; font: 400 clamp(20px, 6.2vw, 26px)/1.05 var(--f-display); letter-spacing: .01em; }
h2 { margin: 0 0 8px; font: 400 24px/1.15 var(--f-display); }
.nick {
  flex: none; max-width: 42%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 6px 11px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line-2);
  font-size: 13px; font-weight: 700; color: var(--text-2);
}
.nick::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--green); margin-right: 7px; vertical-align: 1px; box-shadow: 0 0 8px var(--green); }

/* ---------- общие блоки */
.screen { animation: fadeUp .45s var(--ease-out) both; }
.screen.center { min-height: 60vh; display: grid; place-items: center; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.card {
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line-2); border-radius: 22px; padding: 22px 18px 18px;
  display: flex; flex-direction: column; gap: 12px;
  box-shadow: 0 20px 60px #0008, inset 0 1px 0 #FFFFFF0D;
}
.card-center { text-align: center; align-items: center; max-width: 340px; }
.card p { margin: 0; }
.step { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); }
.muted { color: var(--muted); }
.hl { color: var(--gold-hi); }
.hint { margin: 0; font-size: 13px; color: var(--muted); }
.center-text { text-align: center; }
.err { margin: 0; color: var(--red); font-size: 14px; }

.btn {
  appearance: none; border: 0; cursor: pointer; border-radius: 14px; padding: 13px 18px; min-height: 48px;
  font-weight: 700; font-size: 15px; transition: transform .15s var(--ease-out), filter .2s, opacity .2s;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
}
.btn:active { transform: scale(.97); }
.btn:disabled { cursor: default; opacity: .55; transform: none; }
.btn-primary {
  color: var(--on-gold);
  background: linear-gradient(180deg, var(--gold-hi), var(--gold) 55%, var(--gold-dk));
  box-shadow: 0 8px 26px #E2AE4A40, inset 0 1px 0 #FFF6, inset 0 -2px 0 #0003;
}
.btn-primary:disabled { background: var(--surface-3); color: var(--text-2); box-shadow: none; opacity: 1; }
.btn-ghost { background: transparent; color: var(--text-2); border: 1px solid var(--line-2); }
.btn-xl { min-height: 56px; font-size: 17px; border-radius: 16px; letter-spacing: .01em; }

.spinner { width: 42px; height: 42px; border-radius: 50%; border: 3px solid var(--line-2); border-top-color: var(--gold); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- код привязки */
.code {
  width: 100%; display: flex; align-items: center; justify-content: center;
  padding: 18px 14px; border-radius: 16px; border: 1px dashed #E2AE4A80; background: #E2AE4A0F;
  user-select: none; -webkit-user-select: none;
}
.code-val { font: 800 34px/1 var(--f-mono); letter-spacing: .18em; color: var(--gold-hi); }

.waiting, .pay-wait { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-2); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--gold); flex: none; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: .35; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.1); box-shadow: 0 0 12px var(--gold); } }

.howto { margin: 16px 4px 0; padding: 0 0 0 20px; color: var(--muted); font-size: 14px; display: grid; gap: 8px; }
.howto b { color: var(--text-2); }

/* ---------- вкладки */
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.tab { appearance: none; border: 0; background: transparent; cursor: pointer; border-radius: 10px; padding: 10px 8px; font-weight: 700; font-size: 14px; color: var(--muted); transition: background .25s, color .25s; }
.tab.is-active { background: var(--surface-3); color: var(--text); box-shadow: inset 0 1px 0 #FFFFFF12; }
.tab:disabled { cursor: default; }
.badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: var(--gold); color: var(--on-gold); font-size: 12px; font-weight: 800; }

/* ---------- колесо */
.wheel-wrap { position: relative; display: grid; place-items: center; padding: 22px 0 6px; }
.wheel-wrap::before {
  content: ""; position: absolute; width: min(100%, 420px); aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(closest-side, #E2AE4A33, transparent 72%); filter: blur(8px); pointer-events: none;
}
.wheel { position: relative; width: min(88vw, 380px); aspect-ratio: 1; }
.rotor { position: absolute; inset: 0; will-change: transform; }
.rotor svg, .frame { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.frame { pointer-events: none; }
.pointer { position: absolute; left: 50%; top: -14px; width: 40px; height: 52px; transform: translateX(-50%); filter: drop-shadow(0 6px 8px #000A); z-index: 2; transform-origin: 50% 30%; }
.wheel.is-spinning .pointer { animation: wiggle .12s ease-in-out infinite alternate; }
@keyframes wiggle { from { transform: translateX(-50%) rotate(-5deg); } to { transform: translateX(-50%) rotate(4deg); } }
.bulb { fill: #FFE6A8; opacity: .35; }
.wheel.is-spinning .bulb { animation: bulbs .5s steps(2) infinite; }
.wheel.is-spinning .bulb:nth-child(even) { animation-delay: .25s; }
@keyframes bulbs { 0% { opacity: .25; } 50% { opacity: 1; } }
.sector-label { font-family: var(--f-body); font-weight: 800; letter-spacing: .01em; }

.bonus { margin: 6px 0 0; text-align: center; font-size: 14px; color: var(--text-2); padding: 10px 12px; border-radius: 12px; background: #E2AE4A14; border: 1px solid #E2AE4A40; }
.bonus b { color: var(--gold-hi); }

.actions { display: grid; gap: 10px; margin-top: 14px; }
.pay-wait { margin-top: 12px; padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line-2); }

/* ---------- списки */
.section-title { margin: 26px 2px 10px; font: 700 12px var(--f-body); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.prizes { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.prize { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; font-weight: 700; line-height: 1.25; min-width: 0; }
.prize .ico { color: var(--gold); }
.prize.is-super { grid-column: 1 / -1; background: linear-gradient(135deg, #E2AE4A26, #E2AE4A0A); border-color: #E2AE4A66; }
.prize.is-super::after { content: "супер"; margin-left: auto; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--on-gold); background: var(--gold); padding: 2px 6px; border-radius: 6px; flex: none; }
.prize span { min-width: 0; overflow-wrap: break-word; hyphens: auto; }

.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.feed li { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; }
.feed .who { font-weight: 700; color: var(--text); max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed .what { color: var(--text-2); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed .when { color: var(--muted); font-size: 12px; flex: none; }
.feed li.is-super .what { color: var(--gold-hi); font-weight: 700; }
.feed .empty { justify-content: center; color: var(--muted); }
.foot { margin: 18px 0 0; text-align: center; font-size: 12px; }

/* ---------- шторка оплаты */
.sheet-backdrop, .modal-backdrop { position: fixed; inset: 0; z-index: 20; background: #000B; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); animation: fade .25s both; }
@keyframes fade { from { opacity: 0; } }
.sheet-backdrop { display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  width: 100%; max-width: 480px; padding: 10px 18px calc(18px + var(--safe-b));
  background: var(--surface-2); border: 1px solid var(--line-2); border-bottom: 0; border-radius: 24px 24px 0 0;
  display: flex; flex-direction: column; gap: 12px; animation: sheetUp .38s var(--ease-out) both;
}
@keyframes sheetUp { from { transform: translateY(100%); } }
.sheet p { margin: 0; }
.sheet-grip { width: 40px; height: 4px; border-radius: 4px; background: var(--line-2); margin: 0 auto 6px; }
.qty { display: flex; align-items: center; justify-content: center; gap: 18px; padding: 6px 0; }
.qty-btn { width: 48px; height: 48px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--surface); font-size: 24px; cursor: pointer; }
.qty-btn:disabled { opacity: .35; cursor: default; }
.qty-val { min-width: 72px; text-align: center; font: 800 30px/1 var(--f-body); }
.qty-val small { display: block; margin-top: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.field { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.field input {
  width: 100%; padding: 14px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--bg-2);
  color: var(--text); font: 600 16px var(--f-body); outline: none;
}
.field input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px #E2AE4A33; }

/* ---------- результат */
.modal-backdrop { display: grid; place-items: center; padding: 20px; }
.modal {
  width: 100%; max-width: 360px; text-align: center; padding: 26px 20px 20px; border-radius: 26px;
  background: radial-gradient(120% 80% at 50% 0%, #E2AE4A2E, transparent 60%), var(--surface-2);
  border: 1px solid #E2AE4A55; box-shadow: 0 30px 90px #000C, 0 0 0 1px #0006;
  display: flex; flex-direction: column; align-items: center; gap: 10px; animation: pop .5s var(--spring) both;
}
@keyframes pop { from { opacity: 0; transform: scale(.85); } }
.modal p { margin: 0 0 6px; }
.res-kicker { font-size: 12px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); }
.modal.is-super .res-kicker { color: var(--on-gold); background: linear-gradient(90deg, var(--gold-hi), var(--gold)); padding: 4px 10px; border-radius: 8px; }
.res-icon { width: 84px; height: 84px; border-radius: 24px; display: grid; place-items: center; background: #E2AE4A1A; border: 1px solid #E2AE4A55; color: var(--gold-hi); margin: 4px 0; }
.res-icon .ico { width: 46px; height: 46px; stroke-width: 1.5; }
.modal.is-super .res-icon { background: linear-gradient(180deg, var(--gold-hi), var(--gold-dk)); color: var(--on-gold); box-shadow: 0 0 40px #E2AE4A80; }
.modal h2 { font-size: 28px; }

#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 30; }

.toast {
  position: fixed; left: 50%; bottom: calc(22px + var(--safe-b)); transform: translateX(-50%); z-index: 40;
  max-width: calc(100% - 32px); padding: 12px 16px; border-radius: 14px; background: var(--surface-3); border: 1px solid var(--line-2);
  box-shadow: 0 12px 40px #000A; font-size: 14px; font-weight: 600; animation: toastIn .3s var(--ease-out) both;
}
.toast.is-error { border-color: #FF8F8666; color: var(--red); }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
