
        * {
            box-sizing: border-box;
        }

        html,
        body {
            background-color: #000;
            height: 100%;
            margin: 0;
            padding: 0;
        }

        body {
            background: #222;
            background: radial-gradient(#333, #111);
            background-position: center center;
            background-repeat: no-repeat;
            background-size: cover;
            color: #fff;
            font: 100%/1.5 sans-serif;
            overflow: hidden;
        }

        /* ===== START SCREEN ===== */
        .start-screen {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            z-index: 100;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            background: radial-gradient(ellipse at center, #1a2a1a 0%, #0a0a0a 100%);
            transition: opacity 0.5s ease;
            opacity: 1;
        }

        .start-screen.hidden {
            opacity: 0;
            pointer-events: none;
            visibility: hidden;
            display: none !important;
        }

        .start-screen .game-title {
            font-size: 72px;
            font-weight: 900;
            color: #4caf50;
            text-shadow: 0 0 30px rgba(76, 175, 80, 0.6), 0 0 60px rgba(76, 175, 80, 0.3);
            margin-bottom: 10px;
            letter-spacing: 8px;
            text-transform: uppercase;
            animation: titlePulse 2s ease-in-out infinite;
        }

        @keyframes titlePulse {
            0%, 100% { text-shadow: 0 0 30px rgba(76, 175, 80, 0.6), 0 0 60px rgba(76, 175, 80, 0.3); }
            50% { text-shadow: 0 0 50px rgba(76, 175, 80, 0.9), 0 0 100px rgba(76, 175, 80, 0.5); }
        }

        .start-screen .subtitle {
            font-size: 16px;
            color: rgba(255, 255, 255, 0.4);
            margin-bottom: 50px;
            letter-spacing: 4px;
            text-transform: uppercase;
        }

        .start-screen .high-score-display {
            font-size: 18px;
            color: rgba(255, 215, 0, 0.7);
            margin-bottom: 30px;
            letter-spacing: 2px;
        }

        .start-screen .high-score-display span {
            color: #ffd700;
            font-weight: bold;
            font-size: 24px;
            text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
        }

        .start-btn, .restart-btn {
            padding: 18px 60px;
            font-size: 22px;
            font-weight: 700;
            color: #fff;
            background: linear-gradient(135deg, #4caf50 0%, #2e7d32 100%);
            border: none;
            border-radius: 50px;
            cursor: pointer;
            letter-spacing: 3px;
            text-transform: uppercase;
            transition: all 0.3s ease;
            box-shadow: 0 5px 30px rgba(76, 175, 80, 0.4);
            position: relative;
            overflow: hidden;
        }

        .start-btn:hover, .restart-btn:hover {
            transform: translateY(-3px) scale(1.05);
            box-shadow: 0 8px 40px rgba(76, 175, 80, 0.6);
            background: linear-gradient(135deg, #66bb6a 0%, #388e3c 100%);
        }

        .start-btn:active, .restart-btn:active {
            transform: translateY(0) scale(0.98);
        }

        .start-screen .controls-info {
            margin-top: 40px;
            text-align: center;
            color: rgba(255, 255, 255, 0.3);
            font-size: 14px;
        }

        .controls-info .keys {
            display: flex;
            gap: 8px;
            justify-content: center;
            margin-top: 10px;
        }

        .controls-info .key {
            width: 40px;
            height: 40px;
            border: 1px solid rgba(255, 255, 255, 0.2);
            border-radius: 6px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 16px;
            color: rgba(255, 255, 255, 0.4);
            background: rgba(255, 255, 255, 0.05);
        }

        /* ===== SNAKE BACKGROUND ANIMATION ===== */
        .snake-bg-canvas {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            opacity: 0.15;
        }

        /* ===== GAME OVER SCREEN ===== */
        .gameover-screen {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            z-index: 100;
            display: none;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            background: rgba(0, 0, 0, 0);
            pointer-events: none;
            opacity: 0;
        }

        .gameover-screen.active {
            display: flex;
            background: rgba(0, 0, 0, 0.85);
            pointer-events: all;
            opacity: 1;
        }

        .gameover-screen .gameover-title {
            font-size: 56px;
            font-weight: 900;
            color:#66bb6a;
            text-shadow: 0 0 30px #2e7d32;
            margin-bottom: 10px;
            letter-spacing: 5px;
            text-transform: uppercase;
            animation: popIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
        }

        @keyframes popIn {
            0% { transform: scale(0.5); opacity: 0; }
            100% { transform: scale(1); opacity: 1; }
        }

        .gameover-screen .final-score {
            font-size: 20px;
            color: rgba(255, 255, 255, 0.6);
            margin-bottom: 5px;
            letter-spacing: 3px;
            text-transform: uppercase;
            animation: fadeInUp 0.5s ease 0.2s both;
        }

        .gameover-screen .final-score-value {
            font-size: 80px;
            font-weight: 900;
            color: #fff;
            text-shadow: 0 0 30px rgba(255, 255, 255, 0.3);
            margin-bottom: 10px;
            animation: fadeInUp 0.5s ease 0.4s both;
        }

        @keyframes fadeInUp {
            0% { opacity: 0; transform: translateY(20px); }
            100% { opacity: 1; transform: translateY(0); }
        }

        .gameover-screen .new-high-score {
            font-size: 18px;
            color: #ffd700;
            text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
            margin-bottom: 5px;
            letter-spacing: 3px;
            text-transform: uppercase;
            display: none;
        }

        .gameover-screen .new-high-score.show {
            display: block;
            animation: newHighPulse 1s ease-in-out infinite;
        }

        @keyframes newHighPulse {
            0%, 100% { opacity: 1; transform: scale(1); }
            50% { opacity: 0.7; transform: scale(1.1); }
        }

        .gameover-screen .high-score-info {
            font-size: 16px;
            color: rgba(255, 215, 0, 0.6);
            margin-bottom: 35px;
            letter-spacing: 2px;
            animation: fadeInUp 0.5s ease 0.5s both;
        }

        .gameover-screen .high-score-info span {
            color: #ffd700;
            font-weight: bold;
            font-size: 22px;
        }

        .gameover-screen .restart-btn {
            animation: fadeInUp 0.5s ease 0.7s both;
            background: linear-gradient(135deg, #31e02e 0%, #c62828 100%);
            box-shadow: 0 5px 30px rgba(244, 67, 54, 0.4);
        }

        .gameover-screen .restart-btn:hover {
            box-shadow: 0 8px 40px rgba(55, 161, 29, 0.6);
            background: linear-gradient(135deg, #ef5350 0%, #d32f2f 100%);
        }

        /* ===== GAME ELEMENTS ===== */
        .score {
            color: rgba(255, 255, 255, 0.5);
            font-size: 40px;
            font-weight: bold;
            padding-top: 5px;
            text-align: center;
            position: relative;
            z-index: 3;
        }

        .stage {
            bottom: 0;
            left: 0;
            margin: auto;
            position: absolute;
            right: 0;
            top: 2cm;
            ;
            z-index: 2;
        }

        .tile {
            background: rgba(0, 0, 0, 0.15);
            position: absolute;
            transition-property: background, box-shadow, opacity, transform;
            transform: translateZ(0);
            transition-duration: 3000ms;
        }

        .tile:before {
            bottom: 0;
            content: '';
            height: 0;
            left: 0;
            margin: auto;
            opacity: 0;
            position: absolute;
            right: 0;
            top: 0;
            width: 0;
            transition: opacity 300ms;
        }

        .tile.path:before { opacity: 1; }
        .tile.up:before {
            border-bottom: 4px inset rgba(255, 255, 255, 0.15);
            border-left: 4px solid transparent;
            border-right: 4px solid transparent;
        }
        .tile.down:before {
            border-top: 4px inset rgba(255, 255, 255, 0.15);
            border-left: 4px solid transparent;
            border-right: 4px solid transparent;
        }
        .tile.left:before {
            border-right: 4px inset rgba(255, 255, 255, 0.15);
            border-top: 4px solid transparent;
            border-bottom: 4px solid transparent;
        }
        .tile.right:before {
            border-left: 4px inset rgba(255, 255, 255, 0.15);
            border-top: 4px solid transparent;
            border-bottom: 4px solid transparent;
        }

        @media (max-width: 900px), (max-height: 900px) {
            .tile.up:before, .tile.down:before,
            .tile.left:before, .tile.right:before { border-width: 3px; }
            .start-screen .game-title { font-size: 48px; }
            .gameover-screen .gameover-title { font-size: 40px; }
            .gameover-screen .final-score-value { font-size: 60px; }
        }

        @media (max-width: 500px), (max-height: 500px) {
            .tile.up:before, .tile.down:before,
            .tile.left:before, .tile.right:before { border-width: 2px; }
            .start-screen .game-title { font-size: 36px; letter-spacing: 4px; }
            .start-btn, .restart-btn { padding: 14px 40px; font-size: 18px; }
            .gameover-screen .gameover-title { font-size: 32px; }
            .gameover-screen .final-score-value { font-size: 48px; }
        }

        .tile.pressed {
            background: rgba(0, 0, 0, 0.3);
            box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.6);
            transition-duration: 0ms;
        }

        /* Hide game elements before game starts */
        .game-wrapper {
            display: none;
        }
        .game-wrapper.visible {
            display: block;
        }

        /* Touch controls */
        .touch-controls {
            position: fixed;
            bottom: 20px;
            left: 50%;
            transform: translateX(-50%);
            z-index: 50;
            display: none;
        }

        @media (hover: none) and (pointer: coarse) {
            .touch-controls.game-active { display: block; }
        }

        .touch-controls .d-pad {
            display: grid;
            grid-template-columns: 60px 60px 60px;
            grid-template-rows: 60px 60px 60px;
            gap: 4px;
        }

        .touch-controls .d-btn {
            background: rgba(255, 255, 255, 0.1);
            border: 1px solid rgba(255, 255, 255, 0.15);
            border-radius: 10px;
            color: rgba(255, 255, 255, 0.4);
            font-size: 20px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            -webkit-tap-highlight-color: transparent;
            user-select: none;
        }

        .touch-controls .d-btn:active {
            background: rgba(255, 255, 255, 0.25);
        }

        .d-up { grid-column: 2; grid-row: 1; }
        .d-left { grid-column: 1; grid-row: 2; }
        .d-right { grid-column: 3; grid-row: 2; }
        .d-down { grid-column: 2; grid-row: 3; }
        /* ===== FOOTER ===== */
footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  text-align: center;
  padding: 10px 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  color: rgba(255, 255, 255, 0.6);
  font-size: 14px;
  z-index: 40; /* below touch controls (z-index 50) */
  pointer-events: none; /* allow clicks to pass through to game */
}

footer a {
  color: #4caf50;
  text-decoration: none;
  pointer-events: auto; /* make links clickable */
}

footer a:hover {
  text-decoration: underline;
}

.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.creator {
  margin: 0;
  font-size: 14px;
}

.creator-name {
  font-weight: bold;
}

.social-icons {
  display: flex;
  gap: 15px;
  margin: 5px 0;
}

.social-icon {
  color: rgba(255, 255, 255, 0.6);
  font-size: 18px;
  transition: color 0.3s ease;
  pointer-events: auto;
}

.social-icon:hover {
  color: #4caf50;
}

.copyright {
  margin: 0;
  font-size: 12px;
  opacity: 0.5;
}

/* Adjust for mobile so footer doesn't cover touch controls */
@media (max-width: 600px) {
  footer {
    padding: 5px 0;
    font-size: 12px;
  }
  .social-icon {
    font-size: 16px;
  }
}
    
