/* ==========================================================================
   Nokia Snake — Custom Styles
   Authentic monochrome LCD aesthetic with modern UI polish
   ========================================================================== */

:root {
  --nokia-bg: #9bbc0f;
  --nokia-light: #8bac0f;
  --nokia-mid: #306230;
  --nokia-dark: #0f380f;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

/* Selection */
::selection {
  background: var(--nokia-bg);
  color: var(--nokia-dark);
}

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: rgba(255,255,255,0.02); }
::-webkit-scrollbar-thumb {
  background: rgba(155, 188, 15, 0.25);
  border-radius: 8px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(155, 188, 15, 0.45); }

/* ==========================================================================
   Landing Page — Nokia phone mockup
   ========================================================================== */

.nokia-phone {
  position: relative;
  width: 320px;
  max-width: 100%;
  padding: 28px 22px 32px;
  background: linear-gradient(180deg, #1f3a1f 0%, #16291a 50%, #0c1a0d 100%);
  border-radius: 36px;
  box-shadow:
    0 30px 80px -20px rgba(15, 56, 15, 0.6),
    0 0 0 1px rgba(155, 188, 15, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.nokia-phone::before {
  content: '';
  position: absolute;
  inset: 6px;
  border-radius: 30px;
  background: linear-gradient(180deg, transparent 0%, rgba(255,255,255,0.02) 50%, transparent 100%);
  pointer-events: none;
}

.nokia-speaker {
  width: 56px;
  height: 6px;
  margin: 0 auto 18px;
  background: rgba(0,0,0,0.5);
  border-radius: 4px;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.6);
}

.nokia-screen-frame {
  padding: 10px;
  border-radius: 14px;
  background: linear-gradient(180deg, #0a1d0a 0%, #102910 100%);
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.6);
}

.nokia-screen {
  position: relative;
  padding: 10px 12px;
  background: var(--nokia-bg);
  border-radius: 6px;
  color: var(--nokia-dark);
  font-family: 'Press Start 2P', monospace;
  box-shadow: inset 0 0 12px rgba(15, 56, 15, 0.25);
}

.nokia-status {
  display: flex;
  justify-content: space-between;
  font-size: 8px;
  letter-spacing: 1px;
  border-bottom: 1px dashed rgba(15, 56, 15, 0.4);
  padding-bottom: 6px;
}

.nokia-game-preview {
  --cols: 16;
  --rows: 12;
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
  grid-template-rows: repeat(var(--rows), 1fr);
  gap: 1px;
  margin: 8px 0;
  aspect-ratio: var(--cols) / var(--rows);
  background: rgba(15, 56, 15, 0.06);
}

.hp-cell { background: transparent; }
.hp-body { background: var(--nokia-dark); }
.hp-head {
  background: var(--nokia-dark);
  box-shadow: inset 0 0 0 1px var(--nokia-bg);
}
.hp-food {
  background: var(--nokia-dark);
  border-radius: 50%;
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.7); opacity: 0.7; }
}

.nokia-score {
  font-size: 8px;
  letter-spacing: 1px;
  border-top: 1px dashed rgba(15, 56, 15, 0.4);
  padding-top: 6px;
  text-align: right;
}

.nokia-keypad {
  margin-top: 22px;
  display: flex;
  justify-content: center;
}

.nokia-dpad {
  display: grid;
  grid-template-rows: 28px 28px 28px;
  gap: 4px;
}
.nokia-dpad-up,
.nokia-dpad-down {
  width: 60px;
  height: 28px;
  margin: 0 auto;
  background: linear-gradient(180deg, #2d4a2d, #1a2e1a);
  border-radius: 6px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 2px 4px rgba(0,0,0,0.4);
}
.nokia-dpad-mid {
  display: grid;
  grid-template-columns: 28px 28px 28px;
  gap: 4px;
}
.nokia-dpad-left,
.nokia-dpad-right {
  background: linear-gradient(180deg, #2d4a2d, #1a2e1a);
  border-radius: 6px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 2px 4px rgba(0,0,0,0.4);
}
.nokia-dpad-center {
  background: radial-gradient(circle, var(--nokia-bg) 0%, var(--nokia-mid) 100%);
  border-radius: 50%;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 2px 4px rgba(0,0,0,0.4), 0 0 12px rgba(155,188,15,0.4);
}

.nokia-brand {
  margin-top: 22px;
  text-align: center;
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  letter-spacing: 3px;
  color: var(--nokia-bg);
  opacity: 0.8;
}

/* ==========================================================================
   Landing Page — Feature, Step, Timeline, FAQ cards
   ========================================================================== */

.feature-card {
  position: relative;
  padding: 1.5rem;
  border-radius: 1rem;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.025);
  transition: all 0.2s ease;
}
.feature-card:hover {
  border-color: rgba(155, 188, 15, 0.3);
  background: rgba(255,255,255,0.04);
  transform: translateY(-2px);
}

.feature-icon {
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  border-radius: 12px;
  background: rgba(155, 188, 15, 0.1);
  color: var(--nokia-bg);
  margin-bottom: 1rem;
}
.feature-icon svg { width: 22px; height: 22px; }
.feature-title { font-weight: 700; color: white; font-size: 1.05rem; }
.feature-text { margin-top: 0.5rem; color: rgb(203, 213, 225); font-size: 0.925rem; line-height: 1.55; }

.step-card {
  position: relative;
  padding: 1.5rem;
  border-radius: 1rem;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.025);
}
.step-number {
  display: inline-grid;
  place-items: center;
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--nokia-bg);
  color: var(--nokia-dark);
  font-family: 'Press Start 2P', monospace;
  font-size: 0.85rem;
}
.step-title { margin-top: 1rem; font-weight: 700; color: white; font-size: 1.05rem; }
.step-text { margin-top: 0.5rem; color: rgb(203, 213, 225); font-size: 0.925rem; line-height: 1.55; }

.control-row {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.875rem; color: rgb(203, 213, 225);
}
.control-row span { margin-left: 0.5rem; color: rgb(148, 163, 184); }
kbd {
  display: inline-grid; place-items: center;
  min-width: 1.75rem; height: 1.75rem;
  padding: 0 0.5rem;
  border-radius: 0.375rem;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.05);
  color: white;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.6rem;
  box-shadow: 0 2px 0 rgba(0,0,0,0.4);
}

.timeline-item {
  position: relative;
  padding-left: 1.5rem;
  border-left: 2px solid rgba(155, 188, 15, 0.25);
}
.timeline-item::before {
  content: '';
  position: absolute; left: -7px; top: 6px;
  width: 12px; height: 12px;
  background: var(--nokia-bg);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(155, 188, 15, 0.15);
}
.timeline-year {
  display: inline-block;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.75rem;
  color: var(--nokia-bg);
  margin-bottom: 0.5rem;
}
.timeline-title { font-weight: 700; color: white; font-size: 1.1rem; }
.timeline-text { margin-top: 0.4rem; color: rgb(203, 213, 225); line-height: 1.6; }

.faq-item {
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.025);
  border-radius: 0.75rem;
  overflow: hidden;
  transition: border-color 0.2s ease;
}
.faq-item[open] { border-color: rgba(155, 188, 15, 0.3); }
.faq-item summary {
  cursor: pointer;
  list-style: none;
  padding: 1.25rem 1.5rem;
  font-weight: 600;
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: '+';
  font-size: 1.5rem;
  color: var(--nokia-bg);
  font-weight: 300;
  transition: transform 0.2s ease;
}
.faq-item[open] summary::after { content: '−'; }
.faq-item p {
  padding: 0 1.5rem 1.25rem;
  color: rgb(203, 213, 225);
  line-height: 1.6;
}

/* ==========================================================================
   Game Page — Console
   ========================================================================== */

.game-console {
  width: 100%;
  max-width: 480px;
  padding: 28px 24px 32px;
  border-radius: 32px;
  background: linear-gradient(180deg, #1f3a1f 0%, #16291a 50%, #0a1a0d 100%);
  box-shadow:
    0 30px 80px -20px rgba(15, 56, 15, 0.7),
    0 0 0 1px rgba(155, 188, 15, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.game-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px 14px;
  border-bottom: 1px dashed rgba(155, 188, 15, 0.15);
  margin-bottom: 14px;
}

.lcd-frame {
  padding: 12px;
  border-radius: 16px;
  background: linear-gradient(180deg, #0a1d0a 0%, #102910 100%);
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.7);
}

.lcd-screen {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background: var(--nokia-bg);
  aspect-ratio: 1 / 1;
  box-shadow: inset 0 0 24px rgba(15, 56, 15, 0.3);
}

.lcd-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(15, 56, 15, 0.04) 0px,
    rgba(15, 56, 15, 0.04) 1px,
    transparent 1px,
    transparent 3px
  );
  pointer-events: none;
  z-index: 2;
}

.lcd-screen::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 0%, rgba(15, 56, 15, 0.2) 100%);
  pointer-events: none;
  z-index: 2;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  position: relative;
  z-index: 1;
}

/* Overlays */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(155, 188, 15, 0.85);
  backdrop-filter: blur(2px);
  animation: overlayIn 0.2s ease-out;
}
.overlay.hidden { display: none; }

@keyframes overlayIn {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

.overlay-card {
  width: 100%;
  max-width: 280px;
  padding: 22px 20px;
  text-align: center;
  background: var(--nokia-bg);
  border: 2px solid var(--nokia-dark);
  border-radius: 6px;
  box-shadow: 4px 4px 0 var(--nokia-dark);
}

.overlay-stat {
  padding: 8px 10px;
  background: rgba(15, 56, 15, 0.1);
  border: 1px dashed rgba(15, 56, 15, 0.4);
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.overlay-stat span {
  font-size: 8px;
  font-family: 'Press Start 2P', monospace;
  color: var(--nokia-dark);
  opacity: 0.7;
}
.overlay-stat strong {
  margin-top: 4px;
  font-size: 14px;
  font-family: 'Press Start 2P', monospace;
  color: var(--nokia-dark);
}

.overlay-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 12px 16px;
  background: var(--nokia-dark);
  color: var(--nokia-bg);
  font-family: 'Press Start 2P', monospace;
  font-size: 12px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: transform 0.05s ease, box-shadow 0.05s ease;
  box-shadow: 0 3px 0 rgba(0,0,0,0.3);
}
.overlay-cta:hover { transform: translateY(-1px); box-shadow: 0 4px 0 rgba(0,0,0,0.3); }
.overlay-cta:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0,0,0,0.3); }

.diff-btn {
  padding: 8px 4px;
  background: transparent;
  border: 1px solid var(--nokia-dark);
  color: var(--nokia-dark);
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.diff-btn:hover { background: rgba(15, 56, 15, 0.1); }
.diff-btn-active {
  background: var(--nokia-dark);
  color: var(--nokia-bg);
}

/* Game controls (D-pad) */
.game-controls {
  margin-top: 22px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 60px);
  gap: 8px;
  max-width: 240px;
  margin-left: auto;
  margin-right: auto;
}

.ctl-btn {
  background: linear-gradient(180deg, #2d4a2d, #1a2e1a);
  color: var(--nokia-bg);
  border: 1px solid rgba(155, 188, 15, 0.2);
  border-radius: 12px;
  font-size: 1.5rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.05s ease, box-shadow 0.1s ease, background 0.1s ease;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 4px 0 rgba(0,0,0,0.3),
    0 0 0 1px rgba(0,0,0,0.2);
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.ctl-btn:hover { background: linear-gradient(180deg, #345534, #1f3520); }
.ctl-btn:active,
.ctl-btn.pressed {
  transform: translateY(2px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 1px 0 rgba(0,0,0,0.3),
    0 0 0 1px rgba(0,0,0,0.2);
  background: linear-gradient(180deg, #1f3520, #142214);
}

.ctl-up    { grid-column: 2; grid-row: 1; }
.ctl-left  { grid-column: 1; grid-row: 2; }
.ctl-center { grid-column: 2; grid-row: 2;
  background: radial-gradient(circle, var(--nokia-bg) 0%, var(--nokia-mid) 100%);
  color: var(--nokia-dark);
  font-family: 'Press Start 2P', monospace;
  font-size: 0.85rem;
  border-radius: 50%;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.2),
    0 4px 0 rgba(0,0,0,0.3),
    0 0 16px rgba(155,188,15,0.3);
}
.ctl-center:hover { background: radial-gradient(circle, #b1d11a 0%, var(--nokia-mid) 100%); }
.ctl-right { grid-column: 3; grid-row: 2; }
.ctl-down  { grid-column: 2; grid-row: 3; }

/* Sidebar */
.side-card {
  padding: 1.25rem;
  border-radius: 1rem;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.025);
}
.side-title {
  font-size: 0.7rem;
  font-family: 'Press Start 2P', monospace;
  color: var(--nokia-bg);
  letter-spacing: 1px;
}
.side-diff-btn {
  padding: 8px 4px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  color: rgb(203, 213, 225);
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.side-diff-btn:hover { background: rgba(255,255,255,0.08); color: white; }
.side-diff-btn-active {
  background: var(--nokia-bg);
  border-color: var(--nokia-bg);
  color: var(--nokia-dark);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 640px) {
  .game-console { padding: 20px 16px 24px; border-radius: 24px; }
  .game-controls { grid-template-rows: repeat(3, 56px); max-width: 220px; }
  .ctl-btn { font-size: 1.25rem; }
  .nokia-phone { width: 280px; }
  .nokia-game-preview { font-size: 0; }
}

@media (min-width: 1024px) {
  .game-controls { display: none; }
}

/* Hide controls on desktop with fine pointer */
@media (hover: hover) and (pointer: fine) and (min-width: 1024px) {
  .game-controls { display: none; }
}
