/* Модалка для просмотра изображений с навигацией и зумом */
.wiki-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
}

.wiki-modal .wiki-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(2px);
}

.wiki-modal .wiki-modal-dialog {
  position: relative;
  display: grid;
  grid-template-columns: 48px auto 48px;
  align-items: center;
  gap: 8px;
  z-index: 1;
  max-width: 95vw;
  max-height: 95vh;
}

.wiki-modal .canvas {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 6px 8px;
  display: grid;
  gap: 6px;
  grid-template-rows: auto 1fr auto;
  place-items: center;
  width: fit-content;
  max-width: 100%;
}

.wiki-modal .canvas .counter {
  text-align: center;
  color: #fff;
  font-weight: 600;
  opacity: .9;
}

.wiki-modal .canvas .img {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 8px;
  display: block;
  margin: 0 auto;
  transition: opacity .22s ease, transform .28s ease;
  cursor: zoom-in;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
}

.wiki-modal .canvas .img.is-leaving {
  opacity: 0;
}

.wiki-modal .canvas .img.zoomed {
  cursor: zoom-in;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
}

.wiki-modal .canvas .caption {
  text-align: center;
  color: var(--text-secondary, #aab);
  font-size: 0.95rem;
  min-height: 1.2em;
}

.wiki-modal .nav {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.wiki-modal .nav:disabled {
  opacity: .4;
  cursor: default;
}

.wiki-modal .close {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  cursor: pointer;
}

.wiki-modal .zoom-hint {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  opacity: 0;
  transition: opacity .3s ease;
}

.wiki-modal .zoom-hint.show {
  opacity: 1;
}

.badge-new {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: linear-gradient(135deg, #ff4757, #ff6b81) !important;
  -webkit-background-clip: initial !important;
  -webkit-text-fill-color: initial !important;
  color: #ffffff !important;
  font-size: 10px !important;
  font-weight: 800 !important;
  text-transform: uppercase !important;
  padding: 0 8px !important;
  height: 18px !important;
  min-width: 50px !important;
  border-radius: 20px !important;
  margin-left: 10px !important;
  vertical-align: middle !important;
  box-shadow: 0 0 10px rgba(255, 71, 87, 0.5) !important;
  letter-spacing: 0.5px !important;
  border: 1px solid rgba(255, 255, 255, 0.3) !important;
  line-height: normal !important;
  animation: pulse-new 2s infinite !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4) !important;
  white-space: nowrap !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: none;
  font-family: 'Montserrat', sans-serif !important;
}

#wiki-title,
.wiki-block h3,
.body h3,
.wiki-child-card h3 {
  display: flex !important;
  align-items: center !important;
  flex-wrap: wrap !important;
  gap: 12px;
}


@keyframes pulse-new {
  0% {
    transform: scale(1);
    box-shadow: 0 0 10px rgba(255, 71, 87, 0.4);
  }

  50% {
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(255, 71, 87, 0.7);
  }

  100% {
    transform: scale(1);
    box-shadow: 0 0 10px rgba(255, 71, 87, 0.4);
  }
}

.wiki-container {
  display: grid !important;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 20px;
  margin-top: 16px;
  width: 100%;
  max-width: none;
}

/* Развернуть вики на всю ширину страницы, обходя общий контейнер */
.container.wiki-container {
  max-width: none !important;
  width: 100% !important;
  padding: 100px 32px 40px 32px !important;
}

.wiki-sidebar {
  background: var(--card-bg, rgba(255, 255, 255, 0.06));
  border-radius: 14px;
  padding: 12px;
  position: sticky;
  top: 16px;
  height: max-content;
}

.wiki-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 8px 12px;
  margin-bottom: 12px;
}

.wiki-search input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary, #fff);
}

.wiki-sections {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
  padding-right: 4px;
}

.wiki-group {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  overflow: visible;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.02);
}

.wiki-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  color: var(--text-secondary, #aab);
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

.wiki-group-header {
  text-decoration: none;
  border-radius: 10px;
}

.wiki-group:not(.collapsed) .wiki-group-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.wiki-group-header.active,
.wiki-group-header:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary, #fff);
}

.wiki-group-header .chevron {
  margin-left: auto;
  transition: transform .2s ease;
  opacity: .8;
}

.wiki-group.collapsed .wiki-group-header .chevron {
  transform: rotate(-90deg);
}

.wiki-group-list {
  display: flex;
  flex-direction: column;
  padding: 6px 6px 8px;
  gap: 6px;
  margin-top: 2px;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height .25s ease, opacity .25s ease;
}

.wiki-group:not(.collapsed) .wiki-group-list {
  max-height: 1000px;
  opacity: 1;
}

.wiki-section-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  color: inherit;
  text-decoration: none;
  white-space: normal;
  line-height: 1.3;
}

.wiki-section-link:hover {
  background: rgba(255, 255, 255, 0.04);
}

.wiki-section-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text-primary, #fff);
  text-decoration: none;
  background: transparent;
  border: 1px solid transparent;
}

.wiki-section-link.active,
.wiki-section-link:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
}

.wiki-content {
  background: var(--card-bg, rgba(255, 255, 255, 0.06));
  border-radius: 14px;
  padding: 16px;
  min-height: calc(100vh - 180px);
  max-height: calc(100vh - 120px);
  overflow: auto;
}

/* Плавное появление контента */
.fade-swap-enter {
  opacity: 0;
  transform: translateY(8px);
}

.fade-swap-enter.fade-swap-enter-active {
  transition: opacity .24s ease, transform .24s ease;
  opacity: 1;
  transform: translateY(0);
}

.wiki-description {
  color: var(--text-secondary, #aab);
  margin-top: 6px;
}

.wiki-blocks {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 16px;
}

.wiki-block {
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 12px;
}

.wiki-block h3 {
  margin: 0 0 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.wiki-block h3 img {
  width: 64px;
  height: 54px;
  border-radius: 4px;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  object-fit: contain;
  object-position: center;
}

.wiki-block p {
  margin: 0;
  line-height: 1.6;
}

.wiki-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.wiki-image-grid img {
  width: 100%;
  height: 200px;
  object-fit: contain;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 10px;
  cursor: pointer;
  padding: 6px;
  box-sizing: border-box;
}

.wiki-children-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.wiki-child-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 10px;
  color: inherit;
  text-decoration: none;
  opacity: 0;
  transform: translateY(6px);
  animation: cardIn .28s ease forwards;
}

.wiki-child-card:hover {
  background: rgba(255, 255, 255, 0.06);
}

.wiki-child-card .thumb {
  width: 100%;
  height: 120px;
  overflow: hidden;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
}

.wiki-child-card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: rgba(0, 0, 0, 0.25);
}

.wiki-child-card .body h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.wiki-child-card .body p {
  margin: 0;
  color: var(--text-secondary, #aab);
  font-size: 0.9rem;
}

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

/* Стили для таблиц в вики */
.wiki-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.9rem;
}

.wiki-table th {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary, #fff);
  font-weight: 600;
  padding: 12px 8px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  border-right: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 0.9rem;
  position: relative;
}

.wiki-table th:last-child {
  border-right: none;
}

.wiki-table .mob-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.wiki-table .mob-header img {
  width: 48px;
  height: 48px;
  border-radius: 4px;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
}

.wiki-table th:first-child {
  text-align: center;
  width: 60px;
}

.wiki-table th:nth-child(3),
.wiki-table th:nth-child(4) {
  text-align: center;
  width: 80px;
}

.wiki-table td {
  padding: 10px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-primary, #fff);
  vertical-align: middle;
}

.wiki-table td:last-child {
  border-right: none;
}

.wiki-table td:first-child {
  text-align: center;
  width: 60px;
}

.wiki-table td:nth-child(3),
.wiki-table td:nth-child(4) {
  text-align: center;
  width: 80px;
  font-weight: 500;
}

.wiki-table tr:hover {
  background: rgba(255, 255, 255, 0.05);
}

.wiki-table img {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
}

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

  .wiki-sidebar {
    position: static;
  }

  .wiki-table {
    font-size: 0.85rem;
  }

  .wiki-table th,
  .wiki-table td {
    padding: 8px 6px;
  }

  .wiki-table img {
    width: 24px;
    height: 24px;
  }
}