/* 全局样式 - Facebook风格 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
html { overflow-x: hidden; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, '微软雅黑';
    background: linear-gradient(135deg, #e3f2fd 0%, #fff3e0 100%);
    min-height: 100vh;
    padding: 20px;
    color: #050505;
    overflow-x: hidden;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    background: #ffffff;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}
.container { margin-top: 72px; }

/* 标题 */
header {
    text-align: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e4e6eb;
    position: relative;
}

header h1 {
    font-size: 2em;
    color: #1877f2;
    margin-bottom: 8px;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.subtitle {
    color: #65676b;
    font-size: 0.95em;
    font-weight: 400;
}

.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: linear-gradient(90deg, #e3f2fd 0%, #fff3e0 100%);
    border-bottom: 1px solid #e4e6eb;
}

.site-header-inner {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 20px;
}

.site-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: #1877f2;
    font-weight: 700;
}

.site-logo {
    width: 24px;
    height: 24px;
    border-radius: 4px;
}

.site-name {
    display: inline-flex;
    align-items: baseline;
    gap: 0;
    font-size: clamp(18px, 2.4vw, 26px);
    font-weight: 800;
    letter-spacing: 0;
    color: #0d47a1;
}
.site-name .name-group {
    display: inline-block;
    margin: 0;
    line-height: 1;
}
.site-name .name-sep {
    margin: 0 -3px;
    font-size: 0.72em;
    display: inline-block;
    letter-spacing: 0;
    background: linear-gradient(90deg, #1877f2 0%, #42a5f5 55%, #ffc107 85%, #fb8c00 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    -webkit-text-stroke: 0.25px rgba(0, 0, 0, 0.06);
    align-self: center;
    transform: translateY(1px);
}
.site-name .name-group {
    background: linear-gradient(90deg, #1877f2 0%, #42a5f5 55%, #ffc107 85%, #fb8c00 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    -webkit-text-stroke: 0.25px rgba(0, 0, 0, 0.08);
}
.site-name .group-nums { font-size: 1.1em; }

/* 翻页弹窗等待框 */
.popup-mask {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.15);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}
.popup-box {
    background: #ffffff;
    border: 1px solid #e4e6eb;
    border-radius: 8px;
    padding: 12px 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    text-align: center;
    color: #1877f2;
    min-width: 220px;
}
.spinner.small {
    width: 24px;
    height: 24px;
    border: 3px solid #e4e6eb;
    border-top: 3px solid #1877f2;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 8px;
}
@supports not (-webkit-background-clip: text) {
    .site-name .name-group {
        color: #0d47a1;
        -webkit-text-fill-color: initial;
        background: none;
        -webkit-text-stroke: 0;
    }
}

.site-nav {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.site-link {
    padding: 6px 12px;
    background: linear-gradient(90deg, #e3f2fd 0%, #fff3e0 100%);
    color: #0d47a1;
    border: 1px solid #ffd180;
    border-radius: 16px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.2px;
    text-decoration: none;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.site-link:hover {
    background: linear-gradient(90deg, #e1f0fb 0%, #ffe7cc 100%);
    border-color: #ffe0b2;
    color: #0d47a1;
}

.site-link-text {
    color: inherit;
    font-weight: inherit;
    background: none;
    -webkit-background-clip: initial;
    -webkit-text-fill-color: initial;
    -webkit-text-stroke: 0;
    text-shadow: none;
}

/* 留言页 */
.msg-page { margin-top: 72px; }
.msg-form {
    background: #f0f2f5;
    padding: 16px 20px;
    border-radius: 8px;
    border: 1px solid #e4e6eb;
    margin-bottom: 20px;
}
.msg-row { margin-bottom: 10px; }
.msg-form input, .msg-form textarea {
    width: 100%;
    padding: 10px 12px;
    font-size: 15px;
    border: 1px solid #dddfe2;
    border-radius: 6px;
    outline: none;
    transition: all 0.2s;
    background: #ffffff;
    color: #050505;
}
.msg-form textarea { resize: vertical; min-height: 96px; }
.msg-form input:focus, .msg-form textarea:focus {
    border-color: #1877f2;
    box-shadow: 0 0 0 2px rgba(24, 119, 242, 0.1);
}
.msg-tip { margin: 0 0 0 6px; font-size: 13px; display: inline-block; white-space: nowrap; line-height: 24px; vertical-align: middle; background: transparent; border: 0; box-shadow: none; padding: 0; pointer-events: none; cursor: default; }
.msg-tip.info { color: #1877f2; font-weight: 600; }
.msg-tip.warn { color: #ff8f00; font-weight: 600; }
.msg-tip.error { color: #d32f2f; font-weight: 600; }
.msg-tip.success { color: #2e7d32; font-weight: 600; }

.captcha-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.captcha-question { color: #1877f2; font-weight: 700; white-space: nowrap; }
.captcha-input-wrap { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.captcha-input-wrap input { width: 72px; height: 24px; padding: 2px 6px; font-size: 13px; box-sizing: border-box; }
.captcha-row #msgSubmit { margin-left: auto; }
.captcha-refresh-btn { width: 72px; height: 24px; padding: 0 6px; font-size: 13px; line-height: 24px; box-sizing: border-box; white-space: nowrap; }

.msg-list-section { margin-top: 12px; }
.msg-list-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.msg-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr; gap: 10px; }
.msg-item { background: #ffffff; border: 1px solid #e4e6eb; border-radius: 8px; padding: 12px 14px; max-width: 100%; }
.msg-item-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.msg-item-head-left { display: inline-flex; align-items: center; gap: 8px; }
.msg-avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 16px; line-height: 1; color: #37474f; border: 1px solid #e4e6eb; box-shadow: 0 1px 3px rgba(0,0,0,0.08); user-select: none; }
.msg-nickname { color: #1877f2; font-weight: 700; }
.msg-time { color: #8a8d91; font-size: 12px; }
.msg-content { color: #050505; line-height: 1.6; word-break: break-word; overflow-wrap: anywhere; }
.msg-body { margin-left: 40px; }
.msg-ip-inline { color: #8a8d91; font-size: 12px; }
.msg-reply { margin-top: 10px; padding-top: 8px; border-top: 1px dashed #e4e6eb; margin-left: 12px; }
.msg-reply-title { color: #1877f2; font-weight: 700; margin-right: 6px; white-space: nowrap; }
.msg-reply-line { display: grid; grid-template-columns: max-content 1fr; align-items: baseline; gap: 6px; padding-right: 8ch; }
.msg-reply-time-line { display: grid; grid-template-columns: max-content 1fr; gap: 6px; padding-right: 8ch; }
.msg-reply-time { color: #8a8d91; font-size: 12px; grid-column: 2; }
.msg-reply-time-line::before { content: '站长回复：'; visibility: hidden; white-space: nowrap; grid-column: 1; padding-right: 6px; }
.msg-time-line { display: block; text-align: left; }
.msg-empty { text-align: center; color: #8a8d91; padding: 12px 0; }
@supports not (-webkit-background-clip: text) {
    .site-link-text {
        color: inherit;
        -webkit-text-fill-color: initial;
        background: none;
        -webkit-text-stroke: 0;
        text-shadow: none;
    }
}
.site-link:focus-visible {
    outline: 2px solid rgba(24, 119, 242, 0.35);
    outline-offset: 2px;
}

/* 回到顶部按钮 */
.back-to-top {
    position: fixed;
    right: 16px;
    bottom: 16px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid #ffd180;
    background: linear-gradient(90deg, #e3f2fd 0%, #fff3e0 100%);
    color: #1877f2;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    z-index: 10000;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}
.back-to-top.show {
    display: inline-flex;
}

@media (max-width: 768px) {
    body { padding: 12px; }
    .site-header-inner { padding: 8px 12px; }
    .container { padding: 16px; }
    .msg-page, .msg-form, .msg-list-section, .msg-list { width: 100%; max-width: 100%; }
    .msg-avatar { width: 28px; height: 28px; font-size: 15px; }
    .msg-body { margin-left: 34px; }
    .msg-reply-line, .msg-nickname, .msg-content { word-break: break-word; overflow-wrap: anywhere; }
}

/* 使用说明 */
.instructions {
    background: #f0f2f5;
    padding: 16px 20px;
    margin-bottom: 20px;
    border-radius: 8px;
}

.instructions h3 {
    color: #1877f2;
    margin-bottom: 12px;
    font-size: 1.1em;
    font-weight: 600;
}

.instructions ul {
    list-style-position: inside;
    line-height: 1.6;
    color: #65676b;
    font-size: 0.9em;
}



/* 搜索区域 */
.search-section {
    margin-bottom: 24px;
}

.ip-inline {
    text-align: center;
    padding: 0 6px;
    margin: 12px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 0.85em;
    color: #8a8d91;
}

#ipInfo span { display: inline-block; }
#ipText, #locationText { word-break: break-word; overflow-wrap: anywhere; }

.search-box {
    display: flex;
    gap: 8px;
    max-width: 600px;
    margin: 0 auto;
}

#cityInput {
    flex: 1;
    padding: 10px 12px;
    font-size: 15px;
    border: 1px solid #dddfe2;
    border-radius: 6px;
    outline: none;
    transition: all 0.2s;
    background: #f0f2f5;
    color: #050505;
}

#cityInput:focus {
    background: #ffffff;
    border-color: #1877f2;
    box-shadow: 0 0 0 2px rgba(24, 119, 242, 0.1);
}

#cityInput::placeholder {
    color: #8a8d91;
}

#searchBtn {
    padding: 5px 20px;
    background: linear-gradient(90deg, #e3f2fd 0%, #fff3e0 100%);
    color: #1877f2;
    border: 1px solid #ffb74d;
    border-radius: 8px;
    font-size: clamp(16px, 4vw, 20px);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
    text-align: center;
}

#searchBtn:hover {
    background: linear-gradient(90deg, #e1f0fb 0%, #ffe7cc 100%);
}

#searchBtn:active {
    background: linear-gradient(90deg, #d3e8fa 0%, #ffd8a6 100%);
    transform: scale(0.98);
}

#searchBtn .btn-icon {
    font-size: 1.2em;
}

.btn {
    padding: 10px 20px;
    background: linear-gradient(90deg, #e3f2fd 0%, #fff3e0 100%);
    color: #1877f2;
    border: 1px solid #ffd180;
    border-radius: 8px;
    font-size: clamp(14px, 3.5vw, 15px);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-decoration: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
    text-align: center;
}

.btn:hover {
    background: linear-gradient(90deg, #e1f0fb 0%, #ffe7cc 100%);
    border-color: #ffe0b2;
}

.btn:active {
    background: linear-gradient(90deg, #d3e8fa 0%, #ffd8a6 100%);
    transform: scale(0.98);
    border-color: #ffd59a;
}



/* 热门城市一行样式 */
.hot-cities-inline {
    text-align: center;
    margin-top: 12px;
    padding: 8px;
    color: #65676b;
    font-size: 13px;
}

.hot-label {
    color: #ff9800;
    font-weight: 600;
    margin-right: 8px;
}

.hot-cities-inline button {
    color: #ff9800;
    background: transparent;
    border: 1px solid #ffd180;
    margin: 0 6px;
    transition: all 0.2s;
    padding: 6px 10px;
    border-radius: 16px;
    font-weight: 500;
    cursor: pointer;
}

.hot-cities-inline button:hover {
    background: #fff3e0;
    border-color: #ffb74d;
}

/* 加载和错误提示 */
.loading {
    text-align: center;
    padding: 32px;
    color: #1877f2;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e4e6eb;
    border-top: 3px solid #1877f2;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error {
    background: linear-gradient(90deg, #e3f2fd 0%, #fff3e0 100%);
    border: 1px solid #ffb74d;
    color: rgb(239 112 112);
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    text-align: center;
    font-size: 0.95em;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

/* 当前天气 */
.current-weather {
    margin-bottom: 24px;
    background: linear-gradient(135deg, #e3f2fd 0%, #fff3e0 100%);
    color: #1877f2;
    padding: 24px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 1px solid #ffb74d;
}

.weather-header {
    text-align: center;
    margin-bottom: 20px;
}

.weather-header h2 {
    font-size: 1.6em;
    margin-bottom: 4px;
    font-weight: 600;
}

.weather-header p {
    opacity: 0.9;
    font-size: 0.85em;
}

.weather-main {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.temperature-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
}

#weatherIcon {
    width: 100px;
    height: 100px;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.2));
}

.temp-info {
    text-align: center;
}

.temp-current {
    font-size: 3.5em;
    font-weight: 300;
    line-height: 1;
}

.temp-desc {
    font-size: 1.3em;
    margin-top: 8px;
    opacity: 0.95;
}

.weather-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.detail-item {
    background: rgba(255, 255, 255, 0.15);
    padding: 12px;
    border-radius: 6px;
    text-align: center;
    backdrop-filter: blur(10px);
}

.detail-label {
    display: block;
    font-size: 0.85em;
    opacity: 0.9;
    margin-bottom: 6px;
}

.detail-value {
    display: block;
    font-size: 1.2em;
    font-weight: 600;
}

/* 7天预报 */
.forecast-section {
    margin-bottom: 24px;
}

.forecast-section h3 {
    color: #1877f2;
    margin-bottom: 16px;
    text-align: center;
    font-size: 1.4em;
    font-weight: 600;
}

.forecast-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
}

.forecast-day {
    background: #f0f2f5;
    border: 1px solid #e4e6eb;
    border-radius: 8px;
    padding: 16px 12px;
    text-align: center;
    transition: all 0.2s;
}

.forecast-day:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-color: #1877f2;
    background: #ffffff;
}

.forecast-date {
    font-weight: 600;
    color: #ff9800;
    margin-bottom: 4px;
    font-size: 0.9em;
}

.forecast-weekday {
    color: #65676b;
    font-size: 0.8em;
    margin-bottom: 8px;
}

.forecast-icon {
    width: 50px;
    height: 50px;
    margin: 8px auto;
}

.forecast-temp {
    font-size: 1.2em;
    font-weight: 600;
    color: #050505;
    margin: 8px 0;
}

.forecast-desc {
    color: #65676b;
    font-size: 0.85em;
    margin-bottom: 8px;
}

.forecast-details {
    display: flex;
    justify-content: space-around;
    font-size: 0.8em;
    color: #65676b;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #e4e6eb;
}

.error-page {
    margin-top: 12px;
}

.error-hero {
    text-align: center;
    padding: 48px 0;
    background: linear-gradient(135deg, #e3f2fd 0%, #fff3e0 100%);
    color: #1877f2;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 24px;
    border: 1px solid #ffb74d;
    width: 100%;
    max-width: 600px;
}

.error-page header {
    border-bottom: 1px solid #e4e6eb;
    padding-bottom: 16px;
    margin-bottom: 24px;
}

.error-code {
    font-size: 110px;
    font-weight: 700;
    letter-spacing: 8px;
}

.error-desc {
    font-size: 16px;
    margin-top: 12px;
    opacity: 0.95;
}

.error-actions {
    margin-top: 24px;
}

/* 页脚 */
footer {
    text-align: center;
    padding-top: 16px;
    margin-top: 24px;
    border-top: 1px solid #e4e6eb;
    color: #65676b;
    font-size: 0.85em;
}

footer a {
    color: #1877f2;
    text-decoration: none;
    font-weight: 500;
}

footer a:hover {
    text-decoration: underline;
}

footer p {
    margin: 4px 0;
}

/* 响应式设计 */
@media (max-width: 768px) {
    body {
        padding: 12px;
    }

    .container {
        padding: 16px;
    }
    .site-header-inner { padding: 8px 12px; }
    .site-name { font-size: clamp(16px, 3.2vw, 22px); }
    .site-link { padding: 5px 8px; font-size: 13px; }

    header h1 {
        font-size: 1.6em;
    }

    .search-box {
        flex-direction: column;
    }

    #searchBtn {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .hot-cities-inline { font-size: 12px; }
    .hot-cities-inline button { margin: 0 4px; padding: 3px 6px; }
    .temperature-section { flex-direction: column; gap: 12px; }
    #weatherIcon { width: 80px; height: 80px; }
    .temp-current { font-size: 2.8em; }
    .weather-details { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
    .forecast-container { grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); }
}
/* 修复：移除多余的右大括号，保持媒体查询完整 */

@media (max-width: 480px) {
    .container {
        padding: 12px;
    }
    .site-header-inner { flex-direction: column; gap: 8px; }
    .site-name { font-size: clamp(16px, 5vw, 20px); }

    header h1 {
        font-size: 1.4em;
    }

    .subtitle {
        font-size: 0.85em;
    }


    .ip-inline {
        flex-direction: column;
        gap: 6px;
    }

    .hot-cities-inline {
        font-size: 11px;
    }

    .hot-cities-inline button {
        display: inline-block;
        margin: 2px 3px;
    }

    .forecast-container {
        grid-template-columns: 1fr;
    }

    .current-weather {
        padding: 16px;
    }

    .temp-current {
        font-size: 2.5em;
    }
}
