:root {
  --bg-color: #1a0b2e;
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.1);
  --text-color: #f0e6ff;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Nunito', 'Segoe UI', system-ui, sans-serif;
}

body {
  background-color: var(--bg-color);
  background-image: radial-gradient(circle at 50% 50%, #2a114d 0%, #11051f 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  overflow: hidden;
  color: var(--text-color);
  touch-action: none; /* свайпы управляют змейкой, а не прокручивают страницу */
}

.game-wrapper {
  position: relative;
  /* поле квадратное и влезает в окно любой формы (оставляем место под табло) */
  width: min(92vw, 92vh - 30px, 600px);
  height: min(92vw, 92vh - 30px, 600px);
  margin-top: 30px;
  border-radius: 15px;
  box-shadow: 0 0 40px rgba(138, 43, 226, 0.4);
}

/* Табло над полем во время игры (тап — пауза) */
#hud {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  padding-bottom: 6px;
  text-align: center;
  font-weight: 900;
  font-size: 15px;
  cursor: pointer;
  user-select: none;
}

canvas {
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 15px;
  display: block;
}

/* Эффект матового стекла (Glassmorphism) */
.glass-panel {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  border-radius: 15px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  transition: opacity 0.3s ease;
  z-index: 10;
}

.glass-panel.hidden {
  opacity: 0;
  pointer-events: none;
}

.magic-text {
  font-size: 28px;
  font-weight: 900;
  margin-bottom: 10px;
  text-align: center;
  background: linear-gradient(90deg, #ff007f, #7928ca, #00d4ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0px 4px 15px rgba(255, 255, 255, 0.1);
}

#score-display {
  font-size: 18px;
  margin-bottom: 15px;
  font-weight: 700;
}

#target-color-ui {
  margin-bottom: 25px;
  font-size: 16px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 8px 20px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

#color-name {
  transition: color 0.3s ease, text-shadow 0.3s ease;
}

.hint {
  font-size: 12px;
  opacity: 0.8;
  text-align: center;
  margin-top: 20px;
  line-height: 1.5;
  color: #ffeb3b;
}

/* Кнопка с неоновым переливом */
.glow-on-hover {
  width: 220px;
  height: 50px;
  border: none;
  outline: none;
  color: #fff;
  background: #111;
  cursor: pointer;
  position: relative;
  z-index: 0;
  border-radius: 25px;
  font-size: 16px;
  font-weight: bold;
  text-transform: uppercase;
  transition: transform 0.1s ease;
}

.glow-on-hover:active {
  transform: scale(0.95);
}

.glow-on-hover:before {
  content: '';
  background: linear-gradient(45deg, #ff0000, #ff7300, #fffb00, #48ff00, #00ffd5, #002bff, #7a00ff, #ff00c8, #ff0000);
  position: absolute;
  top: -2px;
  left: -2px;
  background-size: 400%;
  z-index: -1;
  filter: blur(5px);
  width: calc(100% + 4px);
  height: calc(100% + 4px);
  animation: glowing 20s linear infinite;
  border-radius: 25px;
}

.glow-on-hover:after {
  z-index: -1;
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  background: #2a114d;
  left: 0;
  top: 0;
  border-radius: 25px;
}

@keyframes glowing {
  0% { background-position: 0 0; }
  50% { background-position: 400% 0; }
  100% { background-position: 0 0; }
}