html, body { height: 100%; }
body { background: radial-gradient(500px 360px at 90% -5%, #262b80 0%, transparent 65%), radial-gradient(400px 300px at -20% 50%, #151852 0%, transparent 70%), var(--night); overscroll-behavior: none; }
.stars { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; opacity: .8; }
.app { position: relative; z-index: 1; max-width: 480px; margin: 0 auto; min-height: 100%; padding: 0 16px calc(96px + env(safe-area-inset-bottom)); }
.app.tg { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }

.screen { display: none; animation: scrIn .45s var(--ease) both; }
.app[data-screen="home"] [data-name="home"], .app[data-screen="confirm"] [data-name="confirm"], .app[data-screen="flight"] [data-name="flight"], .app[data-screen="done"] [data-name="done"], .app[data-screen="history"] [data-name="history"], .app[data-screen="doc"] [data-name="doc"] { display: block; }
@keyframes scrIn { from { opacity: 0; transform: translateY(12px); } }

/* top */
.top { display: flex; align-items: center; justify-content: space-between; padding: 14px 0 6px; }
.brand { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.brand img { width: 30px; height: auto; filter: drop-shadow(0 0 8px rgba(140,153,255,.5)); }
.icon-btn { width: 40px; height: 40px; border-radius: 14px; border: 1px solid var(--line-2); background: rgba(30,34,99,.5); display: grid; place-items: center; color: var(--lav); }
.icon-btn svg { width: 20px; }

/* hello */
.hello { position: relative; padding: 18px 0 22px; min-height: 168px; }
.hello-astro { position: absolute; right: -8px; top: -6px; width: 118px; animation: float 6s var(--ease) infinite; filter: drop-shadow(0 16px 20px rgba(0,0,0,.5)); }
.hello-k { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 11px; color: var(--lav); text-transform: uppercase; letter-spacing: .12em; }
.hello-k .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); animation: blink 2s infinite; }
.hello h1 { font-family: var(--f-display); font-size: 32px; line-height: 1.02; font-weight: 800; letter-spacing: -.02em; margin: 0; }
.hello h1 span { font-weight: 300; color: var(--lav); }

/* card */
.card { position: relative; border-radius: 26px; padding: 18px 16px 16px; }
.card::before { content: ""; position: absolute; left: 26px; right: 26px; top: -1px; height: 2px; border-radius: 2px; background: linear-gradient(90deg, transparent, var(--ion), transparent); box-shadow: 0 0 14px var(--ion); }
.lbl { display: block; font-size: 12.5px; font-weight: 600; color: var(--on-pearl-2); margin-bottom: 6px; }
.box { display: flex; align-items: center; height: 50px; border-radius: 14px; background: #fff; box-shadow: inset 0 0 0 1px #d4d7f3; }
.box:focus-within { box-shadow: inset 0 0 0 2px var(--peri), 0 0 0 4px rgba(140,153,255,.18); }
.box input { flex: 1; min-width: 0; height: 100%; padding: 0 14px; border: 0; background: none; outline: none; font-size: 16px; font-weight: 500; color: var(--on-pearl); }
.box input::placeholder { color: #a6aad0; font-weight: 400; }
.lstate { padding-right: 12px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.lstate[data-s="ok"] { color: #13a36f; } .lstate[data-s="bad"] { color: #d6365a; }
.lstate[data-s="wait"]::after { content: ""; display: inline-block; width: 13px; height: 13px; border: 2px solid #c4c8ec; border-top-color: var(--royal); border-radius: 50%; animation: spin .8s linear infinite; }
.saved { display: flex; gap: 6px; margin: 8px 0 0; overflow-x: auto; scrollbar-width: none; }
.saved:empty { display: none; }
.saved button { flex: 0 0 auto; border: 0; padding: 5px 10px; border-radius: 99px; font-family: var(--f-mono); font-size: 12px; background: #e3e6fb; color: var(--royal); }

.seg { display: flex; padding: 4px; margin: 14px 0 6px; border-radius: 13px; background: #dfe2fa; }
.seg button { flex: 1; border: 0; background: none; padding: 8px 6px; border-radius: 10px; font-size: 13px; font-weight: 600; color: var(--on-pearl-2); transition: .2s; }
.seg button[aria-checked="true"] { background: #fff; color: var(--on-pearl); box-shadow: 0 2px 8px -2px rgba(18,20,58,.2); }

.amount-row { display: flex; align-items: center; gap: 10px; }
.readout { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 6px; }
.readout input { width: 100%; min-width: 0; border: 0; background: none; outline: none; padding: 0; font-family: var(--f-display); font-weight: 700; font-size: 44px; letter-spacing: -.03em; color: var(--on-pearl); font-variant-numeric: tabular-nums; }
.readout span { font-family: var(--f-display); font-weight: 300; font-size: 28px; color: var(--royal); }
.mode { flex: 0 0 auto; display: flex; align-items: center; gap: 4px; border: 1px solid #cfd3f2; background: #fff; border-radius: 99px; padding: 7px 10px 7px 12px; font-size: 12.5px; font-weight: 600; color: var(--royal); }
.mode svg { width: 15px; }

.fuel { position: relative; height: 30px; margin: 2px 0 8px; }
.fuel input { -webkit-appearance: none; appearance: none; width: 100%; height: 30px; margin: 0; background: none; --p: 40%; }
.fuel input::-webkit-slider-runnable-track { height: 7px; border-radius: 7px; background: linear-gradient(90deg, var(--royal), var(--peri) var(--p), #d7daf5 var(--p)); }
.fuel input::-moz-range-track { height: 7px; border-radius: 7px; background: linear-gradient(90deg, var(--royal), var(--peri) var(--p), #d7daf5 var(--p)); }
.fuel input::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; margin-top: -9.5px; border-radius: 50%; background: radial-gradient(circle, var(--ion) 0 4px, #fff 5px); box-shadow: 0 0 0 1px #cfd3f2, 0 4px 12px rgba(18,20,58,.25), 0 0 14px rgba(95,224,255,.6); }
.fuel input::-moz-range-thumb { width: 26px; height: 26px; border: 0; border-radius: 50%; background: radial-gradient(circle, var(--ion) 0 4px, #fff 5px); }

.chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.chips button { border: 1px solid #d0d4f2; background: rgba(255,255,255,.7); padding: 8px 2px; border-radius: 12px; font-size: 12.5px; font-weight: 600; color: var(--on-pearl); white-space: nowrap; transition: .15s; }
.chips button[aria-pressed="true"] { background: var(--on-pearl); border-color: var(--on-pearl); color: #fff; }

.sum { position: relative; display: grid; grid-template-columns: 1fr 1fr; margin: 16px -16px 0; padding: 14px 24px 0; border-top: 1.5px dashed #c6cbef; }
.sum::before, .sum::after { content: ""; position: absolute; top: -6px; width: 10px; height: 10px; border-radius: 50%; background: #cfd3f1; box-shadow: inset 0 1px 2px rgba(18,20,58,.25); }
.sum::before { left: 6px; } .sum::after { right: 6px; }
.sum div { display: flex; flex-direction: column; }
.sum span { font-size: 12px; color: var(--on-pearl-2); }
.sum b { font-family: var(--f-display); font-size: 20px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.sum div:first-child b { color: var(--royal); }
.note { margin: 8px 8px 0; font-size: 10.5px; color: var(--on-pearl-2); }
.note.err { color: #d6365a; }

.seg[hidden] + .amount-row { margin-top: 14px; }
.perks { list-style: none; margin: 18px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: 11px; color: var(--text-2); }
.perks li { display: flex; align-items: center; gap: 6px; }
.perks i { width: 5px; height: 5px; border-radius: 50%; background: var(--ion); box-shadow: 0 0 6px var(--ion); }

/* confirm */
.scr-title { font-family: var(--f-display); font-size: 24px; margin: 20px 0 18px; }
.pass { position: relative; border-radius: 24px; overflow: hidden; background: linear-gradient(165deg, #f4f5ff, #e1e4fb); color: var(--on-pearl); box-shadow: 0 30px 60px -20px rgba(0,0,0,.6); }
.pass-top { display: flex; align-items: center; justify-content: space-between; padding: 22px 20px 20px; background: linear-gradient(135deg, #2b3db0, #6d7cf0 70%, #8c99ff); color: #fff; }
.pass-top span { font-size: 10px; text-transform: uppercase; opacity: .75; letter-spacing: .14em; }
.pass-top b { display: block; font-family: var(--f-display); font-size: 26px; line-height: 1.1; }
.pass-top small { font-size: 11.5px; opacity: .8; }
.pass-top .r { text-align: right; }
.pass-arc { width: 90px; color: rgba(255,255,255,.7); }
.pass-cut { position: relative; height: 0; border-top: 1.5px dashed #c6cbef; margin: 0 16px; }
.pass-cut::before, .pass-cut::after { content: ""; position: absolute; top: -11px; width: 22px; height: 22px; border-radius: 50%; background: var(--night); }
.pass-cut::before { left: -27px; } .pass-cut::after { right: -27px; }
.pass-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 0; padding: 20px; }
.pass-grid dt { font-size: 11px; color: var(--on-pearl-2); text-transform: uppercase; letter-spacing: .1em; font-family: var(--f-mono); }
.pass-grid dd { margin: 3px 0 0; font-weight: 700; font-size: 17px; word-break: break-all; }
.pass-grid .hl { font-family: var(--f-display); font-size: 22px; color: var(--royal); }
.barcode { height: 46px; margin: 0 20px 20px; opacity: .8; background: repeating-linear-gradient(90deg, var(--on-pearl) 0 2px, transparent 2px 4px, var(--on-pearl) 4px 5px, transparent 5px 9px, var(--on-pearl) 9px 12px, transparent 12px 14px); border-radius: 3px; }
.fine { font-size: 13px; color: var(--text-2); margin: 16px 4px; }

/* flight */
.stage { position: relative; height: 340px; margin: 18px 0 6px; }
.stage::before { content: ""; position: absolute; left: 50%; top: 52%; width: 280px; height: 280px; transform: translate(-50%, -50%); border-radius: 50%; background: radial-gradient(circle, rgba(140,153,255,.35), transparent 65%); }
.stage img { position: absolute; inset: 0; margin: auto; height: 100%; width: auto; opacity: 0; transform: translateY(8px) scale(.98); transition: opacity .55s var(--ease), transform .55s var(--ease); }
.stage[data-phase="1"] [data-p="1"], .stage[data-phase="2"] [data-p="2"], .stage[data-phase="3"] [data-p="3"], .stage[data-phase="4"] [data-p="4"] { opacity: 1; transform: none; }
.ring { position: absolute; left: 14%; bottom: 25%; width: 80px; height: 80px; border-radius: 50%; border: 2px solid var(--ion); opacity: 0; }
.stage[data-phase="3"] .ring { animation: pulse 1.3s var(--ease) infinite; } .stage[data-phase="3"] .r2 { animation-delay: .45s; }
.fl-id { text-align: center; margin: 0; font-size: 11.5px; color: var(--ion); letter-spacing: .14em; }
.fl-title { text-align: center; font-family: var(--f-display); font-size: 24px; margin: 6px 0 16px; }
.progress { height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; margin: 0 8px 18px; }
.progress i { display: block; height: 100%; width: 10%; border-radius: 4px; background: linear-gradient(90deg, var(--peri), var(--ion)); box-shadow: 0 0 10px var(--ion); transition: width .8s var(--ease); }
.seq { list-style: none; margin: 0; padding: 0 8px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; font-size: 10px; text-align: center; color: var(--text-3); }
.seq li { transition: color .3s; }
.seq li.on { color: var(--text); }
.demo { text-align: center; font-size: 10.5px; color: var(--text-3); margin-top: 18px; }

/* done */
.done-burst { position: relative; height: 300px; margin-top: 20px; }
.done-burst::before { content: ""; position: absolute; inset: 0; margin: auto; width: 300px; height: 300px; border-radius: 50%; background: conic-gradient(from 0deg, transparent, rgba(95,224,255,.25), transparent 30%, rgba(140,153,255,.3), transparent 60%, rgba(143,91,255,.25), transparent 90%); animation: spin 12s linear infinite; filter: blur(6px); }
.done-burst img { position: relative; height: 100%; width: auto; margin: 0 auto; animation: pop .7s var(--spring) both; }
@keyframes pop { from { transform: scale(.85) translateY(20px); opacity: 0; } }
.done-title { text-align: center; font-family: var(--f-display); font-size: 30px; margin: 4px 0 8px; }
.done-sum { text-align: center; margin: 0; color: var(--text-2); font-size: 15px; }
.done-sum b { color: var(--text); font-size: 17px; }
.done-sum span { font-family: var(--f-mono); color: var(--lav); }
.done-meta { display: flex; justify-content: center; gap: 18px; margin: 18px 0 26px; font-size: 11px; color: var(--text-3); }
.done-meta b { color: var(--ok); font-weight: 500; }
.ghost { display: block; margin: 0 auto; padding: 12px 22px; border-radius: 14px; border: 1px solid var(--line-2); background: rgba(30,34,99,.5); font-weight: 600; color: var(--text); }

/* history */
.hist { display: flex; flex-direction: column; gap: 8px; }
.h-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 14px 16px; border-radius: 18px; background: rgba(30,34,99,.5); border: 1px solid var(--line); }
.h-row .l { font-family: var(--f-mono); font-size: 13px; color: var(--frost); }
.h-row .g { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.h-row .m { font-family: var(--f-mono); font-size: 11px; color: var(--text-3); }
.h-row .s { font-family: var(--f-mono); font-size: 11px; text-align: right; color: var(--warn); }
.h-row .s.done { color: var(--ok); }
.empty { text-align: center; padding: 30px 0; color: var(--text-2); }
.empty img { width: 90px; margin: 0 auto 16px; opacity: .9; }

/* fallback main button */
.mb-wrap { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(180deg, transparent, var(--night) 40%); }
.mb { display: block; width: 100%; max-width: 448px; margin: 0 auto; height: 54px; border: 0; border-radius: 16px; font-weight: 700; font-size: 16px; color: #fff; background: linear-gradient(135deg, #2b3db0, #4a5ee0 45%, #8c99ff); box-shadow: 0 12px 26px -10px rgba(54,81,191,.9), inset 0 1px 0 rgba(255,255,255,.35); }
.mb:disabled { filter: grayscale(.7) brightness(.8); }

.toast { position: fixed; left: 50%; top: 14px; z-index: 20; transform: translate(-50%, -80px); padding: 10px 16px; border-radius: 12px; background: var(--deep); border: 1px solid var(--line-2); font-size: 13px; transition: transform .35s var(--spring); }
.toast.on { transform: translate(-50%, 0); }
.back { margin-top: 14px; padding: 6px 0; border: 0; background: none; color: var(--lav); font-size: 14px; font-weight: 600; }
.back + .scr-title { margin-top: 6px; }

/* Links to the legal pages on the payment screen */
.fine a { color: var(--ion); }

/* Legal documents inside the mini app */
.doc-links { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 20px 4px 0; font-size: 12px; }
.doc-links a { color: var(--text-2); }
.doc-body { font-size: 15px; line-height: 1.55; color: var(--text); overflow-wrap: anywhere; }
.doc-body h1 { font-family: var(--f-display); font-weight: 500; font-size: 22px; line-height: 1.25; margin: 12px 0 6px; }
.doc-body h2 { font-size: 17px; font-weight: 600; margin: 26px 0 6px; }
.doc-body p { margin: 0 0 10px; }
.doc-body ul { margin: 0 0 10px; padding-left: 20px; }
.doc-body li { margin-bottom: 4px; }
.doc-body a { color: var(--ion); }
.doc-body .updated { color: var(--text-2); font-size: 13px; }
