:root {
    /* Reddit 配色方案 */
    --reddit-orange: #FF4500;
    --white: #FFFFFF;
    --bg-gray: #DAE0E6;
    --text-black: #1A1A1B;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-gray);
    color: var(--text-black);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 头部样式 */
.header {
    background-color: var(--white);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header h1 {
    color: var(--reddit-orange);
    margin-bottom: 16px;
}

/* 内容区域样式 */
section {
    background-color: var(--white);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

section h2 {
    color: var(--text-black);
    margin-bottom: 16px;
}

/* 统计卡片网格 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

section {
    animation: fadeIn 0.5s ease-out;
}

/* 用户信息样式 */
.user-info {
    padding: 20px;
    border-radius: 8px;
    background-color: var(--white);
}

.karma-stats {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.karma-total {
    text-align: center;
}

.karma-total h3 {
    color: var(--reddit-orange);
    margin-bottom: 8px;
}

.karma-total p {
    font-size: 2em;
    font-weight: bold;
}

.karma-breakdown {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.karma-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    background-color: var(--bg-gray);
    border-radius: 4px;
}

/* 加载动画 */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: var(--white);
    z-index: 1000;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid var(--white);
    border-top-color: var(--reddit-orange);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* 错误消息 */
.error-message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 20px;
    background-color: #ff4444;
    color: var(--white);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 1000;
}

.error-message button {
    margin-top: 10px;
    padding: 5px 10px;
    background-color: var(--white);
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.error-message button:hover {
    background-color: #eee;
}

/* 图表容器样式 */
.subreddits-chart,
.activity-chart {
    width: 100% !important;
    height: 400px !important;
    margin-bottom: 20px;
}

.keywords-cloud {
    width: 100%;
    height: 400px;
    position: relative;
}

.keywords-cloud svg {
    display: block;
    margin: 0 auto;
}

/* 图表响应式设计 */
@media (max-width: 768px) {
    .subreddits-chart,
    .activity-chart,
    .keywords-cloud {
        height: 300px;
    }
}

/* 搜索框样式 */
.search-container {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    padding: 20px;
    background-color: var(--white);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#username-input {
    flex: 1;
    padding: 10px;
    border: 2px solid var(--bg-gray);
    border-radius: 4px;
    font-size: 16px;
    transition: border-color 0.3s;
}

#username-input:focus {
    outline: none;
    border-color: var(--reddit-orange);
}

#search-btn {
    padding: 10px 20px;
    background-color: var(--reddit-orange);
    color: var(--white);
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#search-btn:hover {
    background-color: #ff5414;
}

#search-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* 统计卡片样式 */
.stat-card {
    background-color: var(--white);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 15px;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-icon {
    font-size: 2em;
    color: var(--reddit-orange);
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(255, 69, 0, 0.1);
    border-radius: 50%;
}

.stat-content {
    flex: 1;
}

.stat-content h3 {
    color: var(--text-black);
    font-size: 1em;
    margin-bottom: 8px;
}

.stat-number {
    font-size: 1.8em;
    font-weight: bold;
    color: var(--reddit-orange);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.9em;
    color: #666;
}

.stat-text {
    font-size: 1.2em;
    font-weight: 500;
    color: var(--reddit-orange);
}

/* 分享部分样式 */
.share-section {
    margin-top: 2rem;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 1rem;
    text-align: center;
}

.share-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.share-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 2rem;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    color: #fff;
}

.share-btn img {
    width: 20px;
    height: 20px;
}

.share-btn.twitter {
    background-color: #1DA1F2;
}

.share-btn.facebook {
    background-color: #4267B2;
}

.share-btn.copy-link {
    background-color: #6e5494;
}

.share-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

/* 添加复制成功的提示样式 */
.copy-success {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 1rem 2rem;
    border-radius: 2rem;
    animation: fadeInOut 2s ease-in-out;
}

@keyframes fadeInOut {
    0% { opacity: 0; }
    20% { opacity: 1; }
    80% { opacity: 1; }
    100% { opacity: 0; }
}