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

body {
    font-family: Arial, sans-serif;
    background-color: #f0f0f0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    transition: background-color 0.3s ease;
    padding-bottom: env(safe-area-inset-bottom, 30px);
}

.game-container {
    position: relative;
    width: 400px;
    margin: 0 auto;
    transition: background-color 0.3s ease;
    max-width: 100%;
    overflow: hidden;
    image-rendering: pixelated;
}

canvas {
    background-color: #f8f8f8;
    border: 2px solid #333;
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
    image-rendering: pixelated;
}

.instructions {
    margin-top: 20px;
    text-align: center;
}

/* Button container for aligned buttons */
.button-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 10px;
    flex-wrap: wrap;
}

button {
    padding: 10px 20px;
    font-size: 16px;
    background-color: #97C21D;
    color: white !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

button:hover {
    background-color: #85AB1A;
}

/* Night mode toggle button */
.night-mode-toggle {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background-color: #333333;
    color: white;
    font-size: 22px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 100;
    padding: 0;
    margin: 0;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    border: none;
    outline: none;
}

.night-mode-toggle:hover {
    background-color: #444444;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* Sound toggle button */
.sound-toggle {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background-color: #3498db;
    color: white;
    font-size: 22px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 100;
    padding: 0;
    margin: 0;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    border: none;
    outline: none;
}

.sound-toggle:hover {
    background-color: #2980b9;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* Style for the sound icon container */
#soundIcon {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
}

/* Style for the sound SVG icons */
.sound-on-icon, .sound-off-icon {
    stroke: white;
    stroke-width: 2;
}

/* Dark mode styles */
body.dark-mode {
    background-color: #000000;
    color: #ffffff;
}

.game-container.dark-mode {
    background-color: #000000;
}

.instructions.dark-mode {
    color: #ffffff;
}

/* Make sure the canvas border is visible in dark mode */
.dark-mode canvas {
    border-color: #444444;
}

/* Style for the night mode icon container */
#nightModeIcon {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
}

/* Style for the SVG icons */
.moon-icon, .sun-icon {
    stroke: white;
    stroke-width: 2;
}

.sun-icon {
    fill: rgba(255, 255, 255, 0.2);
}

/* Dark mode specific styles for the toggle button */
body.dark-mode .night-mode-toggle {
    background-color: #555555;
}

/* Dark mode specific styles for the sound toggle button */
body.dark-mode .sound-toggle {
    background-color: #2980b9;
}

/* Mobile-specific styles */
.mobile-device {
    -webkit-touch-callout: none; /* Disable callout on tap */
    -webkit-user-select: none;   /* Disable selection */
    -webkit-tap-highlight-color: rgba(0,0,0,0); /* Remove tap highlight */
    touch-action: manipulation;  /* Optimization for touch */
    overflow-x: hidden;
    position: relative;
}

/* iOS specific styles */
.ios-device {
    /* iOS-specific optimizations */
    -webkit-overflow-scrolling: touch;
}

/* Permission overlay for motion controls */
.permission-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000; /* Ensure it's above everything else */
}

.permission-dialog {
    background-color: white;
    border-radius: 12px;
    padding: 20px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.permission-dialog h2 {
    margin-top: 0;
    color: #333;
    font-size: 1.3rem;
}

.permission-dialog p {
    margin-bottom: 20px;
    font-size: 0.95rem;
    color: #555;
    line-height: 1.4;
}

.permission-btn {
    background-color: #97C21D; /* Match game button color */
    color: white;
    border: none;
    border-radius: 50px;
    padding: 12px 20px;
    font-size: 1rem;
    font-weight: bold;
    margin-bottom: 10px;
    width: 100%;
    cursor: pointer;
}

.skip-btn {
    background-color: transparent;
    color: #666;
    border: 1px solid #ccc;
    border-radius: 50px;
    padding: 10px 20px;
    font-size: 0.9rem;
    width: 100%;
    cursor: pointer;
}

/* Game notification toast */
.game-notification {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 24px;
    border-radius: 30px;
    font-size: 0.9rem;
    z-index: 900;
    opacity: 0;
    transition: opacity 0.3s;
    /* Hide notifications on mobile */
    @media (max-width: 768px) {
        display: none;
    }
    text-align: center;
    max-width: 90%;
}

/* Responsive canvas container */
@media (max-width: 430px) {
    body {
        padding: 10px;
        min-height: 100%;
        height: auto;
        align-items: flex-start;
        overflow-x: hidden;
        width: 100%;
    }
    
    .game-container {
        width: 100%;
        max-width: 100%;
        padding: 10px;
        margin: 0 auto;
        height: auto;
        max-height: 80vh;
        display: flex;
        flex-direction: column;
        padding-bottom: 20px;
    }
    
    canvas {
        /* Ensure canvas fits within viewport */
        border: 2px solid #333;
        border-radius: 8px;
        width: 100% !important;
        height: auto !important;
        max-height: 75vh;
        object-fit: contain;
        margin: 0 auto;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    }
    
    .instructions {
        padding: 0 10px;
        margin-top: 8px;
        margin-bottom: 8px;
        width: 100%;
    }
    
    .instructions p {
        font-size: 0.85rem;
        margin-bottom: 5px;
    }
    
    .button-container {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 8px;
        margin: 10px 0;
    }
    
    #startButton {
        order: -1; /* Ensure start button is always at the top */
        width: 180px;
        height: 48px;
        display: block !important;
        margin: 10px auto;
        font-size: 18px;
        border-radius: 24px;
    }
    
    /* Mobile controls container */
    .mobile-controls-container {
        background-color: rgba(0, 0, 0, 0.05);
        border-radius: 12px;
        padding: 15px;
        margin-top: 5px;
        margin-bottom: 15px;
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    
    /* Fix the container for sound and night mode buttons */
    .mobile-device .button-container {
        display: flex !important;
        flex-direction: column;
        align-items: center;
    }
    
    /* Create a row for the toggle buttons */
    .toggle-buttons-row {
        display: flex !important;
        flex-direction: row !important;
        justify-content: center;
        gap: 30px;
        margin-top: 5px;
    }
    
    /* Hide tilt controls button */
    .tilt-btn {
        display: none !important;
    }
}

/* Fix for iOS safe areas */
@supports (padding-top: env(safe-area-inset-top)) {
    body {
        padding-top: env(safe-area-inset-top, 10px);
        padding-bottom: calc(env(safe-area-inset-bottom, 10px) + 10px);
        padding-left: env(safe-area-inset-left, 10px);
        padding-right: env(safe-area-inset-right, 10px);
    }
}

/* Tilt controls button - hidden by default on mobile now */
.tilt-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background-color: #FF9800;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 100;
    padding: 0;
    margin: 0;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    border: none;
    outline: none;
}

.tilt-btn:hover {
    background-color: #F57C00;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* Add CSS for iOS safe areas */
@supports (padding: max(0px)) {
  .ios-device .game-container {
    padding-bottom: max(20px, env(safe-area-inset-bottom));
  }
}

/* Ensure instructions have enough bottom margin on mobile */
@media (max-width: 430px) {
  .instructions {
    margin-bottom: 15px;
  }
  
  .ios-device .instructions {
    padding-bottom: 15px;
  }
}

/* Style the row of toggle buttons */
.toggle-buttons-row {
    display: flex;
    gap: 15px;
}

/* Make sure SVG icons are properly sized and centered within buttons */
.sound-toggle svg, 
.night-mode-toggle svg {
    width: 24px;
    height: 24px;
    margin: auto;
    display: block;
}

/* PWA Prompt Styles */
.pwa-prompt {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  animation: slideUp 0.3s ease-out forwards;
  height: 100%;
}

@keyframes slideUp {
  from { opacity: 0; }
  to { opacity: 1; }
}

.pwa-prompt-hidden {
  animation: slideDown 0.3s ease-in forwards;
}

@keyframes slideDown {
  from { opacity: 1; }
  to { opacity: 0; }
}

.pwa-prompt-content {
  background-color: white;
  border-radius: 12px 12px 0 0;
  width: 100%;
  max-width: 500px;
  padding: 20px;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
}

.pwa-prompt-content h3 {
  margin-top: 0;
  font-size: 20px;
  color: #333;
  text-align: center;
}

.pwa-prompt-content p {
  margin: 10px 0;
  color: #666;
  font-size: 16px;
}

.pwa-prompt-steps {
  margin: 20px 0;
}

.pwa-step {
  display: flex;
  align-items: center;
  margin-bottom: 15px;
}

.pwa-step-number {
  width: 25px;
  height: 25px;
  background-color: #4CAF50;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 10px;
  font-weight: bold;
}

.pwa-prompt-close {
  background-color: #4CAF50;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 16px;
  cursor: pointer;
  display: block;
  margin: 15px auto 5px;
  width: 80%;
  max-width: 200px;
}

.pwa-prompt svg {
  vertical-align: middle;
}

/* Dark mode button fixes */
body.dark-mode .button-container button#startButton {
    background-color: #7ba216;
    color: white !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Ensure toggle buttons are always visible */
.toggle-buttons-row {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Make sure these elements are always displayed */
#startButton, #soundToggle, #nightModeToggle {
    display: block !important;
    visibility: visible !important;
} 