:root {
  --primary-color: #26393d;
  --blue: #376d79;
  --green: #dedf55;
  --bg_transparent: rgb(20,20,20,0.7);
  --pink: #e15891;
  --gold: #dfb52a;
  --orange: #f55b29;
  --bg-color1: #ffd0a5;
  --bg-color2: #fff3c6;
}

/* FONTS -----------------------------------------------*/

@font-face {
    font-family: 'Lilita One';
    src:
        url('fonts/LilitaOne-Regular.woff2') format('woff2'),
        url('fonts/LilitaOne-Regular.woff') format('woff'),
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: 'One Little Font';
    src:
        url('fonts/OneLittleFont-Alt-Bold.woff2') format('woff2'),
        url('fonts/OneLittleFont-Alt-Bold.woff') format('woff'),
    font-weight: 800;
    font-style: bold;
}

@font-face {
    font-family: 'One Little Font';
    src:
        url('fonts/OneLittleFont-Alt-Regular.woff2') format('woff2'),
        url('fonts/OneLittleFont-Alt-Regular.woff') format('woff'),
    font-weight: 400;
    font-style: normal;
}

/* GENERAL -----------------------------------------------*/

body {
    color: var(--primary-color);
    font-family: Arial, sans-serif;
    text-align: center;
    margin: 0;
    padding: 0;
    background-color: var(--green);
    background-image: url('/img/textura_fons2.png'), linear-gradient(var(--bg-color2), var(--bg-color2));
    background-repeat: repeat-y;
    background-size: 550px auto;
    background-position: center center;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

body.no-scroll {
    overflow: hidden;
}

.body-content {
    width: 550px;
    display: flex;
    flex-direction: column;
    align-items: center; /* Center horizontally */
    margin: 10px auto;
    margin-top: 0px;
    justify-content: center;
    text-align: center;
    position:relative;
}

@media (max-width: 550px) {
    .body-content {
        width: 95vw; /* Full width on very small screens */
    }
}

.container, .main-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

button {
    padding: 10px 26px;
    margin: 8px;
    cursor: pointer;
    font-size: 15pt;
    font-family: 'One Little Font';
    background: var(--orange);
    border: 2px solid var(--bg-color2);
    color: var(--bg-color2);
    border-radius: 100px;
    cursor: pointer;
    min-width: 120px;
}

button.inverted {
    background: var(--bg-color2);
    border: 2px solid var(--orange);
    color: var(--orange);
}

button.small {
    min-width: 45px;
    min-height: 45px;
    padding: 12px 16px;
}

.small-button-icon {
    width: 1.4em;
    height: 1.4em;
    vertical-align: middle;
}

button.hidden{
    display: none;
}

button.disabled {
    background: gainsboro;
    cursor: not-allowed;
    pointer-events: none; /* prevents clicks */
}

@media (hover: hover) {
    button:hover {
        border: 2px solid var(--primary-color);
    }
}

table td, th {
  border: 2px solid var(--primary-color);
  text-align: center;
  font-family: 'One Little Font';
}

table th {
  background: white;
  font-weight: normal;
  font-size: 20px;
  background: var(--orange);
  color:white;
  padding: 6px;
}

table td {
  background: white;
  color: var(--orange);
  font-size: 20px;
  padding: 4px;
}

input[type="text"] {
    padding: 11px;
    width: 250px;
    margin: 10px 0px;
    font-size: 10pt;
    border-radius: 6px;
    border: 1px solid var(--bg-color2);
}

ul {
    margin-top: 0px
}

a:visited {
    color: var(--blue);
}

a:link {
    color: var(--blue);
}

.input-with-button {
  display: flex;
  align-items: center;
  width: fit-content;
}

.input-with-button input[type="text"] {
  border-radius: 6px 0 0 6px; /* round only left corners */
  outline: none;
  margin-right: 0px;
  width: 200px;
}

.check-btn {
  min-width: 60px;
  height: 39.5px;
  border-left: none; /* connect with input */
  border-radius: 0 6px 6px 0; /* round only right corners */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0px 0px;
  margin: auto 0px;
}

@media (hover: hover) {
    .check-btn:hover {
        border: 2px solid var(--primary-color);
        border-left:2px solid var(--primary-color);
    }
}

.check-btn img {
  width: 20px;
}

.hidden {
    display: none;
}

/* PAGE ELEMENTS -----------------------------------------------*/

.main_title {
    font-family: 'Lilita One';
    text-align: center;
}

#index_title {
    font-size: 45px;
    color: white;
    text-shadow: 4px 3px 0px var(--primary-color);
    background-image: url('img/art_element1.png');
    background-repeat: no-repeat;
    background-size: 100% 100%;
    background-position: center center;
    padding: 17px 80px;
    padding-top: 24px;
    margin-bottom: 15px;
    margin-top: 25px;
}

#album_title {
    margin-bottom: -45px;
    margin-top: 15px;
    color: white;
    font-family: 'Lilita One';
    text-shadow: 6px 3px 0px var(--primary-color);
    background-image: url('img/art_element2.png');
    background-repeat: no-repeat;
    background-size: 100% 100%;
    background-position: center center;
    padding: 25px 20px;
    padding-bottom: 40px;
    width: 90%;
    line-height: 45px;
}

#album_title_a {
    font-size: 2.9em;
}

#album_title_b {
    font-size: 4.1em;
}

.point-text {
    margin: 0px 0px;
    margin-top: 10px;
    color: #333;
    line-height: 1.5;
    font-family: 'One Little Font';
    font-size: 1.5rem;
}

.error-message {
    color: var(--pink);
    background-color: #f8d7da;
    border: 1px solid var(--pink);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 10px;
    margin-top: -5px;
    width: 240px;
    text-align: left;
}

.error-message.hidden {
  display: none;
}

.footer_logos {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.image_pair {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: row;
    margin-bottom: -10px;
}

.logo {
    width: 150px;
    margin: 0px 20px;
}

#v_number {
    margin-top: -15px;
    margin-bottom: 0px;
    text-align: center;
    font-family: 'One Little Font';
}

#footer_links {
    margin-bottom: 80px;
    font-family: 'One Little Font';
    color: var(--blue);
}

/* FOOTER BAR -----------------------------------------------*/

.footer-bar-wrapper {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background-color: #ffffff;
  border-top: 2px solid #ccc;
  display: flex;
  justify-content: center;
  z-index: 999;
}

.footer-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 600px;
  padding: 5px 0;
}

.footer-item {
  font-size: 14.5pt;
  font-family: 'One Little Font';
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  justify-content: center;
  padding: 10px 0px;
  border-radius: 100px;
  margin: 5px;
}

.footer-item.small {
    flex: 0 0 20%;
}

.footer-item.disabled {
  pointer-events: none;
  opacity: 0.4;
  cursor: default;
}

.footer-item.hidden {
  display: none;
}

@media (hover: hover) {
    .footer-item:hover {
      background-color: var(--orange);
      cursor: pointer;
      color:white;
      border: 2px solid var(--primary-color);
      margin: 2px;
    }
}

.footer-icon {
    width: 1.3em;
    height: 1.3em;
    vertical-align: middle;
    margin-right: 0.1em;
}

.footer-divider {
  width: 2px;
  height: 50px;
  background-color: #ccc;
  margin: -14px 0;
}

.footer-divider.hidden {
  display: none;
}

/* LOGIN -----------------------------------------------*/

.login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--green);
  background-image: url('/img/textura_fons1.png');
  background-repeat: no-repeat;
  background-size: 550px;
  background-position: center center;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.login-overlay.hidden {
  display: none;
}

.login-overlay.recover {
  z-index: 10000;
  height: 100%;
  background-image: none;
  background: var(--bg_transparent);
}

#login_title {
    margin: 10px auto;
    width: 400px;
    font-family: 'Lilita One';
    text-shadow: 6px 3px 0px var(--primary-color);
    text-align: center;
    color: white;
    background-image: url('img/art_element2.png');
    background-repeat: no-repeat;
    background-size: 90% 100%;
    background-position: center center;
    padding: 15px 0px;
    padding-top: 30px;
    margin-top: 25px;
}

#login_title_a {
    font-size: 2.9em;
}

#login_title_b {
    font-size: 4.1em;
}

#nameInputSection {
    margin-top: -70px;
}

#recoverInputSection {
    background-color: var(--bg-color1);
    width: 100%;
    height: 30%;
}

#noConnectionSection {
    background-color: var(--orange);
    width: 100%;
    height: 20%;
}

#connection_error {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    color: white;
    font-weight: bold;
    font-family: 'One Little Font';
    margin: 0px;
    line-height: 30px;
}

#connection_error_subtitle {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    color: white;
    font-weight: normal;
    font-family: 'One Little Font';
    margin: 0px;
}

#qui_ets {
    margin-bottom: 1px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    color: var(--primary-color);
    font-weight: normal;
    font-family: 'One Little Font';
}

#loginForm {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

#passwordInput {
    -webkit-text-security: disc;
    margin: 0px 0px;
    margin-bottom: 10px;
}

.login-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: row;
}

/* RANKING -----------------------------------------------*/

.ranking-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--green);
  background-image: url('/img/textura_fons2.png'), linear-gradient(var(--green), var(--bg-color2));
  background-repeat: no-repeat;
  background-size: 550px;
  background-position: center center;
  display: flex;
  justify-content: center;
  align-items: start;
  z-index: 8999;
  overflow-y: auto;
}

.ranking-overlay.hidden {
  display: none;
}

#close-ranking {
  top: 5px;
  right: 5px;
}

#ranking_title {
    margin-top: 25px;
    margin-bottom: 5px;
    font-size: 3em;
    font-family: 'Lilita One';
    text-shadow: 7px 3px 0px var(--primary-color);
    color: white; 
}

#nikname-section {
   margin-top: 0px;
   margin-bottom: 10px;
   background-color: var(--bg-color2);
   width: 100vw;
   max-width: 550px;
   padding: 0px 0px;
   padding-bottom: 10px;
}

#nikname_title {
    margin-top: 8px;
    margin-bottom: -10px;
    flex-direction: column;
    align-items: left;
    font-weight: normal;
    font-family: 'One Little Font';
}

.game-data {
  width: 90%;
  text-align: center;
  margin-bottom: 15px;
}

.ranking-table {
  width: 100%;
  margin-bottom: 5px;
  border-collapse: collapse;
  border: 2px solid var(--primary-color);
  box-shadow: 8px 8px 0px var(--pink);
}

.ranking-table thead {
  background: white;
  font-weight: bold;
  font-size: 20px;
  background: var(--orange);
  color:white;
}

.ranking-table th:nth-child(1) {
  width: 12%;
}

.ranking-table th:nth-child(3) {
  width: 27%;
}

.winner-table {
  width: 100%;
  margin-bottom: 25px;
  border-collapse: collapse;
  border: 2px solid var(--primary-color);
  box-shadow: 8px 8px 0px var(--pink);
}

.winner-table th:nth-child(1) {
  width: 40%;
  height: 30px;
  line-height: 25px;
}


/* POPUP:GENERIC -----------------------------------------------*/

.popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: calc(100% - 64px); /* Leaves space for footer */
    background: var(--bg_transparent);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.popup.hidden {
  display: none;
}

.popup-content {
    position: relative; /* Ensures the close button is positioned inside */
    background-color: var(--bg-color1);
    padding: 12px;
    padding-top: 2px;
    border-radius: 10px;
    text-align: center;
    width: 450px;
    max-width: 83%;
    box-shadow: 10px 10px 0px var(--primary-color);
}

.popup-content.normal {
    background-color: white;
}

.close-popup {
    position: absolute;
    top:-25px;
    right:-25px;
    min-width: 46px;
    min-height: 46px;
    max-width: 46px;
    max-height: 46px;
    padding: 7px;
    z-index: 11; /* Ensure it's on top */
}

.close-popup.login {
    position: absolute;
    top:0px;
    right:10px;
}

#close-popup-sticker {
    top:-35px;
    right:-35px;
}

.close-popup img {
    width: 20px;
}

.close-popup-wrapper {
  display: inline-block;
  position: relative;
}

.close-popup-wrapper::before {
  content: "";
  position: absolute;
  top: -20px; bottom: -20px; left: -20px; right: -20px;
  pointer-events: auto;
}

.popupTitle {
    margin-top: 40px;
    margin-bottom: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    font-family: 'One Little Font';
    font-weight: normal;
}

/* POPUP:INFO -----------------------------------------------*/

#infoPopup {
    z-index: 3;
    widt
}

#infoTextContainer {
    height: 60vh;
    overflow-y: auto;
    margin-bottom: 20px;
    align-items: flex-start;
    padding: 8px;
}

.info-title {
    margin: 20px 0px;
    text-align: left;
    line-height: 1.2;
    font-weight: bold;
    font-size: 1.75em;
}

.info-small-title {
    margin: 10px 0px;
    text-align: left;
    line-height: 0.5;
    font-weight: bold;
    font-size: 1.3em;
}

.info-text {
    margin: 20px 0px;
    text-align: left;
    color: #333;
    line-height: 1.5;
    color: var(--blue);
}

/* POPUP:STICKER -----------------------------------------------*/

#stickerInfoPopup{
    z-index: 3;
}

.stiker-popup-content {
    position: relative; /* Ensures the close button is positioned inside */
    background-color: gainsboro;
    padding: 10px;
    padding-top: 50px;
    border-radius: 0px;
    text-align: center;
    width: 450px;
    max-width: 90%;
    aspect-ratio: 5.5 / 7.5;
    font-size: 14pt;
    border: 12px solid white;
    background-size: 100% 100%; /* options are cover or contain */
    background-position: center;
    background-repeat: no-repeat;
    box-sizing: border-box;
    align-items: flex-start;
}

.stiker-popup-content.small {
    aspect-ratio: auto;
}

@media (max-width: 550px) {
  #stickerInfoPopupContent {
    font-size: 16px;
  }
}

#stickerInfoPopupContent {
    word-wrap: break-word;
    overflow-wrap: break-word;
    padding: 5px;
    box-sizing: border-box;
    max-height: calc(122vw - 80px);
    overflow-y: auto;
}

#showPistes {
    position: absolute;
    top: 95%;
    left: 50%;
    transform: translateX(-50%);
}

.point-value {
    position: absolute;
    top: -12%;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    ont-weight: bold;
    font-size: 1.5em;
    margin-bottom: 4px;
    font-family: 'One Little Font';
    width:100%;
    overflow: hidden;
}

.point-value.hidden {
    display: none;
}

.premi-value {
    position: absolute;
    bottom: -14%;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    ont-weight: bold;
    font-size: 1.5em;
    margin-bottom: 4px;
    font-family: 'One Little Font';
    width:100%;
    overflow: hidden;
}

/* POPUP:STIKER PISTES -----------------------------------------------*/
#locked-number-popup {
    position: absolute;
    top: 8px;
    left: 8px;
    color: white;
    font-size: 30px;
    font-weight: bold;
    padding: 2px 6px;
    z-index: 5;
    margin-bottom: 20px;
}

#sticker-code {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translate(-50%, 0%);
    white-space: nowrap;
    font-size: 28px;
    padding: 2px 6px;
    z-index: 5;
    font-family: 'One Little Font';
}

.pista {
    margin-bottom: 20px;
    text-align: left;
}

.pista-title {
    font-weight: bold;
    font-size: 1.5em;
    margin-bottom: 0px;
    font-family: 'One Little Font';
    line-height: 25px;
}

.pista-text {
    color: var(--blue);
    line-height: 1.6;
    font-size: 1.1em;
}

.premi-text {
    
    color: var(--blue);
    line-height: 1.5;
    font-size: 1.1em;
}

.censored-text {
    height: 75px;
    overflow: hidden;
    text-align: left;
    font-family: monospace;
    line-height: 1.4;
    color: transparent;

    background-image: url('img/art_element3.png');
    background-repeat: no-repeat;
    background-size: 100% 65%;
    background-position: center center;
    padding: 25px 20px;
    margin-top: -20px;
}

.censored-container {
    position: relative;
}

.unlock-overlay {
    position: absolute;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(255, 255, 255, 0.9);
    color: var(--blue);
    border: 1px solid var(--primary-color);
    padding: 6px;
    border-radius: 5px;
    font-size: 16px;
    text-align: center;
    white-space: nowrap;
}

.unlock-overlay.button {
    background-color: var(--orange);
    color: var(--bg-color2);
    border-color: var(--bg-color1);
    margin-left: 0px;
}

@media (hover: hover) {
    .unlock-overlay.button:hover {
        border: 2px solid var(--primary-color);
    }
}

/* STICKER GRID -----------------------------------------------*/

.sticker-grid {
    display: grid;
    justify-items: ;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    width: 100%;
    max-width: 500px;
    margin: 0px auto;
    margin-bottom: 35px;
}

.sticker-grid > :nth-child(odd) {
    justify-self: end; /* Left column aligns right */
}

.sticker-grid > :nth-child(even) {
    justify-self: start; /* Right column aligns left */
}

.sticker {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 90%;
    aspect-ratio: 5.5 / 7.5;
    border: 8px solid white;
    border-radius: 0px;
    background-color: #ccc;
    
    box-shadow: 8px 8px 3px rgba(20,20,20,0.65);
    background-size: 100% 100%; /* options are cover or contain */
    background-position: center;
    background-repeat: no-repeat;
    transition: transform 0.4s ease, box-shadow 0.4s ease, filter 0.4s ease, opacity 0.4s ease;
    position: relative;
}

.sticker.locked {
    filter: grayscale(100%);
    opacity: 0.6;
}

.sticker.unlocked {
    filter: none;
    opacity: 1;
}

.locked-number {
    position: absolute;
    top: 4px;
    left: 4px;
    color: white;
    font-size: 25px;
    font-weight: bold;
    padding: 2px 6px;
}

.lock-icon {
    width: 25%;
    display: block;
    margin: 0 auto;
    margin-bottom: 5px;
}

.pista-icon {
    width: 20%;
    display: block;
    margin: 0 auto;
    margin-bottom: 5px;
}

.sponsor-icon {
    width: 60%;
    aspect-ratio: 1 / 0.45;
    object-fit: scale-down;
    position: absolute;
    bottom: 2%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 5px;
}

.sponsor-img {
    width: 70%;
    object-fit: scale-down;
    position: relative;
}

.pista-label {
    margin-top: 0;
    font-size: 1.4rem;
    color: #333;
    text-align: center;
    font-family: 'One Little Font';
}

.countdown {
    font-size: 1.1rem;
    font-weight: bold;
    color: #ffffff;
    background-color: var(--primary-color);
    padding: 4px 8px;
    border-radius: 6px;
    text-align: center;
    display: inline-block;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    transition: background-color 0.3s ease;
}

/* TERMS AND CONDITIONS -----------------------------------------------*/

.text-content {
    width: 95%;
    display: flex;
    flex-direction: column;
    align-items: center; /* Center horizontally */
    justify-content: center;
    text-align: justify;
    text-justify: inter-word;
    position: relative;
}

.text-content p {
  width:100%;
  text-align: justify;
}

.text-content li {
    margin-top: 10px;
}

#terms-text {
    width: 65%;
    font-family: "One Little Font";
}

/* DASHBOARD -----------------------------------------------*/

.game-data h3 {
  font-family: 'Lilita One';
  text-shadow: 3px 2px 0px var(--bg-color1);
  margin-bottom: 10px;
  font-size: 25px;
  text-align: left;
}

.metric-card {
  background: var(--bg-color1);
  border: 2px solid var(--primary-color);
  box-shadow: 6px 6px 0px var(--orange);
  border-radius: 12px;
  width: 54%;
  margin: 15px auto;
  padding: 5px;
  text-align: center;
  color: var(--primary-color);
  margin-bottom: 30px;
}

.metric-card h2{
  margin: 5px;
}

.metric-value {
  font-size: 50px;
  color: var(--orange);
  text-shadow: 2px 2px 0px var(--primary-color);
  font-family: 'One Little Font';
  margin: 0px;
}

.metrics-table, .stickers-table {
  width: 100%;
  margin-bottom: 30px;
  border-collapse: collapse;
  border: 2px solid var(--primary-color);
  box-shadow: 8px 8px 0px var(--green);
}

.stickers-table thead {
  background: white;
  font-weight: bold;
  font-size: 20px;
  background: var(--orange);
  color:white;
}

.metrics-table th:nth-child(1) {
  width: 60%;
}

.stickers-table th:nth-child(1) {
  width: 25%;
}

.stickers-table th:nth-child(2) {
  width: 50%;
}

/* LOADING OVERLAY -----------------------------------------------*/

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--green);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.loading-overlay.hidden {
  display: none;
}

.loading-text {
  font-size: 35px;
  font-family: 'One Little Font';
  text-align: center;
  color: white;
  margin-top: 0px;
}

.loading-gif {
    width: 275px;
    height: auto;
    margin-bottom: -45px;
}

/* ANIMACIONS:UNLOCK -----------------------------------------------*/

.sticker.highlight-unlock {
    transform: scale(1.2);
    box-shadow: 0 0 15px 5px gold;
    filter: grayscale(0%);
    opacity: 1;
}

.sticker.start-state {
    filter: grayscale(100%);
    opacity: 0.5;
    transform: scale(1);
}

.reveal-animation {
    animation: unlockBounce 2s ease-in-out forwards;
    box-shadow: 0 0 15px 5px gold;
}

.reveal-animation.fade-out {
    box-shadow: none;
}

@keyframes unlockBounce {
    0% {
        transform: scale(1);
        filter: grayscale(100%);
        opacity: 0.5;
    }
    30% {
        transform: scale(1.2);
        filter: grayscale(0%);
        opacity: 1;
    }
    60% {
        transform: scale(0.95);
    }
    100% {
        transform: scale(1);
        filter: none;
        opacity: 1;
    }
}

/* ANIMACIONS:CONFETI -----------------------------------------------*/

@keyframes fall {
    60% { opacity: 0.85; }
    100% { top: 100vh; opacity: 0; }
}

.confetti {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9990;
}

.flake {
    position: absolute;
    top: 0;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    opacity: 1;
    animation: fall cubic-bezier(0.2, 0, 1, 0.75) forwards;
}