/* Стили для игры Змейка в стиле Nokia 3310 */
:root {
  --lcd-bg: #98b17b;
  --lcd-pixel: #1f2b18;
  --lcd-pixel-dim: #7f9567;
  --case-bg: #223242;
  --case-border: #141f2a;
  --button-bg: #c9ced4;
  --button-text: #2c3846;
  --button-shadow: #8893a0;
  --font-lcd: 'Courier New', Courier, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

body {
  background: #111822;
  font-family: var(--font-lcd);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  color: var(--lcd-pixel);
}

/* Корпус телефона */
.phone-wrapper {
  background: var(--case-bg);
  border: 4px solid var(--case-border);
  border-radius: 36px;
  width: 100%;
  max-width: 360px;
  height: 98vh;
  max-height: 720px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), inset 0 2px 6px rgba(255, 255, 255, 0.15);
  position: relative;
}

.speaker {
  width: 48px;
  height: 6px;
  background: #131b23;
  border-radius: 4px;
  margin-bottom: 6px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.8);
}

.brand {
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 4px;
  color: #8c9ba8;
  margin-bottom: 10px;
  text-shadow: 0 -1px 1px rgba(0, 0, 0, 0.8);
}

/* Рамка экрана */
.screen-bezel {
  width: 100%;
  background: #1b2633;
  padding: 10px;
  border-radius: 18px;
  box-shadow: inset 0 4px 8px rgba(0, 0, 0, 0.6), 0 1px 1px rgba(255, 255, 255, 0.1);
}

/* ЖК-экран */
.lcd-screen {
  background: var(--lcd-bg);
  border: 2px solid var(--lcd-pixel);
  border-radius: 8px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.18);
  /* Пиксельная текстура */
  background-image: 
    radial-gradient(var(--lcd-pixel-dim) 15%, transparent 16%),
    radial-gradient(var(--lcd-pixel-dim) 15%, transparent 16%);
  background-size: 4px 4px;
  background-position: 0 0, 2px 2px;
}

/* Статусная строка */
.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--lcd-pixel);
  padding-bottom: 4px;
  font-size: 11px;
  font-weight: bold;
}

.signal-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
}

.signal-bars span {
  width: 3px;
  background: var(--lcd-pixel);
  border-radius: 1px;
}

.signal-bars span:nth-child(1) { height: 3px; }
.signal-bars span:nth-child(2) { height: 6px; }
.signal-bars span:nth-child(3) { height: 9px; }
.signal-bars span:nth-child(4) { height: 12px; }

.game-title {
  letter-spacing: 2px;
  font-weight: 900;
}

.battery-bar {
  width: 18px;
  height: 10px;
  border: 1.5px solid var(--lcd-pixel);
  border-radius: 2px;
  position: relative;
  padding: 1px;
}

.battery-bar::after {
  content: '';
  position: absolute;
  right: -3px;
  top: 2px;
  width: 2px;
  height: 4px;
  background: var(--lcd-pixel);
  border-radius: 0 1px 1px 0;
}

.battery-level {
  width: 80%;
  height: 100%;
  background: var(--lcd-pixel);
}

/* Табло счета */
.score-board {
  display: flex;
  justify-content: space-between;
  padding: 4px 2px;
  font-size: 12px;
  font-weight: bold;
  letter-spacing: 1px;
}

/* Поле холста */
.canvas-container {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--lcd-bg);
  border: 2px solid var(--lcd-pixel);
  display: flex;
  justify-content: center;
  align-items: center;
}

#gameCanvas {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* Оверлей меню и паузы */
.screen-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(152, 177, 123, 0.94);
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  z-index: 10;
  transition: opacity 0.2s ease;
}

.screen-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.overlay-content h2 {
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 3px;
  margin-bottom: 8px;
}

.overlay-content p {
  font-size: 12px;
  font-weight: bold;
  letter-spacing: 1px;
  margin-bottom: 14px;
}

.lcd-btn {
  background: var(--lcd-pixel);
  color: var(--lcd-bg);
  border: none;
  padding: 8px 18px;
  font-family: var(--font-lcd);
  font-size: 13px;
  font-weight: bold;
  letter-spacing: 2px;
  border-radius: 4px;
  cursor: pointer;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.4);
}

.lcd-btn:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.4);
}

/* Нижний футер экрана */
.lcd-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 4px;
  border-top: 1px dashed var(--lcd-pixel);
  font-size: 11px;
  font-weight: bold;
  margin-top: 4px;
}

.lcd-icon-btn {
  background: none;
  border: none;
  font-size: 14px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

/* Клавиатурная панель */
.keypad {
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  padding-top: 10px;
}

/* Навигационный блок D-pad */
.dpad-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.dpad-middle {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Общие стили кнопок */
.key-btn {
  background: var(--button-bg);
  color: var(--button-text);
  border: none;
  border-radius: 12px;
  font-family: var(--font-lcd);
  font-weight: bold;
  box-shadow: 0 4px 0 var(--button-shadow), 0 5px 6px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.05s ease, box-shadow 0.05s ease;
}

.key-btn:active, .key-btn.active-key {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--button-shadow), 0 2px 4px rgba(0, 0, 0, 0.3);
}

.dpad-btn {
  width: 58px;
  height: 44px;
  font-size: 16px;
}

.dpad-btn.center {
  width: 66px;
  height: 44px;
  background: #dbe0e6;
  font-size: 14px;
  font-weight: 900;
}

/* Функциональные кнопки */
.function-keys {
  display: flex;
  justify-content: space-around;
  padding: 4px 10px 0;
  gap: 12px;
}

.fn-btn {
  flex: 1;
  height: 38px;
  font-size: 12px;
  letter-spacing: 1px;
}
