html,
body {
  min-height: 100%;
}

body {
  background:
    radial-gradient(circle at 7% 9%, rgba(88, 203, 255, 0.18), transparent 22%),
    radial-gradient(circle at 94% 10%, rgba(136, 117, 255, 0.16), transparent 24%),
    radial-gradient(circle at 84% 86%, rgba(255, 136, 191, 0.14), transparent 23%),
    radial-gradient(circle at 20% 100%, rgba(245, 192, 106, 0.11), transparent 22%),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

#app {
  min-height: 100vh;
  min-height: var(--tg-viewport-stable-height);
}

.boot-splash,
.error-screen {
  min-height: var(--tg-viewport-stable-height);
  padding: calc(22px + var(--tg-safe-top)) calc(16px + var(--tg-safe-right)) calc(22px + var(--tg-safe-bottom)) calc(16px + var(--tg-safe-left));
  display: grid;
  place-content: center;
}

.boot-splash__shell,
.error-screen__shell {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-3xl);
  padding: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.76), rgba(255, 255, 255, 0.58));
  border: 1px solid rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow-lg);
  display: grid;
  gap: 12px;
  text-align: center;
}

.boot-splash__shell::before,
.error-screen__shell::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 10% 10%, rgba(88, 203, 255, 0.16), transparent 22%),
    radial-gradient(circle at 88% 12%, rgba(136, 117, 255, 0.12), transparent 22%),
    radial-gradient(circle at 82% 86%, rgba(255, 136, 191, 0.11), transparent 20%);
}

.boot-splash__logo {
  position: relative;
  z-index: 1;
  width: 66px;
  height: 66px;
  margin: 0 auto;
  border-radius: 22px;
  display: grid;
  place-items: center;
  color: white;
  font-size: 28px;
  font-weight: 760;
  background:
    radial-gradient(circle at 28% 24%, rgba(255, 255, 255, 0.97), rgba(255, 255, 255, 0.24) 32%, transparent 44%),
    linear-gradient(135deg, rgba(88, 203, 255, 0.98), rgba(129, 118, 255, 0.96), rgba(255, 156, 197, 0.92));
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.72), 0 14px 34px rgba(92, 143, 255, 0.22);
}

.boot-splash__title,
.error-screen__title {
  position: relative;
  z-index: 1;
  font-size: 24px;
  line-height: 1.05;
  letter-spacing: -0.06em;
  font-weight: 780;
}

.boot-splash__subtitle,
.error-screen__subtitle {
  position: relative;
  z-index: 1;
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.48;
}

.mini-shell {
  min-height: var(--tg-viewport-stable-height);
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 14px;
  padding:
    calc(10px + var(--tg-safe-top))
    calc(14px + var(--tg-safe-right))
    calc(14px + var(--tg-safe-bottom))
    calc(14px + var(--tg-safe-left));
}

.mini-shell__header,
.search-strip,
.bottom-nav {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.52));
  border: 1px solid rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(16px) saturate(1.04);
  -webkit-backdrop-filter: blur(16px) saturate(1.04);
}

.mini-shell__header {
  border-radius: var(--radius-3xl);
  padding: 14px 14px 12px;
  display: grid;
  gap: 14px;
}

.header-topline {
  width: 116px;
  height: 5px;
  margin: 2px auto 0;
  border-radius: 999px;
  background: rgba(16, 20, 28, 0.08);
}

.brand-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 18px;
  flex: 0 0 auto;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 28% 24%, rgba(255, 255, 255, 0.97), rgba(255, 255, 255, 0.24) 32%, transparent 44%),
    linear-gradient(135deg, rgba(88, 203, 255, 0.98), rgba(129, 118, 255, 0.96), rgba(255, 156, 197, 0.92));
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.72), 0 14px 34px rgba(92, 143, 255, 0.22);
}

.brand-mark::after {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.48), rgba(255, 255, 255, 0));
}

.brand-copy {
  min-width: 0;
}

.brand-copy h1,
.brand-copy p,
.mini-shell__screen-title,
.mini-shell__screen-copy {
  margin: 0;
}

.brand-copy h1 {
  font-size: 18px;
  line-height: 1;
  letter-spacing: -0.05em;
  font-weight: 780;
}

.brand-copy p,
.mini-shell__screen-copy {
  margin-top: 4px;
  color: var(--text-faint);
  font-size: 12px;
  line-height: 1.35;
}

.header-badge {
  width: 44px;
  height: 44px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-xs);
  color: var(--text-soft);
  font-size: 18px;
}

.header-context {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mini-shell__content {
  min-height: 0;
}

.search-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 14px;
  border-radius: var(--radius-lg);
  color: var(--text-faint);
  font-size: 13px;
}

.search-strip strong {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
  letter-spacing: -0.01em;
}

.screen-stack {
  display: grid;
  gap: 16px;
}

.bottom-nav {
  position: sticky;
  bottom: 0;
  border-radius: var(--radius-2xl);
  padding: 8px;
  box-shadow: var(--shadow-lg);
}

.bottom-nav__grid {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 420px) {
  .mini-shell {
    padding-inline: calc(12px + var(--tg-safe-right));
  }
}
