:root {
  --md-sys-color-primary: #6750a4;
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-primary-container: #eaddff;
  --md-sys-color-on-primary-container: #21005d;
  
  --md-sys-color-secondary: #625b71;
  --md-sys-color-on-secondary: #ffffff;
  --md-sys-color-secondary-container: #e8def8;
  --md-sys-color-on-secondary-container: #1d192b;
  
  --md-sys-color-surface: #fef7ff;
  --md-sys-color-on-surface: #1c1b1f;
  --md-sys-color-surface-variant: #e7e0ec;
  --md-sys-color-on-surface-variant: #49454f;
  --md-sys-color-outline: #79747e;
  --md-sys-color-outline-variant: #cac4d0;
  
  --md-sys-color-surface-container-low: #f7f2fa;
  --md-sys-color-surface-container: #f3edf7;
  --md-sys-color-surface-container-high: #ece6f0;
  --md-sys-color-surface-container-highest: #e6e0e9;

  --md-sys-shape-corner-none: 0;
  --md-sys-shape-corner-small: 8px;
  --md-sys-shape-corner-medium: 16px;
  --md-sys-shape-corner-large: 24px;
  --md-sys-shape-corner-full: 9999px;

  --md-sys-elevation-1: 0px 1px 3px 1px rgba(0, 0, 0, 0.15), 0px 1px 2px 0px rgba(0, 0, 0, 0.3);
  --md-sys-elevation-2: 0px 2px 6px 2px rgba(0, 0, 0, 0.15), 0px 1px 2px 0px rgba(0, 0, 0, 0.3);
}

@media (prefers-color-scheme: dark) {
  :root {
    --md-sys-color-primary: #d0bcff;
    --md-sys-color-on-primary: #381e72;
    --md-sys-color-primary-container: #4f378b;
    --md-sys-color-on-primary-container: #eaddff;
    
    --md-sys-color-secondary: #ccc2dc;
    --md-sys-color-on-secondary: #332d41;
    --md-sys-color-secondary-container: #4a4458;
    --md-sys-color-on-secondary-container: #e8def8;
    
    --md-sys-color-surface: #141218;
    --md-sys-color-on-surface: #e6e0e9;
    --md-sys-color-surface-variant: #49454f;
    --md-sys-color-on-surface-variant: #cac4d0;
    --md-sys-color-outline: #938f99;
    --md-sys-color-outline-variant: #49454f;
    
    --md-sys-color-surface-container-low: #1d1b20;
    --md-sys-color-surface-container: #211f26;
    --md-sys-color-surface-container-high: #2b2930;
    --md-sys-color-surface-container-highest: #36343b;
    
    --md-sys-elevation-1: 0px 1px 3px 1px rgba(0, 0, 0, 0.4), 0px 1px 2px 0px rgba(0, 0, 0, 0.6);
    --md-sys-elevation-2: 0px 2px 6px 2px rgba(0, 0, 0, 0.4), 0px 1px 2px 0px rgba(0, 0, 0, 0.6);
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    background-color: var(--md-sys-color-surface);
    color: var(--md-sys-color-on-surface);
    font-family: 'Roboto', sans-serif;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes emptyPulse {
    0%,
    100% {
        transform: scale(1);
        opacity: 0.9;
    }
    50% {
        transform: scale(1.06);
        opacity: 1;
    }
}

.md-title-large { font-size: 22px; font-weight: 400; line-height: 28px; }
.md-title-medium { font-size: 16px; font-weight: 500; line-height: 24px; letter-spacing: 0.15px; }
.md-body-medium { font-size: 14px; font-weight: 400; line-height: 20px; letter-spacing: 0.25px; }
.md-headline-small { font-size: 24px; font-weight: 400; line-height: 32px; }
.md-on-surface-variant { color: var(--md-sys-color-on-surface-variant); }
.mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-5 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }
.px-3 { padding-left: 12px; padding-right: 12px; }

.md-top-app-bar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 24px; background-color: var(--md-sys-color-surface);
    color: var(--md-sys-color-on-surface);
}
.md-top-app-bar-leading { display: flex; align-items: center; gap: 16px; }
.title-icon { color: var(--md-sys-color-primary); font-size: 28px; }
.md-top-app-bar-title { font-size: 22px; font-weight: 400; }
.md-icon-button {
    display: flex; align-items: center; justify-content: center;
    width: 48px; height: 48px; border-radius: 50%; border: none;
    background: transparent; color: var(--md-sys-color-on-surface-variant);
    cursor: pointer; text-decoration: none; transition: background-color 0.2s, transform 0.2s;
}
.md-icon-button:hover { background-color: color-mix(in srgb, var(--md-sys-color-on-surface-variant) 8%, transparent); }
.md-icon-button:hover { transform: translateY(-1px); }

.md-layout {
    display: flex; flex-direction: column; max-width: 1200px;
    margin: 0 auto; padding: 16px; gap: 32px;
}
@media (min-width: 840px) {
    .md-layout { flex-direction: row; align-items: flex-start; }
    .md-sidebar { width: 320px; flex-shrink: 0; }
    .md-content { flex-grow: 1; }
}

.md-card { border-radius: var(--md-sys-shape-corner-medium); padding: 16px; }
.md-card-elevated {
    background-color: var(--md-sys-color-surface-container-low);
    box-shadow: var(--md-sys-elevation-1);
}

.maintainer-header { display: flex; align-items: center; gap: 16px; }
.md-avatar {
    width: 48px; height: 48px; border-radius: 50%;
    background-color: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
    display: flex; align-items: center; justify-content: center;
}

.md-chips-container { display: flex; flex-wrap: wrap; gap: 8px; }
.md-chip {
    display: inline-flex; align-items: center; gap: 8px;
    height: 32px; padding: 0 16px; border-radius: var(--md-sys-shape-corner-small);
    font-size: 14px; font-weight: 500; cursor: pointer; text-decoration: none;
    transition: background-color 0.2s, box-shadow 0.2s;
    border: 1px solid var(--md-sys-color-outline);
    background-color: transparent; color: var(--md-sys-color-on-surface);
}
.md-chip.active {
    background-color: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
    border-color: transparent;
}
.md-chip:hover { background-color: color-mix(in srgb, var(--md-sys-color-on-surface) 8%, transparent); }
.md-chip.active:hover { background-color: color-mix(in srgb, var(--md-sys-color-on-secondary-container) 8%, var(--md-sys-color-secondary-container)); }
.md-chip .md-icon { font-size: 18px; }

.md-list-item {
    display: flex; flex-direction: column; justify-content: center;
    width: 100%; min-height: 56px; padding: 8px 16px;
    background: transparent; border: none; text-align: left;
    border-radius: var(--md-sys-shape-corner-full); cursor: pointer;
    margin-bottom: 4px; transition: background-color 0.2s, transform 0.2s;
}
.md-list-item-headline { font-size: 16px; font-weight: 400; color: var(--md-sys-color-on-surface); line-height: 24px;}
.md-list-item-supporting-text { font-size: 14px; font-weight: 400; color: var(--md-sys-color-on-surface-variant); line-height: 20px;}
.md-list-item:hover { background-color: color-mix(in srgb, var(--md-sys-color-on-surface) 8%, transparent); }
.md-list-item:hover { transform: translateX(2px); }
.md-list-item.active { background-color: var(--md-sys-color-secondary-container); }
.md-list-item.active .md-list-item-headline, .md-list-item.active .md-list-item-supporting-text { color: var(--md-sys-color-on-secondary-container); }

.download-card {
    display: flex; flex-direction: column; justify-content: space-between;
    gap: 16px; padding: 24px; background-color: var(--md-sys-color-surface-container);
    border-radius: var(--md-sys-shape-corner-large); margin-bottom: 16px;
    border: 1px solid var(--md-sys-color-outline-variant);
    transition: box-shadow 0.2s, transform 0.2s;
}
.download-card:hover {
    box-shadow: var(--md-sys-elevation-1);
    transform: translateY(-2px);
}
@media (min-width: 600px) { .download-card { flex-direction: row; align-items: flex-start; } }
.download-info { flex: 1; min-width: 0; }
.download-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.download-title {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--md-sys-color-on-surface);
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.download-inline-chips {
    display: inline-flex;
    flex-wrap: nowrap;
    gap: 8px;
    max-width: 48%;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
}
.download-inline-chips .info-chip {
    flex: 0 0 auto;
}
.download-meta-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}
.download-info-chips {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
}
.download-info-chips .info-chip {
    flex: 0 0 auto;
}
.download-actions {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-left: auto;
    justify-content: flex-end;
}
.info-chip {
    padding: 4px 12px; border-radius: 8px; font-size: 12px; font-weight: 500;
    background-color: var(--md-sys-color-surface-variant);
    color: var(--md-sys-color-on-surface-variant);
}

.md-filled-button {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 8px; height: 40px; padding: 0 24px; border-radius: 20px; border: none;
    background-color: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary);
    font-size: 14px; font-weight: 500; cursor: pointer; text-decoration: none;
    transition: background-color 0.2s, box-shadow 0.2s, transform 0.2s; white-space: nowrap;
}
.download-main-action {
    min-width: 132px;
}
.md-filled-button-secondary {
    background-color: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface);
    border: 1px solid var(--md-sys-color-outline-variant);
    height: 36px;
    padding: 0 14px;
    border-radius: 18px;
    font-size: 12px;
}
.md-filled-button:hover {
    box-shadow: var(--md-sys-elevation-1);
    background-color: color-mix(in srgb, var(--md-sys-color-on-primary) 8%, var(--md-sys-color-primary));
    transform: translateY(-1px);
}
.md-filled-button-secondary:hover {
    background-color: color-mix(in srgb, var(--md-sys-color-on-surface) 8%, var(--md-sys-color-surface-container-high));
}
.md-filled-button-secondary .btn-icon {
    font-size: 16px;
}
@media (max-width: 599px) {
    .download-title {
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .download-title-row {
        flex-direction: column;
        align-items: flex-start;
    }
    .download-inline-chips {
        max-width: 100%;
        width: 100%;
    }
    .download-meta-row {
        align-items: flex-start;
        flex-direction: column;
    }
    .download-actions,
    .download-main-action,
    .md-filled-button-secondary {
        width: 100%;
    }
    .download-actions {
        margin-left: 0;
    }
    .download-main-action {
        justify-content: center;
    }
}
.btn-icon { font-size: 18px; }

.md-empty-state {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 48px 24px; text-align: center;
    background-color: var(--md-sys-color-surface-container);
    border-radius: var(--md-sys-shape-corner-large);
}
.md-empty-icon { font-size: 48px; color: var(--md-sys-color-on-surface-variant); }
.md-empty-icon { animation: emptyPulse 1.8s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
