:root {
  --bg: #0b0f13;
  --card: #121822;
  --text: #e7edf5;
  --muted: #9bb0c2;
  --accent: #6ab0ff;
  --secondary: #bdbdbd;
}
* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto,
    Inter, Arial;
}
a {
  color: var(--accent);
  text-decoration: none;
}
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
}
.header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(11, 15, 19, 0.8);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid #1b2330;
}
.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
}

header.nav .header-inner {
  display: flex;
  justify-content: center; /* centers everything horizontally */
  align-items: center; /* vertical alignment */
  gap: 20px; /* space between brand and nav */
}

header.nav .brand {
  font-weight: 700;
}

header.nav .navigation {
  display: flex;
  gap: 20px; /* equal spacing between links */
}

header.nav .navigation a {
  text-decoration: none;
  color: whitesmoke;
}

header.nav .navigation a:hover {
  color: var(--accent);
}

.brand {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.4px;
}
.nav {
  display: flex;
  gap: 16px;
}
.row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.btn {
  background: var(--accent);
  color: #001428;
  padding: 10px 14px;
  border-radius: 10px;
  border: 0;
  font-weight: 600;
  cursor: pointer;
}
.btn-secondary {
  background: var(--secondary);
  color: #001428;
  padding: 10px 14px;
  border-radius: 10px;
  border: 0;
  font-weight: 600;
  cursor: pointer;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.input {
  width: 100%;
  padding: 10px 12px;
  background: #0f141d;
  border: 1px solid #223046;
  border-radius: 10px;
  color: var(--text);
}
.stack {
  display: grid;
  gap: 12px;
}
.notice {
  color: #f6c177;
  margin: 8px 0;
}
.center {
  display: grid;
  place-items: center;
  padding: 40px;
}
.controls {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 14px 0;
}
.viewer {
  display: grid;
  place-items: center;
  margin: 12px 0;
}
.viewer img,
.viewer video {
  max-width: 100%;
  max-height: 70vh;
  border-radius: 12px;
}
.badge {
  position: absolute;
  right: 8px;
  top: 8px;
  background: #0008;
  color: #fff;
  padding: 3px 6px;
  border-radius: 6px;
  font-size: 12px;
}
.pagination {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
  margin: 16px 0;
}
.pagination button {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #1f2a3a;
  background: #0f141d;
  color: var(--text);
  cursor: pointer;
}
small.muted {
  color: var(--muted);
}
/* Spinner */
.spinner {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 3px solid #ddd;
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
  margin: auto;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

#albums.grid {
  /* more, smaller columns instead of one huge card */
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.card {
  display: block;
  padding: 10px;
}

.card .thumb {
  width: 100%;
  aspect-ratio: 4 / 3; /* keeps consistent shape */
  max-height: 160px;
  border-radius: 10px;
  overflow: hidden;
  display: flex; /* use flexbox to center */
  align-items: center;
  justify-content: center;
  background: #111;
}

/* Ensure media fits within container */
.card .thumb img,
.card .thumb video {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain; /* no crop */
  display: block;
}

@media (max-width: 480px) {
  .card .thumb {
    max-height: 120px; /* smaller on phones */
  }
}

/* Keep overlay from blocking clicks even when visible */
.viewer {
  position: relative;
  min-height: 220px;
}
.viewer .loading-overlay {
  position: absolute;
  inset: 0;
  display: none; /* toggled on/off by JS */
  place-items: center;
  background: rgba(255, 255, 255, 0.6);
  pointer-events: none; /* never intercept clicks */
}
