:root {
  --screen-bg: #c7f0d8; /* Nokia green backlight */
  --pixel-color: #43523d; /* Dark green/black pixels */
  --phone-body: #1a2530; /* Dark blue/grey phone body */
  --phone-highlight: #2a3b4c;
  --font-main: 'VT323', monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-main);
}

body {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #f0f0f0;
  color: var(--pixel-color);
  touch-action: manipulation; /* Prevent zooming on double tap on mobile */
}

/* Nokia phone body */
.nokia-body {
  background-color: var(--phone-body);
  border-radius: 40px;
  padding: 40px 20px 60px;
  box-shadow:
    inset 0px 5px 10px rgba(255, 255, 255, 0.1),
    inset 0px -5px 15px rgba(0, 0, 0, 0.5),
    0px 20px 40px rgba(0, 0, 0, 0.4);
  width: 100%;
  max-width: 450px;
  position: relative;
}

/* Speaker slit */
.nokia-body::before {
  content: '';
  position: absolute;
  top: 15px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 6px;
  background-color: #0d1318;
  border-radius: 3px;
  box-shadow: inset 0px 2px 3px rgba(0,0,0,0.8);
}

.nokia-screen-bezel {
  background-color: #8c9b9d;
  padding: 20px;
  border-radius: 20px;
  box-shadow: inset 0px 2px 5px rgba(0,0,0,0.3);
  margin-bottom: 30px;
}

.nokia-screen {
  background-color: var(--screen-bg);
  border: 4px solid #5a6668;
  border-radius: 5px;
  position: relative;
  overflow: hidden;
  box-shadow:
    inset 0px 0px 10px rgba(0,0,0,0.1),
    inset 2px 2px 5px rgba(0,0,0,0.2);
  /* Simulate screen grid faintly */
  background-image:
    linear-gradient(rgba(67, 82, 61, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(67, 82, 61, 0.05) 1px, transparent 1px);
  background-size: 4px 4px;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  padding: 5px 10px;
  font-size: 20px;
  font-weight: bold;
  border-bottom: 2px solid var(--pixel-color);
  background-color: var(--screen-bg);
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated; /* Sharp pixels */
}

/* Overlays */
#start-screen, #game-over-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background-color: rgba(199, 240, 216, 0.9); /* Semi-transparent screen bg */
  z-index: 10;
}

.hidden {
  display: none !important;
}

h2 {
  font-size: 48px;
  margin-bottom: 10px;
  text-transform: uppercase;
  text-shadow: 2px 2px 0px rgba(67, 82, 61, 0.3);
}

p {
  font-size: 24px;
}

.blink {
  animation: blinker 1s linear infinite;
}

@keyframes blinker {
  50% { opacity: 0; }
}

/* Controls section */
.nokia-controls {
  text-align: center;
  color: #a0b0c0;
}

.instruction {
  font-family: sans-serif;
  font-size: 14px;
  margin-bottom: 20px;
}

.d-pad {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.d-pad-row {
  display: flex;
  gap: 20px;
}

.btn {
  background-color: #c0c8d0;
  border: none;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  font-size: 24px;
  color: #333;
  box-shadow:
    0px 5px 0px #808890,
    0px 10px 15px rgba(0,0,0,0.3);
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
  font-family: sans-serif;
}

.btn:active {
  transform: translateY(5px);
  box-shadow:
    0px 0px 0px #808890,
    0px 5px 10px rgba(0,0,0,0.3);
}

.action-btn {
  background-color: #e0e8f0;
  font-size: 18px;
  font-weight: bold;
}

@media (min-width: 768px) {
  .d-pad {
    display: none; /* Hide on-screen controls on desktop */
  }
}
