.pulse-page {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  padding: 2rem 3rem;
  color: #333;
  background: #faf7f6;
}

.pulse-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.date-pill.pulse-select {
  border: none;
  background: #fff;
  border-radius: 999px;
  padding: 0.6rem 2.4rem 0.6rem 1.4rem;  /* extra right padding for arrow */
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  font-size: 0.9rem;
  appearance: none;              /* hide native arrow */
  -moz-appearance: none;
  -webkit-appearance: none;
  position: relative;
}

/* wrapper so we can place the arrow */
.pulse-picker {
  position: relative;
  display: inline-block;
}

/* custom arrow */
.pulse-picker::after {
  content: "▾";
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.5rem;
  color: #777;
  pointer-events: none;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.score-section h2 {
  text-align: center;
  margin-bottom: 1.5rem;
}

.score-cards {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  margin-bottom: 1rem;
}

.score-card {
  background: #fff;
  border-radius: 12px;
  padding: 1.5rem 2rem;
  text-align: center;
  min-width: 140px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.score-card.big .score-value {
  font-size: 3rem;
}

.score-value {
  font-size: 2rem;
  font-weight: 600;
  color: #287f7b;
}

.score-label {
  font-size: 0.8rem;
  color: #777;
}

.history-section {
  margin-top: 2.5rem;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.range-toggle {
  display: inline-flex;
  background: #f3f3f5;
  border-radius: 999px;
  padding: 2px;
  gap: 2px;
}

.range-pill {
  padding: 0.35rem 0.9rem;
  font-size: 0.8rem;
  color: #555;
  text-decoration: none;
  border-radius: 999px;
}

.range-pill.active {
  background: #ffffff;
  color: #222;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

.history-chart {
  background: #ffffff;
  border-radius: 12px;
  padding: 1rem 1.5rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);

  display: flex;
  gap: 0.75rem;
  align-items: flex-end;

  max-width: 900px;        /* fixed area */
  overflow: hidden;        /* prevent page extending horizontally */
}

.bar-column {
  flex: 1 1 auto;
  min-width: 40px;         /* small but visible */
  text-align: center;
}

.bar-wrapper {
  height: 140px;           /* fixed chart height */
  display: flex;
  align-items: flex-end;
}

.bar {
  width: 100%;
  background: #50b59a;
  border-radius: 8px 8px 0 0;
  position: relative;
}

.bar-value {
  position: absolute;
  bottom: 4px;
  left: 0;
  right: 0;
  font-size: 0.75rem;
  color: #fff;
}

.bar-label {
  margin-top: 0.3rem;
  font-size: 0.7rem;
  color: #666;
}

.no-history {
  font-size: 0.85rem;
  color: #777;
}

.pulse-results {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 2rem;
  margin-top: 3rem;
  align-items: flex-start;
}

.left-scores .score-box {
  background: #fff;
  border-radius: 12px;
  padding: 1rem 1.2rem;
  margin-bottom: 1rem;
  text-align: left;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.left-scores .big {
  font-size: 2.2rem;
  font-weight: 600;
  color: #287f7b;
}

.questions-table {
  background: #fff;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.question-row {
  display: grid;
  grid-template-columns: 2.5fr 4fr auto;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.question-text {
  font-size: 0.9rem;
}

.stack-bar {
  display: flex;
  height: 26px;
  border-radius: 999px;
  overflow: hidden;
}

.stack-segment {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: #fff;
}

.pulse-picker {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.pulse-select {
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  border: 1px solid #ddd;
  font-size: 0.85rem;
  background: #fff;
}

 .stack-bar {
  display: flex;
  width: 100%;
  height: 18px;
  border-radius: 999px;
  overflow: hidden;
}

/* segment colors for 1..5 */
.seg-1 { background: #f7b5b5; } /* 1 */
.seg-2 { background: #fcd6a4; } /* 2 */
.seg-3 { background: #f5e9b8; } /* 3 */
.seg-4 { background: #add8b1; } /* 4 */
.seg-5 { background: #9fa5ff; } /* 5 */


.fun-1 { background:#9fa5ff; }  /* first option */
.fun-2 { background:#f7b5b5; }  /* second option */
.fun-3 { background:#fcd6a4; }
.fun-4 { background:#add8b1; }



.stack-segment {
  height: 100%;
  position: relative;
  font-size: 0.75rem;
  color: #133;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stack-legend {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.4rem;
  font-size: 0.8rem;
  color: #444;
}

.stack-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.stack-legend-wrapper {
  margin-top: 0.8rem;
  display: flex;
  justify-content: center;
}


.legend-swatch {
  width: 14px;
  height: 8px;
  border-radius: 999px;
}

.avg-pill {
  background: #f1f1f7;
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  font-size: 0.8rem;
  font-weight: 600;
}


.feedback-section {
  margin-top: 3rem;
}

.feedback-header h2 {
  font-size: 1.1rem;
  margin: 0.1rem 0 0.2rem;
}

.feedback-subtitle {
  font-size: 0.85rem;
  color: #6b7280;
  margin-bottom: 1.2rem;
}

/* Responsive “treemap-like” layout */
.feedback-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: 140px;
  gap: 0.75rem;
}

/* default tile style */
.feedback-tile {
  border-radius: 20px;
  padding: 1.2rem 1rem;
  color: #fff;
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

/* approximate the layout in your screenshot: first tile large, etc. */
.feedback-tile-1 {
  grid-column: span 1;
  grid-row: span 2;
  background: #f5a9d8;
}

.feedback-tile-2 {
  background: #fce59a;
}

.feedback-tile-3 {
  grid-column: span 2;
  grid-row: span 2;
  background: #b7dde7;
}

.feedback-tile-4 {
  background: #c9b3f2;
}

.feedback-tile-5 {
  background: #9ca7ff;
}

.feedback-percent {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.feedback-label {
  font-size: 0.8rem;
  line-height: 1.3;
}

/* small screens */
@media (max-width: 900px) {
  .feedback-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: 120px;
  }
  .feedback-tile-1,
  .feedback-tile-3 {
    grid-column: span 2;
    grid-row: span 1;
  }
}

.challenge-section {
  margin-top: 3rem;
}

.challenge-section h2 {
  font-size: 1.1rem;
  margin-bottom: 0.4rem;
}

.challenge-subtitle {
  font-size: 0.85rem;
  color: #6b7280;
  margin-bottom: 1.2rem;
}

.challenge-row {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 1.2rem;
  margin-bottom: 1rem;
  background: #fbf9fb;
  border-radius: 20px;
  padding: 0.8rem 1rem;
}

.challenge-left {
  background: #f5e6ff;
  border-radius: 16px;
  padding: 1.1rem 1rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: left;
}

.challenge-percent {
  font-size: 1.7rem;
  font-weight: 600;
  color: #a855f7;
}

.challenge-label {
  margin-top: 0.4rem;
  font-size: 0.85rem;
  color: #4b5563;
}

.challenge-right {
  background: #ffffff;
  border-radius: 16px;
  padding: 1rem 1rem 0.8rem;
}

.challenge-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
  font-size: 0.8rem;
  color: #6b7280;
}

.challenge-toggle {
  border: none;
  background: none;
  font-size: 0.8rem;
  color: #2563eb;
  cursor: pointer;
}

.challenge-comment {
  font-size: 0.85rem;
  margin: 0.2rem 0;
  color: #111827;
}

.challenge-tags {
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.challenge-tag {
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: #f3f4f6;
  color: #4b5563;
}

details summary {
  margin-top: 0.4rem;
  font-size: 0.8rem;
  color: #2563eb;
  cursor: pointer;
}

details[open] summary {
  margin-bottom: 0.3rem;
}

@media (max-width: 800px) {
  .challenge-row {
    grid-template-columns: 1fr;
  }
}
