* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--tg-theme-text-color, #eef2f7);
  background:
    radial-gradient(circle at 50% -10%, rgba(255, 255, 255, 0.16), transparent 34%),
    linear-gradient(180deg, #2b3036 0%, #191d22 100%);
  font-family: Arial, sans-serif;
}

body {
  min-height: var(--app-height, 100vh);
}

.app-shell {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 16px;
  min-height: var(--app-height, 100vh);
  padding: max(14px, env(safe-area-inset-top)) 16px calc(72px + env(safe-area-inset-bottom));
}

.screen {
  display: none;
  max-width: 520px;
  width: 100%;
  margin: 0 auto;
}

.screen.active {
  display: block;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 520px;
  min-height: 48px;
  margin: 0 auto;
  padding: 0 52px;
  text-align: center;
}

.title-block {
  min-width: 0;
}

.topbar h1,
.topbar h2 {
  margin: 0;
  font-size: 21px;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0 0 4px;
  color: rgba(238, 242, 247, 0.64);
  font-size: 11px;
  text-transform: uppercase;
}

.product-panel,
.content-block,
.checkout {
  align-self: start;
  color: #eef2f7;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(18px);
}

.product-panel h2,
.content-block h2,
.checkout h2 {
  margin: 0 0 10px;
  font-size: 21px;
  letter-spacing: 0;
}

.product-panel p,
.content-block p,
.checkout p,
.notice {
  color: rgba(238, 242, 247, 0.72);
  font-size: 16px;
  line-height: 1.5;
}

ul {
  display: grid;
  gap: 10px;
  margin: 18px 0 0;
  padding-left: 20px;
}

button {
  cursor: pointer;
}

.primary,
.secondary {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 700;
}

.primary {
  color: #111827;
  background: #eef2f7;
}

.secondary {
  color: #eef2f7;
  background: rgba(255, 255, 255, 0.12);
}

.checkout {
  display: grid;
  gap: 16px;
}

.checkout-summary {
  display: grid;
  gap: 6px;
}

.price {
  display: block;
  font-size: 34px;
  font-weight: 700;
}

.notice {
  max-width: 520px;
  margin: 12px auto 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  padding: 12px;
  min-height: 48px;
  text-align: center;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.access-status {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  color: rgba(238, 242, 247, 0.88);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.06)),
    rgba(255, 255, 255, 0.08);
  padding: 12px;
  font-size: 14px;
  line-height: 1.4;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.access-list {
  display: grid;
  gap: 12px;
  max-width: 520px;
  margin: 12px auto 0;
}

.access-card {
  display: grid;
  gap: 12px;
  color: #eef2f7;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.06)),
    rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  padding: 14px;
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.access-card.used {
  opacity: 0.58;
}

.access-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.access-card h3 {
  margin: 0;
  font-size: 16px;
}

.access-card p {
  margin: 0;
  color: rgba(238, 242, 247, 0.64);
  font-size: 13px;
}

.access-state {
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  padding: 5px 8px;
  color: rgba(238, 242, 247, 0.82);
  background: rgba(255, 255, 255, 0.08);
  font-size: 12px;
}

.access-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.access-button {
  display: grid;
  place-items: center;
  min-height: 42px;
  border-radius: 8px;
  color: #111827;
  background: rgba(255, 255, 255, 0.86);
  text-align: center;
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
}

.access-button.disabled {
  color: rgba(238, 242, 247, 0.5);
  background: rgba(255, 255, 255, 0.08);
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  max-width: 520px;
  margin: 0 auto;
  padding: 4px;
  bottom: calc(8px + env(safe-area-inset-bottom));
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.07)),
    rgba(35, 39, 45, 0.54);
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    inset 0 -1px 0 rgba(0, 0, 0, 0.18),
    0 18px 52px rgba(0, 0, 0, 0.34);
  overflow: hidden;
}

.nav-thumb {
  position: absolute;
  inset: 4px auto 4px 4px;
  width: calc((100% - 8px) / 2);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0.18)),
    rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.62),
    inset 0 -1px 0 rgba(255, 255, 255, 0.12),
    0 8px 22px rgba(0, 0, 0, 0.24);
  transform: translateX(var(--nav-thumb-x, 0));
  transition: transform 260ms cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}

.nav-item {
  position: relative;
  z-index: 1;
  min-height: 40px;
  border: 0;
  border-radius: 999px;
  color: rgba(238, 242, 247, 0.68);
  background: transparent;
  font-size: 14px;
  font-weight: 700;
  transition: color 180ms ease;
}

.nav-item.active {
  color: #ffffff;
  background: transparent;
}

@media (min-width: 768px) {
  body {
    background:
      radial-gradient(circle at 50% -10%, rgba(255, 255, 255, 0.16), transparent 34%),
      linear-gradient(180deg, #2b3036 0%, #191d22 100%);
  }

  .app-shell {
    display: grid;
    align-content: center;
    padding: 24px 16px 92px;
  }

  .screen {
    width: 520px;
  }

  .bottom-nav {
    position: fixed;
    bottom: 18px;
    max-width: 420px;
  }
}
