body{
  background:var(--bg);
  margin:0;
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif;
}

.lesson-wrap{
  max-width:960px;
  margin:0 auto;
  padding:16px 20px 80px;
}

.tg-post{
  background:var(--surface);
  box-shadow:var(--shadow);
  border-radius:16px;
  margin-bottom:18px;
  overflow:hidden;
  
}

.tg-header{
  padding:18px 18px 12px;
  font-weight:600;
  font-size:20px;
  line-height:1.3;
  border-bottom:1px solid var(--border);
color:var(--text);
  text-align:center;
}



.video-wrapper iframe {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
border: none;
display: block;
}

/* =========================
   VIDEO LIMIT (RESPONSIVE)
========================= */

.video-wrapper {
  position: relative;

  width: 100%;
  max-width: 420px;   /* ограничение ширины */
  max-height: 80vh;   /* ограничение по высоте */

  aspect-ratio: 9 / 16;

  margin: 10px auto 16px;

  border-radius: 18px;
  overflow: hidden;
}

.video-preview {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
cursor: pointer;
}

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

.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);
display: flex;
align-items: center;
justify-content: center;
font-size: 26px;
color: white;
transition: 0.2s;
}

.video-preview:hover .play-btn {
transform: translate(-50%, -50%) scale(1.1);
background: rgba(0,0,0,0.8);
}

#video-watermark {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 100;
}

.video-wrapper .wm{
  position:absolute;
  inset:0;
  pointer-events:none;
  z-index:10;
}

.video-wrapper {
  position: relative;
  isolation: isolate;
}


.video-wrapper {
  position: relative;
  width: 100%;
  margin-top: 8px;   /* можно 0 если нужно совсем без воздуха */
}

.video-wrapper iframe {
  width: 100%;
  aspect-ratio: 9 / 16;
  border: none;
  border-radius: 16px;
}


.video-wrapper.is-expanded iframe {
  aspect-ratio: auto;
  height: 80vh;
}


.tg-body{
  padding:14px 18px 20px;
  line-height:1.55;
  font-size:15px;
  max-width:92%;
  margin:0 auto;
   color:var(--text);
}

.access-block{
  position:fixed;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  background:var(--bg);
  z-index:999999;
}

.access-card{
  background:var(--surface);
color:var(--text);
  padding:40px 30px;
  border-radius:16px;
  box-shadow:0 10px 30px rgba(0,0,0,0.08);
  text-align:center;
  max-width:320px;
  width:90%;
}

body{
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.tg-body,
.tg-header{
  -webkit-user-select: none;
  user-select: none;
}

.reload-btn{
  border:none;
  background:#2AABEE;
  color:white;
  padding:12px 26px;
  border-radius:12px;
  font-size:15px;
  cursor:pointer;
}

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

.cover-img{
  display:block;
  max-width:84%;
  margin:14px auto 12px;
  border-radius:18px;
  box-shadow:0 8px 22px rgba(0,0,0,.08);
}

.contents-link{
  display:block;
 padding:4px 0;
  font-size:15px;
  line-height:1.4;
  color:#2AABEE;
  text-decoration:none;
}

.contents-link:active{
  opacity:.6;
}

.ingredients-box{
  border:1px solid var(--border);
background:var(--surface);
  border-radius:12px;
  padding:12px 14px;
  display:flex;
  flex-direction:column;
  gap:10px;
  font-size:15px;

  margin:10px 0 16px;
}




.ingredient-row{
  display:flex;
  gap:8px;
  align-items:flex-end;
}

.ingredient-row .line{
  flex:1;
  border-bottom:1px dashed #ddd;
}

.ingredient-row span:first-child{
  white-space:nowrap;
}


.ingredient-row .amount{
  color:var(--text-muted);
  white-space:nowrap;
}

.steps-box{
  display:flex;
  flex-direction:column;
  gap:12px;
  margin:12px 0 18px;   /* без auto */
}


.step-row{
  display:flex;
  gap:14px;
  align-items:center;
  border-radius:14px;
  padding:14px 16px;
  background:var(--surface);
  border:1px solid var(--border);
}


.step-circle{
  min-width:28px;
  height:28px;
  border-radius:50%;
  background:var(--surface-2);
color:var(--text);
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:600;
}

.step-row > div:last-child{
  display:flex;
  align-items:center;
  line-height:1.4;
}

.contents-title{
  font-weight:600;
  margin-bottom:8px;
  color:var(--text);
}



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

.photo-grid img{
  width:100%;
  border-radius:10px;
  display:block;
}

/* последняя картинка — на всю ширину */
.photo-grid img:nth-child(5){
  grid-column:1 / -1;
}

.photo-grid img{
  cursor:pointer;
}



.cover-style {
  display:block;
  max-width:84%;
  margin:14px auto 12px;
  border-radius:18px;
  overflow:hidden;
  box-shadow:0 8px 22px rgba(0,0,0,.08);
}

.cover-style img {
  width:100%;
  display:block;
}

.image-preview{
  display:block;
  width:100%;              /* занимает всю ширину контейнера */
  aspect-ratio:1/1;        /* квадрат */
  object-fit:cover;

  margin:14px 0 12px;      /* без auto */
  border-radius:16px;
  box-shadow:0 8px 22px rgba(0,0,0,.08);
}


.image-placeholder{
 padding:40px;
 border:1px dashed var(--border);
 background:var(--surface-2);
 text-align:center;
 border-radius:16px;
}

.view-switch {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 20px;
}

.switch-btn {
  padding: 8px 14px;
  border-radius: 10px;
  text-decoration: none;
  font-size: 14px;
  background:var(--surface-2);
  color:var(--text);
  transition: 0.2s;
}

.switch-btn:hover {
  background: #e2e2e2;
}

.switch-btn.admin {
  background: #6c5ce7;
  color: #fff;
}

.switch-btn.admin:hover {
  background: #5846d8;
}

/* =========================
   READING MODE BUTTON
========================= */

.tg-header {
  position: relative;
}

.reading-mode-btn {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);

  background: transparent;
  border: none;
  font-size: 18px;
  cursor: pointer;

  opacity: 0.6;
  transition: 0.2s ease;
}

.reading-mode-btn:hover {
  opacity: 1;
  transform: translateY(-50%) scale(1.1);
}

/* =========================
   HEADER ACTION BUTTONS
========================= */

.tg-header {
  position: relative;
}

.section-actions-right {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  gap: 12px;
}

.header-action-btn {
  background: transparent;
  border: none;
  font-size: 18px;
  cursor: pointer;
  opacity: 0.6;
  transition: 0.2s ease;
}

.header-action-btn:hover {
  opacity: 1;
  transform: scale(1.15);
}

/* активная звезда */
.header-action-btn.active {
  opacity: 1;
  color: gold;
}

/* =========================
   READING MODE — REMOVE TG-BODY PADDING
========================= */

body.reading-mode .tg-body {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

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

.play-btn svg {
width: 28px;
height: 28px;
fill: white;
margin-left: 2px; /* небольшая визуальная коррекция */
}

.play-btn {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 72px;
height: 72px;
border-radius: 50%;
background: rgba(0,0,0,0.55);
display: flex;
align-items: center;
justify-content: center;
backdrop-filter: blur(4px);
}

/* квадратное изображение */
.image-square .image-preview{
  aspect-ratio:1 / 1;
  object-fit:cover;
}

/* полное изображение */
.image-full .image-preview{
  aspect-ratio:auto;
  height:auto;
}

.image-square .image-preview{
  aspect-ratio:1/1;
  object-fit:cover;
}

.image-full .image-preview{
  height:auto;
}

.image-wide .image-preview{
  aspect-ratio:16/9;
  object-fit:cover;
}

.image-modal{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.92);
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:999999;
  cursor:zoom-out;
}

.image-modal img{
  max-width:95vw;
  max-height:95vh;
  border-radius:10px;
}

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

.image-modal{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.92);
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:999999;
  cursor:zoom-out;
}

.image-modal img{
  max-width:95vw;
  max-height:95vh;
  border-radius:12px;
}

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