:root {
    --primary-color: #4CAF50;
    --secondary-color: #2E7D32;
    --accent-color: #FFC107;
    --background-color: #F5F5F5;
    --text-color: #333333;
    --menu-bg-color: rgba(255, 255, 255, 0.9);
    --border-radius: 8px;
    --shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Arial', sans-serif;
}

body {
    background-color: var(--background-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.game-container {
    max-width: 800px;
    width: 100%;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

header {
    width: 100%;
    text-align: center;
    margin-bottom: 20px;
}

h1 {
    color: var(--primary-color);
    margin-bottom: 15px;
}

.score-container {
    display: flex;
    justify-content: space-around;
    width: 100%;
    margin-bottom: 15px;
}

.score-box, .coin-box {
    background-color: white;
    padding: 8px 15px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 5px;
}

.coin-icon {
    font-size: 1.2em;
}

.canvas-container {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 100%;
    max-width: 600px;
    max-height: 600px;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    background-color: #263238;
}

#gameCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: transparent;
    background-image: url('images/forest-bg.png');
    background-size: cover;
    background-position: center;
}

.menu {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: var(--menu-bg-color);
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    text-align: center;
    min-width: 280px;
    max-width: 90%;
}

.menu h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
}

.difficulty-selector, .skin-selector {
    margin: 15px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    margin: 10px 0;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s;
    width: 100%;
}

button:hover {
    background-color: var(--secondary-color);
}

select {
    padding: 8px;
    border-radius: var(--border-radius);
    border: 1px solid #ddd;
    background-color: white;
}

.hidden {
    display: none !important;
}

.touch-controls {
    margin-top: 20px;
    display: none;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 200px;
}

.horizontal-controls {
    display: flex;
    width: 100%;
    justify-content: space-between;
    margin: 10px 0;
}

.control-btn {
    width: 60px;
    height: 60px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.control-btn:active {
    background-color: var(--secondary-color);
}

.game-controls {
    margin-top: 20px;
    display: flex;
    justify-content: space-around;
    width: 100%;
}

.control-action-btn {
    flex: 1;
    max-width: 120px;
    margin: 0 5px;
}

.ad-container {
    width: 100%;
    margin: 15px 0;
    border-radius: var(--border-radius);
    overflow: hidden;
}

.ad-placeholder {
    background-color: #f0f0f0;
    color: #888;
    text-align: center;
    padding: 20px;
    border: 1px dashed #ccc;
}

.final-score {
    background-color: white;
    padding: 10px;
    border-radius: var(--border-radius);
    margin: 15px 0;
    font-size: 1.2em;
    font-weight: bold;
}

.achievement {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--accent-color);
    color: var(--text-color);
    padding: 10px 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    animation: fade-in-out 3s forwards;
}

@keyframes fade-in-out {
    0% { opacity: 0; }
    10% { opacity: 1; }
    80% { opacity: 1; }
    100% { opacity: 0; }
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background-color: white;
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    max-width: 90%;
    max-height: 90%;
    overflow-y: auto;
    position: relative;
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    cursor: pointer;
    color: #888;
}

.shop-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.shop-item {
    background-color: #f9f9f9;
    border-radius: var(--border-radius);
    padding: 15px;
    text-align: center;
    box-shadow: var(--shadow);
}

.item-image {
    width: 100px;
    height: 100px;
    margin: 0 auto 15px;
    border-radius: var(--border-radius);
}

.rainbow-skin {
    background: linear-gradient(45deg, red, orange, yellow, green, blue, indigo, violet);
}

.pixel-skin {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20"><rect width="10" height="10" fill="%234CAF50"/><rect x="10" y="0" width="10" height="10" fill="%232E7D32"/><rect x="0" y="10" width="10" height="10" fill="%232E7D32"/><rect x="10" y="10" width="10" height="10" fill="%234CAF50"/></svg>');
    background-size: 20px 20px;
}

.emoji-food {
    background-color: #f8f8f8;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 40px;
}

.emoji-food::after {
    content: "🍎";
}

.settings-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 20px 0;
}

.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary-color);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.performance-panel {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px;
    border-radius: var(--border-radius);
    font-size: 12px;
    z-index: 100;
}

@media (max-width: 768px) {
    .score-container {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
    
    .score-box, .coin-box {
        width: 80%;
    }
    
    .touch-controls {
        display: flex;
    }
}

.snake-body {
    background-color: #4a148c;
}

.snake-head {
    background-color: #6a1b9a;
}

.food {
    background-color: #f44336;
    border-radius: 50%;
} 