/* finální root */
.final-root {
  display: block;
  padding: 0;
  background-color: #fafafa;
}

.final-cards-container,
#results-view,
#main-screen,
.selection-bar {
  width: 100%;
  max-width: 100%;
}

/* Přilepená horní lišta, roste podle obsahu */
.selection-bar {
  position: fixed;
  top: env(safe-area-inset-top, 0);
  left: 0;
  right: 0;
  z-index: 1000;

  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;

  padding: 0.5rem 12px;
  padding-top: calc(0.5rem + env(safe-area-inset-top));
  padding-bottom: 12px;

  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(150%) blur(6px);
  border-bottom: 1px solid #e9e9e9;

  box-sizing: border-box;
}

.selection-count {
  flex-basis: 100%;    
  text-align: center;  
  font-weight: 700;
}

.chips {
  display: flex;
  gap: 0.5rem;
  flex: 1 1 100%;
  flex-wrap: wrap;
  justify-content: center;
  margin-left: 0;
  margin-bottom: 5px;
  margin-right: 0;
}

/* pruh progress bar */
.selection-bar::after {
  content: "";
  position: absolute;
  left: max(12px, env(safe-area-inset-left));
  right: max(12px, env(safe-area-inset-right));
  bottom: 6px;

  height: 6px;
  border-radius: 999px;
  display: block;

  background: linear-gradient(
    to right,
    #ffcc00 0 var(--fav-progress, 0%),
    #f2f2f2 0 100%
  );

  pointer-events: none;
}

/* grid karet */
.final-cards-container {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 30px;
  padding: 12px;
  margin-bottom: 100px;
}

.final-card {
  position: relative;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  padding: 12px;
  border: 2px solid #000;
  min-width: 160px;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  transition: transform 0.2s ease;
}
.final-card:hover {
  transform: translateY(-2px);
}

.final-card ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  text-align: center;
  word-break: break-word;
}

.final-card .highlighted {
  font-weight: 800;
  color: #99115C;
  font-size: 1.2rem;
  margin-bottom: 0.25rem;
}

.final-card li {
  font-size: 0.95rem;
}

.star-icon {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  fill: none;
  stroke: #ffcc00;
  stroke-width: 2;
  cursor: pointer;
  transition: fill 0.2s ease-in-out;
}

.star-icon:focus {
  outline: none;
}

.star-icon:hover {
  transform: scale(1.05);
}

.star-icon.selected {
  fill: #ffcc00 !important;
}

#showResultsBtn {
  position: fixed;
  bottom: 3%;
  left: 50%;
  transform: translateX(-50%);
  padding: 14px 20px;
  background-color: #99115C;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  transition: background-color 0.3s ease, transform 0.2s ease;
  z-index: 999;
}

#showResultsBtn:hover {
  background-color: #AD2C70;
  transform: translateX(-50%) scale(1.05);
}

#showResultsBtn:active {
  transform: translateX(-50%) scale(0.95);
}

/* mobilní doladění */
@media (max-width: 600px) {
  .final-cards-container {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
    gap: 8px;
    padding-left: 4px; 
    padding-right: 4px; 
  }

  .final-card {
    min-height: 150px;
    padding: 8px;
    max-width: none;
  }

  .final-card ul {
    word-break: break-word;
    overflow-wrap: anywhere;
    hyphens: auto;
  }

  .final-card .highlighted {
    font-size: clamp(0.95rem, 3.5vw, 1.05rem);
  }
  .final-card li {
    font-size: clamp(0.8rem, 3.2vw, 0.95rem);
  }

  .star-icon {
    width: 24px;
    height: 24px;
    top: 6px;
    right: 6px;
  }
}

/* extra úzké telefony */
@media (max-width: 360px) {
  .final-cards-container {
    grid-template-columns: 1fr;
  }
}