html { 
    background: url(bg.jpg) no-repeat center center fixed; 
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover;
  }

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    max-width: 100%;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: green;
    width: 100%;
    max-width: 600px;
    margin-bottom: 5px;
    margin-top: 5px;
    padding: 0 15px 0 15px;
    box-sizing: border-box;
}

.language-selector {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    height: 100%;
}

#language-select {
    padding: 6px;
    border: 2px solid white;
    border-radius: 4px;
    background-color: white;
    color: #333;
    cursor: pointer;
    height: 36px;
}

h1 {
    flex: 1;
    color: white;
    margin: 0;
    text-align: center;
    padding: 10px 0;
    font-size: 24px;
}

p {
    text-align: center;
    margin: 5px;
}

.control-bar {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 5px;
}

.control-bar select,
.control-bar .new-game-btn {
    padding: 10px;
    font-size: 16px;
    border: 2px solid #4CAF50;
    border-radius: 4px;
    background-color: white;
    color: #333;
    cursor: pointer;
    transition: background-color 0.3s, color 0.3s;
}

.control-bar .new-game-btn {
    background-color: #4CAF50;
    color: white;
}

.control-bar .new-game-btn:hover {
    background-color: #45a049;
}

.difficulty-label {
    font-weight: bold;
    padding-top: 5px;
}

select {
    padding: 5px;
}
        
.board-container {
    width: 100%;
    max-width: 600px;
    aspect-ratio: 1/1;
    position: relative;
    border: 1px solid #333;
    margin-bottom: 5px;
}

.chessboard {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    width: 100%;
    height: 100%;
}

.square {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.light {
    background-image: url('light.png');
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
}

.dark {
    background-image: url('dark.png');
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center
}

.highlight {
    position: absolute;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 215, 0, 0.7);
    z-index: 2;
}

.path-number {
    position: absolute;
    width: 24px;
    height: 24px;
    background-color: rgba(0, 0, 255, 0.8);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-weight: bold;
    z-index: 4;
    font-size: 14px;
    top: 5px;
    right: 5px;
}

.goal {
    position: absolute;
    width: 100%;
    height: 100%;
    background-color: red;
    background-image: url('goal.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    z-index: 3;
}

.ball {
    position: absolute;
    width: 80%;
    height: 80%;
    background-image: url('voetbal.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    z-index: 3;
}

.arrow {
    position: absolute;
    height: 6px;
    background-color: blue;
    transform-origin: 0 50%;
    z-index: 2;
    pointer-events: none;
}

.arrow:after {
    content: '';
    position: absolute;
    right: -8px;
    top: -5px;
    width: 0;
    height: 0;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-left: 12px solid blue;
}

.pieces-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 800px;
    margin-top: 10px;
}

.piece {
    width: 90px;
    height: 90px;
    cursor: grab;
    user-select: none;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.rook {
    background-image: url('rook.png');
}

.knight {
    background-image: url('knight.png');
}

.bishop {
    background-image: url('bishop.png');
}

.piece.placed {
    opacity: 0.5;
    pointer-events: none;
}

.board-piece {
    position: absolute;
    width: 100%;
    height: 100%;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    z-index: 3;
}

.message {
    margin-top: 10px;
    font-weight: bold;
    color: #333;
    height: 10px;
    text-align: center;
}

/* Animation for success */
@keyframes success {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.success {
    animation: success 0.5s ease-in-out 2;
}

.ball.animated {
    position: absolute;
    width: 30px;
    height: 30px;
    background-image: url('voetbal.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    z-index: 100;
    transform: translate(-50%, -50%);
}

@keyframes bounce {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-20px) scale(1.1); }
}

.goal-celebration {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
    animation: fade-in 0.5s;
}

.goal-text-large {
    font-size: 48px;
    color: gold;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
    animation: bounce 0.5s ease-in-out infinite;
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.fade-out {
    animation: fade-out 1s;
}

@keyframes fade-out {
    from { opacity: 1; }
    to { opacity: 0; }
}

.copyright-message {
    color: white;
    text-decoration: none;
    font-size: 0.8rem;
    text-align: center;
    margin-top: 10px;
}

.copyright-message a {
    color: white;
    text-decoration: none;
}

/* Adding new styles to the existing CSS */

.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 600px;
    margin-bottom: 5px;
    background-color: #333;
    color: white;
    padding: 10px;
    border-radius: 5px;
    box-sizing: border-box;
}

.timer-container, .score-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

#timer-display, #score-display {
    font-size: 1em;
    font-weight: bold;
    min-width: 50px;
    text-align: left;
}

.time-label {
    font-weight: bold;
    padding-top: 5px;
}

/* Style for the mini goal notification */
.mini-goal-notification {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 128, 0, 0.8);
    color: white;
    padding: 5px 15px;
    border-radius: 15px;
    font-weight: bold;
    font-size: 1.2em;
    z-index: 100;
    animation: fadeInOut 1.5s ease-in-out;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translateX(-50%) scale(0.8); }
    20% { opacity: 1; transform: translateX(-50%) scale(1.1); }
    40% { opacity: 1; transform: translateX(-50%) scale(1); }
    80% { opacity: 1; }
    100% { opacity: 0; }
}

/* Game over overlay */
.game-over-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 200;
    animation: fade-in 0.5s;
}

.game-over-title {
    font-size: 32px;
    color: white;
    margin-bottom: 20px;
}

.final-score {
    font-size: 36px;
    color: gold;
    font-weight: bold;
    margin-bottom: 30px;
    text-align: center;
}

.restart-button {
    padding: 10px 20px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 18px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.restart-button:hover {
    background-color: #45a049;
}

/* Animation for the countdown */
.countdown-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    z-index: 200;
}

.countdown-number {
    font-size: 80px;
    color: white;
    animation: countdownPulse 1s ease-in-out;
}

@keyframes countdownPulse {
    0% { transform: scale(0.5); opacity: 0; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1); opacity: 0; }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .status-bar {
        padding: 8px;
    }
    
    #timer-display, #score-display {
        font-size: 1.1em;
    }
    
    .mini-goal-notification {
        font-size: 14px;
        padding: 4px 12px;
    }
    
    .game-over-title {
        font-size: 24px;
    }
    
    .final-score {
        font-size: 36px;
    }
    
    .restart-button {
        padding: 8px 16px;
        font-size: 16px;
    }
    
    .countdown-number {
        font-size: 80px;
    }
}

@media (max-width: 480px) {
    .status-bar {
        padding: 5px;
        flex-direction: row;
    }
    
    #timer-display, #score-display {
        font-size: 1em;
        min-width: 40px;
    }
    
    #timer-label, #score-label {
        font-size: 0.9em;
    }
    
    .mini-goal-notification {
        font-size: 12px;
        padding: 3px 10px;
    }
    
    .game-over-title {
        font-size: 20px;
    }
    
    .final-score {
        font-size: 28px;
    }
    
    .restart-button {
        padding: 6px 12px;
        font-size: 14px;
    }
    
    .countdown-number {
        font-size: 60px;
    }
}


/* General mobile adjustments */
@media (max-width: 768px) {
    body {
        padding: 5px;
    }
    
    .header-container {
        padding: 0 10px;
    }
    
    .language-selector {
        margin-right: 10px;
    }
    
    #language-select {
        padding: 4px;
        height: 32px;
    }

    h1 {
        font-size: 22px;
    }
    
    p {
        font-size: 14px;
        margin-bottom: 10px;
    }
    
    .control-bar {
        flex-direction: column;
        gap: 8px;
        margin-bottom: 10px;
    }
    
    .control-bar select,
    .control-bar .new-game-btn {
        width: 100%;
        max-width: 250px;
        padding: 8px;
        font-size: 14px;
    }
    
    .difficulty-label {
        padding-top: 0;
    }
       
    .pieces-container {
        max-width: 95vw;
        gap: 5px;
    }
    
    .piece {
        width: 60px;
        height: 60px;
    }
    
    .message {
        font-size: 14px;
        margin-top: 5px;
    }
}

/* Smartphone-specific adjustments */
@media (max-width: 480px) {
    h1 {
        font-size: 20px;
    }
    
    p {
        font-size: 12px;
    }
    
    .header-container {
        padding: 0 8px;
    }
    
    #language-select {
        padding: 3px;
        height: 28px;
        font-size: 12px;
    }
    
    h1 {
        font-size: 20px;
        padding: 8px 0;
    }

    .control-bar select,
    .control-bar .new-game-btn {
        max-width: 200px;
        padding: 6px;
        font-size: 12px;
    }
    
    .piece {
        width: 50px;
        height: 50px;
    }
    
    .path-number {
        width: 18px;
        height: 18px;
        font-size: 10px;
        top: 2px;
        right: 2px;
    }
    
    .goal-text-large {
        font-size: 32px;
    }
}

/* Tablet-specific adjustments */
@media (min-width: 481px) and (max-width: 1024px) {
    .board-container {
        max-width: 80vw;
    }
    
    .pieces-container {
        max-width: 80vw;
    }
    
    .piece {
        width: 70px;
        height: 70px;
    }
}

/* Orientation-specific adjustments */
@media (max-width: 768px) and (orientation: landscape) {
    body {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .board-container {
        max-width: 60vh;
        margin-right: 10px;
    }
    
    .pieces-container {
        max-width: 30vh;
        align-content: flex-start;
    }
    
    .control-bar {
        width: 100%;
        flex-direction: row;
    }
}

/* Prevent text size adjustments */
html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

/* Touch interaction improvements */
.piece {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

button, select {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* Prevent zoom on form elements */
@media (max-width: 768px) {
    select {
        font-size: 16px !important;
    }
}

/* Add this to your existing CSS */
@media (min-width: 769px) and (max-width: 1024px) and (min-height: 600px) and (max-height: 768px) {
    body {
        padding: 5px 10px 0;
        justify-content: flex-start;
    }
    
    h1 {
        margin: 5px 0;
        font-size: 24px;
    }
    
    p {
        margin: 0 0 8px;
        font-size: 14px;
    }
    
    .control-bar {
        margin: 0 0 8px;
        gap: 8px;
    }
    
    .board-container {
        max-width: 500px;
        margin-bottom: 8px;
    }
    
    .pieces-container {
        max-width: 500px;
        margin: 0;
        padding-bottom: 5px;
    }
    
    .message {
        margin: 5px 0;
        font-size: 14px;
        height: 20px;
    }
    
    /* Slightly reduce piece size */
    .piece {
        width: 65px;
        height: 65px;
    }
}

/* More aggressive space saving for exactly 768px height */
@media (height: 768px) {
    .board-container {
        max-width: 450px;
    }
    
    .pieces-container {
        max-width: 450px;
    }
    
    .piece {
        width: 60px;
        height: 60px;
    }
}