:root {
    --primary-color: #007bff;
    --primary-hover-color: #0056b3;
    --secondary-color: #333;
    --background-color: #f4f4f4;
    --success-color: #008000;
    --error-color: #ff0000;
    --font-size-large: 2rem;
    --font-size-medium: 1rem;
    --font-size-small: 0.875rem;
    --font-size-xsmall: 0.75rem;
}

* {
    box-sizing: border-box; /* Consistent box-sizing across elements */
}

body {
    font-family: Arial, sans-serif;
    background-color: var(--background-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    text-align: center;
    overflow-x: hidden; /* Prevent horizontal scroll */
    font-size: var(--font-size-medium);
}

.container {
    width: 95%;
    max-width: 1200px;
    background-color: white;
    padding: 15px; /* Consistent padding for inner content */
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    margin: 20px; /* Adjusted margin for consistent spacing */
    overflow: hidden; /* Ensure content does not overflow the container */
}

.top-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
    margin-bottom: 20px;
}

.middle-section {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 20px;
}

.left-container,
.right-container {
    flex: 1;
    min-width: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

h1 {
    color: var(--secondary-color);
    font-size: var(--font-size-large); /* Responsive font size */
}

input, button {
    padding: 10px;
    margin: 10px;
    font-size: var(--font-size-medium); /* Responsive font size */
    border: 1px solid #ccc;
    border-radius: 5px;
    width: calc(100% - 22px);
    max-width: 100%;
}

button {
    background-color: var(--primary-color);
    color: white;
    cursor: pointer;
}

button:hover {
    background-color: var(--primary-hover-color);
}

p {
    color: var(--secondary-color);
    text-align: center; /* Center text for version */
    font-size: var(--font-size-medium); /* Responsive font size */
}

.loader {
    border: 4px solid #f3f3f3;
    border-radius: 50%;
    border-top: 4px solid var(--primary-color);
    width: 30px;
    height: 30px;
    animation: spin 2s linear infinite;
    display: none;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.status-up {
    color: var(--success-color);
    font-size: var(--font-size-medium); /* Responsive font size */
}

.status-down {
    color: var(--error-color);
    font-size: var(--font-size-medium); /* Responsive font size */
}

.result {
    width: 100%;
    margin-top: 20px;
    font-size: var(--font-size-medium); /* Responsive font size */
}

.history {
    width: 100%;
    margin-top: 20px;
}

.history-title {
    font-weight: bold;
    color: var(--secondary-color);
    margin-bottom: 10px;
    text-align: center; /* Center the history title */
    font-size: 1.5rem; /* Responsive font size */
}

.history-item {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center; /* Center the history items */
    justify-content: center;
    padding: 15px; /* Consistent padding */
    border: 1px solid #ccc;
    border-radius: 5px;
    margin-bottom: 15px; /* Consistent margin */
    background-color: #f9f9f9;
    font-size: var(--font-size-medium); /* Responsive font size */
}

.history-item img {
    max-width: 150px;
    width: 100%;
    height: auto;
    object-fit: cover;
    margin-bottom: 10px;
}

.page-link {
    margin: 0 5px;
    text-decoration: none;
    color: var(--primary-color);
    font-weight: bold;
    cursor: pointer;
    font-size: var(--font-size-medium); /* Responsive font size */
}

.page-link.active {
    color: var(--primary-hover-color);
    cursor: default;
}

#visitor-count {
    margin-top: 20px; /* Add margin to the top for better spacing */
}

/* Media Queries for Responsive Design */
@media (max-width: 768px) {
    h1 {
        font-size: var(--font-size-large); /* Adjust font size for smaller screens */
    }
    .middle-section {
        flex-direction: column;
        align-items: center;
    }
    .left-container,
    .right-container {
        width: 100%;
        align-items: center;
    }
    .history-item img {
        margin: 0 0 10px;
        width: 100%;
        max-width: 300px;
    }
    input, button, p, .status-up, .status-down, .result, .history-title, .history-item, .page-link {
        font-size: var(--font-size-small); /* Adjust font size for smaller screens */
    }
    .container {
        padding: 15px;
        margin: 20px; /* Adjust the margin for smaller screens */
    }
    #visitor-count {
        margin-top: 20px; /* Add margin to the top for better spacing */
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: var(--font-size-medium); /* Further adjust font size for very small screens */
    }
    input, button, p, .status-up, .status-down, .result, .history-title, .history-item, .page-link {
        font-size: var(--font-size-xsmall); /* Further adjust font size for very small screens */
    }
    .container {
        padding: 15px;
        margin: 15px; /* Further adjust the margin for very small screens */
    }
    #visitor-count {
        margin-top: 20px; /* Add margin to the top for better spacing */
    }
}