/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #a8e6cf, #dcedc8);
    min-height: 100vh;
    color: #2c3e50;
}

.game-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 8px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header Styles */
.game-header {
    text-align: center;
    margin-bottom: 6px;
    background: white;
    padding: 6px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.game-header h1 {
    font-size: 1.1em;
    color: #2c5530;
    margin-bottom: 4px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

.header-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    gap: 8px;
}

.score-board {
    display: flex;
    gap: 15px;
    align-items: center;
}

.dog-counters {
    display: flex;
    gap: 10px;
    align-items: center;
}

.score, .question-counter {
    font-size: 0.85em;
    font-weight: bold;
    color: #2c5530;
}

.progress-container {
    width: 100%;
}

.progress-bar {
    width: 100%;
    height: 4px;
    background-color: #e0e0e0;
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4caf50, #8bc34a);
    width: 0%;
    transition: width 0.3s ease;
}

/* Walking Dogs Section */
.walking-dogs-section {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    padding: 4px;
    margin-bottom: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    height: 40px;
    overflow: hidden;
    position: relative;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.dog-count {
    font-size: 0.8em;
    font-weight: bold;
    color: #2c5530;
    background: rgba(76, 175, 80, 0.1);
    padding: 2px 8px;
    border-radius: 12px;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.dog-count span {
    color: #4caf50;
}

.walking-dogs-container {
    position: relative;
    height: 100%;
}

/* Dog Park Section */
.dog-park-section {
    background: linear-gradient(to bottom, #87CEEB, #98D8C8);
    border-radius: 8px;
    padding: 3px;
    margin-bottom: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    min-height: 35px;
    position: relative;
    overflow: hidden;
}

.dog-park-title {
    text-align: center;
    color: #2c5530;
    margin-bottom: 1px;
    font-size: 0.75em;
}

.dog-park-container {
    position: relative;
    min-height: 20px;
}

/* Dog Wrapper for proper directional movement */
.dog-wrapper {
    position: absolute;
    width: 50px;
    height: 30px;
}

/* CSS Animated Dog Styles */
.css-dog {
    position: relative;
    width: 100px;
    height: 60px;
    transform-origin: top left;
    transform: scale(0.5);
}

.dog-body {
    position: absolute;
    width: 60px;
    height: 25px;
    background: #F5DEB3;
    border: 2px solid #000;
    border-radius: 20px 15px 15px 8px;
    top: 20px;
    left: 15px;
}

/* Multiple brown spots on body */
.dog-body::before {
    content: '';
    position: absolute;
    width: 12px;
    height: 8px;
    background: #8B4513;
    border-radius: 50%;
    top: 3px;
    left: 8px;
    box-shadow: 
        20px 5px 0 -2px #8B4513,
        10px 12px 0 -4px #8B4513,
        35px 10px 0 -3px #8B4513,
        45px 2px 0 -4px #8B4513;
}

.dog-body::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 6px;
    background: #8B4513;
    border-radius: 50%;
    top: 15px;
    left: 25px;
    box-shadow: 
        15px -3px 0 -2px #8B4513,
        -10px 2px 0 -1px #8B4513;
}

.dog-head {
    position: absolute;
    width: 30px;
    height: 30px;
    background: #F5DEB3;
    border: 2px solid #000;
    border-radius: 12px 20px 12px 8px;
    top: 15px;
    right: 0px;
}

/* Multiple brown spots on head */
.dog-head::before {
    content: '';
    position: absolute;
    width: 10px;
    height: 8px;
    background: #8B4513;
    border-radius: 50%;
    top: 5px;
    left: 8px;
    box-shadow: 
        8px 8px 0 -3px #8B4513,
        -3px 12px 0 -4px #8B4513;
}

/* Dog snout - makes it look more dog-like */
.dog-snout {
    position: absolute;
    width: 15px;
    height: 12px;
    background: #F5DEB3;
    border: 1px solid #000;
    border-radius: 8px;
    top: 20px;
    right: -8px;
}

.dog-ear {
    position: absolute;
    width: 12px;
    height: 20px;
    background: #8B4513;
    border: 2px solid #000;
    border-radius: 60% 40% 40% 60%;
    transform-origin: top center;
    z-index: 5;
}

.ear-left { 
    top: 2px; 
    left: -3px; 
    transform: rotate(-30deg);
    animation: earFlop 1.2s ease-in-out infinite;
}

.dog-eye {
    position: absolute;
    width: 4px;
    height: 4px;
    background: #000;
    border-radius: 50%;
    top: 10px;
}

.eye-left { left: 8px; }
.eye-right { left: 18px; }

.dog-nose {
    position: absolute;
    width: 8px;
    height: 6px;
    background: #000;
    border-radius: 50% 50% 0 0;
    top: 6px;
    right: -2px;
    z-index: 3;
}

/* Add nostrils */
.dog-nose::before {
    content: '';
    position: absolute;
    width: 2px;
    height: 2px;
    background: #555;
    border-radius: 50%;
    top: 2px;
    left: 2px;
}

.dog-nose::after {
    content: '';
    position: absolute;
    width: 2px;
    height: 2px;
    background: #555;
    border-radius: 50%;
    top: 2px;
    right: 2px;
}

.dog-leg {
    position: absolute;
    width: 5px;
    height: 18px;
    background: #F5DEB3;
    border: 1px solid #000;
    border-radius: 3px;
    bottom: 0;
    transform-origin: top center;
}

.leg-fl { left: 25px; animation: frontLegWalk 0.4s ease-in-out infinite; }
.leg-fr { left: 35px; animation: frontLegWalk 0.4s ease-in-out infinite reverse; }
.leg-bl { left: 55px; animation: backLegWalk 0.4s ease-in-out infinite reverse; }
.leg-br { left: 65px; animation: backLegWalk 0.4s ease-in-out infinite; }

.dog-tail {
    position: absolute;
    width: 3px;
    height: 20px;
    top: 12px;
    left: 18px;
    transform-origin: bottom center;
    z-index: -1;
}

.dog-tail::before {
    content: '';
    position: absolute;
    width: 3px;
    height: 12px;
    background: #F5DEB3;
    border: 1px solid #000;
    border-radius: 2px;
    bottom: 0;
    animation: tailWag1 0.8s ease-in-out infinite;
    transform-origin: bottom center;
}

.dog-tail::after {
    content: '';
    position: absolute;
    width: 3px;
    height: 10px;
    background: #F5DEB3;
    border: 1px solid #000;
    border-radius: 2px;
    top: 8px;
    left: 0;
    animation: tailWag2 0.8s ease-in-out infinite;
    transform-origin: bottom center;
}

/* Dog Animations */
@keyframes dogFlipOnBack {
    0% { transform: rotateX(0deg); }
    20% { transform: rotateX(180deg); }
    70% { transform: rotateX(180deg); }
    100% { transform: rotateX(0deg); }
}

.dog-flipper {
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
}

.dog-flipper.dog-flipping {
    animation: dogFlipOnBack 1.5s ease-in-out;
}

@keyframes frontLegWalk {
    0%, 100% { transform: rotate(0deg) translateY(0px); }
    25% { transform: rotate(25deg) translateY(-3px); }
    50% { transform: rotate(0deg) translateY(0px); }
    75% { transform: rotate(-25deg) translateY(-3px); }
}

@keyframes backLegWalk {
    0%, 100% { transform: rotate(0deg) translateY(0px); }
    25% { transform: rotate(-20deg) translateY(-3px); }
    50% { transform: rotate(0deg) translateY(0px); }
    75% { transform: rotate(20deg) translateY(-3px); }
}

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

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

@keyframes earFlop {
    0%, 100% { transform: rotate(-30deg); }
    50% { transform: rotate(-40deg); }
}

@keyframes walkRight {
    from { left: -50px; } /* Adjusted for new dog size */
    to { left: calc(100% + 50px); } /* Adjusted for new dog size */
}

@keyframes walkLeft {
    from { right: -50px; } /* Adjusted for new dog size */
    to { right: calc(100% + 50px); } /* Adjusted for new dog size */
}

.walking-right {
    animation: walkRight 12s linear infinite;
}

.walking-left {
    animation: walkLeft 12s linear infinite;
    transform: scaleX(-1);
}

/* Pause animations when needed */
.dog-wrapper.paused * {
    animation-play-state: paused !important;
}

/* Game Content */
.game-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-height: 300px;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #e0e0e0;
    border-top: 5px solid #4caf50;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.game-screen {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}

.question-section {
    background: white;
    padding: 12px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.question-text {
    font-size: 0.9em;
    color: #2c5530;
}

.game-name {
    font-size: 0.8rem;
    text-decoration: underline;
    text-decoration-color: #90ee90;
    text-underline-offset: 5px;
}

.definition-box p {
    font-size: 0.9em;
    line-height: 1.3;
    color: #34495e;
    margin-bottom: 12px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 3px solid #4caf50;
}

.answers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
}

.answer-btn {
    padding: 6px 10px;
    font-size: 0.75em;
    border: 2px solid #ddd;
    border-radius: 6px;
    background: white;
    color: #2c3e50;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    font-weight: 500;
}

.answer-btn:hover {
    background: #f0f8f4;
    border-color: #4caf50;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.answer-btn.correct {
    background: #4caf50;
    color: white;
    border-color: #4caf50;
    animation: correctAnswer 0.6s ease;
}

.answer-btn.incorrect {
    background: #f44336;
    color: white;
    border-color: #f44336;
    animation: incorrectAnswer 0.6s ease;
}

.answer-btn.disabled {
    pointer-events: none;
    opacity: 0.7;
}

@keyframes correctAnswer {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes incorrectAnswer {
    0% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
    100% { transform: translateX(0); }
}

.game-controls {
    text-align: center;
    padding: 10px 0;
}

/* Buttons */
.btn {
    padding: 8px 20px;
    font-size: 0.95em;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    margin: 0 5px;
}

.btn-primary {
    background: linear-gradient(45deg, #4caf50, #66bb6a);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(45deg, #45a049, #5cb85c);
    transform: translateY(-1px);
    box-shadow: 0 2px 10px rgba(76, 175, 80, 0.3);
}

.btn-secondary {
    background: linear-gradient(45deg, #607d8b, #78909c);
    color: white;
}

.btn-secondary:hover {
    background: linear-gradient(45deg, #546e7a, #607d8b);
    transform: translateY(-1px);
    box-shadow: 0 2px 10px rgba(96, 125, 139, 0.3);
}

/* Final Screen */
.final-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-height: 300px;
}

.final-score-container {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    text-align: center;
    max-width: 500px;
    width: 100%;
}

.final-score-container h2 {
    color: #2c5530;
    margin-bottom: 15px;
    font-size: 1.5em;
}

.final-score {
    margin-bottom: 15px;
}

.final-score p {
    font-size: 1em;
    color: #2c3e50;
    margin-bottom: 8px;
}

.final-score span {
    font-size: 2em;
    font-weight: bold;
    color: #4caf50;
}

.performance-feedback {
    font-size: 0.95em;
    margin: 15px 0;
    padding: 10px;
    border-radius: 8px;
    font-weight: 500;
}

.performance-feedback.excellent {
    background: #e8f5e8;
    color: #2e7d32;
    border: 2px solid #4caf50;
}

.performance-feedback.good {
    background: #fff3e0;
    color: #ef6c00;
    border: 2px solid #ff9800;
}

.performance-feedback.needs-improvement {
    background: #ffebee;
    color: #c62828;
    border: 2px solid #f44336;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Attribution Footer */
.attribution {
    text-align: center;
    padding: 10px;
    margin-top: 20px;
    font-size: 0.8em;
    color: #666;
}

.attribution a {
    color: #4caf50;
    text-decoration: none;
}

.attribution a:hover {
    text-decoration: underline;
}

.text-underline {
    text-decoration: underline;
}

.font-size-sm {
    font-size: 0.9em;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .game-container {
        padding: 6px;
    }
    
    .game-header {
        padding: 5px;
    }
    
    .game-header h1 {
        font-size: 1em;
    }
    
    .header-info {
        flex-direction: column;
        gap: 5px;
    }
    
    .score-board {
        justify-content: center;
        text-align: center;
    }
    
    .dog-counters {
        justify-content: center;
    }
    
    .walking-dogs-section {
        height: 35px;
        padding: 3px;
    }
    
    .section-header {
        margin-bottom: 3px;
    }
    
    .dog-count {
        font-size: 0.8em;
        padding: 2px 8px;
    }
    
    .css-dog {
        width: 100px;
        height: 60px;
        transform: scale(0.4); /* smaller on medium screens */
    }
    
    .dog-wrapper {
        width: 40px;
        height: 24px;
    }
    
    .answers-grid {
        grid-template-columns: 1fr;
        max-width: 280px;
        margin: 0 auto;
    }
    
    .question-section {
        padding: 10px;
    }
    
    .definition-box h2 {
        font-size: 0.95em;
    }
    
    .definition-box p {
        font-size: 0.85em;
        padding: 6px;
    }
    
    .final-score-container {
        padding: 20px;
        margin: 10px;
    }
    
    .final-score-container h2 {
        font-size: 1.3em;
    }
    
    .final-score span {
        font-size: 1.8em;
    }
    
    .btn {
        padding: 8px 16px;
        font-size: 0.9em;
        margin: 5px;
    }
}

@media (max-width: 480px) {
    .game-header h1 {
        font-size: 0.95em;
    }
    
    .score, .question-counter {
        font-size: 0.75em;
    }
    
    .css-dog {
        width: 100px;
        height: 60px;
        transform: scale(0.3); /* even smaller on small screens */
    }
    
    .dog-wrapper {
        width: 30px;
        height: 18px;
    }
    
    .answers-grid {
        max-width: 240px;
    }
    
    .answer-btn {
        padding: 5px 8px;
        font-size: 0.7em;
    }
    
    .walking-dogs-section {
        height: 30px;
        padding: 2px;
    }
    
    .dog-count {
        font-size: 0.75em;
        padding: 2px 6px;
    }
    
    .dog-park-section {
        min-height: 30px;
        padding: 2px;
    }
    
    .dog-park-container {
        min-height: 18px;
    }
    
    .dog-park-title {
        font-size: 0.8em;
        margin-bottom: 1px;
    }
}
