:root {
    --background: linear-gradient(135deg, #000428 0%, #004e92 100%);
    --text-color: #fff;
    --game-info-bg: rgba(0, 0, 0, 0.7);
    --game-info-border: #00f;
    --canvas-border: #00f;
    --instructions-bg: rgba(0, 0, 0, 0.5);
    --instructions-border: #333;
}

body {
    margin: 0;
    padding: 20px;
    background: var(--background);
    color: var(--text-color);
    font-family: 'Courier New', monospace;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    overflow-x: hidden;
    transition: background 0.3s ease, color 0.3s ease;
}

/* ZPacman Logo Styles */
#zpacmanLogo {
    text-align: center;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

#zpacmanLogo .logo-icon {
    animation: logoBounce 3s ease-in-out infinite;
}

#zpacmanLogo .logo-icon svg {
    filter: drop-shadow(0 0 10px rgba(255, 255, 0, 0.6));
}

/* ZPacman bow animation */
#zpacmanLogo .logo-icon svg g[transform*="translate(30, 8)"] {
    animation: bowWiggle 4s ease-in-out infinite;
}

/* Quest Log Styles */
.quest-log-button {
    /* Inherits from .control-button */
    background: var(--game-info-bg);
    border: 2px solid var(--game-info-border);
    color: var(--text-color);
    transition: all 0.3s ease;
}

.quest-log-button:hover {
    background: var(--game-info-border);
    color: var(--game-info-bg);
    transform: scale(1.05);
}

.pause-button {
    /* Inherits from .control-button */
    background: var(--game-info-bg);
    border: 2px solid var(--game-info-border);
    color: var(--text-color);
    transition: all 0.3s ease;
}

.pause-button:hover {
    background: var(--game-info-border);
    color: var(--game-info-bg);
    transform: scale(1.05);
}

.mobile-audio-button {
    /* Inherits from .control-button */
    background: var(--game-info-bg);
    border: 2px solid #ff6b35;
    color: #ff6b35;
    transition: all 0.3s ease;
}

.mobile-audio-button:hover {
    background: #ff6b35;
    color: var(--game-info-bg);
    transform: scale(1.05);
}

.mobile-audio-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.quest-log-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.quest-log-modal.active {
    display: flex;
}

.quest-log-content {
    background: white;
    border-radius: 15px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.quest-log-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.quest-log-header h2 {
    margin: 0;
    font-size: 24px;
}

.close-button {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Improve touch targets for mobile */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
}

.quest-log-tabs {
    display: flex;
    background: #f5f5f5;
    border-bottom: 1px solid #ddd;
}

.tab-button {
    flex: 1;
    padding: 15px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.3s ease;
    /* Improve touch targets for mobile */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
}

.tab-button.active {
    background: white;
    color: #667eea;
    border-bottom: 3px solid #667eea;
}

.quest-log-body {
    max-height: 60vh;
    overflow-y: auto;
}

.tab-content {
    display: none;
    padding: 20px;
}

.tab-content.active {
    display: block;
}

.quest-categories, .achievement-categories {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.category-button {
    padding: 8px 16px;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    /* Improve touch targets for mobile */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
}

.category-button.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.quests-list, .achievements-list {
    display: grid;
    gap: 15px;
}

.quest-item, .achievement-item {
    display: flex;
    align-items: center;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 10px;
    border-left: 4px solid #ddd;
    transition: all 0.3s ease;
}

.quest-item.completed, .achievement-item.completed {
    border-left-color: #4CAF50;
    background: #f0f8f0;
}

.quest-icon, .achievement-icon {
    font-size: 24px;
    margin-right: 15px;
    width: 40px;
    text-align: center;
}

.quest-info, .achievement-info {
    flex: 1;
}

.quest-title, .achievement-title {
    margin: 0 0 5px 0;
    font-size: 16px;
    font-weight: bold;
    color: #333;
}

.quest-description, .achievement-description {
    margin: 0 0 5px 0;
    color: #666;
    font-size: 14px;
}

.quest-reward {
    font-size: 12px;
    color: #4CAF50;
    font-weight: bold;
}

.quest-status, .achievement-status {
    font-size: 20px;
    margin-left: 10px;
}

/* Notifications */
.quest-notification, .achievement-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    padding: 15px;
    max-width: 300px;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 3000;
}

.quest-notification.show, .achievement-notification.show {
    transform: translateX(0);
}

.notification-content {
    display: flex;
    align-items: center;
}

.notification-icon {
    font-size: 24px;
    margin-right: 15px;
}

.notification-text h3 {
    margin: 0 0 5px 0;
    font-size: 16px;
    color: #333;
}

.notification-text p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

.notification-text .reward {
    color: #4CAF50;
    font-weight: bold;
}

/* Responsive Design */
@media (max-width: 768px) {
    .quest-log-content {
        width: 95%;
        max-height: 90vh;
    }
    
    .quest-log-header h2 {
        font-size: 20px;
    }
    
    .tab-button {
        padding: 12px;
        font-size: 14px;
    }
    
    .quest-item, .achievement-item {
        padding: 12px;
    }
    
    .quest-icon, .achievement-icon {
        font-size: 20px;
        width: 30px;
    }
    
    .quest-title, .achievement-title {
        font-size: 14px;
    }
    
    .quest-description, .achievement-description {
        font-size: 12px;
    }
    
    /* Mobile controls adjustments */
    .controls-container {
        gap: 8px;
        margin-bottom: 8px;
    }
    
    .control-button {
        min-width: 36px;
        height: 36px;
        font-size: 14px;
        padding: 6px 8px;
    }
    
    .quest-log-button {
        font-size: 14px;
    }
}

@keyframes bowWiggle {
    0%, 100% {
        transform: translate(30px, 8px) rotate(0deg);
    }
    25% {
        transform: translate(30px, 8px) rotate(-2deg);
    }
    75% {
        transform: translate(30px, 8px) rotate(2deg);
    }
}

#zpacmanLogo .logo-text {
    background: linear-gradient(45deg, #ffff00, #ffd700, #ffff00);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-family: 'Arial Black', sans-serif;
    font-size: 48px;
    font-weight: bold;
    letter-spacing: 2px;
    text-shadow: 0 0 20px rgba(255, 255, 0, 0.8);
    animation: logoGlow 2s ease-in-out infinite alternate;
}

#zpacmanLogo .logo-subtitle {
    font-size: 16px;
    color: #ccc;
    font-family: 'Courier New', monospace;
    opacity: 0.8;
    margin-top: -5px;
}

@keyframes logoGlow {
    0% {
        text-shadow: 0 0 20px rgba(255, 255, 0, 0.8);
    }
    100% {
        text-shadow: 0 0 30px rgba(255, 255, 0, 1), 0 0 40px rgba(255, 255, 0, 0.6);
    }
}

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

#gameContainer {
    text-align: center;
    position: relative;
}

#gameInfo {
    display: flex;
    justify-content: space-between;
    width: 560px;
    margin-bottom: 10px;
    font-size: 18px;
    font-weight: bold;
    background: var(--game-info-bg);
    padding: 10px;
    border-radius: 8px;
    border: 2px solid var(--game-info-border);
    transition: background 0.3s ease, border-color 0.3s ease;
}

#gameCanvas {
    border: 3px solid var(--canvas-border);
    background: #000;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0, 0, 255, 0.5);
    transition: border-color 0.3s ease;
    display: block;
    margin: 0 auto;
}

#loadingIndicator {
    color: #fff;
    text-align: center;
    margin: 10px 0;
    font-size: 16px;
    font-weight: bold;
    background: rgba(0, 0, 0, 0.8);
    padding: 10px;
    border-radius: 8px;
    border: 2px solid var(--game-info-border);
}

#gameOver {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.95);
    color: #ff0;
    padding: 30px;
    border: 3px solid #ff0;
    border-radius: 15px;
    text-align: center;
    font-size: 24px;
    display: none;
    box-shadow: 0 0 30px rgba(255, 255, 0, 0.5);
    backdrop-filter: blur(10px);
}

#instructions {
    margin-top: 20px;
    color: #ccc;
    text-align: center;
    background: var(--instructions-bg);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--instructions-border);
    transition: background 0.3s ease, border-color 0.3s ease;
}

.desktop-instructions, .mobile-instructions, .game-rules {
    margin-bottom: 10px;
}

.desktop-instructions p, .mobile-instructions p, .game-rules p {
    margin: 5px 0;
}

.controls-container {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    justify-content: center;
}

.control-button {
    background: var(--game-info-bg);
    border: 2px solid var(--game-info-border);
    color: var(--text-color);
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Improve touch targets for mobile */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
}

.control-button:hover {
    background: var(--game-info-border);
    color: var(--game-info-bg);
    transform: scale(1.05);
}

.control-button:active {
    transform: scale(0.95);
}

.power-pellet-status {
    background: var(--game-info-bg);
    border: 2px solid #ff0;
    color: #ff0;
    padding: 8px 15px;
    border-radius: 8px;
    text-align: center;
    font-weight: bold;
    font-size: 16px;
    margin-bottom: 10px;
    transition: all 0.3s ease;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

.level-indicator {
    color: #ff69b4;
    font-size: 20px;
    margin-bottom: 10px;
    text-shadow: 0 0 10px rgba(255, 105, 180, 0.5);
}

/* Joystick styles */
.joystick-container {
    display: none;
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
}

.joystick {
    width: 120px;
    height: 120px;
    background: rgba(0, 0, 0, 0.8);
    border: 3px solid var(--game-info-border);
    border-radius: 50%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 20px rgba(0, 0, 255, 0.3);
    backdrop-filter: blur(10px);
}

.joystick-handle {
    width: 50px;
    height: 50px;
    background: var(--game-info-border);
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    cursor: pointer;
    transition: all 0.1s ease;
    box-shadow: 0 0 10px rgba(0, 0, 255, 0.5);
}

.joystick-handle:active {
    transform: scale(0.9);
    box-shadow: 0 0 15px rgba(0, 0, 255, 0.8);
}

.joystick.active .joystick-handle {
    background: #ff0;
    box-shadow: 0 0 20px rgba(255, 255, 0, 0.8);
}

/* Add some visual feedback for direction indicators */
.joystick::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: transparent;
    border: 2px solid rgba(0, 0, 255, 0.3);
    pointer-events: none;
}

/* iOS-specific styles */
@supports (-webkit-touch-callout: none) {
    #gameCanvas {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }
    
    body {
        -webkit-text-size-adjust: 100%;
        -webkit-tap-highlight-color: transparent;
    }
}

/* Responsive design */
@media (max-width: 600px) {
    body {
        padding: 10px;
        min-height: 100vh;
        display: flex;
        flex-direction: column;
    }
    
    #gameContainer {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    
    #gameInfo {
        width: 100%;
        max-width: 560px;
        font-size: 14px;
        flex-wrap: wrap;
        gap: 5px;
        margin-bottom: 5px;
    }
    
    #gameCanvas {
        width: 100%;
        max-width: 560px;
        height: auto;
        max-height: 60vh;
        margin: 10px 0;
    }
    
    #instructions {
        font-size: 12px;
        margin-top: 10px;
        padding: 10px;
    }
    
    .joystick-container {
        display: block;
        bottom: 20px;
    }
    
    .joystick {
        width: 100px;
        height: 100px;
    }
    
    .joystick-handle {
        width: 40px;
        height: 40px;
    }
    
    .level-indicator {
        font-size: 16px;
    }
    
    .power-pellet-status {
        font-size: 14px;
        padding: 6px 12px;
    }
    
    /* Mobile logo adjustments */
    #zpacmanLogo .logo-text {
        font-size: 36px;
    }
    
    #zpacmanLogo .logo-icon svg {
        width: 50px;
        height: 50px;
    }
    
    #zpacmanLogo .logo-subtitle {
        font-size: 14px;
    }
    
    /* Start prompt mobile adjustments */
    #startPrompt {
        font-size: 16px !important;
        padding: 15px !important;
    }
    
    /* Mobile controls adjustments */
    .controls-container {
        gap: 6px;
        margin-bottom: 6px;
    }
    
    .control-button {
        min-width: 32px;
        height: 32px;
        font-size: 12px;
        padding: 4px 6px;
    }
    
    .quest-log-button {
        font-size: 12px;
    }
    
    .pause-button {
        font-size: 12px;
    }
    
    .mobile-audio-button {
        font-size: 12px;
    }
}

/* Copyright Footer */
.copyright {
    text-align: center;
    padding: 20px 0;
    margin-top: 20px;
    border-top: 1px solid var(--game-info-border);
    color: var(--text-color);
    font-size: 14px;
    opacity: 0.8;
}

.copyright p {
    margin: 0;
    font-weight: 500;
}

/* Mobile copyright adjustments */
@media (max-width: 768px) {
    .copyright {
        padding: 15px 0;
        margin-top: 15px;
        font-size: 12px;
    }
}

@media (max-width: 600px) {
    .copyright {
        padding: 10px 0;
        margin-top: 10px;
        font-size: 11px;
    }
}

/* Banner Ads Styles */
.banner-ads-container {
    width: 100%;
    background: var(--background);
    border-bottom: 2px solid var(--game-info-border);
    padding: 10px 0;
    margin-bottom: 10px;
    text-align: center;
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.banner-ad-content {
    max-width: 728px;
    width: 100%;
    margin: 0 auto;
    position: relative;
}

.banner-ad-fallback {
    width: 100%;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f0f0f0 0%, #e0e0e0 100%);
    border: 2px dashed var(--game-info-border);
    border-radius: 8px;
}

.ad-placeholder {
    text-align: center;
    color: var(--text-color);
    opacity: 0.7;
}

.ad-label {
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
    color: #666;
}

.ad-sponsor {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 5px;
    color: var(--text-color);
}

.ad-message {
    font-size: 11px;
    color: #888;
    font-style: italic;
}

.ad-dev-note {
    font-size: 10px;
    color: #999;
    font-style: italic;
    margin-top: 3px;
}

/* AdSense Styles */
.adsbygoogle {
    display: block;
    width: 100%;
    height: 90px;
    margin: 0 auto;
}

/* Amazon Ads Styles */
.amazon-ad {
    width: 100%;
    height: 90px;
    background: #f8f8f8;
    border: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 12px;
}

/* Media.net Ads Styles */
.medianet-ad {
    width: 100%;
    height: 90px;
    background: #f8f8f8;
    border: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 12px;
}

/* Responsive Banner Ads */
@media (max-width: 768px) {
    .banner-ads-container {
        padding: 8px 0;
        margin-bottom: 8px;
        min-height: 60px;
    }
    
    .banner-ad-fallback {
        height: 60px;
    }
    
    .adsbygoogle {
        height: 60px;
    }
    
    .amazon-ad,
    .medianet-ad {
        height: 60px;
        font-size: 10px;
    }
    
    .ad-label {
        font-size: 10px;
    }
    
    .ad-sponsor {
        font-size: 12px;
    }
    
    .ad-message {
        font-size: 9px;
    }
    
    .ad-dev-note {
        font-size: 8px;
    }
}

@media (max-width: 600px) {
    .banner-ads-container {
        padding: 5px 0;
        margin-bottom: 5px;
        min-height: 50px;
    }
    
    .banner-ad-fallback {
        height: 50px;
    }
    
    .adsbygoogle {
        height: 50px;
    }
    
    .amazon-ad,
    .medianet-ad {
        height: 50px;
        font-size: 9px;
    }
    
    .ad-label {
        font-size: 9px;
    }
    
    .ad-sponsor {
        font-size: 11px;
    }
    
    .ad-message {
        font-size: 8px;
    }
} 