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

:root {
    --primary-color: #4285F4;
    --primary-dark: #1a73e8;
    --success-color: #34A853;
    --warning-color: #FBBC04;
    --error-color: #EA4335;
    --text-primary: #202124;
    --text-secondary: #5f6368;
    --text-tertiary: #80868b;
    --background: #f8f9fa;
    --surface: #ffffff;
    --border: #dadce0;
    --shadow-sm: 0 1px 2px 0 rgba(60, 64, 67, 0.1), 0 1px 3px 1px rgba(60, 64, 67, 0.08);
    --shadow-md: 0 1px 3px 0 rgba(60, 64, 67, 0.15), 0 4px 8px 3px rgba(60, 64, 67, 0.1);
    --shadow-lg: 0 1px 4px 0 rgba(60, 64, 67, 0.2), 0 8px 16px 4px rgba(60, 64, 67, 0.15);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

body {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 24px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 48px;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}

.logo-icon {
    width: 48px;
    height: 48px;
}

h1 {
    font-family: 'Google Sans', 'Roboto', sans-serif;
    font-size: 32px;
    font-weight: 500;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 16px;
    font-weight: 400;
}

/* Cards */
.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s ease;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card h2 {
    font-family: 'Google Sans', 'Roboto', sans-serif;
    font-size: 18px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 20px;
}

/* Overview Card */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.stats-grid.four-cols {
    grid-template-columns: repeat(4, 1fr);
}

.stats-grid.five-cols {
    grid-template-columns: repeat(5, 1fr);
}

@media (max-width: 1100px) {
    .stats-grid.five-cols {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 900px) {
    .stats-grid.four-cols,
    .stats-grid.five-cols {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-family: 'Google Sans', 'Roboto', sans-serif;
    font-size: 24px;
    font-weight: 500;
    color: var(--text-primary);
}

/* Staking Cards */
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.card-header h2 {
    margin-bottom: 0;
}

.contract-link {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--primary-color);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    transition: background 0.2s ease;
}

.contract-link:hover {
    background: rgba(66, 133, 244, 0.08);
}

.external-icon {
    width: 14px;
    height: 14px;
}

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

.period-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.period-stats.two-cols {
    grid-template-columns: repeat(2, 1fr);
}

@media (max-width: 640px) {
    .period-stats,
    .period-stats.two-cols {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

.period-item {
    background: var(--background);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.period-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.period-badge {
    font-size: 12px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 20px;
    color: white;
}

.period-90 {
    background: #00ACC1;
}

.period-180 {
    background: var(--primary-color);
}

.period-365 {
    background: var(--success-color);
}

.period-730 {
    background: #9334E6;
}

.apy-badge {
    font-size: 11px;
    font-weight: 500;
    color: var(--success-color);
    background: rgba(52, 168, 83, 0.1);
    padding: 3px 8px;
    border-radius: 12px;
}

.period-value {
    font-family: 'Google Sans', 'Roboto', sans-serif;
    font-size: 20px;
    font-weight: 500;
    color: var(--text-primary);
}

.total-staked {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(135deg, #4285F4 0%, #1a73e8 100%);
    border-radius: var(--radius-md);
    color: white;
}

.total-label {
    font-size: 14px;
    font-weight: 500;
    opacity: 0.9;
}

.total-value {
    font-family: 'Google Sans', 'Roboto', sans-serif;
    font-size: 24px;
    font-weight: 500;
}

/* Combined Card */
.combined-card {
    background: linear-gradient(135deg, #202124 0%, #3c4043 100%);
    color: white;
}

.combined-card h2 {
    color: white;
}

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

.combined-item {
    text-align: center;
    padding: 24px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
}

.combined-label {
    display: block;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 8px;
}

.combined-value {
    font-family: 'Google Sans', 'Roboto', sans-serif;
    font-size: 36px;
    font-weight: 500;
}

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

.combined-breakdown.four-cols {
    grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 768px) {
    .combined-breakdown.four-cols {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .combined-breakdown,
    .combined-breakdown.four-cols {
        grid-template-columns: 1fr;
    }
}

.breakdown-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 16px;
    border-radius: var(--radius-sm);
    text-align: center;
}

.breakdown-label {
    display: block;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 6px;
}

.breakdown-value {
    font-family: 'Google Sans', 'Roboto', sans-serif;
    font-size: 18px;
    font-weight: 500;
}

/* Footer */
footer {
    text-align: center;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

footer p {
    font-size: 13px;
    color: var(--text-tertiary);
}

.refresh-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 24px;
    font-family: 'Google Sans', 'Roboto', sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

.refresh-btn:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow-md);
}

.refresh-btn:active {
    transform: scale(0.98);
}

.refresh-btn:disabled {
    background: var(--text-tertiary);
    cursor: not-allowed;
}

.refresh-icon {
    width: 16px;
    height: 16px;
}

.refresh-btn.loading .refresh-icon {
    animation: spin 1s linear infinite;
}

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

/* Skeleton Loading */
.skeleton {
    display: inline-block;
    width: 100px;
    height: 24px;
    background: linear-gradient(90deg, #e8eaed 25%, #f1f3f4 50%, #e8eaed 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Error State */
.error-value {
    color: var(--error-color);
    font-size: 14px;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --text-primary: #e8eaed;
        --text-secondary: #9aa0a6;
        --text-tertiary: #80868b;
        --background: #202124;
        --surface: #292a2d;
        --border: #3c4043;
    }

    .period-item {
        background: rgba(255, 255, 255, 0.05);
    }

    .skeleton {
        background: linear-gradient(90deg, #3c4043 25%, #5f6368 50%, #3c4043 75%);
        background-size: 200% 100%;
    }

    .combined-card {
        background: linear-gradient(135deg, #1a73e8 0%, #4285F4 100%);
    }
}
