@import url('https://fonts.googleapis.com/css2?family=PT+Mono&display=swap');

/* General body and game container adjustments for a very compact fit */
body {
    font-family: "PT Mono", monospace;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #f1dbaa;
    margin: 0;
    background-image: url("blackboard-learning-kids.png");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    /* Prevent content from overflowing on very small screens */
    overflow-x: hidden;
}

button {
    font-family: "PT Mono", monospace;
    font-size: 0.87em !important;
}

.game-container {
    text-align: center;
    padding: 10px; /* Reduced padding */
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    max-width: 95%; 
    width: 600px;
    box-sizing: border-box;
    margin-top: 10px; /* Greatly reduced top margin */
    margin-bottom: 10px; /* Reduced bottom margin */
    position: relative;
}

h1 {
    color: #333;
    font-size: 1.6em; /* Slightly smaller font */
    margin-top: 5px; /* Minimal top margin */
    margin-bottom: 5px; /* Minimal bottom margin */
}

.problem-display {
    margin: -14px 0; /* Minimal margin */
    font-size: 1.1em;
    font-weight: bold;
}

#target-number {   
    font-size: 1.5em;
    color: #008CBA;
}

#new-problem-button {
    padding: 8px 12px; /* Smaller padding */
    font-size: 0.9em;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    background-color: #4CAF50;
    color: white;
    transition: background-color 0.3s;
    margin-top: 25px;
    margin-bottom: 10px; /* Reduced margin */
}

#new-problem-button:hover {
    background-color: #45a049;
}

/* --- Responsive Grid Styles --- */
.grid-container {
    display: grid;
    grid-template-columns: repeat(11, 1fr);
    grid-template-rows: repeat(11, 1fr);
    width: 100%;
    height: auto;
    border: 1px solid #ccc;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    background-image: url("tablica-x-cover.png");
    background-size: contain;
    background-position: right bottom;
    background-repeat: no-repeat;
}

.grid-cell {
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid #eee;
    font-size: 1em; /* Smaller font for grid cells */
    cursor: pointer;
    aspect-ratio: 1 / 1;
}

/* Style for the new header cells */
.header-cell {
    background-color: #f0f0f0;
    font-weight: bold;
    color: #333;
}

/* Specific styling for the top-left empty cell */
.empty-cell {
    background-color: transparent;
    border: none;
}

.grid-cell:hover {
    background-color: #dcdcdc;
}

.grid-cell.correct-guess {
    background-color: #8bc34a;
    color: white;
    animation: flashcorrect 1s forwards;
}

.grid-cell.wrong-guess {
    background-color: #f44336;
    color: white;
    animation: flashwrong 1s forwards;
}

@keyframes flashcorrect {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@keyframes flashwrong {
    0% { transform: rotate(0deg); }
    25% { transform: rotate(-5deg); }
    50% { transform: rotate(5deg); }
    75% { transform: rotate(-5deg); }
    100% { transform: rotate(0deg); }
}

/* Media Queries for smaller screens */
@media (max-width: 600px) {
    .game-container {
        padding: 5px;
        margin-top: 5px; /* Even smaller top margin on mobile */
        margin-bottom: 5px;
    }
    h1 {
        font-size: 1.3em;
    }
    .problem-display,
    #target-number {
        font-size: 0.9em;
    }
    #new-problem-button {
        font-size: 0.7em;
        padding: 4px 8px;
    }
    .grid-cell {
        font-size: 0.7em;
    }
    body {
        background-image: none;
        background-color: #f1dbaa;
    }
}

#changeok:hover {
    transform: scale(1.1);
    transition: all 0.3s ease;
}

.audiokontrole img:hover {
    transform: scale(1.1);
    transition: all 0.3s ease;
    cursor: pointer;
}