/* -------------------------------------------------------------
   Nokia 6150 (Eloxal Blue - 1998)
   100% Authentic Handset & Keypad Design Styling
   Faithful Nokia Snake In-Game Screen Layout
   ------------------------------------------------------------- */

:root {
  /* Nokia Monochrome LCD Palette */
  --lcd-bg: #98b36e;
  --lcd-pixel: #12210c;
  --lcd-frame-shadow: #1e2c17;
}

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

body {
  font-family: 'VT323', monospace, 'Courier New', monospace;
  background-color: #0b0d14;
  background-image: 
    radial-gradient(#1e293b 1px, transparent 1px),
    radial-gradient(#1e293b 1px, #080a0f 1px);
  background-size: 28px 28px;
  background-position: 0 0, 14px 14px;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px 16px;
  color: #e2e8f0;
}

.table-surface {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 50px;
  flex-wrap: wrap;
}

/* ---------------- Handset Device Wrapper (1.5x Magnified: 480px) ---------------- */
.nokia-device-wrapper {
  position: relative;
  width: 480px;
  max-width: 95vw;
  aspect-ratio: 768 / 1376;
  filter: drop-shadow(0 30px 45px rgba(0, 0, 0, 0.9));
}

.nokia-device-img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  pointer-events: none;
  border-radius: 50px 50px 40px 40px;
}

/* ---------------- Embedded Nokia 84x48 Monochrome LCD ----------------
   Screen location in the 768x1376 photo:
   left: 31.38%, top: 33.58%, width: 37.63%, height: 15.62%
------------------------------------------------------------------------- */
.embedded-lcd-screen {
  position: absolute;
  left: 31.38%;
  top: 33.58%;
  width: 37.63%;
  height: 15.62%;
  background-color: var(--lcd-bg);
  color: var(--lcd-pixel);
  border-radius: 6px;
  box-shadow: 
    inset 0 3px 6px var(--lcd-frame-shadow),
    0 0 12px rgba(152, 179, 110, 0.3);
  overflow: hidden;
  font-family: 'VT323', monospace;
  image-rendering: pixelated;
  z-index: 10;
  /* Eliminate any browser sub-pixel jitter */
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* Static, non-flickering pixel texture */
.lcd-pixel-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  background-image: 
    linear-gradient(rgba(18, 33, 12, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(18, 33, 12, 0.04) 1px, transparent 1px);
  background-size: 3px 3px;
  z-index: 12;
}

/* LCD Layers */
.lcd-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  padding: 4px 6px;
  display: flex;
  flex-direction: column;
}

/* Header & Softkey Guides */
.lcd-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 15px;
  line-height: 1;
  border-bottom: 1.5px solid var(--lcd-pixel);
  padding-bottom: 2px;
  font-weight: bold;
}

.lcd-center-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 3px;
}

.lcd-prompt {
  font-size: 17px;
  letter-spacing: 1px;
}

.input-wrapper input {
  font-family: 'VT323', monospace;
  font-size: 24px;
  width: 120px;
  background: transparent;
  border: none;
  border-bottom: 2px dashed var(--lcd-pixel);
  text-align: center;
  color: var(--lcd-pixel);
  outline: none;
  text-transform: uppercase;
}

.input-wrapper input::placeholder {
  color: rgba(18, 33, 12, 0.35);
}

.lcd-subtext {
  font-size: 13px;
  color: var(--lcd-pixel);
}

.lcd-softkey-bar {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: bold;
  border-top: 1.5px solid var(--lcd-pixel);
  padding-top: 2px;
  margin-top: auto;
}

/* ---------------- Authentic Nokia Snake Gameplay Screen Layout ----------------
   Top bar: Level on left, large Score on right
   Board: Enclosed within solid authentic LCD border wall
--------------------------------------------------------------------------------- */
.nokia-game-topbar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0 2px 2px 2px;
  font-size: 15px;
  font-weight: bold;
  line-height: 1;
}

.level-indicator {
  font-size: 13px;
  letter-spacing: 0.5px;
}

.score-indicator {
  font-size: 16px;
  letter-spacing: 1px;
}

.canvas-board-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

#game-canvas {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  background-color: var(--lcd-bg);
  border: 1.5px solid var(--lcd-pixel);
  box-shadow: inset 0 0 0 1px var(--lcd-bg);
}

/* Game Over & High Scores Board Screen */
.lcd-title-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 15px;
  font-weight: bold;
  border-bottom: 1.5px solid var(--lcd-pixel);
  padding-bottom: 2px;
}

.top-score-tag {
  font-size: 13px;
}

.leaderboard-container {
  flex: 1;
  overflow-y: auto;
  margin: 2px 0;
  scrollbar-width: none;
}

.leaderboard-container::-webkit-scrollbar {
  display: none;
}

.no-scores-msg {
  text-align: center;
  padding: 18px 0;
  font-size: 14px;
  color: var(--lcd-pixel);
}

#leaderboard-list {
  list-style: none;
  padding: 0 2px;
  font-size: 14px;
  line-height: 1.25;
}

#leaderboard-list li {
  display: flex;
  justify-content: space-between;
  padding: 1px 2px;
}

#leaderboard-list li.highlight-score {
  background-color: var(--lcd-pixel);
  color: var(--lcd-bg);
  font-weight: bold;
}

/* ---------------- 100% Real Keypad Interactive Hotspot Layer ---------------- */
.keypad-touch-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: auto;
  z-index: 20;
}

.key-touch-btn {
  position: absolute;
  background: transparent;
  border: none;
  outline: none;
  cursor: pointer;
  border-radius: 16px;
  -webkit-tap-highlight-color: transparent;
}

/* Direction navigation keys (Up/Down rocker and numpad arrows) do NOT flash */
.key-touch-btn.nav-no-flash:hover,
.key-touch-btn.nav-no-flash:active,
.key-touch-btn.nav-no-flash.key-pressed {
  background-color: transparent !important;
  box-shadow: none !important;
  transform: none !important;
}

/* General button tactile feel when clicked with mouse (excluding arrows) */
.key-touch-btn:not(.nav-no-flash):hover {
  background-color: rgba(255, 255, 255, 0.08);
}

.key-touch-btn:not(.nav-no-flash):active, 
.key-touch-btn:not(.nav-no-flash).key-pressed {
  background-color: rgba(56, 189, 248, 0.3);
  box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.7);
  transform: scale(0.96);
}

#btn-top-power {
  border-radius: 50%;
}

#btn-scroll-up {
  border-radius: 12px 12px 3px 3px;
}

#btn-scroll-down {
  border-radius: 3px 3px 12px 12px;
}

#btn-soft-menu, #btn-soft-names, #btn-call, #btn-hang {
  border-radius: 18px;
}

/* ---------------- Desktop Manual / Side Panel ---------------- */
.desktop-manual {
  max-width: 360px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid #334155;
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 20px 35px -8px rgba(0, 0, 0, 0.7);
}

.desktop-manual h2 {
  font-size: 21px;
  color: #38bdf8;
  border-bottom: 1px solid #334155;
  padding-bottom: 10px;
  margin-bottom: 16px;
  letter-spacing: 1px;
}

.manual-section {
  margin-bottom: 16px;
}

.manual-section h3 {
  font-size: 15px;
  color: #e2e8f0;
  margin-bottom: 6px;
}

.manual-section ul {
  list-style: none;
  font-size: 14px;
  color: #94a3b8;
  line-height: 1.6;
}

.manual-section ul li strong {
  color: #f1f5f9;
}

.manual-section p {
  font-size: 13px;
  color: #94a3b8;
  line-height: 1.5;
  margin-bottom: 5px;
}

@media (max-width: 768px) {
  .desktop-manual {
    display: none;
  }
}
