body {
  font-family: "Montserrat", Arial, sans-serif;
  background: #f3f6fb;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

.main-card {
  background: rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(8px) saturate(1.2);
  border-radius: 18px;
  box-shadow: 0 4px 32px #b2d8d830;
  padding: 32px 28px 28px 28px;
  margin-top: 36px;
  max-width: 420px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  border: 1.5px solid #b2d8d8;
}

h1#mainTitle {
  text-align: center;
  font-family: "Montserrat", Arial, sans-serif;
  color: #3a506b;
  letter-spacing: 1.5px;
  margin-bottom: 18px;
  font-size: 2.3em;
  font-weight: 800;
  text-shadow: 0 2px 8px #b2d8d850;
}

#hero-anim {
  width: 70px;
  height: 70px;
  margin: 0 auto 10px auto;
  display: block;
  background: #f7fafc;
  border-radius: 50%;
  box-shadow: 0 2px 8px #b2d8d850;
  object-fit: contain;
  border: 2px solid #b2d8d8;
}

.form-group {
  margin-bottom: 16px;
  width: 100%;
}

label {
  display: block;
  margin-bottom: 6px;
  color: #3a506b;
  font-weight: 600;
  font-size: 1em;
}

input,
select {
  width: 100%;
  padding: 10px;
  border: 1px solid #b0bec5;
  border-radius: 7px;
  font-size: 1em;
  background: #f7fafc;
  transition: border 0.2s;
  margin-bottom: 2px;
}

input:focus,
select:focus {
  border: 1.5px solid #3a506b;
  outline: none;
  background: #fff;
}

button {
  background: linear-gradient(90deg, #b2d8d8 0%, #f7cac9 100%);
  color: #3a506b;
  padding: 13px 0;
  border: none;
  border-radius: 7px;
  font-size: 1.1em;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 8px #b2d8d850;
  transition: background 0.2s, box-shadow 0.2s;
  margin-top: 10px;
  width: 100%;
}

button:hover {
  background: linear-gradient(90deg, #f7cac9 0%, #b2d8d8 100%);
  box-shadow: 0 4px 16px #b2d8d880;
}

.results {
  margin-top: 28px;
  border: 1.5px solid #b2d8d8;
  background: #f8fafc;
  padding: 22px 18px;
  border-radius: 12px;
  box-shadow: 0 2px 12px #b2d8d830;
}

.table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

th,
td {
  padding: 10px 8px;
  text-align: left;
  border-bottom: 1px solid #e3eafc;
  font-size: 1em;
}

th {
  background: #e3f2fd;
  color: #3a506b;
  font-weight: 700;
}

#benchmarkResults {
  border: 2px dashed #b2d8d8;
  background: #f7fafc;
}

#festa {
  font-size: 2em;
  color: #fff;
  background: linear-gradient(90deg, #43a047, #1976d2, #ffd600, #e91e63);
  padding: 20px;
  border-radius: 10px;
  text-align: center;
  box-shadow: 0 0 20px #43a04780;
  animation: festaAnim 1s infinite alternate;
  margin-top: 18px;
}

@keyframes festaAnim {
  0% {
    filter: brightness(1);
  }
  100% {
    filter: brightness(1.5);
  }
}

.bg-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: -1;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
}

.bg-tile {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#langBox {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  font-family: "Montserrat", sans-serif;
}

.lang-selector {
  position: relative;
  display: inline-block;
}

.lang-current {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 10px 15px;
  border: none;
  border-radius: 25px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  gap: 8px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.lang-current:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.lang-current::after {
  content: "▼";
  font-size: 10px;
  transition: transform 0.3s ease;
}

.lang-selector.open .lang-current::after {
  transform: rotate(180deg);
}

.lang-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-radius: 15px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 140px;
  margin-top: 8px;
}

.lang-selector.open .lang-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.lang-btn {
  display: block;
  width: 100%;
  padding: 12px 16px;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
  font-weight: 500;
  color: #333;
  display: flex;
  align-items: center;
  gap: 10px;
}

.lang-btn:hover {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  transform: translateX(5px);
}

.lang-btn.active {
  background: linear-gradient(135deg, #ff6b6b, #feca57);
  color: white;
  font-weight: 600;
}

.lang-btn.active:hover {
  background: linear-gradient(135deg, #ff5252, #ffc107);
}

@media (max-width: 600px) {
  #langBox {
    top: 15px;
    right: 15px;
  }

  .lang-current {
    padding: 8px 12px;
    font-size: 13px;
  }

  .lang-dropdown {
    min-width: 120px;
  }

  .lang-btn {
    padding: 10px 14px;
    font-size: 13px;
  }
}

.main-card {
  position: relative;
}

.letter-card {
  display: none;
  position: fixed;
  top: 100px;
  right: 50px;
  width: 300px;
  min-height: 300px;
  max-height: 80vh;
  padding: 20px;
  border-radius: 12px;
  background: linear-gradient(90deg, #f7cac9 0%, #b2d8d8 100%);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  border: 3px solid #fff;
  color: #3a506b;
  font-size: 1em;
  line-height: 1.5;
  text-align: left;
  overflow-y: auto;
  z-index: 100;
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.4s ease-out,
    transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.letter-card.visible {
  display: block;
  opacity: 1;
  transform: translateX(0);
}

.letter-card h3 {
  margin-top: 0;
  border-bottom: 2px solid #fff;
  padding-bottom: 10px;
  margin-bottom: 15px;
}

.details-container {
  margin-top: 20px;
  width: 100%;
}

.details-toggle {
  background: #f0f5f9;
  border: 1px solid #b0bec5;
  border-radius: 7px;
  padding: 8px 15px;
  cursor: pointer;
  font-weight: 600;
  color: #3a506b;
  width: 100%;
  text-align: left;
  transition: background-color 0.2s;
}

.details-toggle:hover {
  background: #e3eef5;
}

.details-content {
  margin-top: 10px;
  border: 1px solid #b0bec5;
  border-radius: 7px;
  padding: 15px;
  background: #f9fcff;
}

#detailsTable {
  width: 100%;
  border-collapse: collapse;
}

#detailsTable th,
#detailsTable td {
  padding: 8px;
  text-align: left;
  border-bottom: 1px solid #eaeef1;
}

#detailsTable th {
  color: #3a506b;
  font-weight: 600;
}

/* Animazione per rotazione del + quando il menu è aperto */
.details-toggle.open::first-letter {
  display: inline-block;
  transform: rotate(45deg);
}

@media (max-width: 1100px) {
  .letter-card {
    position: static;
    width: calc(100% - 20px);
    margin: 20px auto;
    max-width: 420px;
    transform: translateY(20px);
  }

  .letter-card.visible {
    transform: translateY(0);
  }
}
