/* 全局字体大小体系 */
:root {
    --font-xs: 0.7rem;        /* ~11px */
    --font-sm: 0.8125rem;     /* 13px */
    --font-base: 0.9375rem;   /* 15px */
    --font-lg: 1.0625rem;     /* 17px */
    --font-xl: 1.1875rem;     /* 19px */
    --font-2xl: 1.375rem;     /* 22px */
    --font-3xl: 1.75rem;      /* 28px */
    --font-4xl: 2.1rem;       /* 33.6px */
    --font-5xl: 2.75rem;      /* 44px */
}

/* 防止水平滚动 */
html {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: #ffffff;
    color: #0f1419;
    min-height: 100vh;
    padding: 0;
    padding-bottom: max(90px, env(safe-area-inset-bottom, 0px) + 90px); /* 为固定页脚和安全区域留出空间 */
    margin: 0;
    box-sizing: border-box;
    font-size: var(--font-base);
    line-height: 1.5;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    position: relative;
}

.container {
    background-color: #ffffff;
    padding: clamp(1.5rem, 2.5vw, 2rem);
    padding-bottom: max(2rem, 5vw);
    width: min(1600px, 100%);
    margin: 0 auto;
    min-height: 100%;
    box-sizing: border-box;
    overflow: hidden;
    border-radius: 20px;
    box-shadow: 0 12px 32px rgba(15, 20, 25, 0.06);
    max-width: 100%;
}

/* 主布局容器 */
.main-layout {
    display: flex;
    flex-direction: column;
    gap: clamp(0.75rem, 1.5vw, 1rem);
    align-items: stretch;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 输入面板样式 */
.input-panel {
    width: 100%;
    max-width: 42rem;
    margin: 0 auto;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 结果面板样式 */
.results-panel {
    width: 100%;
    display: flex;
    flex-direction: column;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: clamp(18rem, 36vw, 26rem); /* 确保面板有最小高度 */
}

/* 显示结果时的样式 */
.results-panel.show .results-container {
    box-shadow: 0 22px 54px rgba(29, 155, 240, 0.12);
}

/* 过期结果样式 */
.results-panel.outdated {
    opacity: 0.5;
    filter: grayscale(50%);
}

.results-panel.outdated .stat-value {
    color: #9ca3af !important;
}

.results-panel.outdated .main-result {
    color: #9ca3af !important;
}

.results-panel.outdated .chart-title {
    color: #9ca3af !important;
}

.results-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    text-align: center;
    color: #536471;
    padding: clamp(2.5rem, 5vw, 3.5rem) clamp(1.5rem, 3vw, 2rem);
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(29, 155, 240, 0.06) 0%, rgba(29, 155, 240, 0.02) 100%);
    border: 1px dashed rgba(29, 155, 240, 0.2);
    flex: 1;
    min-height: clamp(18rem, 36vw, 26rem); /* 与 results-container 保持一致 */
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.results-placeholder.hidden {
    display: none;
    opacity: 0;
    transform: scale(0.95);
}

/* 结果显示区域动画 */
#results {
    animation: fadeInUp 0.4s ease-out;
}

#chartSection {
    animation: fadeInUp 0.5s ease-out;
}

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

.placeholder-emoji {
    font-size: clamp(3rem, 8vw, 4rem);
    margin-bottom: 0.5rem;
}

.results-placeholder h3 {
    font-size: clamp(1.125rem, 3.5vw, 1.375rem);
    font-weight: 700;
    color: #0f1419;
    margin: 0.5rem 0;
}

.results-placeholder p {
    font-size: clamp(0.875rem, 2vw, 1rem);
    color: #536471;
    margin: 0.25rem 0 1rem;
    max-width: 32rem;
    line-height: 1.6;
}

.placeholder-tips {
    list-style: none;
    padding: 0;
    margin: 0.75rem 0 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: clamp(0.8125rem, 1.8vw, 0.9375rem);
    color: #4b6a88;
    text-align: left;
    align-self: center;
    max-width: 24rem;
}

.placeholder-tips li {
    position: relative;
    padding-left: 1.5rem;
    line-height: 1.6;
}

.placeholder-tips li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: #1d9bf0;
    font-weight: 700;
    font-size: 1.1em;
}

@media (min-width: 64rem) {
    .main-layout {
        flex-direction: row;
        justify-content: center;
        align-items: flex-start;
        gap: clamp(2rem, 3.5vw, 3rem);
    }

    .main-layout .input-panel {
        flex: 0 0 clamp(28rem, 35vw, 36rem);
        margin: 0;
        position: sticky;
        top: 1.5rem;
        max-height: calc(100vh - 150px);
        overflow-y: auto;
        overflow-x: hidden;
        scrollbar-width: thin;
        scrollbar-color: #1d9bf0 #f1f1f1;
    }

    .main-layout .input-panel::-webkit-scrollbar {
        width: 6px;
    }
    
    .main-layout .input-panel::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 10px;
    }
    
    .main-layout .input-panel::-webkit-scrollbar-thumb {
        background: #1d9bf0;
        border-radius: 10px;
    }
    
    .main-layout .input-panel::-webkit-scrollbar-thumb:hover {
        background: #1a8cd8;
    }

    .main-layout .results-panel {
        flex: 1;
        min-width: 0;
        align-self: stretch;
        max-width: none;
    }

    .main-layout .results-panel .results-container {
        height: 100%;
    }
}

@media (min-width: 80rem) {
    .container {
        padding: 3rem;
    }
}

/* 结果区域高度优化 */
.results-container {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    background-color: #ffffff;
    border: 1px solid #eff3f4;
    border-radius: 16px;
    padding: clamp(1.5rem, 2.5vw, 2rem);
    box-shadow: 0 16px 40px rgba(15, 20, 25, 0.07);
    min-height: clamp(18rem, 36vw, 26rem);
    transition: box-shadow 0.3s ease, min-height 0.3s ease; /* 添加高度过渡 */
}

/* 桌面端布局优化 */
@media (min-width: 64rem) {
    .results-container {
        max-height: none;
        overflow: visible;
    }
}

@media (min-width: 80rem) {
    .results-container {
        max-height: calc(100vh - 180px);
        overflow-y: auto;
        overflow-x: hidden;
        scrollbar-width: thin;
        scrollbar-color: #1d9bf0 #f1f1f1;
    }
    
    /* 美化滚动条 */
    .results-container::-webkit-scrollbar {
        width: 8px;
    }
    
    .results-container::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 10px;
    }
    
    .results-container::-webkit-scrollbar-thumb {
        background: #1d9bf0;
        border-radius: 10px;
    }
    
    .results-container::-webkit-scrollbar-thumb:hover {
        background: #1a8cd8;
    }
}

.header {
    text-align: left;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
}

.header h1 {
    color: #1d9bf0;
    font-size: clamp(1.5rem, 3.5vw, 2rem);
    margin-bottom: 0.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.header-description {
    color: #536471;
    font-size: clamp(0.75rem, 1.8vw, 0.875rem);
    font-weight: 400;
    margin: 0;
}

.input-section {
    margin-bottom: 1.5rem;
}

.form-grid {
    display: grid;
    gap: 1rem;
}

.form-grid .input-group {
    margin: 0;
}

@media (min-width: 48rem) {
    .form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        column-gap: clamp(1.75rem, 3.5vw, 2.25rem);
    }
}

@media (min-width: 64rem) {
    .form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        column-gap: clamp(2rem, 4vw, 2.5rem);
    }
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 700;
    color: #0f1419;
    font-size: 0.8125rem;
    letter-spacing: 0rem;
}

.input-group input[type="number"],
.input-group select {
    width: 100%;
    padding: 0.75rem 0.9rem;
    border: 1.5px solid #eff3f4;
    border-radius: 9px;
    font-size: 0.875rem;
    color: #0f1419;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
    background-color: #ffffff;
    font-weight: 500;
    min-height: 44px; /* 确保触摸目标足够大 */
}

.input-group input[type="number"]:focus,
.input-group select:focus {
    border-color: #1d9bf0;
    box-shadow: 0 0 0 4px rgba(29, 155, 240, 0.1);
    outline: none;
}

.input-helper {
    font-size: 0.6875rem;
    color: #536471;
    margin-bottom: 0.4rem;
    font-weight: 400;
    line-height: 1.4;
}

/* 输入范围提示 */
.range-hint {
    color: #1d9bf0;
    font-weight: 500;
    white-space: nowrap;
}

@media (max-width: 48rem) {
    .range-hint {
        display: block;
        margin-top: 0.15rem;
        white-space: normal;
    }
}

/* 输入错误提示样式 */
.input-error {
    font-size: var(--font-xs);
    color: #f91880;
    margin-top: 0.25rem;
    min-height: 1rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.input-group input.error {
    border-color: #f91880;
    box-shadow: 0 0 0 4px rgba(249, 24, 128, 0.1);
}

/* 全局错误消息样式 */
.error-message {
    background: linear-gradient(135deg, #fff5f8 0%, #ffe8f0 100%);
    color: #f91880;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    border: 2px solid #f91880;
    margin: 1rem 0;
    font-size: var(--font-sm);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 4px 12px rgba(249, 24, 128, 0.2);
    animation: slideDown 0.3s ease;
    transition: opacity 0.3s ease, transform 0.3s ease;
    position: relative;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.error-message svg {
    flex-shrink: 0;
}

.error-text {
    flex: 1;
}

/* 错误提示关闭按钮 */
.error-close {
    background: none;
    border: none;
    color: #f91880;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    flex-shrink: 0;
    font-weight: 700;
}

.error-close:hover {
    background-color: rgba(249, 24, 128, 0.1);
    transform: scale(1.1);
}

.error-close:active {
    transform: scale(0.95);
}

/* 过期结果提示样式 */
.outdated-notice {
    background: linear-gradient(135deg, #fff8e7 0%, #ffeed4 100%);
    color: #ad5700;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    border: 2px solid #ffd280;
    margin-bottom: 1rem;
    font-size: var(--font-sm);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.calculate-btn {
    display: block;
    width: 100%;
    padding: 0.875rem 1rem;
    background-color: #1d9bf0;
    color: white;
    border: none;
    border-radius: 42px;
    font-size: 0.9375rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 14px rgba(29, 155, 240, 0.25);
    margin-top: 1.25rem;
    letter-spacing: 0.01em;
    min-height: 48px; /* 确保按钮足够大 */
    position: relative;
    overflow: hidden;
}

.calculate-btn:hover:not(:disabled) {
    background-color: #1a8cd8;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(29, 155, 240, 0.4);
}

.calculate-btn:active:not(:disabled) {
    transform: translateY(0);
}

.calculate-btn:disabled {
    background-color: #8ecdf8;
    cursor: not-allowed;
    opacity: 0.7;
}

/* 计算中状态样式 */
.calculate-btn.calculating {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

/* 加载动画 - 旋转圆圈 */
.calculating-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

#results {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    text-align: center;
}

.main-result {
    font-size: clamp(2.5rem, 5vw, 4rem);
    color: #1d9bf0;
    font-weight: 800;
    margin-bottom: 0;
    letter-spacing: -0.03em;
    word-break: break-word;
    line-height: 1.1;
}

.main-result-label {
    font-size: clamp(0.875rem, 2vw, 1rem);
    color: #536471;
    margin-bottom: 0.5rem;
    font-weight: 600;
    text-align: right;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.85rem;
    margin-bottom: 0;
    justify-content: center;
}

/* 大屏幕固定4列 */
@media (min-width: 80rem) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* 中等屏幕调整为2列 */
@media (min-width: 64rem) and (max-width: 79.99rem) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 平板屏幕调整为2列 */
@media (min-width: 48rem) and (max-width: 63.99rem) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
}

.stat-card {
    background-color: #ffffff;
    padding: clamp(0.875rem, 2vw, 1.125rem);
    border-radius: 12px;
    border: 1px solid #edf2f7;
    box-shadow: 0 3px 14px rgba(15, 20, 25, 0.05);
    transition: all 0.2s ease;
    text-align: center;
    min-height: 85px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.stat-card:hover {
    border-color: #1d9bf0;
    box-shadow: 0 6px 20px rgba(29, 155, 240, 0.12);
    transform: translateY(-2px);
}

.stat-value {
    font-size: clamp(1.0625rem, 2.2vw, 1.25rem);
    font-weight: 700;
    color: #1d9bf0;
    margin-bottom: 0.4rem;
    word-break: break-word;
    letter-spacing: -0.01em;
}

.stat-label {
    font-size: clamp(0.75rem, 1.6vw, 0.8125rem);
    color: #536471;
    font-weight: 500;
    line-height: 1.3;
}

.warning {
    background-color: #fff8e7;
    color: #ad5700;
    padding: 1.1rem;
    border-radius: 14px;
    border: 1px solid #ffd280;
    margin-top: 0.85rem;
    font-size: var(--font-sm);
    font-weight: 500;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
}

/* 导出按钮容器 */
.export-buttons {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.export-btn {
    flex: 1;
    min-width: 140px;
    padding: 0.625rem 1rem;
    background: linear-gradient(135deg, #1d9bf0 0%, #1a8cd8 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 2px 8px rgba(29, 155, 240, 0.2);
}

.export-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(29, 155, 240, 0.3);
}

.export-btn:active:not(:disabled) {
    transform: translateY(0);
}

.export-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.export-btn.secondary {
    background: linear-gradient(135deg, #ffffff 0%, #f7f9fa 100%);
    color: #1d9bf0;
    border: 1px solid #1d9bf0;
    box-shadow: 0 2px 8px rgba(29, 155, 240, 0.1);
}

.export-btn.secondary:hover:not(:disabled) {
    background: linear-gradient(135deg, #f0f8ff 0%, #e8f4fd 100%);
    box-shadow: 0 4px 12px rgba(29, 155, 240, 0.2);
}

/* 复制成功状态 */
.export-btn.copied {
    background: linear-gradient(135deg, #0d9f6e 0%, #0c8a5e 100%) !important;
    color: white !important;
    border-color: #0d9f6e !important;
    animation: pulseGreen 0.5s ease;
}

@keyframes pulseGreen {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* 成功提示消息 */
.success-message {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #e8f8f5 0%, #d4f1e8 100%);
    color: #0d9f6e;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    border: 2px solid #0d9f6e;
    font-size: var(--font-sm);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 4px 16px rgba(13, 159, 110, 0.2);
    animation: slideInRight 0.3s ease;
    transition: opacity 0.3s ease;
    z-index: 10001;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* 导出容器样式 */
.export-container {
    position: fixed;
    left: -9999px;
    top: 0;
    width: 900px;
    background: #ffffff;
    z-index: -1;
}

.export-content {
    padding: 3rem;
    background: linear-gradient(135deg, #f8fbff 0%, #ffffff 100%);
    border: 3px solid #1d9bf0;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(29, 155, 240, 0.15);
}

.export-header {
    text-align: center;
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 3px solid #1d9bf0;
}

.export-header h1 {
    font-size: 2.5rem;
    color: #1d9bf0;
    margin: 0 0 0.5rem 0;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.export-subtitle {
    font-size: 1.125rem;
    color: #536471;
    font-weight: 500;
}

.export-main-result {
    text-align: center;
    margin: 2rem 0;
    padding: 2rem;
    background: linear-gradient(135deg, rgba(29, 155, 240, 0.08) 0%, rgba(29, 155, 240, 0.03) 100%);
    border-radius: 16px;
    border: 2px solid rgba(29, 155, 240, 0.2);
}

.export-main-label {
    font-size: 1.125rem;
    color: #536471;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.export-main-value {
    font-size: 3.5rem;
    color: #1d9bf0;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.export-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin: 2rem 0;
}

.export-stat-item {
    background: #ffffff;
    padding: 1.5rem;
    border-radius: 12px;
    border: 2px solid #eff3f4;
    text-align: center;
    box-shadow: 0 4px 12px rgba(15, 20, 25, 0.05);
}

.export-stat-label {
    font-size: 0.9375rem;
    color: #536471;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.export-stat-value {
    font-size: 1.75rem;
    color: #0f1419;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.export-stat-value.profit {
    color: #0d9f6e;
}

.export-stat-value.rate {
    color: #1d9bf0;
}

.export-chart {
    margin: 2.5rem 0;
    padding: 2rem;
    background: #ffffff;
    border-radius: 16px;
    border: 2px solid #eff3f4;
    box-shadow: 0 4px 16px rgba(15, 20, 25, 0.06);
}

.export-chart h3 {
    font-size: 1.5rem;
    color: #0f1419;
    margin: 0 0 1.5rem 0;
    text-align: center;
    font-weight: 700;
}

.export-chart img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
}

.export-params {
    margin: 2rem 0;
    padding: 1.5rem;
    background: rgba(83, 100, 113, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(83, 100, 113, 0.1);
}

.export-param-title {
    font-size: 1.125rem;
    color: #0f1419;
    font-weight: 700;
    margin-bottom: 1rem;
    text-align: center;
}

.export-param-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.export-param-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: #ffffff;
    border-radius: 8px;
    border: 1px solid #eff3f4;
}

.param-label {
    font-size: 0.9375rem;
    color: #536471;
    font-weight: 600;
}

.param-value {
    font-size: 0.9375rem;
    color: #0f1419;
    font-weight: 700;
}

.export-footer {
    margin-top: 1.5rem;
    padding-top: 1rem;
}

.export-footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

.export-footer-left {
    flex: 1;
}

.export-time {
    font-size: 0.875rem;
    color: #536471;
    margin-bottom: 0.5rem;
}

.export-watermark {
    font-size: 0.8125rem;
    color: #9ca3af;
    font-weight: 500;
}

.export-footer-right {
    flex-shrink: 0;
}

.export-qrcode {
    text-align: center;
    padding: 0.75rem;
    background: #ffffff;
    border-radius: 12px;
    border: 2px solid #1d9bf0;
    box-shadow: 0 4px 12px rgba(29, 155, 240, 0.15);
}

.export-qrcode img {
    width: 120px;
    height: 120px;
    display: block;
    border-radius: 8px;
    background: white;
}

.qrcode-text {
    margin-top: 0.5rem;
    font-size: 0.8125rem;
    color: #1d9bf0;
    font-weight: 700;
    letter-spacing: 0.5px;
}

@media (max-width: 48rem) {
    .export-buttons {
        flex-direction: column;
    }
    
    .export-btn {
        flex: 1 1 100%;
    }
    
    .success-message {
        top: 10px;
        right: 10px;
        left: 10px;
        padding: 0.875rem 1rem;
    }
}

#chartSection {
    margin-top: 0;
    padding-top: 0;
}

.chart-section {
    background-color: #ffffff;
    padding: 0.5rem 1.5rem 1rem;
    border-radius: 16px;
    border: 1px solid #eff3f4;
    box-shadow: 0 4px 16px rgba(15, 20, 25, 0.05);
}

.chart-title {
    font-size: clamp(1.1875rem, 3vw, 1.5rem);
    color: #1d9bf0;
    margin-bottom: 0.5rem;
    text-align: center;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.chart-container {
    position: relative;
    height: clamp(16rem, 28vw, 22rem);
    width: 100%;
}

#growthChart {
    max-width: 100%;
    height: auto;
}

/* 平板设备优化 */
@media (min-width: 48rem) and (max-width: 63.99rem) {
    .container {
        padding: 2rem 1.5rem;
    }
    
    .chart-container {
        height: clamp(18rem, 32vw, 24rem);
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .input-panel {
        max-width: 100%;
    }
    
    .form-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    .stat-value {
        font-size: 1.125rem;
    }
    
    .main-result {
        font-size: 2.5rem;
    }
    
    .header h1 {
        font-size: 2rem;
    }
}

@media (max-width: 63.99rem) {
    .main-layout {
        flex-direction: column;
        gap: 2rem;
    }
}

/* 桌面端布局优化 */
@media (min-width: 80rem) {
    #results {
        margin-top: 0;
        padding-top: 0;
        border-top: none;
    }
    
    #chartSection {
        margin-top: 0rem;
    }
}

/* 小屏幕优化 */
@media (max-width: 48rem) {
    body {
        padding-bottom: 150px; /* 移动端页脚可能更高 */
    }

    .container {
        padding: 1.5rem 1rem;
        padding-bottom: 2rem;
        border-radius: 0;
    }
    
    .header {
        text-align: center;
        margin-bottom: 1.25rem;
    }

    .main-layout {
        gap: 1.5rem;
    }

    .form-grid {
        gap: 1rem;
    }

    .header h1 {
        font-size: var(--font-3xl);
    }

    .header-description {
        font-size: var(--font-base);
    }

    .input-group {
        margin-bottom: 1rem;
    }

    .input-group input[type="number"],
    .input-group select {
        padding: 0.75rem 0.85rem;
        font-size: var(--font-base);
    }

    .calculate-btn {
        font-size: var(--font-base);
        padding: 1rem;
    }

    .main-result {
        font-size: clamp(2rem, 8vw, 2.75rem);
    }

    .main-result-label {
        font-size: var(--font-base);
    }

    .chart-title {
        font-size: var(--font-xl);
    }

    .chart-container {
        height: 16rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .stat-card {
        padding: 1rem 0.75rem;
    }

    .stat-value {
        font-size: clamp(1rem, 3.5vw, 1.125rem);
    }
    
    .stat-label {
        font-size: var(--font-xs);
    }
    
    .results-container {
        padding: 1.25rem;
        min-height: auto;
    }
}

/* 超小屏幕 */
@media (max-width: 30rem) {
    body {
        padding-bottom: 170px;
    }
    
    .container {
        padding: 1rem 0.75rem;
        padding-bottom: 1.5rem;
    }

    .header h1 {
        font-size: clamp(1.5rem, 6vw, 1.75rem);
    }
    
    .header-description {
        font-size: var(--font-sm);
    }

    .chart-container {
        height: 14rem;
    }

    .input-section {
        margin-bottom: 1.5rem;
    }
    
    .main-result {
        font-size: clamp(1.75rem, 7vw, 2.25rem);
    }
    
    .stat-value {
        font-size: clamp(0.9375rem, 3.2vw, 1rem);
    }
    
    .results-container {
        padding: 1rem;
    }
    
    .input-group input[type="number"],
    .input-group select {
        padding: 0.7rem;
        font-size: 0.9375rem;
    }
    
    .mode-btn {
        min-height: 85px;
        padding: 0.65rem 0.25rem;
    }
    
    .mode-icon {
        font-size: 1.35rem;
    }
    
    .mode-label {
        font-size: 0.8125rem;
    }
    
    .mode-desc {
        font-size: 0.625rem;
    }
    
    .stat-card {
        padding: 0.875rem 0.625rem;
        min-height: 75px;
    }
}

/* 计算模式选择器样式 */
.calculation-mode {
    margin-bottom: 1.5rem;
    padding: 1.125rem;
    border-radius: 12px;
    border: 1px solid rgba(29, 155, 240, 0.12);
    background: linear-gradient(135deg, rgba(29, 155, 240, 0.05) 0%, rgba(29, 155, 240, 0.02) 100%);
    box-shadow: 0 4px 16px rgba(15, 20, 25, 0.04);
}

.mode-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    margin-bottom: 0.75rem;
}

.mode-title {
    font-size: 0.9375rem;
    font-weight: 700;
    color: #0f1419;
    text-align: left;
    letter-spacing: -0.01em;
}

.mode-subtitle {
    font-size: 0.6875rem;
    color: #536471;
    font-weight: 400;
    opacity: 0.8;
}

.mode-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    justify-content: center;
    justify-items: stretch;
    width: 100%;
}

@media (max-width: 64rem) {
    .mode-buttons {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 48rem) {
    .mode-header {
        align-items: center;
        text-align: center;
        gap: 0.35rem;
    }

    .mode-buttons {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
    }
}

.mode-btn {
    background-color: #ffffff;
    border: 1px solid #eff3f4;
    border-radius: 11px;
    padding: 1rem 0.5rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    font-family: inherit;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0.35rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(15, 20, 25, 0.04);
    /* 增大触摸目标 */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
}

.mode-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(29, 155, 240, 0.1),
        transparent
    );
    transition: left 0.5s ease;
}

.mode-btn:hover::before {
    left: 100%;
}

.mode-btn:hover {
    border-color: #1d9bf0;
    box-shadow: 
        0 10px 24px rgba(29, 155, 240, 0.18),
        0 3px 12px rgba(15, 20, 25, 0.08);
    transform: translateY(-3px) scale(1.015);
    background-color: #f7fbff;
}

.mode-btn.active {
    background: linear-gradient(135deg, #1d9bf0 0%, #1a8cd8 100%);
    border-color: #1d9bf0;
    color: white;
    box-shadow: 
        0 12px 28px rgba(29, 155, 240, 0.35),
        0 4px 14px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* 添加按钮内容的动态效果 */
.mode-btn h3 {
    font-size: clamp(0.95rem, 2vw, 1.05rem);
    font-weight: 600;
    margin: 0;
    transition: all 0.3s ease;
}

.mode-btn:hover h3 {
    font-weight: 700;
    transform: scale(1.05);
}

.mode-btn.active h3 {
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* 添加微妙的脉冲效果给激活状态 */
.mode-btn.active {
    animation: subtle-pulse 3s ease-in-out infinite;
}

@keyframes subtle-pulse {
    0%, 100% {
        box-shadow: 
            0 12px 30px rgba(29, 155, 240, 0.4),
            0 4px 15px rgba(0, 0, 0, 0.1),
            inset 0 1px 0 rgba(255, 255, 255, 0.2);
    }
    50% {
        box-shadow: 
            0 15px 35px rgba(29, 155, 240, 0.5),
            0 5px 18px rgba(0, 0, 0, 0.12),
            inset 0 1px 0 rgba(255, 255, 255, 0.3);
    }
}

/* 优化悬停时的光泽效果 */
.mode-btn:hover {
    background: linear-gradient(135deg, #fafbff 0%, #f0f8ff 100%);
}

.mode-btn.active:hover {
    background: linear-gradient(135deg, #1d9bf0 0%, #1a8cd8 100%);
    animation: none; /* 悬停时暂停脉冲 */
    box-shadow: 
        0 15px 40px rgba(29, 155, 240, 0.6),
        0 5px 20px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.mode-btn.active::before {
    display: none;
}

.mode-btn:active {
    transform: translateY(-1px) scale(0.98);
    transition: all 0.1s ease;
}

.mode-icon {
    font-size: 1.5rem;
    margin-bottom: 0.2rem;
}

.mode-label {
    font-size: 0.9375rem;
    font-weight: 700;
    margin-bottom: 0.15rem;
    letter-spacing: -0.01em;
}

.mode-desc {
    font-size: 0.6875rem;
    opacity: 0.7;
    font-weight: 400;
    transition: all 0.3s ease;
    color: #657786;
    line-height: 1.3;
}

.mode-btn.active .mode-desc {
    opacity: 0.9;
    color: rgba(255, 255, 255, 0.9);
}

.mode-btn:hover .mode-desc {
    opacity: 0.9;
    color: #536471;
}

@media (max-width: 48rem) {
    .mode-btn {
        min-height: 95px; /* 增大移动端触摸区域 */
        padding: 0.85rem 0.5rem;
        flex-direction: column;
        justify-content: center;
        text-align: center;
        gap: 0.3rem;
    }
    
    .mode-btn:hover {
        transform: translateY(-2px);
        box-shadow: 
            0 6px 20px rgba(29, 155, 240, 0.12),
            0 2px 8px rgba(0, 0, 0, 0.06);
    }
    
    .mode-btn.active {
        transform: translateY(-1px);
        box-shadow: 
            0 8px 25px rgba(29, 155, 240, 0.35),
            0 3px 12px rgba(0, 0, 0, 0.08),
            inset 0 1px 0 rgba(255, 255, 255, 0.2);
    }
    
    .mode-icon {
        font-size: 1.6rem; /* 增大图标 */
        margin-bottom: 0;
        flex-shrink: 0;
        transition: transform 0.3s ease;
    }
    
    .mode-btn:hover .mode-icon {
        transform: scale(1.08);
    }
    
    .mode-content {
        display: flex;
        flex-direction: column;
        align-items: center;
        width: 100%;
    }
    
    .mode-label {
        margin-bottom: 0.1rem;
        font-size: 0.9375rem; /* 增大字号 */
        white-space: nowrap;
    }
    
    .mode-desc {
        font-size: 0.75rem; /* 增大描述文字 */
        line-height: 1.3;
    }
}

.main-result-container {
    display: flex;
    align-items: baseline;
    justify-content: flex-end;
    gap: 1.25rem;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #eff3f4;
}

@media (max-width: 48rem) {
    .main-result-container {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
    }
    
    .main-result-label {
        text-align: center;
    }
}

/* 性能优化：减少不必要的重绘 */
.mode-btn {
    will-change: transform, box-shadow;
    backface-visibility: hidden;
    perspective: 1000px;
}

/* 为支持减少动画的用户优化 */
@media (prefers-reduced-motion: reduce) {
    .mode-btn,
    .mode-btn::before,
    .mode-desc,
    .mode-btn h3,
    .mode-icon {
        animation: none !important;
        transition: none !important;
    }
    
    .mode-btn:hover,
    .mode-btn.active {
        transform: none !important;
    }
}

/* 为焦点状态添加无障碍支持 */
.mode-btn:focus-visible {
    outline: 3px solid #1d9bf0;
    outline-offset: 2px;
    box-shadow: 
        0 0 0 3px rgba(29, 155, 240, 0.3),
        0 8px 25px rgba(29, 155, 240, 0.15),
        0 3px 12px rgba(0, 0, 0, 0.08);
}

.mode-btn.active:focus-visible {
    outline-color: #ffffff;
    box-shadow: 
        0 0 0 3px rgba(255, 255, 255, 0.8),
        0 12px 30px rgba(29, 155, 240, 0.4),
        0 4px 15px rgba(0, 0, 0, 0.1);
}

/* 打印样式优化 */
@media print {
    body {
        padding-bottom: 0;
    }
    
    .tool-footer,
    .calculate-btn,
    .mode-buttons {
        display: none !important;
    }
    
    .container {
        box-shadow: none;
        border-radius: 0;
        padding: 1rem;
    }
    
    .main-layout {
        flex-direction: column !important;
    }
    
    .input-panel,
    .results-panel {
        position: static !important;
        max-height: none !important;
        overflow: visible !important;
    }
    
    .chart-container {
        height: 400px !important;
        page-break-inside: avoid;
    }
    
    .stat-card {
        page-break-inside: avoid;
    }
}

/* 暗黑模式支持（可选） */
@media (prefers-color-scheme: dark) {
    /* 暂时不启用，保持浅色主题 */
}

/* 移动端图片预览窗口样式 */
.image-preview-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-preview-overlay.show {
    opacity: 1;
}

.image-preview-container {
    background: white;
    border-radius: 16px;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.image-preview-overlay.show .image-preview-container {
    transform: scale(1);
}

.image-preview-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #eff3f4;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #1d9bf0 0%, #1a8cd8 100%);
}

.image-preview-header h3 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 700;
    color: white;
}

.preview-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 1.5rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-weight: 700;
    line-height: 1;
}

.preview-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.preview-close-btn:active {
    transform: scale(0.95);
}

.image-preview-content {
    padding: 1.5rem;
    overflow: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.image-preview-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.preview-hint {
    text-align: center;
    color: #536471;
    font-size: 0.875rem;
    margin: 0;
    padding: 0.75rem 1rem;
    background: #f7f9fa;
    border-radius: 8px;
    border: 1px dashed #1d9bf0;
}

@media (max-width: 48rem) {
    .image-preview-container {
        max-width: 95vw;
        max-height: 95vh;
    }
    
    .image-preview-header {
        padding: 0.875rem 1rem;
    }
    
    .image-preview-header h3 {
        font-size: 1rem;
    }
    
    .image-preview-content {
        padding: 1rem;
    }
    
    .preview-hint {
        font-size: 0.8125rem;
    }
}