.card {
    width: 100%;
    box-shadow: 0 20px 35px -10px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    -webkit-transition: -webkit-transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    -webkit-transform: translateY(-2px);
    box-shadow: 0 25px 40px -12px rgba(0, 0, 0, 0.2);
}

h1 {
    font-size: 1.9rem;
    font-weight: 700;
    background: linear-gradient(135deg, #1e2b6e, #2563eb);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    margin-bottom: 0.5rem;
    letter-spacing: -0.3px;
}

p {
    color: #4b5563;
    margin-bottom: 0.5rem;
    font-size: 1rem;
    line-height: 1.4;
}

/* 普通输入框和下拉框 */
input:not([type="range"]),
select {
    width: 100%;
    padding: 0.9rem 1.2rem;
    font-size: 1.05rem;
    border: 2px solid #cbd5e1;
    border-radius: 60px;
    background: white;
    transition: all 0.2s ease;
    -webkit-transition: all 0.2s ease;
    margin-top: 0.25rem;
    margin-bottom: 1rem;
    font-family: inherit;
    outline: none;
}

input:not([type="range"]):focus,
select:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
    outline: none;
}

/* range 滑动条 - 兼容 WebKit（Chrome/Safari）和 Firefox */
input[type="range"] {
    width: 100%;
    margin: 0.5rem 0 1rem 0;
    border: none;
    background: transparent;
    -webkit-appearance: none;
    /* 移除 WebKit 默认样式 */
    appearance: none;
}

/* WebKit 轨道 */
input[type="range"]::-webkit-slider-runnable-track {
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
}

/* WebKit 滑块 */
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    height: 18px;
    width: 18px;
    border-radius: 50%;
    background: #2563eb;
    margin-top: -6px;
    cursor: pointer;
}

/* Firefox 轨道 */
input[type="range"]::-moz-range-track {
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
}

/* Firefox 滑块 */
input[type="range"]::-moz-range-thumb {
    height: 18px;
    width: 18px;
    border-radius: 50%;
    background: #2563eb;
    border: none;
    cursor: pointer;
}

input[type="range"]:focus {
    outline: none;
}

input::placeholder {
    color: #cbd5e1;
    font-weight: 400;
}

button {
    width: 100%;
    padding: 0.9rem 1.2rem;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 60px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-transition: all 0.2s ease;
    margin: 0.5rem 0 1rem 0;
    font-family: inherit;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}

button:hover {
    background: #1d4ed8;
    transform: scale(0.98);
    -webkit-transform: scale(0.98);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.result {
    background: #eff6ff;
    border-radius: 60px;
    padding: 1rem 1.5rem;
    text-align: center;
    font-size: 1.3rem;
    font-weight: 600;
    color: #1e40af;
    margin: 1rem 0;
    border: 1px solid #bfdbfe;
}

.info-text {
    font-size: 0.85rem;
    color: #6c757d;
    background: #f8fafc;
    padding: 1rem;
    border-radius: 20px;
    margin-top: 1.5rem;
    line-height: 1.5;
    border-left: 4px solid #2563eb;
}

/* 导航栏样式 - 带下划线动画（含兼容性） */
.nav {
    width: 100%;
}

.nav a {
    display: inline-block;
    margin: 0 0.25rem;
    padding: 0.8rem 0.5rem;
    text-decoration: none;
    color: #2563eb;
    font-weight: 500;
    font-size: 1rem;
    transition: opacity 0.2s ease, color 0.2s ease;
    -webkit-transition: opacity 0.2s ease, color 0.2s ease;
    padding-bottom: 4px;
    position: relative;
}

/* 下划线伪元素（初始宽度0，居中） */
.nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: #2563eb;
    transition: width 0.3s ease, left 0.3s ease;
    -webkit-transition: width 0.3s ease, left 0.3s ease;
}

/* 非当前页面链接 hover 时：下划线展开到全宽 */
.nav a:hover:not(.active)::after {
    width: 100%;
    left: 0;
}

/* 非当前页面链接 hover 时：透明度变化 */
.nav a:hover:not(.active) {
    opacity: 0.8;
}

/* 当前页面高亮样式（静态，无 hover 效果） */
.nav a.active {
    color: #1e40af;
    font-weight: 700;
    border-bottom: none;
    position: relative;
}

.nav a.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: #2563eb;
}

.nav a.active:hover {
    opacity: 1;
    transform: none;
    -webkit-transform: none;
}

footer {
    text-align: center;
    margin-top: 2rem;
    font-size: 0.7rem;
    color: #94a3b8;
}

/* 自定义 Toast 通知样式 */
.toast-message {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #1f2937;
    color: white;
    padding: 12px 24px;
    border-radius: 60px;
    font-size: 0.95rem;
    font-weight: 500;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    /* 让通知不干扰点击 */
    font-family: system-ui, -apple-system, sans-serif;
    max-width: 90vw;
    text-align: center;
    white-space: nowrap;
    overflow-x: auto;
}

/* 错误类型（可选，用于区分） */
.toast-message.error {
    background-color: #dc2626;
}

.toast-message.success {
    background-color: #10b981;
}

/* additional style for slider */
.slider-value {
    font-weight: bold;
    color: #2563eb;
}

@media (max-width: 640px) {
    .toast-message {
        white-space: normal;
        width: auto;
        max-width: 85vw;
        padding: 10px 20px;
        font-size: 0.85rem;
    }
}

/* 响应式布局兼容移动端 */
@media (max-width: 480px) {
    .card {
        padding: 1.5rem;
    }

    h1 {
        font-size: 1.6rem;
    }

    .result {
        font-size: 1.1rem;
        padding: 0.8rem 1rem;
    }

    button,
    input:not([type="range"]),
    select {
        padding: 0.8rem 1rem;
    }

    .nav a {
        margin: 0 0.5rem;
        font-size: 0.9rem;
    }
}