/* 触摸优化样式 */

/* 触摸反馈优化 */
.control-btn {
    -webkit-tap-highlight-color: rgba(255, 255, 255, 0.3);
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    touch-action: manipulation;
}

/* 触摸按下效果 */
.control-btn:active {
    background: rgba(255, 255, 255, 0.4) !important;
    transform: scale(0.95);
    transition: all 0.1s ease;
}

/* 长按提示 */
.touch-hint {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 1000;
}

.touch-hint.show {
    opacity: 1;
}

/* 手势区域 */
.gesture-area {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
}

/* 全屏时的触摸区域 */
.fullscreen .gesture-area {
    z-index: 10;
}

/* 触摸涟漪效果 */
.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: scale(0);
    animation: ripple-animation 0.6s linear;
    pointer-events: none;
}

@keyframes ripple-animation {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* 滑动手势指示器 */
.swipe-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1000;
}

.swipe-indicator.show {
    opacity: 1;
}

/* 触摸友好的按钮尺寸 */
@media (pointer: coarse) {
    .control-btn {
        min-height: 48px;
        min-width: 48px;
        padding: 14px 28px;
        font-size: 1.2rem;
    }
}

/* 防止意外缩放 */
body {
    touch-action: pan-x pan-y;
    -ms-touch-action: pan-x pan-y;
}

.time, .date {
    touch-action: none;
    -ms-touch-action: none;
}

/* 触摸时的视觉反馈 */
.time-display {
    transition: transform 0.1s ease;
}

.time-display.touched {
    transform: scale(1.02);
}

/* 长按选择禁用 */
* {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* 允许按钮文本选择（用于复制等） */
.control-btn {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* 触摸滚动优化 */
.clock-container {
    -webkit-overflow-scrolling: touch;
    overflow-scrolling: touch;
}

/* 手势提示动画 */
@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.7;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.gesture-hint {
    animation: pulse 2s infinite;
}

/* 触摸延迟优化 */
a, button, input, select, textarea {
    touch-action: manipulation;
}

/* 防止双击缩放 */
.no-zoom {
    touch-action: pan-x pan-y;
}

/* 触摸状态指示 */
.touch-active {
    background: rgba(255, 255, 255, 0.1) !important;
}

/* iPad特定的触摸优化 */
@media screen and (device-width: 768px) and (device-height: 1024px) {
    /* 增大触摸目标 */
    .control-btn {
        min-height: 52px;
        min-width: 120px;
        margin: 0 15px;
    }
    
    /* 优化触摸反馈 */
    .control-btn:active {
        background: rgba(255, 255, 255, 0.5) !important;
    }
}

/* 触摸设备特定样式 */
@media (hover: none) and (pointer: coarse) {
    /* 移除hover效果，使用touch效果 */
    .control-btn:hover {
        background: rgba(255, 255, 255, 0.2);
        transform: none;
    }
    
    /* 增强触摸反馈 */
    .control-btn:active {
        background: rgba(255, 255, 255, 0.4) !important;
        transform: scale(0.95);
    }
}

/* 手势识别区域 */
.gesture-zone {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 5;
}

/* 全屏手势提示 */
.fullscreen-hint {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 2000;
    pointer-events: none;
}

.fullscreen-hint.show {
    opacity: 1;
}

/* 触摸轨迹效果 */
.touch-trail {
    position: absolute;
    width: 20px;
    height: 20px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    pointer-events: none;
    animation: trail-fade 0.5s ease-out forwards;
}

@keyframes trail-fade {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(0);
        opacity: 0;
    }
}