* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f0f7ff, #e3f2fd);
    color: #333;
    padding: 10px 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.2rem;
    color: #3498db;
    margin-bottom: 8px;
}

.input-section {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

#ipInput,
#queryBtn {
    height: 48px; /* 统一高度 */
    font-size: 16px;
    border-radius: 8px;
    outline: none;
    transition: all 0.3s;
    line-height: 1.2;
}

#ipInput {
    padding: 0 20px;
    border: 2px solid #e1f0fa;
    transition: border-color 0.3s, box-shadow 0.3s;
    width: 340px;
}

#ipInput:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

#queryBtn {
    padding: 0 30px;
    background-color: #3498db;
    color: white;
    border: none;
    cursor: pointer;
    height: 44px;
    margin-top: 2px;
}

#queryBtn:hover {
    background-color: #2980b9;
}

.location-highlight {
    text-align: center;
    margin: 20px 0;
    padding: 12px;
    background-color: #ffffff;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    color: #1565c0;
    border: 1px solid #bbdefb;
    display: none; /* 默认隐藏 */
    line-height: 1.6;
}

.highlight-line {
    margin: 4px 0;
}

.highlight-line:first-child {
    font-weight: bold;
    color: #0d47a1;
}

.result-section {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    /* 关键：限制区域总高，防止撑满屏 */
    max-height: 70vh; /* 可根据需求微调为 60vh~75vh */
    overflow: hidden; /* 防止子元素溢出 */
}

.result-left,
.result-right {
    flex: 1;
    min-width: 300px;
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column; /* 启用纵向弹性布局 */
}

.result-left h3,
.result-right h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    border-bottom: 2px solid #3498db;
    padding-bottom: 8px;
    flex-shrink: 0; /* 标题不收缩 */
}

#jsonResult {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    white-space: pre-wrap;
    word-break: break-all;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    color: #2c3e50;
    /* 关键：让 pre 自动填充父容器剩余高度 */
    flex-grow: 1;
    overflow: auto;
    margin: 0; /* 清除默认 margin */
    min-height: 0; /* 防止 flex 子项最小高度干扰 */
}

#mapContainer {
    position: relative;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

#mapLink {
    display: block;
}

#mapImage {
    width: auto;
    height: auto;
    max-height: 460px;
    display: none; /* JS 控制显隐 */
    object-fit: contain;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

#mapImage:hover {
    transform: scale(1.13);
}

#noLocation {
    color: #7f8c8d;
    font-style: italic;
    text-align: center;
    padding: 12px 20px;
    line-height: 1.5;
    margin: 0;
    background-color: rgba(255, 255, 255, 0.7);
    border-radius: 6px;
}

footer {
    text-align: center;
    margin-top: 20px;
    color: var(--text-light);
    font-size: 0.9rem;
}
  
footer a,
footer a:visited,
footer a:hover,
footer a:active {
color: var(--text-light);
text-decoration: none;
}

/* 响应式 */
@media (max-width: 768px) {
    .input-section {
        flex-direction: column;
        align-items: center;
    }

    #ipInput {
        width: 100%;
        max-width: 400px;
    }

    .result-section {
        flex-direction: column;
    }
}