/* =========================
   BASE
========================= */


:root{

  --bg:#f8f8fb;
  --text:#222;
  --muted:#666;

  --accent:#d9534f;
  --accent-2:#ff7a59;

  --surface:#ffffff;
  --surface-2:#f6f4f9;
  --accent-soft: rgba(76,110,245,0.12);

  --card:var(--surface);

  --border:var(--surface-2);

  --text-2:#1f2937;
  --text-muted:#6b7280;
}


* { box-sizing:border-box; }


/* === App Loader === */

#app-loader {
  position: fixed;
  inset: 0;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity .4s ease, visibility .4s ease;
}

#app-loader.hidden {
  opacity: 0;
  visibility: hidden;
}

.loader-card {
  background: var(--surface);
  padding: 40px 36px;
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  animation: loaderFade .6s ease;
}

.loader-logo {
  font-size: 40px;
  margin-bottom: 12px;
}

.loader-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 24px;
  color: var(--text);
}


@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes loaderFade {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

body{
  margin:0;
  font-family: Inter, system-ui, "Segoe UI", Roboto, Arial;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing:antialiased;
}

h1{
  margin:0 0 16px;
  font-size:28px;
}

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

.container{
  max-width:1200px;
  margin:24px auto;
  padding:0 24px;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}


/* =========================
   HEADER
========================= */
.site-header{
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.header-inner{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:12px 0;
}

.brand{
  font-weight:800;
  font-size:20px;
  text-decoration:none;
  color:var(--text);
}

.main-nav{
  display:flex;
  gap:12px;
  align-items:center;
}

.main-nav a{
  text-decoration:none;
  color:var(--text);
  padding:6px 10px;
  border-radius:6px;
}

.main-nav a:hover{
  background:var(--surface-2);
}

/* =========================
   BUTTONS
========================= */
.btn{
  padding:6px 10px;
  border-radius:6px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor:pointer;
}

.btn.primary{
  background:var(--accent);
  color:var(--surface);
  border:none;
}

.btn.small{
  padding:4px 6px;
  font-size:12px;
}

/* =========================
   ADMIN (TABLES)
========================= */
table{
  width:100%;
  border-collapse:collapse;
  background: var(--surface);
  border-radius:8px;
  overflow:hidden;
}

th, td{
  padding:10px 12px;
  border-bottom:1px solid var(--border);
  font-size:13px;
  vertical-align:middle;
}

th{
  background: var(--surface-2);
  font-weight:600;
  text-align:left;
}

.admin-toolbar{
  display:flex;
  gap:12px;
  align-items:center;
  margin-bottom:16px;
}

tr.frozen{
  opacity:.6;
  background:#f1f5f9 !important;
}

tr.risk-high{
  background:rgba(220,38,38,.06);
}

tr.risk-medium{
  background:rgba(245,158,11,.08);
}

/* =========================
   TG-STYLE LESSON CARDS
========================= */
.page-title{
  margin:12px 0 20px;
}

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

.tg-card{
  display:block;
  background: var(--surface);
  box-shadow: var(--shadow);
  border-radius:14px;
  overflow:hidden;
  text-decoration:none;
  color:var(--text);
  transition:transform .15s ease, box-shadow .15s ease;
}

.tg-card:hover{
  transform:translateY(-2px);
  box-shadow:0 10px 26px rgba(0,0,0,.12);
}

.tg-card__img{
  position: relative;
  width: 100%;
  padding-top: 100%;      /* 🔥 КВАДРАТ */
  background: var(--surface-2);
  overflow: hidden;
}

.tg-card__img img{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}


.tg-card__body{
  padding:12px 12px 14px;
}

.tg-card__title{
  font-weight:600;
  font-size:15px;
  line-height:1.3;
  margin-bottom:8px;
}

.tg-card__tags{
  display:flex;
  gap:6px;
  flex-wrap:wrap;
}

.tg-tag{
  font-size:11px;
  padding:4px 8px;
  border-radius:999px;
  background:var(--surface-2);
  color:#555;
}

/* badges */
.badge{
  position:absolute;
  top:8px;
  right:8px;
  background:rgba(0,0,0,.7);
  color:var(--surface);
  font-size:12px;
  padding:6px 8px;
  border-radius:10px;
  pointer-events:none;
}

.badge.done{
  right:44px;
}

/* =========================
   RESPONSIVE
========================= */
@media (max-width:640px){
  .header-inner{
    flex-direction:column;
    align-items:flex-start;
    gap:8px;
  }

  .main-nav{
    flex-wrap:wrap;
  }
}

@media (max-width:480px){
  .tg-cards{
    grid-template-columns:repeat(2,1fr);
    gap:12px;
  }
}

@media (hover:none){
  .tg-card:hover{
    transform:none;
    box-shadow:0 6px 20px rgba(0,0,0,.08);
  }
}


/* =========================
   LESSON FILTERS
========================= */
.lessons-filters{
  display:flex;
  flex-direction:column;
  gap:12px;
  margin-bottom:20px;
}




.tag-filter{
  font-size:12px;
  padding:6px 10px;
  border-radius:999px;
  background:var(--surface-2);
  color:var(--text);
  cursor:pointer;
  user-select:none;
}

.tag-filter.active{
  background:var(--text);
  color:var(--surface);
}

.site-header {
  position: relative;
  z-index: 1000;
}

.tg-card {
  position: relative;
  z-index: 1;
}


/* ===== LESSON PAGE ===== */

.lesson-header {
  margin-bottom: 20px;
}

.lesson-title {
  font-size: 26px;
  margin-bottom: 8px;
}

.lesson-description {
  color: var(--text-muted);
  max-width: 700px;
}

.lesson-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
}

.lesson-video {
  background: var(--surface);
  border-radius: 14px;
  padding: 16px;
}

.lesson-steps {
  background: var(--surface);
  border-radius: 14px;
  padding: 16px;
}

.steps-title {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
}

.steps-count {
  font-size: 13px;
  color: var(--text-muted);
}

.steps-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.step-item a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
}

.step-item a:hover {
  background: var(--surface-2);
}

.step-item.active a {
  background: #eef2ff;
  font-weight: 600;
}

.step-item.completed .step-title {
  opacity: 0.6;
}


.step-check {
  margin-left: auto;
  color: #16a34a;
  font-weight: bold;
}

.step-row {
  display: flex;
  align-items: center;
  justify-content: space-between; /* 🔥 ключевое */
  width: 100%;
}

.step-link {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;              /* 🔥 растягивается */
  min-width: 0;         /* важно для длинных названий */
  text-decoration: none;
  color: var(--text);
}

.step-check-toggle {
  flex-shrink: 0;
  margin-left: 12px;
}



@media (max-width: 900px) {
  .lesson-layout {
    grid-template-columns: 1fr;
  }
}

.lesson-step.done {
  opacity: .6;
}

.lesson-step .check {
  color: #22c55e;
  font-weight: bold;
}

.progress-info {
  font-size: 14px;
  margin-bottom: 6px;
  color: #555;
}


/* ===== Lesson progress ===== */
.lesson-progress {
  margin: 16px 0 24px;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  margin-bottom: 6px;
}

.progress-bar {
  height: 8px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #ff7a59, #d9534f);
  transition: width 0.3s ease;
}


/* WATERMARK */
.video-watermark {
  position: absolute;
  bottom: 12px;
  right: 12px;

  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  background: rgba(0, 0, 0, 0.25);

  padding: 4px 8px;
  border-radius: 6px;

  pointer-events: none;
  user-select: none;
  z-index: 10;
}


.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  padding: 10px;
  border-bottom: 1px solid var(--border);
}

.admin-table a {
  color: #4f46e5;
  text-decoration: none;
}

@media (max-width: 768px) {
  .site-header {
    display: none;
  }

  .container {
    margin-top: 16px;
  }
}


@media (max-width: 768px) {
 body {
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
}

}

/* iOS: disable fake fullscreen button */
@supports (-webkit-touch-callout: none) {
  #fakeFullscreenBtn {
    display: none !important;
  }
}

/* ===== Compact lesson progress ===== */

.lesson-progress.compact {
  margin-top: 14px;
}

.lesson-progress.compact .progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.progress-text {
  font-size: 13px;
  color: #555;
}

/* нейтральная кнопка */
.progress-btn {
  background: var(--surface-2);
  border: 1px solid #e5e7eb;
  color: var(--text);
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
}


.progress-btn:hover {
  background: var(--surface-2);
}

/* убираем "кричащий" primary-стиль */
.lesson-video .btn.primary {
  background: unset;
  color: inherit;
}

.progress-btn.done {
  background: var(--surface-2);
  color: #6b7280;
  cursor: default;
}


.lesson-progress.compact {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

/* =========================
   LESSON STEPS — FINAL FIX
========================= */

.step-item {
  margin-bottom: 8px;
}

.step-row {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
}

.step-row:hover {
  background: var(--surface-2);
}

.step-item.active .step-row {
  background: #eef2ff;
}

.step-link {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  text-decoration: none;
  color: var(--text);
}

.step-check-toggle {
  flex-shrink: 0;
  margin-left: 12px;
  display: flex;
  align-items: center;
}

/* custom checkbox */
.step-check-toggle input {
  display: none;
}

.step-check-toggle .checkmark {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 2px solid #c7c7c7;
  background: var(--surface);
  position: relative;
}

.step-check-toggle input:checked + .checkmark {
  background: #22c55e;
  border-color: #22c55e;
}

.step-check-toggle input:checked + .checkmark::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 0px;
  width: 5px;
  height: 10px;
  border: solid var(--surface);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* ===== STEP CARDS (как во 2-м фото) ===== */

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

.step-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border-radius: 14px;
  padding: 10px;
  border: 1px solid var(--border);
  position: relative;
}

.step-card.active {
  background: var(--accent-soft);
}

.step-card.completed {
  opacity: 0.6;
}

.step-card-link {
  display: flex;
  gap: 12px;
  align-items: center;
  flex: 1;
  text-decoration: none;
  color: inherit;
}

.step-thumb {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface-2);
  flex-shrink: 0;
}

.step-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.step-info {
  font-size: 14px;
  line-height: 1.3;
}

.btn.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: #555;
}

.hidden {
  display: none;
}

.admin-step-body input {
  width: 100%;
  padding: 8px 10px;
  margin-bottom: 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 14px;
}

.step-edit-actions {
  display: flex;
  gap: 8px;
}

.admin-step-meta {
  font-size: 13px;
  color: var(--text-muted);
}

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

/* планшет */
@media (min-width: 768px) {
  .lessons-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* десктоп */
@media (min-width: 1100px) {
  .lessons-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.card-media__image {
  aspect-ratio: 1 / 1;
}
/* большой экран */
@media (min-width: 1500px) {
  .lessons-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

.lesson-card {
  background: var(--surface);
  border-radius: 18px;
  overflow: hidden;
  text-decoration: none;
  color: var(--text-2);
  box-shadow: 0 10px 30px rgba(0,0,0,.04);
  transition: transform .2s ease, box-shadow .2s ease;
}

.lesson-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 40px rgba(0,0,0,.08);
}

.lesson-cover {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--surface-2);
  overflow: hidden;
}

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

.lesson-body {
  padding: 16px 18px 20px;
}

.lesson-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
}

.lesson-subtitle {
  margin-top: 6px;
  font-size: 13px;
  color: #6b7280;
}

.lessons-list-panel {
  background: var(--surface);
  border-radius: 24px;
  padding: 24px;
  box-shadow: 0 14px 40px rgba(0,0,0,.05);
}



.lessons-list-panel .lesson-card {
  box-shadow: none;
  border: 1px solid var(--border);
}

.lessons-list-panel .lesson-card:hover {
  box-shadow: 0 10px 26px rgba(0,0,0,.08);
}


.step-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
}


.admin-textarea {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
background: var(--surface);
color: var(--text);
  font-size: 14px;
  resize: vertical;
}

.admin-textarea:focus {
  outline: none;
  border-color: #6b4eff;
}

html,
body {
  overflow-x: hidden;
}

/* =========================================
   BASE PAGE CONTAINER
========================================= */

.page-container {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 16px clamp(16px, 3vw, 32px) 96px;
  box-sizing: border-box;
}

/* узкий вариант */
.page-container--narrow {
  max-width: 720px;
}

/* широкий (админка) */
.page-container--wide {
  max-width: 1100px;
}

@import url('./bottom-nav.css');



body[data-entity="recipes"] .container {
  padding: 18px 16px 32px;
}

.tg-body.section-items > * + * {
  margin-top: 16px;
}

/* ===== CARD APPEAR ANIMATION ===== */

[data-theme="dark"] {

  --bg:#111213;
  --text:#f1f1f1;
  --muted:#aaa;
  --accent-soft: rgba(123,140,255,0.18);
  --card:#1b1c1e;
  --surface:#1b1c1e;
  --surface-2:#202124;

  --border:#2a2b2e;

  --text-2:#d1d5db;
  --text-muted:#9ca3af;

  --accent:#ff7a59;
  --accent-2:#ff9b7f;

  --shadow-sm:none;
  --shadow:none;
  --shadow-lg:none;

  --overlay:rgba(0,0,0,.6);
  --overlay-strong:rgba(0,0,0,.85);

}

.lesson-video,
.lesson-steps,
.lesson-card,
.lessons-list-panel,
.loader-card {
  background: var(--surface);
}

:root {

  --nav-bg: rgba(255,255,255,0.85);
  --nav-text: #8f95a3;
  --nav-text-active: #5c5166;
  --nav-shadow: 0 4px 18px rgba(0,0,0,0.05);

}

[data-theme="dark"] {

  --nav-bg: rgba(28,29,31,0.85);
  --nav-text: #9ca3af;
  --nav-text-active: #c4b5fd;
  --nav-shadow: 0 4px 18px rgba(0,0,0,0.6);

}

.marketing-lesson-image {

  width: 100%;
  aspect-ratio: 1 / 1;

  border-radius: 14px;
  overflow: hidden;

  background: var(--surface);

}

.marketing-lesson-image img {

  width: 100%;
  height: 100%;
  object-fit: cover;

}

/* HERO CARD */

.premium-hero {

  background: linear-gradient(
    180deg,
    #ece7f2,
    #e3ddea
  );

  color: #111;

}


/* ===== DARK ===== */

[data-theme="dark"] .premium-hero {

  background: linear-gradient(
    180deg,
    #1c1d21,
    #141518
  );

  color: #fff;

  box-shadow:
    0 10px 30px rgba(0,0,0,.6),
    inset 0 1px 0 rgba(255,255,255,.05);

}

[data-theme="dark"] .hero-subtitle {
  color: #cfcfd4;
}

[data-theme="dark"] .lesson-title {
  color: #ffffff;
}


[data-theme="dark"] .big-cta {

  background: linear-gradient(
    135deg,
    #5b6cff,
    #4a5de0
  );

  color: #fff;

}

[data-theme="dark"] .big-cta {

  background: linear-gradient(
    135deg,
    #5b6cff,
    #4a5de0
  );

  color: #fff;

}

/* ===============================
   PREMIUM HERO GLASS
================================ */

.premium-hero {

  border-radius: 26px;
  padding: 28px 22px;

  background: linear-gradient(
    180deg,
    rgba(255,255,255,0.7),
    rgba(255,255,255,0.4)
  );


  box-shadow:
    0 10px 30px rgba(0,0,0,0.08),
    inset 0 1px 0 rgba(255,255,255,0.6);

  color: #111;

}



/* ===============================
   DARK PREMIUM
================================ */

[data-theme="dark"] .premium-hero {

  background: linear-gradient(
    180deg,
    rgba(30,31,35,0.9),
    rgba(18,19,22,0.85)
  );


  box-shadow:
    0 12px 40px rgba(0,0,0,0.6),
    inset 0 1px 0 rgba(255,255,255,0.05);

  color: #fff;

}

.big-cta {

  border-radius: 14px;

  background: linear-gradient(
    135deg,
    #6a7cff,
    #4f63e6
  );

  color: #fff;

  box-shadow:
    0 6px 18px rgba(80,90,255,.4);

  transition: .15s;
}

.big-cta:active {
  transform: scale(.97);
}


[data-theme="dark"] .big-cta {

  background: linear-gradient(
    135deg,
    #5a6bff,
    #3f52d9
  );

}

/* ===============================
   HERO — LIGHT
================================ */

.lesson-hero.premium-hero {

  border-radius: 26px;
  padding: 28px 22px;

  background: linear-gradient(
    180deg,
    #ffffff,
    #f3eef8
  );

  box-shadow:
    0 10px 30px rgba(0,0,0,0.08);

  color: #111;

}


/* ===============================
   HERO — DARK
================================ */

[data-theme="dark"] .lesson-hero.premium-hero {

  background: linear-gradient(
    180deg,
    #1e1f23,
    #141519
  );

  box-shadow:
    0 12px 40px rgba(0,0,0,0.6);

  color: #ffffff;

}

[data-theme="dark"] .lesson-hero .lesson-title {
  color: #ffffff;
}

[data-theme="dark"] .lesson-hero .hero-subtitle {
  color: #aeb3bd;
}

.recipes-subtitle {
  text-align: center;
  color: var(--text-muted);
  margin-top: 6px;
}

[data-theme="dark"] .recipes-subtitle {
  color: #b5b8c5;
}


/* ===== TELEGRAM SAFE TOP ===== */
body {
  padding-top: calc(env(safe-area-inset-top) + 40px);
}

body {
  min-height: var(--tg-viewport-height);
}


.sticky-cta {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;

  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));

  background: rgba(255,255,255,0.9);

  transform: translateY(120%);
  transition: transform .35s ease;

  z-index: 1000;
}

.sticky-cta.show {
  transform: translateY(0);
}

/* =========================
   PAGE FADE
========================= */


@keyframes pageFadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.recipes-group{
  margin-bottom:28px;
}

.recipes-group-title{
  font-size:20px;
  font-weight:600;
  margin-bottom:14px;
}



.recipe-tile-title {
  position: relative;
  font-weight: 600;
}

.recipes-group-title.hidden {
  display: none;
}

.recipes-grid{
  display:grid;
  grid-template-columns:repeat(2,1fr);
  gap:14px;
}

.recipe-tile{
  position:relative;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:12px;
  text-align:center;

  aspect-ratio:16/9;   /* одинаковая форма */
  
  border-radius:18px;
  background-size:cover;
  background-position:center;
  overflow:hidden;
  
  color:white;
  text-decoration:none;
}



.recipe-tile-title{
  position:relative;
  font-weight:600;
  font-size:14px;
  line-height:1.2;
}

@media (min-width:500px){
  .recipes-grid{
    grid-template-columns:repeat(3,1fr);
  }
}

@media (min-width:800px){
  .recipes-grid{
    grid-template-columns:repeat(4,1fr);
  }
}

@media (min-width:1500px){
  .recipes-grid{
    grid-template-columns:repeat(5,1fr);
  }
}

.recipe-tile-title{
  position:absolute;
  inset:0;

  display:flex;
  align-items:center;
  justify-content:center;

  text-align:center;

  font-weight:600;
  font-size:15px;

  color:#fff;                /* одинаковый цвет для обеих тем */
  text-shadow:0 2px 8px rgba(0,0,0,0.7);

  padding:12px;

  z-index:2;
}
.recipe-tile{
  transition:transform .15s ease;
}

.recipe-tile:active{
  transform:scale(.97);
}

.recipes-empty{
  color:var(--text-muted);
  font-size:14px;
  padding:10px 4px;
}

.recipes-group:first-child .recipes-group-title {
  margin-top: 0;
}

.recipes-empty{

  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;

  text-align:center;

  padding:40px 20px 20px;

  color:var(--text-muted);

}

.recipes-empty-icon{
  font-size:32px;
  margin-bottom:10px;
  opacity:.7;
}

.recipes-empty-title{
  font-size:16px;
  font-weight:600;
  color:var(--text);
  margin-bottom:4px;
}

.recipes-empty-subtitle{
  font-size:13px;
  opacity:.7;
}

.hidden{
  display:none;
}


.recipe-search-clear{

  position:absolute;
  right:10px;
  top:50%;
  transform:translateY(-50%);

  width:26px;
  height:26px;

  border-radius:50%;
  border:none;

  display:flex;
  align-items:center;
  justify-content:center;

  background:var(--surface-2);
  color:var(--text-muted);

  cursor:pointer;
  font-size:14px;
  line-height:1;

}



.recipe-filters{

  display:flex;
  gap:8px;

  overflow-x:auto;
  padding-bottom:4px;

  scrollbar-width:none;
}

.recipe-filters::-webkit-scrollbar{
  display:none;
}

.filter-tag{
  flex-shrink:0;
}

.admin-recipes-actions{

  display:flex;
  gap:10px;
  justify-content:flex-end;

  max-width:900px;
  margin:0 auto 14px;

}

.admin-btn{

  padding:8px 14px;
  border-radius:12px;

  font-size:14px;
  text-decoration:none;

  border:1px solid var(--border);
  color:var(--text);

}

.admin-btn.primary{

  background:linear-gradient(135deg,#7c6cff,#6a5cff);
  color:white;
  border:none;

}

.admin-btn.ghost{

  background:transparent;

}

.admin-btn:active{
  transform:scale(.96);
}

.filters-scroll{
  margin-top: 0;
}

.lessons-search{
  margin-bottom:0;
  touch-action: manipulation;
}

.lessons-search {
  margin-bottom: 0;
}

.tag-filters{
  margin-top:0 !important;
}


.recipes-group{
  margin-bottom:28px;
}

.recipes-group-title{
  margin-top:18px;
}

.recipe-tile{
  position:relative;
  display:block;
  border-radius:18px;
  overflow:hidden;
}

.card-media__image{
  position:relative;
  width:100%;
  aspect-ratio:16 / 9;   /* как было раньше */
  overflow:hidden;
}

.card-media__image img{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  object-fit:cover;
}

/* =========================
   RECIPE SEARCH — SAME AS LESSONS
========================= */

#recipeSearch{
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);

  height: 48px;
  padding: 0 18px;

  border-radius: 16px;

  font-size: 15px;
  line-height: 1;

  width: 100%;
  box-sizing: border-box;
}

#recipeSearch:focus{
  outline: none;
  border-color: #c7d2fe;
}

#lessonSearch{
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);

  height: 48px;
  padding: 0 18px;

  border-radius: 16px;

  font-size: 15px;
  line-height: 1;

  width: 100%;
  box-sizing: border-box;
}

#lessonSearch:focus{
  outline: none;
  border-color: #c7d2fe;
}


.lessons-empty {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .25s ease, transform .25s ease;
}

.lessons-empty.show {
  opacity: 1;
  transform: translateY(0);
}


/* =========================
   RECIPE SEARCH CONTAINER
========================= */

.recipe-search-box{
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
   flex:1;
}

.recipe-search-box input{
  width: 100%;
  padding-right: 36px; /* чтобы крестик не перекрывал текст */
}

#recipeSearch{
  width:100%;
  flex:1;
}

/* =========================
   TELEGRAM MODAL
========================= */

.tg-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;

  display: flex;
  align-items: center;
  justify-content: center;
}

.tg-modal.hidden {
  display: none;
}

.tg-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.45);
}

.tg-modal-card {
  position: relative;
  z-index: 2;

  width: 92%;
  max-width: 340px;

  padding: 26px 24px;

  border-radius: 18px;

  background: var(--surface);
  color: var(--text);

  text-align: center;

  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}

.tg-modal-icon {
  font-size: 34px;
  margin-bottom: 10px;
}

.tg-modal-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}

.tg-modal-text {
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-muted);
  margin-bottom: 18px;
}

.tg-modal-btn {
  display: block;

  padding: 12px;

  border-radius: 12px;

  background: #2AABEE;
  color: white;

  text-decoration: none;
  font-weight: 600;

  transition: .15s;
}

.tg-modal-btn:active {
  transform: scale(.97);
}

.tg-modal-close {
  position: absolute;

  top: 10px;
  right: 12px;

  border: none;
  background: transparent;

  font-size: 18px;
  cursor: pointer;

  opacity: .6;
}

/* =========================
   TELEGRAM BADGE
========================= */

.recipe-telegram-badge{
  position:absolute;
  top:10px;
  left:10px;

  width:32px;
  height:32px;

  display:flex;
  align-items:center;
  justify-content:center;

  border-radius:10px;

  background:rgba(255,255,255,0.15);

  border:1px solid rgba(255,255,255,0.25);

  box-shadow:
    0 4px 12px rgba(0,0,0,0.25);

  z-index:5;
}

[data-theme="dark"] .recipe-telegram-badge{
  background:rgba(0,0,0,0.35);
  border:1px solid rgba(255,255,255,0.08);
}

.recipe-telegram-badge svg{
  width:16px;
  height:16px;
  fill:#2AABEE;
}

.recipe-card:has(.recipe-telegram-badge),
.recipe-card:has(.recipe-emoji-badge){
}



[data-gesture]{
  touch-action: pan-y;
}

.bottom-nav__item{
  touch-action: manipulation;
}

.bottom-nav__item:active{
  transform: scale(.92);
}

.card-appear {
  opacity: 1;
  transform: none;
}

.recipe-emoji-badge{
position:absolute;
top:10px;
left:10px;

width:36px;
height:36px;

display:flex;
align-items:center;
justify-content:center;

font-size:20px;

background:rgba(255,255,255,0.85);

border-radius:10px;
}

.recipe-emoji-badge{
  position:absolute;
  top:10px;
  left:10px;

  width:32px;
  height:32px;

  display:flex;
  align-items:center;
  justify-content:center;

  border-radius:10px;

  background:rgba(255,255,255,0.15);

  border:1px solid rgba(255,255,255,0.25);

  box-shadow:
    0 4px 12px rgba(0,0,0,0.25);

  z-index:5;

  font-size:18px;
}

[data-theme="dark"] .recipe-emoji-badge{
  background:rgba(0,0,0,0.35);
  border:1px solid rgba(255,255,255,0.08);
}

.recipe-emoji-badge img{
width:18px;
height:18px;
display:block;
}

.recipe-emoji-badge img{
width:20px;
height:20px;
display:block;
}

.recipe-emoji-badge img{
  width:20px;
  height:20px;
  display:block;
  filter: drop-shadow(0 0 2px rgba(0,0,0,0.35));
}


.gallery-img{
  border-radius:12px;
}

/* =========================
   GALLERY GRID
========================= */

.gallery-grid{
  display:grid;
  gap:6px;
  margin-bottom:10px;
}

/* =========================
   ITEM
========================= */

.gallery-item{
  position:relative;
  overflow:hidden;
  border-radius:12px;
}

.gallery-img{
  aspect-ratio:1/1;
  cursor:pointer;
  transition:transform .25s ease;
  border-radius:12px;
}

.gallery-item:hover .gallery-img{
  transform:scale(1.05);
}

/* =========================
   DELETE BUTTON
========================= */

.gallery-delete{
  position:absolute;
  top:6px;
  right:6px;
  width:24px;
  height:24px;
  border:none;
  border-radius:50%;
  background:rgba(0,0,0,.6);
  color:#fff;
  cursor:pointer;
}

/* =========================
   1 IMAGE
========================= */

.gallery-count-1{
  grid-template-columns:1fr;
}

.gallery-count-1 .gallery-img{
  aspect-ratio:16/9;
}

/* =========================
   2 IMAGES
========================= */

.gallery-count-2{
  grid-template-columns:1fr 1fr;
}

/* =========================
   3 IMAGES
========================= */

.gallery-count-3{
  grid-template-columns:2fr 1fr;
  grid-template-rows:1fr 1fr;
}

.gallery-count-3 .gallery-item:nth-child(1){
  grid-row:1 / span 2;
}

/* =========================
   4 IMAGES
========================= */

.gallery-count-4{
  grid-template-columns:1fr 1fr;
}

/* =========================
   5 IMAGES
========================= */

.gallery-count-5{
  grid-template-columns:repeat(6,1fr);
}

.gallery-count-5 .gallery-item:nth-child(1){
  grid-column:1 / span 3;
}

.gallery-count-5 .gallery-item:nth-child(2){
  grid-column:4 / span 3;
}

.gallery-count-5 .gallery-item:nth-child(3){
  grid-column:1 / span 2;
}

.gallery-count-5 .gallery-item:nth-child(4){
  grid-column:3 / span 2;
}

.gallery-count-5 .gallery-item:nth-child(5){
  grid-column:5 / span 2;
}

/* =========================
   6 IMAGES
========================= */

.gallery-count-6{
  grid-template-columns:repeat(3,1fr);
}

/* =========================
   7+ IMAGES
========================= */

.gallery-grid[class*="gallery-count-"]
:not(.gallery-count-1)
:not(.gallery-count-2)
:not(.gallery-count-3)
:not(.gallery-count-4)
:not(.gallery-count-5)
:not(.gallery-count-6){
  grid-template-columns:repeat(3,1fr);
}

/* =========================
   MOBILE
========================= */
@media (max-width:600px){

.gallery-grid{
  gap:4px;
}

/* 3 фото */

.gallery-count-3 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  grid-template-rows: 1fr 1fr; /* две строки равной высоты */
  gap: 4px; /* расстояние между фото */
}

.gallery-count-3 .gallery-item:nth-child(1) {
  grid-row: 1 / span 2; /* занимает две строки */
  height: 100%;          /* растягиваем по высоте двух маленьких */
  aspect-ratio: auto;    /* убираем ограничение 1/1 */
  
}

.gallery-count-3 .gallery-item:nth-child(2),
.gallery-count-3 .gallery-item:nth-child(3) {
  aspect-ratio: 1/1;     /* маленькие фото остаются квадратными */
  height: 100%;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;      /* заполняем всю область без искажений */
  display: block;
}
}

/* FIX 3 images desktop */

.gallery-count-3 .gallery-item:nth-child(1) {
  grid-row: 1 / span 2;
  aspect-ratio: auto;
  height: 100%;
}

.gallery-count-3 .gallery-item:nth-child(1) .gallery-img {
  height: 100%;
  object-fit: cover;
}

.gallery-grid {
  max-width: 900px;
  margin: 0 auto;
}

.gallery-block {
  max-width: 900px;   /* подбери под дизайн */
  margin: 0 auto;     /* 💥 центрирование */
  width: 100%;
}

.gallery-grid {
  width: 100%;
}

.gallery-block {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 12px; /* чтобы не липло к краям */
}



.lesson-search-box{
  position:relative;
}

.lesson-search-clear{
  position:absolute;
  right:10px;
  top:50%;
  transform:translateY(-50%);
  
  border:none;
  background:none;
  font-size:16px;
  cursor:pointer;
  opacity:.6;
}

.lesson-search-clear:hover{
  opacity:1;
}

.lessons-empty{
  text-align:center;
  padding:40px 20px;

  opacity:0;
  transform:translateY(12px);
  transition:.25s ease;
}

.lessons-empty:not(.hidden){
  opacity:1;
  transform:none;
}

/* =========================
   TELEGRAM NOTICE
========================= */

.telegram-notice{

  max-width:520px;
  margin:40px auto;
  padding:36px 28px;

  border-radius:22px;

  text-align:center;

  transition:all .2s ease;

}


/* =========================
   LIGHT THEME
========================= */

html[data-theme="light"] .telegram-notice{

  background:#ffffff;

  box-shadow:
    0 10px 28px rgba(0,0,0,0.08),
    0 2px 6px rgba(0,0,0,0.05);

}


/* =========================
   DARK THEME
========================= */

html[data-theme="dark"] .telegram-notice{

  background:#1f1f23;

  box-shadow:
    0 10px 30px rgba(0,0,0,0.45),
    inset 0 1px 0 rgba(255,255,255,0.04);

}


/* =========================
   ICON
========================= */

.telegram-notice-icon{

  font-size:48px;
  margin-bottom:14px;

  animation:telegramFloat 3s ease-in-out infinite;

}


/* =========================
   TITLE
========================= */

.telegram-notice-title{

  font-size:22px;
  font-weight:600;

  margin-bottom:12px;

}


/* =========================
   TEXT
========================= */

.telegram-notice-text{

  font-size:15px;
  line-height:1.5;

  opacity:.75;

  margin-bottom:24px;

}


/* =========================
   BUTTON
========================= */

.telegram-notice-btn{

  display:inline-flex;
  align-items:center;
  justify-content:center;

  padding:12px 20px;

  border-radius:14px;

  font-size:15px;
  font-weight:600;

  text-decoration:none;

  background:#2AABEE;
  color:white;

  transition:all .18s ease;

}

.telegram-notice-btn:hover{
  background:#229ED9;
}

.telegram-notice-btn:active{
  transform:scale(.96);
}


/* =========================
   ICON FLOAT
========================= */

@keyframes telegramFloat{

  0%{ transform:translateY(0); }

  50%{ transform:translateY(-6px); }

  100%{ transform:translateY(0); }

}

.loader-logo {
  font-size: 48px;
  margin-bottom: 12px;

}

.telegram-transfer-icons{

  font-size:42px;
  display:flex;
  align-items:center;
  justify-content:center;

  gap:14px;

  margin-bottom:16px;

}


/* Telegram */

.tg-icon{
  animation: tgMove 3s ease-in-out infinite;
}


/* Arrow */

.arrow{
  opacity:.5;
}


/* Cake */

.cake-icon{
  animation: cakeAppear 3s ease-in-out infinite;
}


/* Telegram fly */

@keyframes tgMove{

  0%{
    transform:translateX(0);
    opacity:1;
  }

  40%{
    transform:translateX(18px);
  }

  60%{
    opacity:0;
  }

  100%{
    transform:translateX(18px);
    opacity:0;
  }

}


/* Cake appear */

@keyframes cakeAppear{

  0%{
    opacity:0;
    transform:scale(.8);
  }

  40%{
    opacity:0;
  }

  60%{
    opacity:1;
    transform:scale(1.1);
  }

  100%{
    opacity:1;
    transform:scale(1);
  }

}

.loader-spinner {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid #eee;
  border-top: 3px solid #d9cce0;
  /* animation: spin .8s linear infinite; */ /* отключили для быстрого рендера */
  margin: 0 auto;
}

.avatar {
  width: 48px;
  height: 48px;
  min-width: 48px;
  max-width: 48px;

  border-radius: 50%;
  overflow: hidden;

  position: relative;

  display: grid;
  place-items: center;

  background: #FF6B6B; /* на всякий */
}

.avatar-fallback {
  font-size: 20px;
  font-weight: 600;
  color: #fff;

  transform: translateY(-1px);
}

.avatar img + .avatar-fallback {
  display: none;
}

.video-preview {
  position: relative;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

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

/* 🔥 кнопка */
.video-play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  
  width: 64px;
  height: 64px;
  border-radius: 50%;

  background: rgba(0, 0, 0, 0.6);
  color: white;

  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 28px;
  transition: all 0.2s ease;
}

/* hover эффект */
.video-preview:hover .video-play-btn {
  transform: translate(-50%, -50%) scale(1.1);
  background: rgba(0, 0, 0, 0.8);
}

.video-play-btn {
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-play-btn span {
  transform: translateX(2px); /* подбирай 1–3px */
}

/* ===== AUTH PAGE ===== */

.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border-radius: 24px;
  padding: 28px;
  box-shadow: var(--shadow);
  text-align: center;
}

/* header */
.auth-logo {
  font-size: 36px;
  margin-bottom: 8px;
}

.auth-header h1 {
  font-size: 20px;
  margin: 0;
}

.auth-sub {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* form */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}

.auth-form input {
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

/* кнопка */
.btn-primary {
  margin-top: 6px;
  padding: 14px;
  border-radius: 14px;
  border: none;
  background: var(--accent);
  color: white;
  font-weight: 600;
  cursor: pointer;
}

/* divider */
.auth-divider {
  margin: 18px 0;
  font-size: 13px;
  color: var(--text-muted);
}

/* telegram */
.tg-login {
  margin-top: 8px;
}

/* error */
.auth-error {
  background: #ff4d4f20;
  color: #ff4d4f;
  padding: 10px;
  border-radius: 12px;
  margin-top: 12px;
  font-size: 13px;
}

.email-box {
  margin-top: 12px;
  padding: 12px;
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-weight: 500;
}

/* ===== AUTH ===== */

.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border-radius: 24px;
  padding: 28px;
  box-shadow: var(--shadow);
  text-align: center;
}

/* header */
.auth-logo {
  font-size: 36px;
  margin-bottom: 8px;
}

.auth-sub {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* form */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-form input {
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

/* button */
.btn-primary {
  padding: 14px;
  border-radius: 14px;
  border: none;
  background: #c4b5fd;
  color: white;
  font-weight: 600;
  cursor: pointer;
}

/* hint */
.auth-hint {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 10px;
}

/* divider */
.auth-divider {
  margin: 20px 0;
  font-size: 13px;
  color: var(--text-muted);
}

/* success */
.auth-success {
  background: rgba(76, 175, 80, 0.1);
  color: #4caf50;
  padding: 10px;
  border-radius: 12px;
  margin-bottom: 12px;
}

.btn-secondary {
  display: block;
  width: 100%;
  padding: 14px;
  margin-top: 16px;
  border-radius: 10px;
  text-align: center;
  text-decoration: none;
  font-size: 16px;
  background: #f3f3f3;
  color: #000;
  border: 1px solid #ddd;
}

.btn-secondary:hover {
  background: #eaeaea;
}

/* Telegram блок (вторичный) */
.tg-alt {
  margin-top: 20px;
  text-align: center;
  font-size: 14px;
  color: #777;
}

.tg-widget {
  margin-top: 10px;
}

/* Footer (покупка) */
.auth-footer {
  margin-top: 24px;
  font-size: 14px;
  color: #777;
  text-align: center;
}

.auth-footer a {
  color: #000;
  text-decoration: underline;
}

.auth-footer a:hover {
  opacity: 0.7;
}

.auth-error {
  background: #ffe5e5;
  color: #c00;
  padding: 10px;
  border-radius: 8px;
  margin-bottom: 15px;
  text-align: center;
}

input[name="code"] {
  letter-spacing: 6px;
  text-align: center;
  font-size: 20px;
}

#app-loader {
  padding-top: env(safe-area-inset-top);
}

.no-tg #app-loader {
  padding-top: 0;
}

#app-loader {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  z-index: 9999;

  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

/* 🔥 ВОТ ЭТО ДОБАВЬ */
.no-tg #app-loader {
  padding-top: 0 !important;
}

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

.card-media__image {
  aspect-ratio: 1 / 1;
  background: #f3f3f3;
}

body {
  padding-top: 5px !important;
}