:root {
    --primary-color: #ff5252;
    --secondary-color: #2196f3;
    --success-color: #4caf50;
    --error-color: #f44336;
    --background-dark: #121212;
    --button-hover: #e53935;
    --button-active: #c62828;
    --input-bg: rgba(255, 255, 255, 0.08);
    --input-border: rgba(255, 255, 255, 0.2);
    --input-focus: #ff5252;
}

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

body {
    font-family: 'Arial', sans-serif;
    background-color: var(--background-dark);
    color: white;
    overflow: hidden;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.background-animation {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 10% 20%, rgba(255, 82, 82, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(33, 150, 243, 0.07) 0%, transparent 40%);
    z-index: -1;
    animation: backgroundPulse 10s infinite alternate;
}

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

.background-animation::before {
    content: '';
    position: absolute;
    width: 200%;
    height: 200%;
    top: -50%;
    left: -50%;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><rect fill="none" stroke="rgba(255,255,255,0.03)" stroke-width="1" width="100" height="100"/></svg>');
    animation: bgMove 60s linear infinite;
    opacity: 0.3;
}

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

/* 输入框容器样式 - 已优化 */
.input-container {
    position: relative;
    width: 80%;
    max-width: 400px;
    margin-bottom: 40px;
    z-index: 10;
}

.input-wrapper {
    position: relative;
    width: 100%;
    margin-top: 15px; /* 为顶部标签留出空间 */
}

.message-input {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid var(--input-border);
    border-radius: 12px;
    background-color: var(--input-bg);
    color: white;
    font-size: 16px;
    outline: none;
    transition: all 0.3s ease;
    -webkit-appearance: none;
    appearance: none;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2), 0 0 15px rgba(255, 82, 82, 0.1);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.message-input:focus {
    border-color: var(--input-focus);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2), 0 0 20px rgba(255, 82, 82, 0.3);
}

/* 移除旧的聚焦效果横线 */
.input-focus-effect {
    display: none;
}

/* 修改浮动标签，防止与占位符重叠 */
.floating-label {
    position: absolute;
    left: 0;
    top: -25px; /* 标签位于输入框上方 */
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
    transition: all 0.3s ease;
    pointer-events: none;
    background: transparent;
    padding: 0 5px;
}

/* 聚焦时标签效果 */
.message-input:focus ~ .floating-label {
    color: var(--primary-color);
    font-weight: 500;
}

.button-container {
    position: relative;
    margin-bottom: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;  /* 确保按钮在上层 */
}

.ping-button {
    position: relative;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: linear-gradient(145deg, #ff5252, #ff1744);
    color: white;
    border: none;
    outline: none;
    cursor: pointer;
    font-size: 24px;
    font-weight: bold;
    letter-spacing: 1px;
    box-shadow: 0 6px 10px rgba(0, 0, 0, 0.25), 
                0 0 20px rgba(255, 23, 68, 0.4),
                0 0 0 4px rgba(255, 23, 68, 0.2);
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.ping-button::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s;
}

.ping-button:hover {
    transform: translateY(-2px);
    background: linear-gradient(145deg, #ff6262, #ff2752);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.3), 
                0 0 30px rgba(255, 23, 68, 0.5),
                0 0 0 4px rgba(255, 23, 68, 0.3);
}

.ping-button:hover::after {
    opacity: 1;
}

.ping-button:active {
    transform: translateY(1px) scale(0.97);
    background: linear-gradient(145deg, #e04747, #e0173c);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2), 
                0 0 15px rgba(255, 23, 68, 0.4),
                0 0 0 2px rgba(255, 23, 68, 0.2);
}

.ping-button .button-text {
    margin-bottom: 8px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.ping-button .button-icon {
    font-size: 40px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.ripple-container {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    border-radius: 50%;
    overflow: hidden;
}

.ripple {
    position: absolute;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.5);
    transform: scale(0);
    animation: rippleEffect 0.8s linear;
}

@keyframes rippleEffect {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

.pulse-container {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    z-index: 5;  /* 确保在按钮下层 */
}

.pulse-circle {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 2px solid var(--primary-color);
    opacity: 0;
}

.pulse-circle-1 {
    width: 200px;
    height: 200px;
}

.pulse-circle-2 {
    width: 300px;
    height: 300px;
}

.pulse-circle-3 {
    width: 400px;
    height: 400px;
}

.pulse-animation {
    animation: pulseRing 1.5s cubic-bezier(0.215, 0.61, 0.355, 1) forwards;
}

.pulse-circle-2.pulse-animation {
    animation-delay: 0.2s;
}

.pulse-circle-3.pulse-animation {
    animation-delay: 0.4s;
}

@keyframes pulseRing {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }
    50% {
        opacity: 0.5;
    }
    100% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 0;
    }
}

.result-message {
    position: relative;
    font-size: 20px;
    margin-top: 20px;
    padding: 10px 20px;
    border-radius: 8px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease;
    text-align: center;
}

.success {
    background-color: rgba(76, 175, 80, 0.2);
    border: 1px solid var(--success-color);
    color: var(--success-color);
    animation: fadeInUp 0.5s forwards;
}

.error {
    background-color: rgba(244, 67, 54, 0.2);
    border: 1px solid var(--error-color);
    color: var(--error-color);
    animation: fadeInUp 0.5s forwards;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.particles-container {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.particle {
    position: absolute;
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
    opacity: 0;
}

.laser-container {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.laser {
    position: absolute;
    height: 2px;
    background: linear-gradient(to right, rgba(255, 255, 255, 0), #ff5252, rgba(255, 255, 255, 0));
    transform-origin: left center;
    opacity: 0;
    z-index: 9;
    filter: drop-shadow(0 0 5px rgba(255, 82, 82, 0.8));
}

@keyframes laserBeam {
    0% {
        opacity: 0;
        transform: scaleX(0);
    }
    5% {
        opacity: 1;
    }
    95% {
        opacity: 1;
        transform: scaleX(1);
    }
    100% {
        opacity: 0;
        transform: scaleX(1);
    }
}

@keyframes particleFade {
    0% {
        opacity: 0;
        transform: translate(0, 0);
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translate(var(--tx), var(--ty));
    }
}

.loading .button-icon {
    animation: rotating 1s linear infinite;
}

@keyframes rotating {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 768px) {
    .ping-button {
        width: 140px;
        height: 140px;
        font-size: 20px;
    }
    
    .ping-button .button-icon {
        font-size: 30px;
    }
    
    .pulse-circle-1 {
        width: 150px;
        height: 150px;
    }
    
    .pulse-circle-2 {
        width: 220px;
        height: 220px;
    }
    
    .pulse-circle-3 {
        width: 300px;
        height: 300px;
    }
    
    .input-container {
        width: 90%;
    }
}