:root {
  --bg: #0c0908;
  --surface: #17110e;
  --surface-2: #211610;
  --line: rgba(255, 255, 255, 0.09);
  --text: #fff8ef;
  --muted: #a89c92;
  --orange: #ff7a1a;
  --gold: #ffb249;
  --green: #61d889;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { background: var(--bg); scroll-behavior: smooth; }
body { min-width: 300px; margin: 0; background: var(--bg); color: var(--text); }
button { font: inherit; }
button, [role="button"] { -webkit-tap-highlight-color: transparent; }

.app-shell { width: min(100%, 520px); min-height: 100dvh; margin: 0 auto; background: var(--bg); }
.topbar { position: sticky; z-index: 20; top: 0; display: flex; height: 64px; align-items: center; justify-content: space-between; padding: 9px 16px; border-bottom: 1px solid var(--line); background: rgba(12, 9, 8, 0.96); }
.brand { display: flex; align-items: center; gap: 10px; padding: 0; border: 0; background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.brand__logo { display: grid; width: 38px; height: 38px; place-items: center; border: 1px solid rgba(255, 138, 43, 0.55); border-radius: 13px; background: linear-gradient(145deg, #352016, #15100d); color: var(--gold); font-family: Georgia, serif; font-size: 19px; box-shadow: 0 0 14px rgba(255, 106, 20, 0.12); }
.brand > span:last-child { display: grid; gap: 3px; }
.brand strong { font-size: 13px; letter-spacing: -0.02em; }
.brand small { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 8px; }
.brand small i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 7px rgba(97, 216, 137, 0.7); }
.network-badge { padding: 7px 9px; border: 1px solid var(--line); border-radius: 999px; color: #d7c9bc; font-size: 8px; font-weight: 750; letter-spacing: 0.08em; }

.user-card { display: flex; min-width: 0; align-items: center; gap: 10px; padding: 0; border: 0; background: transparent; color: var(--text); text-align: left; }
.user-card__avatar { display: grid; width: 40px; height: 40px; flex: 0 0 auto; place-items: center; border: 1px solid rgba(255,122,26,.5); border-radius: 50%; background: #2b1a12 center/cover; color: var(--gold); font-weight: 850; }
.user-card__avatar--photo { color: transparent; }
.user-card > span:last-child { display: grid; min-width: 0; gap: 3px; }
.user-card strong { max-width: 210px; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.user-card small { color: var(--muted); font-size: 8px; }
.system-dot { display: flex; align-items: center; gap: 5px; color: #b6efc8; font-size: 7px; font-weight: 850; letter-spacing: .08em; }
.system-dot i, .system-status i { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: var(--green); box-shadow: 0 0 9px rgba(97,216,137,.85); }

main { padding: 12px 12px calc(90px + var(--safe-bottom)); }
.page { display: none; }
.page--active { display: block; animation: page-in 0.24s ease-out both; }
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } }

.system-status { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; padding: 10px 12px; border: 1px solid rgba(97,216,137,.18); border-radius: 14px; background: rgba(97,216,137,.07); color: #d8f4e1; font-size: 9px; line-height: 1.35; }
.payment-cta { position: relative; display: grid; width: 100%; gap: 4px; margin-bottom: 12px; padding: 17px 48px 17px 18px; border: 1px solid rgba(255,80,60,.55); border-radius: 18px; background: linear-gradient(135deg,#ff4b35,#c51f1a); box-shadow: 0 10px 30px rgba(211,40,28,.24); color: #fff; text-align: left; }
.payment-cta small { font-size: 7px; font-weight: 850; letter-spacing: .13em; opacity: .78; }
.payment-cta strong { font-size: 18px; letter-spacing: -.03em; }
.payment-cta > span { position: absolute; top: 50%; right: 20px; font-size: 22px; transform: translateY(-50%); }

.concert { position: relative; min-height: 510px; overflow: hidden; border: 1px solid rgba(255, 140, 52, 0.18); border-radius: 28px; background: #080706; box-shadow: 0 18px 45px rgba(0, 0, 0, 0.35); isolation: isolate; }
.concert--compact { min-height: 300px; }
.concert--compact::after { background: linear-gradient(180deg,transparent 58%,rgba(8,5,4,.84)); }
.concert--compact .performer { top: 14px; width: min(66%,250px); }
.concert__phrase { position: absolute; z-index: 7; right: 16px; bottom: 13px; left: 16px; margin: 0; color: #fff5eb; font-size: 13px; font-weight: 850; text-align: center; text-shadow: 0 2px 10px #000; }
.concert::after { content: ""; position: absolute; z-index: 5; inset: 0; background: linear-gradient(180deg, transparent 44%, rgba(8, 5, 4, 0.62) 68%, rgba(8, 5, 4, 0.98)); pointer-events: none; }
.concert__stage { position: absolute; z-index: -2; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; }
.beam { position: absolute; z-index: -1; top: -15%; width: 28%; height: 85%; border-radius: 50%; background: linear-gradient(180deg, rgba(255, 169, 79, 0.42), rgba(255, 112, 19, 0.06) 65%, transparent); filter: blur(8px); transform-origin: 50% 0; opacity: 0.55; animation: beam-sway 7s ease-in-out infinite alternate; }
.beam--one { left: 9%; transform: rotate(-12deg); }
.beam--two { left: 37%; background: linear-gradient(180deg, rgba(255, 255, 255, 0.25), rgba(255, 173, 92, 0.04) 65%, transparent); animation-delay: -2.2s; }
.beam--three { right: 5%; transform: rotate(14deg); animation-delay: -4s; }
@keyframes beam-sway { to { transform: rotate(10deg) translateX(12px); opacity: 0.72; } }

.particles { position: absolute; z-index: 2; inset: 0; overflow: hidden; pointer-events: none; }
.particles i { position: absolute; bottom: 18%; width: 3px; height: 12px; border-radius: 999px; background: #ff9a3e; box-shadow: 0 0 7px #ff6c16; opacity: 0; animation: particle-up 5.5s linear infinite; }
.particles i:nth-child(1) { left: 13%; animation-delay: -1s; }
.particles i:nth-child(2) { left: 28%; animation-delay: -3.3s; animation-duration: 6.5s; }
.particles i:nth-child(3) { left: 47%; animation-delay: -4.6s; }
.particles i:nth-child(4) { left: 66%; animation-delay: -2.1s; animation-duration: 7s; }
.particles i:nth-child(5) { left: 81%; animation-delay: -5.1s; }
.particles i:nth-child(6) { left: 91%; animation-delay: -0.3s; animation-duration: 6.2s; }
@keyframes particle-up { 0% { opacity: 0; transform: translateY(0) rotate(20deg); } 15% { opacity: 0.8; } 100% { opacity: 0; transform: translateY(-360px) rotate(20deg); } }

.performer { position: absolute; z-index: 3; top: 66px; left: 50%; width: min(84%, 390px); aspect-ratio: 1; transform: translateX(-50%); filter: drop-shadow(0 14px 18px rgba(0, 0, 0, 0.65)); }
.performer__frame { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; animation: concert-frame 2s step-end infinite; }
.performer__frame--1 { animation-delay: 0s; }
.performer__frame--2 { animation-delay: -1s; }
.performer__frame--3 { animation-delay: -1.6s; }
.performer__frame--4 { animation-delay: -0.8s; }
@keyframes concert-frame { 0%, 49.9% { opacity: 1; transform: translateY(0); } 50%, 100% { opacity: 0; transform: translateY(-3px); } }

.concert__copy { position: absolute; z-index: 6; right: 22px; bottom: 22px; left: 22px; }
.concert__copy > span, .page-heading > span, .section-title small, .status-card small, .reward-card small, .plan small { color: var(--gold); font-size: 8px; font-weight: 800; letter-spacing: 0.14em; }
.concert__copy h1 { margin: 7px 0 8px; font-size: clamp(37px, 11vw, 55px); line-height: 0.88; letter-spacing: -0.065em; }
.concert__copy h1 em { color: #ff8a2e; font-family: Georgia, serif; font-weight: 500; }
.concert__copy p { margin: 0; color: #d5c9bd; font-size: 11px; }

.status-card, .section-block, .reward-card, .safe-payment { margin-top: 12px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); }
.status-card { padding: 18px; background: linear-gradient(145deg, #21140e, #120f0d); }
.status-card__head { display: flex; align-items: center; justify-content: space-between; }
.status-card h2, .section-title h2, .reward-card h2 { margin: 5px 0 0; font-size: 19px; letter-spacing: -0.04em; }
.status-card__days { display: grid; width: 58px; height: 58px; place-items: center; border: 2px solid rgba(255, 132, 40, 0.6); border-radius: 50%; color: white; font-size: 20px; line-height: 1; box-shadow: inset 0 0 0 5px rgba(255, 122, 26, 0.06); }
.status-card__days small { color: #d5c1b1; font-size: 7px; letter-spacing: 0; }
.status-line { height: 4px; margin: 16px 0 12px; overflow: hidden; border-radius: 99px; background: #33261f; }
.status-line i { display: block; width: 72%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--orange), var(--gold)); }
.status-card__foot { display: flex; align-items: center; justify-content: space-between; }
.status-card__foot > span { display: flex; align-items: center; gap: 6px; color: #cbbfb6; font-size: 9px; }
.status-card__foot > span i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.status-card__foot > span i.is-inactive { background: #81766e; box-shadow: none; }
.status-card__foot b { font-weight: 600; }
.status-card__foot button { padding: 8px 12px; border: 0; border-radius: 11px; background: #f6eee6; color: #1b110c; font-size: 9px; font-weight: 800; cursor: pointer; }
.card-copy { margin: 13px 0; color: var(--muted); font-size: 9px; line-height: 1.45; }

.section-block { padding: 18px; }
.section-title { display: flex; align-items: end; justify-content: space-between; margin-bottom: 13px; }
.section-title > span { color: var(--gold); font-size: 10px; font-weight: 800; }
.device-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.device-grid article { display: flex; min-width: 0; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 16px; background: #100d0b; }
.device-grid article > span { display: grid; width: 32px; height: 32px; flex: 0 0 auto; place-items: center; border-radius: 10px; background: rgba(255, 122, 26, 0.1); color: var(--gold); font-size: 18px; }
.device-grid article div { display: grid; min-width: 0; gap: 3px; }
.device-grid strong { overflow: hidden; font-size: 10px; text-overflow: ellipsis; }
.device-grid small { overflow: hidden; color: var(--muted); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.main-button { width: 100%; margin-top: 10px; padding: 13px; border: 0; border-radius: 14px; background: linear-gradient(135deg, #ff9b43, #f1641f); color: #1b0d05; font-size: 10px; font-weight: 850; cursor: pointer; }
.main-button:active, .plan button:active, .game-overlay button:active { transform: scale(0.98); }

.device-list { display: grid; gap: 7px; }
.device-list article { display: grid; gap: 3px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 13px; background: #100d0b; }
.device-list strong { font-size: 10px; }
.device-list small, .empty-state { margin: 0; color: var(--muted); font-size: 8px; line-height: 1.4; }

.mini-banner { position: relative; display: grid; grid-template-columns: 70px 1fr auto; align-items: center; gap: 10px; margin-top: 12px; overflow: hidden; padding: 12px 15px 12px 8px; border: 1px solid rgba(255, 135, 41, 0.38); border-radius: 20px; background: linear-gradient(120deg, #361a0d, #120e0c); box-shadow: inset 0 0 26px rgba(255,105,25,.05); cursor: pointer; animation: banner-pulse 3s ease-in-out infinite; }
.mini-banner__runner { width: 70px; height: 72px; overflow: hidden; }
.mini-banner__runner img { width: 100%; height: 100%; object-fit: contain; animation: runner-bob .7s ease-in-out infinite alternate; }
.mini-banner div { display: grid; gap: 5px; }
.mini-banner small { color: var(--orange); font-size: 8px; font-weight: 800; letter-spacing: 0.12em; }
.mini-banner strong { font-size: 12px; }
.mini-banner span { color: var(--muted); font-size: 8px; }
.mini-banner > b { color: var(--gold); font-size: 18px; }
@keyframes runner-bob { to { transform: translateY(-3px) rotate(-1deg); } }
@keyframes banner-pulse { 50% { border-color: rgba(255,135,41,.62); } }

.page-heading { padding: 25px 8px 14px; }
.page-heading h1 { margin: 7px 0 8px; font-size: 36px; line-height: 0.95; letter-spacing: -0.06em; }
.page-heading p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.45; }

.game-machine { position: relative; overflow: hidden; border: 1px solid rgba(255, 139, 54, 0.22); border-radius: 22px; background: #111; }
.game-hud { position: absolute; z-index: 5; top: 10px; right: 10px; left: 10px; display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; pointer-events: none; }
.game-hud > div { display: grid; gap: 2px; padding: 7px 9px; border: 1px solid rgba(255,255,255,0.13); border-radius: 10px; background: rgba(7, 7, 8, 0.72); }
.game-hud small { color: #a89f97; font-size: 6px; letter-spacing: 0.1em; }
.game-hud strong { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.game-hud .game-phase { display: flex; align-items: center; justify-content: center; gap: 4px; padding-inline: 10px; }
.game-phase i { color: var(--gold); font-size: 12px; font-style: normal; }
.game-phase span { font-size: 7px; }
#game-canvas { display: block; width: 100%; height: auto; min-height: 245px; touch-action: manipulation; }
.game-overlay { position: absolute; z-index: 7; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 60px 24px 24px; background: rgba(7, 7, 8, 0.78); color: white; text-align: center; transition: opacity 0.22s; }
.game-overlay--hidden { visibility: hidden; opacity: 0; pointer-events: none; }
.game-overlay > span { color: var(--gold); font-size: 8px; font-weight: 800; letter-spacing: 0.12em; }
.game-overlay h2 { margin: 7px 0; font-size: 24px; letter-spacing: -0.04em; }
.game-overlay p { max-width: 280px; margin: 0; color: #c3bab3; font-size: 10px; line-height: 1.4; }
.game-overlay button { min-width: 145px; margin-top: 14px; padding: 12px 18px; border: 0; border-radius: 13px; background: linear-gradient(135deg, #ff9b43, #f1641f); color: #1b0d05; font-size: 10px; font-weight: 850; cursor: pointer; }
.game-overlay .game-claim { background: #fff5ec; }
.game-tap-hint { position: absolute; z-index: 6; bottom: 9px; left: 50%; padding: 6px 9px; border-radius: 999px; background: rgba(7, 7, 8, 0.75); color: #f5d1af; font-size: 7px; transform: translateX(-50%); pointer-events: none; transition: opacity 0.2s; }
.game-tap-hint--hidden { opacity: 0; }

.reward-card { padding: 18px; }
.reward-card__head { display: flex; align-items: end; justify-content: space-between; }
.reward-card__head > span { color: var(--gold); font-family: ui-monospace, Consolas, monospace; font-size: 9px; }
.reward-line { height: 5px; margin: 18px 0 12px; overflow: hidden; border-radius: 99px; background: #33261f; }
.reward-line i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--orange), var(--gold)); transition: width 0.25s; }
.reward-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.reward-steps article { display: grid; gap: 3px; padding: 10px; border: 1px solid var(--line); border-radius: 13px; background: #100d0b; }
.reward-steps article.is-unlocked { border-color: rgba(255, 139, 54, 0.45); background: rgba(255, 122, 26, 0.09); }
.reward-steps span { color: #7e746c; font-size: 7px; }
.reward-steps strong { font-size: 11px; }
.reward-steps small { color: var(--muted); font-size: 7px; letter-spacing: 0; }

.leaderboard-card { margin-top: 12px; padding: 18px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); }
.leaderboard-card .section-title button { padding: 7px 9px; border: 1px solid var(--line); border-radius: 10px; background: transparent; color: var(--gold); font-size: 8px; }
.leaderboard { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; counter-reset: place; }
.leaderboard li { display: grid; grid-template-columns: 26px 32px 1fr auto; align-items: center; gap: 8px; padding: 8px; border-radius: 12px; background: #100d0b; counter-increment: place; }
.leaderboard li::before { content: counter(place); color: var(--muted); font-size: 9px; text-align: center; }
.leaderboard li:nth-child(1)::before { content: "🥇"; }
.leaderboard li:nth-child(2)::before { content: "🥈"; }
.leaderboard li:nth-child(3)::before { content: "🥉"; }
.leaderboard__avatar { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 50%; background: #2d1c13 center/cover; color: var(--gold); font-size: 9px; font-weight: 850; }
.leaderboard__name { overflow: hidden; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.leaderboard__score { color: var(--gold); font: 800 9px ui-monospace,Consolas,monospace; }
.own-place { margin: 12px 0 0; color: #d9cfc7; font-size: 9px; }

.plans { display: grid; gap: 10px; }
.plan { position: relative; display: grid; grid-template-columns: 1fr auto; gap: 14px; padding: 18px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); }
.plan--popular { border-color: rgba(255, 132, 40, 0.38); background: linear-gradient(145deg, #29170f, #15100d); }
.plan__tag { position: absolute; top: -7px; right: 14px; padding: 5px 8px; border-radius: 99px; background: var(--orange); color: #1b0b04; font-size: 6px; font-weight: 900; letter-spacing: 0.12em; }
.plan h2 { margin: 5px 0 6px; font-size: 22px; letter-spacing: -0.04em; }
.plan p { margin: 0; color: var(--muted); font-size: 9px; }
.plan__price { display: grid; align-content: center; justify-items: end; gap: 4px; }
.plan__price strong { font-size: 17px; }
.plan__price small { color: #d9a368; font-size: 8px; letter-spacing: 0; }
.plan button { grid-column: 1 / -1; padding: 12px; border: 0; border-radius: 13px; background: #f8efe7; color: #1a100b; font-size: 10px; font-weight: 850; cursor: pointer; }
.plan--popular button { background: linear-gradient(135deg, #ffa34e, #f06a22); }
.safe-payment { display: flex; align-items: center; gap: 12px; padding: 16px; }
.safe-payment > span { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 11px; background: rgba(255, 122, 26, 0.11); color: var(--gold); }
.safe-payment div { display: grid; gap: 4px; }
.safe-payment strong { font-size: 10px; }
.safe-payment small { color: var(--muted); font-size: 8px; }

.payment-sheet[hidden] { display: none; }
.payment-sheet { position: fixed; z-index: 80; inset: 0; display: flex; align-items: flex-end; justify-content: center; padding: 14px; background: rgba(0,0,0,.72); opacity: 0; transition: opacity .18s; }
.payment-sheet--visible { opacity: 1; }
.payment-sheet__card { position: relative; width: min(100%,490px); padding: 22px; border: 1px solid rgba(255,132,40,.32); border-radius: 24px; background: #17110e; transform: translateY(20px); transition: transform .18s; }
.payment-sheet--visible .payment-sheet__card { transform: translateY(0); }
.payment-sheet__close { position: absolute; top: 12px; right: 14px; width: 32px; height: 32px; border: 0; border-radius: 50%; background: #2a211c; color: #fff; font-size: 20px; }
.payment-sheet__card > small { color: var(--gold); font-size: 7px; font-weight: 850; letter-spacing: .13em; }
.payment-sheet__card h2 { margin: 7px 38px 5px 0; font-size: 22px; }
.payment-sheet__card p { margin: 0 0 13px; color: var(--muted); font-size: 9px; }
.payment-methods { display: grid; gap: 8px; }
.payment-methods button { display: flex; justify-content: space-between; padding: 13px 14px; border: 1px solid var(--line); border-radius: 13px; background: #211813; color: #fff; font-size: 10px; text-align: left; }
.payment-methods button:last-child { border-color: rgba(255,132,40,.34); color: var(--gold); }

.bottom-nav { position: fixed; z-index: 30; right: 0; bottom: 0; left: 0; display: grid; width: min(100%, 520px); height: calc(72px + var(--safe-bottom)); grid-template-columns: repeat(3, 1fr); margin: 0 auto; padding: 8px 12px var(--safe-bottom); border-top: 1px solid var(--line); background: rgba(12, 9, 8, 0.97); }
.nav-item { display: grid; gap: 4px; place-items: center; padding: 6px 4px; border: 0; border-radius: 15px; background: transparent; color: #746b64; cursor: pointer; transition: color 0.2s, background 0.2s, transform 0.2s; }
.nav-item svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.nav-item span { font-size: 16px; font-weight: 750; }
.nav-item b { font-size: 8px; font-weight: 750; }
.nav-item--active { background: linear-gradient(145deg, rgba(255, 139, 54, 0.16), rgba(255, 122, 26, 0.04)); color: #ff9a45; transform: translateY(-2px); }
.nav-item--game.nav-item--active { box-shadow: inset 0 0 0 1px rgba(255, 139, 54, 0.18); }

.toast { position: fixed; z-index: 50; top: max(14px, env(safe-area-inset-top)); left: 50%; display: flex; min-width: 220px; align-items: center; gap: 9px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 14px; background: #221a16; box-shadow: 0 12px 35px rgba(0,0,0,0.45); opacity: 0; transform: translate(-50%, -80px); transition: 0.25s; pointer-events: none; }
.toast--visible { opacity: 1; transform: translate(-50%, 0); }
.toast > span { color: var(--green); }
.toast p { margin: 0; font-size: 10px; }

@media (max-width: 370px) {
  .concert { min-height: 470px; }
  .concert--compact { min-height: 280px; }
  .performer { top: 62px; width: 88%; }
  .device-grid { grid-template-columns: 1fr; }
  .page-heading h1 { font-size: 32px; }
}

@media (min-width: 700px) {
  body { padding-block: 14px; }
  .app-shell { min-height: calc(100dvh - 28px); border: 1px solid var(--line); border-radius: 26px; overflow: clip; }
  .topbar { top: 0; }
  .bottom-nav { bottom: 14px; border: 1px solid var(--line); border-radius: 0 0 26px 26px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .performer__frame--1 { opacity: 1; }
}
