* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary-color: #10b981;
    --bg-color: #f0f4f8;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --input-bg: #f8fafc;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: var(--text-primary);
}

.container {
    max-width: 600px;
    margin: 0 auto;
}

.card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hidden {
    display: none !important;
}

/* 头部带关于按钮 */
.header-with-about {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    position: relative;
}

.btn-about {
    position: absolute;
    right: 0;
    padding: 6px 14px;
    background: var(--border-color);
    color: var(--text-secondary);
    border: none;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-about:hover {
    background: var(--primary-color);
    color: white;
}

@media (max-width: 480px) {
    .header-with-about {
        flex-wrap: wrap;
    }
    
    .btn-about {
        position: static;
        margin-top: 8px;
    }
}

h1 {
    font-size: 1.5rem;
    margin-bottom: 8px;
    text-align: center;
    color: var(--text-primary);
}

h2 {
    font-size: 1.3rem;
    margin: 0;
    color: var(--text-primary);
}

.subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 25px;
    font-size: 0.95rem;
}

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-size: 0.95rem;
}

input[type="number"] {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 1rem;
    background: var(--input-bg);
    transition: all 0.3s ease;
}

input[type="number"]:focus {
    outline: none;
    border-color: var(--primary-color);
    background: #ffffff;
}

small {
    display: block;
    margin-top: 6px;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

small.pace-range-desc {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    padding: 10px 14px;
    border-radius: 8px;
    border-left: 4px solid #f59e0b;
    margin-bottom: 8px;
    color: #92400e;
    font-weight: 500;
}

.time-inputs {
    display: flex;
    gap: 10px;
    align-items: center;
}

.time-field {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.time-field input {
    text-align: center;
    font-size: 1.2rem;
    font-weight: 600;
}

.time-field span {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.btn-calculate {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.btn-calculate:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(37, 99, 235, 0.4);
}

.btn-calculate:active {
    transform: translateY(0);
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.btn-back {
    padding: 8px 16px;
    background: var(--border-color);
    color: var(--text-primary);
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-back:hover {
    background: #cbd5e1;
}

.summary {
    display: flex;
    justify-content: space-around;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.summary-item {
    text-align: center;
    flex: 1;
    min-width: 80px;
}

.summary-item .label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.summary-item .value {
    display: block;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.table-container {
    overflow-x: auto;
    margin-bottom: 20px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

th {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 14px 12px;
    text-align: center;
    font-weight: 600;
    white-space: nowrap;
}

th:first-child {
    border-radius: 12px 0 0 0;
}

th:last-child {
    border-radius: 0 12px 0 0;
}

td {
    padding: 12px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

tr:nth-child(even) {
    background: #f8fafc;
}

tr:hover {
    background: #e0f2fe;
}

.pace-avg {
    background: #dcfce7 !important;
    font-weight: 600;
}

.pace-avg td {
    color: #166534;
}

.chart-container {
    margin: 25px 0;
    padding: 15px;
    background: #f8fafc;
    border-radius: 12px;
}

#paceChart {
    width: 100%;
    height: 200px;
}

/* 响应式设计 */
@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .card {
        padding: 20px;
        border-radius: 16px;
    }

    h1 {
        font-size: 1.3rem;
    }

    .time-inputs {
        gap: 6px;
    }

    .time-field input {
        padding: 10px;
        font-size: 1rem;
    }

    .time-field span {
        font-size: 0.7rem;
    }

    th, td {
        padding: 10px 8px;
        font-size: 0.9rem;
    }

    .summary {
        padding: 15px;
    }

    .summary-item .value {
        font-size: 1rem;
    }
}

/* 祝贺消息动效 */
.congrats-message {
    text-align: center;
    padding: 20px;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border-radius: 12px;
    border: 2px solid #f87171;
    opacity: 0;
    transform: translateY(-20px);
    animation: congratsSlideIn 0.8s ease forwards;
}

.congrats-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 8px;
    animation: iconBounce 1s ease infinite;
}

.congrats-text {
    font-size: 1.2rem;
    font-weight: 700;
    color: #991b1b;
    background: linear-gradient(135deg, #991b1b, #b91c1c);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

@keyframes congratsSlideIn {
    0% {
        opacity: 0;
        transform: translateY(-20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes iconBounce {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
}

/* 关于弹窗 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay:not(.hidden) {
    opacity: 1;
}

.modal-content {
    background: white;
    border-radius: 20px;
    width: 90%;
    max-width: 420px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.4);
    animation: modalSlideIn 0.4s ease;
    overflow: hidden;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.2rem;
}

.btn-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.8rem;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s ease;
}

.btn-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 24px;
}

.developer-info {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.avatar {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--input-bg);
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dev-details {
    flex: 1;
}

.dev-name {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 6px 0;
}

.dev-email {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0;
}

.about-description {
    color: var(--text-secondary);
    line-height: 1.7;
}

.about-description p {
    margin: 0 0 12px 0;
}

.about-description p:last-child {
    margin-bottom: 0;
}

/* 动画效果 */
.highlight-row {
    animation: highlight 0.5s ease;
}

@keyframes highlight {
    0% {
        background: #fef3c7;
    }
    100% {
        background: transparent;
    }
}
