html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: #2b1e15;
  overflow: hidden;
  position: relative;
  user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
  -moz-user-select: none;
}

#city-container {
  position: absolute;
  left: 0; top: 0; width: 100%; height: 100%;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
  -moz-user-select: none;
}

.svg-bg {
  display: block;
  position: absolute;
  left: 0; top: 0;
  margin: 0;
  pointer-events: auto;
  user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
  -moz-user-select: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.svg-bg.loaded {
  opacity: 1;
}

.tower-area {
  cursor: pointer;
  fill: transparent;
  stroke: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-focus-ring-color: transparent;
  outline: none !important;
  box-shadow: none !important;
  user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
  -moz-user-select: none;
}

.castle-area {
  cursor: pointer;
  fill: transparent;
  stroke: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-focus-ring-color: transparent;
  outline: none !important;
  box-shadow: none !important;
  user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
  -moz-user-select: none;
}

#towerMenu {
  display: none;
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%,-50%);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s;
  aspect-ratio: 1/1;
  user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
  -moz-user-select: none;
}

#towerMenu.visible {
  opacity: 1;
  pointer-events: auto;
  display: block;
}

#towerMenu img {
  height: 100%;
  width: auto;
  max-width: 100%;
  display: block;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
  -moz-user-select: none;
}

.menu-inner {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  padding: 25% 15% 2% 15%;
  box-sizing: border-box;
  pointer-events: auto;
  user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
  -moz-user-select: none;
}

.menu-inner ul {
  list-style: none;
  padding: 0;
  margin: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.btn-heroes-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin: 0 auto;
  user-select: none;
  -webkit-user-select: none;
}

.btn-heroes-inner {
  width: 100%;
  height: 100%;
  background: url('Knopka.png') center center/100% 100% no-repeat;
  border: none;
  color: #523010;
  font-family: inherit;
  font-weight: bold;
  cursor: pointer;
  outline: none !important;
  box-shadow: none !important;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-focus-ring-color: transparent;
  -webkit-user-select: none;
  -ms-user-select: none;
  -moz-user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .12s, transform .08s;
}

.btn-heroes-inner:focus {
  outline: none !important;
  box-shadow: none !important;
}

.btn-heroes-inner span {
  position: relative;
  z-index: 2;
  text-shadow: 0 2px 1px #f7f6b4, 0 -1px 1px #e6dec2;
  pointer-events: none;
}

.btn-heroes-inner:active {
  background: url('Nagataya-knopka.png') center center/100% 100% no-repeat;
  transform: scale(0.96, 0.98);
}

.first-btn {
  margin-top: 0;
}

.btn-exit, .btn-info {
  position: relative;
  z-index: 10;
}

.btn-double-shift { 
  position: relative; 
  z-index: 8; 
}

.floor-menu-title {
  font-weight: bold;
  color: #523010;
  font-size: 1.2em;
  text-align: center;
  margin-bottom: 12px;
  text-shadow: 0 1px 2px #f7f6b4;
}

.floor-list-container {
  width: 100%;
  max-height: 60%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.floor-item-btn {
  font-family: inherit;
  font-size: 1em;
  color: #523010;
  background: #fffde8;
  border: 1px solid #c2b185;
  border-radius: 12px;
  padding: 11px 14px;
  cursor: pointer;
  transition: background 0.14s, transform 0.12s;
  text-align: center;
  font-weight: normal;
}

.floor-item-btn:hover {
  background: #e6dec2;
  transform: scale(1.02);
}

.floor-item-btn:active {
  transform: scale(0.98);
}

.floor-article-content {
  width: 100%;
  max-height: 50%;
  overflow-y: auto;
  background: transparent;
  color: #523010;
  font-size: 0.95em;
  line-height: 1.4;
  border-top: 1px solid #c2b185;
  padding-top: 8px;
  margin-bottom: 12px;
}

.floor-nav-buttons {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: auto;
}

.floor-nav-btn {
  background: #e6dec2;
  color: #523010;
  border: none;
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 1em;
  cursor: pointer;
  transition: background 0.14s, transform 0.08s;
  font-weight: bold;
}

.floor-nav-btn:hover {
  background: #d4c8a6;
  transform: scale(1.05);
}

.floor-nav-btn:active {
  transform: scale(0.95);
}

.text-display-container {
  position: absolute;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px;
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
  -moz-user-select: none;
  z-index: 5;
  -ms-overflow-style: none;
  scrollbar-width: none;
  --scrollbar-margin: 0px;
}

.text-display-container::-webkit-scrollbar {
  display: none;
}

.custom-scrollbar-container {
  position: relative;
}

.custom-scrollbar {
  position: absolute;
  width: 16px;
  background: url('Ramka_polzunka.png') center/16px 100% no-repeat;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 10;
  pointer-events: none;
}

.custom-scrollbar.visible {
  opacity: 1;
  pointer-events: auto;
}

.scrollbar-thumb {
  position: absolute;
  width: 10px;
  left: 3px;
  background: url('Polzunok.png') center/10px 100% no-repeat;
  cursor: pointer;
  transition: opacity 0.2s;
}

.scrollbar-thumb:hover {
  opacity: 0.9;
}

.scrollbar-thumb:active {
  cursor: grabbing;
}

/* ОБНОВЛЕНО: Только темы и статьи */
.theme-item, .article-item {
  position: relative;
  padding: 8px 15px;
  margin-bottom: 1.5em;
  text-align: center;
  line-height: 1.3;
  color: #523010;
  text-shadow: 0 2px 1px #f7f6b4, 0 -1px 1px #e6dec2;
  word-wrap: break-word;
  font-family: inherit;
  font-weight: bold;
  border-radius: 4px;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
  -moz-user-select: none;
}

/* НОВОЕ: Заголовок статьи с теми же свойствами центрирования */
.article-title {
  position: relative;
  padding: 8px 15px;
  margin-bottom: 0.5em;
  text-align: center;
  line-height: 1.3;
  color: #523010;
  text-shadow: 0 2px 1px #f7f6b4, 0 -1px 1px #e6dec2;
  word-wrap: break-word;
  font-family: inherit;
  font-weight: bold;
  border-radius: 4px;
  box-sizing: border-box;
  font-size: 1.1em;
  padding-bottom: 8px;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
  -moz-user-select: none;
  /* === ЛОЖНЫЙ ЛЕВЫЙ ОТСТУП ДЛЯ ИДЕАЛЬНОГО ЦЕНТРИРОВАНИЯ === */
  padding-left: calc(15px + var(--scrollbar-margin, 0px));
}

/* Невидимый блок справа для заголовка (предотвращает касание скроллбара) */
.article-title::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: var(--scrollbar-margin, 0px);
  height: 100%;
  background: transparent;
  pointer-events: none;
  z-index: 2;
}

/* НОВОЕ: Невидимый блок для заголовка статьи */
.article-title::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: var(--scrollbar-margin, 0px);
  height: 100%;
  background: transparent;
  pointer-events: none;
  z-index: 2;
}

.theme-item.selected, .article-item.selected {
  background-color: transparent;
  box-shadow: none;
  transform: none;
  text-shadow: 
    0 0 3px #ffff00,
    0 0 6px #ffff00,
    0 0 9px #ffff00,
    0 0 12px #ffd700,
    0 0 15px #ffd700,
    0 0 18px #ffb300,
    0 0 21px #ffb300,
    0 0 24px #ff9500,
    0 2px 1px #f7f6b4, 0 -1px 1px #e6dec2;
  transition: text-shadow 0.3s ease;
}

.theme-item:active, .article-item:active,
.theme-text:active, .article-text:active {
  -webkit-tap-highlight-color: transparent !important;
}

.theme-item .theme-text, .article-item .article-text {
  cursor: pointer;
  display: inline-block;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
  -moz-user-select: none;
}

.article-content-text {
  width: 100%;
  height: auto;
  overflow-y: visible;
  overflow-x: hidden;
  color: #523010;
  font-size: 0.9em;
  line-height: 1.5;
  text-align: left;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: text;
  -webkit-user-select: text;
  -ms-user-select: text;
  -moz-user-select: text;
}

.article-content-text::-webkit-scrollbar {
  display: none;
}

.article-content-text p {
  margin-bottom: 12px;
}

.article-content-text h1, .article-content-text h2, .article-content-text h3 {
  color: #523010;
  text-shadow: 0 1px 1px #f7f6b4;
  margin: 16px 0 8px 0;
}

.article-content-text ul, .article-content-text ol {
  margin-left: 20px;
  margin-bottom: 12px;
}

.article-scrollable-content {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0;
  box-sizing: border-box;
  -ms-overflow-style: none;
  scrollbar-width: none;
  padding-right: var(--scrollbar-margin, 0px);
}

.article-scrollable-content::-webkit-scrollbar {
  display: none;
}

/* === СТРЕЛКИ СКРОЛЛБАРА С ПРОЗРАЧНЫМ ФОНОМ === */
.scroll-arrow-overlay {
  transition: opacity 0.15s ease;
  pointer-events: none;
  position: absolute;
  z-index: 12;
  box-sizing: border-box !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  background-color: transparent !important; /* ПРОЗРАЧНЫЙ ФОН */
}

.scroll-arrow-overlay.up-overlay {
  left: 0;
  top: 0;
  background: url('Verh_ramki_polzunka.png') center/contain no-repeat;
  background-color: transparent !important; /* ПРОЗРАЧНЫЙ ФОН */
  opacity: 0;
}

.scroll-arrow-overlay.down-overlay {
  left: 0;
  bottom: 0;
  background: url('Niz_ramki_polzunka.png') center/contain no-repeat;
  background-color: transparent !important; /* ПРОЗРАЧНЫЙ ФОН */
  opacity: 0;
}

.scroll-arrow {
  position: absolute;
  cursor: pointer;
  z-index: 15;
  background: transparent !important; /* ПРОЗРАЧНЫЙ ФОН */
  transition: none;
  box-sizing: border-box !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
}

.scroll-arrow-up {
  left: 0;
  top: 0;
  background: transparent !important; /* ПРОЗРАЧНЫЙ ФОН */
}

.scroll-arrow-down {
  left: 0;
  bottom: 0;
  background: transparent !important; /* ПРОЗРАЧНЫЙ ФОН */
}

.scroll-arrow:hover {
  opacity: 0.8;
}

.scroll-arrow:active {
  opacity: 1;
}

/* Дополнительная защита от выделения текста при клике на стрелки */
.scroll-arrow-up,
.scroll-arrow-down {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}