/* ============================================================
 * Zibll 星级评分 v2.0.3  —  样式（跟随主题变量，暗色自动适配）
 * 配色全部走子比 CSS 变量，不写死颜色，避免暗色下发灰/不统一。
 * ============================================================ */

/* 星星基础结构：基础层(灰) + 填充层(主题色，按宽度裁切) */
.star-icon {
    position: relative;
    display: inline-block;
    width: 1em;
    height: 1em;
    font-size: var(--zsr-star-size, 32px);
    line-height: 1;
}
.star-icon svg {
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: none;
}
.star-icon-base {
    position: absolute;
    inset: 0;
}
.star-icon-base svg {
    fill: var(--muted-3-color, #c9ced6);
}
.star-icon-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0;
    overflow: hidden;
    transition: width .18s ease-out;
}
.star-icon-fill-inner {
    position: absolute;
    top: 0;
    left: 0;
    width: 1em;
    height: 1em;
}
.star-icon-fill-inner svg {
    fill: var(--theme-color, #f04494);
}

/* ===== 侧栏交互评分组件（外层已由 .zib-widget 提供卡片底）===== */
.star-score-widget {
    width: 100%;
}
.star-score-widget-prompt {
    font-size: 15px;
    font-weight: 600;
    color: var(--key-color, #333);
    margin-bottom: 12px;
    letter-spacing: 1px;
}
.star-score-average-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 8px;
}
.star-score-widget .star-score-average {
    font-size: 34px;
    font-weight: 700;
    color: var(--theme-color, #f04494);
    line-height: 1;
}
.star-score-wheat-left,
.star-score-wheat-right {
    width: 24px;
    height: auto;
    fill: var(--theme-color, #f04494);
    opacity: .8;
    flex: 0 0 auto;
}
.star-score-votes {
    font-size: 13px;
    color: var(--muted-2-color, #999);
    margin-bottom: 14px;
    text-align: center;
}
.star-score-votes span {
    color: var(--key-color, #333);
    font-weight: 600;
    margin: 0 2px;
}
.star-score-hover-text {
    font-size: 13px;
    color: var(--muted-2-color, #999);
    min-height: 18px;
    text-align: center;
}

/* ===== 公平性：未评分用户隐藏评分后的状态，仅给星星；评完再揭示 ===== */
.star-score-widget.is-unrated .star-score-average-display,
.star-score-widget.is-unrated .star-score-votes,
.star-score-content-box.is-unrated .star-score-widget-prompt,
.star-score-content-box.is-unrated .star-score-average-display,
.star-score-content-box.is-unrated .star-score-votes,
.star-score-content-box.is-unrated .star-score-stats-right {
    display: none;
}
.star-score-unrated-prompt {
    display: none;
}
.star-score-content-box.is-unrated .star-score-unrated-prompt {
    display: block;
    text-align: center;
    font-size: 14px;
    color: var(--muted-2-color, #999);
    margin-bottom: 8px;
}

/* 交互星星行：row-reverse 让 1→5 从左往右排列 */
.star-score-stars .radio {
    display: flex;
    justify-content: center;
    flex-direction: row-reverse;
    gap: 4px;
    margin-bottom: 6px;
}
.star-score-stars .radio > input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
    opacity: 0;
}
.star-score-stars .radio > label {
    cursor: pointer;
    position: relative;
    display: inline-block;
    line-height: 0;
    transition: transform .1s ease-out;
}
.star-score-stars .radio > label:hover {
    transform: scale(1.08);
}
.star-score-stars .radio > label:active {
    transform: scale(.9);
}
/* 键盘可达：聚焦时给关联 label 描边 */
.star-score-stars .radio > input:focus-visible + label {
    outline: 2px solid var(--focus-color, var(--theme-color, #f04494));
    outline-offset: 2px;
    border-radius: 4px;
}
.star-score-stars[data-rated="true"] .radio > label {
    cursor: default;
    pointer-events: none;
}
.star-score-stars[data-rated="true"] .radio > label:hover {
    transform: none;
}

/* ===== 内容区统计版（自带 .zib-widget 卡片）===== */
.star-score-content-box.zib-widget {
    padding: 20px;
}
.star-score-content-box .stats-main-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--key-color, #333);
    margin-bottom: 10px;
}
.star-score-content-box .stats-separator-line {
    height: 1px;
    background: var(--main-border-color, #eee);
    margin: 0 0 16px;
}
.star-score-stats-container {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}
.star-score-stats-left {
    flex: 0 0 auto;
    min-width: 160px;
    text-align: center;
}
.star-score-stats-left .star-score-widget-prompt {
    margin-bottom: 6px;
}
.star-score-content-box .star-score-average {
    font-size: 34px;
}
.star-score-stats-right {
    flex: 1 1 240px;
    min-width: 200px;
}

/* ===== 评分分布条 ===== */
.distribution-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.distribution-stars {
    flex: 0 0 auto;
    display: flex;
    gap: 2px;
}
.distribution-star-icon {
    width: 12px;
    height: 12px;
    display: inline-block;
}
.distribution-star-icon svg {
    width: 100%;
    height: 100%;
    fill: var(--muted-3-color, #c9ced6);
}
.distribution-bar-container {
    flex: 1 1 auto;
    height: 8px;
    background: var(--muted-bg-color, #f2f3f5);
    border-radius: 99px;
    overflow: hidden;
}
.distribution-bar {
    height: 100%;
    background: var(--theme-color, #f04494);
    border-radius: 99px;
    transition: width .6s ease-out;
}
.distribution-count {
    flex: 0 0 auto;
    font-size: 12px;
    color: var(--muted-2-color, #999);
    min-width: 34px;
    text-align: right;
}

/* ===== 内容版评分星星（平均评分下方，可直接点击）===== */
.star-score-widget-inline {
    margin: 6px 0 8px;
}
.star-score-widget-inline .star-icon {
    font-size: 26px;
}
.star-score-widget-inline .star-score-stars .radio {
    gap: 6px;
}

/* 窄屏：统计区纵向堆叠 */
@media (max-width: 480px) {
    .star-score-stats-container {
        gap: 16px;
    }
    .star-score-stats-left {
        flex: 1 1 100%;
    }
}

/* 尊重减少动效偏好：关闭所有过渡/动画 */
@media (prefers-reduced-motion: reduce) {
    .star-icon-fill,
    .distribution-bar,
    .star-score-stars .radio > label {
        transition: none !important;
    }
}
