body {
  background: #0f1720;
  color: white;
  font-family: Arial, sans-serif;
  text-align: center;
}

.table-wrapper {
  width: fit-content;
  margin: 20px auto;
  margin-top: 10px;
}

.controls-row + .table-wrapper {
  margin-top: 6px;
}

/* заголовки всегда видимы */
.header .cell {
  opacity: 1 !important;
  transform: none !important;
  animation: none !important;
  height: 48px;
  font-size: 14px;
  font-weight: 600;
  background: rgba(255,255,255,0.05);
  position: relative;
}

.green { background: #2ecc71; }
.yellow { background: #f1c40f; color: black; }
.red { background: #e74c3c; }

.hero-cell {
  padding: 0;
  border: none;
  background: transparent;
}

.hero-cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-cell span {
  display: none; /* имя больше не занимает место */
}

.hero-cell::after {
  content: attr(data-hero-name);
  position: absolute;
  inset: 0;                    /* 🔥 занимает всю ячейку */

  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);

  background: rgba(0, 0, 0, 0.65); /* полупрозрачный слой */
  color: #fff;
  font-size: 14px;
  font-weight: bold;
  text-align: center;
  padding: 6px;

  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 5;
}

.hero-cell:hover::after {
  opacity: 1;
}


.hero-cell:hover::after {
  opacity: 1;
}

.suggestions {
  width: 300px;
  margin: 0 auto;
  background: #111;
  border: 1px solid #333;
  max-height: 200px;
  overflow-y: auto;
  display: none;
  position: relative;
  z-index: 3000;
}

.suggestion {
  padding: 6px;
  cursor: pointer;
  border-bottom: 1px solid #222;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
}

.move-speed-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;              /* расстояние между текстом и стрелкой */
}

.ms-value {
  font-weight: 500;
}

.ms-arrow-inline {
  transform: translateY(-1px);
  font-size: 16px;
  font-weight: bold;
  line-height: 1;
}

.ms-arrow-inline.up {
  color: rgba(255, 255, 255, 0.9);
}

.ms-arrow-inline.down {
  color: rgba(0, 0, 0, 0.8);
}

.suggestion:hover {
  background: #333;
}

.input-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 4px;
}

.input-row input {
  width: 300px;
}

.input-wrapper {
  position: relative;
  width: 360px;      /* 🔥 фиксированная ширина */
  margin: 0 auto;    /* центр */
  z-index: 10;
}

.input-row {
  display: flex;
  gap: 8px;
}

.suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: auto;

  background: #111;
  border: 1px solid #333;
  max-height: 200px;
  overflow-y: auto;

  display: none;
  z-index: 1000;
}

.header-cell {
  font-weight: bold;
  background: #222;
}

.game-message {
  margin-top: 20px;
  font-size: 20px;
  font-weight: bold;
  animation: popIn 0.3s ease-out;
}

.game-message.win {
  color: #2ecc71;
}

.game-message.lose {
  color: #e74c3c;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-5px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes rowAppear {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#newRoundBtn {
  border-color: rgba(52, 152, 219, 0.6);
  padding: 8px 14px;
  font-size: 16px;
  transform: translateY(4px);
  cursor: pointer;
}

.stats-box {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;          /* расстояние между пунктами */
  flex-wrap: wrap;   /* чтобы на маленьких экранах переносилось */
  font-size: 14px;
}

#stats {
  margin-top: 2px;   /* попробуй 8–12px */
}

@keyframes flipIn {
  0% {
    transform: rotateY(90deg);
    opacity: 0;
  }
  100% {
    transform: rotateY(0deg);
    opacity: 1;
  }
}

.cell.flip {
  opacity: 0;
  transform: rotateY(90deg);
  animation: flipIn 0.6s ease-out forwards;
}

.row {
  display: grid;
  grid-template-columns: repeat(8, 96px);
  gap: 8px;
  margin-bottom: 10px;
}


.cell {
  position: relative;

  opacity: 1;
  transform: none;

  width: 96px;
  height: 96px;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.08);
  text-align: center;
  word-break: break-word;
}

.table-wrapper {
  width: fit-content;
  margin: 4px auto 0;
}

.header {
  width: 100%;
}

.header {
  animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.suggestion img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.ms-arrow {
  position: absolute;
  bottom: 6px;
  right: 8px;
  font-size: 18px;
  font-weight: bold;
  opacity: 0.9;
}

.ms-arrow.up::after {
  content: "▲"; 
}

.ms-arrow.down::after {
  content: "▼";
}

#openHeroGallery {
  border-color: rgba(52, 152, 219, 0.6);
  margin-top: 8px; /* подбери 6–12px по вкусу */
}

.ms-arrow.up {
  color: #ffffff;
}

.ms-arrow.down {
  color: #000000;
}

#heroInput {
  animation: pulse 1.6s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.5); }
  70% { box-shadow: 0 0 0 8px rgba(46, 204, 113, 0); }
  100% { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0); }
}

.start-hint {
  margin-top: 6px;
  font-size: 14px;
  opacity: 0.75;
  transition: opacity 0.3s ease;
}

.start-hint.hidden {
  opacity: 0;
  pointer-events: none;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: #0f1720;
  width: min(900px, 95%);
  max-height: 80vh;
  border-radius: 10px;
  padding: 16px;
  overflow: hidden;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.hero-tabs {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 12px 0;
}

.hero-tabs button {
  padding: 6px 12px;
  background: #1e2933;
  border: none;
  color: white;
  cursor: pointer;
  border-radius: 6px;
}

.hero-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 72px);
  gap: 10px;
  justify-content: center;
  overflow-y: auto;
  padding: 10px;
}

.hero-smile {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 8px;
  padding: 6px;
  transition: background 0.15s, transform 0.15s;
}

.hero-smile:hover {
  background: rgba(255,255,255,0.08);
  transform: scale(1.05);
}

#gameMessage {
  margin: 2px 0;
  min-height: 0;
  display: none;
  font-size: 20px;
  font-weight: 600;
}

.hero-smile img {
  width: 75%;           /* ⬅️ −25% */
  height: auto;
  object-fit: contain;

  image-rendering: crisp-edges;
}

.hero-section {
  margin-bottom: 18px;
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.hero-section h3 {
  margin: 10px 0 6px;
  font-size: 16px;
  font-weight: bold;
  opacity: 0.9;
  text-align: left;
}

.hero-section .hero-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 72px);
  gap: 10px;
  justify-content: flex-start;
}

h1 {
  margin-bottom: 10px; /* вместо дефолтных ~20px */
}

.controls-row {
  display: flex;
  justify-content: center;
  align-items: center; /* 🔥 ВАЖНО */
  gap: 12px;
  margin-top: 2px;
  margin-bottom: 4px;
}

.controls-row button {
  height: 40px;
  min-width: 120px;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 0;
  line-height: 1;

  background: #1e2933;
  color: white;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;

  font-size: 15px;
  font-weight: 500;
}




.controls-row button:hover {
  background: #263241;
}

.controls-row button:active {
  transform: scale(0.97);
}

.modal-content.small {
  max-width: 420px;
}

.modal-text {
  margin: 16px 0 20px;
  font-size: 15px;
  opacity: 0.85;
  text-align: center;
}

.modal-actions {
  display: flex;
  justify-content: center;
  gap: 14px;
}

.top-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}


/* кнопки */
.btn-secondary {
  background: #1e2933;
  color: white;
  border: 1px solid rgba(255,255,255,0.15);
  padding: 8px 18px;
  border-radius: 6px;
  cursor: pointer;
}

.btn-danger {
  background: #e74c3c;
  color: white;
  border: none;
  padding: 8px 18px;
  border-radius: 6px;
  cursor: pointer;
}

.btn-secondary:hover {
  background: #263241;
}

.btn-danger:hover {
  background: #ff5c4d;
}

.modal-content.center {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.restart-title {
  margin: 10px 0 18px;
  font-size: 22px;
  font-weight: 600;
}

.back-home {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 3000;

  display: flex;
  align-items: center;
  gap: 6px;

  padding: 8px 14px;
  background: rgba(30, 41, 51, 0.9);
  color: white;
  text-decoration: none;

  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;

  font-size: 14px;
  font-weight: 500;

  transition: background 0.2s ease, transform 0.15s ease;
}

.back-home:hover {
  background: rgba(38, 50, 65, 1);
  transform: translateX(-2px);
}

.back-home:active {
  transform: scale(0.96);
}

/* затемнённый фон */
.win-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 5000;

  display: flex;
  align-items: center;
  justify-content: center;

  animation: fadeIn 0.3s ease;
}

/* победная карточка */
.win-box {
  background: linear-gradient(145deg, #1e2933, #0f1720);
  border-radius: 16px;
  padding: 36px 48px;

  text-align: center;
  box-shadow: 0 0 40px rgba(46, 204, 113, 0.4);

  animation: winPop 0.45s ease-out;
}

/* YOU WIN */
.win-title {
  font-size: 42px;
  font-weight: 800;
  letter-spacing: 2px;
  color: #2ecc71;

  text-shadow:
    0 0 12px rgba(46,204,113,0.8),
    0 0 24px rgba(46,204,113,0.4);

  margin-bottom: 12px;
}

/* имя героя */
.win-hero {
  font-size: 26px;
  font-weight: 600;
  color: white;
  margin-bottom: 6px;
}

/* подзаголовок */
.win-sub {
  font-size: 14px;
  opacity: 0.8;
}

/* анимации */
@keyframes winPop {
  0% {
    transform: scale(0.85);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.win-close {
  position: absolute;
  top: 14px;
  right: 16px;

  background: none;
  border: none;
  color: rgba(255,255,255,0.7);

  font-size: 20px;
  cursor: pointer;

  transition: color 0.15s ease, transform 0.15s ease;
}

.win-close:hover {
  color: white;
  transform: scale(1.1);
}

.win-close:active {
  transform: scale(0.95);
}