@import url("https://fonts.googleapis.com/css2?family=Rajdhani:wght@300;500;700&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Share+Tech+Mono&display=swap");

/* Reload restore: дублирует critical CSS из airo-energy-restore-boot.js (fallback) */
html.airo-energy-restore-pending {
  overflow: hidden !important;
  background-color: #030712 !important;
}

html.airo-energy-restore-pending body {
  visibility: hidden !important;
}

html.airo-energy-restore-pending::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 2147483646;
  background: #030712;
  pointer-events: auto;
}

.airo-energy-modal.is-open.is-open-instant {
  transition: none !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

/* Модальное окно AiroEnergy: неоновая карточка (как в референсе), без отдельной страницы */
.airo-energy-modal {
  position: fixed;
  inset: 0;
  z-index: 21050;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right))
    max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  box-sizing: border-box;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.airo-energy-modal[hidden] {
  display: none !important;
}

.airo-energy-modal.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.airo-energy-modal__backdrop {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(6, 6, 10, 0.92) 0%, rgba(15, 15, 23, 0.96) 100%);
  backdrop-filter: blur(6px);
  pointer-events: auto;
}

.airo-energy-modal__dialog {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: min(420px, 100vw - 24px);
  max-height: min(92vh, 900px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  outline: none;
}

/* --- Карточка (структура и эффекты как в референсе) --- */
#airo-energy-modal .card-container {
  position: relative;
  width: min(400px, 92vw);
  height: min(560px, calc(92vh - 48px));
  max-height: calc(92vh - 48px);
  margin: 0 auto;
  perspective: 1000px;
  z-index: 10;
}

#airo-energy-modal .card {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.15s ease-out;
  cursor: default;
}

#airo-energy-modal .card-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 0;
  overflow: hidden;
  box-shadow: 0 0 30px rgba(0, 195, 255, 0.5);
}

#airo-energy-modal .card-front {
  background: linear-gradient(135deg, #12121e 0%, #1c1c2d 100%);
  border: 1px solid #00c3ff;
  display: flex;
  flex-direction: column;
}

#airo-energy-modal .card-inner-curve {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  bottom: 16px;
  border-radius: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: linear-gradient(135deg, #191927 0%, #13131d 100%);
  border: 1px solid rgba(0, 195, 255, 0.3);
  z-index: 1;
}

/* Крестик — малый квадрат в правом верхнем углу карточки */
#airo-energy-modal .airo-energy-card-close {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 25;
  width: 28px;
  height: 28px;
  padding: 0;
  margin: 0;
  border: 1px solid rgba(0, 195, 255, 0.7);
  background: rgba(14, 14, 22, 0.97);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #00c3ff;
  font-family: "Share Tech Mono", monospace;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.07),
    0 0 14px rgba(0, 195, 255, 0.35);
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    color 0.2s ease;
}

#airo-energy-modal .airo-energy-card-close:hover,
#airo-energy-modal .airo-energy-card-close:focus-visible {
  background-color: rgba(255, 0, 85, 0.15);
  border-color: rgba(255, 0, 85, 0.85);
  color: #ffb3c9;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.1),
    0 0 18px rgba(255, 0, 85, 0.45);
  outline: none;
}

#airo-energy-modal .airo-energy-card-close__x {
  font-size: 15px;
  line-height: 1;
  display: block;
  margin-top: -1px;
  pointer-events: none;
}

#airo-energy-modal .card-inner-curve::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAwIiBoZWlnaHQ9IjIwMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZGVmcz48cGF0dGVybiBpZD0iZ3JpZCIgd2lkdGg9IjIwIiBoZWlnaHQ9IjIwIiBwYXR0ZXJuVW5pdHM9InVzZXJTcGFjZU9uVXNlIj48cGF0aCBkPSJNIDIwIDAgTCAwIDAgTCAwIDIwIiBmaWxsPSJub25lIiBzdHJva2U9IiMwMGMzZmYiIHN0cm9rZS13aWR0aD0iMC41IiBvcGFjaXR5PSIwLjIiLz48L3BhdHRlcm4+PC9kZWZzPjxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JpZCkiLz48L3N2Zz4=");
  opacity: 0.5;
  pointer-events: none;
}

#airo-energy-modal .card-header {
  padding: 14px 34px 12px 34px;
  position: relative;
  z-index: 2;
  flex-shrink: 0;
  text-align: center;
}

#airo-energy-modal .card-title {
  font-family: "neuro", "Rajdhani", sans-serif;
  font-size: clamp(18px, 4.2vw, 24px);
  font-weight: 700;
  text-transform: none;
  color: #00c3ff;
  margin-bottom: 8px;
  text-shadow: 0 0 10px rgba(0, 195, 255, 0.7);
  letter-spacing: 0.06em;
  line-height: 1.25;
  text-align: center;
  width: 100%;
}

#airo-energy-modal .card-subtitle {
  font-family: "Share Tech Mono", monospace;
  font-size: 13px;
  color: #40e0d0;
  margin: 0;
  padding: 0;
  text-transform: uppercase;
  letter-spacing: 2px;
  text-align: center;
  width: 100%;
  flex-shrink: 0;
  min-height: 1.35em;
  display: block;
  text-shadow: 0 0 10px rgba(64, 224, 208, 0.55);
}

#airo-energy-modal .card-content {
  padding: 8px 16px 10px;
  position: relative;
  z-index: 2;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

#airo-energy-modal .airo-energy-balance-block {
  flex-shrink: 0;
  margin-bottom: 12px;
}

#airo-energy-modal .airo-energy-balance-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

#airo-energy-modal .airo-energy-balance-value {
  font-family: "Share Tech Mono", monospace;
  font-size: clamp(36px, 10vw, 52px);
  font-weight: 700;
  color: #00c3ff;
  text-shadow: 0 0 14px rgba(0, 195, 255, 0.75);
  line-height: 1;
}

/* Анимированная «батарейка» — уровень через --battery-level 0…1 */
#airo-energy-modal .airo-energy-battery {
  display: flex;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
}

#airo-energy-modal .airo-energy-battery__body {
  width: 28px;
  height: 52px;
  border-radius: 5px;
  border: 2px solid rgba(0, 195, 255, 0.65);
  background: rgba(10, 10, 20, 0.85);
  position: relative;
  overflow: hidden;
  box-shadow:
    inset 0 0 12px rgba(0, 195, 255, 0.25),
    0 0 10px rgba(0, 195, 255, 0.25);
}

#airo-energy-modal .airo-energy-battery__fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--battery-level, 0.65) * 100%);
  background: linear-gradient(180deg, #ff8800 0%, #ff0055 40%, #00c3ff 100%);
  box-shadow: 0 0 16px rgba(0, 195, 255, 0.6);
  transition: height 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  animation: airo-battery-pulse 2.4s ease-in-out infinite;
}

@keyframes airo-battery-pulse {
  0%,
  100% {
    filter: brightness(1);
    opacity: 1;
  }
  50% {
    filter: brightness(1.15);
    opacity: 0.95;
  }
}

#airo-energy-modal .airo-energy-battery__tip {
  width: 6px;
  height: 14px;
  margin-left: -1px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, #1c1c2d, #12121e);
  border: 2px solid rgba(0, 195, 255, 0.45);
  border-left: none;
  align-self: flex-start;
  margin-top: 8px;
}

#airo-energy-modal .airo-energy-history-wrap {
  flex: 1 1 auto;
  min-height: 0;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  margin-top: 4px;
  overflow: hidden;
}

#airo-energy-modal .airo-energy-history {
  list-style: none;
  margin: 0;
  padding: 4px 0 4px;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1 1 auto;
  align-self: stretch;
  min-height: 0;
  max-height: 100%;
  height: 100%;
  width: 100%;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}

#airo-energy-modal .airo-energy-history::-webkit-scrollbar {
  width: 6px;
}

#airo-energy-modal .airo-energy-history::-webkit-scrollbar-track {
  background: transparent;
  margin: 2px 0;
}

#airo-energy-modal .airo-energy-history::-webkit-scrollbar-thumb {
  background: rgba(0, 195, 255, 0.35);
  border-radius: 3px;
  min-height: 24px;
}

#airo-energy-modal .airo-energy-history li:last-child {
  margin-bottom: 0;
}

#airo-energy-modal .airo-energy-history li {
  display: grid;
  grid-template-columns: minmax(2.5rem, auto) minmax(0, 1fr);
  align-items: center;
  column-gap: 8px;
  font-size: 15px;
  padding: 8px 8px;
  margin: 0 auto 8px;
  max-width: 100%;
  width: 100%;
  border-radius: 0;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(0, 195, 255, 0.12);
  box-sizing: border-box;
}

#airo-energy-modal .airo-energy-history__delta {
  font-family: "Share Tech Mono", monospace;
  white-space: nowrap;
  justify-self: center;
  align-self: center;
  line-height: 1.2;
  text-align: center;
  min-height: 1.15em;
  min-width: 2.5rem;
}

#airo-energy-modal .airo-energy-history__desc {
  font-family: "Rajdhani", sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: #b3b3cc;
  text-align: center;
  justify-self: center;
  align-self: center;
  line-height: 1.35;
  min-width: 0;
  min-height: 1.15em;
}

#airo-energy-modal .airo-energy-history li.is-slot-empty .airo-energy-history__delta,
#airo-energy-modal .airo-energy-history li.is-slot-empty .airo-energy-history__desc {
  color: transparent;
  text-shadow: none;
}

#airo-energy-modal .airo-energy-history li.is-pos .airo-energy-history__delta {
  color: #00c3ff;
  text-shadow: 0 0 8px rgba(0, 195, 255, 0.45);
}

#airo-energy-modal .airo-energy-history li.is-neg .airo-energy-history__delta {
  color: #ff0055;
  text-shadow: 0 0 8px rgba(255, 0, 85, 0.45);
}

#airo-energy-modal .airo-energy-empty-hint {
  font-family: "Rajdhani", sans-serif;
  font-size: 14px;
  color: #b3b3cc;
  line-height: 1.5;
  letter-spacing: 0.3px;
  margin: 8px 0 0;
  white-space: pre-line;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#airo-energy-modal .airo-energy-empty-hint[hidden] {
  display: none !important;
}

#airo-energy-modal .glow-effect {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 0;
  box-shadow: inset 0 0 20px rgba(0, 195, 255, 0.3);
  pointer-events: none;
  z-index: 3;
}

#airo-energy-modal .edge-highlight {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 0;
  box-shadow: inset 0 0 2px rgba(255, 255, 255, 0.5);
  pointer-events: none;
  z-index: 4;
}

#airo-energy-modal .scanline {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  opacity: 0.15;
  z-index: 5;
  pointer-events: none;
}

#airo-energy-modal .scanline::before {
  content: "";
  position: absolute;
  width: 100%;
  height: 2px;
  background: rgba(0, 195, 255, 0.5);
  animation: airo-scanline 4s linear infinite;
}

@keyframes airo-scanline {
  0% {
    top: 0%;
  }
  100% {
    top: 100%;
  }
}

#airo-energy-modal .glitch {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  animation: airo-glitch 10s infinite;
  pointer-events: none;
  z-index: 6;
}

@keyframes airo-glitch {
  0% {
    opacity: 0;
  }
  1% {
    opacity: 0.3;
    transform: translate3d(5px, 0, 0);
    background: linear-gradient(90deg, rgba(255, 0, 85, 0.2) 0%, rgba(0, 195, 255, 0.2) 100%);
  }
  1.5% {
    opacity: 0;
  }
  15% {
    opacity: 0;
  }
  15.5% {
    opacity: 0.3;
    transform: translate3d(-5px, 0, 0);
    background: linear-gradient(90deg, rgba(0, 195, 255, 0.2) 0%, rgba(255, 0, 85, 0.2) 100%);
  }
  16% {
    opacity: 0;
  }
  100% {
    opacity: 0;
  }
}

#airo-energy-modal .hologram-effect {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    135deg,
    rgba(255, 0, 85, 0.1) 0%,
    rgba(0, 195, 255, 0.1) 100%
  );
  border-radius: 0;
  opacity: 0.5;
  z-index: 7;
  pointer-events: none;
}

@media (max-width: 380px) {
  #airo-energy-modal .card-container {
    width: 100%;
    height: min(520px, calc(100vh - 56px));
  }

  #airo-energy-modal .airo-energy-history {
    max-width: 100%;
  }
}
