:root {
  --bg: #0f1115;
  --panel: #161922;
  --line: #232735;
  --fg: #e7eaf2;
  --muted: #8a93a6;
  --accent: #7aa2ff;
  --skeleton: #2a2f3d;
  --cell-radius: 10px;
  --cell-aspect: 4 / 5;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.bar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 16px;
  background: rgba(15,17,21,.92); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.bar-left { display: flex; gap: 10px; align-items: baseline; }
.bar-right { display: flex; gap: 10px; flex-wrap: wrap; }
.muted { color: var(--muted); font-size: 12px; }

.switch {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--panel); border: 1px solid var(--line);
  padding: 4px 8px; border-radius: 8px; font-size: 12px;
}
.switch input, .switch select {
  background: transparent; color: var(--fg);
  border: none; outline: none; font: inherit;
  width: 60px;
}
.switch select { width: auto; }

button {
  background: var(--accent); color: #0a0d14; border: none;
  padding: 6px 10px; border-radius: 8px; font-weight: 600; cursor: pointer;
}

.metrics {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 1px;
  background: var(--line); border-bottom: 1px solid var(--line);
}
.metrics > div {
  background: var(--panel); padding: 8px 12px;
  font-size: 12px; display: flex; gap: 6px; align-items: baseline;
}
.metrics .k { color: var(--muted); }
.metrics b { color: var(--fg); font-variant-numeric: tabular-nums; }

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  padding: 14px;
}

.cell {
  position: relative;
  aspect-ratio: var(--cell-aspect);
  border-radius: var(--cell-radius);
  overflow: hidden;
  background: var(--skeleton);
  transition: background-color .15s ease;
}

.cell.mode-A { background: var(--skeleton); }
.cell.mode-A.loading::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,.04) 50%, transparent 100%);
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }

.cell.mode-B { background: var(--rep-color, var(--skeleton)); }

.cell img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity .18s ease;
}
.cell img.shown { opacity: 1; }

.cell .label {
  position: absolute; left: 6px; bottom: 6px;
  padding: 2px 6px; border-radius: 6px;
  font-size: 10px; color: rgba(255,255,255,.86);
  background: rgba(0,0,0,.32);
  font-variant-numeric: tabular-nums;
}
