.screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: opacity 0.5s, transform 0.5s;
}

.screen.hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.95);
}

#screen-name {
  background: radial-gradient(ellipse at center, #0d1117 0%, #000 100%);
  flex-direction: column;
  gap: 2rem;
}

.name-container {
  text-align: center;
  padding: 3rem;
  border: 1px solid var(--border);
  background: var(--panel-bg);
  backdrop-filter: blur(20px);
  position: relative;
  clip-path: polygon(0 0,
      calc(100% - 20px) 0,
      100% 20px,
      100% 100%,
      20px 100%,
      0 calc(100% - 20px));
  min-width: 480px;
}

.name-container::before {
  content: "";
  position: absolute;
  inset: -1px;
  background: linear-gradient(135deg, var(--accent), transparent, var(--accent2));
  clip-path: polygon(0 0,
      calc(100% - 20px) 0,
      100% 20px,
      100% 100%,
      20px 100%,
      0 calc(100% - 20px));
  z-index: -1;
  opacity: 0.4;
}

.game-logo {
  font-family: var(--font-pixel);
  font-size: 2.5rem;
  color: var(--accent);
  text-shadow: 0 0 20px var(--accent), 0 0 40px var(--accent), 0 0 80px rgba(0, 255, 136, 0.3);
  margin-bottom: 0.5rem;
  animation: glitch 4s infinite;
  letter-spacing: 4px;
}

.game-logo span {
  color: var(--accent2);
}

@keyframes glitch {

  0%,
  90%,
  100% {
    text-shadow: 0 0 20px var(--accent), 0 0 40px var(--accent);
    transform: none;
  }

  92% {
    transform: translate(-2px, 0);
    text-shadow: 2px 0 var(--accent2), 0 0 20px var(--accent);
  }

  94% {
    transform: translate(2px, 0);
    text-shadow: -2px 0 #00ffff, 0 0 20px var(--accent);
  }

  96% {
    transform: none;
  }
}

.game-subtitle {
  font-family: var(--font-retro);
  font-size: 1.4rem;
  color: rgba(255, 255, 255, 0.4);
  margin-bottom: 2rem;
  letter-spacing: 6px;
}

.name-label {
  font-family: var(--font-pixel);
  font-size: 0.6rem;
  color: var(--accent);
  letter-spacing: 3px;
  margin-bottom: 1rem;
  display: block;
}

.name-input-wrapper {
  position: relative;
  margin-bottom: 1.5rem;
}

.name-input-wrapper::before {
  content: ">";
  font-family: var(--font-pixel);
  font-size: 0.8rem;
  color: var(--accent);
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  animation: blink 1s infinite;
}

@keyframes blink {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0;
  }
}

#player-name-input {
  width: 100%;
  background: rgba(0, 255, 136, 0.05);
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 0.9rem 1rem 0.9rem 2.5rem;
  font-family: var(--font-pixel);
  font-size: 0.9rem;
  color: var(--snake-color);
  outline: none;
  letter-spacing: 3px;
  text-transform: uppercase;
  transition: all 0.3s;
  clip-path: polygon(0 0,
      calc(100% - 10px) 0,
      100% 10px,
      100% 100%,
      10px 100%,
      0 calc(100% - 10px));
}

#player-name-input:focus {
  border-color: var(--accent);
  background: rgba(0, 255, 136, 0.1);
  box-shadow: 0 0 20px rgba(0, 255, 136, 0.2);
}

.color-preview-name {
  font-family: var(--font-pixel);
  font-size: 1rem;
  margin-bottom: 2rem;
  min-height: 2rem;
  letter-spacing: 2px;
  text-shadow: 0 0 10px currentColor;
  transition: color 0.3s;
}

#screen-menu {
  background: radial-gradient(ellipse at 30% 50%, #0d1a0d 0%, #000 70%);
  flex-direction: column;
}

.menu-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  width: 900px;
  max-width: 95vw;
  border: 1px solid var(--border);
  clip-path: polygon(0 0,
      calc(100% - 30px) 0,
      100% 30px,
      100% 100%,
      30px 100%,
      0 calc(100% - 30px));
  background: var(--panel-bg);
  backdrop-filter: blur(30px);
  overflow: hidden;
}

.menu-left {
  padding: 3rem 2.5rem;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0;
}

.menu-player-info {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.menu-player-label {
  font-size: 0.55rem;
  font-family: var(--font-pixel);
  color: rgba(255, 255, 255, 0.3);
  letter-spacing: 3px;
  margin-bottom: 0.5rem;
}

.menu-player-name {
  font-family: var(--font-pixel);
  font-size: 1.1rem;
  text-shadow: 0 0 15px currentColor;
  letter-spacing: 3px;
}

.menu-title {
  font-family: var(--font-pixel);
  font-size: 1.8rem;
  color: var(--accent);
  text-shadow: 0 0 20px var(--accent);
  margin-bottom: 2rem;
  letter-spacing: 2px;
  line-height: 1.5;
}

.menu-items {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex: 1;
}

.menu-item {
  font-family: var(--font-pixel);
  font-size: 0.65rem;
  letter-spacing: 2px;
  padding: 1rem 1.2rem;
  background: transparent;
  border: 1px solid transparent;
  color: rgba(255, 255, 255, 0.5);
  cursor: none;
  text-align: left;
  transition: all 0.2s;
  position: relative;
  text-transform: uppercase;
}

.menu-item::before {
  content: "▶";
  position: absolute;
  left: -10px;
  opacity: 0;
  transition: all 0.2s;
  color: var(--accent);
}

.menu-item:hover,
.menu-item.selected {
  color: var(--accent);
  border-color: var(--border);
  background: rgba(0, 255, 136, 0.05);
  padding-left: 2rem;
}

.menu-item:hover::before,
.menu-item.selected::before {
  opacity: 1;
  left: 0.8rem;
}

.menu-right {
  padding: 3rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  position: relative;
  overflow: hidden;
}

.snake-preview {
  width: 180px;
  height: 180px;
  position: relative;
}

.snake-preview canvas {
  image-rendering: pixelated;
}

.menu-highscore-block {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.menu-highscore-label {
  font-family: var(--font-pixel);
  font-size: 0.45rem;
  color: rgba(255, 255, 255, 0.25);
  letter-spacing: 2px;
  margin-bottom: 0.4rem;
}

.menu-highscore-value {
  font-family: var(--font-retro);
  font-size: 2.5rem;
  color: var(--accent);
  text-shadow: 0 0 10px var(--accent);
}

.menu-controls-hint {
  text-align: center;
  font-family: var(--font-pixel);
  font-size: 0.45rem;
  color: rgba(255, 255, 255, 0.2);
  letter-spacing: 2px;
  line-height: 2;
}

.menu-version {
  font-family: var(--font-pixel);
  font-size: 0.45rem;
  color: rgba(255, 255, 255, 0.2);
  letter-spacing: 2px;
  position: absolute;
  bottom: 1rem;
  right: 1rem;
}

#screen-help {
  background: radial-gradient(ellipse at 50% 80%, #0d1a1a 0%, #000 70%);
}

.help-container {
  width: 760px;
  max-width: 95vw;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  clip-path: polygon(0 0,
      calc(100% - 25px) 0,
      100% 25px,
      100% 100%,
      25px 100%,
      0 calc(100% - 25px));
  backdrop-filter: blur(30px);
  padding: 2.5rem;
  max-height: 85vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) transparent;
}

.help-section {
  margin-bottom: 2rem;
}

.help-section h3 {
  font-family: var(--font-pixel);
  font-size: 0.65rem;
  color: var(--accent);
  letter-spacing: 3px;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

.help-rules-text {
  font-family: var(--font-retro);
  font-size: 1.15rem;
  color: rgba(255, 255, 255, 0.5);
  line-height: 2;
  letter-spacing: 1px;
}

.controls-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.control-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.key {
  font-family: var(--font-pixel);
  font-size: 0.5rem;
  padding: 0.3rem 0.6rem;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.05);
  color: var(--accent);
  white-space: nowrap;
  letter-spacing: 1px;
}

.control-desc {
  font-family: var(--font-retro);
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 1px;
}

.pdf-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  font-family: var(--font-pixel);
  font-size: 0.55rem;
  color: var(--accent2);
  border: 1px solid var(--accent2);
  padding: 0.8rem 1.5rem;
  cursor: none;
  text-decoration: none;
  letter-spacing: 2px;
  transition: all 0.2s;
  background: transparent;
}

.pdf-link-btn:hover {
  background: rgba(255, 0, 110, 0.1);
}

.pdf-link-note {
  font-family: var(--font-pixel);
  font-size: 0.4rem;
  color: rgba(255, 255, 255, 0.2);
  letter-spacing: 2px;
  margin-top: 0.8rem;
}