body {
  margin: 0;
  font-family: sans-serif;
  background: #111;
  color: #eee;
}

/* ---------- HEADER ---------- */

header {
  position: sticky;
  top: 0;
  background: #1b1b1b;
  padding: 10px;
  z-index: 10;
}

/* ---------- LIGHTBOX ---------- */
.lightbox {
  position: fixed;
  top:0; left:0;
  width:100%; height:100%;
  background: rgba(0,0,0,0.9);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.lightbox.hidden {
  display: none;
}

.lightbox img.lightbox-main {
  max-width: 80%;
  max-height: 70%;
  margin-bottom: 10px;
}

.lightbox-variants {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  max-width: 90%;
}

.lightbox-variants img {
  height: 100px;
  cursor: pointer;
  border: 2px solid #333;
  border-radius: 4px;
}

.lightbox-variants img.selected {
  border-color: #4af;
}

.lightbox .close {
  position: absolute;
  top: 10px;
  right: 20px;
  font-size: 36px;
  color: #fff;
  cursor: pointer;
}

/* ---------- CARD DETAILS ---------- */
.card .label {
  padding: 5px;
  font-size: 12px;
  line-height: 1.2;
}
.card .label .char {
  font-weight: bold;
  display: block;
  text-align: center;
}
.card .label .meta {
  font-size: 10px;
  opacity: 0.8;
  display: block;
  text-align: left; /* keep text left-aligned */
}

.alt-count {
  position: absolute;
  bottom: 3px;
  right: 3px;
  background: rgba(25, 25, 25, 0.9);
  color: white;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 5px;
  font-weight: bold;
  pointer-events: none;
  z-index: 2;
}


/* ---------- GALLERY (shared, identical behavior) ---------- */

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

.card {
  background: #222;
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  position: relative; /* needed for badge positioning */
}

.card img {
  width: 100%;
  height: auto;
  display: block;
}

.card .label {
  padding: 5px;
  font-size: 12px;
}

/* ---------- ADMIN LAYOUT ---------- */

.admin-layout {
  display: flex;
  align-items: flex-start; /* THIS MATTERS */
}

.admin-layout .gallery {
  flex: 1;
}

/* ---------- SIDE PANEL ---------- */

.side-panel {
  width: 320px;
  background: #181818;
  border-left: 1px solid #333;
  padding: 10px;
  box-sizing: border-box;
  position: sticky;
  top: 60px; /* below header */
  height: fit-content;
}

.admin-selected {
  outline: 3px solid #4af;
}

/* ---------- FORM ---------- */

.field {
  margin-bottom: 10px;
}

.field label {
  display: block;
  font-size: 12px;
  margin-bottom: 4px;
  opacity: 0.8;
}

.field input,
.field select {
  width: 100%;
  padding: 4px;
  background: #222;
  color: #eee;
  border: 1px solid #333;
}
