/* 基礎樣式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    min-height: 100vh;
    color: #fff;
    padding: 20px;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 10px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 20px;
    position: relative;
}

header h1 {
    font-size: 2.5rem;
    background: linear-gradient(90deg, #00d4ff, #7b2cbf, #ff6b6b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
}

.subtitle {
    color: #a0a0a0;
    font-size: 1rem;
}

.subtitle-hint {
    color: #00d4ff;
    font-size: 0.85rem;
    margin-top: 5px;
    font-style: italic;
}

/* 语言切换按钮 */
.lang-switch {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    gap: 5px;
}

.lang-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.lang-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* 控制面板 */
.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    font-size: 0.9rem;
    color: #ccc;
}

.filter-group select {
    padding: 8px 12px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    cursor: pointer;
    font-size: 0.9rem;
}

.filter-group select option {
    background: #1a1a2e;
    color: #fff;
}

/* 按鈕 */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.btn-reset {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.btn.active {
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.6);
}

/* 图例 */
.legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
    padding: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: #ccc;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
}

/* 元素类别颜色 */
.alkali-metal {
    background: #ff6b6b;
}

.alkaline-earth {
    background: #feca57;
}

.transition-metal {
    background: #48dbfb;
}

.post-transition {
    background: #1dd1a1;
}

.metalloid {
    background: #5f27cd;
}

.nonmetal {
    background: #ff9ff3;
}

.halogen {
    background: #54a0ff;
}

.noble-gas {
    background: #c8d6e5;
}

.lanthanide {
    background: #ff9f43;
}

.actinide {
    background: #ee5a24;
}

/* 对比面板 */
.compare-panel {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    padding: 20px;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.5);
    z-index: 100;
}

.compare-panel.show {
    display: block;
}

.compare-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.compare-header .close-btn {
    position: static;
    font-size: 1.5rem;
}

.compare-hint {
    color: #888;
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.compare-elements {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.compare-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 20px;
    min-width: 250px;
    text-align: center;
}

.compare-card .symbol {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 10px;
}

.compare-card .name {
    font-size: 1.2rem;
    margin-bottom: 15px;
}

.compare-card .props {
    text-align: left;
}

.compare-card .prop {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.compare-card .prop-label {
    color: #888;
}

.compare-atom {
    width: 80px;
    height: 80px;
    margin: 0 auto 10px;
}

/* 时间线面板 */
.timeline-panel {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    width: 400px;
    height: 100%;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    padding: 20px;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
    z-index: 100;
    overflow-y: auto;
}

.timeline-panel.show {
    display: block;
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.timeline-header .close-btn {
    position: static;
    font-size: 1.5rem;
}

.timeline-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.timeline-era-btn {
    padding: 8px 15px;
    border: none;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s;
}

.timeline-era-btn:hover,
.timeline-era-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.timeline-content {
    position: relative;
    padding-left: 30px;
}

.timeline-content::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, #667eea, #764ba2);
}

.timeline-item {
    position: relative;
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
}

.timeline-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(5px);
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -24px;
    top: 20px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #667eea;
    border: 2px solid #1a1a2e;
}

.timeline-year {
    font-size: 0.85rem;
    color: #667eea;
    margin-bottom: 5px;
}

.timeline-element {
    display: flex;
    align-items: center;
    gap: 10px;
}

.timeline-symbol {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    color: #fff;
}

.timeline-name {
    font-size: 1rem;
}

.timeline-discoverer {
    font-size: 0.8rem;
    color: #888;
    margin-top: 5px;
}

/* Footer */
.site-footer {
    text-align: center;
    font-size: 1.15rem;
    padding: 18px 0;
    margin-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 -12px 30px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.site-footer .footer-text {
    background: linear-gradient(90deg, #00d4ff, #7b2cbf, #ff6b6b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 600;
    text-shadow: 0 2px 8px rgba(123, 44, 191, 0.35);
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}