@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@500&display=swap');

:root {
    --primary-color: #a6c8ff; /* Light blue */
    --secondary-color: #d4e4ff; /* Very light blue */
    --accent-color: #7ba4e0; /* Medium light blue for accents */
    --text-color: #4a5568; /* Dark grey for text */
    --background-color: #f7fafc; /* Very light grey/blue for background */
    --card-background: rgba(255, 255, 255, 0.85); /* Semi-transparent white */
    --border-color: rgba(200, 215, 235, 0.5); /* Light blue border */
    --input-background: rgba(255, 255, 255, 0.8); /* Nearly white input background */
    --shadow-light: rgba(0, 0, 0, 0.05);
    --shadow-medium: rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: var(--background-color);
    color: var(--text-color);
    overflow-x: hidden; /* Only prevent horizontal scrollbars */
    position: relative;
    padding: 20px 0; /* Add padding for better spacing on mobile */
}

/* Background animation */
body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('https://files.codelife.cc/wallpaper/wallspic/20240607l06j9e.jpeg') no-repeat center center/cover;
    filter: brightness(1.1) saturate(0.8) blur(8px); /* Lighten and reduce saturation */
    transform: scale(1.1); /* Slightly zoom to cover blur edges */
    animation: pan-background 60s infinite alternate linear;
    z-index: -1;
    opacity: 0.4; /* Make background more subtle */
}

@keyframes pan-background {
    0% {
        background-position: 0% 0%;
    }
    100% {
        background-position: 100% 100%;
    }
}

.form-box {
    position: relative;
    width: 450px;
    background: var(--card-background);
    border-radius: 20px;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 30px var(--shadow-medium);
    padding: 50px;
    text-align: center;
    backdrop-filter: blur(10px); /* Glassmorphism effect */
    -webkit-backdrop-filter: blur(10px);
    animation: fade-in 1s ease-out;
}

@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

h2 {
    font-size: 1.8rem; /* Reduced size to match mobile */
    color: var(--text-color); /* Dark text for contrast */
    margin-bottom: 35px;
    text-shadow: 0 1px 2px var(--shadow-light);
}

.inputbox {
    position: relative;
    margin: 30px 0;
    border-bottom: 2px solid var(--border-color);
}

.inputbox label {
    position: absolute;
    top: 50%;
    left: 5px;
    transform: translateY(-50%);
    color: #8a9ab0; /* Medium blue-grey for labels */
    font-size: 1rem;
    pointer-events: none;
    transition: 0.3s ease-in-out;
}

.inputbox input:focus ~ label,
.inputbox input:valid ~ label,
.inputbox input.active ~ label {
    top: -15px;
    font-size: 0.8rem;
    color: var(--accent-color); /* Medium light blue when active */
    text-shadow: 0 1px 1px var(--shadow-light);
}

.inputbox input {
    width: 100%;
    height: 50px;
    background: var(--input-background);
    border: none;
    outline: none;
    font-size: 1rem;
    padding: 0 35px 0 10px;
    color: var(--text-color); /* Dark grey text */
    border-radius: 5px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.inputbox input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 10px rgba(123, 164, 224, 0.3); /* Light blue glow on focus */
}

.inputbox ion-icon {
    position: absolute;
    right: 10px;
    color: #8a9ab0; /* Medium blue-grey for icons */
    font-size: 1.4rem;
    top: 50%;
    transform: translateY(-50%);
    transition: color 0.3s ease;
}

.inputbox input:focus ~ ion-icon,
.inputbox input:valid ~ ion-icon {
    color: var(--accent-color);
}

.captcha-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 30px;
}

.captcha-input-wrapper {
    position: relative;
    flex-grow: 1;
    margin-right: 15px;
}

.captcha-box input {
    width: 100%;
    margin-right: 0;
}

.captcha-box img {
    height: 50px; /* Slightly larger captcha */
    cursor: pointer;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: transform 0.2s ease, box-shadow 0.3s ease;
    background-color: rgba(255, 255, 255, 0.9);
}

.captcha-box img:hover {
    transform: scale(1.03);
    box-shadow: 0 0 15px rgba(123, 164, 224, 0.3);
}

button {
    width: 100%;
    height: 55px;
    border-radius: 30px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    color: white;
    border: none;
    outline: none;
    cursor: pointer;
    font-size: 1.1rem; /* 调整桌面端字体大小 */
    font-weight: 600;
    transition: all 0.3s ease;
    margin-top: 30px;
    box-shadow: 0 5px 15px var(--shadow-medium);
    position: relative;
    overflow: hidden;
}

/* 桌面版和移动版按钮文本 */
.desktop-text {
    display: inline;
}

.mobile-text {
    display: none;
}

/* 按钮点击效果 */
button.clicked {
    animation: button-press 0.8s ease;
}

@keyframes button-press {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(0.95);
    }
    100% {
        transform: scale(1);
    }
}

/* 波纹效果 */
button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.5);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1, 1) translate(-50%);
    transform-origin: 50% 50%;
}

button.clicked::after {
    animation: ripple 1s ease-out;
}

@keyframes ripple {
    0% {
        transform: scale(0, 0);
        opacity: 0.5;
    }
    100% {
        transform: scale(20, 20);
        opacity: 0;
    }
}

.result {
    display: none;
    margin-top: 30px;
    padding: 20px;
    background: var(--card-background);
    border-radius: 15px;
    border: 1px solid var(--border-color);
    box-shadow: 0 5px 15px var(--shadow-light);
    text-align: left;
    min-height: 30px;
    animation: slide-up 0.5s ease-out forwards;
}

@keyframes slide-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result p {
    margin: 10px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
    animation: fade-in-item 0.5s ease-out forwards;
    animation-delay: calc(var(--item-index) * 0.1s);
    opacity: 0;
}

.result p:last-child {
    border-bottom: none;
}

.result p strong {
    color: var(--accent-color);
    display: block;
    margin-bottom: 5px;
    animation: slide-in-heading 0.5s ease-out forwards;
    animation-delay: calc(var(--item-index) * 0.1s);
    transform: translateX(-20px);
    opacity: 0;
}

.scoreInquiry {
    margin-top: 20px;
    text-align: center;
}

.scoreInquiry p a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
}

.scoreInquiry p a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

/* 错误消息样式 */
.error-message {
    color: #e74c3c !important;
    font-weight: 500;
    text-align: center;
    padding: 10px;
    border-radius: 8px;
    background-color: rgba(231, 76, 60, 0.1);
    border-left: 3px solid #e74c3c;
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both !important;
    transform: translate3d(0, 0, 0) !important;
    backface-visibility: hidden;
    perspective: 1000px;
    display: block !important;
    opacity: 1 !important;
    border-bottom: none !important;
}

@keyframes shake {
    10%, 90% {
        transform: translate3d(-1px, 0, 0);
    }
    
    20%, 80% {
        transform: translate3d(2px, 0, 0);
    }

    30%, 50%, 70% {
        transform: translate3d(-4px, 0, 0);
    }

    40%, 60% {
        transform: translate3d(4px, 0, 0);
    }
}

@keyframes fade-in-item {
    to {
        opacity: 1;
    }
}

@keyframes slide-in-heading {
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* 移动端适配 */
@media (max-width: 600px) {
    body {
        align-items: flex-start; /* 顶部对齐，便于移动端滚动 */
        padding: 30px 0;
    }
    
    .form-box {
        width: 92%;
        padding: 25px 15px;
        margin: 10px auto;
        max-height: none; /* 移除高度限制 */
        text-align: left; /* 移动端左对齐内容 */
    }

    h2 {
        font-size: 1.8rem;
        margin-bottom: 25px;
        text-align: center; /* 移动端标题居中 */
    }

    .inputbox {
        margin: 25px 0;
        width: 100%;
    }

    .inputbox input,
    button {
        height: 48px;
        font-size: 1rem;
    }

    .inputbox label {
        font-size: 0.9rem;
        width: 90%; /* 防止标签溢出 */
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .inputbox input:focus ~ label,
    .inputbox input:valid ~ label,
    .inputbox input.active ~ label {
        top: -12px;
        font-size: 0.75rem;
        width: auto; /* 激活时重置宽度 */
        white-space: normal;
    }

    .captcha-box {
        flex-direction: row; /* 横向排版 */
        align-items: center;
    }
    
    .captcha-input-wrapper {
        width: auto;
        flex-grow: 1;
        margin-right: 10px;
        margin-bottom: 0;
    }

    .captcha-box input {
        width: 100%;
    }

    .captcha-box img {
        height: 45px;
        width: auto; /* 自动宽度 */
        align-self: center;
    }

    .result {
        font-size: 0.95rem;
        padding: 15px;
        margin-top: 25px;
        overflow-wrap: break-word;
        word-wrap: break-word;
    }

    .scoreInquiry {
        font-size: 1rem;
        margin: 25px 0 10px;
    }

    button {
        margin-top: 25px;
        font-size: 1rem; /* 调整移动端按钮字体大小 */
    }
    
    /* 移动端按钮文本显示 */
    .desktop-text {
        display: none;
    }
    
    .mobile-text {
        display: inline;
        font-size: 0.9rem; /* 调整移动端文本字体大小 */
    }
}
