/* === COLOR PALETTE === */
:root {
  --main-black: #1f1f1f;
  --main-white: white;
  --highlight-primary: #e3b6ff;
  --highlight-secondary: #000;
  --grad-primary: linear-gradient(135deg, #d3a1ea, #935bf9);
  --grad-accent: linear-gradient(135deg, #d3a1ea4d, #935bf94d);
  --grad-yellow: linear-gradient(222deg, #fbd231, #b839ab);
  --grad-red: linear-gradient(222deg, #d24571, #d24571);
  --grad-blue: linear-gradient(222deg, #327fe3, #327fe3);
  --grad-green: linear-gradient(222deg, #5ee687, #5ee687);
  --box-width: 500px;
  --box-height: calc(var(--box-width) * 16 / 9);
}
::-webkit-scrollbar {
  display: none;
}

body {
  background-color: transparent;
}

/* === FONS CYBERPUNK === */
#wrap2025-inputbox {
  max-width: var(--box-width);
  margin: auto;
  padding: 25px;
  font-family: "Be Vietnam Pro", sans-serif;
  background-image: url("wrappedbg.jpg");
  background-position: center;
  color: #f0f0f0;
  border-radius: 16px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 5px rgba(180, 76, 255, 0.25);
  margin-bottom: 40px;
  margin-top: 25px;
}
h1,
h2 {
  font-family: "Exo 2", sans-serif;
}

.wrap-page {
  max-width: var(--box-width);
  min-height: 600px;
  height: auto;
  margin: auto;
  padding: 25px;
  /* AFEGEIX AIXÒ: */
  padding-bottom: 80px; 
  /* ------------- */
  font-family: "Be Vietnam Pro", sans-serif;
  background-image: url("wrappedbg.jpg");
  color: #f0f0f0;
  border-radius: 16px;
  position: relative; /* Això manté el logo dins la caixa */
  overflow: hidden;
  box-shadow: 0 0 5px rgba(180, 76, 255, 0.25);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start; /* Millor que 'center' per evitar que el contingut lliscant baixi massa */
}
/* GRID ANIMAT Purple */
.wrap-page::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
      90deg,
      rgba(180, 76, 255, 0.05) 1px,
      transparent 1px
    ),
    linear-gradient(0deg, rgba(180, 76, 255, 0.05) 1px, transparent 1px);
  background-size: 40px 40px;
  animation: gridMove 45s linear infinite;
  z-index: 0;
}

@keyframes gridMove {
  from {
    transform: translateY(-248px) translateX(0) rotate(-60deg);
  }
  to {
    transform: translateY(-400px) translateX(-250px) rotate(-60deg);
  }
}

/* Tot el contingut per sobre del grid */
.wrap-page * {
  position: relative;
  z-index: 2;
}

/* === TITLE === */
.wrap-page h2 {
  text-align: center;
  color: #b44cff;
  font-size: 32px;
  text-shadow: 0 0 16px rgba(180, 76, 255, 0.9);
  margin-bottom: 20px;
}

/* === INPUT (fixed width) === */
#wrap2025-inputbox input {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 14px;
  border: 2px solid #2a2a2a;
  background: #141414d9;
  color: #f1f1f1;
  border-radius: 10px;
  outline: none;
  transition: 0.2s;
  backdrop-filter: blur(4px);
}

#wrap2025-inputbox input:focus {
  border-color: #b44cff;
  box-shadow: 0 0 10px #b44cff;
}

#resName {
  font-weight: 900;
  font-size: 32px;
  font-style: italic;
  background-image: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: inline-block;
}

#resNameLvl {
  font-weight: 900;
  font-size: 25px;
  font-style: bold;
  background-image: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: inline-block;
}

#logo {
  position: absolute;
  bottom: 20px; /* Distància fixa des del fons del contenidor */
  right: 20px;  /* Distància fixa des de la dreta */
  max-width: 80px;
  margin-top: 0; /* Elimina marges extra que puguin moure'l */
  z-index: 10;
  pointer-events: none; /* Opcional: fa que puguis clicar "a través" del logo si cal */
}

#share {
  position: absolute;
  top: 3%;
  right: 5%;
  max-width: 30px;
  filter: brightness(0) invert(1);
  transition: 0.25s;
}
#share:hover {
  transform: scale(1.15);
  filter: invert(82%) sepia(25%) saturate(2089%) hue-rotate(199deg)
    brightness(100%) contrast(110%);
}

.nav-btn {
  color: #1c1b23;
  transition: 0.25s;
}
.nav-btn:hover {
  transform: scale(1.15);
  filter: invert(82%) sepia(25%) saturate(2089%) hue-rotate(199deg)
    brightness(100%) contrast(110%);
}

/* === BUTTON Purple→Yellow === */
#wrap2025-inputbox button {
  font-family: Be Vietnam Pro;
  margin-top: 14px;
  width: 100%;
  padding: 14px;
  background: var(--grad-primary);
  color: white;
  font-weight: bold;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: 0.2s ease;
  position: relative;
  overflow: hidden;
}

#wrap2025-inputbox button:hover {
  filter: brightness(1.15);
}

/* Efecte pulsació */
#wrap2025-inputbox button::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.3);
  opacity: 0;
  transform: scale(0.8);
  border-radius: inherit;
  animation: pulse 2.3s infinite ease-in-out;
}

#lvl-small {
  text-align: right;
  display: inline-block;
  margin-left: 100px;
  padding-left: 40px;
  font-family: "Exo 2", sans-serif;
  font-size: 24px;
  font-style: italic;
}

@keyframes pulse {
  0% {
    opacity: 0.1;
    transform: scale(0.8);
  }
  50% {
    opacity: 0.25;
    transform: scale(1);
  }
  100% {
    opacity: 0.1;
    transform: scale(0.8);
  }
}

#wrapmsg {
  position: absolute;
  bottom: 22%;
  right: -7%;
  font-family: "Exo 2", sans-serif;
  font-size: 250px;
  font-style: italic;
  background-image: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 800;
  z-index: 0;
  filter: opacity(0.3);
}

/* === Nav & slide === */

.wrap-page {
  display: block;
}

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

.wrap-nav button {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
}

/* === Cards === */
.wrap-card {
  flex: 1;
  padding: 18px;
  padding-top: 1px;
  border-radius: 3px;
  border: 1px solid rgba(180, 76, 255, 0.2);
  box-shadow: 0 0 3px rgba(180, 76, 255, 0.1);
  text-align: left;
  transition: 0.25s ease;
  backdrop-filter: blur(4px);
}
.wrap-card h4 {
  font-weight: 300;
  transition: 0.25s ease;
}
.wrap-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 0 18px rgba(180, 76, 255, 0.45);
  background-image: var(--grad-primary);
}

.wrap-card:hover h4 {
  font-weight: 600;
  color: var(--main-black);
}

.wrap-card:hover .wrap-value {
  color: var(--main-black);
}

.card-lvl:hover {
  background-image: var(--grad-accent) !important;
}
.card-lvl:hover h4 {
  background-image: var(--grad-accent);
  color: var(--highlight-primary) !important;
}

.card-lvl:hover .lvl-number {
  color: var(--highlight-primary) !important;
}

.card-stat:hover {
  background-image: var(--grad-accent) !important;
}
.card-stat:hover h4 {
  background-image: var(--grad-accent);
  color: var(--highlight-primary) !important;
}

.card-stat:hover .stat-name,
.card-stat:hover .stat-percent {
  color: var(--highlight-primary) !important;
  display: inline-block !important;
}

#resFavChamp {
}
/* Variants Neon Yellow */
/* card champ */
.card-champ {
  position: relative;
  /* fallback */
}

.card-champ::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 50%;
  height: 100%;

  background-image: linear-gradient(
      rgba(170, 70, 255, 0.45),
      rgba(170, 70, 255, 0.35)
    ),
    var(--champ-bg);

  background-size: cover;
  background-position: right;
  background-repeat: no-repeat;

  opacity: 0.8;

  -webkit-mask-image: linear-gradient(to left, black 70%, transparent 100%);
  mask-image: linear-gradient(to left, black 70%, transparent 100%);

  pointer-events: none;
}

.card-champ .wrap-value {
  opacity: 0;
  font-size: 1px;
  visibility: hidden;
  margin-top: -10px;
  transition: opacity 0.4s ease;
}
.card-champ:hover .wrap-value {
  margin-top: 0;
  font-size: 30px;
  opacity: 1;
  visibility: visible;
}

/* card task */
/* card task */
.card-task::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 50%;
  height: 100%;

  background-image: linear-gradient(var(--task-img-overlay, rgba(0, 0, 0, 0))),
    var(--task-image);

  background-size: cover;
  background-position: right;
  background-repeat: no-repeat;

  opacity: 0.8;
  -webkit-mask-image: linear-gradient(to left, black 70%, transparent 100%);
}

.card-task .wrap-value {
  font-size: 20px;

  margin-top: -10px;
  transition: opacity 0.4s ease;
}
.card-task:hover .wrap-value {
  margin-top: 0;
  font-size: 30px;
  visibility: visible;
}

.card-task:hover {
  background-image: var(--task-gradient);
}

.card-blue {
  border-color: rgba(255, 224, 102, 0.5);
  box-shadow: 0 0 3px rgba(255, 224, 102, 0.2);
}

.card-orange {
  border-color: rgba(255, 224, 102, 0.5);
  box-shadow: 0 0 3px rgba(255, 224, 102, 0.2);
}

.card-total {
  color: white;
  font-weight: bold;
  background-image: var(--grad-primary) !important;

  box-shadow: 0 0 3px rgba(255, 224, 102, 0.2);
}

.card-lvl {
  text-align: center;
}

.lvl-xp {
  font-weight: 900;
}

.lvl-progress-container {
  position: relative;
}

.lvl-number {
  position: absolute;
  text-align: center;
  top: 68.5%; /* Moves the top edge of the element to the vertical center of the container */
  left: 50%; /* Moves the left edge of the element to the horizontal center of the container */
  transform: translate(
    -50%,
    -50%
  ); /* Shifts the element back by half its own width and height for perfect centering */
  font-weight: 900;
  font-size: 65px !important;
}

.stat-percent {
  display: inline-block;
  text-align: right;
  padding-left: 100px;
}
.stat-name {
  display: inline-block;
  text-align: left;
  font-weight: 900;
}

/* Stats numbers */
.wrap-value {
  font-size: 34px;
  font-weight: bold;
  color: var(--highlight-primary);
  text-shadow: 0 0 10px rgba(227, 182, 255, 0.6);
  transition: 0.25s ease;
}
.wrap-value:hover {
  text-shadow: 0 0 18px rgba(227, 182, 255, 0.7);
}

.wrap-value-total {
  font-size: 34px;
  font-weight: bold;
  color: white;
  text-shadow: 0 0 10px rgba(255, 224, 102, 0.6);
  transition: 0.25s ease;
}
.wrap-value-total:hover {
  text-shadow: 0 0 18px rgba(255, 224, 102, 0.7);
}

/* === ROW layout helper === */
.wrap-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

/* =============================== */
/*     PROGRESS BAR                */
/* =============================== */

.linear-progress {
  width: 100%;
  height: 25px;
}

.linear-progress .bg {
  fill: rgba(147, 91, 249, 0.4);
}

.linear-progress .fg {
  stroke: url(#progressGradient);
  stroke-width: 35px;
  stroke-linecap: square;

  stroke-dasharray: 100; /* total */
  stroke-dashoffset: calc(100 - var(--progress));

  transition: stroke-dashoffset 0.3s linear;
}

/* =============================== */
/*     CIRCULAR PROGRESS BAR       */
/* =============================== */
.circular-progress {
  --size: 249px;
  --half-size: calc(var(--size) / 2);
  --stroke-width: 25px;
  --radius: calc((var(--size) - var(--stroke-width)) / 2);
  --circumference: calc(var(--radius) * pi * 2);
  --dash: calc((var(--progress) * var(--circumference)) / 100);
}

.circular-progress circle {
  cx: var(--half-size);
  cy: var(--half-size);
  r: var(--radius);
  stroke-width: var(--stroke-width);
  fill: none;
  stroke-linecap: square;
}

.circular-progress circle.bg {
  stroke: rgba(147, 91, 249, 0.4);
}

.circular-progress circle.fg {
  transform: rotate(90deg);
  transform-origin: var(--half-size) var(--half-size);
  stroke-dasharray: var(--dash) calc(var(--circumference) - var(--dash));
  transition: stroke-dasharray 0.3s linear 0s;
  stroke: url(#progressGradient);
}

/* =============================== */
/*     LOADING ANIMATION (NEW)     */
/* =============================== */

#wrap-loading {
  display: none;
  text-align: center;
  margin-top: 20px;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 5px solid rgba(180, 76, 255, 0.2);
  border-top-color: #b44cff;
  border-radius: 50%;
  margin: auto;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-text {
  margin-top: 12px;
  color: #ffe066;
  font-size: 16px;
  text-shadow: 0 0 10px rgba(255, 224, 102, 0.6);
}

/* === HTML2CANVAS FIX === */
.is-capturing::before {
  display: none !important;
}

.is-capturing #resName,
.is-capturing #wrapmsg {
  background-image: none !important;
  -webkit-text-fill-color: #e3b6ff !important;
  color: #e3b6ff !important;
  text-shadow: none !important;
}

.is-capturing .wrap-card,
.is-capturing input {
  backdrop-filter: none !important;
  background-color: rgba(20, 20, 20, 0.95) !important;
}

.is-capturing #wrapmsg {
  display: none !important;
}

@media (max-width: 480px) {
  .wrap-page {
    min-height: auto;
    padding-bottom: 70px;
    height: auto;
    justify-content: flex-start; /* No centrar verticalment */
  }

  #logo {
    bottom: 15px;
    right: 15px;
    max-width: 60px;
  }

  #wrapmsg {
    font-size: 120px;
    bottom: auto;
    top: 100px; /* perquè no interfereixi amb el logo */
  }

  .wrap-card {
    padding: 10px;
    margin-bottom: 8px;
  }

  :root {
    --box-width: 95vw;
    --box-height: auto;
  }
}

