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: #6f42c1;
  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: #6f42c1;
  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;
}

/* Специфические стили для руководства по портам */
.port-table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  background: #f8f9fa;
  border-radius: 8px;
  overflow: hidden;
}

.port-table th {
  background: #007bff;
  color: #fff;
  padding: 12px;
  text-align: left;
  font-weight: 600;
}

.port-table td {
  padding: 12px;
  border-bottom: 1px solid #dee2e6;
}

.port-table tr:last-child td {
  border-bottom: none;
}

.port-table tr:nth-child(even) {
  background: #f1f3f4;
}

.router-guide {
  margin: 30px 0;
  padding: 20px;
  background: #e7f3ff;
  border-radius: 8px;
  border-left: 4px solid #007bff;
}

.router-guide h4 {
  margin-top: 0;
  color: #007bff;
}

.security-warning {
  background: #fff3cd;
  border: 1px solid #ffeaa7;
  border-radius: 8px;
  padding: 20px;
  margin: 25px 0;
  border-left: 4px solid #ffc107;
}

.security-warning h4 {
  color: #856404;
  margin: 0 0 15px;
  font-size: 1.2rem;
}

.success-tip {
  background: #d4edda;
  border: 1px solid #c3e6cb;
  border-radius: 8px;
  padding: 20px;
  margin: 25px 0;
  border-left: 4px solid #28a745;
}

.success-tip h4 {
  color: #155724;
  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;
}

.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 #007bff;
  position: relative;
}

.step-list li::before {
  content: counter(step-counter);
  position: absolute;
  left: -15px;
  top: 20px;
  background: #007bff;
  color: #fff;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 0.9rem;
}

.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;
  border: 2px solid #e9ecef;
}

.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;
}

/* Стили для рекламы */
.ad-top-banner {
  text-align: center;
  margin: 16px 0;
  position: relative;
  transition: opacity 0.3s ease, height 0.3s ease;
}

.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;
}

/* Стили для социальных кнопок */
.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 0.2s ease, box-shadow 0.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, 0.15);
}

/* Стили для кнопок поделиться */
.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);
}

/* Стили для секции комментариев */
.comments-section {
  margin-top: 40px;
  padding: 20px;
  border-top: 2px solid #e9ecef;
}

.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;
}

/* Стили для прогресса чтения */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: #e9ecef;
  z-index: 10000;
}

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

/* Стили для плавающего оглавления */
.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: #007bff;
  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);
}

/* Стили для кнопки "Наверх" */
.scroll-to-top {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #007bff;
  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;
}

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

  .toc-toggle {
    display: none !important;
  }
}

/* Стили для таблицы содержания */
.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;
}

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

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

/* Мобильная реклама */
.mobile-anchor-ad {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: none;
  justify-content: center;
  z-index: 2147483000;
  padding-bottom: env(safe-area-inset-bottom);
  pointer-events: none;
}