.review-sentiment-widget,
.review-sentiment-widget * {
  box-sizing: border-box;
}

.review-sentiment-widget {
  --positive-color: #A389FA;
  --positive-color-dark: #8E6BFA;
  --neutral-color: #1B1B1F;
  --neutral-color-light: #303036;
  --negative-color: #C7F76A;
  --negative-color-dark: #B8EF4F;
  --text-color: #1B1B1F;
  --muted-color: #6B7280;
  --grid-color: rgba(27, 27, 31, 0.14);
  --card-bg: #FFFFFF;
  --soft-bg: #FAFAFC;

  width: 100%;
  margin: 36px 0;
  padding: 30px;
  border-radius: 28px;
  background:
    radial-gradient(circle at 7% 0%, rgba(163, 137, 250, 0.18), transparent 28%),
    radial-gradient(circle at 94% 10%, rgba(199, 247, 106, 0.22), transparent 30%),
    var(--card-bg);
  box-shadow: 0 20px 60px rgba(20, 20, 30, 0.10);
  border: 1px solid rgba(27, 27, 31, 0.08);
  font-family: inherit;
  overflow: hidden;
  position: relative;
}

.review-chart-head h3 {
  margin: 0;
  color: var(--text-color);
  font-family: inherit;
  font-size: clamp(24px, 3.2vw, 42px);
  line-height: 1.12;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.review-chart-head p {
  margin: 10px 0 0;
  color: var(--muted-color);
  font-family: inherit;
  font-size: 16px;
  line-height: 1.5;
}

.review-chart-legend {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 22px;
  margin: 26px 0 24px;
  color: var(--text-color);
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
}

.review-chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.legend-dot {
  width: 16px;
  height: 16px;
  display: inline-block;
  border-radius: 5px;
}

.positive-dot {
  background: var(--positive-color);
}

.neutral-dot {
  background: var(--neutral-color);
}

.negative-dot {
  background: var(--negative-color);
}

.review-chart-area {
  position: relative;
  padding-bottom: 38px;
}

.review-grid-lines {
  position: absolute;
  top: 0;
  bottom: 38px;
  left: 118px;
  right: 0;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
  z-index: 0;
}

.review-grid-lines span {
  width: 1px;
  background: var(--grid-color);
}

.review-chart-rows {
  position: relative;
  z-index: 2;
}

.review-row {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin: 17px 0;
}

.review-brand {
  color: var(--text-color);
  font-family: inherit;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.2;
  text-align: right;
  padding-right: 4px;
}

.review-bar {
  display: flex;
  width: 100%;
  height: 46px;
  border-radius: 0 10px 10px 0;
  overflow: visible;
  background: rgba(27, 27, 31, 0.06);
  box-shadow: inset 0 0 0 1px rgba(27, 27, 31, 0.05);
}

.review-segment {
  width: 0;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 10px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  cursor: default;
  transition:
    width 1.05s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.2s ease,
    filter 0.2s ease;
}

.review-sentiment-widget.is-visible .review-segment {
  width: var(--value);
}

.review-segment.positive {
  background: linear-gradient(90deg, var(--positive-color), var(--positive-color-dark));
  color: #FFFFFF;
}

.review-segment.neutral {
  background: linear-gradient(90deg, var(--neutral-color-light), var(--neutral-color));
  color: #FFFFFF;
}

.review-segment.negative {
  background: linear-gradient(90deg, var(--negative-color), var(--negative-color-dark));
  color: #1B1B1F;
}

.review-segment:hover {
  filter: saturate(1.12) brightness(1.04);
  transform: translateY(-1px);
  z-index: 5;
}

/* Small segment label handling */
.review-segment.is-small {
  overflow: visible;
  color: transparent;
  justify-content: center;
  padding-right: 0;
}

.review-segment.is-small::after {
  content: attr(data-value);
  position: absolute;
  top: -30px;
  left: 50%;
  transform: translateX(-50%);
  min-width: 34px;
  padding: 5px 7px;
  border-radius: 999px;
  background: #1B1B1F;
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  box-shadow: 0 8px 20px rgba(27, 27, 31, 0.18);
  z-index: 20;
}

.review-segment.positive.is-small::after {
  background: var(--positive-color-dark);
  color: #FFFFFF;
}

.review-segment.neutral.is-small::after {
  background: #1B1B1F;
  color: #FFFFFF;
}

.review-segment.negative.is-small::after {
  background: var(--negative-color-dark);
  color: #1B1B1F;
}

.review-axis {
  position: absolute;
  left: 118px;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-color);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.review-axis span {
  display: block;
  line-height: 1;
}

.review-chart-footnote {
  margin-top: 18px;
  color: var(--muted-color);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.5;
}

.review-tooltip {
  position: fixed;
  display: none;
  z-index: 99999;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(27, 27, 31, 0.94);
  color: #FFFFFF;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  pointer-events: none;
  box-shadow: 0 16px 35px rgba(27, 27, 31, 0.25);
}

@media (max-width: 767px) {
  .review-sentiment-widget {
    padding: 22px 16px;
    border-radius: 22px;
  }

  .review-chart-legend {
    justify-content: flex-start;
    gap: 14px;
    font-size: 14px;
  }

  .review-chart-area {
    overflow-x: auto;
    padding-bottom: 42px;
  }

  .review-grid-lines,
  .review-axis,
  .review-chart-rows {
    min-width: 760px;
  }

  .review-grid-lines,
  .review-axis {
    left: 108px;
  }

  .review-row {
    grid-template-columns: 98px 650px;
  }

  .review-brand {
    font-size: 15px;
  }

  .review-bar {
    height: 42px;
  }

  .review-segment {
    font-size: 13px;
    padding-right: 7px;
  }

  .review-segment.is-small {
    padding-right: 0;
  }

  .review-segment.is-small::after {
    top: -27px;
    min-width: 30px;
    padding: 4px 6px;
    font-size: 11px;
  }
}