/* ===== Cell Evolution — стили ===== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-dark: #0b1f1a;
  --bg-mid: #10312a;
  --green: #2ecc71;
  --green-dark: #27ae60;
  --green-light: #7bed9f;
  --teal: #1abc9c;
  --text: #eafaf1;
  --text-dim: #a8d5ba;
  --accent: #f1c40f;
  --danger: #e74c3c;
}

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: radial-gradient(ellipse at top, var(--bg-mid), var(--bg-dark));
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

.game {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

/* ===== Верхняя панель ===== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--green-light);
  letter-spacing: 0.5px;
}

.energy-box {
  background: rgba(46, 204, 113, 0.12);
  border: 1px solid rgba(46, 204, 113, 0.35);
  border-radius: 12px;
  padding: 8px 18px;
  text-align: center;
  min-width: 140px;
}

.energy-label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
}

.energy-value {
  display: block;
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--green-light);
  line-height: 1.1;
}

/* ===== Прогресс ===== */
.progress-wrap {
  margin-bottom: 24px;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.progress-bar {
  height: 10px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--teal), var(--green-light));
  border-radius: 6px;
  transition: width 0.3s ease;
}

/* ===== Игровая зона ===== */
.play-area {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 0 32px;
}

.combo-box {
  margin-bottom: 18px;
  background: rgba(241, 196, 15, 0.1);
  border: 1px solid rgba(241, 196, 15, 0.3);
  border-radius: 30px;
  padding: 6px 20px;
  transition: all 0.2s ease;
}

.combo-box.combo-active {
  background: rgba(241, 196, 15, 0.22);
  border-color: var(--accent);
  box-shadow: 0 0 18px rgba(241, 196, 15, 0.35);
}

.combo-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  margin-right: 8px;
}

.combo-value {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--accent);
}

/* ===== Клетка ===== */
.cell {
  position: relative;
  width: 220px;
  height: 220px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  background: radial-gradient(circle at 35% 30%,
    rgba(123, 237, 159, 0.9),
    rgba(46, 204, 113, 0.7) 45%,
    rgba(39, 174, 96, 0.9));
  box-shadow:
    0 0 40px rgba(46, 204, 113, 0.45),
    inset 0 0 40px rgba(255, 255, 255, 0.15);
  transition: transform 0.1s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.cell:active {
  transform: scale(0.94);
}

.cell-membrane {
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  border: 2px dashed rgba(255, 255, 255, 0.35);
  animation: spin 18s linear infinite;
}

.cell-nucleus {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle at 35% 30%, #a8e6cf, #58b19f);
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.cell-core {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.7);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.35); }
}

/* Всплывающий +N */
.float-text {
  position: fixed;
  pointer-events: none;
  font-weight: 800;
  font-size: 1.3rem;
  color: var(--green-light);
  text-shadow: 0 0 8px rgba(46, 204, 113, 0.8);
  animation: floatUp 0.9s ease-out forwards;
  z-index: 50;
}

.float-text.combo {
  color: var(--accent);
  text-shadow: 0 0 10px rgba(241, 196, 15, 0.9);
  font-size: 1.5rem;
}

@keyframes floatUp {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-70px) scale(1.3); }
}

.hint {
  margin-top: 20px;
  font-size: 0.85rem;
  color: var(--text-dim);
  text-align: center;
  max-width: 380px;
}

/* ===== Улучшения ===== */
.upgrades-title {
  font-size: 1.1rem;
  color: var(--green-light);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.upgrade-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.upgrade-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(46, 204, 113, 0.2);
  border-radius: 14px;
  padding: 16px 14px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.upgrade-card.owned {
  border-color: var(--green);
  background: rgba(46, 204, 113, 0.1);
}

.upgrade-icon {
  font-size: 1.8rem;
}

.upgrade-name {
  font-weight: 700;
  font-size: 0.95rem;
}

.upgrade-desc {
  font-size: 0.78rem;
  color: var(--text-dim);
  line-height: 1.3;
}

.upgrade-level {
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 600;
  min-height: 1em;
}

.buy-btn {
  width: 100%;
  padding: 9px 10px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--green), var(--green-dark));
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.buy-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(46, 204, 113, 0.4);
}

.buy-btn:disabled {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-dim);
  cursor: not-allowed;
}

/* ===== Модальное окно победы ===== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: linear-gradient(160deg, var(--bg-mid), var(--bg-dark));
  border: 1px solid var(--green);
  border-radius: 20px;
  padding: 36px 40px;
  text-align: center;
  max-width: 400px;
  box-shadow: 0 0 60px rgba(46, 204, 113, 0.35);
}

.modal-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.modal-title {
  color: var(--green-light);
  margin-bottom: 12px;
  font-size: 1.6rem;
}

.modal-text {
  color: var(--text-dim);
  line-height: 1.5;
  margin-bottom: 24px;
}

.modal-text strong {
  color: var(--accent);
}

.restart-btn {
  padding: 12px 28px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--green), var(--green-dark));
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
}

.restart-btn:hover {
  transform: translateY(-2px);
}

/* ===== Адаптивность ===== */
@media (max-width: 480px) {
  .cell {
    width: 180px;
    height: 180px;
  }
  .title {
    font-size: 1.2rem;
  }
}