:root {
  --bg: radial-gradient(120% 120% at 20% 20%, rgba(255, 70, 110, 0.15), rgba(40, 10, 70, 0.9)), radial-gradient(140% 140% at 80% 10%, rgba(120, 40, 255, 0.15), rgba(12, 8, 30, 0.95)), #0b0616;
  --glass: rgba(255, 255, 255, 0.08);
  --glass-strong: rgba(255, 255, 255, 0.12);
  --text: #f7f8fb;
  --muted: #a5a9c9;
  --accent: #ff2e63;
  --accent-2: #6e3bff;
  --success: #4fe3a4;
  --danger: #ff6b6b;
  --blur: 18px;
  --radius: 18px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.app {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.viewport {
  position: relative;
  width: min(100vw - 24px, 540px);
  aspect-ratio: 9 / 16;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  background: var(--bg);
}

.brand {
  position: absolute;
  top: 12px;
  left: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 10;
}

.brand-logo {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  flex-shrink: 0;
}

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

.brand-mark {
  padding: 8px 14px;
  border-radius: 999px;
  background: linear-gradient(120deg, rgba(255, 46, 99, 0.4), rgba(110, 59, 255, 0.4));
  backdrop-filter: blur(var(--blur));
  box-shadow: var(--shadow);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.02em;
}

.badge {
  padding: 6px 10px;
  border-radius: 10px;
  background: var(--glass);
  backdrop-filter: blur(var(--blur));
  font-size: 12px;
  color: var(--muted);
}

.feed {
  position: relative;
  height: 100%;
  scroll-snap-type: y mandatory;
  overflow: hidden; /* скролл управляется программно, чтобы не перескакивать больше чем на 1 карточку */
  scroll-behavior: smooth;
  touch-action: none; /* отключаем нативный скролл, управляем свайпом сами */
}

.card {
  position: relative;
  height: 100%;
  min-height: 100%;
  padding: 88px 16px 140px;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
}

.card.video-card {
  padding: 0;
}

.card.video-card .media {
  border: none;
  background: transparent;
  border-radius: 0;
  min-height: 100%;
}

.video-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 20px 20px 110px; /* добавили отступ под нижнюю навигацию, но тянем градиент с самого низа */
  background: linear-gradient(180deg, rgba(5, 5, 15, 0) 0%, rgba(5, 5, 15, 0.75) 60%, rgba(5, 5, 15, 0.9) 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.video-title {
  font-size: 22px;
  font-weight: 700;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
}

.video-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.card-shell {
  height: 100%;
  border-radius: var(--radius);
  background: var(--glass);
  box-shadow: var(--shadow);
  backdrop-filter: blur(var(--blur));
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 12px;
}

.title {
  font-size: 24px;
  font-weight: 700;
  margin: 6px 0 0;
}

.subtitle {
  color: var(--muted);
  font-size: 14px;
  margin: 2px 0 0;
}

.media {
  position: relative;
  border-radius: calc(var(--radius) - 2px);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  flex: 1;
  min-height: 40vh;
  display: flex;
}

.media video,
.media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.quiz-card .media {
  flex: 0 0 auto;
  width: 100%;
  aspect-ratio: 16 / 9; /* 1280x720 пропорция */
  min-height: auto;
}

.quiz-card .media img {
  height: 100%;
}

.answers {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.profile-screen {
  position: absolute;
  inset: 0;
  background: transparent;
}

.profile-scroll {
  height: 100%;
  overflow-y: auto;
  padding: 88px 16px 140px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.profile-hero {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--glass);
  border-radius: 16px;
  backdrop-filter: blur(var(--blur));
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.profile-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.7);
  flex-shrink: 0;
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-text {
  flex: 1;
}

.profile-name {
  font-weight: 700;
  font-size: 16px;
}

.profile-sub {
  color: var(--muted);
  font-size: 13px;
}

.streak-pill {
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.1);
  font-weight: 700;
  font-size: 13px;
}

.profile-card {
  padding: 14px;
}

.title.sm {
  font-size: 16px;
}

.stat-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

.stat-line {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 6px;
}

.stat-label {
  color: var(--muted);
  font-size: 14px;
}

.stat-value {
  font-weight: 700;
  font-size: 14px;
}

.progress.slim {
  grid-column: 1 / -1;
  height: 6px;
}

.plan-list {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.plan-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 14px;
}

.plan-item.done {
  border-color: rgba(79, 227, 164, 0.6);
  background: rgba(79, 227, 164, 0.12);
}

.plan-status {
  font-weight: 700;
  font-size: 12px;
  color: var(--text);
}

.plan-status.muted {
  color: var(--muted);
  font-weight: 600;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}

.auth-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
}

.code-pill {
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-weight: 700;
  letter-spacing: 0.06em;
}

.auth-btn {
  padding: 10px 12px;
  height: 42px;
}
.answer {
  width: 100%;
  padding: 14px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-weight: 600;
  font-size: 15px;
  text-align: left;
  cursor: pointer;
  transition: transform 0.08s ease, border-color 0.2s ease, background 0.2s ease;
}

.answer:hover,
.answer:active {
  transform: translateY(-2px);
}

.answer.correct {
  border-color: rgba(79, 227, 164, 0.7);
  background: rgba(79, 227, 164, 0.12);
}

.answer.incorrect {
  border-color: rgba(255, 107, 107, 0.7);
  background: rgba(255, 107, 107, 0.12);
}

.hint {
  margin-top: 6px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--muted);
  font-size: 14px;
}

.hint strong {
  color: var(--text);
}

.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.stat {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 8px;
  font-size: 14px;
}

.stat small {
  color: var(--muted);
}

.progress {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.bottom-nav {
  position: absolute;
  bottom: 12px;
  left: 12px;
  right: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr 1.4fr;
  gap: 10px;
  z-index: 20;
}

.nav-btn,
.cta-btn {
  border: none;
  border-radius: 16px;
  padding: 12px 10px;
  font-weight: 700;
  color: var(--text);
  background: var(--glass);
  backdrop-filter: blur(var(--blur));
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.2s ease;
}

.nav-btn .icon {
  display: inline-flex;
}

.nav-btn.is-active {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.cta-btn {
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: linear-gradient(135deg, #ff355d 0%, #ff5f8a 35%, #7a4bff 100%);
  text-align: center;
  box-shadow:
    0 14px 36px rgba(255, 53, 93, 0.28),
    0 0 0 1px rgba(255, 255, 255, 0.08);
  letter-spacing: 0.01em;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.12;
  padding: 11px 12px 10px;
  border-radius: 16px;
}

.cta-sub {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.05;
  opacity: 0.92;
}

.nav-btn:active,
.cta-btn:active {
  transform: translateY(1px);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 12px;
  color: var(--muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

@media (max-width: 420px) {
  .card {
    padding: 72px 14px 132px;
  }

  .viewport {
    width: calc(100vw - 24px);
  }
}
