@font-face {
    font-family: 'Frankfurter';
    src: url('assets/fonts/Franxurter-w11D9.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

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

body {
  background: #fff5f8;
  font-family: 'Quicksand', sans-serif;
  min-height: 100vh;
  min-height: -webkit-fill-available;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0;
  padding-top: env(safe-area-inset-top);
  overflow: hidden;
  position: fixed;
  width: 100%;
  height: 100%;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.game-container {
  width: 100%;
  max-width: 500px;
  height: 100vh;
  height: -webkit-fill-available;
  padding: 16px;
  padding-top: max(16px, env(safe-area-inset-top));
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 12px;
}

h1 {
  color: #ff66a3;
  font-family: 'Frankfurter', 'Arial Rounded MT Bold', 'Arial', sans-serif;
  font-size: 1.8rem;
  margin: 8px 0 16px 0;
  text-shadow: 0 2px 4px rgba(255, 102, 163, 0.15);
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, #ff85b3, #ff66a3);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  padding: env(safe-area-inset-top) 0 0 0;
  position: relative;
  display: inline-block;
  margin: 0 auto;
}

h1::after {
  display: none;
}

.character-select {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin: 0 auto;
  width: 100%;
  max-width: 400px;
  padding: 20px 0;
}

.character-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding: 0 8px;
  margin-bottom: 32px;
}

.character-option {
  background: white;
  border-radius: 16px;
  padding: 8px 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.character-option.selected {
  transform: scale(1.05);
  box-shadow: 0 8px 20px rgba(255, 102, 163, 0.25);
  border: 3px solid #ff66a3;
}

.character-option img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  margin-bottom: 2px;
}

.character-option span {
  display: block;
  margin-top: 3px;
  font-size: 0.7rem;
  color: #666;
  font-weight: 600;
}

/* Hide game screen and controls initially */
#gameScreen {
    display: none; /* Start hidden */
    flex: 1;
    flex-direction: column;
    margin: 8px 0;
    padding: 12px;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.1));
    backdrop-filter: blur(10px);
    position: relative;
    max-height: calc(100vh - 140px);
    overflow: hidden;
}

/* Show game screen when active */
#gameScreen.active {
    display: flex;
}

/* Game controls container at top */
.game-controls {
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    z-index: 10;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    backdrop-filter: blur(4px);
    box-shadow: 0 4px 20px rgba(255, 102, 163, 0.1);
    padding: 8px 12px;
}

/* Adjust canvas position to account for controls */
#gameCanvas {
  margin-top: 80px; /* Give space for the controls */
  margin-bottom: auto;
  width: 100%;
  height: auto;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  object-fit: contain;
}

/* Move arrow controls higher */
.arrow-controls {
    position: fixed;
    bottom: 140px;
    left: 50%;
    transform: translateX(-50%);
    display: grid;
    grid-template-columns: repeat(3, 52px);
    grid-template-rows: repeat(3, 52px);
    gap: 4px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.15); /* Even more transparent */
    border-radius: 16px;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    box-shadow: 0 4px 20px rgba(255, 102, 163, 0.05);
    z-index: 10;
}

/* Position Change Character button outside game area */
#changeCharacterBtn {
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    font-size: 0.85rem;
    padding: 6px 16px;
    height: 34px;
    z-index: 5;
    margin-bottom: env(safe-area-inset-bottom, 0);
    display: none; /* Hide by default */
}

/* Show Change Character button when game is active */
#gameScreen:not([style*="display: none"]) ~ #changeCharacterBtn {
    display: block;
}

/* Hide Change Character button when character select is visible */
.character-select[style*="display: flex"] ~ #changeCharacterBtn {
    display: none !important;
}

/* Adjust game screen to not overlap with button */
.game-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin: 8px 0;
    padding: 12px;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.1));
    backdrop-filter: blur(10px);
    position: relative;
    max-height: calc(100vh - 180px); /* Increased to make room for button */
    overflow: hidden;
}

/* Adjust game stats spacing */
.game-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  gap: 12px;
  padding: 0 4px;
}

/* Make score and lives containers more compact */
.score, .lives-container {
  padding: 6px 12px;
}

.score {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.1rem;
  color: #ff66a3;
  font-weight: 600;
  position: relative;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 20px;
  box-shadow: 0 2px 8px rgba(255, 102, 163, 0.1);
}

.lives-container {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 20px;
  box-shadow: 0 2px 8px rgba(255, 102, 163, 0.1);
}

.lives-label {
  color: #ff66a3;
  font-size: 0.9rem;
  font-weight: 600;
}

.lives {
  display: flex;
  gap: 4px;
  align-items: center;
}

/* Bottom row with change character button */
.game-actions {
  display: flex;
  justify-content: center;
  width: 100%;
}

.mobile-controls {
  display: none;
  gap: 12px;
  flex-direction: column;
  align-items: center;
  margin-top: 20px;
  padding: 15px;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 20px;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 15px rgba(255, 102, 163, 0.15);
}

.horizontal-controls {
  display: flex;
  gap: 20px;
  align-items: center;
}

.control-btn {
  width: 65px;
  height: 65px;
  border-radius: 50%;
  border: none;
  background: #fff;
  color: #ff66a3;
  font-size: 24px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(255, 102, 163, 0.2),
              inset 0 -2px 5px rgba(0, 0, 0, 0.1);
}

.control-btn:active {
  transform: scale(0.95) translateY(2px);
  box-shadow: 0 2px 5px rgba(255, 102, 163, 0.2),
              inset 0 -1px 3px rgba(0, 0, 0, 0.1);
  background: #fff5f8;
}

/* Specific styling for each direction button */
#upButton i { transform: translateY(-1px); }
#downButton i { transform: translateY(1px); }
#leftButton i { transform: translateX(-1px); }
#rightButton i { transform: translateX(1px); }

/* Base button styles - update to ensure font is applied */
.primary-btn, .secondary-btn, #startButton, .start-button {
    font-family: 'Quicksand', sans-serif !important; /* Force font */
    font-weight: 600;
    font-size: 1.1rem;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: -0.2px; /* Add slight letter spacing adjustment */
}

/* Primary button style (including start button) */
.primary-btn, #startButton, .start-button {
    background: linear-gradient(to bottom, #ff85b3, #ff66a3);
    color: white;
    border: none;
    box-shadow: 0 4px 15px rgba(255, 102, 163, 0.3);
    text-rendering: optimizeLegibility; /* Improve font rendering */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.primary-btn:active, #startButton:active, .start-button:active {
    transform: scale(0.95) translateY(2px);
    box-shadow: 0 2px 8px rgba(255, 102, 163, 0.2);
    background: linear-gradient(to bottom, #ff7aa8, #ff5c99);
}

/* Ensure start button inherits all styles */
#startButton {
    display: block; /* Default to showing */
    margin: 32px auto;
    min-width: 160px;
}

/* Game over buttons specific sizes */
.game-over-buttons .primary-btn,
.game-over-buttons .secondary-btn {
    min-width: 110px;
    padding: 8px 16px;
    font-size: 0.95rem;
    white-space: nowrap;
}

.secondary-btn {
  background: white;
  color: #ff66a3;
  border: 2px solid #ff66a3;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.9rem;
}

.game-over-screen {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 245, 248, 0.95);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.game-over-content {
    background: #fff5f8;
    padding: 24px;
    border-radius: 24px;
    text-align: center;
    max-width: 320px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.game-over-icon {
    width: 72px;
    height: 72px;
    margin-bottom: 8px;
}

.treats-collected {
    background: white;
    padding: 20px;
    border-radius: 20px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(255, 102, 163, 0.15);
    border: 2px solid rgba(255, 102, 163, 0.2);
}

.character-message {
    background: white;
    padding: 16px 20px;
    border-radius: 16px;
    text-align: center;
    color: #ff66a3;
    font-size: 1.3rem;
    line-height: 1.4;
    width: 100%;
    box-shadow: 0 4px 15px rgba(255, 102, 163, 0.15);
    border: 2px solid rgba(255, 102, 163, 0.2);
}

.score-food-icon {
  width: 32px;
  height: 32px;
  object-fit: contain;
  animation: wiggle 2s ease-in-out infinite;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

#finalScore {
  font-size: 2.4rem;
  font-weight: 700;
  margin: 0 8px;
  color: #ff66a3;
  background: linear-gradient(135deg, #ff85b3, #ff66a3);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 2px 4px rgba(255, 102, 163, 0.2);
  opacity: 1 !important;
}

.game-over-content p .score-text {
  opacity: 0.7;
  font-size: 0.9rem;
  font-weight: 500;
}

.game-over-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 200px;
  margin-top: 12px;
}

.game-over-buttons button {
  width: 100%;
  padding: 12px 24px;
  font-size: 1rem;
  white-space: nowrap;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  min-height: 48px;
  line-height: 1.2;
  border-radius: 24px;
  font-weight: 600;
  opacity: 1 !important;
}

/* Make game over buttons match other CTAs */
.game-over-buttons .primary-btn,
.game-over-buttons .secondary-btn {
    width: 100%;
    padding: 10px 16px; /* Reduced horizontal padding */
    font-size: 0.95rem; /* Slightly smaller font */
    white-space: nowrap;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    min-height: 44px; /* Ensure consistent height */
    line-height: 1.2; /* Better line height for text */
}

/* Specific adjustment for Change Character button */
.game-over-buttons .secondary-btn {
    font-size: 0.9rem; /* Even smaller for longer text */
    letter-spacing: -0.3px; /* Tighten letter spacing */
}

/* Add back the bounce animation */
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* Update start button visibility control */
.start-button {
    transition: opacity 0.3s ease, transform 0.3s ease;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.start-button.hidden {
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
}

@media (max-width: 768px) {
  .game-container {
    padding: 5px;
  }
  
  h1 {
    font-size: 2.8rem;
  }
  
  .character-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .mobile-controls {
    display: flex;
  }

  .control-btn {
    width: 70px;
    height: 70px;
    font-size: 26px;
  }

  .horizontal-controls {
    gap: 25px;
  }
}

@media (max-width: 380px) {
  .control-btn {
    width: 60px;
    height: 60px;
    font-size: 22px;
  }
  
  .horizontal-controls {
    gap: 20px;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 2.4rem;
  }

  .character-option img {
    width: 80px;
    height: 80px;
  }
}

@media (max-height: 700px) {
  .game-container {
    padding: 12px;
    gap: 8px;
  }
  
  h1 {
    font-size: 1.5rem;
    margin: 4px 0 12px 0;
  }
  
  .game-screen {
    margin: 4px 0;
    padding: 8px;
  }
  
  .game-controls {
    padding: 6px 10px;
  }
  
  #gameCanvas {
    margin-top: 70px;
  }

  .arrow-controls {
    bottom: 120px; /* Adjusted for smaller screens but still in game area */
  }
  
  #changeCharacterBtn {
    bottom: 12px;
    height: 30px;
    font-size: 0.8rem;
    padding: 4px 12px;
  }
}

@media (max-height: 600px) {
  .game-container {
    padding: 12px 8px;
  }
  
  h1 {
    font-size: 1.3rem;
    margin: 12px 0 20px 0;
  }
  
  .character-grid {
    gap: 10px;
    margin-bottom: 20px;
  }
  
  #startButton {
    margin: 20px auto;
  }
}

@media (max-height: 500px) {
  .game-over-icon {
    width: 56px;
    height: 56px;
    margin-bottom: 2px;
  }
  
  .game-over-content {
    gap: 12px;
    padding: 16px;
  }
  
  .game-over-content h2 {
    font-size: 1.5rem;
  }
  
  .game-over-content p {
    padding: 10px 16px;
  }
  
  .score-food-icon {
    width: 26px;
    height: 26px;
  }
  
  #finalScore {
    font-size: 1.6rem;
  }

  .game-over-buttons {
    margin-top: 12px;
    gap: 6px;
  }
  
  .game-over-buttons .primary-btn,
  .game-over-buttons .secondary-btn {
    padding: 8px 16px;
    font-size: 0.85rem;
    min-height: 38px;
  }

  .score-icon {
    width: 28px;
    height: 28px;
  }
}

/* Responsive adjustments */
@media (max-width: 500px) {
    .game-container {
        padding: 12px;
        padding-top: max(12px, env(safe-area-inset-top));
    }
    
    .game-screen {
        margin: 8px 0;
        padding: 8px;
        max-height: calc(100vh - 140px);
    }
    
    .game-controls {
        padding: 6px 12px;
    }
}

/* iPhone specific adjustments */
@supports (-webkit-touch-callout: none) {
    .game-container {
        height: -webkit-fill-available;
    }
    
    .game-screen {
        max-height: calc(100vh - 180px - env(safe-area-inset-top));
    }
}

/* Control preference styling */
.control-preference {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 24px;
    padding: 0 16px;
}

.control-option {
    flex: 1;
    max-width: 160px;
    background: white;
    border-radius: 16px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-option input {
    display: none;
}

.control-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #666;
    font-size: 0.9rem;
    font-weight: 600;
}

.control-label i {
    font-size: 1.1rem;
    color: #ff66a3;
}

.control-option:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(255, 102, 163, 0.15);
}

.control-option input:checked + .control-label {
    color: #ff66a3;
}

.control-option input:checked + .control-label i {
    color: #ff66a3;
}

.control-option input:checked + .control-label::after {
    content: '✓';
    margin-left: 4px;
    color: #ff66a3;
}

/* Mobile arrow controls - keyboard style in cross layout */
.arrow-controls {
    position: fixed;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    display: grid;
    grid-template-columns: repeat(3, 56px);
    grid-template-rows: repeat(3, 56px);
    gap: 4px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 20px rgba(255, 102, 163, 0.15);
    z-index: 100;
}

/* Keep buttons more solid for usability */
.arrow-btn {
    background: rgba(255, 255, 255, 0.95); /* Keep buttons more visible */
    width: 54px;
    height: 54px;
    border-radius: 12px;
    border: 2px solid #ff66a3;
    box-shadow: 
        0 4px 0 #ff66a3,
        0 4px 12px rgba(255, 102, 163, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #ff66a3;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: all 0.1s ease;
}

.arrow-btn:active {
    transform: translateY(4px);
    box-shadow: 
        0 0 0 #ff66a3,
        0 0 4px rgba(255, 102, 163, 0.2);
}

/* Position buttons in cross shape */
.arrow-btn.up {
    grid-column: 2;
    grid-row: 1;
}

.arrow-btn.left {
    grid-column: 1;
    grid-row: 2;
}

.arrow-btn.down {
    grid-column: 2;
    grid-row: 3;
}

.arrow-btn.right {
    grid-column: 3;
    grid-row: 2;
}

/* Empty cells for diagonal spaces */
.arrow-controls::before {
    content: "";
    grid-column: 1;
    grid-row: 1;
}

.arrow-controls::after {
    content: "";
    grid-column: 3;
    grid-row: 3;
}

/* Responsive adjustments */
@media (max-height: 700px) {
    .arrow-controls {
        bottom: 120px; /* Adjusted for smaller screens but still in game area */
    }
    
    .game-controls {
        padding: 6px 10px;
    }
    
    #gameCanvas {
        margin-top: 70px;
    }
}

.score-icon {
    width: 28px;
    height: 28px;
    object-fit: contain;
    animation: wiggle 2s ease-in-out infinite;
}

/* Update score increment styles for better animation */
.score-increment {
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    color: #ff66a3;
    font-size: 0.9rem;
    font-weight: 600;
    opacity: 0;
    margin-left: 6px;
    pointer-events: none;
    letter-spacing: -0.5px; /* Make +1 more compact */
    filter: blur(0.2px);
    text-shadow: 
        0 0 6px rgba(255, 102, 163, 0.4),
        0 0 2px rgba(255, 255, 255, 0.8);
}

.score-increment::before {
    content: '+1';
    display: inline-block;
    transform: scale(0.95); /* Slightly compress the text */
}

.score-increment.animate {
    animation: scorePopup 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes scorePopup {
    0% {
        opacity: 0;
        transform: translate(0, -50%) scale(0.8);
        filter: blur(2px);
    }
    20% {
        opacity: 1;
        transform: translate(0, -120%) scale(1.1);
        filter: blur(0.2px);
    }
    80% {
        opacity: 1;
        transform: translate(0, -120%) scale(1.1);
        filter: blur(0.2px);
    }
    100% {
        opacity: 0;
        transform: translate(0, -150%) scale(0.9);
        filter: blur(2px);
    }
}

.life-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
    transform-origin: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: floatBow 3s ease-in-out infinite;
    filter: drop-shadow(0 2px 4px rgba(255, 102, 163, 0.2));
}

.life-icon:nth-child(2) {
    animation-delay: -1s;
}

.life-icon:nth-child(3) {
    animation-delay: -2s;
}

.life-icon.lost {
    transform: scale(0.8);
    opacity: 0.15;
    animation: loseLife 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    filter: none;
}

@keyframes wiggle {
    0%, 100% {
        transform: rotate(-5deg);
    }
    50% {
        transform: rotate(5deg);
    }
}

@keyframes floatBow {
    0%, 100% {
        transform: translateY(0) rotate(-2deg);
    }
    50% {
        transform: translateY(-2px) rotate(2deg);
    }
}

@keyframes loseLife {
    0% {
        transform: scale(1) rotate(-2deg);
        opacity: 1;
    }
    15% {
        transform: scale(1.2) rotate(5deg);
        opacity: 0.8;
    }
    30% {
        transform: scale(1.1) rotate(-5deg);
        opacity: 0.6;
    }
    100% {
        transform: scale(0.8) rotate(0);
        opacity: 0.15;
    }
}

/* Life lost overlay animation */
.life-lost-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 102, 163, 0.1);
    pointer-events: none;
    opacity: 0;
    z-index: 1000;
    transition: opacity 0.3s ease;
}

.life-lost-overlay.visible {
    opacity: 1;
}

.life-lost-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1000;
}

.life-lost-screen.visible {
    opacity: 1;
    pointer-events: auto;
}

.life-lost-content {
    background: white;
    padding: 24px;
    border-radius: 24px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(255, 102, 163, 0.15);
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 320px;
    width: 90%;
}

.life-lost-screen.visible .life-lost-content {
    transform: translateY(0);
}

.life-lost-icon {
    width: 120px;
    height: 120px;
    object-fit: contain;
    margin-bottom: 16px;
}

.life-lost-screen h2 {
    color: #ff66a3;
    font-size: 1.6rem;
    margin-bottom: 8px;
    font-family: 'Quicksand', 'Arial', sans-serif !important;
}

.life-lost-text {
    color: #ff66a3;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.life-lost-encouragement {
    color: #666;
    font-size: 0.95rem;
    margin-bottom: 20px;
}

#livesLeftText {
    font-size: 1.2rem;
    font-weight: 700;
    color: #ff66a3;
}

#continueButton {
    min-width: 160px;
}

.treats-collected {
    background: linear-gradient(135deg, #fff5f8, #fff);
    padding: 20px 24px;
    border-radius: 24px;
    margin: 12px 0;
    box-shadow: 
        0 4px 15px rgba(255, 102, 163, 0.15),
        inset 0 2px 4px rgba(255, 255, 255, 0.8);
    border: 2px solid rgba(255, 102, 163, 0.15);
    opacity: 1 !important;
}

.treats-header {
    color: #ff66a3;
    font-size: 1.1rem;
    font-weight: 600;
    margin: 4px 0;
    opacity: 1 !important;
}

.treats-score {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 8px 0;
}

.treats-footer {
    color: #ff66a3;
    font-size: 1.1rem;
    font-weight: 600;
    opacity: 1 !important;
}

/* Responsive adjustments */
@media (max-height: 500px) {
    .treats-collected {
        padding: 12px 20px;
    }
    
    .treats-header, .treats-footer {
        font-size: 0.9rem;
    }
    
    #finalScore {
        font-size: 1.8rem;
    }
    
    .score-food-icon {
        width: 28px;
        height: 28px;
    }
}

/* Add to your existing CSS */
@keyframes confettiFall {
    0% {
        transform: translateY(-10vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0;
    }
}

/* Optional: Add a subtle glow to emojis */
.confetti-emoji {
    filter: drop-shadow(0 0 3px rgba(255, 102, 163, 0.3));
}

.character-message {
    color: #ff66a3;
    font-size: 1.2rem;
    font-weight: 600;
    margin: 12px 0;
    padding: 12px 20px;
    background: linear-gradient(135deg, #fff5f8, #fff);
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(255, 102, 163, 0.15);
    border: 2px solid rgba(255, 102, 163, 0.15);
    animation: fadeIn 0.5s ease-out;
    opacity: 1 !important;
}

.share-btn {
    background: linear-gradient(135deg, #7289da, #5865f2);
    color: white;
    border: none;
    margin-bottom: 8px;
    box-shadow: 0 4px 15px rgba(114, 137, 218, 0.3);
}

.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(114, 137, 218, 0.4);
}

.share-btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 15px rgba(114, 137, 218, 0.3);
}

/* Add loading state */
.share-btn.loading {
    opacity: 0.7;
    cursor: wait;
}

.share-btn.loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #fff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.8s linear infinite;
    margin-left: 8px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive adjustments */
@media (max-height: 500px) {
    .share-btn {
        padding: 8px 16px;
        font-size: 0.9rem;
    }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.game-description {
    color: #666;
    font-size: 0.9rem;
    margin: 8px auto;
    max-width: 280px;
    line-height: 1.4;
    display: none; /* Hidden by default but visible to search engines */
}

.game-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    padding: 8px;
    font-size: 0.8rem;
    color: #999;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(4px);
    display: none; /* Hidden by default but visible to search engines */
}

/* Show description and footer for search engines */
@media print {
    .game-description,
    .game-footer {
        display: block;
    }
}

/* Screenshot-specific styles - mobile optimized */
.game-over-screen.screenshot-mode {
    background: #fff5f8 !important;
    padding: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    position: fixed !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
    top: 0 !important;
    left: 0 !important;
}

.screenshot-mode .game-over-content {
    background: #fff5f8 !important;
    padding: 24px !important;
    width: 100% !important;
    max-width: 300px !important;
    margin: 0 auto !important;
    gap: 16px !important;
    position: relative !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
}

.screenshot-mode .game-over-icon {
    width: 72px !important;
    height: 72px !important;
    margin-bottom: 8px !important;
}

.screenshot-mode .game-over-content h2 {
    font-size: 2.2rem !important;
    margin: 0 0 12px 0 !important;
    font-family: 'Frankfurter', 'Quicksand', sans-serif !important;
    color: #ff66a3 !important;
    text-align: center !important;
}

.screenshot-mode .treats-collected {
    background: white !important;
    padding: 20px !important;
    margin: 8px 0 !important;
    border-radius: 20px !important;
    border: 2px solid rgba(255, 102, 163, 0.15) !important;
    box-shadow: 0 4px 12px rgba(255, 102, 163, 0.1) !important;
    width: 100% !important;
}

.screenshot-mode .treats-header,
.screenshot-mode .treats-footer {
    font-size: 1.2rem !important;
    margin: 4px 0 !important;
    color: #ff66a3 !important;
    font-weight: 600 !important;
    text-align: center !important;
}

.screenshot-mode #finalScore {
    font-size: 2.8rem !important;
    margin: 0 8px !important;
    color: #ff66a3 !important;
    font-weight: 700 !important;
}

.screenshot-mode .score-food-icon {
    width: 36px !important;
    height: 36px !important;
}

.screenshot-mode .character-message {
    font-size: 1.3rem !important;
    padding: 16px 20px !important;
    margin: 12px 0 !important;
    background: white !important;
    border-radius: 16px !important;
    border: 2px solid rgba(255, 102, 163, 0.15) !important;
    box-shadow: 0 4px 12px rgba(255, 102, 163, 0.1) !important;
    color: #ff66a3 !important;
    font-weight: 600 !important;
    line-height: 1.4 !important;
    text-align: center !important;
    width: 100% !important;
}

/* Hide buttons in screenshot */
.screenshot-mode .game-over-buttons {
    display: none !important;
}

/* Add watermark */
.screenshot-mode::after {
    content: 'hellokittysnake.com' !important;
    position: absolute !important;
    bottom: 20px !important;
    left: 0 !important;
    right: 0 !important;
    text-align: center !important;
    color: #ff66a3 !important;
    font-size: 1.2rem !important;
    font-weight: 600 !important;
    opacity: 0.9 !important;
    font-family: 'Frankfurter', 'Quicksand', sans-serif !important;
    z-index: 1002 !important;
    text-shadow: 0 1px 2px rgba(255, 102, 163, 0.2) !important;
}

/* Add background pattern */
.screenshot-mode::before {
    content: '' !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: 
        radial-gradient(circle at 20% 20%, rgba(255, 102, 163, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(255, 102, 163, 0.05) 0%, transparent 50%) !important;
    z-index: 0 !important;
}

/* iPhone-specific adjustments */
@supports (-webkit-touch-callout: none) {
    .screenshot-mode .game-over-content {
        padding: 20px !important;
        transform: scale(0.95) !important;
    }

    .screenshot-mode .game-over-icon {
        width: 64px !important;
        height: 64px !important;
    }

    .screenshot-mode .game-over-content h2 {
        font-size: 2rem !important;
    }

    .screenshot-mode #finalScore {
        font-size: 2.4rem !important;
    }

    .screenshot-mode .treats-collected {
        padding: 16px !important;
    }

    .screenshot-mode .character-message {
        font-size: 1.2rem !important;
        padding: 14px 18px !important;
    }

    .screenshot-mode::after {
        bottom: 16px !important;
        font-size: 1.1rem !important;
    }
}

/* Remove Frankfurter from these elements, use clean readable fonts */
.game-over-content h2,
.character-message,
.treats-header,
.treats-footer,
#finalScore,
.screenshot-mode .game-over-content h2,
.screenshot-mode::after,
.screenshot-mode .character-message,
.screenshot-mode .treats-header,
.screenshot-mode .treats-footer {
    font-family: 'Quicksand', 'Arial', sans-serif !important;
}

/* Keep emoji rendering clean */
.confetti-emoji,
.score-increment::before,
.control-option input:checked + .control-label::after {
    font-family: "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", sans-serif;
}

/* Style for the arrow buttons */
.arrow-btn {
    width: 52px;
    height: 52px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.2); /* Much more transparent buttons */
    color: rgba(255, 102, 163, 0.8); /* Slightly transparent icons */
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

/* Active state for buttons */
.arrow-btn:active {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(0.95);
}

/* Android-specific adjustments */
@supports (-webkit-appearance: none) and (not (-webkit-touch-callout: none)) {
    .arrow-controls {
        background: rgba(255, 255, 255, 0.15);
    }
    
    .arrow-btn {
        background: rgba(255, 255, 255, 0.2);
    }
}

/* For devices that don't support backdrop-filter */
@supports not (backdrop-filter: blur(3px)) {
    .arrow-controls {
        background: rgba(255, 255, 255, 0.3);
    }
}
