:root {
  --bg: #090909;
  --panel: #151515;
  --panel-2: #1f1f1f;
  --red: #d71920;
  --red-dark: #880d12;
  --text: #f7f2f2;
  --muted: #b8adad;
  --line: #333;
  --success: #fff;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(215, 25, 32, 0.16), transparent 34%),
    radial-gradient(circle at 85% 15%, rgba(215, 25, 32, 0.2), transparent 28%),
    var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

.game {
  width: min(940px, calc(100vw - 32px));
  padding: 28px;
}

.intro {
  margin-bottom: 20px;
}

.kicker {
  margin: 0 0 8px;
  color: var(--red);
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2.4rem, 8vw, 5.4rem);
  line-height: 0.95;
}

.subtitle {
  max-width: 620px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.5;
}

.status-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 74px;
  margin: 24px 0;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-left: 6px solid var(--red);
  background: rgba(21, 21, 21, 0.9);
}

.label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.mistakes {
  font-size: 1.35rem;
  font-weight: 900;
}

.level {
  font-size: 1.35rem;
  font-weight: 900;
}

.message {
  margin: 0;
  color: var(--text);
  text-align: right;
}

.answer-panel {
  min-height: 54px;
  margin: 0 0 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: #0f0f0f;
  color: var(--muted);
  font-weight: 800;
}

.answer-panel strong {
  color: var(--red);
}

.solved-groups {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.solved-card {
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: linear-gradient(90deg, var(--red), var(--red-dark));
  color: var(--success);
}

.solved-card h2 {
  margin: 0 0 6px;
  font-size: 1rem;
  text-transform: uppercase;
}

.solved-card p {
  margin: 0;
  font-weight: 700;
}

.board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.tile {
  min-height: 92px;
  border: 2px solid transparent;
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
  font-size: clamp(0.85rem, 2.2vw, 1.05rem);
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

.tile:hover {
  transform: translateY(-2px);
  border-color: rgba(215, 25, 32, 0.55);
}

.tile.selected {
  border-color: var(--red);
  background: var(--red);
  color: white;
}

.tile:disabled {
  cursor: default;
}

.controls {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-top: 18px;
}

button {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111;
  color: var(--text);
  cursor: pointer;
  font-weight: 900;
  text-transform: uppercase;
}

button:hover {
  border-color: var(--red);
}

button.primary {
  border-color: var(--red);
  background: var(--red);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

@media (max-width: 640px) {
  .game {
    width: min(100%, calc(100vw - 20px));
    padding: 18px 0;
  }

  .status-panel {
    align-items: flex-start;
    flex-direction: column;
  }

  .message {
    text-align: left;
  }

  .board {
    gap: 8px;
  }

  .tile {
    min-height: 70px;
  }

  .controls {
    grid-template-columns: repeat(2, 1fr);
  }
}
