:root {
  --attacker: #f16c38;
  --defender: #aced5b;
  --speedster: #29a5e3;
  --supporter: #dc923f;
  --all-rounder: #ce5fd3;
}

body {
  font-family: "Roboto", sans-serif;
  background: #8346e5;
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

#icon {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 50px;
    height: 50px;
    background-color: #fff;
    border-radius: 12px;
    border: 3px solid #19072d;
    padding: 5px;               
    box-sizing: border-box;     
    display: flex;
    align-items: stretch;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

#icon:hover{
    box-shadow: 0 10px 10px 0 rgba(0, 0, 0, 0.2);
    transform: translateY(-1px); 
}

#icon:active{
    box-shadow: none;
    transform: translateY(0px);
}

#icon img {
    width: 100%;                
    height: 100%;
    object-fit: contain;        
    border-radius: 8px;         
    pointer-events: none;       
}

.app {
  width: 100%;
  text-align: center;
}

/* Stage */
#stage {
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  align-items: center;

  position: relative;
  margin: 30px auto;
  width: 400px;
  height: 320px;
}

#spotlight {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  filter: blur(35px);
  opacity: 0.7;
}

#stage-img {
  position: relative;
  height: 270px;
  width: auto;
  min-height: 270px;
  object-fit: contain;
  z-index: 1;
}

#stage-name {
  font-weight: bold;
  font-size: 36px;
  font-style: italic;
  margin: 20px 0 0 0;
}

#items {
  display: none;
  align-items: center;
  flex-direction: row;
  margin-top: 5px;
  gap: 10px;
}

.held-items, .battle-items {
  display: block;
  background-color: #fff;
  border: 1px solid #351061;
  border-radius: 50%;
  
  /* Fixed container size */
  width: 36px;
  height: 36px;
  padding: 2px;

  /* Maintain image aspect ratio */
  object-fit: contain;
}

.battle-items{
  border: none;
  background-color: #000;
}

.skill1, .skill2{
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.buttons{
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 75px;
}

.populate{
  display: inline-flex;
  flex-wrap: wrap;
  width: 100%;
  justify-content: space-between;
  gap: 8px;
}

/* Filters */
.filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 8px;
}

.filters button {
    background-color: #351061;
    color: #fff;
    cursor: pointer;
    font-weight: bold;
    padding: 8px 16px;
    font-size: 14px;
    border: 1px solid #351061;
    border-radius: 28px;
}

.filters button:hover{
    background-color: #fff;
    border-color: #fff;
    color: #351061;
}

.filters button.active{
  background-color: #f9c921;
  border-color: #fafa00;
  color: #351061;
}

/* Tooptip */
.tooltip {
  position: absolute;
  padding: 6px 10px;
  font-size: 12px;
  background: rgba(0,0,0,0.85);
  color: #fff;
  border-radius: 12px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -6px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 99;
}

/* Arrow */
.tooltip::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -6px;
  transform: translateX(-50%);
  border-width: 6px 6px 0 6px;
  border-style: solid;
  border-color: rgba(0,0,0,0.85) transparent transparent transparent;
}

.tooltip.show {
  opacity: 1;
  transform: translate(-50%, -110%);
}

.controls{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Random button */
#random-btn {
  background-color: #351061;
  color: #fff;
  padding: 8px 14px;
  font-size: 18px;
  cursor: pointer;
  border-radius: 12px;
  border: none;
  width: 205px;
}

#random-btn:hover{
    box-shadow: 0 10px 10px 0 rgba(0, 0, 0, 0.2);
    transform: translateY(-1px); 
    background-color: #fff;
    color: #351061;
}

#random-btn:active{
    box-shadow: none;
    transform: translateY(0);
}

/* volume control */
.volume-control {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  position: relative;
  left: 0;
  gap: 4px;

  background: #351061;
  color: #fff;

  width: auto;
  font-size: 16px;
  padding: 8px 14px;

  border: none;
  border-radius: 12px;
}

.volume-control i{
  display: inline-flex;
  justify-content: flex-start;
  font-size: 20px;
  width: 25px;
}

#volume-slider {
  accent-color: #fff;
  width: 100px;
  /* outline: none; */
}

#volume-slider::-webkit-slider-thumb {
  background-color: #fff;
  border: none;
  cursor: pointer;
}

#volume-label{
  letter-spacing: 1px;
  width: 40px;
}

/* Grid */
#grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.character {
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  border: 3px solid #19072d;
  box-shadow: 0 10px 10px 0 rgba(0, 0, 0, 0.2);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.2s;
}

.character:hover{
  transform: scale(1.05);
}

/* Role-colored frame */
.character.attacker .character-image { background-color: var(--attacker); }
.character.defender .character-image { background-color: var(--defender); }
.character.speedster .character-image { background-color: var(--speedster); }
.character.supporter .character-image { background-color: var(--supporter); }
.character.all-rounder .character-image { background-color: var(--all-rounder); }

/* Image section */
.character-image {
  border-radius: 9px;
  background-color: #2a1242;
  background-image:
    linear-gradient(45deg, rgba(0,0,0,0.1) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(0,0,0,0.1) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(0,0,0,0.1) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(0,0,0,0.1) 75%);
  background-size: 76px 76px;
  background-position: -15px 0px, -15px 38px, 23px -38px, 23px 0px;
  overflow: hidden;
}

/* Base image styling */
.character-image img {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1.155;
  object-fit: cover;
  object-position: top;
  display: block;

  --scale: 1;

  transform: scale(var(--scale));
  transition: transform 0.2s ease;
}

/* Hover zoom (always 1.1x) */
.character:hover .character-image img {
  transform: scale(calc(var(--scale) * 1.1));
}

/* ---- Exceptions ---- */
.character-image img.mega {
  --scale: 1.7;
  object-position: left;
}

.character-image img.lucario {
  object-position: left 20px;
}

.character-image img.sirfetchd {
  object-position: right -25px;
}

.character-image img.zapdos {
  --scale: 1.5;
  object-position: 5px 5px;
}

.character-image img.moltres {
  --scale: 2.5;
  object-position: -12px -21px;
}

/* Name section */
.character-name {
  background: #19072d;
  color: #fff;
  text-align: center;
  padding: 6px 4px 2px;
  font-weight: 800;
  letter-spacing: 0.6px;
  font-size: 14px;
  font-style: italic;
}

/* Disabled state */
.character.disabled {
  opacity: 0.35;
  filter: grayscale(1);
  box-shadow: none;
}

#footer {
  width: 100%;
  color: #fff;
  text-align: center;
  padding-top: 8px;
  line-height: 1.5;
}

#footer a{
  color: #fff;
}

#footer a:hover{
  color: #351061;
}