@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Silkscreen:wght@400;700&display=swap');

:root {
  --nokia-green: #4a7a2e;
  --nokia-green-light: #6b9b3a;
  --nokia-green-dark: #3a6120;
  --nokia-screen: #9bbc0f;
  --nokia-screen-dark: #8bac0f;
  --nokia-screen-darker: #306230;
  --nokia-screen-darkest: #0f380f;
  --nokia-body: #b0b4a8;
  --nokia-body-dark: #8a8e80;
  --nokia-body-light: #c8ccc0;
  --nokia-blue: #2c3e7a;
  --nokia-blue-dark: #1a2a5a;
  --nokia-text: #0f380f;
  --nokia-shadow: rgba(0, 0, 0, 0.3);
  --pixel-font: 'Press Start 2P', monospace;
  --ui-font: 'Silkscreen', sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--ui-font);
  background: #1a1a2e;
  color: #e0e0e0;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===== NOKIA PHONE FRAME ===== */
.nokia-phone {
  width: 320px;
  background: linear-gradient(145deg, var(--nokia-body-light), var(--nokia-body), var(--nokia-body-dark));
  border-radius: 30px 30px 40px 40px;
  padding: 20px;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.5),
    inset 0 2px 4px rgba(255, 255, 255, 0.3),
    inset 0 -2px 4px rgba(0, 0, 0, 0.2);
  position: relative;
}

.nokia-phone::before {
  content: 'NOKIA';
  display: block;
  text-align: center;
  font-family: var(--ui-font);
  font-size: 16px;
  font-weight: 700;
  color: var(--nokia-body-dark);
  letter-spacing: 6px;
  margin-bottom: 10px;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
}

.nokia-screen {
  background: var(--nokia-screen);
  border-radius: 8px;
  border: 3px solid #6a6e60;
  box-shadow:
    inset 0 2px 8px rgba(0, 0, 0, 0.3),
    0 1px 0 rgba(255, 255, 255, 0.3);
  overflow: hidden;
}

.nokia-screen-inner {
  padding: 8px;
  min-height: 260px;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ===== NOKIA KEYPAD ===== */
.nokia-keypad {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.nokia-nav-cluster {
  position: relative;
  width: 120px;
  height: 120px;
  margin-bottom: 4px;
}

.nokia-dpad {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: linear-gradient(145deg, #4a4e44, #3a3e34);
  position: relative;
  box-shadow:
    0 4px 8px rgba(0, 0, 0, 0.3),
    inset 0 1px 2px rgba(255, 255, 255, 0.1);
}

.nokia-dpad-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(145deg, #5a5e54, #4a4e44);
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.3),
    inset 0 1px 2px rgba(255, 255, 255, 0.1);
}

.dpad-btn {
  position: absolute;
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.4);
  font-size: 14px;
  padding: 8px;
  transition: color 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.dpad-btn:active {
  color: rgba(255, 255, 255, 0.8);
}

.dpad-up { top: 4px; left: 50%; transform: translateX(-50%); }
.dpad-down { bottom: 4px; left: 50%; transform: translateX(-50%); }
.dpad-left { left: 4px; top: 50%; transform: translateY(-50%); }
.dpad-right { right: 4px; top: 50%; transform: translateY(-50%); }

.nokia-action-btns {
  display: flex;
  gap: 60px;
  margin-top: 4px;
}

.nokia-action-btn {
  width: 48px;
  height: 28px;
  border-radius: 14px;
  background: linear-gradient(145deg, #5a5e54, #4a4e44);
  border: none;
  cursor: pointer;
  box-shadow:
    0 3px 6px rgba(0, 0, 0, 0.3),
    inset 0 1px 2px rgba(255, 255, 255, 0.1);
  font-family: var(--ui-font);
  font-size: 7px;
  color: rgba(255, 255, 255, 0.5);
  transition: transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.nokia-action-btn:active {
  transform: scale(0.95);
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.3),
    inset 0 1px 2px rgba(255, 255, 255, 0.1);
}

.nokia-numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  width: 200px;
}

.nokia-num-btn {
  height: 32px;
  border-radius: 6px;
  background: linear-gradient(145deg, #5a5e54, #4a4e44);
  border: none;
  cursor: pointer;
  box-shadow:
    0 3px 6px rgba(0, 0, 0, 0.3),
    inset 0 1px 2px rgba(255, 255, 255, 0.1);
  font-family: var(--ui-font);
  font-size: 10px;
  color: rgba(255, 255, 255, 0.6);
  transition: transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.nokia-num-btn:active {
  transform: scale(0.95);
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--nokia-green);
  border-radius: 3px;
}

/* ===== PAGE LAYOUT ===== */
.page-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ===== HEADER / NAV ===== */
.site-header {
  background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
  border-bottom: 2px solid var(--nokia-green);
  padding: 16px 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header .page-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-logo {
  font-family: var(--pixel-font);
  font-size: 14px;
  color: var(--nokia-screen);
  text-decoration: none;
  text-shadow: 0 0 10px rgba(155, 188, 15, 0.5);
  display: flex;
  align-items: center;
  gap: 10px;
}

.site-logo .snake-icon {
  font-size: 20px;
}

.site-nav {
  display: flex;
  gap: 24px;
  align-items: center;
}

.site-nav a {
  font-family: var(--ui-font);
  font-size: 14px;
  color: #aaa;
  text-decoration: none;
  transition: color 0.2s;
}

.site-nav a:hover {
  color: var(--nokia-screen);
}

/* ===== HERO ===== */
.hero {
  padding: 80px 0 60px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at center, rgba(155, 188, 15, 0.05) 0%, transparent 50%);
  animation: pulse 4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.hero h1 {
  font-family: var(--pixel-font);
  font-size: clamp(24px, 5vw, 48px);
  color: var(--nokia-screen);
  text-shadow: 0 0 20px rgba(155, 188, 15, 0.4);
  margin-bottom: 16px;
  position: relative;
  line-height: 1.4;
}

.hero .subtitle {
  font-family: var(--ui-font);
  font-size: clamp(14px, 2.5vw, 20px);
  color: #8a8e80;
  margin-bottom: 40px;
  position: relative;
}

.hero-phone-wrapper {
  display: flex;
  justify-content: center;
  margin: 40px 0;
  position: relative;
}

.play-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 16px 48px;
  font-family: var(--pixel-font);
  font-size: 16px;
  color: #0f380f;
  background: var(--nokia-screen);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
  box-shadow:
    0 4px 0 var(--nokia-green-dark),
    0 8px 20px rgba(155, 188, 15, 0.3);
  position: relative;
}

.play-btn:hover {
  transform: translateY(-2px);
  box-shadow:
    0 6px 0 var(--nokia-green-dark),
    0 12px 30px rgba(155, 188, 15, 0.4);
}

.play-btn:active {
  transform: translateY(2px);
  box-shadow:
    0 2px 0 var(--nokia-green-dark),
    0 4px 10px rgba(155, 188, 15, 0.2);
}

/* ===== FEATURES SECTION ===== */
.features {
  padding: 80px 0;
}

.section-title {
  font-family: var(--pixel-font);
  font-size: clamp(16px, 3vw, 24px);
  color: var(--nokia-screen);
  text-align: center;
  margin-bottom: 48px;
  text-shadow: 0 0 10px rgba(155, 188, 15, 0.3);
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 32px;
}

.feature-card {
  background: linear-gradient(145deg, #1e2a4a, #16213e);
  border: 1px solid rgba(155, 188, 15, 0.15);
  border-radius: 16px;
  padding: 32px;
  transition: all 0.3s;
}

.feature-card:hover {
  border-color: rgba(155, 188, 15, 0.4);
  transform: translateY(-4px);
  box-shadow: 0 8px 30px rgba(155, 188, 15, 0.1);
}

.feature-icon {
  font-size: 36px;
  margin-bottom: 16px;
  display: block;
}

.feature-card h3 {
  font-family: var(--pixel-font);
  font-size: 12px;
  color: var(--nokia-screen);
  margin-bottom: 12px;
}

.feature-card p {
  font-size: 14px;
  color: #8a8e80;
  line-height: 1.8;
}

/* ===== HOW TO PLAY ===== */
.how-to-play {
  padding: 80px 0;
  background: linear-gradient(180deg, transparent, rgba(155, 188, 15, 0.03), transparent);
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px;
  max-width: 900px;
  margin: 0 auto;
}

.step-card {
  text-align: center;
  padding: 32px 20px;
  position: relative;
}

.step-number {
  font-family: var(--pixel-font);
  font-size: 36px;
  color: var(--nokia-screen);
  opacity: 0.3;
  display: block;
  margin-bottom: 16px;
}

.step-card h3 {
  font-family: var(--pixel-font);
  font-size: 11px;
  color: var(--nokia-screen);
  margin-bottom: 8px;
}

.step-card p {
  font-size: 13px;
  color: #8a8e80;
  line-height: 1.7;
}

/* ===== HISTORY SECTION ===== */
.history {
  padding: 80px 0;
}

.history-content {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.history-content p {
  font-size: 15px;
  color: #aaa;
  line-height: 1.9;
}

.history-content p strong {
  color: var(--nokia-screen);
}

/* ===== CTA SECTION ===== */
.cta-section {
  padding: 80px 0;
  text-align: center;
}

.cta-section h2 {
  font-family: var(--pixel-font);
  font-size: clamp(16px, 3vw, 28px);
  color: var(--nokia-screen);
  margin-bottom: 16px;
  text-shadow: 0 0 10px rgba(155, 188, 15, 0.3);
}

.cta-section p {
  font-size: 16px;
  color: #8a8e80;
  margin-bottom: 32px;
}

/* ===== FOOTER ===== */
.site-footer {
  border-top: 1px solid rgba(155, 188, 15, 0.15);
  padding: 32px 0;
  text-align: center;
}

.site-footer p {
  font-size: 12px;
  color: #555;
}

.site-footer a {
  color: var(--nokia-screen);
  text-decoration: none;
}

/* ===== GAME PAGE SPECIFIC ===== */
.game-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(circle at 50% 30%, rgba(155, 188, 15, 0.05) 0%, transparent 50%),
    #1a1a2e;
}

.game-page .nokia-phone {
  margin: 0 auto;
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
  font-family: var(--pixel-font);
  font-size: 7px;
  color: var(--nokia-text);
}

.game-canvas-wrapper {
  background: var(--nokia-screen);
  position: relative;
  image-rendering: pixelated;
}

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

.game-status-bar {
  display: flex;
  justify-content: space-between;
  font-family: var(--pixel-font);
  font-size: 7px;
  color: var(--nokia-text);
  margin-top: 4px;
}

.game-menu {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 240px;
}

.game-menu h2 {
  font-family: var(--pixel-font);
  font-size: 14px;
  color: var(--nokia-text);
  margin-bottom: 8px;
}

.game-menu .menu-snake {
  font-family: var(--pixel-font);
  font-size: 8px;
  color: var(--nokia-screen-darker);
  margin-bottom: 24px;
  letter-spacing: 2px;
}

.menu-items {
  list-style: none;
  text-align: center;
}

.menu-items li {
  font-family: var(--pixel-font);
  font-size: 9px;
  color: var(--nokia-text);
  padding: 8px 16px;
  cursor: pointer;
  transition: background 0.15s;
  border-radius: 4px;
}

.menu-items li:hover,
.menu-items li.selected {
  background: var(--nokia-screen-darker);
  color: var(--nokia-screen);
}

.game-over-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 240px;
}

.game-over-screen h2 {
  font-family: var(--pixel-font);
  font-size: 12px;
  color: var(--nokia-text);
  margin-bottom: 16px;
}

.game-over-screen .final-score {
  font-family: var(--pixel-font);
  font-size: 20px;
  color: var(--nokia-text);
  margin-bottom: 8px;
}

.game-over-screen .high-score-label {
  font-family: var(--pixel-font);
  font-size: 8px;
  color: var(--nokia-screen-darker);
  margin-bottom: 24px;
}

.game-over-screen .restart-hint {
  font-family: var(--pixel-font);
  font-size: 7px;
  color: var(--nokia-screen-darker);
  animation: blink 1.2s step-end infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
  font-family: var(--ui-font);
  font-size: 14px;
  color: #666;
  text-decoration: none;
  transition: color 0.2s;
}

.back-link:hover {
  color: var(--nokia-screen);
}

/* ===== TOUCH CONTROLS (mobile) ===== */
.touch-controls {
  display: none;
  margin-top: 20px;
}

.touch-dpad {
  display: grid;
  grid-template-areas:
    ". up ."
    "left center right"
    ". down .";
  grid-template-columns: 64px 64px 64px;
  grid-template-rows: 64px 64px 64px;
  gap: 4px;
}

.touch-btn {
  background: rgba(155, 188, 15, 0.15);
  border: 2px solid rgba(155, 188, 15, 0.3);
  border-radius: 12px;
  color: var(--nokia-screen);
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  transition: background 0.1s;
}

.touch-btn:active {
  background: rgba(155, 188, 15, 0.3);
}

.touch-btn.up { grid-area: up; }
.touch-btn.down { grid-area: down; }
.touch-btn.left { grid-area: left; }
.touch-btn.right { grid-area: right; }
.touch-btn.center { grid-area: center; border-radius: 50%; font-size: 14px; }

/* ===== ANIMATIONS ===== */
.fade-in {
  animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .hero { padding: 40px 0 30px; }
  .features, .how-to-play, .history, .cta-section { padding: 50px 0; }
  .site-nav { gap: 16px; }
  .site-nav a { font-size: 12px; }
  .nokia-phone { width: 290px; padding: 16px; }
  .touch-controls { display: flex; justify-content: center; }
}

@media (max-width: 480px) {
  .site-header .page-container {
    flex-direction: column;
    gap: 12px;
  }
  .nokia-phone { width: 270px; padding: 14px; }
  .play-btn { padding: 14px 36px; font-size: 14px; }
}

/* ===== SCREEN PIXEL GRID OVERLAY ===== */
.pixel-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.03) 1px, transparent 1px);
  background-size: 2px 2px;
  pointer-events: none;
  z-index: 1;
}

/* ===== PAUSE OVERLAY ===== */
.pause-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(155, 188, 15, 0.85);
  z-index: 5;
}

.pause-overlay span {
  font-family: var(--pixel-font);
  font-size: 14px;
  color: var(--nokia-text);
  animation: blink 1s step-end infinite;
}
