* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: system-ui, sans-serif;
  background: linear-gradient(135deg, #1e3c72, #2a5298);
  color: #fff;
  padding: 16px;
  display: flex;
  justify-content: center;
  min-height: 100vh;
}

.game-wrapper {
  width: 100%;
  max-width: 1400px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

header { flex-shrink: 0; }

h1 {
  text-align: center;
  margin-bottom: 8px;
  font-size: 28px;
}

.hud {
  display: flex;
  justify-content: space-around;
  background: rgba(255,255,255,0.1);
  padding: 10px 20px;
  border-radius: 10px;
  font-weight: bold;
  font-size: 18px;
  flex-wrap: wrap;
  gap: 12px;
}

/* ===== Игровое поле ===== */
.game-area {
  position: relative;
  width: 100%;
  height: 85vh;
  min-height: 500px;
  background: rgba(0,0,0,0.35);
  border: 2px solid #fff3;
  border-radius: 12px;
  overflow: hidden;
  flex-shrink: 0;
}

.game-area::after {
  content: '';
  position: absolute;
  bottom: 40px;
  left: 0;
  right: 0;
  height: 2px;
  background: rgba(255, 215, 0, 0.4);
  box-shadow: 0 0 12px #ffd700;
  pointer-events: none;
}

/* ===== Падающая буква ===== */
.letter {
  position: absolute;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  font-weight: bold;
  color: #ffd700;
  background: rgba(255, 215, 0, 0.12);
  border: 2px solid #ffd700;
  border-radius: 12px;
  text-shadow: 0 0 8px #ff0;
  user-select: none;
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.15);
}

.letter.danger {
  border-color: #ff5252;
  color: #ff5252;
  background: rgba(255, 82, 82, 0.15);
  text-shadow: 0 0 8px #f00;
  box-shadow: 0 0 20px rgba(255, 82, 82, 0.3);
}

.letter.hit {
  animation: pop 0.25s forwards;
  pointer-events: none;
}

@keyframes pop {
  0%   { transform: scale(1);   background: #ffd700; color: #1e3c72; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* ===== Оверлей ===== */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 10;
  text-align: center;
  padding: 20px;
}

.overlay.hidden { display: none; }
.overlay h2 { font-size: 32px; }
.overlay p  { font-size: 16px; opacity: 0.8; }

/* ===== Кнопки ===== */
button {
  padding: 12px 24px;
  border: none;
  border-radius: 10px;
  background: #ffd700;
  color: #1e3c72;
  font-weight: bold;
  font-size: 16px;
  cursor: pointer;
  transition: 0.2s;
}

button:hover { transform: scale(1.05); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

button.danger {
  background: #ff5252;
  color: #fff;
  width: 100%;
  margin-top: 14px;
}

/* ===== Настройки ===== */
.settings, .stats {
  background: rgba(255,255,255,0.08);
  padding: 18px 22px;
  border-radius: 12px;
  flex-shrink: 0;
}

.settings h2, .stats h2 {
  font-size: 20px;
  margin-bottom: 14px;
}

.setting-row {
  display: grid;
  grid-template-columns: 280px 1fr;
  align-items: center;
  gap: 14px;
  padding: 8px 0;
}

.setting-row label { font-size: 15px; }

.setting-row input[type="range"] {
  width: 100%;
  accent-color: #ffd700;
  cursor: pointer;
}

.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.radio-group label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 15px;
}

.radio-group input[type="radio"] {
  accent-color: #ffd700;
  cursor: pointer;
}

/* ===== Статистика ===== */
table { width: 100%; border-collapse: collapse; }

td {
  padding: 8px 0;
  border-bottom: 1px solid #fff2;
  font-size: 15px;
}

td:last-child {
  text-align: right;
  font-weight: bold;
  color: #ffd700;
}

.letters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.letters span {
  background: #ffd700;
  color: #1e3c72;
  padding: 4px 10px;
  border-radius: 6px;
  font-weight: bold;
  font-size: 14px;
}

/* ===== Вспышки ===== */
.game-area.wrong-flash { animation: wrongFlash 0.2s; }
@keyframes wrongFlash {
  0%, 100% { background: rgba(0,0,0,0.35); }
  50%      { background: rgba(255, 0, 0, 0.35); }
}

.game-area.correct-flash { animation: correctFlash 0.15s; }
@keyframes correctFlash {
  0%, 100% { background: rgba(0,0,0,0.35); }
  50%      { background: rgba(0, 255, 100, 0.15); }
}

/* ===== Мобильная адаптация ===== */
@media (max-width: 700px) {
  .setting-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .game-area { height: 60vh; min-height: 400px; }
  .letter { width: 44px; height: 44px; font-size: 24px; }
}