/* =========================
   Mobile-first базовые стили
   (0 – 767px)
========================= */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  margin: 0;
  background-color: #1a1a1a;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: #e0e0e0;
  line-height: 1.55;
  overflow-x: hidden;
  font-size: 16px;
}

/* Базовые правила для всех медиа */
img,
video,
iframe {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: #1e88ff;
  text-decoration: underline;
  text-underline-offset: 3px;
}

a:hover {
  color: #ffb300;
}

p {
  margin: 0 0 16px;
}

ul,
ol {
  margin-top: 0;
  margin-bottom: 16px;
  padding-left: 24px;
}

li {
  margin-bottom: 6px;
}

/* Якоря не перекрываются фиксированной шапкой */
section,
[id] {
  scroll-margin-top: 90px;
}

/* =========================
   Layout – контейнеры
========================= */
.container,
.main-container,
main,
.content,
.site-content {
  width: calc(100% - 20px);
  margin-left: auto;
  margin-right: auto;
}

main,
.site-content {
  padding-top: 22px;
  padding-bottom: 22px;
}

body > .block {
  width: calc(100% - 20px);
}

.block {
  width: 100%;
  background: #222;
  border: 1px solid #333;
  border-radius: 10px;
  padding: 16px;
  margin: 0 auto 22px;
}

/* =========================
   Navbar – мобильная версия
========================= */
.navbar {
  width: 100%;
  min-height: 64px;
  background-color: #000;
  border-bottom: 2px solid #d32f2f;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.navbar .container,
.navbar .main-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.navbar-brand,
.logo {
  display: flex;
  justify-content: center;
  width: 100%;
}

.navbar-brand img,
.logo img {
  max-height: 28px;
  width: auto;
}

.navbar-nav,
.nav-menu {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

.navbar .nav-link {
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
  line-height: 1.2;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-link.nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 14px;
  background: linear-gradient(135deg, #ffb300, #d32f2f);
  border-radius: 6px;
  color: #000;
  font-weight: 800;
  text-transform: uppercase;
  box-shadow: 0 0 12px rgba(255, 179, 0, 0.4);
  white-space: nowrap;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-link.nav-btn:hover {
  color: #fff;
  filter: brightness(1.15);
}

.login-btn,
.btn-login {
  background: #d32f2f;
  color: #fff;
}

.register-btn,
.btn-register-nav {
  background: #ffb300;
  color: #000;
}

/* =========================
   Typography
========================= */
h1,
h2,
h3,
h4 {
  color: #ffb300;
  line-height: 1.15;
  margin-top: 0;
  margin-bottom: 18px;
  overflow-wrap: break-word;
  text-transform: none;
}

h1 {
  font-size: 30px;
  letter-spacing: 0.5px;
}

h2 {
  font-size: 25px;
}

h3 {
  font-size: 22px;
}

/* =========================
   Buttons
========================= */
button,
input[type="submit"] {
  cursor: pointer;
}

.btn-primary,
.btn-secondary,
.btn-register {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.btn-primary {
  background-color: #d32f2f;
  color: #fff;
}

.btn-primary:hover {
  background-color: #b71c1c;
  color: #fff;
}

.btn-secondary {
  background-color: #ffb300;
  color: #000;
}

.btn-secondary:hover {
  background-color: #d32f2f;
  color: #fff;
}

.btn-register {
  background: #ffb300;
  color: #000;
  text-transform: uppercase;
  box-shadow: 0 0 18px rgba(255, 179, 0, 0.6);
}

.btn-register:hover {
  background: #d32f2f;
  color: #fff;
}

/* =========================
   Table – всегда с прокруткой
========================= */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-glow {
  width: 100%;
  min-width: 480px;
  border-collapse: collapse;
  background: rgba(255, 215, 0, 0.05);
  border: 1px solid #ffb300;
  border-radius: 10px;
  overflow: hidden;
  animation: tableGlow 3s infinite;
}

@keyframes tableGlow {
  0% {
    box-shadow: 0 0 10px rgba(255, 179, 0, 0.3);
  }
  50% {
    box-shadow: 0 0 25px rgba(255, 179, 0, 0.8);
  }
  100% {
    box-shadow: 0 0 10px rgba(255, 179, 0, 0.3);
  }
}

.table-glow th {
  background: rgba(211, 47, 47, 0.3);
  color: #ffb300;
  padding: 12px;
  text-align: left;
}

.table-glow td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 179, 0, 0.2);
  color: #ddd;
}

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

/* =========================
   Содержание / структура
========================= */
.toc,
.structure,
.contents,
#toc {
  width: 100%;
  margin: 18px auto;
  padding: 16px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid #333;
  border-radius: 10px;
  text-align: left;
}

.toc-title,
.structure-title,
.contents-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  color: #fff;
  font-weight: 800;
}

.toc ul,
.structure ul,
.contents ul,
#toc ul {
  margin: 0;
  padding-left: 22px;
}

.toc a,
.structure a,
.contents a,
#toc a {
  color: #1e88ff;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.toc a:hover,
.structure a:hover,
.contents a:hover,
#toc a:hover {
  color: #ffb300;
}

/* =========================
   Адаптивные изображения (доп. классы)
========================= */
.ratio-16x9 {
  aspect-ratio: 16 / 9;
}
.ratio-4x3 {
  aspect-ratio: 4 / 3;
}
.ratio-1x1 {
  aspect-ratio: 1 / 1;
}
.cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* =========================
   Кнопка «Вверх»
========================= */
.toc-back-top,
.back-to-top,
.to-top {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  min-height: 42px;
  background: #eee;
  color: #111;
  border: 1px solid #aaa;
  text-decoration: none;
  font-weight: 800;
}

.toc-back-top:hover,
.back-to-top:hover,
.to-top:hover {
  background: #ffb300;
  color: #000;
}

.toc-back-top,
.back-to-top,
.to-top {
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 1001;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.toc-back-top.is-visible,
.back-to-top.is-visible,
.to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* =========================
   Hero / banners
========================= */
.hero,
.banner,
.main-banner {
  width: 100%;
  margin: 0 auto 24px;
  overflow: hidden;
  border-radius: 10px;
}

.hero img,
.banner img,
.main-banner img {
  width: 100%;
  height: auto;
  object-fit: cover;
}

/* =========================
   Footer
========================= */
footer,
.footer,
.site-footer {
  width: 100%;
  margin-top: 24px;
  padding: 14px 12px;
  background: #1c2126;
  color: #ddd;
  text-align: center;
}

footer .container,
.footer .container,
.site-footer .container {
  width: 100%;
  margin: 0 auto;
}

footer nav,
.footer nav,
.site-footer nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-bottom: 8px;
}

footer a,
.footer a,
.site-footer a {
  color: #1e88ff;
}

footer p,
.footer p,
.site-footer p {
  margin: 6px 0 0;
  font-size: 13px;
}

footer[style],
.footer[style],
.site-footer[style] {
  min-height: auto !important;
}

/* =========================
   Forms
========================= */
input,
select,
textarea {
  max-width: 100%;
  background: #111;
  color: #fff;
  border: 1px solid #444;
  border-radius: 6px;
  padding: 10px 12px;
  font: inherit;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(255, 179, 0, 0.6);
  border-color: #ffb300;
}

/* =========================
   Toggle / FAQ
========================= */
.toc-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 42px;
  padding: 8px 14px;
  margin: 16px auto 10px;
  background: #eee;
  color: #111;
  border: 1px solid #aaa;
  border-radius: 4px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.toc-toggle:hover {
  background: #ffb300;
  color: #000;
}

.toc.is-collapsed,
.structure.is-collapsed,
.contents.is-collapsed,
#toc.is-collapsed {
  display: none;
}

.faq-answer[hidden] {
  display: none;
}

.faq-question {
  width: 100%;
  text-align: left;
  cursor: pointer;
}

/* =========================
   Планшет (≥768px)
========================= */
@media (min-width: 768px) {
  .container,
  .main-container,
  main,
  .content,
  .site-content,
  body > .block {
    width: calc(100% - 32px);
    max-width: 1280px;
  }

  main,
  .site-content {
    padding-top: 28px;
    padding-bottom: 28px;
  }

  .block {
    padding: 24px;
    border-radius: 12px;
  }

  .navbar {
    flex-direction: row;
    justify-content: space-between;
    padding: 10px 20px;
  }

  .navbar .container,
  .navbar .main-container {
    flex-direction: row;
    justify-content: space-between;
    width: 100%;
    max-width: 1280px;
  }

  .navbar-brand,
  .logo {
    width: auto;
    justify-content: flex-start;
  }

  .navbar-brand img,
  .logo img {
    max-height: 32px;
  }

  .navbar-nav,
  .nav-menu {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-end;
    width: auto;
    gap: 10px;
  }

  .nav-link.nav-btn {
    width: auto;
    min-height: 44px;
    padding: 10px 20px;
    border-radius: 8px;
    overflow: visible;
    text-overflow: clip;
  }

  h1 {
    font-size: clamp(32px, 5vw, 56px);
    letter-spacing: 1px;
  }

  h2 {
    font-size: clamp(26px, 4vw, 40px);
  }

  h3 {
    font-size: clamp(22px, 3vw, 30px);
  }

  .btn-primary,
  .btn-secondary {
    width: auto;
  }

  .btn-register {
    width: auto;
    min-width: 180px;
    min-height: 48px;
    padding: 0 22px;
    border-radius: 8px;
  }

  .toc,
  .structure,
  .contents,
  #toc {
    width: fit-content;
    max-width: 100%;
    padding: 18px 22px;
  }

  footer nav,
  .footer nav,
  .site-footer nav {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 18px;
  }

  footer p,
  .footer p,
  .site-footer p {
    font-size: 14px;
  }
}

/* =========================
   Десктоп (≥992px)
========================= */
@media (min-width: 992px) {
  .block {
    padding: 36px;
  }

  .content,
  .site-content,
  main {
    display: block;
  }

  .center-content {
    margin-left: auto;
    margin-right: auto;
    text-align: center;
  }

  .center-content .block,
  .center-content p,
  .center-content ul,
  .center-content ol {
    text-align: left;
  }

  .table-glow {
    min-width: 560px;
  }
}