
/* css/explore.css */

/* HEADER MAKEOVER */
#product-analysis .market-header h2 {
  text-align: left;
  font-size: 1.8rem;
  font-weight: 900;
  margin-top: 0;
  margin-bottom: 24px;
  color: var(--theme-explore-header-text);
  text-transform: uppercase;
  letter-spacing: 2.5px;
  text-shadow: var(--theme-explore-header-shadow);
  position: relative;
  display: block;
  width: 100%;
  padding-bottom: 12px;
  border-bottom: 4px solid var(--theme-accent-primary);
}

#product-analysis .market-header {
    text-align: left;
}

/* Allow hobby dropdown list to extend past card (avoid overflow:hidden on tab surfaces). */
#product-analysis section.dashboard-section.explore-category-toolbar {
  overflow: visible;
}

/* Product / format row: combobox panel is position:absolute; same overflow:hidden clip as toolbar. */
#product-analysis #exploreHiddenContent section.dashboard-section {
  overflow: visible;
}

.explore-product-title-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
}

.explore-product-title-row .explore-product-title {
  grid-column: 2;
  text-align: center;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

/* Use the shared Trends pin icon styling, but in-flow for the product header. */
.explore-product-title-row .pin-icon {
  grid-column: 3;
  justify-self: end;
  position: static;
  top: auto;
  right: auto;
}

.explore-pins-mini__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.explore-pins-mini__title {
  margin: 0;
  font-size: 1rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--theme-explore-header-text);
}

.explore-pins-mini__toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: none;
  background: transparent;
  color: var(--theme-text-muted, #8892b0);
  border-radius: 8px;
  padding: 0.35rem 0.5rem;
  cursor: pointer;
  line-height: 1;
  transition: background 0.15s ease, color 0.15s ease;
}

.explore-pins-mini__toggle:hover {
  color: var(--theme-text-primary, #e5e7eb);
  background: rgba(255, 255, 255, 0.04);
}

body.light-mode .explore-pins-mini__toggle:hover {
  color: #0f172a;
  background: rgba(0, 0, 0, 0.04);
}

.explore-pins-mini__toggle-icon {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  margin-top: -0.15rem;
  opacity: 0.85;
  transition: transform 0.2s ease;
}

.explore-pins-mini.is-collapsed .explore-pins-mini__toggle-icon {
  transform: rotate(45deg);
  margin-top: 0.1rem;
}

.explore-pins-mini.is-collapsed .explore-pins-mini__list {
  display: none;
}

.explore-pins-mini__list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* Pinned products: category picker + one chip row (less busy UI). */
.explore-pins-mini__picker {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto auto;
  gap: 12px;
  width: 100%;
  min-width: 0;
}

.explore-pins-mini__cats {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
  align-items: center;
}

.explore-pins-mini__cat {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  width: auto;
  border: none;
  border-radius: 10px;
  padding: 7px 10px;
  background: transparent;
  color: var(--theme-text-muted, #8892b0);
  cursor: pointer;
  /* Keep user-facing category text as-is (don’t mangle ß → SS). */
  text-transform: none;
  letter-spacing: 0.02em;
  font-size: 0.78rem;
  font-weight: 800;
  transition: background 0.15s ease, color 0.15s ease;
}

.explore-pins-mini__cat:hover {
  color: var(--theme-text-primary, #e5e7eb);
  background: rgba(255, 255, 255, 0.04);
}

body.light-mode .explore-pins-mini__cat:hover {
  color: #0f172a;
  background: rgba(0, 0, 0, 0.04);
}

.explore-pins-mini__cat.is-active {
  color: var(--theme-text-primary, #e5e7eb);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

body.light-mode .explore-pins-mini__cat.is-active {
  color: #0f172a;
  background: rgba(15, 23, 42, 0.06);
  border-color: rgba(15, 23, 42, 0.12);
}

.explore-pins-mini__panel {
  min-width: 0;
}

.explore-pins-mini__chips {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
  -webkit-overflow-scrolling: touch;
  min-width: 0;
}

/* Keep scrollbar visible + unobtrusive (horizontal only). */
.explore-pins-mini__chips::-webkit-scrollbar {
  height: 6px;
}
.explore-pins-mini__chips::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
}

/* Firefox scrollbar */
.explore-pins-mini__chips {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

/* Keep pinned chips single-line so the row doesn't grow vertically. */
.explore-pins-mini__chips .pinned-market-chip {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
  flex: 0 0 auto;
}

/* (Scrollbar styles are above.) */

.explore-action-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  width: 100%;
  min-width: 200px;
}

.explore-export-wrap {
  position: relative;
}

.explore-export-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 950;
  min-width: 260px;
  max-width: min(340px, 92vw);
  padding: 8px 0;
  border-radius: 8px;
  background: var(--theme-tab-surface-bg, #2a2a2a);
  border: 1px solid var(--theme-tab-surface-border, #444);
  box-shadow: var(--theme-shadow-modal, 0 8px 24px rgba(0, 0, 0, 0.35));
}

.explore-export-menu__item {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 8px 14px;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 0.88rem;
  text-align: left;
  cursor: pointer;
}

.explore-export-menu__item:hover {
  background: var(--theme-analysis-dropdown-hover-bg, #3a3a3a);
}

.explore-export-menu__opts {
  margin-top: 6px;
  padding: 8px 14px 4px;
  border-top: 1px solid var(--theme-tab-surface-border, #444);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.explore-export-menu__label {
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--theme-text-muted, #aaa);
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.explore-export-menu__label input {
  margin-top: 2px;
  flex-shrink: 0;
}

#exploreReviewsSection .market-header h3 {
    text-align: left;
    font-size: 1.8rem;
    font-weight: 800;
    margin-top: 16px;
    margin-bottom: 16px;
    color: var(--theme-explore-header-text);
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: var(--theme-explore-h3-shadow);
    position: relative;
    display: block;
    width: 100%;
    padding-bottom: 8px;
    border-bottom: 3px solid var(--theme-accent-primary);
}

.analysis-input {
    width: 100%;
    padding: 10px;
    background: var(--theme-explore-input-bg);
    border: 1px solid var(--theme-explore-input-border);
    color: var(--theme-explore-input-text);
    border-radius: 6px;
    font-size: 0.9rem;
    box-sizing: border-box;
}

.analysis-input:focus {
    outline: none;
    border-color: var(--theme-accent-primary);
}

/* Product Analysis: product name + optional reason — keep chart row close below (no dead air). */
#exploreResults .explore-product-title {
    text-align: center;
    margin: 0 0 6px;
    color: var(--theme-text-primary, #fff);
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.3;
}

#exploreResults .explore-reason-line {
    text-align: center;
    margin: 0 0 8px;
    min-height: 0;
    font-size: 0.82rem;
    line-height: 1.35;
    color: var(--theme-text-muted, #b0b8c8);
}

#exploreResults .explore-reason-line:empty {
    display: none;
    margin-bottom: 0;
}

/* ROI Display (Legacy) */
.roi-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    align-items: center;
    gap: 12px;
    background: var(--theme-roi-bg);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}

/* Condensed ROI Display */
.roi-container.condensed {
    padding: 10px;
    margin-bottom: 5px;
    background: var(--theme-roi-condensed-bg);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-bottom: 1px solid var(--theme-roi-condensed-border);
}

/* Product Analysis: stats strip left-aligned (when not in chart row, legacy). */
#exploreResults .roi-container.condensed {
    justify-content: flex-start;
    gap: clamp(18px, 4vw, 42px);
    align-items: flex-start;
}

#exploreResults .roi-container.condensed .roi-item {
    align-items: flex-start;
    text-align: left;
}

/* Three columns: [ ROI ] [ metric title, viewport-centered ] [ dropdowns ] — same pattern as panel-header grid */
.explore-chart-top-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 12px 16px;
    width: 100%;
    margin-bottom: 8px;
}

/* ROI: equal thirds inside the box so columns use full width */
#exploreResults .explore-chart-top-row .explore-roi--chart-row.roi-container.condensed {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    column-gap: clamp(10px, 2vw, 20px);
    row-gap: 6px;
    align-items: start;
    margin-bottom: 0;
    border-bottom: none;
    border-radius: 10px;
    padding: 12px 16px;
    justify-self: start;
    width: 100%;
    max-width: 520px;
}

#exploreResults .explore-chart-top-row .explore-roi--chart-row .roi-item {
    align-items: center;
    text-align: center;
    min-width: 0;
}

#exploreResults .explore-chart-top-row .explore-roi--chart-row .roi-item.main .roi-val-main {
    font-size: clamp(1.1rem, 2.8vw, 1.35rem);
}

.roi-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.roi-label-small {
    font-size: 0.65rem;
    color: var(--theme-roi-label);
    text-transform: uppercase;
    margin-bottom: 2px;
    letter-spacing: 0.5px;
}

.roi-val-small {
    font-size: 0.95rem;
    font-weight: bold;
    color: var(--theme-roi-value);
}

.roi-val-main {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--theme-roi-value); /* Default, JS overrides */
}

.chart-header-small {
    text-align: center;
    font-size: 0.75rem;
    color: var(--theme-chart-header-small);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 10px;
}

/* Product Analysis chart: controls + stable sizing (Chart.js maintainAspectRatio: false) */
.explore-chart-section {
    width: 100%;
    margin-top: 0;
}

/* Center column: aligns with page center (equal 1fr side tracks), not the leftover flex gap */
.explore-chart-top-row .explore-chart-metric-title {
    grid-column: 2;
    justify-self: center;
    margin: 0;
    padding: 2px 4px 0;
    text-align: center;
    max-width: min(100%, 42ch);
    white-space: normal;
    line-height: 1.2;
}

.explore-chart-top-row .chart-header-small.explore-chart-metric-title {
    margin-top: 0;
}

.explore-chart-metric-title {
    position: static;
    left: auto;
    transform: none;
    font-size: 0.75rem;
    color: var(--theme-chart-header-small);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.explore-chart-top-row .explore-chart-toolbar--inline {
    grid-column: 3;
    justify-self: end;
}

.explore-chart-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 20px;
    align-items: flex-end;
    justify-content: center;
    margin-bottom: 0;
}

.explore-chart-toolbar--inline {
    position: relative;
    z-index: 1;
    justify-content: flex-end;
    margin-bottom: 0;
}

@media (max-width: 640px) {
    .explore-chart-top-row {
        grid-template-columns: 1fr;
    }

    .explore-chart-top-row .explore-chart-metric-title,
    .explore-chart-top-row .explore-chart-toolbar--inline {
        grid-column: 1;
        justify-self: stretch;
    }

    .explore-chart-top-row .explore-chart-metric-title {
        max-width: none;
    }

    #exploreResults .explore-chart-top-row .explore-roi--chart-row.roi-container.condensed {
        max-width: none;
        justify-self: stretch;
    }

    .explore-chart-toolbar--inline {
        justify-content: center;
        width: 100%;
    }
}

.explore-chart-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: min(200px, 100%);
}

.explore-chart-toolbar--inline .explore-chart-field {
    min-width: min(160px, 48vw);
}

.explore-chart-field label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--theme-roi-label, #888);
}

#product-analysis .explore-chart-panel.chart-container {
    height: clamp(280px, 42vh, 540px);
    min-height: 280px;
    width: 100%;
    max-width: 100%;
    margin-top: 0;
    margin-bottom: 16px;
    box-sizing: border-box;
}

.explore-comps-block {
    margin-top: 18px;
    padding-top: 8px;
    border-top: 1px solid var(--theme-review-item-border, rgba(255, 255, 255, 0.08));
    /* Same tokens as #item-lookup — listing row styles use these variables. */
    --il-inner-gap: 14px;
    --il-space-sm: 12px;
}

/* Listing rows use shared Item Lookup classes (item-lookup-product-listings__*, item-lookup-product-listing). */
.explore-comps-block .item-lookup-product-listings__head {
    text-align: left;
}

/*
 * Title row: primary sets the block height (one line). Pill is position:absolute so a tall
 * chip does not stretch the row and leave a dead band above Mean/Median.
 */
.explore-comps-head-split {
    position: relative;
    display: block;
    margin-bottom: 4px;
}

.explore-comps-head-split__primary {
    min-width: 0;
}

/* Reserve horizontal space for the pill only when it is shown. */
.explore-comps-head-split:has(.explore-comps-grouping-rating:not([hidden])) .explore-comps-head-split__primary {
    padding-right: clamp(104px, 38vw, 216px);
    box-sizing: border-box;
}

.explore-comps-head-split__primary .item-lookup-product-listings__title {
    margin: 0;
}

.explore-comps-sort {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex: 0 0 auto;
    color: var(--theme-text-muted, #8892b0);
    font-size: 0.78rem;
    user-select: none;
    margin-top: 8px;
}

.explore-comps-sort__lbl {
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.explore-comps-sort__select {
    width: auto;
    min-width: 165px;
}

/* Use shared .analysis-dropdown visual system; keep only layout tweaks here. */

.explore-comps-head-split__aside {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: flex-start;
    z-index: 1;
    min-width: 0;
    pointer-events: auto;
}

/* Hint + price line — directly under the title band (no extra row height from the pill). */
.explore-comps-head-meta {
    width: 100%;
    min-width: 0;
    margin-top: 0;
}

.explore-comps-head-meta .explore-comps-price-line {
    margin-top: 2px;
}

.explore-comps-price-line {
    margin-top: 0;
    margin-bottom: 0;
}

.explore-comps-price-line strong {
    color: var(--theme-accent-primary, #4b9cd3);
    font-weight: 700;
}

/* Confidence chip lives only in the aside column. */
.explore-comps-head-split__aside .explore-comps-grouping-rating {
    flex: 0 0 auto;
    margin: 0;
    max-width: min(100%, 200px);
    min-width: 0;
}

.explore-comps-grouping-rating {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
}

.explore-comps-grouping-rating__card {
    flex: 0 0 auto;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    width: max-content;
    max-width: 100%;
    min-height: 0;
    padding: 3px 9px 3px 7px;
    border-radius: 7px;
    border: 1px solid var(--theme-accent-a35, rgba(75, 156, 211, 0.35));
    background: linear-gradient(
        135deg,
        var(--theme-accent-a12, rgba(75, 156, 211, 0.14)) 0%,
        var(--theme-bg-analysis-toolbar, rgba(255, 255, 255, 0.04)) 100%
    );
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
}

body.light-mode .explore-comps-grouping-rating__card {
    border-color: var(--theme-accent-a40, rgba(37, 99, 235, 0.35));
    background: linear-gradient(
        135deg,
        var(--theme-accent-a10, rgba(37, 99, 235, 0.1)) 0%,
        #f8fafc 100%
    );
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.explore-comps-grouping-rating__lbl {
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    line-height: 1.08;
    text-transform: uppercase;
    text-align: right;
    color: var(--theme-text-muted, #94a3b8);
}

body.light-mode .explore-comps-grouping-rating__lbl {
    color: #64748b;
}

.explore-comps-grouping-rating__value {
    font-size: 1.08rem;
    font-weight: 900;
    line-height: 1;
    color: var(--theme-accent-primary, #4b9cd3);
    text-shadow: 0 0 14px var(--theme-accent-a25, rgba(75, 156, 211, 0.22));
    flex-shrink: 0;
}

body.light-mode .explore-comps-grouping-rating__value {
    color: var(--theme-accent-primary, #2563eb);
    text-shadow: none;
}

.explore-comps-grouping-rating__suffix {
    font-size: 0.68rem;
    font-weight: 600;
    line-height: 1;
    color: var(--theme-text-secondary, #cbd5e1);
    flex-shrink: 0;
}

body.light-mode .explore-comps-grouping-rating__suffix {
    color: #475569;
}

/* Reviews Formatting */
.review-item {
    background: var(--theme-review-item-bg);
    border-radius: 12px;
    padding: 16px 18px;
    margin-bottom: 14px;
    border: 1px solid var(--theme-review-item-border);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.review-item__head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.review-item__byline {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.review-item__author {
    color: var(--theme-accent-primary, #4b9cd3);
    font-weight: 700;
    font-size: 0.95rem;
    text-decoration: none;
}

a.review-item__author:hover {
    text-decoration: underline;
}

.review-item__author--text {
    color: var(--theme-accent-primary, #4b9cd3);
    font-weight: 700;
    font-size: 0.95rem;
    cursor: default;
}

.review-item__date {
    font-size: 0.78rem;
    color: var(--theme-roi-label, #888);
    letter-spacing: 0.02em;
}

.review-item__head-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.review-item__stars {
    font-size: 0.95rem;
    line-height: 1.2;
}

.review-item__mock-tag {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--theme-roi-label, #888);
}

.review-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.review-rating {
    color: var(--theme-explore-review-rating);
    font-size: 0.9rem;
}

.review-comment {
    color: var(--theme-review-comment);
    font-size: 0.95rem;
    line-height: 1.45;
    margin: 0;
}

.review-meta {
    background: var(--theme-review-meta-bg);
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--theme-review-meta-border);
    font-size: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.review-meta--structured {
    margin-top: 2px;
}

.review-meta__pulls {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.review-meta__pulls-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--theme-roi-label, #888);
}

.review-meta__pulls-value {
    color: var(--theme-review-comment, #eee);
    font-weight: 500;
    word-break: break-word;
}

.review-meta__finance {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
}

.review-kv {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    font-size: 0.82rem;
}

.review-kv__k {
    color: var(--theme-roi-label, #888);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.review-kv__v {
    color: var(--theme-review-comment, #eee);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.review-roi-badge {
    margin-left: auto;
    font-weight: 700;
    font-size: 0.88rem;
    font-variant-numeric: tabular-nums;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
}

.review-roi-badge.roi-positive {
    color: var(--theme-roi-positive);
}

.review-roi-badge.roi-negative {
    color: var(--theme-roi-negative);
}

.review-roi {
    display: flex;
    gap: 15px;
    align-items: center;
}

.roi-positive { color: var(--theme-roi-positive); font-weight: bold; }
.roi-negative { color: var(--theme-roi-negative); font-weight: bold; }

.review-hits {
    margin-top: 4px;
}

.review-hits__toggle {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--theme-accent-primary, #4b9cd3);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.review-hits__toggle:hover {
    color: var(--theme-accent-primary, #4b9cd3);
    filter: brightness(1.1);
}

.review-hits__panel {
    margin-top: 8px;
}

.review-hits__img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid var(--theme-review-meta-border, #333);
    display: block;
}

.review-delete-btn {
    background: none;
    border: none;
    color: var(--theme-review-delete);
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 4px;
    opacity: 0.65;
}
.review-delete-btn:hover {
    color: var(--theme-review-delete-hover);
    opacity: 1;
}

#exploreSurveySubmitBtn:disabled {
    opacity: 0.75;
    cursor: not-allowed;
}

/* --- Product review & survey modal --- */
.explore-survey-cta {
  text-align: center;
  margin-top: 12px;
}

.explore-survey-open-btn {
  padding: 10px 22px;
  font-size: 0.9rem;
}

.explore-survey-modal .explore-survey-modal-content {
  max-width: min(96vw, 520px);
  width: 100%;
}

.explore-survey-header {
  margin-bottom: 8px;
}

.explore-survey-body {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: min(70vh, 640px);
  overflow-y: auto;
  padding-right: 4px;
}

.explore-survey-intro {
  margin: 0 0 18px 0;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--theme-text-modal-label, var(--theme-explore-input-text));
  opacity: 0.95;
}

.explore-survey-section {
  margin-bottom: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--theme-border-modal);
}

.explore-survey-section:last-of-type {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.explore-survey-section--optional {
  background: var(--theme-review-meta-bg);
  margin-left: -4px;
  margin-right: -4px;
  padding: 14px 14px 18px;
  border-radius: 10px;
  border: 1px solid var(--theme-review-meta-border);
}

.explore-survey-section-title {
  margin: 0 0 12px 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--theme-chart-header-small);
}

.explore-survey-section-lead {
  margin: -4px 0 14px 0;
  font-size: 0.86rem;
  line-height: 1.45;
  color: var(--theme-review-comment);
  opacity: 0.9;
}

.explore-survey-optional-badge {
  font-weight: 600;
  letter-spacing: 0.06em;
  font-size: 0.65rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--theme-coll-item-card-bg);
  border: 1px solid var(--theme-border-modal);
  vertical-align: middle;
  margin-left: 6px;
}

.explore-survey-field {
  margin-bottom: 14px;
}

.explore-survey-field:last-child {
  margin-bottom: 0;
}

.explore-survey-field--inline {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
}

.explore-survey-field-grow {
  flex: 1 1 200px;
  min-width: 0;
}

.explore-survey-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--theme-text-modal-label);
}

.explore-survey-required {
  color: var(--theme-danger, #f87171);
  font-weight: 700;
}

.explore-survey-hint {
  display: block;
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--theme-explore-input-text);
  opacity: 0.75;
}

.explore-survey-textarea,
.explore-survey-modal .modal-input {
  width: 100%;
  box-sizing: border-box;
}

.explore-survey-field--rating {
  margin-bottom: 16px;
  text-align: center;
}

.explore-survey-field--rating .explore-survey-label {
  text-align: center;
}

.explore-rating-stars {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 6px;
  width: 100%;
}

.explore-rating-row {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  width: 100%;
  max-width: 300px;
  min-height: 48px;
  margin-left: auto;
  margin-right: auto;
  gap: 0;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

.explore-rating-star {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 0;
  min-width: 0;
  padding: 6px 4px;
  margin: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 6px;
  line-height: 1;
  transition: background 0.12s ease;
}

.explore-rating-star:hover {
  background: var(--theme-bg-close-hover);
}

.explore-rating-star:focus {
  outline: none;
}

.explore-rating-star:focus-visible {
  outline: 2px solid var(--theme-accent-primary);
  outline-offset: 1px;
}

/* Hollow outline when not filled (all five always visible as outlines) */
.explore-rating-star:not(.is-filled):not(.is-half) .explore-rating-ico {
  color: transparent;
  -webkit-text-stroke: 1.35px var(--theme-explore-rating-outline, var(--theme-border-modal));
  text-shadow: none;
  filter: none;
}

.explore-rating-ico {
  font-size: 1.85rem;
  line-height: 1;
  display: block;
  transition: color 0.12s ease, -webkit-text-stroke 0.12s ease;
}

.explore-rating-star.is-filled .explore-rating-ico {
  color: var(--theme-explore-review-rating);
  -webkit-text-stroke: 0;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.22);
}

.explore-rating-star.is-half .explore-rating-ico {
  color: var(--theme-explore-review-rating);
  -webkit-text-stroke: 0;
  opacity: 0.92;
}

.review-star-half {
  opacity: 0.52;
  display: inline-block;
}

@supports not (-webkit-text-stroke: 1px transparent) {
  .explore-rating-star:not(.is-filled):not(.is-half) .explore-rating-ico {
    color: var(--theme-roi-label);
    opacity: 0.65;
  }
}

.explore-survey-textarea {
  resize: vertical;
  min-height: 96px;
  line-height: 1.45;
}

.explore-survey-file {
  padding: 10px 12px;
  font-size: 0.85rem;
  cursor: pointer;
}

.explore-survey-file-status {
  font-size: 0.8rem;
  margin-top: 8px;
  min-height: 1.2em;
  color: var(--theme-chart-header-small);
}

.explore-survey-actions {
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--theme-border-modal);
  gap: 12px;
}

@media (max-width: 480px) {
  .explore-survey-modal .explore-survey-modal-content {
    max-width: 100%;
    padding: 18px;
  }
}

/* Product Analysis — verdict card: ROI control on same row as SHOULD BUY / NEUTRAL (compact height) */
#exploreConclusionBox.explore-conclusion {
  position: relative;
}

#exploreConclusionBox .explore-conclusion__main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) minmax(0, 1fr);
  align-items: start;
  column-gap: 10px;
  row-gap: 6px;
}

#exploreConclusionBox .explore-conclusion__mode {
  justify-self: start;
  align-self: start;
  min-width: 0;
  padding-top: 1px;
}

#exploreConclusionBox .explore-conclusion__mode-select.analysis-dropdown {
  width: auto;
  min-width: 0;
  max-width: 100%;
  height: 32px;
  padding-top: 4px;
  padding-bottom: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: none;
  line-height: 1.15;
}

#exploreConclusionBox .explore-conclusion__verdict {
  text-align: center;
  min-width: 0;
  justify-self: center;
  padding-top: 0;
}

#exploreConclusionBox .explore-conclusion__stats {
  justify-self: end;
  min-width: 0;
}

#exploreConclusionBox .explore-conclusion__stats-inner {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: flex-end;
}

@media (max-width: 640px) {
  #exploreConclusionBox .explore-conclusion__main {
    grid-template-columns: 1fr;
    justify-items: stretch;
    row-gap: 8px;
  }

  #exploreConclusionBox .explore-conclusion__mode {
    justify-self: stretch;
    order: 1;
  }

  #exploreConclusionBox .explore-conclusion__mode-select.analysis-dropdown {
    width: 100%;
  }

  #exploreConclusionBox .explore-conclusion__verdict {
    order: 2;
    justify-self: center;
  }

  #exploreConclusionBox .explore-conclusion__stats {
    order: 3;
    justify-self: center;
  }

  #exploreConclusionBox .explore-conclusion__stats-inner {
    justify-content: center;
  }
}

/* Product analysis: chart + comps + reviews load behind one overlay */
.explore-analysis-body {
  position: relative;
  min-height: 120px;
}

.explore-analysis-loading {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--theme-bg-primary, #0f1419) 88%, transparent);
  border-radius: 10px;
}

.explore-analysis-loading[hidden] {
  display: none !important;
}

.explore-analysis-loading__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 24px 20px;
  text-align: center;
}

.explore-analysis-loading__spinner {
  width: 40px;
  height: 40px;
  border: 3px solid color-mix(in srgb, var(--theme-text-muted, #9ca3af) 35%, transparent);
  border-top-color: var(--theme-accent-primary, #38bdf8);
  border-radius: 50%;
  animation: explore-analysis-spin 0.75s linear infinite;
}

.explore-analysis-loading__label {
  margin: 0;
  font-size: 0.95rem;
  color: var(--theme-text-secondary, #cbd5e1);
  max-width: 22rem;
  line-height: 1.35;
}

@keyframes explore-analysis-spin {
  to {
    transform: rotate(360deg);
  }
}

body.light-mode .explore-analysis-loading {
  background: rgba(255, 255, 255, 0.9);
}

body.light-mode .explore-analysis-loading__label {
  color: #334155;
}
