@font-face {
  font-family: 'Belepotan Rus';
  src: url('./Belepotan Rus.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  --light-square: #f0d9b5;
  --dark-square: #b58863;
  --selected-square: #f7f769;
  --legal-move: rgba(20, 85, 30, 0.5);
  --last-move: rgba(155, 199, 0, 0.41);
  --in-check: #ff0000;
  --bg-color: #2b2b2b;
  --text-color: #e0e0e0;
  --panel-bg: #3b3b3b;
  --border-color: #555;
}

[data-theme='light'] {
  --bg-color: #f5f5f5;
  --text-color: #333;
  --panel-bg: #ffffff;
  --border-color: #ddd;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  font-family: 'Belepotan Rus', sans-serif !important;
}

input, textarea {
  user-select: text;
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: 'Belepotan Rus', sans-serif !important;
  background-color: var(--bg-color);
  color: var(--text-color);
}

body.dragging {
  cursor: none !important;
}

body.dragging * {
  cursor: none !important;
}

#game-wrapper {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

#game-root {
  width: 1920px;
  height: 1080px;
  position: absolute;
  transform-origin: top left;
  display: flex;
  flex-direction: column;
  padding: 0;
  gap: 0;
  overflow: hidden;
}

.theme-toggle {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-color);
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
}

.main-content {
  display: flex;
  gap: 2rem;
  flex: 1;
  align-items: center;
  justify-content: center;
  position: relative;
  height: 100%;
  overflow: hidden;
  padding: 0;
  padding-top: 102px;
}

.game-area {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
  flex: 1;
  justify-content: center;
  height: 100%;
  overflow: hidden;
}

.board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  width: 850px;
  height: 850px;
  min-width: 280px;
  min-height: 280px;
  border: none;
  border-radius: 0;
  overflow: hidden;
  position: relative;
  background-image: url('./doska.png');
  background-size: 110% 110%;
  background-position: center;
  background-repeat: no-repeat;
}

.square {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
}

.square.light {
  background-color: transparent;
}

.square.dark {
  background-color: transparent;
}

.square.selected {
  background-color: var(--selected-square) !important;
}

.square.legal-move::after {
  content: '';
  position: absolute;
  width: 30%;
  height: 30%;
  border-radius: 50%;
  background-color: var(--legal-move);
  pointer-events: none;
}

.square.trapped {
  position: relative;
}

.square.trapped::before {
  content: '';
  position: absolute;
  top: 5%;
  left: 5%;
  right: 5%;
  bottom: 5%;
  background-image: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 8px,
    rgba(100, 255, 100, 0.4) 8px,
    rgba(100, 255, 100, 0.4) 16px
  );
  background-size: 22px 22px;
  pointer-events: none;
  z-index: 1;
}

.square.trapped::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 8px,
    rgba(100, 255, 100, 0.5) 8px,
    rgba(100, 255, 100, 0.5) 16px
  );
  background-size: 22px 22px;
  filter: blur(10px);
  mask-image: radial-gradient(ellipse 90% 90% at center, transparent 0%, transparent 88%, rgba(0, 0, 0, 0.2) 90%, rgba(0, 0, 0, 0.5) 92%, rgba(0, 0, 0, 0.8) 94%, black 96%, black 100%);
  -webkit-mask-image: radial-gradient(ellipse 90% 90% at center, transparent 0%, transparent 88%, rgba(0, 0, 0, 0.2) 90%, rgba(0, 0, 0, 0.5) 92%, rgba(0, 0, 0, 0.8) 94%, black 96%, black 100%);
  pointer-events: none;
  z-index: 0;
}


.square.in-check {
  background-color: var(--in-check) !important;
}

.square img {
  width: 90%;
  height: 90%;
  pointer-events: none;
}

.square.dragging {
  opacity: 0.5;
}

.hp-bar-container {
  position: absolute;
  bottom: 2px;
  left: 5%;
  right: 5%;
  height: 4px;
  background-color: rgba(0, 0, 0, 0.3);
  border-radius: 2px;
  overflow: hidden;
}

.hp-bar {
  height: 100%;
  transition: width 0.3s ease;
  border-radius: 2px;
}

.hp-bar.hp-high {
  background-color: #4caf50;
}

.hp-bar.hp-medium {
  background-color: #ff9800;
}

.hp-bar.hp-low {
  background-color: #f44336;
}

.crosshair-sprite {
  position: fixed;
  font-size: 40px;
  pointer-events: none;
  z-index: 10000;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.8));
  animation: crosshairPulse 0.5s ease-in-out infinite;
  display: flex;
  align-items: center;
  justify-content: center;
}

.crosshair-sprite-img {
  position: absolute;
  width: 40px;
  height: 40px;
  object-fit: contain;
  pointer-events: none;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: crosshairSpritePulse 0.5s ease-in-out infinite;
}

@keyframes crosshairSpritePulse {
  0%, 100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.1);
    opacity: 0.8;
  }
}

@keyframes crosshairPulse {
  0%, 100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.1);
    opacity: 0.8;
  }
}

@keyframes hitExplosion {
  0% {
    transform: translate(-50%, -50%) scale(0);
    opacity: 1;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.5);
    opacity: 0.8;
  }
  100% {
    transform: translate(-50%, -50%) scale(2);
    opacity: 0;
  }
}

.square.hit-flash {
  animation: hitFlash 0.3s ease-out;
}

@keyframes hitFlash {
  0% {
    background-color: rgba(255, 100, 0, 0.8) !important;
  }
  100% {
    background-color: transparent;
  }
}

.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 92px;
  background: var(--panel-bg);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  z-index: 200;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  background-image: url('./UI_ramk.png');
  background-size: 110% 100%;
  background-position: center;
  background-repeat: no-repeat;
}

.top-bar-left {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex: 1;
  justify-content: center;
}

.top-bar-right {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.top-bar-btn {
  padding: 0.9rem 1.8rem;
  border: 1px solid var(--border-color);
  background: var(--panel-bg);
  color: var(--text-color);
  border-radius: 4px;
  cursor: pointer;
  font-size: 1.32rem;
  transition: background 0.2s;
  white-space: nowrap;
  position: relative;
  background-image: url('./knp.png');
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 201;
  pointer-events: auto;
}

.top-bar-btn:hover:not(:disabled) {
  background: var(--border-color);
  background-image: url('./knp.png');
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
}

.top-bar-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.top-bar-btn-primary {
  background: #4a90e2;
  background-image: url('./knp.png'), linear-gradient(to bottom, #4a90e2, #357abd);
  background-size: 100% 100%, 100% 100%;
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
  color: white;
  border-color: #4a90e2;
}

.top-bar-btn-primary:hover:not(:disabled) {
  background: #357abd;
  background-image: url('./knp.png'), linear-gradient(to bottom, #357abd, #2a5f8f);
  background-size: 100% 100%, 100% 100%;
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
}

.top-bar-btn-danger {
  background: #e74c3c;
  background-image: url('./knp.png'), linear-gradient(to bottom, #e74c3c, #c0392b);
  background-size: 100% 100%, 100% 100%;
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
  color: white;
  border-color: #e74c3c;
}

.top-bar-btn-danger:hover:not(:disabled) {
  background: #c0392b;
  background-image: url('./knp.png'), linear-gradient(to bottom, #c0392b, #a93226);
  background-size: 100% 100%, 100% 100%;
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
}

.top-bar-btn-menu {
  background: var(--panel-bg);
  color: var(--text-color);
  border-color: var(--border-color);
  position: relative;
  background-image: url('./knp.png');
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
}

.top-bar-btn-menu:hover {
  background: var(--border-color);
  background-image: url('./knp.png');
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
}

.sidebar {
  position: fixed;
  right: calc((1920px - 850px) / 2 - 250px - 20px);
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 250px;
  max-height: 90%;
  overflow-y: auto;
  z-index: 100;
}

.sidebar-left {
  position: fixed;
  left: calc((1920px - 850px) / 2 - 250px - 275px);
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 100;
  max-height: calc(100% - 140px);
  overflow: visible;
}

.sidebar-right {
  position: fixed;
  right: calc(1920px - ((1920px - 850px) / 2 + 850px + 275px + 250px));
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 100;
  max-height: calc(100% - 140px);
  max-width: calc(100% - 1rem);
  overflow: visible;
  align-items: flex-end;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem;
  background: var(--panel-bg);
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.controls-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.difficulty-label {
  font-size: 0.9rem;
  color: var(--text-color);
  margin-right: 0.5rem;
}

.difficulty-select {
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  background: var(--panel-bg);
  color: var(--text-color);
  border-radius: 4px;
  font-size: 0.9rem;
  cursor: pointer;
  flex: 1;
  min-width: 120px;
}

.difficulty-select:hover {
  background: var(--border-color);
}

.btn {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  background: var(--panel-bg);
  color: var(--text-color);
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.2s;
  flex: 1;
  min-width: 80px;
}

.btn:hover:not(:disabled) {
  background: var(--border-color);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: #4a90e2;
  color: white;
  border-color: #4a90e2;
}

.btn-primary:hover:not(:disabled) {
  background: #357abd;
}

.btn-danger {
  background: #e74c3c;
  color: white;
  border-color: #e74c3c;
}

.btn-danger:hover:not(:disabled) {
  background: #c0392b;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
}

.toggle-label input[type='checkbox'] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}


.status-bar {
  padding: 1.5rem 2rem;
  background: var(--panel-bg);
  border-radius: 8px;
  border: 1px solid var(--border-color);
  text-align: center;
  font-weight: 500;
  font-size: 1.5rem;
  position: relative;
  margin-top: 15px;
  background-image: url('./ramk1.png');
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
}

.promotion-overlay,
.confirm-overlay,
.gameover-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.promotion-dialog,
.confirm-dialog,
.gameover-dialog {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 2rem;
  max-width: 400px;
  text-align: center;
  position: relative;
  background-image: url('./ramk.png');
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
}

.promotion-dialog > *,
.confirm-dialog > *,
.gameover-dialog > * {
  position: relative;
  z-index: 1;
}

.promotion-dialog h3,
.confirm-dialog p,
.gameover-dialog h2 {
  margin-bottom: 1rem;
  -webkit-text-stroke: 2px black;
  text-stroke: 2px black;
  paint-order: stroke fill;
}

.promotion-pieces {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.promotion-piece {
  background: var(--panel-bg);
  border: 2px solid var(--border-color);
  border-radius: 4px;
  padding: 1rem;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s;
}

.promotion-piece:hover {
  transform: scale(1.1);
  border-color: #4a90e2;
}

.promotion-piece img {
  width: 100%;
  height: auto;
}

.confirm-buttons {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
  justify-content: center;
}

.gameover-dialog button {
  display: block;
  margin: 1rem auto 0;
}

.confirm-btn,
.gameover-btn {
  padding: 0.75rem 1.5rem;
  border: none;
  background: transparent;
  color: var(--text-color);
  border-radius: 0;
  cursor: pointer;
  font-size: 1rem;
  position: relative;
  background-image: url('./knp.png');
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
}

.confirm-btn:hover,
.gameover-btn:hover {
  background: transparent;
  background-image: url('./knp.png');
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
}

.confirm-yes {
  background: transparent;
  color: var(--text-color);
  border: none;
  background-image: url('./knp.png');
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
}

.confirm-yes:hover {
  background: transparent;
  background-image: url('./knp.png');
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
}

.tactics-panel h3 {
  margin: 0;
  font-size: 1.4em;
  color: var(--text-color);
  -webkit-text-stroke: 2px black;
  text-stroke: 2px black;
  paint-order: stroke fill;
}

.ap-display {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5em;
  background: rgba(74, 144, 226, 0.1);
  border-radius: 4px;
  border: 1px solid rgba(74, 144, 226, 0.3);
  position: relative;
}

.ap-display::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: url('./rmk.png');
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  transform: rotate(0deg);
  z-index: 0;
  pointer-events: none;
}

.ap-display > * {
  position: relative;
  z-index: 1;
}

.ap-label {
  font-size: 0.9em;
  color: var(--text-color);
  -webkit-text-stroke: 2px black;
  text-stroke: 2px black;
  paint-order: stroke fill;
}

.ap-value {
  font-size: 1.2em;
  font-weight: bold;
  color: #4a90e2;
  -webkit-text-stroke: 2px black;
  text-stroke: 2px black;
  paint-order: stroke fill;
  margin-left: 3em;
}

.bonuses-container {
  display: flex;
  flex-direction: column;
  gap: 0.75em;
  width: 100%;
  position: relative;
  padding: 0.5em;
  overflow: visible;
  flex: 1;
  min-height: 0;
}

.bonus-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0;
  padding: 0.3rem 0;
  background: transparent;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  flex: 1;
  min-height: 60px;
  width: 100%;
  margin: 0 auto;
  justify-content: flex-start;
  background-image: url('./pod_B.png');
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  position: relative;
  box-sizing: border-box;
}

.bonus-item > .bonus-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  width: auto;
  height: auto;
  font-size: 1.5rem;
  line-height: 1;
  color: transparent;
  margin-left: 18px;
  gap: 12px;
}

.bonus-item > .bonus-name {
  font-size: 1.7204rem;
  text-align: left;
  line-height: 1.2;
  flex: 1;
  margin-left: 24px;
  margin-right: 0.6rem;
  padding-right: 2px;
  word-wrap: break-word;
  overflow-wrap: break-word;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  white-space: normal;
  color: white;
}

.bonus-item[data-bonus-type="machine_gun"] > .bonus-name,
.bonus-item[data-bonus-type="molotov"] > .bonus-name {
  font-size: 1.0557rem;
  line-height: 1.2;
  word-break: break-word;
}

.bonus-item[data-bonus-type="shockwave"] > .bonus-name {
  font-size: 1.0029rem;
  line-height: 1.2;
  word-break: break-word;
}

.bonus-item[data-bonus-type="machine_gun"] > .bonus-name,
.bonus-item[data-bonus-type="artillery"] > .bonus-name,
.bonus-item[data-bonus-type="bandage"] > .bonus-name {
  margin-left: 12px;
}

.bonus-item > .bonus-cost {
  font-size: 1.4rem;
  color: #4a90e2;
  font-weight: bold;
  line-height: 1;
  text-align: center;
  margin-top: -6px;
}

.bonus-item.bonus-available {
  cursor: grab;
}

.bonus-item.bonus-available:hover {
  opacity: 0.9;
}

.bonus-item.bonus-available:active {
  cursor: grabbing;
}

.bonus-item.bonus-unavailable {
  opacity: 0.5;
  cursor: not-allowed;
}

.bonus-item.dragging {
  opacity: 0.5;
}


.smoke-effect {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle, rgba(80, 80, 80, 0.85) 0%, rgba(120, 120, 120, 0.65) 40%, rgba(150, 150, 150, 0.45) 70%, transparent 100%);
  pointer-events: none;
  z-index: 5;
  animation: smokePulse 2s ease-in-out infinite;
  box-shadow: inset 0 0 20px rgba(100, 100, 100, 0.5);
}

@keyframes smokePulse {
  0%, 100% {
    opacity: 0.75;
    transform: scale(1);
  }
  50% {
    opacity: 0.9;
    transform: scale(1.08);
  }
}

.smoke-effect-appearing {
  animation: smokeAppear 0.8s ease-out;
}

@keyframes smokeAppear {
  0% {
    opacity: 0;
    transform: scale(0.5);
  }
  50% {
    opacity: 0.6;
    transform: scale(1.1);
  }
  100% {
    opacity: 0.75;
    transform: scale(1);
  }
}

.fire-effect {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 24px;
  z-index: 5;
  pointer-events: none;
  animation: fireFlicker 1s ease-in-out infinite;
}

.fire-glow {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(255,100,0,0.4) 0%, rgba(255,50,0,0.2) 50%, transparent 100%);
  z-index: 1;
  pointer-events: none;
  animation: firePulse 1.5s ease-in-out infinite;
}

@keyframes fireFlicker {
  0%, 100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  25% {
    opacity: 0.8;
    transform: translate(-50%, -50%) scale(1.1);
  }
  50% {
    opacity: 0.9;
    transform: translate(-50%, -50%) scale(0.95);
  }
  75% {
    opacity: 0.85;
    transform: translate(-50%, -50%) scale(1.05);
  }
}

@keyframes firePulse {
  0%, 100% {
    opacity: 0.6;
    transform: scale(1);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.1);
  }
}

.heal-effect {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 20px;
  z-index: 5;
  pointer-events: none;
  animation: healPulse 2s ease-in-out infinite;
}

.heal-glow {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(76, 217, 100, 0.3) 0%, rgba(52, 199, 89, 0.2) 50%, transparent 100%);
  z-index: 1;
  pointer-events: none;
  animation: healGlowPulse 2s ease-in-out infinite;
}

@keyframes healPulse {
  0%, 100% {
    opacity: 0.8;
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.15);
  }
}

@keyframes healGlowPulse {
  0%, 100% {
    opacity: 0.5;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.05);
  }
}

.aa-defense-effect {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle, rgba(100, 150, 255, 0.3) 0%, rgba(50, 100, 200, 0.2) 40%, rgba(30, 70, 150, 0.15) 70%, transparent 100%);
  pointer-events: none;
  z-index: 4;
  animation: aaDefensePulse 2s ease-in-out infinite;
  box-shadow: inset 0 0 15px rgba(100, 150, 255, 0.4);
  border: 1px solid rgba(100, 150, 255, 0.3);
}

.aa-defense-glow {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(100, 150, 255, 0.25) 0%, rgba(50, 100, 200, 0.15) 50%, transparent 100%);
  z-index: 1;
  pointer-events: none;
  animation: aaDefenseGlowPulse 2s ease-in-out infinite;
}

@keyframes aaDefensePulse {
  0%, 100% {
    opacity: 0.6;
    transform: scale(1);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.02);
  }
}

@keyframes aaDefenseGlowPulse {
  0%, 100% {
    opacity: 0.4;
    transform: scale(1);
  }
  50% {
    opacity: 0.6;
    transform: scale(1.05);
  }
}

.main-menu {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-color);
  z-index: 10000;
  background-image: url('./fon.jpg');
  background-size: 110% 110%;
  background-position: center;
  background-repeat: no-repeat;
}

.menu-rate-button {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  padding: 1.4rem 2.8rem;
  border: none;
  background: transparent;
  color: var(--text-color);
  border-radius: 4px;
  cursor: pointer;
  font-size: 2.5rem;
  transition: background 0.2s;
  white-space: nowrap;
  background-image: url('./knp.png');
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 10001;
  height: 84px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.menu-rate-button:hover {
  background: transparent;
  background-image: url('./knp.png');
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
}

.menu-other-games-button {
  top: calc(1.5rem + 4.5rem + 30px);
  padding: 1.4rem 2.8rem;
  font-size: 2.5rem;
  height: 84px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.menu-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  padding: 2rem;
  max-width: 600px;
  width: 100%;
}

.menu-title {
  font-size: 3rem;
  font-weight: bold;
  color: var(--text-color);
  margin-bottom: 1rem;
  text-align: center;
}

.menu-subtitle {
  font-size: 2rem;
  font-weight: bold;
  color: var(--text-color);
  margin-bottom: 1rem;
  text-align: center;
  -webkit-text-stroke: 6px black;
  text-stroke: 6px black;
  paint-order: stroke fill;
}

.menu-options {
  display: flex;
  flex-direction: row;
  gap: 2rem;
  width: 100%;
  justify-content: center;
  flex-wrap: wrap;
}

.menu-options-vertical {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.3rem;
  width: 100%;
  max-width: 650px;
  margin: 0 auto;
}

.menu-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 3.5rem 4.5rem;
  background: transparent;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s;
  min-width: 320px;
  flex: 1;
  max-width: 420px;
  background-image: url('./pod_B.png');
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
}

.menu-options-vertical .menu-button {
  padding: 2.6rem 3.25rem;
  min-width: 286px;
  max-width: 364px;
}

.menu-button:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

.menu-button-icon {
  font-size: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.menu-button-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  max-width: 130px;
  max-height: 130px;
}

.menu-options-vertical .menu-button-icon {
  font-size: 3.25rem;
}

.menu-options-vertical .menu-button-icon img {
  max-width: 104px;
  max-height: 104px;
}

.menu-button-text {
  font-size: 1.8rem;
  font-weight: 500;
  color: var(--text-color);
  text-align: center;
}

.menu-options-vertical .menu-button-text {
  font-size: 1.5rem;
}

  .menu-back-button {
    padding: 1.1rem 2.2rem;
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-color);
    cursor: pointer;
    font-size: 1.43rem;
    transition: all 0.2s;
    position: relative;
    background-image: url('./knp.png');
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
    height: 66px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

.menu-back-button:hover {
  background: var(--border-color);
  background-image: url('./knp.png');
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
}

.menu-back-buttons {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: center;
  margin-top: 1rem;
}

.menu-tutorial-button {
  padding: 1.1rem 2.2rem;
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-color);
  cursor: pointer;
  font-size: 1.43rem;
  transition: all 0.2s;
  position: relative;
  background-image: url('./knp.png');
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  height: 66px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.menu-tutorial-button:hover {
  background: var(--border-color);
  background-image: url('./knp.png');
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
}

.tutorial-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 1rem;
}

.tutorial-modal {
  background: var(--panel-bg);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.tutorial-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.tutorial-title {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--text-color);
  margin: 0;
}

.tutorial-close {
  background: transparent;
  border: none;
  font-size: 2rem;
  color: var(--text-color);
  cursor: pointer;
  padding: 0;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
}

.tutorial-close:hover {
  transform: scale(1.2);
}

.tutorial-content {
  padding: 1.5rem;
  flex: 1;
}

.tutorial-section {
  margin-bottom: 1.5rem;
}

.tutorial-section:last-child {
  margin-bottom: 0;
}

.tutorial-section-title {
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--text-color);
  margin-bottom: 0.5rem;
}

.tutorial-text {
  font-size: 1rem;
  color: var(--text-color);
  line-height: 1.6;
  margin: 0;
}

.tutorial-ok-button {
  padding: 0.5rem 1.2rem;
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-color);
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
  margin: 1.5rem;
  background-image: url('./knp.png');
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  width: fit-content;
  align-self: center;
}

.tutorial-ok-button:hover {
  background: var(--border-color);
  background-image: url('./knp.png');
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
}

.menu-reward-container {
  width: 100%;
  display: flex;
  justify-content: center;
  margin-top: 1.5rem;
  margin-bottom: 0;
}

.menu-button-reward {
  background-image: url('./ramk.png');
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  border: 2px solid rgba(255, 255, 255, 0.3);
  position: relative;
  min-width: 250px;
  width: auto;
  max-width: 350px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 1.36rem 3rem;
  cursor: pointer;
  z-index: 1;
  visibility: visible;
  opacity: 1;
  border-radius: 12px;
  transition: all 0.3s;
}

.menu-button-reward:hover {
  background-image: url('./ramk.png');
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.menu-button-reward.reward-watched {
  background-image: url('./ramk.png');
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  border: 2px solid rgba(255, 255, 255, 0.5);
}

.menu-button-reward.reward-watched:hover {
  background-image: url('./ramk.png');
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  box-shadow: 0 8px 20px rgba(56, 239, 125, 0.4);
}

.menu-button-reward:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.reward-check {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  font-size: 1.5rem;
  color: #fff;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 50%;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

.menu-gifts-container {
  position: fixed;
  top: 1rem;
  left: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 1000;
}

.menu-gift-button {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  padding: 1.26rem 2.1rem;
  background-image: url('./ramk.png');
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  background-color: transparent;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s;
  min-width: 302.4px;
  max-width: 403.2px;
  font-size: 1.512rem;
}

.menu-gift-button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.menu-gift-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.menu-gift-icon {
  font-size: 2.52rem;
  flex-shrink: 0;
}

.menu-gift-text {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.menu-gift-title {
  font-size: 1.68rem;
  font-weight: bold;
  color: var(--text-color);
}

.menu-gift-desc {
  font-size: 1.428rem;
  color: var(--text-color);
  opacity: 0.9;
}

.menu-gift-timer {
  font-size: 1.428rem;
  color: var(--text-color);
  opacity: 0.9;
  margin-top: 0.25rem;
  font-weight: bold;
  font-family: monospace;
}

.menu-gift-ready {
  font-size: 1.428rem;
  color: #4caf50;
  font-weight: bold;
  margin-top: 0.25rem;
}

.game-container {
  width: 100%;
  height: 100%;
  position: relative;
  background-image: url('./pole.jpg');
  background-size: 110% 110%;
  background-position: center;
  background-repeat: no-repeat;
}

.bonus-columns-container {
  display: flex;
  flex-direction: row;
  gap: 0.25rem;
  width: 100%;
  flex: 1;
  min-height: 0;
}

.bonus-column {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
  min-height: 0;
}

.tactics-panel {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 1.2rem;
  background: var(--panel-bg);
  border-radius: 8px;
  border: 1px solid var(--border-color);
  margin-top: 0.5rem;
  width: 500px;
  height: 810px;
  min-width: 400px;
  position: relative;
  background-image: url('./rmk_boy.png');
  background-size: 112% 112%;
  background-position: center;
  background-repeat: no-repeat;
  max-width: min(500px, calc(100vw - 2rem));
  font-size: 1.25rem;
}

.bonus-item .bonus-icon {
  font-size: 1em;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
  color: transparent;
  flex-shrink: 0;
  width: auto;
  height: auto;
  margin-left: 1em;
  gap: 0.5em;
  transform: translateY(-15%);
}

.bonus-item .bonus-sprite {
  position: relative;
  width: 2em;
  height: 2em;
  object-fit: contain;
  pointer-events: none;
  flex-shrink: 0;
}

.bonus-item .bonus-name {
  font-size: 1.0948em;
  text-align: left;
  line-height: 1.1;
  flex: 1;
  margin-left: 1.2em;
  margin-right: 0.5em;
  word-wrap: break-word;
  overflow-wrap: break-word;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  white-space: normal;
  overflow: visible;
  color: white;
  -webkit-text-stroke: 1px white;
  text-stroke: 1px white;
  paint-order: stroke fill;
  transform: translateY(-15%);
}

.bonus-item[data-bonus-type="machine_gun"] .bonus-name,
.bonus-item[data-bonus-type="artillery"] .bonus-name,
.bonus-item[data-bonus-type="bandage"] .bonus-name {
  margin-left: 1em;
}

.bonus-item[data-bonus-type="machine_gun"] .bonus-name,
.bonus-item[data-bonus-type="molotov"] .bonus-name {
  font-size: 1.0557em;
  line-height: 1.2;
  max-width: 100%;
  word-break: break-word;
}

.bonus-item[data-bonus-type="shockwave"] .bonus-name {
  font-size: 1.0029em;
  line-height: 1.2;
  max-width: 100%;
  word-break: break-word;
}

.bonus-item .bonus-cost {
  font-size: 0.98em;
  color: #4a90e2;
  font-weight: bold;
  line-height: 1;
  text-align: center;
  margin-top: 0;
  -webkit-text-stroke: 2px black;
  text-stroke: 2px black;
  paint-order: stroke fill;
  transform: translateY(-15%);
}

@media (max-width: 768px) {
  .menu-subtitle {
    -webkit-text-stroke: 2px black !important;
    text-stroke: 2px black !important;
  }

  .menu-other-games-button {
    top: calc(1.5rem + 6.5rem + 20px) !important;
  }
}
