:root { 
    --red: #ef4444; 
    --green: #22c55e; 
    --bg: #000; 
    --blue: #3b82f6;
    --blue-hover: #2563eb;
    --zinc-800: #27272a;
    --zinc-900: #18181b;
    --zinc-500: #71717a;
}

* { box-sizing: border-box; }

body { 
    background-color: var(--bg); 
    color: #fff; 
    font-family: -apple-system, system-ui, sans-serif; 
    margin: 0; 
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.glass { 
    background: rgba(18, 18, 18, 0.8); 
    backdrop-filter: blur(20px); 
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08); 
}

/* 欢迎页本地化替代 */
.welcome-screen {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #000;
    transition: opacity 0.5s ease;
}
.welcome-box { text-align: center; padding: 2rem; max-width: 24rem; width: 100%; }
.icon-wrapper {
    display: inline-flex;
    padding: 1.5rem;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 1.5rem;
}
.arrow-svg { width: 2.5rem; height: 2.5rem; color: var(--blue); }
.welcome-title { font-size: 1.5rem; font-weight: 900; font-style: italic; margin-bottom: 0.5rem; letter-spacing: -0.05em; text-transform: uppercase; }
.welcome-subtitle { color: var(--zinc-500); font-size: 15px; margin-bottom: 2rem; letter-spacing: 0.3em; text-transform: uppercase; }
.load-btn {
    display: block; width: 100%; background-color: var(--blue); padding: 1rem 0; border-radius: 1rem; font-weight: bold; cursor: pointer; text-align: center; box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3); transition: all 0.2s;
}
.load-btn:hover { background-color: var(--blue-hover); }
.load-btn:active { transform: scale(0.95); }
.hidden-input { display: none; }

/* 主应用容器 */
.app-container { width: 100%; flex: 1 1 0%; display: flex; flex-direction: column; opacity: 0; transition: opacity 0.7s ease; padding-bottom: env(safe-area-inset-bottom); }
.hidden { display: none !important; }

/* 头部布局 - 响应式栅格 */
.main-header { padding: 0.75rem; display: grid; grid-template-columns: 1fr; gap: 0.5rem; }
@media (min-width: 768px) {
    .main-header { padding: 1.5rem; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
    .col-span-2 { grid-column: span 2 / span 2; }
    .mode-buttons-row { grid-column: span 4 / span 4; }
}

.header-card { padding: 0.5rem; border-radius: 0.75rem; display: flex; flex-direction: column; justify-content: center; min-height: 70px;}
@media (min-width: 768px) { .header-card { padding: 0.75rem; border-radius: 1rem; } }
.border-highlight { border-color: rgba(59, 130, 246, 0.2); }

.card-content { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.card-label { font-size: 12px; font-weight: 900; color: var(--blue); text-transform: uppercase; letter-spacing: 0.1em; }
@media (min-width: 768px) { .card-label { font-size: 15px; } }

.card-value-date { font-size: 1rem; font-family: monospace; font-weight: 900; margin-top: 2px;}
@media (min-width: 768px) { .card-value-date { font-size: 1.125rem; } }

.worth-group { display: flex; flex-direction: row; align-items: center; gap: 0.5rem; margin-top: 2px;}
@media (min-width: 768px) { .worth-group { flex-direction: column; gap: 0; } }

.card-value-worth { font-size: 1.25rem; font-family: monospace; font-weight: 900; letter-spacing: -0.05em; }
@media (min-width: 768px) { .card-value-worth { font-size: 1.875rem; } }

.card-value-diff { font-size: 0.875rem; font-family: monospace; font-weight: bold; opacity: 0.8; }
@media (min-width: 768px) { .card-value-diff { font-size: 1.25rem; } }

.import-label { width: 100%; height: 100%; display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 0.5rem; cursor: pointer; transition: background-color 0.2s; border-radius: 0.75rem; }
@media (min-width: 768px) { .import-label { flex-direction: column; gap: 0.25rem; } }
.import-label:hover { background-color: rgba(255, 255, 255, 0.05); }
.upload-svg { width: 1rem; height: 1rem; color: var(--blue); }
@media (min-width: 768px) { .upload-svg { width: 1.5rem; height: 1.5rem; } }

/* 维度切换按钮 */
.mode-buttons-row { display: flex; justify-content: center; gap: 0.5rem; padding: 0.5rem 0; }
.dimension-btn { padding: 0.375rem 1rem; font-size: 0.75rem; border-radius: 0.75rem; font-weight: bold; border: none; color: #fff; cursor: pointer; transition: all 0.2s; }
.btn-active { background-color: var(--blue); }
.btn-inactive { background-color: rgba(255, 255, 255, 0.1); }
.btn-inactive:hover { background-color: rgba(255, 255, 255, 0.2); }

/* 画布主结构 */
#canvasContainer { position: relative; width: 100%; height: 40vh; min-height: 260px; margin: 10px 0; }
canvas { display: block; touch-action: none; width: 100%; height: 100%; }

.absolute { position: absolute; }
.pointer-events-none { pointer-events: none; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.rounded-lg { border-radius: 0.5rem; }
.text-\[10px\] { font-size: 10px; }
.font-mono { font-family: monospace; }
.z-30 { z-index: 30; }

/* 底部区域 */
.main-footer { padding: 1rem; background-color: rgba(24, 24, 27, 0.9); border-top: 1px solid rgba(255, 255, 255, 0.05); margin-top: auto; }
@media (min-width: 768px) { .main-footer { padding: 1.5rem; } }
.footer-inner { max-width: 72rem; margin: 0 auto; display: flex; flex-direction: column; gap: 1rem; }

.range-controls { display: flex; flex-direction: column; gap: 0.5rem; }
.date-inputs-wrapper { display: flex; flex-direction: column; }
.date-inputs { display: flex; flex-direction: row; justify-content: center; align-items: center; padding: 0 0.25rem; gap: 0.5rem; }
.date-picker { background-color: #1f2937; color: #fff; border: 1px solid rgba(55, 65, 81, 0.8); border-radius: 0.5rem; padding: 0.25rem 0.625rem; font-size: 11px; outline: none; width: 100%; text-align: center; }
@media (min-width: 640px) { .date-picker { width: auto; } }
.date-picker:focus { border-color: var(--blue); }
.to-text { color: var(--zinc-500); font-size: 10px; flex-shrink: 0; }

/* 双滑块组件样式 */
.range-slider { position: relative; height: 8px; background: rgba(255,255,255,0.1); border-radius: 4px; margin: 24px 0 12px 0; }
.range-slider .progress { position: absolute; height: 100%; background: var(--blue); border-radius: 4px; }
.range-input { position: relative; z-index: 10; }
.range-input input { position: absolute; top: -16px; width: 100%; height: 40px; background: none; pointer-events: none; -webkit-appearance: none; outline: none; margin: 0;}

/* 自定义大头针滑块 */
input[type="range"]::-webkit-slider-thumb { 
    height: 32px; width: 24px; 
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 32' width='24' height='32'%3E%3Cfilter id='sh' x='-30%25' y='-30%25' width='160%25' height='160%25'%3E%3CfeDropShadow dx='0' dy='1.5' stdDeviation='1.2' flood-color='%23000000' flood-opacity='0.5' /%3E%3C/filter%3E%3Cpath d='M 12 28 C 17 20, 22 15, 22 10 A 10 10 0 1 0 2 10 C 2 15, 7 20, 12 28 Z' fill='%233b82f6' stroke='%23000000' stroke-width='1.8' stroke-linejoin='round' filter='url(%23sh)' /%3E%3Ccircle cx='12' cy='10' r='2.5' fill='%23000000' /%3E%3C/svg%3E") no-repeat center;
    pointer-events: auto; -webkit-appearance: none; cursor: pointer; border: none; transform: translateY(-20px); transition: transform 0.1s cubic-bezier(0.25, 0.8, 0.25, 1);
}
input[type="range"]::-moz-range-thumb { 
    height: 32px; width: 24px; 
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 32' width='24' height='32'%3E%3Cfilter id='sh' x='-30%25' y='-30%25' width='160%25' height='160%25'%3E%3CfeDropShadow dx='0' dy='1.5' stdDeviation='1.2' flood-color='%23000000' flood-opacity='0.5' /%3E%3C/filter%3E%3Cpath d='M 12 28 C 17 20, 22 15, 22 10 A 10 10 0 1 0 2 10 C 2 15, 7 20, 12 28 Z' fill='%233b82f6' stroke='%23000000' stroke-width='1.8' stroke-linejoin='round' filter='url(%23sh)' /%3E%3Ccircle cx='12' cy='10' r='2.5' fill='%23000000' /%3E%3C/svg%3E") no-repeat center;
    pointer-events: auto; cursor: pointer; border: none; transform: translateY(-20px); transition: transform 0.1s cubic-bezier(0.25, 0.8, 0.25, 1);
}
input[type="range"]:active::-webkit-slider-thumb { transform: translateY(-23px) scale(1.12); }
input[type="range"]:active::-moz-range-thumb { transform: translateY(-23px) scale(1.12); }

/* 播放控制器 */
.playback-controls { display: flex; align-items: center; gap: 1rem; padding: 0.25rem 0; }
.play-btn { width: 2.5rem; height: 2.5rem; background-color: #fff; color: #000; border-radius: 50%; border: none; display: flex; align-items: center; justify-content: center; box-shadow: 0 10px 15px -3px rgba(0,0,0,0.3); cursor: pointer; transition: all 0.2s; flex-shrink: 0; z-index: 20; }
@media (min-width: 768px) { .play-btn { width: 3rem; height: 3rem; } }
.play-btn:active { transform: scale(0.9); }
.play-icon-svg { width: 1rem; height: 1rem; margin-left: 2px; }
@media (min-width: 768px) { .play-icon-svg { width: 1.25rem; height: 1.25rem; } }

.timeline-wrapper { flex: 1 1 0%; display: flex; flex-direction: column; gap: 0.25rem; }
.timeline-slider { -webkit-appearance: none; appearance: none; width: 100%; height: 40px; background: transparent; outline: none; touch-action: none; margin-top: 10px; margin-bottom: 4px; }
.timeline-slider::-webkit-slider-runnable-track { width: 100%; height: 6px; background: rgba(255, 255, 255, 0.1); border-radius: 3px; }
.timeline-slider::-moz-range-track { width: 100%; height: 6px; background: rgba(255, 255, 255, 0.1); border-radius: 3px; }

.timeline-slider::-webkit-slider-thumb { 
    -webkit-appearance: none; appearance: none; height: 32px; width: 24px; 
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 32' width='24' height='32'%3E%3Cfilter id='sh' x='-30%25' y='-30%25' width='160%25' height='160%25'%3E%3CfeDropShadow dx='0' dy='1.5' stdDeviation='1.2' flood-color='%23000000' flood-opacity='0.5' /%3E%3C/filter%3E%3Cpath d='M 12 28 C 17 20, 22 15, 22 10 A 10 10 0 1 0 2 10 C 2 15, 7 20, 12 28 Z' fill='%233b82f6' stroke='%23000000' stroke-width='1.8' stroke-linejoin='round' filter='url(%23sh)' /%3E%3Ccircle cx='12' cy='10' r='2.5' fill='%23000000' /%3E%3C/svg%3E") no-repeat center;
    cursor: pointer; border: none; transform: translateY(-19px); transition: transform 0.1s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.timeline-slider::-moz-range-thumb { 
    height: 32px; width: 24px; 
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 32' width='24' height='32'%3E%3Cfilter id='sh' x='-30%25' y='-30%25' width='160%25' height='160%25'%3E%3CfeDropShadow dx='0' dy='1.5' stdDeviation='1.2' flood-color='%23000000' flood-opacity='0.5' /%3E%3C/filter%3E%3Cpath d='M 12 28 C 17 20, 22 15, 22 10 A 10 10 0 1 0 2 10 C 2 15, 7 20, 12 28 Z' fill='%233b82f6' stroke='%23000000' stroke-width='1.8' stroke-linejoin='round' filter='url(%23sh)' /%3E%3Ccircle cx='12' cy='10' r='2.5' fill='%23000000' /%3E%3C/svg%3E") no-repeat center;
    cursor: pointer; border: none; transform: translateY(-19px); transition: transform 0.1s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.timeline-slider:active::-webkit-slider-thumb { transform: translateY(-22px) scale(1.12); }
.timeline-slider:active::-moz-range-thumb { transform: translateY(-22px) scale(1.12); }

.timeline-labels { display: flex; justify-content: space-between; font-size: 11px; font-weight: bold; color: var(--zinc-500); font-family: monospace; }
@media (min-width: 768px) { .timeline-labels { font-size: 12px; } }

/* 版权行 */
.copyright-row { padding-top: 1rem; border-top: 1px solid rgba(255, 255, 255, 0.05); display: flex; flex-direction: column; align-items: center; gap: 0.5rem; text-align: center; padding-bottom: 0.5rem; }
.copyright-text { color: rgba(255,255,255,0.5); font-size: 10px; letter-spacing: 0.1em; font-weight: 500; text-transform: uppercase; }

input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(1); cursor: pointer; }