/* ========== RESET ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
ul, ol { list-style: none; }
img { display: block; max-width: 100%; }

/* ========== DESIGN TOKENS ========== */
:root {
  --bg:           #141420;
  --bg-elev:     #1e1e2e;
  --card:        #252836;
  --card-stroke: rgba(255,255,255,.06);
  --text:        #ffffff;
  --text-mute:   #8c8fa3;
  --text-dim:    #5d6080;

  --accent-from: #3D7EFF;
  --accent-to:   #5B8FFF;
  --accent-glow: rgba(61, 126, 255, .35);

  --logo-from:   #5B5BFF;
  --logo-to:     #8B5BFF;

  --green:       #2ECC71;
  --red:         #FF4D4D;
  --red-bg:      rgba(255, 77, 77, .10);
  --red-stroke:  rgba(255, 77, 77, .25);

  --radius-sm:   10px;
  --radius-md:   14px;
  --radius-lg:   18px;
  --radius-xl:   22px;

  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bot:    env(safe-area-inset-bottom, 0px);
}

/* ========== APP / SCREENS ========== */
.app {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

.screen {
  position: absolute;
  inset: 0;
  padding-top:    calc(var(--safe-top) + 16px);
  padding-bottom: calc(var(--safe-bot) + 24px);
  padding-left:   20px;
  padding-right:  20px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--bg);

  opacity: 0;
  visibility: hidden;
  transform: translateX(40px);
  transition:
    transform .32s cubic-bezier(.4,0,.2,1),
    opacity   .26s ease,
    visibility 0s linear .32s;
}
.screen.is-active {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
  transition:
    transform .32s cubic-bezier(.4,0,.2,1),
    opacity   .26s ease,
    visibility 0s linear 0s;
}
.screen.is-leaving-left  { transform: translateX(-40px); opacity: 0; visibility: hidden; }
.screen.is-leaving-right { transform: translateX( 40px); opacity: 0; visibility: hidden; }

/* ========== SCREEN 1: WELCOME ========== */
.welcome {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 8vh 4px 0;
}
.logo {
  width: 88px;
  height: 88px;
  border-radius: 22px;
  background: linear-gradient(135deg, var(--logo-from), var(--logo-to));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 18px 40px rgba(91, 91, 255, .35),
    inset 0 1px 0 rgba(255,255,255,.25);
  margin-bottom: 24px;
}
.logo__text {
  font-weight: 800;
  font-size: 32px;
  letter-spacing: -.5px;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0,0,0,.25);
}
.welcome__title {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 1.5px;
  margin-bottom: 18px;
  background: linear-gradient(180deg, #fff 0%, #c9cce0 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.welcome__desc {
  font-size: 15px;
  line-height: 1.55;
  color: var(--text-mute);
  max-width: 320px;
  margin-bottom: 28px;
}
.welcome__features {
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 36px;
  text-align: left;
}
.welcome__feature {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 14px;
  color: var(--text);
  line-height: 1.45;
}
.welcome__bullet {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  margin-top: 7px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-from), var(--accent-to));
  box-shadow: 0 0 12px var(--accent-glow);
}

/* ========== BUTTONS ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: .8px;
  border-radius: 16px;
  padding: 18px 32px;
  transition: transform .12s ease, box-shadow .2s ease, filter .2s ease;
  will-change: transform;
}
.btn:active { transform: scale(.97); }
.btn--primary {
  width: 100%;
  max-width: 340px;
  margin-top: auto;
  background: linear-gradient(135deg, var(--accent-from), var(--accent-to));
  color: #fff;
  box-shadow:
    0 10px 28px var(--accent-glow),
    inset 0 1px 0 rgba(255,255,255,.18);
}
.btn--primary:active { filter: brightness(1.05); }

/* ========== TOPBAR ========== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  padding: 4px 0;
}
.topbar__title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: var(--text);
  text-align: center;
  flex: 1;
}
.topbar__back, .topbar__close {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  color: var(--text);
  background: rgba(255,255,255,.05);
  transition: transform .12s ease, background .2s ease;
}
.topbar__back:active, .topbar__close:active {
  transform: scale(.92);
  background: rgba(255,255,255,.10);
}
.topbar__spacer { width: 38px; }

/* ========== SCREEN 2: LIST ========== */
.list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 20px;
}
.card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  background: var(--card);
  border: 1px solid var(--card-stroke);
  border-radius: var(--radius-lg);
  transition: transform .12s ease, background .2s ease;
  will-change: transform;
  cursor: pointer;
}
.card:active {
  transform: scale(.98);
  background: #2c2f3f;
}
.card__icon {
  flex-shrink: 0;
  width: 62px;
  height: 62px;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(135deg, #2d3047, #1d2034);
  position: relative;
}
.card__icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.card__body {
  flex: 1;
  min-width: 0;
}
.card__tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .5px;
  color: var(--text-mute);
  text-transform: uppercase;
  margin-bottom: 4px;
}
.card__tag::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-from);
}
.card__title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card__desc {
  font-size: 12px;
  color: var(--text-mute);
  line-height: 1.35;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.card__arrow {
  flex-shrink: 0;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ========== SCREEN 3: DETAIL ========== */
.detail {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding-bottom: 24px;
}
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.stats__item {
  background: var(--card);
  border: 1px solid var(--card-stroke);
  border-radius: var(--radius-md);
  padding: 12px 8px;
  text-align: center;
}
.stats__value {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  white-space: nowrap;
}
.stats__value--accent { color: var(--green); }
.stats__label {
  font-size: 11px;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: .5px;
}
.poster {
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--card);
  box-shadow: 0 12px 32px rgba(0,0,0,.4);
}
.poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.detail__heading {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-mute);
  letter-spacing: 1.2px;
  text-transform: uppercase;
  margin-top: 4px;
}
.steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  counter-reset: step;
}
.steps__item {
  position: relative;
  background: var(--card);
  border: 1px solid var(--card-stroke);
  border-radius: var(--radius-md);
  padding: 14px 14px 14px 50px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  counter-increment: step;
}
.steps__item::before {
  content: counter(step);
  position: absolute;
  top: 50%;
  left: 12px;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-from), var(--accent-to));
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px var(--accent-glow);
}
/* ========== VIDEO BLOCK ========== */
.video {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.btn-video {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-from), var(--accent-to));
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: .5px;
  box-shadow:
    0 8px 20px var(--accent-glow),
    inset 0 1px 0 rgba(255,255,255,.18);
  transition: transform .12s ease, filter .2s ease;
  will-change: transform;
}
.btn-video:active { transform: scale(.97); filter: brightness(1.05); }
.btn-video__icon {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255,255,255,.18);
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-video.is-active {
  background: var(--card);
  border: 1px solid var(--card-stroke);
  box-shadow: none;
  color: var(--text-mute);
}
.video__player {
  width: 100%;
  border-radius: var(--radius-md);
  background: #000;
  display: block;
  max-height: 60vh;
}

.warning {
  display: flex;
  gap: 10px;
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--red-bg);
  border: 1px solid var(--red-stroke);
}
.warning__icon {
  flex-shrink: 0;
  font-size: 20px;
  line-height: 1;
}
.warning__text {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text);
  opacity: .92;
}
.warning__text strong { color: var(--red); font-weight: 700; }

/* ========== SCROLLBAR HIDE ========== */
.screen::-webkit-scrollbar { display: none; }
.screen { scrollbar-width: none; }

/* ========== SMALL SCREENS ========== */
@media (max-height: 700px) {
  .welcome { padding-top: 4vh; }
  .logo { width: 72px; height: 72px; margin-bottom: 18px; }
  .logo__text { font-size: 26px; }
  .welcome__title { font-size: 28px; margin-bottom: 14px; }
  .welcome__desc { margin-bottom: 20px; }
  .welcome__features { margin-bottom: 24px; }
}
