:root {
  color-scheme: dark;
  --chrome: #1b2531;
  --bg: #070b12;
  --panel: #111823;
  --panel-2: #172131;
  --text: #f8fbff;
  --muted: #8a96a8;
  --blue: #27c3f6;
  --blue-2: #6572ff;
  --mint: #77ffd0;
  --line: rgba(255, 255, 255, 0.08);
  --radius: 12px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  max-width: 100vw;
  color: var(--text);
  background:
    radial-gradient(circle at 82% 4%, rgba(54, 88, 164, 0.22), transparent 34%),
    radial-gradient(circle at 10% 18%, rgba(37, 195, 246, 0.08), transparent 26%),
    linear-gradient(180deg, #0b111c 0%, #070b12 42%, #060910 100%);
  letter-spacing: 0;
}

button {
  font: inherit;
}

.telegram-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 52px 1fr 48px 44px;
  align-items: center;
  width: 100%;
  max-width: 480px;
  height: 70px;
  margin: 0 auto;
  padding-top: env(safe-area-inset-top);
  background: var(--chrome);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.5);
}

.telegram-bar h1 {
  margin: 0;
  color: #ffffff;
  font-size: 1.35rem;
  line-height: 1;
  font-weight: 760;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border: 0;
  color: #ffffff;
  background: transparent;
  cursor: pointer;
}

.icon-button svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.app-shell {
  width: 100%;
  max-width: 460px;
  min-height: calc(100vh - 70px);
  margin: 0 auto;
  padding: 18px 14px calc(24px + env(safe-area-inset-bottom));
  overflow-x: hidden;
  background:
    linear-gradient(180deg, rgba(14, 23, 38, 0.78), rgba(7, 11, 18, 0.2) 32%),
    transparent;
}

.tg-native .telegram-bar {
  display: none;
}

.tg-native .app-shell {
  min-height: 100vh;
}

.screen {
  display: none;
}

.screen.is-active {
  display: block;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 16px;
}

.video-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(21, 31, 46, 0.98), rgba(13, 19, 29, 0.98));
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.035);
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, filter 160ms ease;
  -webkit-tap-highlight-color: transparent;
}

.video-card:active {
  transform: scale(0.985);
}

.video-card:focus-visible {
  outline: 2px solid rgba(39, 195, 246, 0.92);
  outline-offset: 3px;
}

.poster-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  width: 100%;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(49, 66, 90, 0.9), rgba(29, 39, 55, 0.9)),
    #1d2737;
}

.poster-wrap::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 42%;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.34));
  pointer-events: none;
}

.poster-wrap img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.duration-badge {
  position: absolute;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  line-height: 1;
  backdrop-filter: blur(10px);
}

.duration-badge {
  right: 7px;
  bottom: 7px;
  padding: 4px 7px;
  color: #ffffff;
  background: rgba(0, 0, 0, 0.56);
  font-size: 0.76rem;
  font-weight: 790;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

.empty-state {
  margin: 34px auto 0;
  color: var(--muted);
  text-align: center;
  font-size: 0.96rem;
}

.empty-state.is-retry {
  color: #79dfff;
  cursor: pointer;
}

.pager[hidden] {
  display: none;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin: 26px 0 2px;
  overflow: hidden;
  padding: 2px 0 8px;
  color: #b7c3d4;
  font-size: 0.72rem;
  width: 100%;
}

.pager-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  min-height: 34px;
  padding: 0 8px;
  border: 0;
  border-radius: 4px;
  color: #b9c5d6;
  background: rgba(22, 32, 45, 0.92);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07);
  box-shadow: none;
  font-size: 0.68rem;
  font-weight: 800;
  cursor: pointer;
}

.pager-button:first-child,
.pager-button:last-child {
  min-width: 50px;
}

.pager-button.is-active {
  color: #03131c;
  background: linear-gradient(135deg, #31c7fb, #74ffd1);
  box-shadow: 0 8px 22px rgba(39, 195, 246, 0.18);
}

.pager-button:disabled {
  color: #627086;
  background: rgba(18, 26, 38, 0.68);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  opacity: 0.75;
  cursor: not-allowed;
}

.unlocked-screen {
  min-height: calc(100vh - 70px);
  padding: 22px 0 28px;
  background:
    radial-gradient(circle at 50% 8%, rgba(37, 189, 243, 0.2), transparent 34%),
    radial-gradient(circle at 100% 42%, rgba(255, 112, 215, 0.12), transparent 28%),
    transparent;
}

.unlock-card {
  position: relative;
  overflow: hidden;
  margin: 0;
  padding: 30px 24px 26px;
  border: 1px solid rgba(120, 150, 190, 0.17);
  border-radius: 26px;
  background:
    linear-gradient(180deg, rgba(18, 27, 43, 0.96), rgba(8, 13, 22, 0.96)),
    rgba(13, 18, 29, 0.92);
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.48), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  text-align: center;
}

.unlock-card::before {
  content: "";
  position: absolute;
  inset: -80px 24px auto;
  height: 150px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(37, 189, 243, 0.2), transparent 68%);
  pointer-events: none;
}

.success-pill {
  position: relative;
  width: max-content;
  margin: 0 auto 22px;
  padding: 7px 13px;
  border: 1px solid rgba(16, 228, 154, 0.22);
  border-radius: 999px;
  color: var(--mint);
  background: rgba(16, 228, 154, 0.08);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.unlock-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 78px;
  height: 78px;
  margin: 0 auto 24px;
  border: 1px solid rgba(16, 228, 154, 0.24);
  border-radius: 22px;
  color: #10e49a;
  background: linear-gradient(180deg, rgba(16, 228, 154, 0.18), rgba(16, 228, 154, 0.08));
  box-shadow: 0 18px 40px rgba(16, 228, 154, 0.1);
}

.unlock-icon svg {
  width: 32px;
  height: 32px;
  fill: currentColor;
}

.unlock-card h2 {
  position: relative;
  margin: 0;
  background: linear-gradient(90deg, #36baff, #ff70d7);
  background-clip: text;
  color: transparent;
  font-size: clamp(2.25rem, 12vw, 3rem);
  font-weight: 520;
  line-height: 1;
}

.unlock-card p {
  position: relative;
  max-width: 270px;
  margin: 14px auto 0;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.4;
}

.delivery-card {
  position: relative;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 22px;
  align-items: center;
  gap: 13px;
  width: 100%;
  margin-top: 26px;
  padding: 15px 16px;
  border: 1px solid transparent;
  border-radius: 18px;
  color: #ffffff;
  background:
    linear-gradient(rgba(8, 14, 25, 0.96), rgba(8, 14, 25, 0.96)) padding-box,
    linear-gradient(110deg, #27c3f6, #6572ff) border-box;
  box-shadow: 0 16px 36px rgba(36, 122, 255, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  text-align: left;
  cursor: pointer;
  transition: transform 160ms ease, filter 160ms ease, box-shadow 160ms ease;
  -webkit-tap-highlight-color: transparent;
}

.delivery-card:active:not(:disabled) {
  transform: scale(0.985);
}

.delivery-card:focus-visible {
  outline: 2px solid rgba(39, 195, 246, 0.9);
  outline-offset: 3px;
}

.delivery-card:disabled {
  opacity: 0.66;
  cursor: progress;
}

.delivery-icon {
  display: grid;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(79, 151, 255, 0.26);
  border-radius: 14px;
  color: #39bdf8;
  background: rgba(54, 104, 190, 0.12);
}

.delivery-icon svg {
  width: 27px;
  height: 27px;
  fill: currentColor;
}

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

.delivery-copy strong,
.delivery-copy small {
  display: block;
  letter-spacing: 0;
}

.delivery-copy strong {
  overflow-wrap: anywhere;
  color: #ffffff;
  font-size: 0.98rem;
  font-weight: 800;
  line-height: 1.2;
}

.delivery-copy small {
  margin-top: 5px;
  overflow-wrap: anywhere;
  color: #8491a6;
  font-size: 0.74rem;
  line-height: 1.25;
}

.delivery-chevron {
  width: 22px;
  height: 22px;
  fill: #a8b3c4;
}

.text-button {
  margin-top: 22px;
  border: 0;
  color: #667286;
  background: transparent;
  font-size: 0.95rem;
  cursor: pointer;
}

.error-text {
  padding: 12px;
  border: 1px solid rgba(255, 92, 126, 0.35);
  border-radius: 12px;
  color: #ffb9c9;
  background: rgba(255, 92, 126, 0.1);
  font-size: 0.95rem !important;
}

@media (max-width: 380px) {
  .telegram-bar h1 {
    font-size: 1.15rem;
  }

  .app-shell {
    padding-right: 10px;
    padding-left: 10px;
  }

  .video-grid {
    gap: 14px 10px;
  }

  .pager {
    gap: 4px;
  }

  .pager-button {
    min-width: 34px;
    min-height: 32px;
    padding: 0 6px;
    font-size: 0.64rem;
  }

  .pager-button:first-child,
  .pager-button:last-child {
    min-width: 46px;
  }
}
