/* Base */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  padding: 0.5em 1.5em 1.5em;
  font-family: Arial, Helvetica, sans-serif;
  color: #000000;
  background: #ffffff;
}
h2 { margin: 0 0 0.5em; font-size: 1em; letter-spacing: 0.05em; }
img { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; }

/* Tabs */
#tabs {
  display: flex;
  gap: 0.25em;
  border-bottom: 1px solid #dddddd;
  margin-bottom: 1.5em;
}
.tab {
  background: transparent;
  border: none;
  padding: 0.6em 1em;
  font-size: 1em;
  color: #666666;
  border-bottom: 2px solid transparent;
}
.tab[aria-current] {
  color: #000000;
  border-bottom-color: #000000;
}

.view { animation: fade 0.15s ease-out; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ── Randomizer ─────────────────────────────────────────────────────────── */
#view-randomizer {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 2em;
  align-items: start;
}
#left-pane {
  display: flex;
  flex-direction: column;
  gap: 1em;
  justify-self: stretch;
  width: 100%;
  height: calc(100vh - 9em);
  min-height: 0;
}
#left-pane #control-panel {
  align-self: flex-start;
  width: 200px;
}
#left-pane .slot {
  align-self: flex-end;
  width: 240px;
}
#right-pane {
  display: flex;
  flex-direction: column;
  gap: 1em;
  justify-self: start;
  width: 100%;
  max-width: 240px;
  height: calc(100vh - 9em);
  min-height: 0;
}
#left-pane .slot,
#right-pane .slot {
  margin: 0;
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-height: 0;
}
#left-pane .slot img,
#right-pane .slot img {
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  object-fit: contain;
  background: #ffffff;
}
/* Hide randomizer labels — flip this rule off to bring them back. */
#view-randomizer figcaption { display: none; }

/* Per-slot prev/next arrows — hidden until the slot is hovered */
#view-randomizer .slot { position: relative; }
.nav-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  font-size: 1.8em;
  line-height: 1;
  color: #000000;
  cursor: pointer;
  padding: 0.1em 0.35em;
  z-index: 2;
  opacity: 0;
  transition: opacity 0.12s;
}
#view-randomizer .slot:hover .nav-arrow { opacity: 1; }
.nav-arrow:hover { color: #a9a9a9; }
.nav-arrow:active { color: #e31c79; }
.nav-arrow.prev { left: 0; }
.nav-arrow.next { right: 0; }

/* Per-slot lock toggle — hidden until hover; persists when locked */
.lock-btn {
  position: absolute;
  top: 0.25em;
  right: 0.25em;
  background: transparent;
  border: none;
  padding: 0.15em;
  cursor: pointer;
  color: #000000;
  z-index: 2;
  opacity: 0;
  transition: opacity 0.12s;
  line-height: 0;
}
.lock-btn svg { display: block; width: 14px; height: 14px; }
#view-randomizer .slot:hover .lock-btn { opacity: 1; }
#view-randomizer .slot.locked .lock-btn { opacity: 1; color: #e31c79; }
.lock-btn:hover { color: #a9a9a9; }
.lock-btn:active { color: #e31c79; }
/*
#left-pane figcaption,
#right-pane figcaption {
  flex: 0 0 auto;
  margin-top: 0.15em;
  font-size: 0.8em;
  text-align: center;
}
*/
#control-panel {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.5em;
  padding: 1em;
  border: 1px solid #dddddd;
}
#control-panel label {
  display: flex;
  align-items: center;
  gap: 0.5em;
  cursor: pointer;
}
#shuffle {
  margin-top: 0.5em;
  padding: 0.6em 1em;
  background: #000000;
  color: #ffffff;
  border: none;
  border-radius: 4px;
  font-size: 1em;
}
#shuffle:hover { background: #a9a9a9; }
#shuffle:active { background: #e31c79; }

#outfit-stack {
  display: flex;
  flex-direction: column;
  gap: 0.5em;
  width: 100%;
  max-width: 300px;
  justify-self: center;
  /* Fill viewport minus header + body padding so the stack never scrolls. */
  height: calc(100vh - 9em);
  min-height: 0;
}
#outfit-stack .slot {
  margin: 0;
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-height: 0;
}
#outfit-stack .slot img {
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  object-fit: contain;
  background: #ffffff;
}
#outfit-stack .slot[data-slot="bottom"] {
  flex: 1.2 1 0;
}
#outfit-stack .slot[data-slot="shoe"] {
  flex: 0 0 auto;
}
#outfit-stack .slot[data-slot="shoe"] img {
  flex: none;
  height: 180px;
  width: auto;
  max-width: 70%;
  align-self: center;
}
/*
#outfit-stack figcaption {
  flex: 0 0 auto;
  margin-top: 0.15em;
  font-size: 0.8em;
  color: #666666;
  text-align: center;
}
*/

/* ── Categories / Library ───────────────────────────────────────────────── */
#category-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4em;
  margin-bottom: 1.5em;
}
.cat-btn {
  padding: 0.4em 0.8em;
  background: #f0f0f0;
  border: 1px solid #dddddd;
  font-size: 0.9em;
  color: #333333;
}
.cat-btn[aria-current] {
  background: #000000;
  color: #ffffff;
  border-color: #000000;
}

#library {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1em;
}
.library-item {
  margin: 0;
  padding: 0.5em;
  border: 1px solid #eeeeee;
  background: #ffffff;
}
.library-item img {
  width: 100%;
  height: 180px;
  object-fit: contain;
  background: #ffffff;
}
.library-item figcaption {
  margin-top: 0.4em;
  font-size: 0.8em;
  color: #444444;
  line-height: 1.3;
}
.library-item small { color: #888888; }

/* ── Classic view (preserved from original) ─────────────────────────────── */
#view-classic { margin-left: 1.5em; }
#containercontainer {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 300px;
}
#acontainercontainer {
  display: flex;
  height: 200px;
  margin-top: 5em;
}
.classic-container {
  width: 100%;
  height: auto;
  align-self: flex-end;
}
#view-classic img {
  max-width: 50%;
  height: 300px;
  object-fit: contain;
}
#view-classic details { position: relative; width: 100%; }
#view-classic details[open] summary { color: #d3d3d3; background: #000000; }
#view-classic summary { color: #ffffff; background: #000000; position: absolute; bottom: 0; }
#view-classic details:hover { cursor: grab; }
#classic-button-container { margin-bottom: 0.5em; }
#classic-shuffle {
  font-size: 20px;
  color: #ffffff;
  border: none;
  border-radius: 5px;
  background: #000000;
  padding: 0.3em 1em;
}
#classic-shuffle:hover { background: #a9a9a9; }
#classic-shuffle:active { background: #e31c79; }

/* ── About ──────────────────────────────────────────────────────────────── */
#view-about {
  line-height: 1.5;
}
#view-about p { margin: 0 0 1em; max-width: 640px; }
#view-about a { color: #000000; }
.about-gifs {
  display: flex;
  gap: 1em;
  margin: 1.5em 0;
  flex-wrap: wrap;
}
.about-gifs img {
  flex: 1 1 0;
  min-width: 280px;
  max-width: 480px;
  height: auto;
  object-fit: contain;
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 720px) {
  #view-randomizer { grid-template-columns: 1fr; }
  #control-panel { position: static; }
}
