.ad-top-banner {
  text-align: center;
  margin: 16px 0;
  position: relative;
  transition: opacity 0.3s ease, height 0.3s ease;
}
.ad-top-banner .mrg-tag {
  width: 100% !important;
  max-width: 970px;
  height: auto;
  aspect-ratio: 970 / 250;
  display: inline-block;
}
.ad-banner.loading::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
}
@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.ad-banner.hidden {
  opacity: 0;
  height: 0;
  overflow: hidden;
}
@media (max-width: 1199px) { .ad-top-banner .mrg-tag { max-width: 728px; aspect-ratio: 728 / 90; } }
@media (max-width: 768px) { .ad-top-banner .mrg-tag { max-width: 320px; aspect-ratio: 320 / 50; } }
body{max-width:800px;margin:0 auto;padding:16px;font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;background:#f5f5f5;line-height:1.7}
article{background:#fff;border-radius:12px;padding:40px;margin:20px auto;box-shadow:0 2px 8px rgba(0,0,0,0.1);max-width:800px}
.article-header{text-align:center;margin-bottom:40px;padding-bottom:30px;border-bottom:2px solid #e9ecef}
.article-title{font-size:2.5rem;color:#333;margin-bottom:15px;font-weight:700;line-height:1.2}
.article-meta{color:#6c757d;font-size:1.1rem;margin-bottom:20px}
.article-category{display:inline-block;padding:8px 16px;background:#dc3545;color:#fff;border-radius:20px;font-size:0.9rem;font-weight:500}
.article-content{font-size:1.15rem;color:#333;letter-spacing:0.02em}
.article-content>*{opacity:0;transform:translateY(20px);transition:opacity 0.5s ease,transform 0.5s ease}
.article-content>.visible{opacity:1;transform:translateY(0)}
.article-content h2{color:#dc3545;margin:40px 0 20px;font-size:1.8rem;font-weight:600}
.article-content h3{color:#495057;margin:30px 0 15px;font-size:1.4rem;font-weight:600}
.article-content p{margin-bottom:20px}
.article-content ul,.article-content ol{margin-bottom:20px;padding-left:25px}
.article-content li{margin-bottom:10px}
.highlight-box{background:#fdecea;border:1px solid #f5c6cb;border-radius:8px;padding:20px;margin:25px 0;color:#721c24}
.highlight-box h4{color:#721c24;margin:0 0 15px;font-size:1.2rem}
.warning-box{background:#fff3cd;border:1px solid #ffeaa7;border-radius:8px;padding:20px;margin:25px 0;border-left:4px solid #ffc107}
.warning-box h4{color:#856404;margin:0 0 15px;font-size:1.2rem}
.code-example{background:#f8f9fa;border:1px solid #dee2e6;border-radius:6px;padding:20px;margin:25px 0;font-family:'Courier New',monospace;font-size:0.9rem;overflow-x:auto;border-left:4px solid #6c757d}
.code-example h4{color:#495057;margin:0 0 15px;font-size:1.2rem}
.step-list{counter-reset:step-counter;list-style:none;padding:0}
.step-list li{counter-increment:step-counter;margin-bottom:25px;padding:20px;background:#f8f9fa;border-radius:8px;border-left:4px solid #dc3545;position:relative}
.step-list li::before{content:counter(step-counter);position:absolute;left:-15px;top:20px;background:#dc3545;color:#fff;width:30px;height:30px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-weight:bold;font-size:0.9rem}
.tech-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(250px,1fr));gap:20px;margin:30px 0}
.tech-card{background:#f8f9fa;border:2px solid #e9ecef;border-radius:8px;padding:20px;text-align:center;transition:transform 0.3s ease,box-shadow 0.3s ease}
.tech-card:hover{transform:translateY(-5px);box-shadow:0 8px 25px rgba(0,0,0,0.15)}
.tech-icon{font-size:3rem;margin-bottom:15px;display:block}
.tech-name{font-weight:600}
.social-subscribe{display:flex;justify-content:center;gap:12px;margin-top:24px;flex-wrap:wrap}
.tg-btn,.vk-btn{display:inline-block;padding:10px 20px;border-radius:25px;color:#fff;font-weight:600;text-decoration:none;transition:transform .2s ease,box-shadow .2s ease}
.tg-btn{background:linear-gradient(90deg,#229ED9,#1E88C0)}
.vk-btn{background:linear-gradient(90deg,#2787F5,#1E6BC0)}
.tg-btn:hover,.vk-btn:hover{transform:translateY(-1px);box-shadow:0 6px 14px rgba(0,0,0,.15)}
.table-of-contents{margin-bottom:30px;padding:20px;background:#f8f9fa;border-radius:8px}
.table-of-contents h2{font-size:1.5rem;color:#333;margin-bottom:15px}
.table-of-contents ul{list-style:none;padding:0}
.table-of-contents li{margin-bottom:10px}
.table-of-contents a{color:#007bff;text-decoration:none}
.table-of-contents a:hover{text-decoration:underline}
.share-buttons{display:flex;justify-content:center;gap:12px;margin-top:30px}
.share-buttons button{background:linear-gradient(90deg,#007bff,#0056b3);color:#fff;border:none;padding:10px 20px;border-radius:25px;font-size:1rem;cursor:pointer}
.share-buttons button:hover{background:linear-gradient(90deg,#0056b3,#004085);transform:translateY(-2px)}
.scroll-to-top{position:fixed;bottom:20px;right:20px;background:#dc3545;color:#fff;border:none;border-radius:50%;width:50px;height:50px;font-size:1.2rem;cursor:pointer;display:none;z-index:1000}
.scroll-to-top.show{display:block}
.comments-section{margin-top:40px;padding:20px;border-top:2px solid #e9ecef}
.code-preview-container{margin:20px 0;padding:20px;background:#f8f9fa;border-radius:8px;border:1px solid #dee2e6}
.code-preview-button{background:#007bff;color:#fff;border:none;padding:10px 20px;border-radius:25px;font-size:1rem;cursor:pointer;margin-top:10px}
.code-preview-button:hover{background:#0056b3}
.code-preview-output{display:none;border:1px solid #dee2e6;border-radius:6px;padding:20px;margin-top:15px;background:#fff}
.code-preview-output.show{display:block}

/* Новые стили для улучшений */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: #e9ecef;
  z-index: 10000;
}

.reading-progress-bar {
  height: 100%;
  background: #dc3545;
  width: 0%;
  transition: width 0.3s ease;
}

.sticky-toc {
  position: sticky;
  top: 20px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}

.sticky-toc h2 {
  margin-top: 0;
}

.interactive-editor {
  border: 1px solid #dee2e6;
  border-radius: 6px;
  margin: 25px 0;
  overflow: hidden;
}

.editor-toolbar {
  background: #f8f9fa;
  padding: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #dee2e6;
}

.editor-content {
  display: flex;
  flex-direction: column;
}

@media (min-width: 992px) {
  .editor-content {
    flex-direction: row;
  }
}

.code-area, .preview-area {
  flex: 1;
  min-height: 300px;
}

.code-area {
  border-right: 1px solid #dee2e6;
}

.preview-area {
  padding: 15px;
  background: white;
}

.code-textarea {
  width: 100%;
  height: 100%;
  border: none;
  padding: 15px;
  font-family: 'Courier New', monospace;
  resize: none;
}

.run-button {
  background: #28a745;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
}

.faq-item {
  margin-bottom: 25px;
  border-bottom: 1px solid #e9ecef;
  padding-bottom: 15px;
}

.faq-question {
  font-weight: 600;
  color: #333;
  margin-bottom: 10px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.faq-answer {
  color: #555;
  display: none;
}

.faq-answer.show {
  display: block;
}

.checklist {
  list-style: none;
  padding: 0;
}

.checklist li {
  margin-bottom: 10px;
  display: flex;
  align-items: flex-start;
}

.checklist input[type="checkbox"] {
  margin-right: 10px;
  margin-top: 4px;
}

.visual-guide {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin: 30px 0;
}

.visual-item {
  text-align: center;
  padding: 15px;
  border-radius: 8px;
  background: #f8f9fa;
}

.visual-icon {
  font-size: 2.5rem;
  margin-bottom: 15px;
  color: #dc3545;
}

.floating-toc {
  position: fixed;
  top: 50%;
  right: 20px;
  transform: translateY(-50%);
  background: white;
  border-radius: 8px;
  padding: 15px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  max-width: 250px;
  max-height: 70vh;
  overflow-y: auto;
  z-index: 999;
  display: none;
}

.floating-toc h3 {
  margin-top: 0;
  font-size: 1.2rem;
  color: #333;
}

.floating-toc ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.floating-toc li {
  margin-bottom: 8px;
}

.floating-toc a {
  color: #007bff;
  text-decoration: none;
  font-size: 0.9rem;
}

.floating-toc a:hover {
  text-decoration: underline;
}

.toc-toggle {
  position: fixed;
  top: 100px;
  right: 20px;
  background: #dc3545;
  color: white;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* Стили для формы комментариев */
.comment-form {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 30px;
}

.form-group {
  margin-bottom: 15px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: 600;
  color: #333;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  font-family: inherit;
  font-size: 1rem;
}

.form-group textarea {
  min-height: 100px;
  resize: vertical;
}

.submit-button {
  background: #28a745;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  transition: background-color 0.3s;
}

.submit-button:hover {
  background: #218838;
}

.comments-list {
  margin-top: 30px;
}

.comment {
  background: white;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 15px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.comment-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}

.comment-author {
  font-weight: 600;
  color: #333;
}

.comment-date {
  color: #6c757d;
  font-size: 0.9rem;
}

.comment-text {
  color: #333;
  line-height: 1.5;
}

.no-comments {
  text-align: center;
  color: #6c757d;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 8px;
}

/* Адаптивность для плавающего оглавления */
@media (max-width: 991px) {
  .sticky-toc {
    position: static;
    margin-bottom: 30px;
  }
  
  .floating-toc {
    display: none !important;
  }
  
  .toc-toggle {
    display: none !important;
  }
}