/* Общие сбросы */
html, body, #cesiumContainer {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* Левая информационная панель */
#leftPanel {
  position: absolute;
  top: 0;
  left: 0;
  width: 300px;
  height: 100%;
  background: rgba(10, 10, 20, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  padding: 32px 24px 100px 24px; /* нижний отступ под нижнюю панель */
  color: #fff;
  z-index: 1000;
  box-shadow: 4px 0 30px rgba(0, 0, 0, 0.6);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.35s ease;
  transform: translateX(-100%);
  opacity: 0;
  overflow-y: auto;
  box-sizing: border-box;
}

#leftPanel.visible {
  transform: translateX(0);
  opacity: 1;
}

#leftPanel h2, #rightComparePanel h2 {
  margin: 0 0 28px 0;
  font-size: 26px;
  font-weight: 700;
  color: #00d4ff;
  letter-spacing: -0.3px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 16px;
}

/* Правая панель сравнения */
#rightComparePanel {
  position: absolute;
  top: 0;
  right: 0;
  width: 300px;
  height: 100%;
  background: rgba(10, 10, 20, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  padding: 32px 24px 100px 24px;
  color: #fff;
  z-index: 1000;
  box-shadow: -4px 0 30px rgba(0, 0, 0, 0.6);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.35s ease;
  transform: translateX(100%);
  opacity: 0;
  overflow-y: auto;
  box-sizing: border-box;
}

#rightComparePanel.visible {
  transform: translateX(0);
  opacity: 1;
}

/* Правая панель слоёв */
#layersPanel {
  position: absolute;
  top: 0;
  right: 0;
  width: 270px;
  height: 100%;
  background: rgba(10, 10, 20, 0.85);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  padding: 28px 20px 100px 20px;
  color: #fff;
  z-index: 1001;
  box-shadow: -4px 0 30px rgba(0, 0, 0, 0.6);
  transform: translateX(100%);
  transition: transform 0.35s ease;
  overflow-y: auto;
  box-sizing: border-box;
}

#layersPanel.visible {
  transform: translateX(0);
}

.category {
  margin-bottom: 28px;
}

.category-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: rgba(255, 255, 255, 0.5);
  margin: 0 0 12px 0;
  font-weight: 600;
}

.info-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}

.info-label {
  color: rgba(255, 255, 255, 0.65);
  font-weight: 500;
}

.info-value {
  font-weight: 600;
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
  padding: 4px 12px;
  border-radius: 8px;
  font-size: 13px;
  transition: all 0.3s ease;
}

/* Стили сравнения */
.info-value.better {
  color: #4caf50;
  font-weight: 700;
  background: rgba(76, 175, 80, 0.15);
}

.info-value.worse {
  color: #f44336;
  font-weight: 700;
  background: rgba(244, 67, 54, 0.15);
}

.info-value.equal {
  color: #ffc107;
  font-weight: 700;
  background: rgba(255, 193, 7, 0.15);
}

.arrow-up::after {
  content: ' ▲';
  color: #4caf50;
}

.arrow-down::after {
  content: ' ▼';
  color: #f44336;
}

.panel-hint {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.3);
  text-align: center;
  margin-top: auto;
  font-style: italic;
}

/* Стили слоёв внутри панели слоёв */
.panel-section h3,
.layer-group summary {
  margin: 0 0 10px 0;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #00d4ff;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.layer-group summary::-webkit-details-marker { display: none; }
.layer-group summary::before {
  content: '▸ ';
  display: inline-block;
  transition: transform 0.2s;
  font-size: 12px;
  margin-right: 6px;
}
.layer-group[open] summary::before { transform: rotate(90deg); }

.layer-btn {
  display: block;
  width: 100%;
  margin: 4px 0 4px 16px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.8);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
}

.layer-btn:hover { background: rgba(0, 212, 255, 0.1); border-color: rgba(0, 212, 255, 0.3); }
.layer-btn.active { background: rgba(0, 212, 255, 0.25); border-color: #00d4ff; color: #fff; font-weight: 600; }

/* Нижняя панель управления */
#bottomPanel {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: rgba(10, 10, 20, 0.85);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 2000;
  box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.6);
}

.bottom-tools {
  display: flex;
  gap: 12px;
}

.bottom-btn {
  padding: 8px 20px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.bottom-btn:hover { background: rgba(0, 212, 255, 0.15); border-color: rgba(0, 212, 255, 0.4); }
.bottom-btn.active { background: rgba(0, 212, 255, 0.3); border-color: #00d4ff; color: #fff; }

.bottom-checks {
  display: flex;
  gap: 16px;
  align-items: center;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  position: relative;
  transition: all 0.2s;
}

.checkbox-label input[type="checkbox"]:checked { background: #00d4ff; border-color: #00d4ff; }
.checkbox-label input[type="checkbox"]:checked::after {
  content: '✓';
  color: #000;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 11px;
  font-weight: bold;
}

#hint {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.35);
  font-size: 12px;
  z-index: 999;
  pointer-events: none;
  background: rgba(0,0,0,0.4);
  padding: 6px 18px;
  border-radius: 20px;
  backdrop-filter: blur(10px);
}

/* Панель альянсов */
#alliancesPanel {
  position: absolute;
  top: 0;
  left: 0;
  width: 280px;
  height: 100%;
  background: rgba(10, 10, 20, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  padding: 28px 20px 100px 20px;
  color: #fff;
  z-index: 1002;
  box-shadow: 4px 0 30px rgba(0, 0, 0, 0.6);
  transform: translateX(-100%);
  transition: transform 0.35s ease;
  overflow-y: auto;
  box-sizing: border-box;
}

#alliancesPanel.visible {
  transform: translateX(0);
}

#alliancesPanel h3 {
  margin: 0 0 20px 0;
  font-size: 16px;
  color: #00d4ff;
}

#alliancesList {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.alliance-checkbox {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
}

.alliance-checkbox:hover {
  background: rgba(0, 212, 255, 0.1);
  border-color: rgba(0, 212, 255, 0.3);
}

.alliance-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #00d4ff;
  cursor: pointer;
}

.alliance-color {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  flex-shrink: 0;
}

.alliance-label {
  flex: 1;
  font-weight: 500;
}

/* Карточка альянса */
#allianceCard {
  position: absolute;
  top: 0;
  right: 0;
  width: 320px;
  height: 100%;
  background: rgba(10, 10, 20, 0.92);
  backdrop-filter: blur(20px);
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  padding: 32px 24px 100px 24px;
  color: #fff;
  z-index: 1002;
  box-shadow: -4px 0 30px rgba(0, 0, 0, 0.6);
  transform: translateX(100%);
  transition: transform 0.35s ease;
  overflow-y: auto;
  box-sizing: border-box;
}

#allianceCard.visible {
  transform: translateX(0);
}

#allianceCard h2 {
  margin: 0 0 20px 0;
  font-size: 22px;
  font-weight: 700;
  color: #00d4ff;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  padding-bottom: 14px;
}

.alliance-card-info p {
  margin: 6px 0;
  font-size: 13px;
  color: rgba(255,255,255,0.7);
}

.ac-label {
  color: rgba(255,255,255,0.45);
  font-weight: 500;
}

.alliance-card-desc {
  font-size: 13px;
  line-height: 1.6;
  color: rgba(255,255,255,0.8);
  margin: 16px 0;
  padding: 12px;
  background: rgba(255,255,255,0.04);
  border-radius: 8px;
}

#allianceCard h4 {
  margin: 16px 0 8px 0;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: rgba(255,255,255,0.5);
}

#acFeatures {
  list-style: none;
  padding: 0;
  margin: 0 0 16px 0;
}

#acFeatures li {
  font-size: 13px;
  padding: 4px 0;
  color: rgba(255,255,255,0.85);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

#acFeatures li::before {
  content: '▸ ';
  color: #00d4ff;
  font-size: 10px;
}

#acMembers {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.member-tag {
  background: rgba(0, 212, 255, 0.15);
  color: #00d4ff;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

/* Карточка слоя (справа) */
#layerCard {
  position: absolute;
  top: 0;
  right: 0;
  width: 320px;
  height: 100%;
  background: rgba(10, 10, 20, 0.92);
  backdrop-filter: blur(20px);
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  padding: 32px 24px 100px 24px;
  color: #fff;
  z-index: 1002;
  box-shadow: -4px 0 30px rgba(0, 0, 0, 0.6);
  transform: translateX(100%);
  transition: transform 0.35s ease;
  overflow-y: auto;
  box-sizing: border-box;
}

#layerCard.visible {
  transform: translateX(0);
}

#layerCard h2 {
  margin: 0 0 16px 0;
  font-size: 22px;
  font-weight: 700;
  color: #00d4ff;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  padding-bottom: 14px;
}

.layer-card-desc {
  font-size: 13px;
  line-height: 1.6;
  color: rgba(255,255,255,0.8);
  margin-bottom: 12px;
}

.layer-card-meta {
  font-size: 12px;
  color: rgba(255,255,255,0.6);
  margin: 4px 0;
}

.layer-source-link {
  display: inline-block;
  margin: 8px 0 16px;
  font-size: 12px;
  color: #00d4ff;
  text-decoration: none;
  border-bottom: 1px dotted #00d4ff;
}

.layer-source-link:hover {
  color: #fff;
  border-bottom-color: #fff;
}

#layerCard h4 {
  margin: 16px 0 8px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: rgba(255,255,255,0.5);
}

/* Легенда */
.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  font-size: 12px;
}

.legend-color {
  width: 24px;
  height: 14px;
  border-radius: 3px;
  flex-shrink: 0;
}

.legend-label {
  color: rgba(255,255,255,0.8);
}

/* Панель слоёв слева */
#layersPanel {
  position: absolute;
  top: 0;
  left: 0;
  width: 280px;
  height: 100%;
  background: rgba(10, 10, 20, 0.92);
  backdrop-filter: blur(20px);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  padding: 28px 20px 100px 20px;
  color: #fff;
  z-index: 1001;
  box-shadow: 4px 0 30px rgba(0, 0, 0, 0.6);
  transform: translateX(-100%);
  transition: transform 0.35s ease;
  overflow-y: auto;
  box-sizing: border-box;
}

#layersPanel.visible {
  transform: translateX(0);
}

#layersPanel h3 {
  margin: 0 0 20px;
  font-size: 16px;
  color: #00d4ff;
}

.layers-category {
  margin-bottom: 20px;
}

.layers-cat-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.5);
  margin: 0 0 8px;
  font-weight: 600;
}

.layer-radio-label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  margin: 2px 0;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}

.layer-radio-label:hover {
  background: rgba(0,212,255,0.1);
  border-color: rgba(0,212,255,0.3);
}

.layer-radio-label input[type="radio"] {
  accent-color: #00d4ff;
  cursor: pointer;
}

/* Компактные значения в карточке */
.info-value {
  font-size: 12px;
  padding: 3px 8px;
  white-space: nowrap;
}

.info-label {
  font-size: 12px;
}

.info-item {
  margin-bottom: 2px;
}

.category {
  margin-bottom: 18px;
}

.category-title {
  font-size: 11px;
  margin-bottom: 8px;
}

#leftPanel h2 {
  font-size: 22px;
  margin-bottom: 20px;
}

/* ===========================================
   КАСТОМНЫЙ СКРОЛЛБАР ДЛЯ ВСЕХ ПАНЕЛЕЙ
   =========================================== */

/* Для WebKit-браузеров (Chrome, Edge, Safari) */
#leftPanel::-webkit-scrollbar,
#rightComparePanel::-webkit-scrollbar,
#layersPanel::-webkit-scrollbar,
#alliancesPanel::-webkit-scrollbar,
#layerCard::-webkit-scrollbar,
#allianceCard::-webkit-scrollbar {
  width: 4px;
}

/* Фон дорожки скроллбара */
#leftPanel::-webkit-scrollbar-track,
#rightComparePanel::-webkit-scrollbar-track,
#layersPanel::-webkit-scrollbar-track,
#alliancesPanel::-webkit-scrollbar-track,
#layerCard::-webkit-scrollbar-track,
#allianceCard::-webkit-scrollbar-track {
  background: transparent;
  margin: 10px 0;
}

/* Сам ползунок */
#leftPanel::-webkit-scrollbar-thumb,
#rightComparePanel::-webkit-scrollbar-thumb,
#layersPanel::-webkit-scrollbar-thumb,
#alliancesPanel::-webkit-scrollbar-thumb,
#layerCard::-webkit-scrollbar-thumb,
#allianceCard::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
  transition: background 0.3s ease;
}

/* Ползунок при наведении */
#leftPanel::-webkit-scrollbar-thumb:hover,
#rightComparePanel::-webkit-scrollbar-thumb:hover,
#layersPanel::-webkit-scrollbar-thumb:hover,
#alliancesPanel::-webkit-scrollbar-thumb:hover,
#layerCard::-webkit-scrollbar-thumb:hover,
#allianceCard::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 212, 255, 0.4);
}

/* Для Firefox */
#leftPanel,
#rightComparePanel,
#layersPanel,
#alliancesPanel,
#layerCard,
#allianceCard {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

/* Панель торговли */
#tradePanel {
  position: absolute;
  top: 0;
  left: 0;
  width: 320px;
  height: 100%;
  background: rgba(10, 10, 20, 0.92);
  backdrop-filter: blur(20px);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  padding: 28px 20px 100px 20px;
  color: #fff;
  z-index: 1002;
  box-shadow: 4px 0 30px rgba(0, 0, 0, 0.6);
  transform: translateX(-100%);
  transition: transform 0.35s ease;
  overflow-y: auto;
  box-sizing: border-box;
}

#tradePanel.visible {
  transform: translateX(0);
}

#tradePanel h2 {
  margin: 0 0 20px 0;
  font-size: 22px;
  color: #00d4ff;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  padding-bottom: 14px;
}

.trade-summary {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
  padding: 12px;
  background: rgba(255,255,255,0.04);
  border-radius: 8px;
}

.trade-summary-item {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 600;
}

.trade-item {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

/* Панель дипломатии */
#diplomacyPanel {
  position: absolute;
  top: 0;
  left: 0;
  width: 380px;
  height: 100%;
  background: rgba(10, 10, 20, 0.92);
  backdrop-filter: blur(20px);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  padding: 28px 24px 100px 24px;
  color: #fff;
  z-index: 1002;
  box-shadow: 4px 0 30px rgba(0, 0, 0, 0.6);
  transform: translateX(-100%);
  transition: transform 0.35s ease;
  overflow-y: auto;
  box-sizing: border-box;
}

#diplomacyPanel.visible {
  transform: translateX(0);
}

#diplomacyPanel h2 {
  margin: 0 0 16px 0;
  font-size: 20px;
  color: #00d4ff;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  padding-bottom: 14px;
}

.diplomacy-doc-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 10px;
}

.diplomacy-doc-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

.diplomacy-doc-header h4 {
  margin: 0;
  font-size: 14px;
  color: #fff;
  font-weight: 600;
}

.diplomacy-doc-meta {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  white-space: nowrap;
}

.diplomacy-doc-card p {
  margin: 0;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.5;
}