/* ===== GLOBAL ===== */
html, body {
    height: 100%;
}

body {
  margin: 0;
  padding: 0;
  background: #111;
  color: #eee;
  font-family: Arial, Helvetica, sans-serif;
  display: flex;
  flex-direction: column;
}

main {
    flex: 1; 
}

.hidden { display: none !important; }

button {
  cursor: pointer;
  border: none;
  outline: none;
  font-family: inherit;
  transition: 0.15s ease;
}

/* ===== HEADER ===== */
header {
  position: relative;
  top: 15px;
  left: 0;
  right: 0;
  margin: 0 20px;
  bottom: 100%;

  img {
    height: 40px;
  }

  .header__logo {
    position: absolute;
    left: 0;
    top: 0;
  }

  .header__counter {
    position: absolute;
    left: 50%;
    top: 0;
    transform: translate(-50%, 0);
  }

  .header__buttons {
    position: absolute;
    right: 0;
    top: 0;

    .header__buttons--button {
      background: #444;
      color: #fff;
      padding: 8px 16px;
      border-radius: 6px;

      &:hover {
        background: #666;
      }
    }
  }
}

/* ===== MODE SELECT ===== */
#modeSelect {
  padding: 20px;
  text-align: center;
}

.modesRow {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.modeBtn {
  background: #222;
  border: 2px solid #444;
  width: 260px;
  padding: 20px;
  color: #fff;
  border-radius: 12px;
  transition: 0.2s;
  text-align: left;
}

.modeBtn:hover {
  transform: translateY(-4px);
  background: #333;
  border-color: #888;
}

.modeBtn h2 {
  margin: 0 0 8px 0;
  font-size: 22px;
}

.subText {
  font-size: 12px;
  margin-bottom: 0%;
  color: #888
}

/* ===== COMPARISON AREA ===== */
.choiceContainer {
  display: flex;
  justify-content: space-between;
  gap: 2%;
  padding: 20px;
  flex-wrap: wrap;
  width: 100%;
  box-sizing: border-box;
}

/* OUTER CONTAINER */
.choiceBtnDiv {
  position: relative;
  flex: 1 1 48%;
  max-width: 48%;
  min-width: 300px;
  background: #1b1b1b;
  border: 2px solid #333;
  border-radius: 15px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: 0.2s ease;
}

.choiceBtnDiv:hover {
  border-color: #666;
  background: #242424;
  box-shadow: 0 12px 30px rgba(0,0,0,0.55);
}

/* CLICKABLE AREA */
.choiceBtn {
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  width: 100%;
  position: relative;
}

/* NUMBER INSIDE IMAGE AREA */
.number {
  position: absolute;
  top: 10px;
  z-index: 10;
  font-size: 22px;
  font-weight: bold;
  color: #fff;
  text-shadow: 0 0 6px black;
}

.number-left { left: 10px; }
.number-right { right: 10px; }

.shiny {
  position: absolute;
  top: 10px;
  width: 36px;
  height: 36px;
  z-index: 60;               
  pointer-events: auto;      
  cursor: pointer;
  transition: transform .12s ease, filter .12s ease;
}

.shiny-right { right: 10px; left: auto; }
.shiny-left  { left: 10px; right: auto; }

.shiny:hover {
  transform: scale(1.08);
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.45));
}

.gender {
  position: absolute;
  top: 56px;
  width: 36px;
  height: 36px;
  z-index: 60;               
  pointer-events: auto;      
  cursor: pointer;
  transition: transform .12s ease, filter .12s ease;
  font-size: 22px;
  font-weight: bolder;
  color: #fff;
  text-shadow: 0 0 6px black;
}

.gender-right { right: 10px; left: auto; }
.gender-left  { left: 10px; right: auto; }

.gender:hover {
  transform: scale(1.08);
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.45));
}

/* IMAGE */
.choiceImg {
  width: 100%;
  height: auto;
  max-width: 92%;
  margin: 20px auto 10px auto;
  display: block;
  object-fit: contain;
  max-height: calc(55vh - 80px);
  transition: transform .2s ease, filter .2s ease;
  position: relative;
  z-index: 1;
}

.B_DIV:hover .choiceImg {
  transform: scale(1.03);
  filter: brightness(1.08);
}

.A_DIV:hover .choiceImg {
  transform: scale(-1.03, 1.03);
  filter: brightness(1.08);
}

/* FLIP LEFT IMAGE */
.flipX { transform: scaleX(-1); }

/* LABEL BELOW IMAGE */
.choiceLabel {
  padding: 12px;
  text-align: center;
  font-size: 18px;
  background: #151515;
  color: #eee;
  border-top: 1px solid rgba(255,255,255,0.05);
  z-index: 2;
  margin-top: auto;
  margin-bottom: 0;
}

/* MODE BUTTONS */
.imgModeButtons {
  display: flex;
  width: 100%;
  background: #101010;
  border-top: 1px solid rgba(255,255,255,0.05);
  z-index: 2;
}

.imgTypeBtn {
  flex: 1 1 0;
  background: #222;
  color: #ddd;
  padding: 10px 6px;
  font-size: 14px;
  border-right: 1px solid rgba(255,255,255,0.06);
}

.imgTypeBtn:last-child { border-right: none; }

.imgTypeBtn:hover {
  background: #2b2b2b;
  color: #fff;
}
/* scores */
#finalScores {
  width: 90%;
  margin: 40px auto;
  color: #eee;
}

.finalTitle {
  text-align: center;
  margin-bottom: 25px;
}

.rankGroup {
  margin-bottom: 20px;
  border: 2px solid #333;
  border-radius: 12px;
  overflow: hidden;
  background: #1b1b1b;
}

.rankHeader {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  background: #222;
  cursor: pointer;
  user-select: none;
  transition: background .18s ease, border-color .18s ease;
}

.rankHeader > h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  flex: 1 1 auto;      
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rankHeader:hover {
  background: #2c2c2c;
}

.rankHeader .arrow {
  transition: transform 0.25s ease;
}

.rankGroup.collapsed .rankList {
  max-height: 0;
  overflow: hidden;
  padding: 0;
}

.rankGroup.collapsed .arrow {
  transform: rotate(-90deg);
}

.rankList {
  padding: 10px 0;
  max-height: 2000px; 
  transition: max-height 0.3s ease;
}

.rankEntry {
  display: grid;
  grid-template-columns: 60px 70px 90px 1fr 80px; 
  align-items: center;

  padding: 10px 15px;
  border-bottom: 1px solid #333;
}

.rankEntry:last-child {
  border-bottom: none;
}

.rankEntry img {
  width: 64px;
  height: 64px;
  object-fit: contain;
}

.rankPos {
  font-size: 20px;
  font-weight: bold;
}

.rankScore {
  text-align: right;
  font-weight: bold;
}

.exportListBtn {
  flex: 0 0 auto;      
  background: #444;
  color: #fff;
  padding: 6px 10px;
  border-radius: 8px;
  border: none;
  font-size: 0.9rem;
  cursor: pointer;
  margin-left: 6px;
  transition: background .15s ease, transform .12s ease;
}

.exportListBtn:hover {
  background: #666;
  transform: translateY(-1px);
}

.rankHeader .arrow {
  flex: 0 0 auto;
  margin-left: 8px;
  transition: transform .25s ease;
  font-size: 0.95rem;
  color: #ddd;
}

.rankGroup.collapsed .rankList {
  max-height: 0;
  overflow: hidden;
  padding: 0;
}

.rankGroup.collapsed .arrow {
  transform: rotate(-90deg);
}

.rankHeader .exportListBtn {
  pointer-events: auto;
}

/* ===== FOOTER ===== */
footer {
  text-align: center;
  padding: 15px;
  background: #1a1a1a;
  border-top: 2px solid #333;
  margin-top: 20px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .choiceBtnDiv {
    flex-basis: 100%;
    max-width: 100%;
    margin-bottom: calc(2vh);

  }

  .choiceImg {
    max-height: calc(50vh);
    margin:auto;
  }
}

@media (max-width: 600px) {
  .choiceBtnDiv {
    margin-bottom: calc(2vh);
  }
  .choiceImg {
    max-height: calc(25vh);
  }

  .imgTypeBtn {
    flex: 1 1 50%;
  }

  .rankHeader {
    gap: 8px;
    padding: 10px 12px;
  }

  .exportListBtn {
    padding: 6px 8px;
    font-size: 0.85rem;
  }

  .rankHeader > h2 {
    font-size: 1rem;
  }

  .rankHeader .arrow {
    font-size: 0.9rem;
  }
}

@media (max-width: 420px) {
  .imgTypeBtn {
    flex: 1 1 100%;
  }
}
