/* CSS Variables for Theming */
:root {
    --bg-color: #121212;
    --primary-surface-color: #1e1e1e;
    --secondary-surface-color: #2a2a2a;
    --border-color: #2e2e2e;
    --primary-text-color: #e0e0e0;
    --secondary-text-color: #b3b3b3;
    --accent-color: #03dac6;
    --shadow-color: rgba(0, 0, 0, 0.2);
    --shadow-hover-color: rgba(3, 218, 198, 0.2);
}

/* SEO and Accessibility Utilities */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Compact Header Styling */
.compact-header {
    padding: 1rem;
    margin-bottom: 0.5rem;
}

.strikethrough {
  text-decoration: line-through !important;
  text-decoration-line: line-through !important;
  text-decoration-style: solid !important;
  text-decoration-color: currentColor !important;
}

.coffee-message {
  display: block;
  margin-top: 10px;
}

.coffee-message .strikethrough {
  text-decoration: line-through !important;
  text-decoration-line: line-through !important;
  text-decoration-style: solid !important;
  text-decoration-color: currentColor !important;
}

/* More specific selector for the coffee message structure */
strong.coffee-message .strikethrough {
  text-decoration: line-through !important;
  text-decoration-line: line-through !important;
  text-decoration-style: solid !important;
  text-decoration-color: var(--accent-color) !important;
  /* Apply the same gradient as parent logo-text */
  background: linear-gradient(45deg, var(--accent-color), #00ff9f) !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  background-clip: text !important;
}

/* Alternative strikethrough using pseudo-elements as fallback */
.strikethrough-alt {
  position: relative !important;
  display: inline-block !important;
}

.strikethrough-alt::after {
  content: '' !important;
  position: absolute !important;
  top: 50% !important;
  left: 0 !important;
  width: 100% !important;
  height: 1px !important;
  background-color: currentColor !important;
  transform: translateY(-50%) !important;
}

/* Button Bar - Three Column Layout with Center Logo */
.button-bar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 1.5rem;
    padding: 1.25rem;
    background: var(--primary-surface-color);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    min-height: 140px;
}

.left-buttons {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 0.75rem;
    justify-self: start;
    height: 100%;
}

/* Coffee Button Container */
.coffee-button-container {
    flex-shrink: 0;
    display: flex;
    justify-content: flex-start;
    align-self: flex-start;
    margin: 0;
    padding: 0;
}

/* Coffee GIF Button Styling */
.coffee-gif-button {
    display: inline-block;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    border: 2px solid transparent;
    background: transparent;
    text-decoration: none;
    min-height: auto;
    min-width: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
}

.coffee-gif-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(95, 127, 255, 0.3);
    border-color: rgba(95, 127, 255, 0.5);
}

.coffee-gif {
    display: block;
    width: auto;
    height: 75px;
    border-radius: 6px;
    transition: all 0.3s ease;
    object-fit: contain;
    max-width: 190px;
}

.coffee-gif:hover {
    filter: brightness(1.1);
}

/* Button alignment - ensure all left buttons align properly */
.left-buttons > * {
    flex-shrink: 0;
    position: relative;
    align-self: flex-start;
    margin: 0;
}

.center-logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    justify-self: center;
}

.right-buttons {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    justify-self: end;
    height: 100%;
}

/* Inline Logo in Button Bar */
.logo.inline {
    width: 120px;
    height: 120px;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(3, 218, 198, 0.3));
}

.logo-text {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--primary-text-color);
    background: linear-gradient(45deg, var(--accent-color), #00ff9f);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    white-space: nowrap;
}

/* Games Section - Immediate (minimal top margin) */
.games-section.immediate {
    margin: 0.25rem 0 2rem 0;
    padding: 0 1rem;
    text-align: center;
}

.games-section.immediate .games-title {
    font-size: 2rem;
    font-weight: bold;
    color: var(--accent-color);
    margin: 0 0 1.5rem 0;
    text-shadow: 0 0 10px rgba(3, 218, 198, 0.3);
}

/* Header Button Styling */
.header-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: var(--secondary-surface-color);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    color: var(--primary-text-color);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    min-height: 40px;
    white-space: nowrap;
}

/* High Score Button Specific Styling */
#mainHighScoreBtn {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%) !important;
    color: white !important;
    border: 2px solid #ff5252 !important;
    box-shadow: 0 2px 6px rgba(255, 107, 107, 0.3) !important;
}

#mainHighScoreBtn:hover {
    background: linear-gradient(135deg, #ff5252 0%, #c62828 100%) !important;
    border-color: #c62828 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 82, 82, 0.4) !important;
    color: white !important;
}

.header-btn:hover {
    background: var(--accent-color);
    color: var(--bg-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(3, 218, 198, 0.3);
    border-color: var(--accent-color);
}

.header-btn .btn-icon {
    font-size: 1rem;
    line-height: 1;
}

.header-btn .btn-text {
    font-size: 0.85rem;
    font-weight: 600;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    min-height: 40px;
}

.left-controls, .right-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.logo.large {
    width: 100px;
    height: 100px;
    object-fit: contain;
    filter: drop-shadow(0 4px 12px rgba(3, 218, 198, 0.3));
}

.logo.compact {
    width: 60px;
    height: 60px;
    object-fit: contain;
}

.title-section {
    text-align: left;
}

.main-title {
    font-size: 2.5rem;
    font-weight: bold;
    background: linear-gradient(45deg, var(--accent-color), #00ff9f);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
    line-height: 1.2;
    text-shadow: 0 0 20px rgba(3, 218, 198, 0.5);
}

.subtitle {
    font-size: 1.1rem;
    color: var(--secondary-text-color);
    margin: 0.5rem 0 0 0;
    line-height: 1.3;
    font-weight: 500;
}

.disclaimer-compact {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    color: var(--secondary-text-color);
}

.disclaimer-compact .info-icon.compact {
    width: 16px;
    height: 16px;
    padding: 2px;
}

.disclaimer-tooltip.compact {
    position: absolute;
    background: var(--primary-surface-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.5rem;
    font-size: 0.7rem;
    max-width: 200px;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    transform: translateY(-100%);
    margin-top: -0.5rem;
}

.disclaimer-compact:hover .disclaimer-tooltip.compact {
    opacity: 1;
    pointer-events: auto;
}

/* Compact Mascot Styling */
.mascot-container.compact {
    position: fixed;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 50;
    pointer-events: auto;
}

.pixel-panda-mascot.compact {
    width: 120px;
    height: 120px;
    position: relative; /* Make compact panda also a positioned container */
}

.mascot-speech-bubble.compact {
    position: absolute;
    top: -50px; /* Position above the panda */
    left: 60%; /* Slightly to the right of center */
    transform: translateX(-50%) scale(0); /* Center perfectly and start hidden */
    transform-origin: center bottom; /* Scale from bottom center (closest to panda) */
    
    /* Game bubble styling - ensure proper text containment */
    background: linear-gradient(135deg, var(--primary-surface-color) 0%, var(--secondary-surface-color) 100%);
    border: 3px solid var(--accent-color);
    border-radius: 20px;
    padding: 12px 16px; /* Generous padding for proper text containment */
    
    /* Text styling - ensure text fits properly */
    color: var(--primary-text-color);
    font-family: 'Courier New', monospace; /* Game-like font */
    font-size: 12px; /* Readable size */
    font-weight: bold;
    text-align: center;
    white-space: normal; /* Allow text wrapping */
    max-width: 180px; /* Generous width for text */
    min-width: 120px; /* Minimum width to contain short text */
    word-wrap: break-word;
    line-height: 1.3; /* Better line spacing */
    
    /* Effects */
    box-shadow: 
        0 6px 20px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 60; /* Ensure it appears above other elements */
    will-change: transform;
    
    /* Pixelated border effect */
    image-rendering: pixelated;
    -ms-interpolation-mode: nearest-neighbor;
}

.pixel-panda-mascot.compact:hover .mascot-speech-bubble.compact {
    transform: translateX(-50%) scale(1);
}

/* Speech bubble tail for compact version (pointing down towards panda) */
.mascot-speech-bubble.compact::before {
    content: '';
    position: absolute;
    top: 100%; /* Position at bottom of bubble */
    left: 40%; /* Adjust arrow position to align with panda center */
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-top: 12px solid var(--accent-color); /* Point down */
    z-index: -1;
}

/* Inner tail for clean look on compact version */
.mascot-speech-bubble.compact::after {
    content: '';
    position: absolute;
    top: 100%; /* Position at bottom of bubble */
    left: 40%; /* Adjust arrow position to align with panda center */
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid var(--primary-surface-color); /* Point down with background color */
    margin-top: -2px; /* Slightly overlap to hide the border line */
}

/* Show animation for compact speech bubble */
.mascot-speech-bubble.compact.show {
    transform: translateX(-50%) scale(1);
    animation: bubbleBounce 0.6s ease-out;
}

/* Prominent Games Section */
.games-section.prominent {
    margin: 0.5rem 0 2rem 0;
    padding: 1rem;
    text-align: center;
}

.games-title {
    font-size: 2.2rem;
    font-weight: bold;
    color: var(--accent-color);
    margin: 0 0 0.5rem 0;
    text-shadow: 0 0 10px rgba(3, 218, 198, 0.3);
}

.games-subtitle {
    font-size: 1rem;
    color: var(--secondary-text-color);
    margin: 0 0 0.75rem 0;
    font-weight: 500;
}

.intro-line {
    font-size: 0.95rem;
    color: var(--primary-text-color);
    margin: 0 0 1.5rem 0;
    font-weight: 400;
}

.intro-line strong {
    color: var(--accent-color);
    font-weight: 600;
}

/* Compact Control Buttons */
.control-btn.compact, .menu-btn.compact {
    padding: 0.4rem 0.6rem;
    font-size: 0.8rem;
    min-height: 32px;
}

.menu-btn.compact .btn-text {
    font-size: 0.75rem;
}

/* Main content sections styling - Updated for compact layout */
.intro-section, .games-section {
    margin: 1rem 0;
    padding: 0 1rem;
}

.section-title {
    color: var(--accent-color);
    font-size: 1.8rem;
    margin-bottom: 1rem;
    text-align: center;
    font-weight: bold;
}

.intro-content {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.intro-text {
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--primary-text-color);
    margin-bottom: 1.5rem;
}

.intro-text strong {
    color: var(--accent-color);
    font-weight: 600;
}

/* iOS Safari and Mobile Browser Fixes */
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

* {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Allow text selection for specific elements */
input, textarea, [contenteditable] {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

body.light-mode {
    --bg-color: #f0f2f5;
    --primary-surface-color: #ffffff;
    --secondary-surface-color: #f7f7f7;
    --border-color: #d1d1d1;
    --primary-text-color: #0d1117;
    --secondary-text-color: #586069;
    --accent-color: #007bff;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --shadow-hover-color: rgba(0, 123, 255, 0.2);
}

/* General Body Styling */
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--primary-text-color);
    display: grid;
    grid-template-columns: 160px 1fr 160px;
    grid-template-rows: 1fr;
    height: 100vh;
    overflow: hidden;
    transition: background-color 0.3s, color 0.3s;
}

/* Responsive grid layout for larger screens */
@media (min-width: 1440px) {
    body {
        grid-template-columns: 180px 1fr 180px;
    }
}

@media (min-width: 1920px) {
    body {
        grid-template-columns: 200px 1fr 200px;
    }
}

@media (min-width: 2560px) {
    body {
        grid-template-columns: 250px 1fr 250px;
    }
}

/* Arcade Panel Styling */
.ad-container {
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 50%, #2d2d2d 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-left: 2px solid var(--border-color);
    border-right: 2px solid var(--border-color);
    position: relative;
}

.arcade-panel {
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 50%, #0f0f23 100%);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.neon-border {
    width: 90%;
    height: 95%;
    border: 2px solid #00ffff;
    border-radius: 15px;
    position: relative;
    background: linear-gradient(45deg, rgba(0,255,255,0.1) 0%, rgba(255,0,255,0.1) 100%);
    box-shadow: 
        0 0 20px rgba(0,255,255,0.5),
        inset 0 0 20px rgba(0,255,255,0.1);
    animation: neonPulse 2s ease-in-out infinite alternate;
}

@keyframes neonPulse {
    from {
        box-shadow: 
            0 0 20px rgba(0,255,255,0.5),
            inset 0 0 20px rgba(0,255,255,0.1);
    }
    to {
        box-shadow: 
            0 0 30px rgba(0,255,255,0.8),
            inset 0 0 30px rgba(0,255,255,0.2);
    }
}

.retro-grid {
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(0,255,255,0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,255,255,0.1) 1px, transparent 1px);
    background-size: 20px 20px;
    position: relative;
    border-radius: 12px;
    overflow: hidden;
}

.pixel-art-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-around;
    height: 100%;
    padding: 20px 10px;
    position: relative;
}

.arcade-title {
    font-family: 'Courier New', monospace;
    font-size: 16px;
    font-weight: bold;
    color: #00ffff;
    text-shadow: 0 0 10px #00ffff;
    letter-spacing: 3px;
    margin-bottom: 10px;
    animation: titleGlow 1.5s ease-in-out infinite alternate;
}

@keyframes titleGlow {
    from { text-shadow: 0 0 10px #00ffff; }
    to { text-shadow: 0 0 20px #00ffff, 0 0 30px #00ffff; }
}

/* Left Panel - Spaceship */
.pixel-ship {
    width: 40px;
    height: 40px;
    background: linear-gradient(45deg, #ff6b6b, #ffd93d);
    clip-path: polygon(50% 0%, 0% 100%, 25% 85%, 75% 85%, 100% 100%);
    margin: 15px 0;
    animation: shipFloat 3s ease-in-out infinite;
    box-shadow: 0 0 15px rgba(255, 107, 107, 0.5);
}

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

.pixel-dots {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin: 15px 0;
}

.pixel-dots span {
    width: 12px;
    height: 12px;
    background: #ff6b6b;
    border-radius: 50%;
    animation: dotPulse 1s ease-in-out infinite;
    box-shadow: 0 0 10px rgba(255, 107, 107, 0.7);
}

.pixel-dots span:nth-child(even) {
    animation-delay: 0.5s;
    background: #4ecdc4;
    box-shadow: 0 0 10px rgba(78, 205, 196, 0.7);
}

@keyframes dotPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.7; }
}

/* Right Panel - Space Invader */
.pixel-invader {
    width: 48px;
    height: 32px;
    background: #ff6b6b;
    position: relative;
    margin: 15px 0;
    clip-path: polygon(
        12.5% 0%, 87.5% 0%, 100% 25%, 87.5% 25%, 87.5% 50%, 100% 50%, 100% 75%, 
        75% 75%, 75% 100%, 62.5% 100%, 62.5% 75%, 37.5% 75%, 37.5% 100%, 25% 100%, 
        25% 75%, 0% 75%, 0% 50%, 12.5% 50%, 12.5% 25%, 0% 25%
    );
    animation: invaderMove 2s linear infinite;
    box-shadow: 0 0 15px rgba(255, 107, 107, 0.5);
}

@keyframes invaderMove {
    0%, 100% { transform: translateX(-5px); }
    50% { transform: translateX(5px); }
}

.pixel-blocks {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    margin: 15px 0;
}

.block {
    width: 16px;
    height: 16px;
    background: #4ecdc4;
    border-radius: 2px;
    animation: blockRotate 4s linear infinite;
    box-shadow: 0 0 8px rgba(78, 205, 196, 0.5);
}

.block:nth-child(2) { animation-delay: 1s; }
.block:nth-child(3) { animation-delay: 2s; }
.block:nth-child(4) { animation-delay: 3s; }

@keyframes blockRotate {
    0% { transform: rotate(0deg) scale(1); }
    25% { transform: rotate(90deg) scale(1.1); }
    50% { transform: rotate(180deg) scale(1); }
    75% { transform: rotate(270deg) scale(1.1); }
    100% { transform: rotate(360deg) scale(1); }
}

.score-display {
    font-family: 'Courier New', monospace;
    font-size: 10px;
    color: #ffd93d;
    text-shadow: 0 0 8px #ffd93d;
    letter-spacing: 1px;
    margin-top: 10px;
}

.digital-numbers {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    font-weight: bold;
    color: #00ff00;
    text-shadow: 0 0 10px #00ff00;
    letter-spacing: 2px;
    margin-top: 5px;
}

.blinking {
    animation: blink 1s step-start infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.3; }
}

.left-ad {
    border-right: 2px solid var(--border-color);
}

.right-ad {
    border-left: 2px solid var(--border-color);
}

/* Left panel specific colors */
.left-panel .neon-border {
    border-color: #ff6b6b;
    box-shadow: 
        0 0 20px rgba(255, 107, 107, 0.5),
        inset 0 0 20px rgba(255, 107, 107, 0.1);
}

.left-panel .arcade-title {
    color: #ff6b6b;
    text-shadow: 0 0 10px #ff6b6b;
}

@keyframes leftNeonPulse {
    from {
        box-shadow: 
            0 0 20px rgba(255, 107, 107, 0.5),
            inset 0 0 20px rgba(255, 107, 107, 0.1);
    }
    to {
        box-shadow: 
            0 0 30px rgba(255, 107, 107, 0.8),
            inset 0 0 30px rgba(255, 107, 107, 0.2);
    }
}

.left-panel .neon-border {
    animation: leftNeonPulse 2s ease-in-out infinite alternate;
}

/* Right panel specific colors */
.right-panel .neon-border {
    border-color: #4ecdc4;
    box-shadow: 
        0 0 20px rgba(78, 205, 196, 0.5),
        inset 0 0 20px rgba(78, 205, 196, 0.1);
}

.right-panel .arcade-title {
    color: #4ecdc4;
    text-shadow: 0 0 10px #4ecdc4;
}

@keyframes rightNeonPulse {
    from {
        box-shadow: 
            0 0 20px rgba(78, 205, 196, 0.5),
            inset 0 0 20px rgba(78, 205, 196, 0.1);
    }
    to {
        box-shadow: 
            0 0 30px rgba(78, 205, 196, 0.8),
            inset 0 0 30px rgba(78, 205, 196, 0.2);
    }
}

.right-panel .neon-border {
    animation: rightNeonPulse 2s ease-in-out infinite alternate;
}

/* Ad placeholder styling */
.ad-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--secondary-text-color);
    opacity: 0.5;
    text-align: center;
}

.ad-placeholder p {
    margin: 0 0 0.5rem 0;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.ad-placeholder small {
    font-size: 0.7rem;
    opacity: 0.7;
}

/* Main Content Area */
.main-content {
    display: flex;
    flex-direction: column;
    padding: 2rem 2rem 3rem 2rem;
    overflow-y: auto;
}

header {
    position: relative;
    margin-bottom: 2rem;
}

.logo-container {
    flex-shrink: 0;
    position: relative;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo {
    height: 140px;
    width: auto;
    transition: transform 0.3s ease, filter 0.3s ease;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
}

.logo:hover {
    transform: scale(1.05);
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.4)) brightness(1.1);
}

body.light-mode .logo {
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.15));
}

body.light-mode .logo:hover {
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.25)) brightness(1.1);
}

/* Pixel Panda Mascot Styling - Optimized for Performance */
.mascot-container {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    z-index: 1000;
    will-change: transform;
    animation: mascotIntro 1s ease-out;
    transition: transform 0.3s ease;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.pixel-panda-mascot {
    height: 80px;
    width: 80px;
    cursor: pointer;
    transition: filter 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.2));
    animation: pandaFloat 6s ease-in-out infinite; /* Slower animation for better performance */
    will-change: transform; /* GPU acceleration */
    -webkit-user-select: none; /* Safari */
    -moz-user-select: none; /* Firefox */
    -ms-user-select: none; /* IE */
    user-select: none; /* Standard */
    pointer-events: auto; /* Ensure events work for dragging */
    position: relative; /* Make this a positioned container for the speech bubble */
    
    /* Default static image background */
    background-image: url('assets/pixelpanda/image/PixelPanda-character-transparent.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.pixel-panda-mascot:hover {
    filter: drop-shadow(0 4px 12px rgba(3, 218, 198, 0.4)); /* Subtle glow instead of zoom */
}

/* Draggable state styling for large screens */
@media (min-width: 1024px) {
    .pixel-panda-mascot {
        cursor: -webkit-grab; /* Safari */
        cursor: grab;
    }
    
    .pixel-panda-mascot:active {
        cursor: -webkit-grabbing; /* Safari */
        cursor: grabbing;
    }
}

/* Game-style speech bubble - positioned above the panda */
.mascot-speech-bubble {
    position: absolute;
    top: -45px; /* Position closer above the panda */
    left: 50%; /* Center horizontally */
    transform: translateX(-50%) scale(0); /* Center perfectly and start hidden */
    transform-origin: center bottom; /* Scale from bottom center (closest to panda) */
    
    /* Game bubble styling - ensure proper text containment */
    background: linear-gradient(135deg, var(--primary-surface-color) 0%, var(--secondary-surface-color) 100%);
    border: 3px solid var(--accent-color);
    border-radius: 20px;
    padding: 12px 16px; /* Generous padding for proper text containment */
    
    /* Text styling - ensure text fits properly */
    color: var(--primary-text-color);
    font-family: 'Courier New', monospace; /* Game-like font */
    font-size: 12px; /* Readable size */
    font-weight: bold;
    text-align: center;
    white-space: normal; /* Allow text wrapping */
    max-width: 180px; /* Generous width for text */
    min-width: 120px; /* Minimum width to contain short text */
    word-wrap: break-word;
    line-height: 1.3; /* Better line spacing */
    
    /* Effects */
    box-shadow: 
        0 6px 20px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 1001;
    will-change: transform;
    
    /* Pixelated border effect */
    image-rendering: pixelated;
    -ms-interpolation-mode: nearest-neighbor;
}

/* Speech bubble tail (pointing down towards panda) */
.mascot-speech-bubble::before {
    content: '';
    position: absolute;
    top: 100%; /* Position at bottom of bubble */
    left: 50%; /* Center horizontally */
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-top: 12px solid var(--accent-color); /* Point down */
    z-index: -1;
}

/* Inner tail for clean look */
.mascot-speech-bubble::after {
    content: '';
    position: absolute;
    top: 100%; /* Position at bottom of bubble */
    left: 50%; /* Center horizontally */
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid var(--primary-surface-color); /* Point down with background color */
    margin-top: -2px; /* Slightly overlap to hide the border line */
}

/* Game-style thought bubbles (small circles) */
.mascot-speech-bubble.thinking::before {
    content: '';
    position: absolute;
    bottom: -25px;
    left: 60%;
    width: 8px;
    height: 8px;
    background: var(--accent-color);
    border-radius: 50%;
    box-shadow: 
        -15px 8px 0 -2px var(--accent-color),
        -25px 15px 0 -4px var(--accent-color);
    border: none;
    transform: none;
}

.mascot-speech-bubble.thinking::after {
    display: none; /* Hide the triangle tail for thought bubbles */
}

.mascot-speech-bubble.show {
    transform: translateX(-50%) scale(1);
    animation: bubbleBounce 0.6s ease-out;
}

/* Game-style bounce animation for overhead positioning */
@keyframes bubbleBounce {
    0% { transform: translateX(-50%) translateY(20px) scale(0); }
    50% { transform: translateX(-50%) translateY(-5px) scale(1.1); }
    70% { transform: translateX(-50%) translateY(2px) scale(0.95); }
    100% { transform: translateX(-50%) translateY(0) scale(1); }
}

/* Simplified animations for better performance */
@keyframes pandaFloat {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-6px); } /* Reduced movement */
}

@keyframes mascotIntro {
    0% { 
        opacity: 0; 
        transform: translateX(20px) scale(0.9); /* Simpler intro */
    }
    100% { 
        opacity: 1; 
        transform: translateX(0) scale(1); 
    }
}

/* Sprite Sheet Animation System for Pixel Panda */
.pixel-panda-mascot.sprite-mode {
    background-image: url('assets/pixelpanda/pixel-panda-sprites.png') !important;
    background-size: 600px 600px !important; /* 6 frames × 6 animations */
    background-repeat: no-repeat !important;
    background-position: 0 0; /* Start at first frame */
    width: 100px;
    height: 100px;
}

/* Sprite Sheet Animations - Using steps() to prevent sliding */
.pixel-panda-mascot.sprite-mode.sprite-idle {
    animation: spriteIdle 2s steps(6, end) infinite !important;
}

.pixel-panda-mascot.sprite-mode.sprite-idle-smooth {
    animation: spriteIdle 3s steps(6, end) infinite !important;
}

.pixel-panda-mascot.sprite-mode.sprite-idle-slow {
    animation: spriteIdle 4s steps(6, end) infinite !important;
}

.pixel-panda-mascot.sprite-win {
    animation: spriteWin 1.2s steps(6, end);
}

.pixel-panda-mascot.sprite-lose {
    animation: spriteLose 1.5s steps(6, end);
}

.pixel-panda-mascot.sprite-excited {
    animation: spriteExcited 1s steps(6, end);
}

.pixel-panda-mascot.sprite-thumbs {
    animation: spriteThumbs 1.2s steps(6, end);
}

.pixel-panda-mascot.sprite-sad {
    animation: spriteSad 2s steps(6, end);
}

/* Keyframe Animations for Each Sprite Row - Fixed to prevent sliding */
@keyframes spriteIdle {
    0% { background-position: 0 0; }
    16.66% { background-position: -100px 0; }
    33.33% { background-position: -200px 0; }
    50% { background-position: -300px 0; }
    66.66% { background-position: -400px 0; }
    83.33% { background-position: -500px 0; }
    100% { background-position: 0 0; }
}

@keyframes spriteWin {
    0% { background-position: 0 -100px; }
    16.66% { background-position: -100px -100px; }
    33.33% { background-position: -200px -100px; }
    50% { background-position: -300px -100px; }
    66.66% { background-position: -400px -100px; }
    83.33% { background-position: -500px -100px; }
    100% { background-position: -500px -100px; }
}

@keyframes spriteLose {
    0% { background-position: 0 -200px; }
    16.66% { background-position: -100px -200px; }
    33.33% { background-position: -200px -200px; }
    50% { background-position: -300px -200px; }
    66.66% { background-position: -400px -200px; }
    83.33% { background-position: -500px -200px; }
    100% { background-position: -500px -200px; }
}

@keyframes spriteExcited {
    0% { background-position: 0 -300px; }
    16.66% { background-position: -100px -300px; }
    33.33% { background-position: -200px -300px; }
    50% { background-position: -300px -300px; }
    66.66% { background-position: -400px -300px; }
    83.33% { background-position: -500px -300px; }
    100% { background-position: -500px -300px; }
}

@keyframes spriteThumbs {
    0% { background-position: 0 -400px; }
    16.66% { background-position: -100px -400px; }
    33.33% { background-position: -200px -400px; }
    50% { background-position: -300px -400px; }
    66.66% { background-position: -400px -400px; }
    83.33% { background-position: -500px -400px; }
    100% { background-position: -500px -400px; }
}

@keyframes spriteSad {
    0% { background-position: 0 -500px; }
    16.66% { background-position: -100px -500px; }
    33.33% { background-position: -200px -500px; }
    50% { background-position: -300px -500px; }
    66.66% { background-position: -400px -500px; }
    83.33% { background-position: -500px -500px; }
    100% { background-position: -500px -500px; }
}

/* Responsive design with performance optimizations */
@media (max-width: 1023px) {
    /* On smaller screens, position in top-right corner */
    .mascot-container {
        top: 80px;
        right: 20px;
        left: auto;
        transform: none;
    }
}

@media (max-width: 768px) {
    /* Hide mascot on small mobile devices to prevent UI conflicts */
    .mascot-container {
        display: none !important;
    }
}

@media (max-width: 767px) {
    /* Ensure mascot stays hidden on mobile */
    .pixel-panda-mascot {
        display: none !important;
    }
    
    .mascot-container {
        display: none !important;
    }
}

@media (max-width: 480px) {
    .pixel-panda-mascot {
        height: 160px;
        width: 160px;
        animation: none;
    }
    
    .mascot-container {
        top: 60px;
        right: 10px;
        left: auto;
        transform: none;
    }
    
    .mascot-speech-bubble {
        font-size: 0.75rem;
        padding: 6px 10px;
        top: -45px; /* Position closer above the panda */
        left: 50%; /* Center horizontally relative to panda */
        transform: translateX(-50%) scale(0); /* Center and scale */
        max-width: 160px;
    }
    
    .mascot-speech-bubble.compact {
        font-size: 0.75rem;
        padding: 6px 10px;
        top: -45px; /* Position closer above the panda */
        left: 60%; /* Slightly to the right of center on mobile too */
        transform: translateX(-50%) scale(0); /* Center and scale */
        max-width: 160px;
    }
    
    .mascot-speech-bubble.show,
    .mascot-speech-bubble.compact.show {
        transform: translateX(-50%) scale(1);
    }
}

.speech-text {
    color: var(--primary-text-color);
    font-size: 0.85rem;
    font-weight: 600;
}

/* Animations */
@keyframes pandaFloat {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-8px); }
}

@keyframes mascotIntro {
    0% { 
        opacity: 0; 
        transform: translateX(30px) scale(0.8); 
    }
    100% { 
        opacity: 1; 
        transform: translateX(0) scale(1); 
    }
}

body.light-mode .mascot-speech-bubble {
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.2)) brightness(1.05);
}

/* Disclaimer Text Styling */
.disclaimer-text {
    flex: 1;
    text-align: left;
    max-width: 125px;
}

.disclaimer-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
}

.disclaimer-summary {
    color: #666666;
    font-size: 0.85rem;
    font-weight: 400;
    opacity: 0.8;
}

body.light-mode .disclaimer-summary {
    color: #555555;
}

.info-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    color: #666666;
    opacity: 0.7;
}

.info-icon:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

body.light-mode .info-icon {
    color: #555555;
}

body.light-mode .info-icon:hover {
    background: rgba(0, 0, 0, 0.05);
}

.disclaimer-tooltip {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--primary-surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    min-width: 300px;
    max-width: 400px;
}

.disclaimer-tooltip p {
    margin: 0;
    font-size: 0.8rem;
    line-height: 1.4;
    color: var(--primary-text-color);
}

.info-icon:hover + .disclaimer-tooltip,
.disclaimer-tooltip:hover {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.info-icon:focus + .disclaimer-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Audio Prompt Styling */
.audio-prompt {
    margin-top: 8px;
    text-align: center;
}

.audio-prompt.hidden {
    display: none;
}

.audio-enable-btn {
    background: linear-gradient(135deg, var(--accent-color), #00bfa5);
    color: #ffffff;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(3, 218, 198, 0.3);
}

.audio-enable-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(3, 218, 198, 0.4);
    background: linear-gradient(135deg, #00bfa5, var(--accent-color));
}

.audio-enable-btn:active {
    transform: translateY(0);
}

.audio-enable-btn svg {
    width: 14px;
    height: 14px;
}

@media (max-width: 768px) {
    .audio-prompt {
        margin-top: 6px;
    }
    
    .audio-enable-btn {
        padding: 6px 12px;
        font-size: 11px;
    }
}

header h1 {
    font-size: 3rem;
    color: var(--accent-color);
    margin: 0;
}

/* Game Grid Layout - Compact Design */
.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem;
}

/* Game Tile Styling - Compact Design */
.game-tile {
    position: relative;
    border: none;
    border-radius: 16px;
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: linear-gradient(135deg, 
        var(--primary-surface-color) 0%, 
        var(--secondary-surface-color) 50%,
        var(--primary-surface-color) 100%
    );
    box-shadow: 
        0 4px 16px rgba(0, 0, 0, 0.2),
        0 2px 8px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 0 0 1px rgba(3, 218, 198, 0.15);
    overflow: hidden;
    aspect-ratio: 1;
    min-height: 160px;
    transform: translateY(0);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* Animated background gradient */
.game-tile::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, 
        transparent 0%, 
        rgba(3, 218, 198, 0.15) 50%, 
        transparent 100%
    );
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    border-radius: 16px;
}

.game-tile:hover::before {
    opacity: 1;
}

/* Game title styling - positioned at bottom */
.game-tile h3 {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-text-color);
    margin: 0;
    padding: 0.75rem;
    line-height: 1.2;
    background: linear-gradient(to top, 
        rgba(0, 0, 0, 0.9) 0%, 
        rgba(0, 0, 0, 0.7) 70%,
        transparent 100%);
    border-radius: 0 0 16px 16px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    z-index: 3;
}

/* Game description - hidden by default, shown on hover */
.game-tile p {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.9rem;
    color: var(--primary-text-color);
    line-height: 1.4;
    margin: 0;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.85);
    border-radius: 12px;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(3, 218, 198, 0.3);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 4;
    max-width: 90%;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

.game-tile:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 
        0 12px 24px rgba(0, 0, 0, 0.3),
        0 8px 16px rgba(3, 218, 198, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        0 0 0 2px rgba(3, 218, 198, 0.4);
}

.game-tile:hover p {
    opacity: 1;
    visibility: visible;
}

.game-tile:hover h3 {
    background: linear-gradient(to top, 
        rgba(0, 0, 0, 0.95) 0%, 
        rgba(0, 0, 0, 0.8) 70%,
        transparent 100%);
}

/* Coming soon tile styling */
.coming-next-tile {
    background: linear-gradient(135deg, 
        rgba(255, 165, 0, 0.1) 0%, 
        rgba(255, 140, 0, 0.1) 50%,
        rgba(255, 165, 0, 0.1) 100%
    );
    border: 2px dashed rgba(255, 165, 0, 0.3);
}

.coming-next-tile:hover {
    border-color: rgba(255, 165, 0, 0.6);
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.3),
        0 0 0 2px rgba(255, 165, 0, 0.4);
}

/* Inner border glow effect */
.game-tile::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    right: 2px;
    bottom: 2px;
    border-radius: 18px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
    pointer-events: none;
    z-index: 1;
    transition: box-shadow 0.3s ease;
}

body.light-mode .game-tile {
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.08),
        0 2px 6px rgba(0, 0, 0, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

body.light-mode .game-tile h3 {
    background: linear-gradient(to top, 
        rgba(255, 255, 255, 0.95) 0%, 
        rgba(255, 255, 255, 0.8) 70%,
        transparent 100%);
    color: var(--bg-color);
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

/* Text overlay background for better contrast - simplified */
.game-tile::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 30%;
    background: linear-gradient(to top, 
        rgba(0, 0, 0, 0.7) 0%, 
        rgba(0, 0, 0, 0.4) 50%, 
        transparent 100%);
    pointer-events: none;
    z-index: 2;
    border-radius: 0 0 16px 16px;
}

body.light-mode .game-tile::after {
    background: linear-gradient(to top, 
        rgba(255, 255, 255, 0.9) 0%, 
        rgba(255, 255, 255, 0.6) 50%,
        transparent 100%);
}

/* Individual game tile backgrounds */
#snake {
    background-image: url('assets/game-tiles/snake-tile.svg');
}

#blockyslot {
    background-image: url('assets/game-tiles/blockyslot-tile.svg');
}

#minechaser {
    background-image: url('assets/game-tiles/minechaser-tile.svg');
}

#wordfinder {
    background-image: url('assets/game-tiles/wordfinder-tile.svg');
}

#neurogrid {
    background-image: url('assets/game-tiles/neurogrid-tile.svg');
}

#pacrcade {
    background-image: url('assets/game-tiles/pacrcade-tile.svg');
}

#ricochetshot {
    background-image: url('assets/game-tiles/ricochetshot-tile.svg');
}

#retrorunner {
    background-image: url('assets/game-tiles/retrorunner.png');
}

.game-tile:active {
    transform: translateY(-4px) scale(1.01);
    transition: all 0.1s;
}

.game-tile h2 {
    margin-top: 0;
    margin-bottom: 0.5rem;
    color: white;
    font-size: 1.4rem;
    font-weight: 700;
    position: relative;
    z-index: 3;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

body.light-mode .game-tile h2 {
    color: var(--primary-text-color);
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
}

.game-tile p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.95rem;
    margin: 0;
    line-height: 1.4;
    position: relative;
    z-index: 3;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

body.light-mode .game-tile p {
    color: var(--secondary-text-color);
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
}

/* Game Icon Styling - show SVG icons for games */
.game-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.game-tile:hover .game-icon {
    transform: scale(1.1);
    transition: transform 0.2s ease;
}

/* --- Professional Panda-at-Work Tile Design --- */

/* Base container with background image integration */
.coming-next-tile {
    /* Professional gradient with panda background - reduced opacity for better image visibility */
    background: 
        linear-gradient(135deg, rgba(45, 45, 65, 0.7) 0%, rgba(60, 60, 80, 0.6) 50%, rgba(75, 75, 95, 0.7) 100%),
        url('assets/pixelpanda/panda-construction-icon.png') center/contain no-repeat !important;
    border: 2px solid #6c7cff !important;
    
    /* Layout and positioning - override the aspect-ratio constraint */
    justify-content: space-between !important; 
    padding: 1.5rem !important; 
    position: relative;
    overflow: hidden;
    cursor: default;
    aspect-ratio: unset !important; /* Remove the 1:1 aspect ratio constraint */
    min-height: 200px !important; /* Set a reasonable minimum height for content */
    height: auto !important; /* Allow natural height based on content */
    display: flex !important;
    flex-direction: column !important;
    
    /* Professional shadow and depth */
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.3),
        0 4px 16px rgba(108, 124, 255, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    
    /* Smooth transitions for professional feel */
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Subtle animated glow effect - reduced opacity for better background visibility */
.coming-next-tile::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, 
        rgba(108, 124, 255, 0.05) 0%, 
        rgba(138, 43, 226, 0.05) 50%,
        rgba(255, 157, 77, 0.05) 100%) !important;
    opacity: 0.4;
    z-index: 1;
    animation: subtleGlow 3s ease-in-out infinite alternate;
}

/* Professional hover effect */
.coming-next-tile:hover {
    transform: translateY(-12px) scale(1.02) !important;
    box-shadow: 
        0 24px 48px rgba(0, 0, 0, 0.4),
        0 12px 24px rgba(108, 124, 255, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
    border-color: #8c9cff !important;
}

/* Disable the old text overlay */
.coming-next-tile::after {
    display: none !important;
}

/* Hide the old mystery icon */
.coming-next-tile .mystery-icon {
    display: none !important;
}

/* Hide the separate image element since we're using it as background */
.coming-next-tile .game-tile-image {
    display: none !important;
}

/* Professional header styling */
.coming-next-tile h3 {
    color: #ffffff !important;
    font-size: 1.6rem !important;
    font-weight: 700 !important;
    margin: 0 0 12px 0 !important; /* Increased bottom margin for better spacing */
    text-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.5),
        0 0 20px rgba(255, 221, 68, 0.3) !important;
    text-align: center;
    position: relative;
    z-index: 3;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    flex-shrink: 0; /* Prevent shrinking */
}

/* Professional description text */
.coming-next-tile .mystery-text {
    color: #e8ecff !important;
    font-weight: 500;
    margin: 0 0 16px 0 !important; /* Increased bottom margin for better spacing */
    line-height: 1.5;
    font-size: 1rem !important;
    text-align: center;
    position: relative;
    z-index: 3;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3) !important;
    opacity: 0.95;
    flex-shrink: 0; /* Prevent shrinking */
}

/* Professional call-to-action box */
.coming-next-tile .support-message {
    background: linear-gradient(135deg, 
        rgba(255, 221, 68, 0.15) 0%, 
        rgba(255, 157, 77, 0.15) 100%);
    border: 1px solid rgba(255, 221, 68, 0.4);
    border-radius: 12px;
    padding: 1rem !important;
    margin-top: auto !important; /* Push to bottom */
    position: relative;
    z-index: 3;
    width: 100%;
    box-sizing: border-box;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    box-shadow: 
        0 4px 16px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    flex-shrink: 0; /* Prevent shrinking */
}

/* Professional call-to-action text */
.coming-next-tile .support-message p {
    margin: 0 !important;
    color: #ffffff !important;
    font-size: 0.9rem !important;
    text-align: center;
    line-height: 1.4;
    position: relative;
    z-index: 3;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3) !important;
    font-weight: 500;
}

/* Accent color for emphasis */
.coming-next-tile .support-message strong {
    color: #ffdd44 !important;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(255, 221, 68, 0.4);
}

/* Subtle glow animation */
@keyframes subtleGlow {
    0% { opacity: 0.6; }
    100% { opacity: 0.8; }
}

/* Light mode overrides for coming next tile */
body.light-mode .coming-next-tile {
    background: 
        linear-gradient(135deg, rgba(240, 244, 255, 0.6) 0%, rgba(230, 238, 255, 0.5) 50%, rgba(221, 231, 255, 0.6) 100%),
        url('assets/pixelpanda/panda-construction-icon.png') center/contain no-repeat !important;
    border-color: #4169e1 !important;
}

body.light-mode .coming-next-tile h2 {
    color: #4169e1 !important;
    text-shadow: 0 0 10px rgba(65, 105, 225, 0.3);
}

body.light-mode .coming-next-tile h3 {
    color: #2c5aa0 !important;
    text-shadow: 0 2px 4px rgba(44, 90, 160, 0.3), 0 0 15px rgba(44, 90, 160, 0.2) !important;
}

body.light-mode .coming-next-tile .mystery-text {
    color: #2c5aa0 !important;
}

body.light-mode .coming-next-tile .mystery-icon {
    color: #4169e1 !important;
}

body.light-mode .coming-next-tile .support-message {
    background: rgba(65, 105, 225, 0.1);
    border-color: rgba(65, 105, 225, 0.3);
}

body.light-mode .coming-next-tile .support-message p {
    color: #4169e1 !important;
}

/* Animations */
@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 5px rgba(255, 107, 107, 0.5); }
    50% { box-shadow: 0 0 15px rgba(255, 107, 107, 0.8), 0 0 25px rgba(255, 107, 107, 0.4); }
}

/* Footer Styling */
footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.5rem 1rem;
    margin: 0;
    text-align: center;
    width: 100%;
    z-index: 100;
    background: rgba(18, 18, 18, 0.95);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border-color);
}

.footer-nav {
    pointer-events: auto;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.footer-separator {
    color: var(--secondary-text-color);
    font-size: 0.7rem;
}

.footer-game-link, .privacy-link {
    color: var(--secondary-text-color);
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 400;
    transition: color 0.3s ease;
    pointer-events: auto;
}

.footer-game-link:hover, .privacy-link:hover {
    color: var(--accent-color);
}

.footer-description {
    font-size: 0.7rem;
    color: var(--secondary-text-color);
    margin: 0;
    padding: 0 1rem;
    line-height: 1.4;
    pointer-events: none;
}

/* Mobile Panda Presence - only visible on mobile when main mascot is hidden */
.mobile-panda-presence {
    display: none;
    margin-left: 0.5rem;
    animation: subtleBounce 3s ease-in-out infinite;
    cursor: pointer;
    transition: transform 0.3s ease;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.mobile-panda-presence:hover {
    transform: scale(1.2);
    animation: none;
}

.mobile-panda-presence:active {
    transform: scale(0.9);
}

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

@media (max-width: 768px) {
    .mobile-panda-presence {
        display: inline;
        font-size: 1rem;
    }
}

/* Legacy privacy link hover styles */
.privacy-link:hover {
    color: var(--accent-color);
    text-decoration: underline;
}

/* Styling for Privacy Policy Page */
body.content-page {
    display: block;
    height: auto;
    overflow: auto;
}
.text-content {
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.6;
}
.home-link {
    display: inline-block;
    margin-top: 2rem;
    color: var(--accent-color);
    text-decoration: none;
}


/* Settings Cog and Panel */
.settings-btn {
    position: fixed;
    top: 20px;
    right: 180px; /* Position to the left of the right ad banner (160px + 20px margin) */
    z-index: 1001;
    background-color: var(--primary-surface-color);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px var(--shadow-color);
}

.settings-btn svg {
    stroke: var(--secondary-text-color);
}

.settings-panel {
    position: fixed;
    top: 75px;
    right: 180px; /* Align with the settings button */
    z-index: 1000;
    background-color: var(--secondary-surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 4px 12px var(--shadow-color);
    display: none;
}

.settings-panel.show {
    display: block;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.setting-item label {
    margin-right: 1rem;
}

/* Toggle Switch Styling */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}

.toggle-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: 22px;
}

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

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

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


/* --- Game Area Styles --- */

.game-active-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    height: 100%;
    min-height: calc(100vh - 6rem);
    padding: 2rem 1rem 3rem 1rem; /* Increased padding for better spacing */
    overflow-y: auto;
    background: linear-gradient(135deg, var(--primary-bg-color) 0%, var(--secondary-surface-color) 100%);
    position: relative;
    
    /* iOS Safari mobile fixes */
    touch-action: pan-y pinch-zoom;
}

/* Game canvas specific mobile fixes */
.game-active-area canvas {
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    position: relative;
    max-width: 100%;
    height: auto;
}

/* Enhanced light mode styling for game area */
body.light-mode .game-active-area {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 50%, #f1f3f4 100%);
}

/* Enhanced back button for light mode */
body.light-mode .back-btn {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-color: rgba(0, 0, 0, 0.12);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

body.light-mode .back-btn:hover {
    background: linear-gradient(135deg, #f8f9fa 0%, var(--accent-color) 100%);
    color: white;
}

.back-btn {
    background: linear-gradient(135deg, var(--primary-surface-color) 0%, var(--secondary-surface-color) 100%);
    color: var(--primary-text-color);
    border: 2px solid var(--border-color);
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    cursor: pointer;
    margin-bottom: 1.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 10;
    align-self: flex-start;
    margin-left: 1rem;
    font-weight: 600;
    font-size: 0.95rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.back-btn:hover {
    background: linear-gradient(135deg, var(--secondary-surface-color) 0%, var(--accent-color) 100%);
    border-color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
    color: var(--primary-text-color);
}

/* Game Header Styling */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1rem;
    margin-bottom: 1.5rem;
    gap: 1rem;
    flex-wrap: wrap;
}

/* High Score Button Styling */
.high-score-btn {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
    color: white;
    border: 2px solid #ff5252;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 10;
    font-weight: 600;
    font-size: 0.95rem;
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.high-score-btn:hover {
    background: linear-gradient(135deg, #ff5252 0%, #c62828 100%);
    border-color: #c62828;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 82, 82, 0.4);
    color: white;
}

/* Light mode high score button */
body.light-mode .high-score-btn {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
    border-color: #ff5252;
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.25);
}

body.light-mode .high-score-btn:hover {
    background: linear-gradient(135deg, #ff5252 0%, #c62828 100%);
    border-color: #c62828;
    box-shadow: 0 8px 20px rgba(255, 82, 82, 0.35);
}

#gameCanvas {
    background: linear-gradient(135deg, var(--primary-surface-color) 0%, var(--secondary-surface-color) 100%);
    border: 3px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.2),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset,
        0 16px 64px rgba(0, 0, 0, 0.1);
    margin-top: 0.5rem;
    max-width: 95vw;
    max-height: 85vh;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    /* Allow rectangular aspect ratios */
    width: auto;
    height: auto;
}

/* Enhanced responsive canvas sizing for larger screens */
@media (min-width: 1200px) {
    #gameCanvas {
        max-width: 90vw;
        max-height: 75vh;
    }
}

@media (min-width: 1440px) {
    #gameCanvas {
        max-width: 85vw;
        max-height: 70vh;
    }
}

@media (min-width: 1920px) {
    #gameCanvas {
        max-width: 80vw;
        max-height: 65vh;
    }
}

@media (min-width: 2560px) {
    #gameCanvas {
        max-width: 75vw;
        max-height: 60vh;
    }
}

#gameCanvas:hover {
    transform: translateY(-4px);
    box-shadow: 
        0 12px 40px rgba(0, 0, 0, 0.25),
        0 0 0 1px rgba(255, 255, 255, 0.15) inset,
        0 20px 80px rgba(0, 0, 0, 0.15);
}

/* Light mode enhancements */
body.light-mode #gameCanvas {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-color: rgba(0, 0, 0, 0.12);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.08),
        0 0 0 1px rgba(0, 0, 0, 0.05) inset,
        0 16px 64px rgba(0, 0, 0, 0.04);
}

body.light-mode #gameCanvas:hover {
    box-shadow: 
        0 12px 40px rgba(0, 0, 0, 0.12),
        0 0 0 1px rgba(0, 0, 0, 0.08) inset,
        0 20px 80px rgba(0, 0, 0, 0.06);
}

/* Game Restart Overlay */
.game-restart-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    border-radius: 1rem;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    animation: fadeInOverlay 0.3s ease-out;
}

/* MineChaser specific modal - no dark background */
.game-restart-overlay.minechaser-modal {
    background: transparent;
    -webkit-backdrop-filter: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}

/* MineChaser Mobile Controls */
.minechaser-mobile-controls {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
    padding: 0 1rem;
}

.mobile-control-panel {
    background: rgba(0, 0, 0, 0.8);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    border: 2px solid var(--accent-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.toggle-mode-btn {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(76, 175, 80, 0.3);
    margin-bottom: 0.5rem;
}

.toggle-mode-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

.toggle-mode-btn:active {
    transform: translateY(0);
}

.toggle-mode-btn.flag-mode {
    background: linear-gradient(135deg, #ff6b6b, #ff5252);
    box-shadow: 0 2px 6px rgba(255, 107, 107, 0.3);
}

.toggle-mode-btn.flag-mode:hover {
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.4);
}

.mode-icon {
    font-size: 1.1rem;
    display: inline-block;
}

/* 🚧 DEV MODE: Bomb highlight toggle button */
.dev-toggle-btn {
    background: linear-gradient(135deg, #4ecdc4 0%, #44a08d 100%);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(78, 205, 196, 0.3);
    margin-bottom: 0.5rem;
    border: 2px solid #ff9800; /* Orange border to indicate dev mode */
}

.dev-toggle-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(78, 205, 196, 0.4);
}

.dev-toggle-btn:active {
    transform: translateY(0);
}

.dev-toggle-btn.bomb-visible {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    box-shadow: 0 2px 6px rgba(255, 107, 107, 0.3);
}

.dev-toggle-btn.bomb-visible:hover {
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.4);
}

.dev-icon {
    font-size: 1.1rem;
    display: inline-block;
}

.dev-text {
    font-size: 0.85rem;
    font-weight: 600;
}

.mode-text {
    font-size: 0.85rem;
    font-weight: 600;
}

.mobile-instructions {
    text-align: center;
    color: #ccc;
    font-size: 0.75rem;
    line-height: 1.2;
}

/* Hide mobile controls on desktop */
@media (min-width: 769px) {
    .minechaser-mobile-controls {
        display: none;
    }
}

/* Responsive mobile controls */
@media (max-width: 480px) {
    .mobile-control-panel {
        padding: 0.5rem 0.75rem;
    }
    
    .toggle-mode-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
    
    .mode-icon {
        font-size: 1rem;
    }
    
    .mobile-instructions {
        font-size: 0.7rem;
    }
}

/* WordFinder Mobile Enhancements */
.game-active-area[data-game="wordfinder"] canvas {
    touch-action: none; /* Prevent scrolling while selecting words */
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    user-select: none;
}

/* Improve touch accuracy for WordFinder on mobile */
@media (max-width: 768px) {
    .game-active-area[data-game="wordfinder"] canvas {
        cursor: crosshair; /* Visual indicator for selection */
    }
    
    /* Ensure smooth touch interactions */
    .game-active-area[data-game="wordfinder"] {
        touch-action: none;
    }
}

@keyframes fadeInOverlay {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.restart-content {
    text-align: center;
    color: white;
    padding: 1.5rem; /* Reduced from 2rem */
    background: rgba(255, 255, 255, 0.1);
    border-radius: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    max-width: 400px; /* Consistent maximum width */
    width: 90%; /* Responsive width */
    min-width: 280px; /* Minimum width for readability */
    box-sizing: border-box; /* Ensure padding is included in width calculations */
}

.restart-content h3 {
    margin: 0 0 0.75rem 0; /* Reduced margin */
    font-size: 1.6rem; /* Reduced from 2rem */
    color: #ff6b6b;
    font-weight: bold;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.restart-content p {
    margin: 0 0 1.25rem 0; /* Reduced margin */
    font-size: 1.1rem; /* Reduced from 1.2rem */
    color: #fff;
    font-weight: 500;
}

.restart-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
}

.restart-btn, .menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem; /* Slightly smaller padding */
    border: none;
    border-radius: 0.5rem;
    font-size: 0.9rem; /* Slightly smaller font */
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 140px; /* Fixed width for consistent sizing */
    min-height: 44px; /* Touch-friendly height */
}

.restart-btn {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.menu-btn {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(108, 117, 125, 0.3);
}

.restart-btn:hover {
    background: linear-gradient(135deg, #45a049 0%, #4CAF50 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.menu-btn:hover {
    background: linear-gradient(135deg, #495057 0%, #6c757d 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(108, 117, 125, 0.4);
}

.restart-btn:active, .menu-btn:active {
    transform: translateY(0);
}

.restart-btn:active {
    box-shadow: 0 2px 10px rgba(76, 175, 80, 0.3);
}

.menu-btn:active {
    box-shadow: 0 2px 10px rgba(108, 117, 125, 0.3);
}

.restart-btn svg, .menu-btn svg {
    width: 18px; /* Slightly smaller icons */
    height: 18px;
}

/* Mobile responsive adjustments for restart modal */
@media (max-width: 480px) {
    .restart-content {
        padding: 1.25rem; /* Even smaller padding on mobile */
        max-width: 280px; /* Smaller max-width for mobile */
        width: 85vw; /* More responsive width */
    }
    
    .restart-content h3 {
        font-size: 1.4rem; /* Smaller heading on mobile */
        margin-bottom: 0.5rem;
    }
    
    .restart-content p {
        font-size: 1rem; /* Smaller text on mobile */
        margin-bottom: 1rem;
    }
    
    .restart-btn, .menu-btn {
        padding: 0.5rem 1rem; /* Smaller padding on mobile */
        font-size: 0.85rem; /* Smaller font on mobile */
        width: 120px; /* Smaller width for mobile */
        min-height: 40px; /* Smaller but still touch-friendly */
    }
    
    .restart-buttons {
        gap: 0.5rem; /* Smaller gap on mobile */
    }
    
    .restart-btn svg, .menu-btn svg {
        width: 16px; /* Even smaller icons on mobile */
        height: 16px;
    }
}

/* Landscape mobile adjustments */
@media (max-height: 500px) and (orientation: landscape) {
    .restart-content {
        padding: 1rem;
        max-width: 240px;
    }
    
    .restart-content h3 {
        font-size: 1.2rem;
        margin-bottom: 0.25rem;
    }
    
    .restart-content p {
        font-size: 0.9rem;
        margin-bottom: 0.75rem;
    }
    
    .restart-btn, .menu-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
        width: 100px;
        min-height: 36px;
    }
}

/* --- BlockySlot Game Styles --- */

.blockyslot-wrapper {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
}

.blockyslot-side-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: var(--primary-surface-color);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.blockyslot-side-panel h2 {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    color: var(--secondary-text-color);
    font-weight: bold;
}

.blockyslot-side-panel p {
    margin: 0 0 1.5rem 0;
    font-size: 1.5rem;
    color: var(--accent-color);
    font-weight: bold;
}

#nextCanvas {
    background-color: var(--bg-color);
    border-radius: 4px;
}


/* --- Responsive Design --- */

/* 13-inch laptop and small desktop adjustments */
@media (max-width: 1440px) and (min-width: 1025px) {
    .game-grid {
        max-width: 1000px;
        gap: 1.25rem; /* Slightly reduce gap */
    }
    
    .game-tile {
        padding: 1.25rem; /* Reduce padding */
        min-height: 8rem; /* Reduce minimum height */
    }
    
    .main-content {
        padding: 1.5rem; /* Reduce content padding */
    }
}

/* Small laptops (13-inch typical resolution 1366x768) */
@media (max-width: 1366px) and (min-width: 1025px) {
    body {
        grid-template-columns: 140px 1fr 140px; /* Reduce sidebar width */
    }
    
    .game-grid {
        max-width: 850px;
        gap: 1rem; /* Further reduce gap */
    }
    
    .game-tile {
        padding: 1rem;
        min-height: 7rem;
        font-size: 0.9rem;
    }
    
    .game-tile h3 {
        font-size: 1.1rem;
        margin-bottom: 0.5rem;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    header {
        margin-bottom: 1rem;
    }
    
    /* Responsive modal sizing for laptops */
    .restart-content {
        max-width: 350px;
        padding: 1.25rem;
    }
    
    /* Coming-next-tile laptop adjustments */
    .coming-next-tile {
        padding: 1.2rem !important;
        /* Smaller background image for laptops */
        background-size: 80px !important;
    }
    
    .coming-next-tile h3 {
        font-size: 1.3rem !important;
        margin-bottom: 6px !important;
    }
    
    .coming-next-tile .mystery-text {
        font-size: 0.85rem !important;
        line-height: 1.3;
        margin-bottom: 0.8rem !important;
    }
    
    .coming-next-tile .support-message {
        padding: 0.8rem !important;
        border-radius: 8px;
    }

    .coming-next-tile .support-message p {
        font-size: 0.8rem !important;
        line-height: 1.3;
    }
}

@media (max-width: 1024px) {
    body {
        display: block;
        height: auto;
        overflow: auto;
    }

    .ad-container {
        display: none;
    }

    .main-content {
        padding: 1.5rem;
    }

    header {
        height: 6rem; /* Reduced height for higher logo */
        margin-bottom: 1.5rem;
        padding-top: 1.5rem; /* Add padding for logo space */
    }

    .logo {
        height: 90px;
    }

    .game-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
        max-width: 100%;
        padding: 0.75rem;
    }

    .game-tile {
        min-height: 140px;
        padding: 0.75rem;
    }
    
    .game-tile h3 {
        font-size: 1rem;
        padding: 0.5rem;
    }
    
    .game-tile p {
        font-size: 0.8rem;
        padding: 0.75rem;
    }
    
    .games-title {
        font-size: 2rem;
    }
    
    .logo-section {
        gap: 0.75rem;
    }
    
    .logo.inline {
        width: 100px;
        height: 100px;
    }
    
    .logo-text {
        font-size: 0.9rem;
    }
    
    .button-bar {
        padding: 1rem;
        gap: 1rem;
        min-height: 100px;
    }
    
    .header-btn {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }
    
    /* Coffee button scaling for tablet */
    .coffee-gif {
        height: 42px;
        max-width: 100px;
    }
    
    .games-section.immediate .games-title {
        font-size: 1.9rem;
    }

    .settings-btn {
        top: 15px;
        right: 15px;
        width: 40px;
        height: 40px;
    }

    .settings-panel {
        top: 65px;
        right: 15px;
    }
    
    /* Tablet modal sizing */
    .restart-content {
        max-width: 300px;
        padding: 1rem;
        min-width: 250px;
    }
}

/* Responsive design for smaller laptops (13" screens and below) */
@media (max-width: 1500px) {
    .right-buttons {
        flex-direction: column !important;
        gap: 0.4rem !important;
        align-items: center;
        justify-content: center;
        min-width: 80px;
    }
    
    .right-buttons .header-btn {
        min-width: 70px;
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
        border-radius: 6px;
    }
    
    .right-buttons .header-btn .btn-text {
        display: none !important; /* Hide text labels to save space */
    }
    
    .right-buttons .header-btn .btn-icon {
        font-size: 1.1rem;
    }
    
    /* Adjust header height to accommodate stacked buttons */
    header {
        min-height: 180px; /* Increased from 140px to accommodate 3 stacked buttons */
    }
    
    .button-bar {
        min-height: 160px; /* Increased to match header */
        align-items: stretch; /* Stretch to fill height */
    }
    
    /* Ensure right-buttons container doesn't overflow */
    .right-buttons {
        max-height: 150px; /* Constrain height to prevent sidebar overlap */
        overflow: hidden; /* Hide any overflow */
        justify-content: flex-start; /* Align buttons to top */
    }
    
    /* Make buttons slightly smaller to fit better */
    .right-buttons .header-btn {
        min-width: 65px; /* Reduced from 70px */
        padding: 0.35rem 0.5rem; /* Reduced padding */
        font-size: 0.75rem; /* Smaller text */
    }
}

/* Additional responsive adjustments for very tight screens */
@media (max-width: 1200px) {
    .right-buttons .header-btn {
        min-width: 55px; /* Even smaller for tight screens */
        padding: 0.25rem 0.35rem;
        font-size: 0.7rem;
    }
    
    .right-buttons .header-btn .btn-icon {
        font-size: 1rem;
    }
    
    .right-buttons {
        gap: 0.25rem !important; /* Tighter gap */
        min-width: 60px;
        max-height: 140px; /* Slightly smaller max height */
    }
    
    /* Reduce header height slightly on very small screens */
    header {
        min-height: 160px;
    }
    
    .button-bar {
        min-height: 140px;
    }
}

/* Games section - add bottom padding */
.games-section {
    padding-bottom: 3rem; /* Add bottom padding after game tiles */
}

.games-section.immediate {
    padding-bottom: 3rem; /* Ensure immediate class also has bottom padding */
}

/* Simple mobile disclaimer - grey text only */
.mobile-disclaimer {
    width: 100%;
    text-align: center;
    padding: 1rem 0;
    margin: 0;
    font-size: 0.9rem;
    color: #888888; /* Simple grey text */
    font-weight: normal;
    display: none; /* Hidden by default */
    position: static; /* Normal document flow */
}

/* Show on mobile and tablet devices (below 1025px) */
@media (max-width: 1024px) {
    .mobile-disclaimer {
        display: block;
    }
}

/* Critical fix for 480-490px range where layout breaks */
@media (min-width: 480px) and (max-width: 490px) {
    .button-bar {
        grid-template-columns: auto 1fr auto !important; /* Force proper layout */
        grid-template-rows: auto !important;
        gap: 0.75rem !important;
        padding: 0.5rem 0.75rem !important;
        align-items: center !important;
        min-height: 70px !important;
    }
    
    .left-buttons, .right-buttons {
        display: flex !important;
        gap: 0.4rem !important;
        align-items: center !important;
    }
    
    .left-buttons {
        justify-content: flex-start !important;
    }
    
    .right-buttons {
        justify-content: flex-end !important;
    }
    
    .center-logo {
        justify-self: center !important;
        text-align: center !important;
    }
    
    .center-logo h1 {
        font-size: 1.2rem !important;
        margin: 0 !important;
    }
    
    /* Ensure intro text fits */
    .intro-section p {
        font-size: 0.8rem !important;
        line-height: 1.3 !important;
        padding: 0 0.25rem !important;
    }
    
    .intro-section .coffee-cta {
        font-size: 0.85rem !important;
        padding: 0 0.25rem !important;
    }
    
    /* Smaller buttons for tight space */
    .left-buttons button, .right-buttons button {
        font-size: 0.8rem !important;
        padding: 0.5rem 0.6rem !important;
        min-width: auto !important;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 0.75rem; /* Reduced padding for more space */
    }

    header {
        margin-bottom: 1rem; /* Reduced from 2rem to prevent overlap */
        min-height: 80px; /* Fixed height instead of auto for browser compatibility */
    }

    .button-bar {
        padding: 0.5rem; /* Reduced padding */
        gap: 0.5rem; /* Tighter gap */
        min-height: 60px; /* Fixed height instead of auto for browser compatibility */
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
        text-align: center;
        margin-bottom: 1rem; /* Add margin below button bar */
    }
    
    .left-buttons {
        justify-self: center;
        align-items: center;
        flex-direction: row;
        gap: 0.5rem;
        order: 3;
    }
    
    .center-logo {
        justify-self: center;
        order: 1;
        gap: 0.5rem;
        margin-bottom: 0.5rem; /* Add spacing below logo */
    }
    
    .right-buttons {
        justify-self: center;
        order: 2;
        gap: 0.5rem;
        margin-bottom: 0.5rem; /* Add spacing below buttons */
    }
    
    /* Mobile logo sizing */
    .logo.inline {
        width: 60px;
        height: 60px;
    }
    
    /* Mobile text scaling */
    .logo-text {
        font-size: 0.7rem !important; /* Smaller text */
        line-height: 1.2 !important;
    }
    
    /* Mobile coffee button styling */
    .coffee-gif {
        height: 30px; /* Smaller coffee button */
        border-radius: 4px;
        max-width: 70px;
    }
    
    .coffee-gif-button {
        border-radius: 6px;
        padding: 2px;
    }
    
    .header-btn {
        padding: 0.4rem 0.6rem; /* Smaller padding */
        font-size: 0.75rem; /* Smaller text */
        min-height: 28px; /* Smaller height */
        border-radius: 4px; /* Smaller border radius */
    }
    
    #mainHighScoreBtn {
        font-size: 0.7rem !important; /* Smaller high score button text */
    }

    .logo.inline {
        width: 60px !important; /* Override other mobile settings */
        height: 60px !important;
    }
    
    .logo-text {
        font-size: 0.7rem !important; /* Smaller logo text */
        line-height: 1.2 !important;
    }

    /* Responsive text scaling for all mobile elements */
    .games-title {
        font-size: 1.5rem !important; /* Smaller main title */
        margin-bottom: 0.75rem !important;
    }
    
    .game-tile h3 {
        font-size: 0.9rem !important; /* Smaller game tile titles */
        padding: 0.4rem !important;
    }
    
    .game-tile p {
        font-size: 0.75rem !important; /* Smaller game descriptions */
        padding: 0.5rem !important;
        line-height: 1.3 !important;
    }
    
    /* Additional spacing fixes - Prevent header overlap */
    .games-section {
        margin-top: 4rem !important; /* Much larger margin to clear entire header */
        padding-top: 2rem !important; /* Additional padding for safety */
        clear: both !important; /* Ensure it clears any floating elements */
    }
    
    .game-grid {
        margin-top: 2rem !important; /* Large additional margin above grid */
        padding-top: 1.5rem !important; /* More padding inside grid */
    }

    /* Ensure main content has enough top spacing */
    .main-content {
        padding-top: 1rem !important; /* Add top padding */
    }
    
    /* Make header position more predictable */
    header {
        position: relative !important;
        z-index: 100 !important; /* Ensure header stays above content */
        background: var(--bg-color) !important; /* Add background to prevent transparency */
        margin-bottom: 3rem !important; /* Much larger margin below header */
        padding-bottom: 1rem !important; /* More padding at bottom of header */
    }

    /* Ensure button bar doesn't contribute to overlap */
    .button-bar {
        margin-bottom: 2rem !important; /* Large margin below button bar */
        padding-bottom: 1rem !important; /* Additional padding */
    }

    /* Force game tiles to respect spacing */
    .game-tile {
        position: relative !important; /* Ensure normal document flow */
        top: 0 !important; /* Reset any positioning */
        margin-top: 1rem !important; /* Additional margin on each tile */
    }

    /* Add massive top spacing for mobile */
    body {
        padding-top: 1rem !important; /* Body padding for extra safety */
    }
    
    /* Ensure games section starts way below header - override the 0.25rem base margin! */
    .games-section.immediate {
        margin: 5rem 0 2rem 0 !important; /* Override the base 0.25rem top margin completely */
        padding-top: 2rem !important;
        position: relative !important; /* Ensure normal flow */
        top: 0 !important; /* Reset any positioning */
    }

    .disclaimer-text {
        max-width: 90%;
        text-align: center;
        font-size: 0.7rem !important; /* Smaller disclaimer text */
    }
    
    .disclaimer-summary {
        font-size: 0.75rem;
    }
    
    .disclaimer-tooltip {
        position: fixed;
        top: 50%;
        left: 50%;
        right: auto;
        transform: translate(-50%, -50%) scale(0.9);
        min-width: 280px;
        max-width: 90vw;
    }
    
    .info-icon:hover + .disclaimer-tooltip,
    .disclaimer-tooltip:hover,
    .info-icon:focus + .disclaimer-tooltip {
        transform: translate(-50%, -50%) scale(1);
    }

    .game-grid {
        display: grid;
        grid-template-columns: 1fr 1fr; /* Exactly 2 columns on mobile */
        gap: 0.75rem; /* Consistent gap */
        max-width: 100%;
        width: 100%;
        padding: 0.75rem; /* Uniform padding */
        margin: 0 auto; /* Center the grid */
        margin-top: 2rem !important; /* Keep the large margin for header clearance */
        box-sizing: border-box; /* Include padding in width calculation */
    }
    
    .game-tile {
        width: 100%; /* Full width of grid cell */
        height: auto; /* Let height adjust naturally */
        min-height: 140px; /* Minimum height for touch targets */
        max-height: 160px; /* Maximum height to prevent oversized tiles */
        padding: 0.6rem; /* Consistent internal padding */
        border-radius: 12px; /* Consistent radius */
        box-sizing: border-box; /* Include padding in size calculation */
        overflow: hidden; /* Prevent content overflow */
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        text-align: center;
        position: relative;
        /* Reset any absolute positioning */
        top: auto;
        left: auto;
        right: auto;
        bottom: auto;
    }
    
    .game-tile h3 {
        font-size: 0.85rem; /* Readable but compact */
        line-height: 1.2; /* Tight line height */
        margin: 0 0 0.4rem 0; /* Consistent margins */
        padding: 0.25rem; /* Small padding for readability */
        font-weight: 600; /* Slightly bolder for readability */
        color: var(--accent-color);
        text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8); /* Strong text shadow for visibility over background images */
        background: rgba(0, 0, 0, 0.6); /* Semi-transparent background for text visibility */
        border-radius: 6px; /* Rounded corners for background */
        position: relative; /* Ensure it's above background images */
        z-index: 10; /* Higher z-index to be above background */
    }
    
    .game-tile p {
        font-size: 0.7rem; /* Smaller description text */
        line-height: 1.3; /* Better readability */
        margin: 0; /* No margins */
        padding: 0.25rem; /* Small padding for readability */
        opacity: 0.95; /* Slight transparency for hierarchy */
        color: #ffffff; /* White text for visibility */
        text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8); /* Text shadow for visibility */
        background: rgba(0, 0, 0, 0.5); /* Semi-transparent background */
        border-radius: 4px; /* Rounded corners */
        overflow: hidden;
        display: -webkit-box;
        -webkit-line-clamp: 3; /* Limit to 3 lines */
        line-clamp: 3; /* Standard property for compatibility */
        -webkit-box-orient: vertical;
        position: relative; /* Ensure it's above background images */
        z-index: 10; /* Higher z-index */
    }
    
    .games-title {
        font-size: 1.8rem;
    }
    
    .games-subtitle {
        font-size: 0.9rem;
    }
    
    /* Mobile header adjustments */
    .compact-header {
        padding: 0.5rem;
    }
    
    .button-bar {
        grid-template-columns: 1fr 1fr 1fr; /* Three columns for side-by-side buttons */
        grid-template-rows: auto; /* Single row */
        gap: 0.5rem; /* Smaller gap for compact layout */
        padding: 0.75rem; /* Reduced padding */
        text-align: center;
        align-items: center; /* Center align all items */
    }
    
    .left-buttons, .center-logo, .right-buttons {
        justify-self: center;
        display: flex;
        justify-content: center;
        align-items: center;
    }
    
    .left-buttons, .right-buttons {
        width: auto; /* Let buttons size naturally */
        gap: 0.25rem; /* Smaller gap between individual buttons */
    }
    
    /* Make individual buttons smaller for mobile */
    .left-buttons button, .right-buttons button {
        padding: 0.5rem; /* Smaller button padding */
        min-width: auto; /* Remove minimum width */
        font-size: 0.8rem; /* Smaller text */
    }
    
    /* Adjust logo size for compact layout */
    .center-logo h1 {
        font-size: 1.2rem !important; /* Smaller logo text */
    }
    
    .center-logo {
        order: -1; /* Move logo to top on mobile */
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .logo.inline {
        width: 75px;
        height: 75px;
    }
    
    .logo-text {
        font-size: 0.85rem;
        text-align: center;
    }
    
    .header-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
    
    .header-btn .btn-text {
        font-size: 0.75rem;
    }
    
    .games-section.immediate .games-title {
        font-size: 1.8rem;
    }
    
    .mascot-container.compact {
        position: static;
        margin: 0.5rem auto;
        transform: none;
        display: flex;
        justify-content: center;
        align-items: center;
        flex-direction: column;
    }
    
    .mascot-speech-bubble.compact {
        position: static;
        margin-top: 0.5rem;
        transform: none;
        opacity: 1;
    }

    /* Responsive game canvas for mobile */
    #gameCanvas {
        max-width: 98vw;
        max-height: 75vh; /* Increased from 50vh to 75vh */
        width: auto;
        height: auto;
        border-radius: 12px;
        border-width: 2px;
        margin-top: 0.25rem;
    }

    .game-active-area {
        padding: 0.5rem 0.25rem 1rem 0.25rem;
        min-height: calc(100vh - 3rem); /* Maximize height */
        /* Enhanced touch responsiveness */
        touch-action: none;
        -webkit-user-select: none;
        -webkit-touch-callout: none;
        user-select: none;
        transition: transform 0.1s ease-out;
        
        /* iOS Safari specific fixes */
        position: relative;
        overflow: visible;
        -webkit-transform: translateZ(0); /* Force hardware acceleration */
        transform: translateZ(0);
    }
    
    /* Ensure canvas doesn't trigger viewport changes on iOS */
    .game-active-area canvas {
        pointer-events: auto;
        touch-action: none;
        -webkit-touch-callout: none;
        position: relative;
        max-width: 95vw !important;
        max-height: 70vh !important;
        -webkit-transform: translateZ(0); /* Force hardware acceleration */
        transform: translateZ(0);
    }
    
    /* Disable touch feedback scaling for mobile gaming to prevent bouncing */
    /* .game-active-area:active {
        transform: scale(0.98);
    } */
    
    /* Additional mobile touch fixes */
    @media (max-width: 768px) {
        .game-active-area:active {
            transform: none !important;
        }
        
        .game-active-area canvas:active {
            transform: none !important;
        }
        
        /* Prevent scaling on game elements for mobile */
        .game-active-area *:active {
            transform: none !important;
        }
        
        /* But allow button feedback to work */
        .restart-btn:active, .menu-btn:active, 
        .toggle-mode-btn:active, .control-btn:active {
            transform: translateY(0) !important;
        }
    }
    
    /* Ensure smooth touch interactions */
    canvas {
        touch-action: none;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
    }

    .back-btn {
        margin-left: 0.5rem;
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
    }
    
    /* Mobile game header styles */
    .game-header {
        flex-direction: column;
        gap: 0.5rem;
        margin-bottom: 1rem;
        padding: 0 0.5rem;
    }
    
    .high-score-btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
        width: 100%;
        max-width: 200px;
        align-self: center;
    }

    /* Mobile modal sizing */
    .restart-content {
        max-width: 90vw;
        padding: 1rem;
        min-width: 200px;
    }

    .game-tile {
        min-height: 8rem;
        padding: 1rem;
        aspect-ratio: 1.4;
    }

    .game-tile h2 {
        font-size: 1.2rem;
    }
    
    /* Coming-next-tile mobile adjustments */
    .coming-next-tile {
        padding: 1rem !important;
        /* Even smaller background image for mobile */
        background-size: 60px !important;
        /* Reduce hover effects on mobile */
        transform: none !important;
    }
    
    .coming-next-tile:hover {
        transform: translateY(-4px) scale(1.01) !important;
    }
    
    .coming-next-tile h3 {
        font-size: 1.1rem !important;
        margin-bottom: 4px !important;
        letter-spacing: 0.3px;
    }
    
    .coming-next-tile .mystery-text {
        font-size: 0.75rem !important;
        line-height: 1.2;
        margin-bottom: 0.6rem !important;
    }
    
    .coming-next-tile .support-message {
        padding: 0.6rem !important;
        margin: 0.6rem 0 !important;
        border-radius: 6px;
    }
    
    .coming-next-tile .support-message p {
        font-size: 0.7rem !important;
        line-height: 1.2;
    }
}

/* Additional mobile breakpoints for better responsive design */

/* Small mobile devices (iPhone SE, etc.) */
@media (max-width: 375px) {
    .coffee-button-container {
        transform: scale(0.5); /* Even smaller for very small screens */
        padding: 0.15rem;
    }
    
    #gameCanvas {
        max-width: 99vw;
        max-height: 80vh; /* Use more screen real estate */
    }
    
    header {
        height: 3rem;
        margin-bottom: 0.5rem;
    }
    
    .logo {
        height: 60px;
    }
}

/* Large mobile devices and small tablets */
@media (min-width: 481px) and (max-width: 768px) {
    /* Tablet/small desktop responsive layout */
    .button-bar {
        grid-template-columns: auto 1fr auto; /* Left - Center - Right layout */
        grid-template-rows: auto;
        gap: 1rem;
        padding: 0.75rem 1rem;
        align-items: center;
        min-height: 80px; /* Ensure adequate height */
    }
    
    .left-buttons, .right-buttons {
        display: flex;
        gap: 0.5rem;
        align-items: center;
    }
    
    .left-buttons {
        justify-content: flex-start;
    }
    
    .right-buttons {
        justify-content: flex-end;
    }
    
    .center-logo {
        justify-self: center;
        text-align: center;
    }
    
    .center-logo h1 {
        font-size: 1.4rem; /* Slightly smaller logo for this range */
        margin: 0;
    }
    
    /* Ensure header content fits properly */
    .intro-section {
        padding: 1rem;
        font-size: 0.95rem; /* Slightly smaller text */
    }
    
    .intro-section h2 {
        font-size: 1.2rem; /* Smaller heading */
    }
    
    .coffee-button-container {
        transform: scale(0.7);
        padding: 0.4rem;
    }
    
    .main-high-score-container {
        transform: scale(0.7);
        padding: 0.4rem;
        top: 60px; /* Adjust for larger scale */
    }
    
    #gameCanvas {
        max-width: 90vw;
        max-height: 70vh;
    }
    
    .game-active-area {
        padding: 1rem 0.5rem 1.5rem 0.5rem;
    }
}

/* Narrow mobile screens - 480px to 600px */
@media (min-width: 481px) and (max-width: 600px) {
    .intro-section p {
        font-size: 0.85rem; /* Smaller paragraph text */
        line-height: 1.4;
        padding: 0 0.5rem; /* Add side padding */
    }
    
    .intro-section .coffee-cta {
        font-size: 0.9rem; /* Smaller CTA text */
        padding: 0 0.5rem;
    }
    
    .center-logo h1 {
        font-size: 1.3rem !important; /* Even smaller logo */
    }
    
    /* Ensure button text fits */
    .left-buttons button, .right-buttons button {
        font-size: 0.85rem;
        padding: 0.6rem 0.8rem;
    }
    
    /* More compact header */
    .button-bar {
        padding: 0.5rem 0.75rem;
        min-height: 70px;
    }
}

/* Landscape mobile devices */
@media (max-height: 500px) and (orientation: landscape) {
    .coffee-button-container {
        transform: scale(0.5);
        position: fixed;
        top: 0.15rem;
        left: 0.15rem;
    }
    
    .main-high-score-container {
        transform: scale(0.5);
        position: fixed;
        top: 35px; /* Closer together in landscape */
        left: 0.15rem;
    }
    
    #gameCanvas {
        max-height: 85vh; /* Use almost full height in landscape */
        max-width: 95vw;
    }
    
    .game-active-area {
        padding: 0.25rem;
        min-height: calc(100vh - 2rem);
    }
    
    header {
        height: 2.5rem;
        margin-bottom: 0.25rem;
    }
    
    .logo {
        height: 45px;
    }
}

/* Responsive Design for Arcade Panels */

/* Large Desktop Screens */
@media (min-width: 1400px) {
    .arcade-title {
        font-size: 18px;
        letter-spacing: 4px;
    }
    
    .pixel-ship, .pixel-invader {
        transform: scale(1.2);
    }
    
    .digital-numbers {
        font-size: 16px;
    }
    
    .neon-border {
        width: 85%;
        height: 90%;
    }
}

/* Standard Desktop */
@media (min-width: 1024px) and (max-width: 1399px) {
    .arcade-title {
        font-size: 15px;
        letter-spacing: 2px;
    }
    
    .pixel-art-container {
        padding: 15px 8px;
    }
}

/* Tablet Landscape */
@media (min-width: 768px) and (max-width: 1023px) {
    .ad-container {
        display: none;
    }
}

/* Mobile Portrait - Hide sidebars completely */
@media (max-width: 767px) {
    .ad-container {
        display: none;
    }
    
    body {
        grid-template-columns: 1fr;
    }
}

/* Small Desktop/Laptop */
@media (min-width: 1024px) and (max-height: 768px) {
    .pixel-art-container {
        padding: 10px 5px;
        justify-content: space-between;
    }
    
    .arcade-title {
        font-size: 12px;
        margin-bottom: 5px;
    }
    
    .pixel-ship, .pixel-invader {
        margin: 8px 0;
        transform: scale(0.8);
    }
    
    .digital-numbers {
        font-size: 11px;
    }
    
    .score-display {
        font-size: 8px;
    }
}

/* Ultra-wide screens */
@media (min-width: 1600px) {
    .retro-grid {
        background-size: 25px 25px;
    }
    
    .neon-border {
        border-width: 3px;
        border-radius: 20px;
    }
    
    .pixel-ship, .pixel-invader {
        transform: scale(1.5);
    }
    
    .arcade-title {
        font-size: 20px;
        letter-spacing: 5px;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .neon-border {
        border-width: 1px;
    }
    
    .retro-grid {
        background-size: 15px 15px;
    }
}

/* Dark mode specific arcade styling */
body.dark-mode .arcade-panel {
    background: linear-gradient(180deg, #0a0a0a 0%, #1a1a2e 50%, #000000 100%);
}

body.dark-mode .retro-grid {
    background-image: 
        linear-gradient(rgba(0,255,255,0.15) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,255,255,0.15) 1px, transparent 1px);
}

/* Arcade panels maintain dark theme regardless of mode - no light mode overrides */

/* Header Controls */
.header-controls {
    position: fixed;
    top: 20px;
    right: 180px; /* 160px sidebar + 20px buffer */
    display: flex;
    gap: 15px;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.8);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-radius: 50px;
    padding: 8px 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* Hide pause/restart controls for now */
.game-controls {
    display: none !important;
}

.control-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
    position: relative;
    overflow: hidden;
}

.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.5);
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.control-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.control-btn svg {
    width: 20px;
    height: 20px;
    fill: white;
    transition: all 0.3s ease;
}

.control-btn:hover svg {
    transform: scale(1.1);
}

/* Audio and theme icon states - controls CSS visibility instead of inline styles */
.audio-off {
    display: none;
}

.theme-light {
    display: none;
}

/* When audio is disabled, show audio-off icon instead */
.audio-disabled .audio-on {
    display: none;
}

.audio-disabled .audio-off {
    display: block;
}

/* Dark mode adjustments for header controls */
body.dark-mode .header-controls {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

body.dark-mode .theme-light {
    display: block;
}

body.dark-mode .theme-dark {
    display: none;
}

/* Coffee button styling */
.bmc-btn {
    background: linear-gradient(45deg, #ff6b6b, #ff8e53) !important;
    border: 2px solid #fff !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4) !important;
    transition: all 0.3s ease !important;
    font-weight: bold !important;
}

.bmc-btn:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.6) !important;
}

/* Mobile responsiveness for header controls */
@media (max-width: 768px) {
    .header-controls {
        top: 15px;
        right: 15px; /* Back to edge on mobile since sidebars are hidden */
        gap: 10px;
        padding: 6px 12px;
    }
    
    .control-btn {
        width: 36px;
        height: 36px;
    }
    
    .control-btn svg {
        width: 18px;
        height: 18px;
    }
}

@media (max-width: 480px) {
    .header-controls {
        top: 10px;
        right: 10px;
        gap: 8px;
        padding: 4px 8px;
    }
    
    .control-btn {
        width: 32px;
        height: 32px;
    }
    
    .control-btn svg {
        width: 16px;
        height: 16px;
    }
}

/* ========================================
   COOKIE CONSENT BANNER
   ======================================== */

.cookie-consent-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #2C3E50 0%, #34495E 100%);
    border-top: 2px solid #3498DB;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    padding: 16px 20px;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Arial', sans-serif;
}

.cookie-consent-banner.show {
    transform: translateY(0);
}

.cookie-consent-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.cookie-consent-text {
    flex: 1;
    min-width: 300px;
    color: #ECF0F1;
    font-size: 14px;
    line-height: 1.5;
}

.cookie-consent-text strong {
    color: #3498DB;
    font-weight: 600;
}

.cookie-disclaimer {
    margin-top: 6px;
    font-size: 12px;
    color: #BDC3C7;
    font-style: italic;
}

.cookie-disclaimer .info-icon {
    margin-right: 4px;
    opacity: 0.8;
}

.cookie-consent-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-shrink: 0;
}

.cookie-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 100px;
}

.cookie-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.cookie-btn.accept {
    background: linear-gradient(135deg, #27AE60 0%, #2ECC71 100%);
    color: white;
}

.cookie-btn.accept:hover {
    background: linear-gradient(135deg, #229954 0%, #27AE60 100%);
}

.cookie-btn.decline {
    background: transparent;
    color: #BDC3C7;
    border: 1px solid #7F8C8D;
}

.cookie-btn.decline:hover {
    background: #34495E;
    color: #ECF0F1;
    border-color: #95A5A6;
}

.privacy-link-banner {
    color: #3498DB;
    text-decoration: none;
    font-size: 13px;
    margin-left: 15px;
    transition: color 0.3s ease;
}

.privacy-link-banner:hover {
    color: #5DADE2;
    text-decoration: underline;
}

/* Mobile Responsive Cookie Banner */
@media (max-width: 768px) {
    .cookie-consent-banner {
        padding: 14px 16px;
    }
    
    .cookie-consent-content {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
        text-align: center;
    }
    
    .cookie-consent-text {
        min-width: unset;
        font-size: 13px;
    }
    
    .cookie-disclaimer {
        font-size: 11px;
    }
    
    .cookie-consent-actions {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .cookie-btn {
        flex: 1;
        min-width: 90px;
        padding: 12px 16px;
        font-size: 13px;
    }
    
    .privacy-link-banner {
        margin-left: 0;
        margin-top: 8px;
        display: block;
    }
}

@media (max-width: 480px) {
    .cookie-consent-banner {
        padding: 12px 14px;
    }
    
    .cookie-consent-text {
        font-size: 12px;
    }
    
    .cookie-disclaimer {
        font-size: 10px;
    }
    
    .cookie-btn {
        padding: 10px 14px;
        font-size: 12px;
        min-width: 80px;
    }
}

/* Cookie Banner Animation */
@keyframes slideUpFade {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.cookie-consent-banner.animate-in {
    animation: slideUpFade 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Ensure banner doesn't interfere with footer */
body.cookie-banner-visible {
    padding-bottom: 120px;
}

@media (max-width: 768px) {
    body.cookie-banner-visible {
        padding-bottom: 140px;
    }
}

@media (max-width: 480px) {
    body.cookie-banner-visible {
        padding-bottom: 160px;
    }
}

/* Cookie warnings in score displays */
.cookie-warning,
.cookie-disclaimer {
    font-size: 12px;
    color: #F39C12;
    font-style: italic;
    margin-top: 8px;
    text-align: center;
    padding: 8px 12px;
    background: rgba(243, 156, 18, 0.1);
    border-radius: 4px;
    border-left: 3px solid #F39C12;
}

.cookie-warning {
    margin-bottom: 12px;
}

.cookie-disclaimer {
    margin-bottom: 16px;
}

/* Very small mobile devices (small phones in portrait) */
@media (max-width: 360px) {
    .game-grid {
        grid-template-columns: 1fr 1fr; /* Still 2 columns but smaller */
        gap: 0.5rem; /* Smaller gap for tiny screens */
        padding: 0.5rem; /* Reduced padding */
    }
    
    .game-tile {
        min-height: 120px; /* Smaller height for tiny screens */
        max-height: 140px; /* Adjusted max height */
        padding: 0.5rem; /* Reduced padding */
        border-radius: 10px; /* Smaller radius */
    }
    
    .game-tile h3 {
        font-size: 0.75rem; /* Smaller text for tiny screens */
        margin-bottom: 0.3rem;
        padding: 0.2rem; /* Small padding for readability */
        background: rgba(0, 0, 0, 0.6); /* Background for visibility */
        border-radius: 4px;
        text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
        color: var(--accent-color);
        position: relative;
        z-index: 10;
    }
    
    .game-tile p {
        font-size: 0.65rem; /* Very small description text */
        line-height: 1.2;
        padding: 0.2rem; /* Small padding */
        background: rgba(0, 0, 0, 0.5);
        border-radius: 3px;
        text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
        color: #ffffff;
        position: relative;
        z-index: 10;
        -webkit-line-clamp: 2; /* Only 2 lines on tiny screens */
        line-clamp: 2;
    }
    
    .games-title {
        font-size: 1.5rem; /* Smaller title for tiny screens */
    }
}

/* Mobile landscape mode - better use of horizontal space */
@media (max-width: 768px) and (orientation: landscape) {
    .game-grid {
        grid-template-columns: 1fr 1fr 1fr; /* 3 columns in landscape */
        gap: 0.6rem;
        padding: 1rem 0.75rem; /* More side padding in landscape */
        max-width: 100%;
    }
    
    .game-tile {
        min-height: 110px; /* Smaller height for landscape */
        max-height: 130px;
        padding: 0.5rem;
    }
    
    .game-tile h3 {
        font-size: 0.8rem; /* Smaller text for landscape */
        margin-bottom: 0.3rem;
        padding: 0.2rem;
        background: rgba(0, 0, 0, 0.6);
        border-radius: 4px;
        text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
        color: var(--accent-color);
        position: relative;
        z-index: 10;
    }
    
    .game-tile p {
        font-size: 0.65rem;
        line-height: 1.2;
        padding: 0.2rem;
        background: rgba(0, 0, 0, 0.5);
        border-radius: 3px;
        text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
        color: #ffffff;
        position: relative;
        z-index: 10;
        -webkit-line-clamp: 2; /* Fewer lines in landscape */
        line-clamp: 2;
    }
    
    /* Compact header and content for landscape */
    header {
        margin-bottom: 1.5rem !important; /* Smaller margin in landscape */
    }
    
    .games-section.immediate {
        margin: 2rem 0 2rem 0 !important; /* Smaller top margin in landscape */
        padding-top: 1rem !important;
    }
}

@media (max-width: 768px) {
    .cookie-warning,
    .cookie-disclaimer {
        font-size: 11px;
        padding: 6px 10px;
    }
}
