.cell { position: relative; }
.cell img.cat { width: var(--cat-size); height: var(--cat-size); pointer-events: none; filter: drop-shadow(2px 6px 7px rgba(0, 0, 0, 0.5)); position: relative; z-index: 3; }
.cell .label { margin-top: 2px; font-weight: bold; position: relative; z-index: 3; }
.cell[data-mood="-6"] .label,
.cell[data-mood="-5"] .label,
.cell[data-mood="-4"] .label,
.cell[data-mood="-3"] .label,
.cell[data-mood="-2"] .label,
.cell[data-mood="-1"] .label { color: #a00; }
.cell[data-mood="0"] .label { color: #666; }
.cell[data-mood="1"] .label,
.cell[data-mood="2"] .label,
.cell[data-mood="3"] .label,
.cell[data-mood="4"] .label,
.cell[data-mood="5"] .label,
.cell[data-mood="6"] .label { color: #070; }

/* Jumping animation for non-green cats */
@keyframes jump {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.cell[data-mood="-6"] img.cat,
.cell[data-mood="-5"] img.cat,
.cell[data-mood="-4"] img.cat,
.cell[data-mood="-3"] img.cat,
.cell[data-mood="-2"] img.cat,
.cell[data-mood="-1"] img.cat,
.cell[data-mood="0"] img.cat {
  will-change: transform;
  animation: jump 1s ease-in-out infinite;
}

/* Progressive golden glow for happy cats */
.cell[data-mood="2"] img.cat {
  filter: drop-shadow(2px 6px 7px rgba(0, 0, 0, 0.5)) drop-shadow(0 0 3px rgba(255, 215, 0, 0.35));
}
.cell[data-mood="3"] img.cat {
  filter: drop-shadow(2px 6px 7px rgba(0, 0, 0, 0.5)) drop-shadow(0 0 5px rgba(255, 215, 0, 0.5));
}
.cell[data-mood="4"] img.cat {
  filter: drop-shadow(2px 6px 7px rgba(0, 0, 0, 0.5)) drop-shadow(0 0 7px rgba(255, 215, 0, 0.65));
}
.cell[data-mood="5"] img.cat {
  filter: drop-shadow(2px 6px 7px rgba(0, 0, 0, 0.5)) drop-shadow(0 0 10px rgba(255, 215, 0, 0.8));
}
.cell[data-mood="6"] img.cat {
  filter: drop-shadow(2px 6px 7px rgba(0, 0, 0, 0.5)) drop-shadow(0 0 10px #ffd700) drop-shadow(0 0 20px rgba(255, 215, 0, 0.6));
}

/* Golden flash for new kings */
.cell .golden-flash {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(255, 215, 0, 0.9) 0%, rgba(255, 215, 0, 0) 70%);
  z-index: 5;
  pointer-events: none;
  animation: flash 0.4s ease-out forwards;
}
@keyframes flash {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

/* Экран победы */
#win-screen {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: #fff;
  z-index: 100;
}
#win-screen img { width: 240px; max-width: 70vw; }
#win-screen .win-title { font-size: 26px; font-weight: bold; }
#win-screen .win-stats {
  margin: 0 16px;
  color: #fff;
}
#win-screen .win-stat-value {
  color: #fff;
}
#win-screen .win-stat-label,
#win-screen .win-stat-detail {
  color: rgba(255, 255, 255, 0.85);
}

/* Экран импичмента */
#impeachment-screen {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  color: #fff;
  z-index: 200;
  padding: 20px;
}

#impeachment-screen .win-stats {
  margin: 0 16px;
  color: #fff;
  max-width: min(640px, 90vw);
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  box-sizing: border-box;
}

.impeachment-title {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 28px;
  font-weight: bold;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #ff6b6b;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  max-width: 90vw;
}

.impeachment-video-wrap {
  width: fit-content;
  max-width: min(640px, 90vw);
  background: transparent;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-radius: 12px;
  overflow: hidden;
  line-height: 0;
}

.impeachment-video {
  display: block;
  width: auto;
  height: auto;
  max-width: min(640px, 90vw);
  max-height: min(70vh, 480px);
  background: transparent;
  opacity: 0.7;
}

.impeachment-btns {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

/* Сворачивание/разворачивание окна победы и импичмента */
.result-collapse-btn {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 8px 16px;
  font-size: 14px;
  border-radius: 8px;
  background: var(--button-bg);
  color: var(--button-text);
  border: 2px solid var(--primary-color);
  width: auto;
  transition: transform 0.2s;
}

.result-collapse-btn:hover {
  background: var(--button-hover);
  transform: scale(1.05);
}

.result-reopen-btn {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  left: max(12px, env(safe-area-inset-left));
  z-index: 500;
  padding: 8px 16px;
  font-size: 14px;
  border-radius: 999px;
  background: var(--primary-color);
  border: none;
  color: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  cursor: pointer;
}
.result-reopen-btn:hover {
  opacity: 0.9;
}

/* Rocket button styles - physical button design */
.rocket-btn {
  width: 100%;
  min-height: 36px;
  padding: 8px 12px;
  border: 3px solid #000000;
  border-radius: 12px;
  background: linear-gradient(180deg, #ff8c00 0%, #ff6b00 45%, #e55a00 100%);
  color: #000000 !important;
  font-weight: bold;
  font-size: 14px;
  line-height: 1.3;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 6px 0 #000000, inset 0 2px 0 rgba(255, 255, 255, 0.3), 0 8px 10px rgba(0, 0, 0, 0.35);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.rocket-btn-disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Rocket launch animation */
.rocket-launch {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  font-size: 24px;
  animation: rocketFly 0.8s ease-out forwards;
  z-index: 10;
}

@keyframes rocketFly {
  0% {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(-60px);
  }
}

/* Floating text animations */
.floating-text {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  color: #00ff00;
  font-weight: bold;
  font-size: 18px;
  animation: floatUp 1s ease-out forwards;
  z-index: 10;
}

@keyframes floatUp {
  0% {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(-40px);
  }
}

/* Screen shake animation */
.screen-shake {
  animation: shake 0.3s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

@media (min-width: 769px) {
  .cell img.cat {
    filter: drop-shadow(5px 14px 20px rgba(0, 0, 0, 0.55));
  }
  .cell[data-mood="2"] img.cat {
    filter: drop-shadow(5px 14px 20px rgba(0, 0, 0, 0.55)) drop-shadow(0 0 3px rgba(255, 215, 0, 0.35));
  }
  .cell[data-mood="3"] img.cat {
    filter: drop-shadow(5px 14px 20px rgba(0, 0, 0, 0.55)) drop-shadow(0 0 5px rgba(255, 215, 0, 0.5));
  }
  .cell[data-mood="4"] img.cat {
    filter: drop-shadow(5px 14px 20px rgba(0, 0, 0, 0.55)) drop-shadow(0 0 7px rgba(255, 215, 0, 0.65));
  }
  .cell[data-mood="5"] img.cat {
    filter: drop-shadow(5px 14px 20px rgba(0, 0, 0, 0.55)) drop-shadow(0 0 10px rgba(255, 215, 0, 0.8));
  }
  .cell[data-mood="6"] img.cat {
    filter: drop-shadow(5px 14px 20px rgba(0, 0, 0, 0.55)) drop-shadow(0 0 10px #ffd700) drop-shadow(0 0 20px rgba(255, 215, 0, 0.6));
  }
}

/* ===== Супер-анимации котов ===== */

/* Пульсация выбранной клетки */
@keyframes cellSelectPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 215, 0, 0.6); }
  50%      { box-shadow: 0 0 12px 4px rgba(255, 215, 0, 0.9); }
}
#board .cell.selected {
  animation: cellSelectPulse 1s ease-in-out infinite;
}

/* Подсветка клетки-цели */
@keyframes cellTargetGlow {
  0%, 100% { box-shadow: inset 0 0 0 2px rgba(80, 200, 255, 0.5); }
  50%      { box-shadow: inset 0 0 10px 2px rgba(80, 200, 255, 0.9); }
}
#board .cell.target {
  animation: cellTargetGlow 1.2s ease-in-out infinite;
}

/* ===== Ракета: показываем куда прибавилось + полёт (вау) ===== */
.boost-float {
  position: fixed;
  transform: translateX(-50%);
  color: #ffcc00;
  font-weight: bold;
  font-size: 20px;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  z-index: 3000;
  animation: boostFloatUp 1.1s ease-out forwards;
}
@keyframes boostFloatUp {
  0%   { opacity: 0; transform: translateX(-50%) translateY(6px) scale(0.8); }
  20%  { opacity: 1; transform: translateX(-50%) translateY(-4px) scale(1.15); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-46px) scale(1); }
}
.boost-glow {
  position: fixed;
  border-radius: 8px;
  box-sizing: border-box;
  pointer-events: none;
  z-index: 2999;
  animation: boostGlow 0.9s ease-out forwards;
}
@keyframes boostGlow {
  0%   { box-shadow: 0 0 0 0 rgba(255, 204, 0, 0); background: rgba(255, 204, 0, 0); }
  30%  { box-shadow: 0 0 16px 5px rgba(255, 204, 0, 0.9); background: rgba(255, 204, 0, 0.28); }
  100% { box-shadow: 0 0 0 0 rgba(255, 204, 0, 0); background: rgba(255, 204, 0, 0); }
}
.board-area { position: relative; }
.rocket-fly-big {
  position: absolute;
  left: 12%;
  bottom: 8%;
  font-size: 44px;
  pointer-events: none;
  z-index: 20;
  animation: rocketFlyBig 1s ease-in forwards;
}
@keyframes rocketFlyBig {
  0%   { opacity: 0; transform: translate(0, 0) rotate(0deg) scale(0.6); }
  15%  { opacity: 1; }
  100% { opacity: 0; transform: translate(220px, -260px) rotate(35deg) scale(1.2); }
}

/* ===== Коты: приземление после хода и превращение при смене настроения ===== */
@keyframes catLand {
  0%   { transform: translateY(-30%) scale(0.8); }
  60%  { transform: translateY(6%) scale(1.08); }
  100% { transform: translateY(0) scale(1); }
}
#board .cell .cat.cat-land {
  animation: catLand 0.3s ease-out !important;
  z-index: 6;
}
@keyframes moodChange {
  0%   { transform: scale(1) rotateY(0deg); filter: brightness(1); }
  40%  { transform: scale(1.35) rotateY(180deg); filter: brightness(1.6); }
  60%  { transform: scale(1.35) rotateY(180deg); }
  100% { transform: scale(1) rotateY(360deg); filter: brightness(1); }
}
#board .cell .cat.mood-change {
  animation: moodChange 0.8s ease-out !important;
  z-index: 6;
}

/* Мобильная версия: кнопка "Ракеты" — размером с окошки-счётчики рядом */
@media (max-width: 768px) {
  .rocket-btn {
    min-height: 32px;
    padding: 6px 8px;
    font-size: 11px;
    line-height: 1.3;
    border-width: 2px;
    border-radius: 8px;
    box-sizing: border-box;
    box-shadow: 0 3px 0 #000000, inset 0 2px 0 rgba(255,255,255,0.3), 0 4px 6px rgba(0,0,0,0.3);
  }
}
@media (max-width: 575.98px) {
  .rocket-btn {
    min-height: 28px;
    padding: 4px 6px;
    font-size: 10px;
  }
}
