:root {
    color-scheme: dark;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    line-height: 1.5;

    /* Modern Palette */
    --bg-gradient: linear-gradient(135deg, #1a1c2c 0%, #4a192c 100%);
    --card-bg: rgba(255, 255, 255, 0.05);
    --card-border: rgba(255, 255, 255, 0.1);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --shadow: rgba(0, 0, 0, 0.25);
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--bg-gradient);
    color: var(--text-primary);
    padding: 2rem;
    box-sizing: border-box;
}

main {
    width: min(800px, 95vw);
    /* Wider for charts */
    padding: 2.5rem;
    border-radius: 24px;
    border: 1px solid var(--card-border);
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 25px 50px -12px var(--shadow);
    display: grid;
    gap: 2rem;
    margin: auto;
    /* Center vertically and horizontally */
}

header {
    display: grid;
    gap: 0.5rem;
    text-align: center;
}

.header__top {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

h1 {
    margin: 0;
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(to right, #fff, #ccc);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.02em;
}

p {
    color: var(--text-secondary);
    margin: 0;
    font-size: 1.1rem;
}

form {
    display: flex;
    gap: 1rem;
    margin: 0 auto;
    width: 100%;
    max-width: 500px;
}

input[type='text'] {
    flex: 1;
    border-radius: 12px;
    border: 1px solid var(--card-border);
    padding: 0.8rem 1.2rem;
    font-size: 1rem;
    background: rgba(0, 0, 0, 0.2);
    color: white;
    transition: border-color 0.2s;
}

input[type='text']:focus {
    outline: none;
    border-color: var(--accent);
}

button {
    border-radius: 12px;
    border: none;
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    background: var(--accent);
    color: white;
    cursor: pointer;
    transition: all 0.2s;
}

button:hover:not(:disabled) {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#status {
    text-align: center;
    min-height: 1.5rem;
    font-weight: 500;
}

#status[data-tone='warn'] {
    color: var(--warning);
}

#status[data-tone='error'] {
    color: var(--error);
}

#status[data-tone='success'] {
    color: var(--success);
}

/* Stats Grid */
.totals {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.totals__item {
    padding: 1.5rem;
    border-radius: 16px;
    border: 1px solid var(--card-border);
    background: rgba(255, 255, 255, 0.03);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.5rem;
    transition: transform 0.2s;
}

.totals__item:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.05);
}

.totals__label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
}

.totals__value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Charts Section */
.charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
    margin-bottom: 2rem;
}

.chart-card {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Table */
.table-wrapper {
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--card-border);
    background: rgba(0, 0, 0, 0.2);
}

.table-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--card-border);
}

.table-toolbar__heading {
    margin: 0;
    font-size: 1.2rem;
    color: var(--text-primary);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

th {
    text-align: left;
    padding: 1rem 1.5rem;
    color: var(--text-secondary);
    font-weight: 600;
    border-bottom: 1px solid var(--card-border);
    background: rgba(255, 255, 255, 0.02);
}

td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--card-border);
    color: var(--text-primary);
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* GitHub Link */
.repo-link {
    color: var(--text-secondary);
    transition: color 0.2s;
}

.repo-link:hover {
    color: var(--text-primary);
}

.repo-link svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

@media (max-width: 600px) {
    body {
        padding: 1rem;
    }

    main {
        padding: 1.5rem;
    }

    form {
        flex-direction: column;
    }

    .header__top {
        flex-direction: column;
    }

    h1 {
        font-size: 2rem;
    }
}

/* Footer */
footer {
    display: flex;
    justify-content: center;
    padding: 1rem;
    width: 100%;
}

footer .repo-link {
    color: rgba(255, 255, 255, 0.4);
}

footer .repo-link:hover {
    color: var(--text-primary);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}