:root {
  color-scheme: dark;
  --bg: #071018;
  --surface: #0b1620;
  --surface-strong: #101f2c;
  --text: #eef7ff;
  --muted: #899bab;
  --line: rgba(172, 205, 232, 0.15);
  --accent: #4aa8ff;
  --accent-soft: rgba(74, 168, 255, 0.14);
  --danger: #ff795f;
  --success: #55d99a;
  --nav-height: 82px;
  --max: 720px;
}

* { box-sizing: border-box; }
html { background: var(--bg); scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100svh;
  background:
    radial-gradient(circle at 82% -10%, rgba(74, 168, 255, 0.13), transparent 34rem),
    var(--tg-theme-bg-color, var(--bg));
  color: var(--tg-theme-text-color, var(--text));
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, textarea { font: inherit; }
button { color: inherit; }
.app-shell { width: min(100%, var(--max)); margin: 0 auto; min-height: 100svh; }

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 66px;
  padding: max(10px, env(safe-area-inset-top)) 22px 0;
  background: linear-gradient(180deg, rgba(7, 16, 24, .97) 66%, rgba(7, 16, 24, 0));
  backdrop-filter: blur(16px);
}

.brand { display: inline-flex; gap: 10px; align-items: center; color: inherit; text-decoration: none; font-weight: 820; letter-spacing: -.03em; }
.brand-mark { position: relative; display: grid; place-items: center; width: 26px; aspect-ratio: 1; border: 1px solid rgba(74, 168, 255, .5); border-radius: 50%; }
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; border: 1px solid rgba(74, 168, 255, .2); border-radius: 50%; }
.brand-mark::before { inset: -5px; }
.brand-mark::after { inset: 6px; }
.brand-mark i { width: 5px; aspect-ratio: 1; background: var(--accent); border-radius: 50%; box-shadow: 0 0 14px var(--accent); }
main { padding: 24px 22px calc(var(--nav-height) + 42px); }
.view[hidden] { display: none; }
.view.is-active { animation: view-enter .38s cubic-bezier(.2,.8,.2,1) both; }
.section-heading { max-width: 590px; }
.eyebrow { margin: 0 0 14px; color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 16px; font-size: clamp(36px, 10vw, 58px); line-height: .98; letter-spacing: -.055em; }
h2 { letter-spacing: -.035em; }
.section-heading > p:last-child { max-width: 520px; margin-bottom: 0; color: var(--muted); font-size: 15px; line-height: 1.55; }

.status-workspace { display: grid; grid-template-columns: 1fr; gap: 30px; margin-top: 26px; }
.status-orbit { position: relative; isolation: isolate; display: grid; place-items: center; width: min(72vw, 290px); margin: 0 auto; aspect-ratio: 1; }
.orbit-line { position: absolute; inset: 6%; border: 1px solid rgba(74,168,255,.18); border-radius: 50%; animation: orbit-breathe 4s ease-in-out infinite; }
.orbit-line::before, .orbit-line::after { content: ""; position: absolute; border-radius: 50%; border: 1px solid rgba(74,168,255,.1); }
.orbit-line::before { inset: 16%; }
.orbit-line::after { inset: 34%; background: rgba(74,168,255,.03); }
.orbit-core { position: relative; z-index: 2; width: 61%; overflow: hidden; aspect-ratio: 1; border: 1px solid rgba(126,190,255,.42); border-radius: 50%; background: #07111f; box-shadow: 0 0 0 6px rgba(74,168,255,.04), 0 18px 55px rgba(0,79,163,.28); }
.orbit-core::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(145deg, rgba(255,255,255,.11), transparent 32%, rgba(0,20,45,.12)); pointer-events: none; }
.orbit-core img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.status-badge { position: absolute; z-index: 3; left: 50%; bottom: 3%; display: flex; align-items: center; gap: 9px; min-height: 38px; padding: 9px 15px; border: 1px solid rgba(167,199,226,.2); border-radius: 999px; background: rgba(8,20,30,.88); box-shadow: 0 12px 32px rgba(0,0,0,.34); backdrop-filter: blur(12px); transform: translateX(-50%); white-space: nowrap; }
.status-badge strong { font-size: 14px; letter-spacing: -.01em; }
.status-dot { width: 9px; aspect-ratio: 1; border-radius: 50%; background: var(--danger); box-shadow: 0 0 22px rgba(255,121,95,.66); }
.status-active .status-dot { background: var(--success); box-shadow: 0 0 22px rgba(85,217,154,.68); }
.status-active .orbit-core { border-color: rgba(85,217,154,.48); box-shadow: 0 0 0 6px rgba(85,217,154,.04), 0 18px 55px rgba(0,121,80,.22); }
.status-expired .status-dot, .status-blocked .status-dot { background: var(--danger); }

.facts { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0; border-block: 1px solid var(--line); }
.facts div { padding: 20px 8px; }
.facts div + div { border-left: 1px solid var(--line); }
.facts dt { margin-bottom: 8px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.facts dd { margin: 0; font-size: 18px; font-weight: 750; }

.actions { display: flex; flex-direction: column; gap: 6px; margin-top: 30px; }
.primary-action, .text-action { width: 100%; min-height: 54px; border: 0; border-radius: 15px; cursor: pointer; font-weight: 780; }
.primary-action { background: var(--accent); color: #031422; box-shadow: 0 13px 34px rgba(74,168,255,.18); transition: transform .18s ease, filter .18s ease; }
.primary-action:active { transform: scale(.985); }
.text-action { background: transparent; color: var(--muted); }
.text-action span { color: var(--accent); }

.empty-workspace { min-height: 56svh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.empty-workspace[hidden], .device-list[hidden] { display: none; }
.empty-workspace p { max-width: 390px; color: var(--muted); line-height: 1.55; }
.empty-workspace .primary-action { max-width: 360px; margin-top: 12px; }
.device-glyph { position: relative; width: 78px; height: 112px; margin-bottom: 24px; border: 1px solid rgba(74,168,255,.38); border-radius: 20px; box-shadow: inset 0 0 28px rgba(74,168,255,.07), 0 0 40px rgba(74,168,255,.07); }
.device-glyph::before { content: ""; position: absolute; inset: 10px; border: 1px solid var(--line); border-radius: 13px; }
.device-glyph span { position: absolute; bottom: 7px; left: 50%; width: 4px; aspect-ratio: 1; border-radius: 50%; background: var(--accent); transform: translateX(-50%); }
.device-list { margin-top: 34px; border-top: 1px solid var(--line); }
.device-row { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 20px 0; border-bottom: 1px solid var(--line); }
.device-row-glyph { position: relative; width: 31px; height: 43px; border: 1px solid rgba(74,168,255,.44); border-radius: 8px; box-shadow: inset 0 0 14px rgba(74,168,255,.06); }
.device-row-glyph::after { content: ""; position: absolute; bottom: 4px; left: 50%; width: 3px; aspect-ratio: 1; border-radius: 50%; background: var(--accent); transform: translateX(-50%); }
.device-row > div { min-width: 0; }
.device-row strong { display: block; overflow: hidden; margin-bottom: 5px; font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
.device-row small { color: var(--muted); font-size: 11px; }
.device-row-state { max-width: 118px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .07em; text-align: right; text-transform: uppercase; }
.device-row-state.is-online { color: var(--success); }
.device-row-state.is-created { color: var(--accent); }
.device-row-state.is-seen { color: #8eb5d3; }
.device-row-state.is-unknown { letter-spacing: .03em; text-transform: none; }

.platform-switch { display: flex; gap: 8px; margin: 34px -22px 0; padding: 0 22px 8px; overflow-x: auto; scrollbar-width: none; }
.platform-switch::-webkit-scrollbar { display: none; }
.platform-switch button { flex: 0 0 auto; padding: 10px 15px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--muted); }
.platform-switch button.is-selected { border-color: rgba(74,168,255,.5); background: var(--accent-soft); color: var(--text); }
.platform-panel[hidden] { display: none; }
.platform-panel.is-selected { animation: view-enter .34s cubic-bezier(.2,.8,.2,1) both; }
.download-intro { display: grid; gap: 22px; margin-top: 20px; padding: 26px 0; border-block: 1px solid var(--line); }
.download-intro > div > span { display: block; margin-bottom: 7px; color: var(--accent); font-size: 10px; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.download-intro h2 { margin: 0 0 9px; font-size: 28px; }
.download-intro p { max-width: 470px; margin: 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
.download-action { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 54px; padding: 0 18px; border-radius: 15px; background: var(--accent); box-shadow: 0 13px 34px rgba(74,168,255,.18); color: #031422; font-weight: 800; text-decoration: none; transition: filter .18s ease, transform .18s ease; }
.download-action:active { transform: scale(.985); }
.download-action span { font-size: 18px; }
.alternate-links { display: flex; flex-wrap: wrap; gap: 8px 14px; padding: 17px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.alternate-links > span { color: var(--muted); }
.alternate-links a { color: var(--accent); font-weight: 700; text-decoration: none; }
.steps { margin: 26px 0 0; padding: 0; list-style: none; }
.steps li { display: grid; grid-template-columns: 46px 1fr; padding: 22px 0; border-top: 1px solid var(--line); }
.steps li > span { color: var(--accent); font: 700 11px ui-monospace, SFMono-Regular, Menlo, monospace; }
.steps strong { display: block; margin-bottom: 7px; font-size: 17px; }
.steps p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.setup-next { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 58px; margin-top: 12px; padding: 0 4px; border: 0; border-top: 1px solid var(--line); background: transparent; color: var(--text); font-weight: 800; cursor: pointer; }
.setup-next span { color: var(--accent); font-size: 20px; transition: transform .18s ease; }
.setup-next:active span { transform: translateX(4px); }

.plan-list { margin-top: 34px; border-top: 1px solid var(--line); }
.plan-row { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 20px 4px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; cursor: pointer; }
.plan-row > span:first-child { display: flex; flex-direction: column; gap: 5px; }
.plan-row strong { font-size: 17px; }
.plan-row small { color: var(--muted); }
.plan-price { font-size: 19px; font-weight: 800; transition: color .18s ease, transform .18s ease; }
.plan-row.is-selected .plan-price { color: var(--accent); transform: translateX(-4px); }
.payment-route { display: grid; grid-template-columns: 1fr 30px 1fr; align-items: center; margin: 32px 0 24px; padding: 20px 0; border-block: 1px solid var(--line); }
.payment-route div { display: flex; flex-direction: column; gap: 6px; }
.payment-route div:last-child { text-align: right; }
.payment-route span { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; }
.payment-route i { color: var(--accent); text-align: center; font-style: normal; }

.support-flow { margin: 36px 0; }
.support-flow div { display: grid; grid-template-columns: 38px 1fr; padding: 18px 0; border-top: 1px solid var(--line); }
.support-flow div:last-child { border-bottom: 1px solid var(--line); }
.support-flow span { color: var(--accent); font: 700 11px ui-monospace, SFMono-Regular, Menlo, monospace; }
.support-flow p { margin: 0; }
.message-field { display: block; margin-bottom: 14px; }
.message-field > span { display: block; margin-bottom: 9px; color: var(--muted); font-size: 12px; }
.message-field textarea { width: 100%; resize: none; padding: 16px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); color: var(--text); }

.bottom-nav { position: fixed; z-index: 30; bottom: 0; left: 50%; width: min(100%, var(--max)); height: calc(var(--nav-height) + env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(5, 1fr); padding: 9px 8px env(safe-area-inset-bottom); border-top: 1px solid var(--line); background: rgba(7,16,24,.92); backdrop-filter: blur(22px); transform: translateX(-50%); }
.bottom-nav button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; border: 0; background: transparent; color: var(--muted); font-size: 10px; cursor: pointer; transition: color .18s ease, transform .18s ease; }
.bottom-nav button.is-active { color: var(--accent); transform: translateY(-2px); }
.bottom-nav button.is-active::before { content: ""; position: absolute; top: -9px; width: 28px; height: 2px; border-radius: 2px; background: var(--accent); box-shadow: 0 0 13px var(--accent); }
.nav-icon { position: relative; display: block; width: 19px; height: 19px; border: 1.5px solid currentColor; border-radius: 6px; }
.home-icon { border-radius: 50%; }
.home-icon::after { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: currentColor; }
.devices-icon::after { content: ""; position: absolute; width: 7px; height: 11px; right: -5px; bottom: -4px; border: 1.5px solid currentColor; border-radius: 3px; background: var(--bg); }
.setup-icon { border-radius: 50%; }
.setup-icon::before, .setup-icon::after { content: ""; position: absolute; background: currentColor; }
.setup-icon::before { width: 3px; height: 23px; left: 7px; top: -3px; }
.setup-icon::after { width: 23px; height: 3px; top: 7px; left: -3px; }
.plans-icon::before { content: ""; position: absolute; inset: 4px 3px; border-block: 1.5px solid currentColor; }
.support-icon { border-radius: 50%; }
.support-icon::after { content: "?"; position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; font-weight: 800; }

.toast { position: fixed; z-index: 50; left: 50%; bottom: calc(var(--nav-height) + env(safe-area-inset-bottom) + 16px); width: max-content; max-width: calc(100% - 32px); padding: 12px 16px; border: 1px solid rgba(74,168,255,.35); border-radius: 13px; background: #102536; box-shadow: 0 16px 50px rgba(0,0,0,.35); color: var(--text); font-size: 13px; opacity: 0; transform: translate(-50%, 10px); transition: opacity .18s ease, transform .18s ease; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

.reveal { animation: rise .55s cubic-bezier(.2,.8,.2,1) both; }
.reveal-delay { animation-delay: .08s; }
.reveal-delay-2 { animation-delay: .16s; }
.unavailable-page { display: grid; place-items: center; }
.unavailable { width: min(100% - 44px, 600px); }
.unavailable p:last-child { color: var(--muted); line-height: 1.55; }

@keyframes view-enter { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes orbit-breathe { 0%,100% { transform: scale(.98); opacity: .7; } 50% { transform: scale(1.025); opacity: 1; } }

@media (min-width: 620px) {
  main { padding-inline: 34px; }
  .topbar { padding-inline: 34px; }
  .status-workspace { grid-template-columns: 290px 1fr; align-items: center; }
  .facts { grid-template-columns: 1fr; border-block: 0; border-left: 1px solid var(--line); }
  .facts div { padding: 16px 24px; }
  .facts div + div { border-left: 0; border-top: 1px solid var(--line); }
  .actions { flex-direction: row; }
  .actions > * { flex: 1; }
  .download-intro { grid-template-columns: 1fr minmax(250px, 300px); align-items: end; }
}

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