:root {
  --bg: #f7f8fa;
  --card: #ffffff;
  --border: #e5e7eb;
  --text: #1f2430;
  --muted: #6b7280;
  --accent: #4f46e5;
  --accent-soft: #eef2ff;
  --green: #059669;
  --green-soft: #ecfdf5;
  --radius: 14px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
}

.container {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ── Верхняя навигация ── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  /* держим шапку на отдельном слое поверх кросс-доменного YouTube-iframe */
  transform: translateZ(0);
}

.topbar-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo {
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.02em;
}

.logo span {
  color: var(--accent);
}

/* ── Табы ── */
.tabbar {
  border-top: 1px solid var(--border);
}

.tabbar-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 12px;
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.tabbar-inner::-webkit-scrollbar {
  display: none;
}

.tab {
  padding: 12px 14px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ── Авторизация ── */
.auth-slot {
  margin-left: auto;
  width: 80px;
  height: 34px;
}

.tg-login {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #2aabee;
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
}

.tg-login:hover {
  background: #1d9ddf;
}

.tg-icon {
  font-size: 15px;
}

.auth-user {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 4px 10px 4px 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
}

.auth-user:hover {
  background: var(--bg);
}

.auth-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.auth-avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.auth-name {
  font-size: 14px;
  font-weight: 600;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-chip {
  font-size: 13px;
  color: var(--muted);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 12px;
  white-space: nowrap;
}

/* ── Карточки и кнопки ── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 15px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: opacity 0.15s;
}

.btn:hover {
  opacity: 0.88;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-secondary {
  background: var(--card);
  border-color: var(--border);
  color: var(--text);
}

.btn-green {
  background: var(--green);
  color: #fff;
}

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

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}
.courses-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 28px 16px 80px;
}

.courses-hero {
  margin-bottom: 24px;
}

.courses-hero h1 {
  font-size: 28px;
  letter-spacing: -0.02em;
}

.courses-hero p {
  font-size: 15px;
  max-width: 520px;
  margin-top: 6px;
}

.cat-section {
  margin-bottom: 30px;
}

.cat-title {
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 12px;
}

.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.course-link {
  display: block;
}

.course-card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 20px;
  border-top: 3px solid var(--border);
  transition: box-shadow 0.15s, transform 0.15s;
}

.course-link:hover .course-card {
  box-shadow: 0 4px 16px rgba(20, 24, 40, 0.08);
  transform: translateY(-2px);
}

.course-card.soon {
  opacity: 0.72;
}

.course-emoji {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin-bottom: 14px;
}

.course-body {
  flex: 1;
}

.course-body h3 {
  font-size: 18px;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}

.course-body p {
  font-size: 14px;
}

.course-meta {
  font-size: 13px;
  margin-top: 10px;
}

.soon-badge {
  display: inline-block;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 10px;
  font-weight: 600;
  font-size: 12px;
}

.course-sub {
  margin-top: 16px;
  width: 100%;
  border: none;
  border-radius: 10px;
  padding: 10px;
  font-size: 14.5px;
  font-weight: 700;
  color: #fff;
}

.course-sub.on {
  background: var(--green-soft);
  color: var(--green);
}

.course-sub:hover {
  opacity: 0.9;
}

/* ── Пустые состояния ── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  max-width: 440px;
  margin: 0 auto;
}

.empty-state .big-emoji {
  font-size: 48px;
  margin-bottom: 14px;
}

.empty-state h2 {
  font-size: 20px;
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 15px;
  margin-bottom: 18px;
}
.lessons-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 28px 16px 80px;
}

.lessons-hero {
  margin-bottom: 20px;
}

.lessons-hero h1 {
  font-size: 28px;
  letter-spacing: -0.02em;
}

.lessons-hero p {
  font-size: 15px;
  margin-top: 6px;
}

.lessons-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lesson-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
}

.lesson-row-emoji {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  flex-shrink: 0;
}

.lesson-row-info {
  flex: 1;
  min-width: 0;
}

.lesson-row-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.lesson-row-info h3 {
  font-size: 16px;
  letter-spacing: -0.01em;
}

.lesson-row-info p {
  font-size: 13.5px;
}

.done-pill {
  font-size: 12px;
  font-weight: 700;
  color: var(--green);
  background: var(--green-soft);
  border-radius: 999px;
  padding: 2px 9px;
}

.lesson-row-btn {
  flex-shrink: 0;
  white-space: nowrap;
}

@media (max-width: 560px) {
  .lesson-row {
    flex-wrap: wrap;
  }
  .lesson-row-btn {
    width: 100%;
  }
}
.course-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 80px;
}

.back-link {
  font-size: 14px;
}

.course-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 14px 0 8px;
}

.course-header-emoji {
  font-size: 44px;
}

.course-header h1 {
  font-size: 26px;
  letter-spacing: -0.02em;
}

.course-header p {
  font-size: 14.5px;
}

.tree-hint {
  font-size: 14px;
  margin: 8px 0 6px;
}

.tree-svg {
  width: 100%;
  height: auto;
  display: block;
}

.tree-node {
  cursor: pointer;
}

.tree-node:hover circle:first-of-type {
  filter: brightness(0.97);
}
.lesson-page {
  max-width: 560px;
  margin: 0 auto;
  padding: 24px 16px 60px;
}

.lesson-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.back-link {
  font-size: 14px;
}

.lesson-counter {
  font-size: 13px;
}

.lesson-title {
  font-size: 24px;
  letter-spacing: -0.02em;
  margin-top: 14px;
}

.lesson-sub {
  font-size: 15px;
  margin-top: 2px;
}

.cards-progress {
  display: flex;
  gap: 5px;
  margin: 18px 0;
}

.cards-progress-dot {
  flex: 1;
  height: 4px;
  border-radius: 99px;
}

/* ── Flash-карточка с флипом ── */
.flashcard {
  width: 100%;
  border: none;
  background: none;
  padding: 0;
  perspective: 1400px;
  cursor: pointer;
}

.flashcard-inner {
  position: relative;
  width: 100%;
  min-height: 300px;
  transition: transform 0.5s cubic-bezier(0.4, 0.2, 0.2, 1);
  transform-style: preserve-3d;
}

.flashcard.flipped .flashcard-inner {
  transform: rotateY(180deg);
}

.flashcard-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  background: var(--card);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: 18px;
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-shadow: 0 4px 18px rgba(20, 24, 40, 0.06);
}

.flashcard-face.back {
  transform: rotateY(180deg);
  background: #fafbff;
}

.flashcard-label {
  position: absolute;
  top: 16px;
  left: 20px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.flashcard-text {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.flashcard-text.back-text {
  font-size: 18px;
  font-weight: 500;
  color: var(--text);
}

.flashcard-hint {
  position: absolute;
  bottom: 16px;
  font-size: 12.5px;
}

.cards-nav {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.cards-nav .btn {
  flex: 1;
}

/* ── Финальный экран ── */
.lesson-done {
  text-align: center;
  padding: 36px 28px;
  margin-top: 20px;
}

.lesson-done-emoji {
  font-size: 48px;
  margin-bottom: 10px;
}

.lesson-done h2 {
  font-size: 22px;
  margin-bottom: 8px;
}

.lesson-done p {
  font-size: 15px;
  max-width: 380px;
  margin: 0 auto 20px;
}

.lesson-done-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  align-items: center;
}

.lesson-done-nav {
  display: flex;
  gap: 18px;
  justify-content: center;
  margin-top: 22px;
}

.link-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 14px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.link-btn:hover {
  color: var(--accent);
}
.sim-page {
  padding: 20px 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: calc(100vh - 60px);
}

.sim-header {
  padding: 14px 18px;
}

.sim-header-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.goals-toggle {
  margin-left: auto;
  background: none;
  border: none;
  font-size: 13px;
}

.sim-setup {
  font-size: 14px;
  margin-top: 8px;
  color: var(--muted);
}

.sim-setup b {
  color: var(--text);
}

.sim-goals {
  margin-top: 8px;
  padding-left: 20px;
  font-size: 14px;
  color: var(--muted);
}

.mock-banner {
  margin-top: 10px;
  font-size: 13px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 6px 10px;
}

.chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bubble {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 15px;
}

.bubble.assistant {
  background: var(--card);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}

.bubble.user {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}

.bubble-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 3px;
}

.typing {
  display: flex;
  gap: 4px;
  padding: 14px 16px;
}

.typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #c3c8d4;
  animation: blink 1.2s infinite;
}

.typing span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes blink {
  0%,
  80%,
  100% {
    opacity: 0.3;
  }
  40% {
    opacity: 1;
  }
}

.debrief {
  padding: 20px;
  margin-top: 8px;
  font-size: 15px;
}

.debrief h2 {
  font-size: 18px;
  margin-bottom: 12px;
}

.debrief-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.composer {
  position: sticky;
  bottom: 0;
  background: var(--bg);
  padding: 10px 0 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.composer textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 15px;
  resize: none;
  background: var(--card);
  color: var(--text);
}

.composer textarea:focus {
  outline: 2px solid var(--accent-soft);
  border-color: var(--accent);
}

.composer-buttons {
  display: flex;
  gap: 10px;
}

.learned-badge {
  background: var(--green-soft);
  color: var(--green);
  font-weight: 700;
  font-size: 14px;
  padding: 8px 14px;
  border-radius: 999px;
  align-self: center;
}
.content-page {
  max-width: 380px;
  margin: 0 auto;
  padding: 24px 16px 80px;
}

.content-hero {
  margin-bottom: 18px;
}

.content-hero h1 {
  font-size: 26px;
  letter-spacing: -0.02em;
}

.content-hero p {
  font-size: 14.5px;
  margin-top: 6px;
}

.vfeed {
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.vfeed-status {
  padding: 40px 0;
  text-align: center;
}

.vfeed-banner {
  font-size: 13px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 10px;
  padding: 8px 12px;
}

/* ── Одна карточка: название / ролик / предложение ── */
.short-item {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Название над роликом */
.short-head {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.short-head .tag {
  align-self: flex-start;
}

.short-title {
  font-size: 17px;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.short-channel {
  font-size: 13.5px;
}

/* Ролик 9:16 */
.short-video {
  width: 100%;
}

.short-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  border-radius: 16px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 6px 24px rgba(20, 24, 40, 0.12);
}

.short-iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.short-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: none;
  background: #000;
  cursor: pointer;
}

.short-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.92;
}

.short-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-left: 4px;
}

/* Предложение под роликом */
.short-offer {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cta-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.cta-course {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cta-course-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

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

.cta-course .course-sub {
  margin-top: 0;
  width: auto;
  padding: 9px 18px;
}

.cta-lessons {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* разделитель только если выше есть блок курса */
.cta-course + .cta-lessons {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.cta-lesson {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--bg);
}

.cta-lesson:hover {
  background: #eef0f4;
}

.cta-lesson-emoji {
  font-size: 20px;
}

.cta-lesson-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.cta-lesson-title {
  font-size: 14.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cta-lesson-course {
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cta-lesson-go {
  font-size: 13.5px;
  font-weight: 700;
  white-space: nowrap;
}

/* ═══════════════ Каталог навыков (YouTube-стиль) ═══════════════ */
.catalog-page {
  max-width: 760px;
  margin: 0 auto;
  padding: 16px 16px 80px;
}

.catalog-search {
  position: sticky;
  top: 104px; /* высота шапки с табами */
  z-index: 40;
  background: var(--bg);
  padding: 10px 0 12px;
}

.catalog-search input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 12px 20px;
  font-size: 15px;
  font-family: inherit;
  background: var(--card);
  color: var(--text);
}

.catalog-search input:focus {
  outline: 2px solid var(--accent-soft);
  border-color: var(--accent);
}

.goal-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.goal-row {
  display: flex;
  gap: 16px;
  padding: 14px;
  align-items: flex-start;
  transition: box-shadow 0.15s;
}

.goal-row:not(.inactive):hover {
  box-shadow: 0 4px 14px rgba(20, 24, 40, 0.08);
}

.goal-row.inactive {
  opacity: 0.68;
}

.goal-thumb {
  position: relative;
  flex: 0 0 168px;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.goal-thumb-emoji {
  font-size: 44px;
}

.goal-type-badge {
  position: absolute;
  left: 8px;
  bottom: 8px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(20, 24, 40, 0.75);
  color: #fff;
  border-radius: 6px;
  padding: 2px 7px;
}

.goal-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.goal-title {
  font-size: 16.5px;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.goal-promise {
  font-size: 13.5px;
  line-height: 1.45;
}

.goal-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.goal-meta-item {
  font-size: 12.5px;
}

.goal-action {
  flex-shrink: 0;
  align-self: center;
}

.goal-action .course-sub {
  margin-top: 0;
  width: auto;
  padding: 9px 16px;
}

@media (max-width: 560px) {
  .goal-row {
    flex-wrap: wrap;
  }
  .goal-thumb {
    flex: 0 0 128px;
  }
  .goal-info {
    flex: 1;
    min-width: 55%;
  }
  .goal-action {
    width: 100%;
  }
  .goal-action .course-sub {
    width: 100%;
  }
  .catalog-search {
    top: 100px;
  }
}

/* ═══════════════ Страница цели ═══════════════ */
.goal-status-line {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 10px 0 4px;
}

.goal-done {
  text-align: center;
  padding: 28px 22px;
  margin: 14px 0;
}

.goal-done h2 {
  font-size: 22px;
  margin: 6px 0;
}

.goal-done p {
  max-width: 420px;
  margin: 0 auto 18px;
}

.goal-next-list {
  text-align: left;
}

/* отметка «пройден» на узле дерева */
.tree-mark {
  cursor: pointer;
}

.tree-mark:hover circle {
  filter: brightness(0.95);
}

/* ═══════════════ Упражнение ═══════════════ */
.exercise {
  margin-top: 20px;
  padding: 20px;
  text-align: left;
}

.exercise h3 {
  font-size: 17px;
  margin-bottom: 10px;
}

.exercise-task {
  font-size: 15px;
  background: var(--accent-soft);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
}

.exercise-hint {
  font-size: 13.5px;
  margin-bottom: 10px;
}

.exercise textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 14.5px;
  resize: vertical;
  background: var(--card);
  color: var(--text);
}

.exercise textarea:focus {
  outline: 2px solid var(--accent-soft);
  border-color: var(--accent);
}

.exercise-actions {
  margin-top: 10px;
}

.exercise-feedback {
  margin-top: 14px;
  font-size: 14.5px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}

/* дерево на экране «урок пройден» */
.lesson-tree {
  margin-top: 18px;
  padding: 18px;
}

.lesson-tree-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 6px;
}
