/**
 * UPGRADES MODAL — модальное окно ветки.
 */

.upgrades-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  font-family: var(--font-pixel);
}

.upgrades-modal.open {
  display: flex;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
}

.modal-window {
  position: relative;
  width: min(92vw, 420px);
  max-height: 92vh;
  background: var(--bg-panel);
  border: var(--border-w) solid var(--outline);
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.6);
  animation: modalIn 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalIn {
  0%   { transform: scale(0.9); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--bg-deep);
  border-bottom: 2px solid var(--outline);
}

.modal-title {
  color: var(--accent);
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.modal-close {
  font-family: var(--font-pixel);
  font-size: 18px;
  color: var(--text-dim);
  padding: 0 6px;
  cursor: pointer;
  background: none;
  border: none;
  line-height: 1;
}

.modal-close:active {
  color: var(--accent);
}

.modal-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  overflow-y: auto;
  flex: 1;
}

.modal-icon {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  background: var(--bg-deep);
  border: 2px solid var(--outline);
}

.modal-icon svg {
  image-rendering: pixelated;
  shape-rendering: crispEdges;
}

.modal-effect {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.effect-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  background: var(--bg-panel-2);
  border-left: 3px solid var(--outline);
  font-size: 10px;
  gap: 8px;
}

.effect-row.next {
  border-left-color: var(--accent);
}

.effect-row.next .effect-value {
  color: var(--accent);
}

.effect-label {
  color: var(--text-dim);
  letter-spacing: 1px;
}

.effect-value {
  color: var(--text);
  font-size: 11px;
  text-align: right;
}

.modal-levels {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 4px;
  width: 100%;
  padding: 8px;
  background: var(--bg-deep);
  border: 2px solid var(--outline);
}

.level-dot {
  aspect-ratio: 1;
  background: var(--outline-lo);
  border: 1px solid var(--outline);
}

.level-dot.done {
  background: var(--accent-dim);
  border-color: var(--accent);
}

.level-dot.current {
  background: var(--accent);
  border-color: var(--accent-hi);
  animation: levelPulse 1.2s ease-in-out infinite;
}

.level-dot.locked {
  opacity: 0.5;
}

@keyframes levelPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(232, 184, 64, 0.5); }
  50%      { box-shadow: 0 0 0 4px rgba(232, 184, 64, 0); }
}

.modal-footer {
  padding: 10px 12px 12px;
  border-top: 2px solid var(--outline);
  background: var(--bg-deep);
}

.modal-buy {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  color: var(--bg-deep);
  border: 2px solid var(--accent-hi);
  font-family: var(--font-pixel);
  font-size: 12px;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: transform 0.1s, background 0.12s;
  gap: 8px;
}

.modal-buy:active:not(:disabled) {
  transform: scale(0.97);
  background: var(--accent-hi);
}

.modal-buy:disabled {
  background: var(--outline);
  border-color: var(--outline-hi);
  color: var(--text-mute);
  cursor: default;
}