/* 基础样式 */
:root {
    --primary-color: #e91e63;
    --button-hover: #f50057;
    --text-color: #68495b;
    --button-text: white;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    background-color: #f1d5da;
    text-align: center;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    position: relative;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* 天气组件样式 */
.weather-widget {
    position: fixed;
    top: 10px;
    left: 10px;
    background: linear-gradient(135deg, rgba(236, 240, 243, 0.95) 0%, rgba(200, 210, 220, 0.95) 100%);
    -webkit-backdrop-filter: blur(8px) saturate(180%);
    backdrop-filter: blur(8px) saturate(180%);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-perspective: 1000px;
    perspective: 1000px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(31, 38, 135, 0.15);
    z-index: 1000;
    width: 300px;
    max-width: 90vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(255, 255, 255, 0.6);
    color: #2c3e50;
    -webkit-transition: all 0.3s ease;
    transition: all 0.3s ease;
    overflow: hidden;
    resize: both;
    min-width: 200px;
    min-height: 150px;
}

/* 调整大小手柄 */
.resize-handle {
    position: absolute;
    width: 30px;
    height: 30px;
    bottom: 0;
    right: 0;
    cursor: nwse-resize;
    z-index: 1001;
    background: linear-gradient(135deg, transparent 50%, rgba(74, 144, 226, 0.6) 50%);
    border-top-left-radius: 6px;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.resize-handle:hover,
.resize-handle:active {
    opacity: 1;
}

/* 移动端样式 */
@media (max-width: 768px) {
    .weather-widget {
        width: 280px;
        min-width: 200px;
        min-height: 150px;
        resize: none;
        right: 10px;
        max-width: 90%;
        max-height: 80vh;
        touch-action: none;
        border-bottom-right-radius: 12px;
        overflow: hidden;
    }
    
    .resize-handle {
        display: block;
        width: 40px;
        height: 40px;
    }
    
    .weather-widget:active {
        transition: none;
    }
}

/* 天气组件头部 */
.weather-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.6);
}

.weather-title {
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
}

/* 移动端触摸支持 */
.weather-widget {
    touch-action: none; /* 禁用默认触摸行为 */
}

.weather-header {
    touch-action: none; /* 允许拖动 */
    cursor: move;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* 滚动区域 */
.weather-scrollable {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    max-height: calc(70vh - 50px);
    padding: 0 16px 16px;
    /* 优化滚动性能 */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    perspective: 1000;
    -webkit-perspective: 1000;
}

/* 最小化状态栏 */
.weather-minimized {
    position: fixed;
    top: 10px;
    left: 10px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 20px;
    padding: 6px 16px;
    z-index: 999;
    display: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.weather-minimized.visible {
    display: flex;
    align-items: center;
}

.minimized-content {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #2c3e50;
    font-size: 14px;
    font-weight: 500;
}

.weather-expand-btn {
    background: rgba(74, 144, 226, 0.2);
    border: none;
    border-radius: 12px;
    padding: 2px 10px;
    font-size: 12px;
    color: #2c3e50;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.weather-expand-btn:active {
    background: rgba(74, 144, 226, 0.3);
    transform: scale(0.95);
}

/* 天气内容区域 */
.weather-content {
    padding: 12px 0 0;
}

.weather-location {
    font-size: 14px;
    color: #2c3e50;
    margin-bottom: 12px;
    font-weight: 500;
}

.weather-main {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
}

.weather-temp {
    font-size: 36px;
    font-weight: 700;
    color: #2c3e50;
    margin-right: 16px;
}

.weather-details {
    flex: 1;
}

.weather-skycon,
.weather-aqi,
.weather-wind {
    font-size: 13px;
    margin: 4px 0;
    color: #2c3e50;
}

.weather-extra {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px dashed rgba(0, 0, 0, 0.1);
}

.weather-item {
    font-size: 13px;
    padding: 6px 0;
    color: #2c3e50;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.weather-item:last-child {
    border-bottom: none;
}

/* 移动端样式 */
@media (max-width: 768px) {
    .weather-widget {
        max-width: 95%;
        max-height: 80vh;
        resize: none;
        touch-action: pinch-zoom;
    }
    
    .weather-header {
        padding: 10px 12px;
    }
    
    .weather-scrollable {
        padding: 0 12px 12px;
    }
    
    .weather-close-btn {
        padding: 3px 10px;
        font-size: 11px;
    }
    
    .weather-temp {
        font-size: 32px;
    }
    
    .weather-minimized {
        padding: 5px 14px;
    }
    
    .minimized-content {
        font-size: 13px;
    }
    
    .weather-expand-btn {
        padding: 2px 8px;
        font-size: 11px;
    }
}

.weather-widget::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.4) 0%, rgba(255, 255, 255, 0.1) 50%, rgba(255, 255, 255, 0.4) 100%);
    z-index: -1;
    pointer-events: none;
}

.weather-title {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.2));
    padding: 12px 15px;
    font-size: 14px;
    font-weight: bold;
    color: #2c3e50;
    border-bottom: 1px solid rgba(255, 255, 255, 0.6);
    text-align: center;
    letter-spacing: 2px;
    text-transform: uppercase;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
    position: relative;
    overflow: hidden;
}

.weather-title::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -60%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        to right,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.4) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    transform: rotate(30deg);
    animation: shine 3s infinite;
}

@keyframes shine {
    0% {
        left: -60%;
    }
    20% {
        left: 100%;
    }
    100% {
        left: 100%;
    }
}

.weather-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 8px;
}

.weather-location {
    font-size: 16px;
    font-weight: bold;
    color: #68495b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
    margin-bottom: 5px;
}

.weather-refresh {
    cursor: pointer;
    font-size: 16px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
}

.weather-refresh:hover {
    transform: rotate(180deg);
    background: rgba(255, 255, 255, 0.5);
}

.weather-temp {
    font-size: 28px;
    font-weight: bold;
    color: #2c3e50;
    margin: 5px 0 10px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.weather-details {
    font-size: 12px;
    color: #5a4a57;
    margin-top: 8px;
    border-top: 1px dashed rgba(0, 0, 0, 0.1);
    padding-top: 8px;
}

.weather-detail-item {
    padding: 8px 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-bottom: 1px solid rgba(255, 255, 255, 0.4);
    line-height: 1.6;
    margin: 4px 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border-left: 3px solid rgba(255, 255, 255, 0.3);
}

.weather-detail-item:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateX(5px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.weather-detail-item:last-child {
    border-bottom: none;
}

.weather-skycon {
    margin-bottom: 3px;
}

.weather-aqi, .weather-wind {
    margin: 2px 0;
}

.container {
    width: 100%;
    max-width: 600px;
    padding: 20px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

#mainImage {
    width: 100%;
    max-width: 200px;
    height: auto;
    transition: var(--transition);
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    pointer-events: none; /* 可选：防止图片被点击拖动 */
}

h1 {
    color: var(--text-color);
    margin: 20px 0;
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.4;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

@media (min-width: 768px) {
    .buttons {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 15px;
        margin-top: 25px;
    }
}

button {
    padding: 12px 30px;
    margin: 5px;
    font-size: 1rem;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
    position: relative;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    touch-action: manipulation;
    min-width: 120px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    user-select: none;
    line-height: 1.5;
    box-shadow: var(--shadow);
    outline: none;
    transform: translateY(0);
    will-change: transform, box-shadow;
}

#yes {
    background: linear-gradient(45deg, #4CAF50, #8BC34A);
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
    background-size: 200% auto;
    border: 2px solid #45a049;
    position: relative;
    overflow: hidden;
}

#yes:active, #yes.touch-active {
    transform: translateY(1px) scale(0.98);
    box-shadow: 0 2px 5px rgba(76, 175, 80, 0.3);
}

#no:active, #no.touch-active {
    transform: translateY(1px) scale(0.98);
    box-shadow: 0 2px 5px rgba(244, 67, 54, 0.3);
}

@media (hover: hover) and (pointer: fine) {
    #yes:hover {
        background-position: right center;
        transform: translateY(-3px);
        box-shadow: 0 8px 25px rgba(76, 175, 80, 0.4);
        animation: pulse 1.5s infinite;
    }
    
    #no:hover {
        transform: translateY(-3px);
        box-shadow: 0 8px 25px rgba(244, 67, 54, 0.4);
    }
}

#no {
    background: linear-gradient(45deg, #f44336, #ff9800);
    color: white;
    border: 2px solid #e53935;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
    background-size: 200% auto;
    position: relative;
    overflow: hidden;
    transform: translateY(0);
    will-change: transform, box-shadow;
}

#no:hover {
    background-position: right center;
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(244, 67, 54, 0.4);
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

.yes-text {
    font-size: 7vw; /* 字体大小根据视口宽度变化 */
}

/* 按钮动画 */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(76, 175, 80, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0);
    }
}

@keyframes shake {
    10%, 90% {
        transform: translate3d(-1px, -3px, 0);
    }
    
    20%, 80% {
        transform: translate3d(2px, -3px, 0);
    }

    30%, 50%, 70% {
        transform: translate3d(-3px, -3px, 0);
    }

    40%, 60% {
        transform: translate3d(3px, -3px, 0);
    }
}

/* 按钮点击效果 */
button:active {
    transform: translateY(1px) !important;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2) !important;
}

/* 按钮光效 */
button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: 0.5s;
    z-index: -1;
}

button:hover::before {
    left: 100%;
}

.yes-image {
    width: 50%; /* 图片宽度自适应容器 */
    max-width: 300px; /* 最大宽度限制 */
}

/* 页脚样式 */
.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    text-align: center;
    padding: 20px 0;
    z-index: 100;
    background: linear-gradient(to top, rgba(0,0,0,0.2), transparent);
    pointer-events: none;
}

.footer p {
    display: inline-block;
    background: linear-gradient(90deg, #3498db, #e74c3c);
    -webkit-background-clip: text;
    background-clip: text;
    color: #3498db; /* 设置默认颜色，在不支持背景渐变的浏览器中显示 */
    font-weight: 700;
    letter-spacing: 1.5px;
    position: relative;
    padding: 10px 30px;
    margin: 0;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
    background-size: 200% auto;
    animation: 
        shine 3s linear infinite,
        float 4s ease-in-out infinite;
    font-size: 16px;
    border-radius: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    background-color: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 215, 0, 0.3);
    pointer-events: auto;
    transition: all 0.3s ease;
}

/* 添加金色光晕效果 */
.footer p::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, #3498db, #e74c3c, #3498db, #e74c3c);
    background-size: 300% 300%;
    z-index: -1;
    border-radius: 30px;
    opacity: 0.5;
    transition: 0.5s;
    animation: gradientBG 6s ease infinite;
    filter: blur(4px);
}

.footer p:hover::before {
    opacity: 0.8;
    filter: blur(6px);
}

/* 添加光点效果 */
.footer p::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 20% 30%, rgba(255,255,255,0.9), transparent 40%),
                radial-gradient(circle at 80% 70%, rgba(255,255,255,0.7), transparent 40%);
    border-radius: 30px;
    opacity: 0.4;
    pointer-events: none;
    mix-blend-mode: overlay;
}

/* 添加动画 */
@keyframes shine {
    0% {
        background-position: 0% center;
    }
    100% {
        background-position: 200% center;
    }
}

/* 按钮动画 */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(76, 175, 80, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0);
    }
}

@keyframes shake {
    10%, 90% {
        transform: translate3d(-1px, -3px, 0);
    }
    
    20%, 80% {
        transform: translate3d(2px, -3px, 0);
    }

    30%, 50%, 70% {
        transform: translate3d(-3px, -3px, 0);
    }

    40%, 60% {
        transform: translate3d(3px, -3px, 0);
    }
}

/* 按钮点击效果 */
button:active {
    transform: translateY(1px) !important;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2) !important;
}

/* 按钮光效 */
button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: 0.5s;
}

button:hover::before {
    left: 100%;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

@keyframes gradientBG {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* 悬停效果 */
.footer p:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25), 0 0 20px rgba(52, 152, 219, 0.4);
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.9);
    background-color: rgba(0, 0, 0, 0.6);
}

/* 电脑端样式优化 */
@media (min-width: 768px) {
    body {
        display: block;
    }

    .container {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: auto;
        max-width: none;
    }

    #mainImage {
        width: 200px; /* 固定图片宽度 */
    }

    h1 {
        font-size: 28px; /* 固定字体大小 */
        margin: 20px 0;
    }

    button {
        font-size: 18px; /* 固定字体大小 */
    }

    .yes-text {
        font-size: 36px; /* 固定字体大小 */
    }

    .yes-image {
        width: 300px; /* 固定图片宽度 */
    }
}