* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --primary-light: #3b82f6;
    --secondary-color: #64748b;
    --background: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --gradient-primary: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
    --gradient-accent: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

header {
    background: var(--gradient-primary);
    color: white;
    padding: 2rem 1rem;
    text-align: center;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    animation: float 6s ease-in-out infinite;
}

header::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -5%;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    animation: float 8s ease-in-out infinite reverse;
}

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(5deg); }
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 1;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
    font-weight: 300;
    position: relative;
    z-index: 1;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.card-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-title::before {
    content: '';
    width: 4px;
    height: 24px;
    background: var(--gradient-primary);
    border-radius: 2px;
}

.ruler-container {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-lg);
    border: 2px solid var(--primary-color);
}

.ruler-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
    align-items: center;
    justify-content: center;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: white;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-secondary:hover {
    background: var(--primary-color);
    color: white;
}

.unit-toggle {
    display: flex;
    gap: 0.5rem;
    background: var(--background);
    padding: 0.25rem;
    border-radius: 8px;
}

.unit-btn {
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.unit-btn.active {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-sm);
}

.ruler-display {
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    overflow-x: auto;
    position: relative;
}

.ruler {
    height: 100px;
    background: linear-gradient(to bottom, #f1f5f9 0%, #ffffff 50%, #f1f5f9 100%);
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
    min-width: 800px;
}

.ruler-marks {
    display: flex;
    height: 100%;
    position: relative;
}

.mark {
    position: absolute;
    height: 100%;
}

.mark-label {
    position: absolute;
    top: 5px;
    left: 2px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary-color);
}

.mark-line {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 1px;
    background: var(--text-secondary);
}

.mark.major .mark-line {
    height: 30px;
    background: var(--primary-color);
    width: 2px;
}

.mark.medium .mark-line {
    height: 20px;
}

.mark.minor .mark-line {
    height: 12px;
}

.calibration-info {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--gradient-accent);
    border-radius: 8px;
    color: white;
    text-align: center;
    font-size: 0.9rem;
}

.ad-banner {
    background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
    border-radius: 16px;
    padding: 2rem;
    margin: 2rem 0;
    text-align: center;
    box-shadow: var(--shadow-lg);
    border: 2px solid #fb923c;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease;
}

.ad-banner::before {
    content: '🔥';
    position: absolute;
    top: -20px;
    right: -20px;
    font-size: 100px;
    opacity: 0.1;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.ad-banner:hover {
    transform: scale(1.02);
}

.ad-banner h3 {
    color: white;
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.ad-banner p {
    color: rgba(255, 255, 255, 0.95);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.ad-banner .btn {
    background: white;
    color: #f97316;
    font-weight: 700;
    font-size: 1.1rem;
    padding: 1rem 2rem;
    text-decoration: none;
    display: inline-block;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.ad-banner .btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.feature-item {
    padding: 1.5rem;
    background: var(--background);
    border-radius: 12px;
    border-left: 4px solid var(--primary-color);
    transition: all 0.3s ease;
}

.feature-item:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow-md);
}

.feature-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.feature-item h3 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.feature-item p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.steps {
    counter-reset: step-counter;
}

.step-item {
    padding: 1.5rem;
    margin-bottom: 1rem;
    background: var(--background);
    border-radius: 12px;
    position: relative;
    padding-left: 4rem;
    transition: all 0.3s ease;
}

.step-item:hover {
    background: white;
    box-shadow: var(--shadow-md);
}

.step-item::before {
    counter-increment: step-counter;
    content: counter(step-counter);
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: var(--gradient-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
    box-shadow: var(--shadow-md);
}

.step-item h3 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.links-grid a {
    color: var(--primary-color);
    text-decoration: none;
    padding: 0.75rem;
    background: var(--background);
    border-radius: 8px;
    text-align: center;
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
}

.links-grid a:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

footer {
    background: var(--text-primary);
    color: white;
    padding: 3rem 1rem 1rem;
    margin-top: 4rem;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3 {
    margin-bottom: 1rem;
    color: var(--primary-light);
}

.footer-section p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-section a:hover {
    color: var(--primary-light);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
}

.measurement-result {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--gradient-primary);
    color: white;
    border-radius: 8px;
    text-align: center;
    font-size: 1.2rem;
    font-weight: 600;
}

.measurement-line {
    position: absolute;
    top: 0;
    height: 100%;
    width: 2px;
    background: #ef4444;
    cursor: pointer;
    z-index: 10;
}

.measurement-line::before {
    content: '';
    position: absolute;
    top: -5px;
    left: -4px;
    width: 10px;
    height: 10px;
    background: #ef4444;
    border-radius: 50%;
}

@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }

    .container {
        padding: 1rem;
    }

    .card {
        padding: 1.5rem;
    }

    .ruler-container {
        padding: 1rem;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .ad-banner h3 {
        font-size: 1.5rem;
    }

    .ruler-display {
        padding: 1rem;
    }

    .ruler {
        min-width: 600px;
    }
}
