[x-cloak] { display: none !important; }
html { scroll-behavior: smooth; }

nav.topnav {
  position: sticky; top: 0; z-index: 100;
  background: var(--pico-card-background-color);
  border-bottom: 1px solid var(--pico-muted-border-color);
}
nav.topnav .container {
  display: flex; align-items: center; justify-content: space-between;
  padding-block: 0.5rem;
}
nav.topnav .brand-icon { display: inline-flex; }
nav.topnav .brand-icon img { height: 1.75rem; width: 1.75rem; }
nav.topnav ul { display: flex; gap: 1rem; list-style: none; margin: 0 0 0 auto; padding: 0; }
nav.topnav a { text-decoration: none; color: var(--pico-muted-color); }
nav.topnav .active a { color: var(--pico-primary); font-weight: 600; }
nav.topnav .theme-toggle { margin: 0; padding: 0.3rem; line-height: 0; width: auto; display: inline-flex; align-items: center; justify-content: center; }

section[id], article[id] { scroll-margin-top: 60px; }

.alert { padding: 0.75rem 1rem; border-radius: 0.25rem; margin-bottom: 1rem; border: 1px solid transparent; }
.alert-info { background: var(--pico-card-background-color); border-color: var(--pico-muted-border-color); color: var(--pico-color); }
.alert-danger { background: var(--pico-card-background-color); border-color: var(--pico-form-element-invalid-border-color); color: var(--pico-form-element-invalid-border-color); }
.alert-warning { background: var(--pico-card-background-color); border-color: var(--pico-muted-border-color); color: var(--pico-muted-color); }

.btn-group { display: inline-flex; }
.btn-group button { margin: 0; border-radius: 0; padding: 0.25rem 0.75rem; font-size: 0.875rem; }
.btn-group button:first-child { border-radius: var(--pico-border-radius) 0 0 var(--pico-border-radius); }
.btn-group button:last-child { border-radius: 0 var(--pico-border-radius) var(--pico-border-radius) 0; }
.btn-group button.active { background: var(--pico-primary); color: var(--pico-primary-inverse); border-color: var(--pico-primary); }

.chart-container { position: relative; height: 400px; margin: 1rem 0; }
.chart-controls { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.5rem; }
.mass-control { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem; }
.mass-control input[type="range"] { margin: 0.15rem 0 0; padding: 0; }
.mass-display { font-weight: 600; min-width: 3rem; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; margin-top: 1rem; }
article > article { margin-top: 1rem; margin-bottom: 0; }

.loading-spinner { display: inline-block; width: 1.5rem; height: 1.5rem; border: 3px solid var(--pico-muted-border-color); border-top-color: var(--pico-primary); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.form-grid { display: grid; grid-template-columns: 1fr auto auto; gap: 1rem; align-items: start; margin-bottom: 1rem; }
@media (max-width: 576px) { .form-grid { grid-template-columns: 1fr; } }
.field { margin-bottom: 1rem; }
.file-label { display: block; padding: 0.5rem 0.75rem; border: 1px solid var(--pico-form-element-border-color); border-radius: var(--pico-border-radius); cursor: pointer; margin-bottom: 0; }
.result-row { display: flex; flex-direction: column; align-items: flex-start; gap: 0.75rem; }
.result-row button { margin: 0; width: auto; align-self: flex-start; }

.muted { color: var(--pico-muted-color); }
.center { text-align: center; }
.small { font-size: 0.875rem; }
small { font-size: 80%; }
.danger { color: var(--pico-form-element-invalid-border-color); }
.brand { font-size: 3.5rem; font-weight: 300; margin-bottom: 0; }
.lead { font-size: 1.25rem; font-weight: 300; }

.downloads-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; margin-top: 1rem; }
.download-card { display: flex; flex-direction: column; gap: 0.25rem; padding: 1rem; border: 1px solid var(--pico-muted-border-color); border-radius: var(--pico-border-radius); text-decoration: none; color: var(--pico-color); transition: border-color 0.15s, background 0.15s; }
.download-card:hover { border-color: var(--pico-primary); background: var(--pico-primary-focus); text-decoration: none; }
.download-card.unavailable { opacity: 0.5; pointer-events: none; }
