@import url('tokens.css');

/* rating 页面语义别名与组件变量（品牌令牌由 tokens.css 提供） */
:root {
    --color-bg-main: var(--color-bg-primary);
    --color-text-main: var(--color-text-primary);
    --color-card-bg: var(--color-bg-glass);
    --gauge-size: 140px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Lora', 'Microsoft YaHei', serif;
    background: var(--color-bg-main);
    color: var(--color-text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.55;
}

/* ── 顶栏（与 play.html 一致） ── */
.rating-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: transparent;
    position: relative;
    z-index: 100;
}

.rating-brand {
    font-family: 'Lora', serif;
    font-weight: 700;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--color-text-main);
    text-decoration: none;
}

.rating-brand img {
    width: 28px;
    height: 28px;
}

.rating-topbar-cta {
    font-family: 'Outfit', sans-serif;
    background: var(--color-text-main);
    color: #fff;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
}

.rating-topbar-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(95, 74, 58, 0.2);
}

/* ── 主容器 ── */
.rating-container {
    flex: 1;
    max-width: 680px;
    width: 100%;
    margin: 0 auto;
    padding: 0 20px 60px;
    display: flex;
    flex-direction: column;
    transition: min-height 0.3s ease;
}

/* 空结果状态下（未展开结果面板时），容器平滑弹性垂直居中，解决“头重脚轻”问题 */
.rating-container:has(#result-panel[hidden]) {
    min-height: calc(100vh - 120px);
    justify-content: center;
}

/* ── 页面标题 ── */
.rating-header {
    text-align: center;
    margin-bottom: 28px;
}

.rating-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.9rem;
    font-weight: 700;
    color: var(--color-accent-primary);
    margin-bottom: 8px;
}

.rating-subtitle {
    font-size: 0.92rem;
    color: var(--color-text-muted);
}

.rating-subtitle-cta {
    font-family: 'Outfit', sans-serif;
    font-size: 0.81rem;
    color: var(--color-text-muted);
    margin-top: 4px;
    font-weight: 400;
    opacity: 0.85;
}

/* ── 输入卡片（毛玻璃） ── */
.rating-input-card {
    background: var(--color-card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--color-border);
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 8px 32px rgba(74, 62, 53, 0.05);
}

.rating-name-row {
    margin-bottom: 14px;
}

.rating-name-row input {
    width: 100%;
}

.rating-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    width: 100%;
    box-sizing: border-box;
}

.rating-input-card label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.82rem;
    color: var(--color-text-muted);
    font-weight: 500;
    position: relative;
    min-width: 0;
    width: 100%;
}

.rating-input-card input {
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    background: #fff;
    color: var(--color-text-main);
    transition: border-color 0.2s;
    outline: none;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.field-title {
    white-space: nowrap;
}

.kcal-label-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 4px;
}

.kcal-label-header-right {
    display: flex;
    align-items: center;
    gap: 3px;
    flex-shrink: 0;
}

/* ── 分段控件 (Segmented Control) ── */
.unit-segment {
    display: inline-flex;
    background: rgba(95, 74, 58, 0.07);
    border-radius: 999px;
    gap: 2px;
}

.unit-seg-btn {
    font-family: 'Outfit', sans-serif;
    font-size: 0.66rem;
    font-weight: 500;
    color: var(--color-text-muted);
    background: none;
    border: none;
    border-radius: 999px;
    padding: 2px 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.unit-seg-btn.active {
    background: var(--color-text-main);
    color: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.revert-kcal-btn {
    font-family: 'Outfit', sans-serif;
    font-size: 0.64rem;
    font-weight: 500;
    color: #b45309;
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.25);
    border-radius: 4px;
    padding: 1px 5px;
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
    transition: all 0.2s;
}

.revert-kcal-btn:hover {
    background: rgba(245, 158, 11, 0.16);
}

.auto-hint-inline {
    font-size: 0.68rem;
    color: var(--color-text-muted);
    opacity: 0.75;
    font-weight: 400;
    white-space: nowrap;
}

.rating-actions {
    margin-top: 18px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.rating-btn-primary {
    font-family: 'Outfit', sans-serif;
    background: var(--color-accent-primary);
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 11px 24px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.rating-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(217, 119, 87, 0.3);
}

.rating-btn-ghost {
    font-family: 'Outfit', sans-serif;
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 10px 18px;
    color: var(--color-text-muted);
    font-size: 0.88rem;
    cursor: pointer;
    transition: all 0.2s;
}

.rating-btn-ghost:hover {
    border-color: var(--color-text-main);
    color: var(--color-text-main);
}

.rating-error {
    color: #cd5c5c;
    font-size: 0.85rem;
    margin-top: 10px;
}

.rating-error-smart {
    margin-top: 12px;
    margin-bottom: 4px;
    padding: 10px 14px;
    background: rgba(217, 119, 87, 0.07);
    border: 1px solid rgba(217, 119, 87, 0.22);
    border-radius: 12px;
    font-size: 0.82rem;
    color: var(--color-text-main);
    line-height: 1.5;
    text-align: left;
}

.smart-err-cta {
    color: var(--color-accent-primary);
    font-weight: 600;
    text-decoration: underline;
    margin: 0 4px;
    transition: opacity 0.2s;
    display: inline-block;
}

.smart-err-cta:hover {
    opacity: 0.85;
}

/* ── 最近分析历史记录 ── */
.rating-history-wrap {
    margin-top: 24px;
}

.rating-history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    padding: 0 4px;
}

.rating-history-label {
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text-main);
}

.history-clear-btn {
    font-family: 'Outfit', sans-serif;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: color 0.2s;
}

.history-clear-btn:hover {
    color: var(--color-accent-primary);
}

.rating-history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.65);
    border: 1px solid var(--color-border);
    border-radius: 14px;
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.history-card:hover {
    transform: translateY(-2px);
    background: #fff;
    border-color: rgba(217, 119, 87, 0.3);
    box-shadow: 0 4px 12px rgba(74, 62, 53, 0.06);
}

.history-info {
    flex: 1;
    min-width: 0;
}

.history-name {
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text-main);
}

.history-macros {
    font-family: 'Outfit', sans-serif;
    font-size: 0.74rem;
    color: var(--color-text-muted);
    margin-top: 2px;
}

.history-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.history-score {
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
}

.history-rank-badge {
    font-family: 'Outfit', sans-serif;
    font-size: 0.72rem;
    color: var(--color-text-muted);
    background: rgba(95, 74, 58, 0.07);
    padding: 2px 8px;
    border-radius: 999px;
}

.history-action-hint {
    font-family: 'Outfit', sans-serif;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--color-accent-primary);
}

/* ── 轮播 ── */
.rating-carousel-wrap {
    margin-top: 24px;
    text-align: center;
}

.rating-carousel-label {
    font-family: 'Outfit', sans-serif;
    font-size: 0.78rem;
    color: var(--color-text-muted);
    margin-bottom: 10px;
    letter-spacing: 0.5px;
}

.rating-carousel {
    height: 42px;
    overflow: hidden;
    position: relative;
}

.carousel-item {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.88rem;
    color: var(--color-text-main);
    opacity: 0;
    transform: translateY(20px);
    transition:
        opacity 0.6s ease,
        transform 0.6s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 8px;
    pointer-events: none;
    z-index: 1;
}

.carousel-item.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    z-index: 3;
}

.carousel-item.exit {
    opacity: 0;
    transform: translateY(-20px);
    z-index: 2;
}

.carousel-item img {
    width: 20px;
    height: 20px;
    object-fit: contain;
    flex-shrink: 0;
}

.carousel-niche {
    font-family: 'Outfit', sans-serif;
    font-size: 0.72rem;
    background: rgba(95, 74, 58, 0.08);
    padding: 2px 8px;
    border-radius: 999px;
    flex-shrink: 0;
}

.carousel-score {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    color: var(--color-success);
    flex-shrink: 0;
}

.carousel-macros {
    font-family: 'Outfit', sans-serif;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    flex-shrink: 0;
}

/* ── 结果面板 ── */
.rating-result {
    margin-top: 28px;
    animation: slideUp 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* ── 仪表盘区域 ── */
.rating-gauge-section {
    background: var(--color-card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--color-border);
    border-radius: 20px;
    padding: 28px 24px;
    box-shadow: 0 8px 32px rgba(74, 62, 53, 0.05);
    display: flex;
    align-items: center;
    gap: 28px;
}

.gauge-wrap {
    position: relative;
    width: var(--gauge-size);
    height: var(--gauge-size);
    flex-shrink: 0;
}

.gauge-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.gauge-bg {
    fill: none;
    stroke: #e8e2da;
    stroke-width: 10;
}

.gauge-fill {
    fill: none;
    stroke: var(--color-success);
    stroke-width: 10;
    stroke-linecap: round;
    stroke-dasharray: 326.73;
    transition:
        stroke-dashoffset 1.2s cubic-bezier(0.4, 0, 0.2, 1),
        stroke 0.5s ease;
}

.gauge-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Outfit', sans-serif;
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--color-text-main);
}

.rating-meta {
    flex: 1;
    min-width: 0;
}

.rating-rank-text {
    font-family: 'Outfit', sans-serif;
    font-size: 0.92rem;
    font-weight: 500;
    margin-bottom: 8px;
}

.rating-rank-text strong {
    color: var(--color-accent-primary);
    font-size: 1.05rem;
}

.rating-niche-rank-line {
    font-family: 'Outfit', sans-serif;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.rating-niche-rank-line img {
    width: 16px;
    height: 16px;
    object-fit: contain;
}

/* ── 开发者控件区域 ── */
#dev-controls-wrap {
    margin-bottom: 15px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
}

/* ── 每份换算行 ── */
.serving-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.82rem;
    color: var(--color-text-muted);
    font-weight: 500;
}

.serving-row input {
    width: 72px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    padding: 8px 10px;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    background: #fff;
    color: var(--color-text-main);
    text-align: center;
    outline: none;
    transition: border-color 0.2s;
}

.serving-row .serving-unit {
    font-size: 0.78rem;
    color: var(--color-text-muted);
    opacity: 0.85;
}

/* ── 返回分析按钮 ── */
.rating-btn-back {
    font-family: 'Outfit', sans-serif;
    background: transparent;
    border: 1px solid rgba(217, 119, 87, 0.3);
    border-radius: 12px;
    padding: 10px 18px;
    color: var(--color-accent-primary);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.rating-btn-back:hover {
    background: rgba(217, 119, 87, 0.08);
    border-color: var(--color-accent-primary);
}

/* ── 排名卡片同类排名行 ── */
.neighbor-niche-rank {
    font-family: 'Outfit', sans-serif;
    font-size: 0.72rem;
    color: var(--color-text-muted);
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.neighbor-niche-rank img {
    width: 14px;
    height: 14px;
    object-fit: contain;
}

/* ── 排名卡片可点击（开发者模式） ── */
.neighbor-card.dev-clickable {
    cursor: pointer;
}

.neighbor-card.dev-clickable:hover {
    background: rgba(217, 119, 87, 0.06);
    border-color: rgba(217, 119, 87, 0.2);
}

/* ── 开发者模式页脚标记 ── */
.dev-badge {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 600;
    color: #b45309;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.25);
    border-radius: 4px;
    padding: 1px 6px;
    margin-left: 6px;
}

/* ── 邻域卡片 ── */
.rating-neighbors {
    margin-top: 20px;
}

.rating-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.rating-section-header .rating-section-title {
    margin-bottom: 0;
}

.rating-niche-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--color-text-muted, #7e6e65);
    cursor: pointer;
    user-select: none;
    transition: color 0.2s;
}

.rating-niche-toggle:hover {
    color: var(--color-accent-primary, #d97757);
}

.rating-niche-toggle input[type='checkbox'] {
    width: 15px;
    height: 15px;
    cursor: pointer;
    accent-color: var(--color-accent-primary, #d97757);
}

.rating-section-title {
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.rating-section-title img {
    width: 22px;
    height: 22px;
    object-fit: contain;
}

.neighbor-cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.neighbor-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid var(--color-border);
    border-radius: 14px;
    transition: transform 0.2s;
}

.neighbor-card:hover {
    transform: translateX(4px);
}

.neighbor-card.is-candidate {
    background: rgba(217, 119, 87, 0.08);
    border-color: rgba(217, 119, 87, 0.25);
}

.neighbor-rank {
    font-family: 'Outfit', sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--color-text-muted);
    min-width: 32px;
    text-align: center;
}

.neighbor-info {
    flex: 1;
    min-width: 0;
}

.neighbor-name {
    font-family: 'Outfit', sans-serif;
    font-size: 0.88rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.neighbor-niche {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    color: var(--color-text-muted);
    margin-top: 2px;
}

.neighbor-niche img {
    width: 14px;
    height: 14px;
    object-fit: contain;
}

.neighbor-score {
    font-family: 'Outfit', sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    min-width: 44px;
    text-align: right;
}

.neighbor-badge {
    font-family: 'Outfit', sans-serif;
    font-size: 0.68rem;
    font-weight: 500;
    padding: 1px 6px;
    border-radius: 4px;
    margin-left: 6px;
    display: inline-block;
}

.neighbor-badge-best {
    color: #2e7d32;
    background: rgba(46, 125, 50, 0.1);
    border: 1px solid rgba(46, 125, 50, 0.25);
}

.neighbor-badge-worst {
    color: #c62828;
    background: rgba(198, 40, 40, 0.1);
    border: 1px solid rgba(198, 40, 40, 0.25);
}

.neighbor-macros {
    font-family: 'Outfit', sans-serif;
    font-size: 0.72rem;
    color: var(--color-text-muted);
    margin-top: 2px;
    opacity: 0.9;
}

/* ── 多菜品合并排名的分界线 ── */
.neighbor-divider {
    display: flex;
    align-items: center;
    margin: 6px 0;
    gap: 8px;
}

.neighbor-divider::before,
.neighbor-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px dashed rgba(95, 74, 58, 0.15);
}

.neighbor-card.is-active-dish {
    border-color: var(--color-accent-primary);
    box-shadow: 0 2px 12px rgba(217, 119, 87, 0.18);
}

/* ── CTA ── */
.rating-cta-card {
    margin-top: 28px;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    background: linear-gradient(135deg, rgba(217, 119, 87, 0.08) 0%, rgba(217, 119, 87, 0.02) 100%);
    border: 1px solid rgba(217, 119, 87, 0.15);
    border-radius: 18px;
}

.cta-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}

.cta-icon {
    width: 26px;
    height: 26px;
    object-fit: contain;
    flex-shrink: 0;
}

.cta-text {
    flex: 1;
    min-width: 0;
}

.cta-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 0.98rem;
    color: var(--color-text-main);
}

.cta-text p {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    line-height: 1.55;
    margin-top: 4px;
}

.cta-btn {
    flex-shrink: 0;
    font-size: 0.85rem;
    padding: 9px 18px;
}

/* ── 脚注 ── */
.rating-footer {
    text-align: center;
    padding: 20px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.72rem;
    color: var(--color-text-muted);
    opacity: 0.7;
}

/* ── 动画 ── */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(24px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ── 响应式 (标准 768px 与 480px 断点) ── */
@media (max-width: 768px) {
    .rating-container {
        padding: 0 16px 40px;
    }

    .rating-input-card {
        padding: 20px;
    }

    .rating-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .rating-gauge-section {
        flex-direction: column;
        text-align: center;
        padding: 24px 18px;
    }

    .percentile-bar {
        margin: 0 auto;
    }
}

@media (max-width: 480px) {
    .rating-topbar {
        padding: 10px 14px;
    }

    .rating-brand {
        font-size: 0.95rem;
    }

    .rating-topbar-cta {
        padding: 6px 14px;
        font-size: 0.82rem;
    }

    .rating-header {
        margin-bottom: 16px;
    }

    .rating-title {
        font-size: 1.35rem;
    }

    .rating-subtitle {
        font-size: 0.82rem;
    }

    .rating-input-card {
        padding: 16px;
        border-radius: 16px;
    }

    .history-card {
        padding: 10px 12px;
        gap: 8px;
    }

    .history-rank-badge {
        display: none;
    }

    .history-macros {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: 0.7rem;
    }

    .history-right {
        gap: 6px;
    }

    .history-score {
        font-size: 1rem;
    }

    .rating-grid {
        grid-template-columns: 1fr;
    }

    .rating-actions {
        flex-direction: column;
    }

    .rating-btn-primary,
    .rating-btn-ghost {
        width: 100%;
        text-align: center;
    }

    .carousel-macros {
        display: none;
    }

    :root {
        --gauge-size: 110px;
    }

    .gauge-value {
        font-size: 1.8rem;
    }

    .rating-cta-card {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
        padding: 18px 16px;
    }

    .cta-header {
        justify-content: center;
    }

    .cta-btn {
        display: block;
        width: 100%;
        margin-top: 10px;
        text-align: center;
    }
}

@media (hover: none) {
    .neighbor-card:hover,
    .rating-topbar-cta:hover,
    .rating-btn-primary:hover {
        transform: none;
    }
}

/* ── AI 识别区 ── */
.rating-smart {
    position: relative;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 16px;
    overflow: hidden;
    transition:
        border-color 0.2s,
        box-shadow 0.2s;
}

.rating-smart:focus-within {
    border-color: var(--color-accent-primary);
    box-shadow: 0 4px 18px rgba(217, 119, 87, 0.12);
}

.rating-smart-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px 0;
}

.rating-smart-hint {
    font-family: 'Outfit', sans-serif;
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.rating-smart-trial-hint {
    font-family: 'Outfit', sans-serif;
    font-size: 0.68rem;
    font-weight: 500;
    color: var(--color-success);
    background: rgba(107, 142, 35, 0.1);
    border-radius: 4px;
    padding: 2px 8px;
    white-space: nowrap;
}

.rating-smart-textarea {
    display: block;
    width: 100%;
    padding: 10px 16px 4px;
    background: transparent;
    border: none;
    outline: none;
    resize: none;
    font-family: 'Outfit', 'Microsoft YaHei', sans-serif;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--color-text-main);
}

.rating-smart-textarea::placeholder {
    color: var(--color-text-muted);
    opacity: 0.75;
}

.rating-previews:not(:empty) {
    padding: 4px 16px 8px;
}

.rating-preview-item {
    position: relative;
    width: 64px;
    height: 64px;
}

.rating-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid var(--color-border);
}

/* ── ECharts 雷达图悬浮提示框样式 (Radar Tooltip) ── */
.radar-tooltip-content {
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    line-height: 1.6;
    padding: 4px;
}
.radar-tooltip-title {
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--color-accent-primary);
}
.radar-tooltip-label {
    display: inline-block;
    width: 75px;
    color: var(--color-text-muted);
}
.radar-tooltip-unit {
    color: var(--color-text-muted);
    opacity: 0.85;
    font-size: 12px;
}
.radar-tooltip-sub {
    color: var(--color-text-muted);
    font-size: 12px;
}

.rating-preview-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-text-main);
    color: #fff;
    border: 2px solid #fff;
    border-radius: 50%;
    font-size: 0.6rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s;
}

.rating-preview-remove:hover {
    background: var(--color-accent-primary);
}

.rating-smart-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px 12px;
}

.rating-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    color: var(--color-text-muted);
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.rating-upload-btn:hover {
    background: rgba(217, 119, 87, 0.06);
    border-color: rgba(217, 119, 87, 0.35);
    color: var(--color-accent-primary);
}

.rating-upload-btn img {
    width: 15px;
    height: 15px;
}

.rating-smart-submit {
    font-family: 'Outfit', sans-serif;
    background: var(--color-accent-primary);
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 9px 22px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.rating-smart-submit:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(217, 119, 87, 0.3);
}

.rating-smart-submit:disabled {
    background: rgba(140, 127, 112, 0.25);
    color: rgba(255, 255, 255, 0.85);
    cursor: not-allowed;
}

/* 识别中：盖住整个输入区，避免用户重复提交 */
.rating-smart-mask {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 2;
}

.rating-smart-mask[hidden] {
    display: none;
}

.smart-loading-dots {
    display: flex;
    gap: 7px;
}

.smart-loading-dots i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-accent-primary);
    animation: smartDotPulse 1.2s ease-in-out infinite;
}

.smart-loading-dots i:nth-child(2) {
    animation-delay: 0.16s;
}

.smart-loading-dots i:nth-child(3) {
    animation-delay: 0.32s;
}

@keyframes smartDotPulse {
    0%,
    80%,
    100% {
        opacity: 0.25;
        transform: scale(0.8);
    }
    40% {
        opacity: 1;
        transform: scale(1);
    }
}

.smart-loading-text {
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

/* 拖拽悬停提示 */
.rating-drop-veil {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(245, 240, 234, 0.94);
    border: 2px dashed var(--color-accent-primary);
    border-radius: 16px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    color: var(--color-accent-primary);
    z-index: 3;
    pointer-events: none;
}

.rating-smart.drag-over .rating-drop-veil {
    display: flex;
}

.rating-error-smart {
    margin-top: 10px;
    margin-bottom: 0;
}

.rating-divider {
    display: flex;
    align-items: center;
    text-align: center;
    font-family: 'Outfit', sans-serif;
    color: var(--color-text-muted);
    font-size: 0.78rem;
    margin: 12px 0 2px;
}

.rating-divider::before,
.rating-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--color-border);
}

.rating-divider span {
    padding: 0 12px;
}

/* ── 多菜品切换 ── */
.rating-dish-switch {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid var(--color-border);
    border-radius: 999px;
}

.rating-dish-switch[hidden] {
    display: none;
}

.dish-nav-btn {
    flex: none;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: 50%;
    color: var(--color-accent-primary);
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s;
}

.dish-nav-btn:hover {
    background: var(--color-accent-primary);
    border-color: var(--color-accent-primary);
    color: #fff;
}

.dish-switch-center {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.dish-switch-name {
    max-width: 100%;
    font-family: 'Outfit', 'Microsoft YaHei', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dish-switch-dots {
    display: flex;
    gap: 6px;
}

.dish-dot {
    width: 7px;
    height: 7px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(95, 74, 58, 0.2);
    cursor: pointer;
    transition: all 0.2s;
}

.dish-dot:hover {
    background: rgba(217, 119, 87, 0.5);
}

.dish-dot.is-active {
    width: 18px;
    border-radius: 4px;
    background: var(--color-accent-primary);
}

/* 混合品类时的说明 */
.neighbor-note {
    margin-bottom: 10px;
    padding: 9px 14px;
    background: rgba(217, 119, 87, 0.07);
    border-left: 3px solid rgba(217, 119, 87, 0.45);
    border-radius: 0 8px 8px 0;
    font-family: 'Outfit', 'Microsoft YaHei', sans-serif;
    font-size: 0.8rem;
    line-height: 1.5;
    color: var(--color-text-muted);
}

.neighbor-note[hidden] {
    display: none;
}

/* ── 手动输入折叠面板 ── */
.rating-manual-toggle {
    border-radius: 12px;
    background: transparent;
}

.rating-manual-summary {
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-text-muted);
    outline: none;
    user-select: none;
    text-align: center;
    list-style: none;
    padding: 4px;
    transition: color 0.2s;
}

.rating-manual-summary:hover {
    color: var(--color-accent-primary);
}

.rating-manual-summary::-webkit-details-marker {
    display: none;
}

.rating-manual-summary::before {
    content: '▸';
    display: inline-block;
    margin-right: 6px;
    transition: transform 0.2s;
}

.rating-manual-toggle[open] .rating-manual-summary::before {
    transform: rotate(90deg);
}

.rating-manual-content {
    margin-top: 8px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── 手动录入 tab 切换 ── */
.manual-tab-nav[hidden] {
    display: none !important;
}

.manual-tab-nav {
    display: inline-flex;
    background: rgba(95, 74, 58, 0.07);
    border-radius: 999px;
    padding: 3px;
    gap: 2px;
    margin-bottom: 16px;
}

.manual-tab-btn {
    font-family: 'Outfit', sans-serif;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--color-text-muted);
    background: none;
    border: none;
    border-radius: 999px;
    padding: 6px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.manual-tab-btn.active {
    background: var(--color-text-main);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.manual-tab-btn:hover:not(.active) {
    color: var(--color-text-main);
}

.manual-tab-pane[hidden] {
    display: none;
}

/* ── 批量添加食品 ── */
.batch-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.batch-header-hint {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.batch-fill-demo-btn {
    padding: 2px 10px;
    font-size: 0.75rem;
    height: auto;
}

.batch-import-box {
    min-height: 140px;
}

.batch-import-box .rating-smart-textarea {
    min-height: 140px;
    padding: 14px 16px;
    background: #faf7f2;
    border-radius: 14px;
    border-color: #eadfd3;
}
@media (max-width: 520px) {
    .rating-smart-head {
        flex-wrap: wrap;
        gap: 6px;
        align-items: center;
    }

    .rating-smart-hint {
        font-size: 0.75rem;
    }

    .rating-smart-toolbar {
        gap: 8px;
    }

    .rating-smart-submit {
        padding: 9px 18px;
    }
}
