/* Reset and Base Styles */
body, h1, h2, h3, p, ul, li, form, input, div {
    margin: 0;
    padding: 0;
    box-sizing: border-box; /* Ensures padding and border are included in element's total width/height */
}

body {
    font-family: Arial, Helvetica, "Microsoft YaHei", sans-serif;
    /* background-color: #f4f7f6; Light background for the whole page */
    color: #333;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: #000; /* Blue for links */
    transition: color 0.3s ease;
}

a:hover {
    color: #008c00;
}

.container {
    max-width: 960px; /* Max width for content */
    margin: 4rem auto;
    padding: 0 15px; /* Padding on sides for smaller screens */
}
.container-top {
   /* max-width: 960px; /* Max width for content */
  /*  margin: 4rem auto;/* Padding on sides for smaller screens */
    padding: 0 15px; 
}
/* Header and Titles */
h1 {
    font-size: 1.7em;
    color: #000;
    text-align: center;
    margin-bottom: 20px;
    letter-spacing: 3px;
}

h2 {
    font-size: 1.5em;
    color: #000;
    text-align: center;
    margin-top: 30px;
    margin-bottom: 15px;
}

h3 {
    font-size: 1.2em;
    color: #008c00;
    text-align: center;
    margin-bottom: 15px;
    letter-spacing: 0.02em;
}

/* Ad Section (removed, but keeping class for consistency if you add other content) */
.ad-section {
    margin: 25px 0;
    text-align: center;
    /* Removed background, padding, border if not needed for empty ad sections */
}

/* IP Display Section */
.ip-display {
    /*background-color: #eaf6ee;  Light green background 
    border: 1px solid #d4edda;*/
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
    text-align: center;
    font-size: 1.2em;
    color: #008c00; /* Dark green text */
    letter-spacing: 0.01em;
}

.ip-display strong {
    color: #ff0000; /* Specific color for IP */
}

.ip-display .region {
    color: #ff0000; /* Red for region */
    font-weight: 400;
}
.region a {
    color: #ff0000; 
    text-decoration: underline;
}
.region a:hover {
    color: #008c00;
}
/* IP Query Form */
.query-form {
    background-color: #fff;
    border: 0px solid #e0e0e0;
    border-radius: 1px;
    padding: 20px;
    margin-bottom: 30px;
    text-align: center;
}

.query-form form {
    display: flex;
    flex-wrap: wrap; /* Allow wrapping on small screens */
    justify-content: center; /* Center items */
    gap: 0px; /* Space between input and button */
}

.query-form input[type="text"] {
    flex-grow: 2; /* Allows input to take available space */
    max-width: 250px; /* Limit max width for input */
    padding: 12px 15px;
    border: 0px solid #ccc;
    font-size: 1em;
    line-height: 1.1;
    background-color: #f2f2f2 !important;
}

.query-form input[type="submit"] {
    padding: 10px 12px;
    background-color: #CCC;
    color: #000;
    border: none;
    font-size: 1.1em;
    cursor: pointer;
    /*  transition: background-color 0.3s ease, transform 0.2s ease;
    flex-shrink: 0;Prevents button from shrinking */
}

.query-form input[type="submit"]:hover {
    background-color: #b3b3b3;
    /*transform: translateY(-1px);  Slight lift on hover */
}

/* Tools Grid Layout (CSS Grid for PC, Flexbox for Mobile) */
.tools-grid {
    display: grid; /* Use Grid for PC layout */
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); /* Auto-fit columns, min 200px, max 1fr */
    gap: 3px; /* Gap between grid items */
    margin-bottom: 30px;
}

.tool-item {
    background-color: #f2f2f2;
    border: 0px solid #e0e0e0;
    border-radius: 1px;
    padding: 6px;
    text-align: center;
}

.tool-item:hover {
    /*transform: translateY(-3px);  Lift effect on hover 
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    background-color: #b3b3b3;*/
}

.tool-item a {
    /*display: block;  Make the whole item clickable */
    color: #343a40; /* Darker text for items */
    font-size: 1em;
}

.tool-item a:hover {
    color: #008c00;
}

/* Mobile-specific adjustments for tools (Flexbox fallback/override for clarity) */
@media (max-width: 767px) {
    .tools-grid {
        display: flex; /* Switch to Flexbox for mobile for simple column stacking */
        flex-direction: column;
        gap: 10px; /* Smaller gap on mobile */
    }

    .tool-item {
        padding: 12px; /* Smaller padding on mobile */
        font-size: 1em;
    }
}

/* History Section */
.history-section {
    margin-top: 3px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

.history-section h2 {
    text-align: center;
    margin-bottom: 15px;
}

/* New: History list to use grid layout */
.history-list {
    list-style: none;
    padding: 0;
    display: grid; /* Use Grid for PC layout */
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); /* Auto-fit columns, min 180px, max 1fr (adjusted min-width for IP only) */
    gap: 15px; /* Same gap as tools grid */
}

/* Styling for each history item in the grid */
.history-list li {
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px; /* Slightly larger border-radius for consistency */
    padding: 2px; /* Adjust padding for visual balance */
    text-align: center; /* Center the IP address */
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex; /* Use flex to center content vertically/horizontally */
    justify-content: center;
    align-items: center;
    height: 60px; /* Give a fixed height to make grid items uniform */
}

.history-list li:hover {
    transform: translateY(-3px); /* Lift effect on hover */
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.history-list li a {
    color: #333;
    font-size: 0.8em; /* Slightly larger font for IP */
    word-break: break-all; /* Ensures long IPs break words if needed */
    display: block; /* Make the IP clickable if desired (though currently just text) */
}

/* Hide the region and time information from display */
.history-list li span:last-child {
   /* display: none;  */
}

.error-section {
    margin-top: 15px;
    margin-bottom: 15px;
    padding: 10px 15px;
    background-color: #ffebeb; /* 浅红色背景 */
    border: 1px solid #ffaaaa; /* 红色边框 */
    border-radius: 5px;
    text-align: center;
    font-size: 1.1em;
}

.error-message {
    color: #cc0000; /* 错误的深红色文字 */
    font-weight: bold;
}
/* Mobile-specific adjustments for history list */
@media (max-width: 767px) {
    .history-list {
        display: flex; /* Switch to Flexbox for mobile for simple column stacking */
        flex-direction: column;
        gap: 10px; /* Smaller gap on mobile */
    }

    .history-list li {
        padding: 10px; /* Smaller padding on mobile */
        height: auto; /* Auto height on mobile */
    }
}

.error-section {
    margin-top: 15px;
    margin-bottom: 15px;
    padding: 10px 15px;
    background-color: #ffebeb; /* 浅红色背景 */
    border-radius: 5px;
    text-align: center;
    font-size: 1.1em;
}

.error-message {
    color: #cc0000; /* 错误的深红色文字 */
}
/* Footer */
.footer {
    text-align: center;
    padding: 30px 0 20px;
    margin-top: 40px;
    color: #888;
    font-size: 0.9em;
}

.footer a {
    color: #000;
}

.footer a:hover {
    color: #000;
}
