body {
  font-family: Arial, sans-serif;
  background: #f7f7f7;
  margin: 0;
  padding: 0;
}

.container {
  background: #fff;
  width: 90%;
  max-width: 600px;
  margin: 50px auto;
  padding: 30px;
  border-radius: 10px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-sizing: border-box;
  transition: min-height 0.3s ease; /* smooth adjustment */
}

/* Buttons */
button {
  background-color: #007bff;
  color: white;
  border: 2px solid transparent; /* ← reserve space */
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  transition: background-color 0.2s, transform 0.1s;
}

button:hover:not(.selected) {
  background-color: #d0e6ff;
}

button.selected {
  background-color: #4caf50;
  color: white;
  border: 2px solid #388e3c;
}

/* Category and Size Lists */
.category-list,
.size-list {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  margin-top: 20px;
}

.category-btn,
.size-btn {
  background-color: #007bff;
  color: white;
  border: 2px solid transparent; /* reserve space for selection border */
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  width: 100%;
  text-align: left;
  transition: background-color 0.2s, transform 0.05s;
}

.category-btn.selected,
.size-btn.selected {
  background-color: #4caf50;
  border: 2px solid #388e3c;
}

/* === Compare Sidebar === */
.sidebar {
  position: fixed;
  top: 0;
  right: -320px; /* hidden off-screen */
  width: 300px;
  height: 100%;
  background-color: #007bff; /* theme blue */
  color: white; /* white text for contrast */
  border-left: 2px solid #ccc;
  box-shadow: -4px 0 8px rgba(0, 0, 0, 0.1);
  padding: 16px;
  overflow-y: auto;
  transition: right 0.3s ease;
  z-index: 100;
}

.sidebar.open {
  right: 0;
}

.sidebar h3 {
  margin-top: 0;
  border-bottom: 1px solid #ccc;
  padding-bottom: 8px;
  text-align: center;
}

.sidebar-toggle {
  position: fixed;
  right: 10px;
  top: 10px;
  background: #007bff;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 8px 14px;
  cursor: pointer;
  z-index: 101;
  transition: background 0.2s;
}

.sidebar-toggle:hover {
  background: #0056b3;
}

.person-logo {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  vertical-align: middle;
  margin-right: 8px;
  object-fit: contain;
}

.result-person {
  display: flex;
  align-items: center;
  gap: 6px;
}

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
}

.container {
  min-height: 400px; /* a safe default */
  display: flex;
  flex-direction: column;
  justify-content: flex-start; /* don't distribute space automatically */
  align-items: center;
  box-sizing: border-box;
  background: #fff;
  max-width: 600px;
  margin: 0 auto;
  padding: 30px;
  border-radius: 10px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  position: relative; /* for footer absolute positioning */
}

footer {
  position: absolute;
  bottom: 30px; /* matches container padding */
  left: 0;
  width: 100%;
  display: flex;
  justify-content: center;
  gap: 10px;
}

main {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

button:disabled {
  background-color: #ccc !important;
  color: #666 !important;
  cursor: not-allowed;
  border: none;
}

.question-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  width: 100%;
  margin-bottom: 20px;
}

.question-progress {
  color: #666;
  font-size: 15px;
}

.question-category {
  font-style: italic;
  color: #555;
  font-size: 15px;
}

/* exact bottom alignment for Yes/No and significance 10 */
/* === FORCE exact horizontal + vertical alignment for question layout === */

/* Ensure question + significance are on same top line */
.quiz-row {
  display: flex !important;
  align-items: flex-start !important;
  justify-content: space-between;
  gap: 40px;
  width: 100%;
  position: relative;
}

/* Left column (question + yes/no) */
.quiz-row .left {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between; /* question top, yes/no bottom */
  text-align: left;
  min-height: 320px; /* controls vertical alignment area */
}

/* Question text aligns with significance heading */
.question-text {
  margin: 0 0 16px 0;
  line-height: 1.4;
  font-size: 1.2rem;
}

/* Right column (significance) */
.quiz-row .right {
  width: 140px;
  display: flex;
  flex-direction: column;
  justify-content: space-between; /* title top, form bottom */
  align-items: center;
  text-align: center;
  height: 100%;
}

/* Title aligns with question text */
.significance-title {
  margin: 0 0 8px 0;
  line-height: 1.1;
}

/* Form fills the rest, bottom aligns with yes/no buttons */
#significanceForm {
  display: flex;
  flex-direction: column;
  justify-content: flex-end; /* make last radio flush to bottom */
  align-items: center;
  gap: 6px;
  flex-grow: 1;
}

/* Yes/No buttons bottom flush with significance form bottom */
.controls {
  display: flex;
  justify-content: flex-start;
  align-self: flex-start;
  gap: 10px;
  margin: 0;
  padding: 0;
}

/* Buttons consistent size */
.controls button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Ensure radios don't have extra margins */
#significanceForm label {
  margin: 0;
  padding: 0;
  line-height: 1.2;
}

/* Responsive */
@media (max-width: 600px) {
  .quiz-row {
    flex-direction: column;
    align-items: stretch;
    gap: 20px;
  }

  .quiz-row .left {
    align-items: flex-start;
  }

  .quiz-row .right {
    width: 100%;
    justify-content: flex-start;
  }

  .controls {
    justify-content: flex-start;
  }

  /* Keep the significance scale vertical and centered */
  #significanceForm {
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
  }
}

/* === Score row spacing: left (name+logo) grows, right (score) fixed === */
.result-list .result-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px; /* keep same visual padding */
}

/* Left column (logo + name) takes remaining space, but allow truncation */
.result-list .result-row > .result-person {
  flex: 1 1 auto;
  min-width: 0; /* allow flex shrink for ellipsis */
}

/* Ensure the name text doesn't push into the score: allow ellipsis if too long */
.result-list .result-row > .result-person span {
  display: inline-block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Right column (score) stays its own width and is right aligned */
.result-list .result-row > div:last-child {
  flex: 0 0 auto;
  margin-left: 12px;
  text-align: right;
  white-space: nowrap;
}

/* Slightly larger gap between rows for readability */
.result-list .result-row + .result-row {
  margin-top: 6px;
}
