/* ============================================================
   segmentation_basic.css - 07 Segmentation
   ============================================================ */
.seg-basic-region-row {
    grid-template-columns: 18px minmax(80px, 0.8fr) minmax(90px, 1fr) 38px;
}

.seg-basic-region-row > i {
    display: block;
    width: 13px;
    height: 13px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    box-shadow: 0 0 0 1px #cbd5e1;
}

.segmentation-basic-workbench .vision-formula-card {
    gap: 8px;
    padding: 12px;
}

.segmentation-basic-workbench .vision-formula-card strong {
    font-family: "Times New Roman", "Cambria Math", serif;
    font-size: 14px;
    line-height: 1.35;
}

.seg-latex-inline {
    display: block;
    overflow-wrap: anywhere;
}

.seg-notes-current {
    display: grid;
    gap: 8px;
    border: 1px solid #dbeafe;
    border-radius: 13px;
    padding: 10px;
    background: linear-gradient(180deg, #f8fbff, #ffffff);
}

.seg-notes-current p {
    margin: 0;
    color: #475569;
    font-size: 11px;
    line-height: 1.48;
}

.seg-notes-flowline {
    position: relative;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    overflow: hidden;
}

.seg-notes-flowline::after {
    content: "";
    position: absolute;
    top: 17px;
    left: 4px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #f97316;
    box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.16);
    animation: segNotesFlowDot 1.45s ease-in-out infinite;
}

.seg-notes-flowline span {
    display: grid;
    min-height: 34px;
    place-items: center;
    border: 1px solid #bfdbfe;
    border-radius: 9px;
    padding: 5px;
    color: #172554;
    font-size: 9px;
    font-weight: 950;
    line-height: 1.2;
    text-align: center;
    background: #eff6ff;
}

.seg-notes-flowline i {
    display: none;
}

.seg-notes-stat-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
}

.seg-notes-stat-grid div {
    display: grid;
    gap: 2px;
    border: 1px solid #e2e8f0;
    border-radius: 9px;
    padding: 6px 7px;
    background: #f8fafc;
}

.seg-notes-stat-grid span {
    color: #64748b;
    font-size: 8px;
    font-weight: 900;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.seg-notes-stat-grid strong {
    overflow: hidden;
    color: #1e3a8a;
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 原理解释脑洞类比卡片 */
.seg-concept-analogy {
    position: relative;
    border: 1px dashed #f59e0b;
    border-radius: 12px;
    padding: 11px 12px 11px 34px;
    background: #fdfaf2;
    box-shadow: inset 0 1px 3px rgba(245, 158, 11, 0.03);
    margin: 4px 0 10px 0;
}

.seg-concept-analogy::before {
    content: "💡";
    position: absolute;
    top: 10px;
    left: 11px;
    font-size: 14px;
    filter: drop-shadow(0 2px 4px rgba(245, 158, 11, 0.28));
}

.seg-concept-analogy strong {
    display: block;
    color: #b45309;
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 3px;
}

.seg-concept-analogy p {
    margin: 0;
    color: #78350f;
    font-size: 11px;
    font-weight: 550;
    line-height: 1.5;
}

.seg-notes-compact {
    margin-top: 8px !important;
    display: grid;
    gap: 8px;
}

.seg-notes-compact > div {
    position: relative;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 10px 12px 10px 14px;
    background: linear-gradient(180deg, #ffffff, #f8fafc);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    overflow: hidden;
}

.seg-notes-compact > div::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, #3b82f6, #60a5fa);
    border-radius: 12px 0 0 12px;
}

.seg-notes-compact > div:nth-child(2)::before {
    background: linear-gradient(180deg, #10b981, #34d399);
}

.seg-notes-compact > div:nth-child(3)::before {
    background: linear-gradient(180deg, #f59e0b, #fbbf24);
}

.seg-notes-compact > div:nth-child(4)::before {
    background: linear-gradient(180deg, #8b5cf6, #a78bfa);
}

.seg-notes-compact dt {
    color: #1e3a8a;
    font-size: 12px;
    font-weight: 800;
    margin-bottom: 3px;
}

.seg-notes-compact dd {
    margin: 0;
    color: #475569;
    font-size: 11px;
    line-height: 1.5;
}

.method-error {
    margin: 0;
    border: 1px solid #fecaca;
    border-radius: 12px;
    padding: 10px;
    color: #991b1b;
    background: #fff1f2;
}

.seg-basic-stage-panel {
    min-height: 0;
}

.segmentation-basic-workbench {
    align-items: start;
    grid-template-columns: minmax(210px, 238px) minmax(760px, 1fr) minmax(248px, 292px);
    gap: 12px;
}

.segmentation-basic-workbench::before {
    display: none;
}

.segmentation-basic-workbench .vision-panel,
.segmentation-basic-workbench .method-stage-panel {
    background: rgba(255, 255, 255, 0.74);
    backdrop-filter: blur(16px);
}

[data-seg-basic-lab] [hidden] {
    display: none !important;
}

.seg-basic-methods {
    grid-template-columns: 1fr;
}

.seg-basic-method-groups {
    display: grid;
    gap: 10px;
}

.seg-basic-method-groups section {
    display: grid;
    gap: 7px;
    min-width: 0;
    border: 1px solid #dbeafe;
    border-radius: 14px;
    padding: 10px;
    background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.seg-basic-method-groups section > strong {
    color: #1e3a8a;
    font-size: 11px;
    font-weight: 950;
}

.seg-basic-kmeans-controls {
    display: grid;
    gap: 8px;
    border: 1px solid #dbeafe;
    border-radius: 14px;
    padding: 10px;
    background: #f8fbff;
}

.seg-basic-action-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.seg-basic-action-row button {
    min-height: 36px;
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    color: #1d4ed8;
    font: inherit;
    font-size: 11px;
    font-weight: 900;
    cursor: pointer;
    background: #eff6ff;
    padding: 0;
    margin: 0;
    width: 100%;
}

.seg-basic-action-row button:disabled {
    cursor: not-allowed;
    opacity: 0.58;
}

.seg-basic-playground[hidden],
.seg-basic-concept-view[hidden] {
    display: none !important;
}

.seg-basic-playground {
    position: relative;
    display: grid;
    gap: 10px;
    padding: 12px;
    background:
        linear-gradient(90deg, rgba(219, 234, 254, 0.46) 1px, transparent 1px),
        linear-gradient(180deg, rgba(219, 234, 254, 0.46) 1px, transparent 1px),
        #f8fafc;
    background-size: 28px 28px;
    overflow: hidden;
}

.seg-basic-playground::before,
.seg-basic-playground::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.seg-basic-playground::before {
    background:
        radial-gradient(circle at 18% 22%, rgba(125, 211, 252, 0.34) 0 2px, transparent 3px),
        radial-gradient(circle at 72% 12%, rgba(216, 180, 254, 0.32) 0 2px, transparent 3px),
        radial-gradient(circle at 88% 66%, rgba(147, 197, 253, 0.36) 0 2px, transparent 3px);
    background-size: 190px 140px, 230px 170px, 170px 210px;
    animation: segDataParticles 7s linear infinite;
}

.seg-basic-playground::after {
    background: linear-gradient(115deg, transparent 0 38%, rgba(255, 255, 255, 0.34) 45%, transparent 54% 100%);
    opacity: 0.5;
    transform: translateX(-70%);
    animation: segGlassSweep 5.4s ease-in-out infinite;
}

.seg-basic-playground > * {
    position: relative;
    z-index: 1;
}

.seg-basic-playground[data-phase] .seg-basic-input-card,
.seg-basic-playground[data-phase] .seg-basic-output-card,
.seg-basic-playground[data-phase] .seg-basic-process-card {
    animation: segPhaseReveal 0.38s ease both;
}

.seg-basic-playground[data-phase="image"] .seg-basic-step-focus,
.seg-basic-playground[data-phase="feature"] .seg-basic-step-focus,
.seg-basic-playground[data-phase="assign"] .seg-basic-step-focus,
.seg-basic-playground[data-phase="update"] .seg-basic-step-focus,
.seg-basic-playground[data-phase="map"] .seg-basic-step-focus,
.seg-basic-playground[data-phase="stats"] .seg-basic-step-focus {
    margin-top: -2px;
}

.seg-basic-playground[data-phase] .seg-process-mini-card {
    display: none;
}

.seg-basic-playground[data-phase="image"] .seg-process-output-card,
.seg-basic-playground[data-phase="feature"] .seg-process-feature-card,
.seg-basic-playground[data-phase="assign"] .seg-process-iteration-card,
.seg-basic-playground[data-phase="update"] .seg-process-iteration-card,
.seg-basic-playground[data-phase="map"] .seg-process-output-card,
.seg-basic-playground[data-phase="stats"] .seg-process-output-card {
    display: grid;
    animation: segProcessCardIn 0.42s ease both;
}

.seg-basic-playground[data-phase] .seg-basic-process-grid {
    grid-template-columns: 1fr;
}

.seg-basic-playground .seg-basic-step-matrix,
.seg-basic-playground .seg-basic-step-detail {
    display: none;
}

.seg-basic-playground .seg-basic-step-visual {
    animation: segStepCardLift 0.4s ease both;
}

.seg-basic-canvas-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.seg-basic-canvas-grid figure {
    position: relative;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 8px;
    min-width: 0;
    min-height: 254px;
    margin: 0;
    border: 1px solid #dbeafe;
    border-radius: 14px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.72);
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.05);
    backdrop-filter: blur(12px);
}

.seg-basic-input-card::after {
    content: "";
    position: absolute;
    top: 44px;
    bottom: 14px;
    left: 12px;
    width: 2px;
    border-radius: 99px;
    background: linear-gradient(180deg, transparent, rgba(96, 165, 250, 0.86), transparent);
    box-shadow: 0 0 18px rgba(37, 99, 235, 0.34);
    animation: segInputScan 2.8s ease-in-out infinite;
    pointer-events: none;
}

.seg-basic-input-card {
    grid-column: 1;
    grid-row: 1;
}

.seg-basic-output-card {
    grid-column: 2;
    grid-row: 1;
}

.seg-basic-process-card {
    display: block !important;
    min-height: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    margin: 0;
}

.seg-basic-process-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr) minmax(0, 1fr);
    align-items: stretch;
    gap: 12px;
}

.seg-process-mini-card {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 9px;
    min-width: 0;
    min-height: 168px;
    border: 1px solid #dbeafe;
    border-radius: 14px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.66);
    box-shadow: 0 16px 30px rgba(37, 99, 235, 0.08);
    backdrop-filter: blur(14px);
}

.seg-basic-process-row {
    display: grid;
    grid-template-columns: minmax(240px, 0.42fr) minmax(0, 1fr);
    gap: 12px;
    align-items: stretch;
    min-width: 0;
}

.seg-basic-process-row .seg-basic-process-card {
    min-width: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.seg-basic-process-row .seg-basic-process-grid {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.seg-basic-process-row .seg-basic-step-focus {
    min-width: 0;
    grid-template-columns: 1fr;
    padding: 8px;
    height: 100%;
}

.seg-basic-process-row .seg-process-mini-card {
    display: none;
    height: 100%;
    box-sizing: border-box;
}

.seg-basic-process-row .seg-process-output-card {
    display: grid;
    height: 100%;
}

.seg-basic-process-row .seg-process-output-card {
    animation: segOutputPulse 2.8s ease-in-out infinite;
}

.seg-process-iteration-card {
    position: relative;
    overflow: hidden;
}

.seg-process-iteration-card::before,
.seg-process-iteration-card::after {
    content: "";
    position: absolute;
    right: 10px;
    left: 10px;
    height: 3px;
    border-radius: 999px;
    background: #dbeafe;
}

.seg-process-iteration-card::before {
    bottom: 11px;
}

.seg-process-iteration-card::after {
    bottom: 11px;
    width: var(--iter-progress, 0%);
    background: linear-gradient(90deg, #60a5fa, #2563eb);
    box-shadow: 0 0 14px rgba(37, 99, 235, 0.28);
    animation: methodBarGrow 0.5s ease both;
}

.seg-process-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
}

.seg-process-card-head strong {
    overflow: hidden;
    color: #1e40af;
    font-size: 11px;
    font-weight: 950;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.seg-process-card-head small {
    flex: 0 0 auto;
    color: #64748b;
    font-size: 9px;
    font-weight: 900;
}

.seg-process-card-head small.is-converged {
    color: #16a34a;
}

.seg-process-metrics,
.seg-process-output-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.seg-process-output-card .seg-process-output-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
}

.seg-process-metrics div,
.seg-process-output-list div {
    display: grid;
    gap: 3px;
    min-width: 0;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 8px;
    background: #f8fbff;
}

.seg-process-metrics span,
.seg-process-output-list span {
    overflow: hidden;
    color: #64748b;
    font-size: 8px;
    font-weight: 950;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}

.seg-process-metrics strong,
.seg-process-output-list strong {
    overflow: hidden;
    color: #172554;
    font-size: 12px;
    font-weight: 950;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.seg-process-output-card {
    position: relative;
    overflow: hidden;
}

.seg-output-story {
    display: grid;
    grid-template-columns: minmax(72px, 0.72fr) 36px minmax(74px, 0.78fr);
    align-items: center;
    gap: 7px;
    min-height: 92px;
    border: 1px solid #dbeafe;
    border-radius: 12px;
    padding: 8px;
    background:
        linear-gradient(90deg, rgba(219, 234, 254, 0.38) 1px, transparent 1px),
        linear-gradient(180deg, rgba(219, 234, 254, 0.32) 1px, transparent 1px),
        rgba(255, 255, 255, 0.72);
    background-size: 18px 18px;
}

.seg-output-labelmap {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 2px;
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    padding: 6px;
    background: rgba(248, 251, 255, 0.9);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.7);
}

.seg-output-labelmap i {
    aspect-ratio: 1;
    border-radius: 3px;
    background: var(--seg-label-color, #93c5fd);
    animation: segLabelCellDecode 1.9s ease-in-out infinite;
    animation-delay: calc(var(--i, 0) * 20ms);
}

.seg-output-labelmap i:nth-child(4n + 1) {
    --seg-label-color: #93c5fd;
}

.seg-output-labelmap i:nth-child(4n + 2) {
    --seg-label-color: #86efac;
}

.seg-output-labelmap i:nth-child(4n + 3) {
    --seg-label-color: #fdba74;
}

.seg-output-labelmap i:nth-child(4n) {
    --seg-label-color: #c4b5fd;
}

.seg-output-decode-arrow {
    display: grid;
    justify-items: center;
    gap: 6px;
    color: #2563eb;
    font-size: 8px;
    font-weight: 950;
    text-transform: uppercase;
}

.seg-output-decode-arrow b {
    position: relative;
    display: block;
    width: 34px;
    height: 2px;
    border-radius: 999px;
    background: #bfdbfe;
    overflow: hidden;
}

.seg-output-decode-arrow b::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 60%;
    border-radius: inherit;
    background: #2563eb;
    animation: segDecodeArrowFlow 1.25s ease-in-out infinite;
}

.seg-output-decode-arrow b::after {
    content: "";
    position: absolute;
    right: -1px;
    top: 50%;
    width: 7px;
    height: 7px;
    border-top: 2px solid #2563eb;
    border-right: 2px solid #2563eb;
    transform: translateY(-50%) rotate(45deg);
}

.seg-output-overlay-demo {
    position: relative;
    min-height: 68px;
    overflow: hidden;
    border: 1px solid #bfdbfe;
    border-radius: 12px;
    background: #f8fafc;
}

.seg-output-overlay-demo span {
    position: absolute;
    inset: 0;
}

.seg-demo-photo {
    background:
        linear-gradient(135deg, rgba(15, 23, 42, 0.34), transparent 32%),
        radial-gradient(circle at 24% 72%, rgba(51, 65, 85, 0.42) 0 7px, transparent 8px),
        radial-gradient(circle at 54% 60%, rgba(51, 65, 85, 0.32) 0 10px, transparent 11px),
        linear-gradient(180deg, #dbeafe 0 42%, #f8fafc 43% 100%);
}

.seg-demo-mask {
    background:
        linear-gradient(90deg, rgba(147, 197, 253, 0.58) 0 28%, rgba(134, 239, 172, 0.56) 28% 54%, rgba(253, 186, 116, 0.54) 54% 76%, rgba(196, 181, 253, 0.58) 76% 100%);
    opacity: 0.42;
    transform: translateY(18%);
    animation: segMaskLayerRise 1.65s ease-in-out infinite;
}

.seg-demo-boundary {
    background:
        linear-gradient(90deg, transparent 0 26%, rgba(30, 41, 59, 0.62) 26.5% 27.5%, transparent 28% 52%, rgba(30, 41, 59, 0.62) 52.5% 53.5%, transparent 54% 75%, rgba(30, 41, 59, 0.62) 75.5% 76.5%, transparent 77% 100%),
        linear-gradient(180deg, transparent 0 48%, rgba(30, 41, 59, 0.52) 48.5% 49.5%, transparent 50% 100%);
    opacity: 0;
    animation: segBoundaryTrace 1.65s ease-in-out infinite;
}

.seg-output-story[data-phase="image"] .seg-demo-mask,
.seg-output-story[data-phase="feature"] .seg-demo-mask,
.seg-output-story[data-phase="assign"] .seg-demo-mask {
    opacity: 0.18;
}

.seg-output-story[data-phase="map"] .seg-demo-mask,
.seg-output-story[data-phase="stats"] .seg-demo-mask {
    opacity: 0.48;
}

.seg-output-story[data-phase="stats"] .seg-output-labelmap {
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.7), 0 0 0 3px rgba(96, 165, 250, 0.12);
}

.seg-output-story[data-mode="rgbxy"] .seg-output-overlay-demo {
    background:
        linear-gradient(90deg, rgba(187, 247, 208, 0.36) 1px, transparent 1px),
        linear-gradient(180deg, rgba(187, 247, 208, 0.28) 1px, transparent 1px),
        #f8fafc;
    background-size: 14px 14px;
}

.seg-process-output-card.is-overlay-active {
    border-color: #93c5fd;
    background: linear-gradient(180deg, #eff6ff, #ffffff);
    animation: segProcessGlow 0.55s ease both;
}

.seg-process-output-card p {
    display: -webkit-box;
    overflow: hidden;
    margin: 0;
    color: #475569;
    font-size: 9.5px;
    font-weight: 780;
    line-height: 1.35;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.seg-process-output-card .seg-process-output-list strong {
    white-space: normal;
    line-height: 1.25;
}

.seg-process-output-card .seg-process-output-list div {
    min-height: 0;
    border-radius: 999px;
    padding: 6px 8px;
}

.seg-process-output-card .seg-process-output-list span {
    font-size: 7px;
}

.seg-process-output-card .seg-process-output-list strong {
    font-size: 9px;
}

.seg-basic-canvas-grid figcaption {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    overflow: hidden;
    color: #1e40af;
    font-size: 11px;
    font-weight: 950;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.seg-basic-canvas-grid figcaption strong,
.seg-basic-canvas-grid figcaption small {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.seg-basic-canvas-grid figcaption small {
    color: #64748b;
    font-size: 10px;
    font-weight: 850;
}

.seg-basic-canvas-grid canvas {
    width: 100%;
    aspect-ratio: 4 / 3;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #eaf2ff;
    image-rendering: auto;
}

.seg-basic-input-card canvas,
.seg-basic-output-card canvas {
    min-height: 216px;
}

.seg-basic-output-card canvas {
    cursor: crosshair;
}

.seg-basic-output-card::before {
    content: "";
    position: absolute;
    top: 44px;
    right: 14px;
    bottom: 14px;
    left: 14px;
    border-radius: 10px;
    background: linear-gradient(90deg, transparent 0 42%, rgba(255, 255, 255, 0.32) 50%, transparent 58% 100%);
    mix-blend-mode: screen;
    opacity: 0.62;
    transform: translateX(-70%);
    animation: segOverlaySweep 3.1s ease-in-out infinite;
    pointer-events: none;
}

.seg-basic-output-card::after {
    content: "RGB color grouping";
    position: absolute;
    right: 22px;
    bottom: 20px;
    border: 1px solid rgba(191, 219, 254, 0.86);
    border-radius: 999px;
    padding: 6px 10px;
    color: #172554;
    font-size: 9px;
    font-weight: 950;
    background: rgba(255, 255, 255, 0.72);
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.14);
    backdrop-filter: blur(10px);
    animation: segOverlayBadge 1.8s ease-in-out infinite;
    pointer-events: none;
}

.seg-basic-playground[data-feature-mode="rgbxy"] .seg-basic-output-card::after {
    content: "RGB + XY locality";
}

.seg-basic-playground[data-feature-mode="rgb"] .seg-basic-output-card {
    background:
        radial-gradient(circle at 22% 26%, rgba(96, 165, 250, 0.14), transparent 32%),
        rgba(255, 255, 255, 0.72);
}

.seg-basic-playground[data-feature-mode="rgbxy"] .seg-basic-output-card {
    background:
        linear-gradient(90deg, rgba(34, 197, 94, 0.07) 1px, transparent 1px),
        linear-gradient(180deg, rgba(34, 197, 94, 0.07) 1px, transparent 1px),
        rgba(255, 255, 255, 0.72);
    background-size: 36px 36px;
}

.seg-basic-output-card canvas.is-mask-fade {
    animation: segMaskFade 0.42s ease both, segMaskBreath 1.7s ease-in-out 0.42s;
}

.seg-basic-region-popover {
    position: absolute;
    right: 18px;
    bottom: 18px;
    display: grid;
    gap: 3px;
    max-width: min(230px, calc(100% - 36px));
    border: 1px solid #fed7aa;
    border-radius: 10px;
    padding: 9px 10px;
    color: #7c2d12;
    font-size: 10px;
    font-weight: 850;
    line-height: 1.35;
    background: rgba(255, 247, 237, 0.94);
    box-shadow: 0 12px 24px rgba(124, 45, 18, 0.16);
    pointer-events: none;
}

.seg-basic-region-popover strong {
    color: #9a3412;
    font-size: 11px;
}

.seg-basic-feature-space {
    position: relative;
    min-height: 146px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background:
        radial-gradient(circle at 18% 20%, rgba(34, 211, 238, 0.26), transparent 30%),
        radial-gradient(circle at 84% 78%, rgba(216, 180, 254, 0.26), transparent 35%),
        rgba(248, 251, 255, 0.76);
    perspective: 520px;
    backdrop-filter: blur(12px);
}

.seg-basic-feature-cloud {
    position: absolute;
    inset: 0;
}

.seg-feature-3d-shell {
    position: absolute;
    inset: 0;
    overflow: hidden;
    border-radius: 10px;
    background:
        linear-gradient(90deg, rgba(219, 234, 254, 0.48) 1px, transparent 1px),
        linear-gradient(180deg, rgba(219, 234, 254, 0.42) 1px, transparent 1px),
        rgba(255, 255, 255, 0.5);
    background-size: 26px 26px;
    animation: segFeatureStageIn 0.38s ease both;
}

.seg-feature-3d-shell[data-mode="rgbxy"] {
    background:
        linear-gradient(90deg, rgba(187, 247, 208, 0.42) 1px, transparent 1px),
        linear-gradient(180deg, rgba(219, 234, 254, 0.42) 1px, transparent 1px),
        rgba(255, 255, 255, 0.52);
    background-size: 24px 24px;
}

.seg-feature-3d-stage {
    position: absolute;
    inset: 0 0 24px;
    cursor: grab;
    touch-action: none;
}

.seg-feature-3d-stage:active {
    cursor: grabbing;
}

.seg-feature-3d-stage canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

.seg-feature-3d-labels {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
}

.seg-feature-3d-labels span {
    display: grid;
    width: 18px;
    height: 18px;
    place-items: center;
    border: 1px solid #bfdbfe;
    border-radius: 50%;
    color: #1d4ed8;
    font-size: 8px;
    font-weight: 950;
    background: rgba(255, 255, 255, 0.82);
}

.seg-feature-3d-caption {
    position: absolute;
    right: 8px;
    bottom: 7px;
    left: 8px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 7px;
    align-items: center;
    border: 1px solid rgba(191, 219, 254, 0.82);
    border-radius: 9px;
    padding: 5px 7px;
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: blur(8px);
}

.seg-feature-3d-caption strong {
    color: #1d4ed8;
    font-size: 9px;
    font-weight: 950;
}

.seg-feature-3d-caption span {
    min-width: 0;
    overflow: hidden;
    color: #475569;
    font-size: 8px;
    font-weight: 850;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.seg-feature-cube-scene {
    display: grid;
    place-items: center;
    transform-style: preserve-3d;
}

.seg-feature-cube {
    position: relative;
    z-index: 2;
    width: 106px;
    height: 106px;
    transform-style: preserve-3d;
    animation: segCubeRotate 8s linear infinite;
}

.seg-feature-cube-scene:hover .seg-feature-cube {
    animation-play-state: paused;
}

.seg-feature-xy-plane,
.seg-feature-rgb-beams {
    position: absolute;
    inset: 12px;
    z-index: 0;
    border-radius: 12px;
    pointer-events: none;
}

.seg-feature-xy-plane {
    background:
        linear-gradient(90deg, rgba(34, 197, 94, 0.2) 1px, transparent 1px),
        linear-gradient(180deg, rgba(34, 197, 94, 0.18) 1px, transparent 1px);
    background-size: 22px 22px;
    transform: perspective(260px) rotateX(58deg) translateY(42px) scale(0.86);
    transform-origin: center bottom;
    opacity: 0.78;
    animation: segXYPlaneDrift 4.2s ease-in-out infinite;
}

.seg-feature-xy-plane span {
    position: absolute;
    left: var(--x);
    top: var(--y);
    width: 34px;
    height: 34px;
    border: 1px solid rgba(34, 197, 94, 0.55);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: segXYLocalPulse 1.7s ease-in-out infinite;
}

.seg-feature-xy-plane b,
.seg-feature-rgb-beams b {
    position: absolute;
    right: 8px;
    bottom: 7px;
    border-radius: 999px;
    padding: 3px 7px;
    color: #14532d;
    font-size: 8px;
    font-weight: 950;
    background: rgba(240, 253, 244, 0.86);
}

.seg-feature-rgb-beams {
    overflow: hidden;
}

.seg-feature-rgb-beams span {
    position: absolute;
    left: 9%;
    top: 50%;
    width: 86%;
    height: 2px;
    border-radius: 999px;
    background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.78), rgba(168, 85, 247, 0.7), transparent);
    transform: rotate(var(--r));
    transform-origin: center;
    opacity: 0.72;
    animation: segRgbBeamFlow 2.1s ease-in-out infinite;
    animation-delay: var(--d);
}

.seg-feature-rgb-beams b {
    color: #1e3a8a;
    background: rgba(239, 246, 255, 0.88);
}

.seg-cube-face {
    position: absolute;
    inset: 0;
    border: 1px solid rgba(147, 197, 253, 0.7);
    border-radius: 6px;
    background:
        linear-gradient(90deg, rgba(191, 219, 254, 0.24) 1px, transparent 1px),
        linear-gradient(180deg, rgba(191, 219, 254, 0.24) 1px, transparent 1px),
        rgba(255, 255, 255, 0.13);
    background-size: 18px 18px;
    box-shadow: inset 0 0 18px rgba(96, 165, 250, 0.12);
}

.seg-cube-face.is-front {
    transform: translateZ(53px);
}

.seg-cube-face.is-back {
    transform: rotateY(180deg) translateZ(53px);
}

.seg-cube-face.is-left {
    transform: rotateY(-90deg) translateZ(53px);
}

.seg-cube-face.is-right {
    transform: rotateY(90deg) translateZ(53px);
}

.seg-cube-face.is-top {
    transform: rotateX(90deg) translateZ(53px);
}

.seg-cube-face.is-bottom {
    transform: rotateX(-90deg) translateZ(53px);
}

.seg-feature-particle,
.seg-feature-trail-3d,
.seg-feature-center-3d {
    position: absolute;
    top: 50%;
    left: 50%;
    transform-style: preserve-3d;
}

.seg-feature-particle {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--c);
    box-shadow: 0 0 7px var(--c);
    opacity: 0.68;
    transform: translate3d(var(--x), var(--y), var(--z));
    animation: segParticleFloat 2.6s ease-in-out infinite;
}

.seg-feature-trail-3d {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--c);
    opacity: 0.32;
    transform: translate3d(var(--x), var(--y), var(--z));
    box-shadow: 0 0 10px var(--c);
}

.seg-feature-center-3d {
    display: grid;
    width: var(--s);
    height: var(--s);
    place-items: center;
    border: 2px solid rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    color: #ffffff;
    font-size: 8px;
    font-weight: 950;
    background:
        radial-gradient(circle at 35% 30%, #ffffff, var(--c) 38%, rgba(15, 23, 42, 0.38) 100%);
    box-shadow: 0 0 16px var(--c), 0 10px 20px rgba(15, 23, 42, 0.28);
    transform: translate3d(var(--x), var(--y), var(--z)) translate(-50%, -50%);
    animation: segCenterPulse 1.25s ease-in-out infinite;
}

.seg-feature-center-3d span {
    text-shadow: 0 1px 5px rgba(15, 23, 42, 0.42);
}

.seg-feature-cube-labels {
    position: absolute;
    inset: 8px 9px auto auto;
    display: flex;
    gap: 4px;
}

.seg-feature-cube-labels span {
    display: grid;
    width: 17px;
    height: 17px;
    place-items: center;
    border: 1px solid #bfdbfe;
    border-radius: 50%;
    color: #1d4ed8;
    font-size: 8px;
    font-weight: 950;
    background: rgba(255, 255, 255, 0.72);
}

.seg-basic-feature-cloud svg {
    position: absolute;
    inset: 7px 8px 33px;
    width: calc(100% - 16px);
    height: calc(100% - 40px);
}

.seg-basic-feature-cloud svg rect {
    fill: rgba(255, 255, 255, 0.62);
    stroke: #bfdbfe;
}

.seg-basic-feature-cloud polyline {
    fill: none;
    stroke: var(--c);
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 5 4;
    opacity: 0.82;
    animation: segCenterTrail 0.68s ease both;
}

.seg-feature-samples {
    opacity: 0.55;
}

.seg-feature-sample-dot {
    stroke: rgba(255, 255, 255, 0.8);
    stroke-width: 0.45;
    animation: segSampleDotIn 0.5s ease both;
}

.seg-feature-center-arrow {
    stroke: var(--c);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-dasharray: 3 2;
    opacity: 0.9;
    animation: segCenterTrail 0.58s ease both;
}

.seg-feature-center circle {
    fill: var(--c);
    stroke: #ffffff;
    stroke-width: 3;
    filter: drop-shadow(0 7px 12px rgba(15, 23, 42, 0.2));
    animation: segCenterPulse 0.7s ease both;
}

.seg-feature-center text {
    fill: #ffffff;
    font-size: 8px;
    font-weight: 950;
    text-anchor: middle;
}

.seg-feature-trail-dot {
    fill: var(--c);
    opacity: 0.5;
    animation: segCenterDot 0.42s ease both;
}

.seg-feature-axis {
    position: absolute;
    inset: 10px 12px auto;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    color: #64748b;
    font-size: 9px;
    font-weight: 900;
    pointer-events: none;
}

.seg-basic-feature-cloud span {
    position: absolute;
    display: grid;
    place-items: center;
    border: 3px solid rgba(255, 255, 255, 0.85);
    border-radius: 50%;
    color: #ffffff;
    font-size: 9px;
    font-weight: 950;
    transform: translate(-50%, -50%);
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.18);
    animation: methodBarRise 0.48s ease both;
}

.seg-basic-feature-cloud em {
    position: absolute;
    right: 10px;
    bottom: 7px;
    left: 10px;
    border: 1px solid #dbeafe;
    border-radius: 9px;
    padding: 5px 7px;
    color: #475569;
    font-size: 9px;
    font-style: normal;
    font-weight: 800;
    line-height: 1.25;
    background: rgba(255, 255, 255, 0.86);
}

.seg-feature-mode-facts {
    position: absolute;
    right: 10px;
    bottom: 34px;
    left: 10px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 7px;
    align-items: center;
    border: 1px solid rgba(191, 219, 254, 0.8);
    border-radius: 9px;
    padding: 5px 7px;
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(8px);
}

.seg-feature-mode-facts strong {
    color: #1d4ed8;
    font-size: 9px;
    font-weight: 950;
}

.seg-feature-mode-facts span {
    min-width: 0;
    overflow: hidden;
    color: #475569;
    font-size: 8px;
    font-weight: 850;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.seg-basic-feature-cloud em strong {
    margin-right: 7px;
    color: #1d4ed8;
    font-style: normal;
    font-weight: 950;
}

.seg-basic-flow-band {
    display: grid;
    grid-template-columns: minmax(86px, 0.26fr) minmax(80px, 1fr) minmax(132px, 0.36fr) minmax(80px, 1fr) minmax(112px, 0.32fr);
    align-items: center;
    gap: 8px;
    border: 1px solid #dbeafe;
    border-radius: 14px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.78);
    box-shadow: 0 10px 22px rgba(37, 99, 235, 0.05);
}

.seg-basic-step-focus {
    display: grid;
    grid-template-columns: minmax(320px, 1.35fr) minmax(180px, 0.78fr) minmax(180px, 0.78fr);
    align-items: stretch; /* 让三个面板拉伸等高 */
    gap: 12px;
    max-width: 100%;
    overflow: hidden;
    border: 1px solid #bfdbfe;
    border-radius: 16px;
    padding: 12px;
    background:
        linear-gradient(180deg, rgba(239, 246, 255, 0.92), rgba(255, 255, 255, 0.96));
    box-shadow: 0 14px 30px rgba(37, 99, 235, 0.08);
}

.seg-basic-step-visual,
.seg-basic-step-matrix,
.seg-basic-step-detail {
    min-width: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.seg-basic-step-focus .seg-concept-card {
    height: 100%;
    min-height: 0;
    max-width: 100%;
    overflow: hidden;
    border-color: #dbeafe;
    background: #ffffff;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.seg-basic-step-focus .seg-basic-step-visual .seg-concept-card {
    min-height: 258px;
}

.seg-basic-step-focus[data-phase] .seg-basic-step-visual .seg-concept-card {
    position: relative;
    overflow: hidden;
    border-color: #bfdbfe;
    background:
        linear-gradient(90deg, rgba(219, 234, 254, 0.46) 1px, transparent 1px),
        linear-gradient(180deg, rgba(219, 234, 254, 0.38) 1px, transparent 1px),
        #ffffff;
    background-size: 24px 24px;
}

.seg-basic-step-focus[data-phase] .seg-basic-step-visual .seg-concept-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(105deg, transparent 0 35%, rgba(96, 165, 250, 0.13) 45%, transparent 56% 100%);
    transform: translateX(-80%);
    animation: segAlgoCanvasSweep 3.2s ease-in-out infinite;
    pointer-events: none;
}

.seg-basic-step-focus[data-phase] .seg-basic-step-visual .seg-concept-card h4 {
    position: relative;
    z-index: 1;
    display: inline-flex;
    width: fit-content;
    max-width: 100%;
    border: 1px solid #dbeafe;
    border-radius: 999px;
    padding: 6px 9px;
    background: rgba(255, 255, 255, 0.86);
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.08);
}

.seg-basic-step-focus .seg-concept-card h4 {
    font-size: 14px;
    flex-shrink: 0;
}

.seg-basic-step-focus .seg-concept-card p {
    display: -webkit-box;
    overflow: hidden;
    margin-bottom: 0;
    font-size: 9.5px;
    line-height: 1.32;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.seg-basic-step-focus[data-phase] .seg-basic-step-visual .seg-concept-card p {
    position: relative;
    z-index: 1;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 6px 8px;
    background: rgba(248, 251, 255, 0.84);
}

.seg-basic-step-focus .seg-concept-svg {
    width: 100%;
    height: 180px; /* 固定高度防止拉伸 */
    min-height: 0;
    max-height: 180px;
}

.seg-basic-step-focus[data-phase] .seg-basic-step-visual .seg-concept-svg {
    position: relative;
    z-index: 1;
    height: 176px;
    max-height: 176px;
    filter: drop-shadow(0 10px 18px rgba(37, 99, 235, 0.08));
}

.seg-basic-step-focus[data-phase="image"] .seg-algo-grid .seg-grid-cell {
    animation: segGridCellPop 0.42s cubic-bezier(0.2, 0.8, 0.2, 1) both, segSampleScanTint 2.2s ease-in-out infinite;
}

.seg-basic-step-focus[data-phase="assign"] .seg-kmeans-line,
.seg-basic-step-focus[data-phase="update"] .seg-kmeans-line {
    stroke-width: 4;
    opacity: 0.9;
}

.seg-basic-step-focus[data-phase="map"] .seg-algo-grid .seg-grid-cell,
.seg-basic-step-focus[data-phase="stats"] .seg-kmeans-stats-svg rect {
    animation: segRegionTint 0.52s ease both, segLabelCellDecode 2.1s ease-in-out infinite;
}
.seg-basic-step-focus .seg-concept-svg.is-3d-terrain {
    height: 236px;
    max-height: 236px;
}

.seg-basic-step-focus .seg-analysis-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.seg-basic-step-focus .seg-analysis-metrics span,
.seg-basic-step-focus .seg-analysis-metrics strong,
.seg-basic-step-focus .seg-concept-card dd {
    min-width: 0;
    overflow-wrap: anywhere;
}

.seg-basic-step-focus .seg-algo-bars {
    gap: 6px;
    overflow-y: auto; /* 溢出时开启内部自适应纵向平滑滚动 */
    max-height: 236px; /* 限制最大高度，多出时有精致窄滚动条，避免上下高度突变 */
    flex: 1;
    padding-right: 4px;
}

/* 兼容滚动条样式 */
.seg-basic-step-focus .seg-algo-bars::-webkit-scrollbar {
    width: 4px;
}
.seg-basic-step-focus .seg-algo-bars::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 99px;
}

/* 当条目过多（例如 e1-e10 超过 5 条）时，使其紧凑排列免去过多滚动 */
.seg-basic-step-focus .seg-algo-bars:has(span:nth-child(5)) span {
    min-height: 24px;
    padding: 3px 6px;
    gap: 6px;
}

.seg-basic-step-focus .seg-algo-bars:has(span:nth-child(5)) span b {
    font-size: 10.5px;
}

.seg-basic-step-focus .seg-algo-bars:has(span:nth-child(5)) span em {
    font-size: 10.5px;
}

.seg-basic-step-focus .seg-algo-bars span {
    display: grid;
    grid-template-columns: minmax(34px, 0.35fr) minmax(0, 1fr);
    gap: 8px;
    min-height: 32px;
    padding: 6px 8px;
    box-sizing: border-box;
}

.seg-basic-step-focus .seg-algo-bars b,
.seg-basic-step-focus .seg-algo-bars em {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.seg-basic-step-focus .seg-algo-bars em {
    text-align: right;
}

.seg-basic-step-focus .seg-kmeans-stats-svg {
    height: 168px;
    max-height: 168px;
}

.seg-basic-kmeans-support {
    border: 1px solid #dbeafe;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.9);
}

.seg-basic-kmeans-support summary {
    min-height: 42px;
    padding: 12px 14px;
    color: #1e40af;
    font-size: 11px;
    font-weight: 950;
    cursor: pointer;
    list-style-position: inside;
}

.seg-basic-kmeans-support[open] summary {
    border-bottom: 1px solid #e2e8f0;
    background: #f8fbff;
}

.seg-basic-kmeans-summary {
    display: grid;
    grid-template-columns: minmax(190px, 0.9fr) minmax(190px, 0.85fr) minmax(230px, 1fr) minmax(210px, 0.9fr);
    gap: 12px;
    padding: 12px;
}

.seg-basic-kmeans-summary section {
    display: grid;
    gap: 10px;
    min-width: 0;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 12px;
    background: #ffffff;
}

.seg-basic-center-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.seg-basic-label-card canvas {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #eff6ff;
}

.seg-basic-iteration-monitor {
    display: grid;
    gap: 8px;
}

.seg-basic-movement-bars {
    display: flex;
    align-items: end;
    gap: 5px;
    min-height: 124px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 10px 8px 20px;
    background: linear-gradient(180deg, #f8fbff, #ffffff);
}

.seg-basic-movement-bars i {
    position: relative;
    flex: 1 1 0;
    min-width: 5px;
    border-radius: 999px 999px 3px 3px;
    background: linear-gradient(180deg, #93c5fd, #2563eb);
    opacity: 0.72;
    animation: methodBarRise 0.42s ease both;
}

.seg-basic-movement-bars i.is-active {
    background: linear-gradient(180deg, #f97316, #2563eb);
    opacity: 1;
}

.seg-basic-movement-bars span {
    position: absolute;
    bottom: -17px;
    left: 50%;
    color: #64748b;
    font-size: 8px;
    font-style: normal;
    font-weight: 900;
    transform: translateX(-50%);
}

.seg-basic-iteration-monitor p {
    margin: 0;
    color: #475569;
    font-size: 10px;
    font-weight: 800;
    line-height: 1.45;
}

.seg-basic-center-row {
    display: grid;
    grid-template-columns: 20px 28px minmax(0, 1fr);
    align-items: center;
    gap: 7px;
    min-height: 34px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 6px;
    background: #f8fafc;
    animation: methodBarRise 0.36s ease both;
}

.seg-basic-center-row i {
    display: block;
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    box-shadow: 0 0 0 1px #cbd5e1;
}

.seg-basic-center-row strong {
    color: #1e40af;
    font-size: 10px;
}

.seg-basic-center-row span,
.seg-basic-center-row small {
    overflow: hidden;
    color: #475569;
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.seg-basic-center-row small {
    grid-column: 3;
    margin-top: -4px;
    color: #94a3b8;
}

.seg-basic-region-row {
    display: grid;
    grid-template-columns: 18px minmax(78px, 0.78fr) minmax(80px, 1fr) minmax(78px, 0.64fr);
    align-items: center;
    gap: 7px;
    min-height: 32px;
    width: 100%;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 6px;
    color: inherit;
    font: inherit;
    text-align: left;
    background: #f8fafc;
    cursor: pointer;
    animation: segRegionTint 0.42s ease both;
}

.seg-basic-region-row:hover,
.seg-basic-region-row.is-selected {
    border-color: #93c5fd;
    background: #eff6ff;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.12);
}

.seg-basic-region-row.is-selected {
    outline: 2px solid rgba(249, 115, 22, 0.26);
}

.seg-basic-region-row em {
    white-space: nowrap;
}

.seg-basic-region-row i {
    width: 14px;
    height: 14px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    box-shadow: 0 0 0 1px #cbd5e1;
}

.seg-basic-region-row strong {
    color: #1e40af;
    font-size: 10px;
}

.seg-basic-region-row div {
    overflow: hidden;
    height: 7px;
    border-radius: 999px;
    background: #e2e8f0;
}

.seg-basic-region-row div span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #93c5fd, #2563eb);
}

.seg-basic-region-row em {
    color: #475569;
    font-size: 10px;
    font-style: normal;
    font-weight: 850;
}

.seg-basic-muted {
    margin: 0;
    border: 1px dashed #bfdbfe;
    border-radius: 10px;
    padding: 10px;
    color: #64748b;
    font-size: 11px;
    background: #f8fbff;
}

.seg-basic-compare-note {
    margin: 0;
    font-size: 11px;
    line-height: 1.55;
}

.seg-basic-sample-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.seg-basic-selector-wrapper {
    position: relative;
    width: 100%;
}

.seg-basic-selector-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 38px;
    padding: 8px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #ffffff;
    color: #334155;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.seg-basic-selector-trigger:hover {
    border-color: #94a3b8;
    background: #f8fafc;
}

.seg-basic-selector-trigger svg {
    color: #64748b;
    transition: transform 0.2s ease;
}

.seg-basic-selector-wrapper.is-open .seg-basic-selector-trigger svg {
    transform: rotate(180deg);
}

.seg-basic-dropdown-panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 50;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    padding: 8px;
    display: none;
}

.seg-basic-selector-wrapper.is-open .seg-basic-dropdown-panel {
    display: block;
}

.seg-basic-sample-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    max-height: 76px; /* 初始显示 1 行的高度 (卡片 68px + gap) */
    overflow-y: auto;
    padding: 2px;
}

.seg-basic-selector-wrapper.is-open .seg-basic-sample-grid {
    max-height: 240px; /* 展开后显现更多行并支持滚动 */
}

.seg-basic-sample-grid button {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    border: 1px solid #dbeafe;
    border-radius: 8px;
    padding: 4px;
    color: #1e3a8a;
    background: #f8fbff;
    cursor: pointer;
    height: 68px; /* 固定高度让其垂直分布 */
    box-sizing: border-box;
    transition: all 0.2s ease;
}

.seg-basic-sample-grid button:hover {
    border-color: #93c5fd;
    background: #eff6ff;
}

.seg-basic-sample-grid button.is-active {
    border-color: #2563eb;
    background: #eff6ff;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.1);
}

.seg-basic-sample-grid img {
    width: 100%;
    height: 40px;
    border-radius: 4px;
    object-fit: cover;
    background: #e2e8f0;
    flex-shrink: 0;
}

.seg-basic-sample-grid span {
    overflow: hidden;
    font-size: 10px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #334155;
    text-align: center;
}

.seg-basic-sample-grid button.is-active span {
    color: #2563eb;
}

.seg-basic-concept-view {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    column-gap: 12px;
    row-gap: 14px;
    padding: 10px;
    background:
        radial-gradient(circle at 20% 20%, rgba(219, 234, 254, 0.78), transparent 34%),
        #f8fafc;
}

.seg-basic-concept-result {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    border: 1px solid #bfdbfe;
    border-radius: 16px;
    padding: 10px;
    background:
        linear-gradient(180deg, rgba(239, 246, 255, 0.96), rgba(255, 255, 255, 0.94));
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.08);
}

.seg-basic-concept-result figure {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 7px;
    min-width: 0;
    margin: 0;
    border: 1px solid #dbeafe;
    border-radius: 13px;
    padding: 8px;
    background: #ffffff;
}

.seg-concept-figure-head {
    display: grid;
    align-content: start;
    gap: 5px;
    min-height: 52px;
}

.seg-basic-concept-result figcaption {
    color: #1e3a8a;
    font-size: 11px;
    font-weight: 950;
}

.seg-grabcut-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.seg-grabcut-toolbar[hidden] {
    display: none;
}

.seg-grabcut-toolbar button {
    min-height: 29px;
    border: 1px solid #dbeafe;
    border-radius: 8px;
    padding: 0 10px;
    color: #1e3a8a;
    font-size: 10px;
    font-weight: 900;
    background: #f8fbff;
    cursor: pointer;
}

.seg-grabcut-toolbar button.is-active {
    border-color: #93c5fd;
    color: #ffffff;
    background: #2563eb;
    box-shadow: 0 6px 14px rgba(37, 99, 235, 0.18);
}

.seg-basic-concept-result canvas {
    display: block;
    width: 100%;
    height: clamp(184px, 16vw, 238px);
    min-height: 0;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #e2e8f0;
    object-fit: contain;
}

.seg-basic-concept-result canvas[data-segb-concept-source] {
    cursor: crosshair;
    touch-action: none;
}

.seg-basic-concept-result p {
    margin: 0;
    color: #475569;
    font-size: 11px;
    line-height: 1.36;
}

.seg-basic-frame-strip {
    position: relative;
    display: grid;
    grid-column: 1 / -1;
    grid-auto-flow: column;
    grid-auto-columns: minmax(126px, 1fr);
    gap: 10px;
    overflow-x: auto;
    border: 1px solid #bfdbfe;
    border-radius: 16px;
    padding: 10px 10px 14px 10px;
    background: rgba(255, 255, 255, 0.72);
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.07);
    backdrop-filter: blur(14px);
    scrollbar-width: thin;
    scrollbar-color: #bfdbfe transparent;
}

.seg-basic-frame-strip::-webkit-scrollbar {
    height: 6px;
}

.seg-basic-frame-strip::-webkit-scrollbar-track {
    background: transparent;
}

.seg-basic-frame-strip::-webkit-scrollbar-thumb {
    background-color: #bfdbfe;
    border-radius: 99px;
}

.seg-basic-frame-strip::-webkit-scrollbar-thumb:hover {
    background-color: #93c5fd;
}

.seg-basic-frame-strip::before {
    content: "";
    position: absolute;
    right: 18px;
    bottom: 13px;
    left: 18px;
    height: 2px;
    border-radius: 99px;
    background: linear-gradient(90deg, #bfdbfe, #2563eb, #bfdbfe);
    opacity: 0.7;
    box-shadow: 0 0 16px rgba(37, 99, 235, 0.26);
}

.seg-basic-frame-strip::after {
    content: "";
    position: absolute;
    bottom: 10px;
    left: 18px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.16), 0 0 18px #60a5fa;
    animation: segTimelineOrb 4.8s ease-in-out infinite;
}

.seg-basic-frame-strip:empty {
    display: none;
}

.seg-basic-frame-strip button {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 6px 8px;
    min-width: 0;
    min-height: 122px;
    overflow: hidden;
    border: 1px solid #dbeafe;
    border-radius: 12px;
    padding: 7px;
    color: #1e3a8a;
    text-align: left;
    background: rgba(248, 251, 255, 0.78);
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.seg-basic-frame-strip button:hover {
    transform: translateY(-2px);
    border-color: #93c5fd;
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.1);
}

.seg-basic-frame-strip button.is-active:hover {
    transform: none;
}

.seg-basic-frame-strip button::after {
    content: "";
    position: absolute;
    inset: auto 0 0 0;
    height: 3px;
    transform: scaleX(0);
    transform-origin: left;
    background: #2563eb;
}

.seg-basic-frame-strip.is-playing button.is-active::after {
    animation: segFrameProgress 0.62s linear both;
}

.seg-basic-frame-strip button.is-active {
    border-color: #2563eb;
    background:
        linear-gradient(180deg, #eff6ff, #ffffff);
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.16), 0 0 0 3px rgba(96, 165, 250, 0.12);
}

.seg-basic-frame-strip button.is-active span {
    background: #f97316;
}

.seg-basic-frame-strip canvas {
    grid-column: 1 / -1;
    display: block;
    width: 100%;
    height: 72px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #e2e8f0;
    object-fit: cover;
}

.seg-basic-frame-strip button.is-active canvas {
    border-color: #93c5fd;
    box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.16);
}

.seg-basic-frame-strip span {
    display: grid;
    width: 20px;
    height: 20px;
    place-items: center;
    border-radius: 50%;
    color: #ffffff;
    font-size: 10px;
    font-weight: 950;
    background: #2563eb;
}

.seg-basic-frame-strip strong {
    min-width: 0;
    overflow: hidden;
    color: #172554;
    font-size: 10px;
    font-weight: 950;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.seg-basic-note-current {
    display: grid;
    gap: 4px;
    border: 1px solid #bfdbfe;
    border-radius: 12px;
    padding: 9px;
    background: linear-gradient(180deg, #eff6ff, #ffffff);
}

.seg-basic-note-current span {
    color: #2563eb;
    font-size: 9px;
    font-weight: 950;
    text-transform: uppercase;
}

.seg-basic-note-current strong {
    color: #172554;
    font-size: 13px;
    font-weight: 950;
}

.seg-basic-note-current p {
    margin: 0;
    color: #475569;
    font-size: 10px;
    font-weight: 750;
    line-height: 1.42;
}

.seg-notes-mini-flow {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 10px minmax(0, 1fr) 10px minmax(0, 1fr) 10px minmax(0, 1fr);
    align-items: center;
    gap: 4px;
    border: 1px solid #dbeafe;
    border-radius: 12px;
    padding: 7px;
    background: #f8fbff;
}

.seg-notes-mini-flow span {
    display: grid;
    min-height: 28px;
    place-items: center;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    padding: 4px;
    color: #1e40af;
    font-size: 9px;
    font-weight: 950;
    line-height: 1.15;
    text-align: center;
    background: #eff6ff;
}

.seg-notes-mini-flow i {
    width: 10px;
    height: 2px;
    border-radius: 99px;
    background: linear-gradient(90deg, #93c5fd, #2563eb);
}

.seg-notes-mini-flow i::after {
    content: "";
    display: block;
    width: 5px;
    height: 5px;
    margin: -1.5px 0 0 auto;
    border-top: 2px solid #2563eb;
    border-right: 2px solid #2563eb;
    transform: rotate(45deg);
}

.seg-notes-cluster-bars {
    display: grid;
    gap: 5px;
    border: 1px solid #dbeafe;
    border-radius: 12px;
    padding: 8px;
    background: #ffffff;
}

.seg-notes-cluster-bars div {
    display: grid;
    grid-template-columns: 26px minmax(0, 1fr) 30px;
    align-items: center;
    gap: 7px;
    color: #334155;
    font-size: 9px;
    font-weight: 900;
}

.seg-notes-cluster-bars span,
.seg-notes-cluster-bars em {
    font-style: normal;
    white-space: nowrap;
}

.seg-notes-cluster-bars b {
    position: relative;
    height: 8px;
    overflow: hidden;
    border-radius: 99px;
    background: #e2e8f0;
}

.seg-notes-cluster-bars b::after {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: var(--w);
    border-radius: inherit;
    background: var(--c);
    opacity: 0.72;
    animation: methodBarGrow 0.5s ease both;
}

.seg-notes-cluster-bars div.is-active {
    color: #1d4ed8;
}

.seg-notes-cluster-bars div.is-active b::after {
    opacity: 1;
}

.seg-notes-focus-list {
    gap: 5px !important;
}

.seg-notes-focus-list > div {
    border-bottom: 1px solid #edf2f7 !important;
    padding-bottom: 5px !important;
}

.seg-notes-focus-list dt {
    font-size: 9px !important;
}

.seg-notes-focus-list dd {
    overflow-wrap: anywhere;
    color: #475569;
    font-size: 10px;
    line-height: 1.42;
}

.seg-basic-cluster-legend {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
}

.seg-basic-cluster-legend span {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    border: 1px solid #e2e8f0;
    border-radius: 9px;
    padding: 6px 7px;
    color: #1e3a8a;
    font-size: 10px;
    font-weight: 900;
    background: #f8fafc;
}

.seg-basic-cluster-legend span.is-active,
.seg-basic-cluster-legend span:hover {
    border-color: #93c5fd;
    background: #eff6ff;
}

.seg-basic-cluster-legend span.is-active i {
    animation: segLegendPulse 1.1s ease-in-out infinite;
}

.seg-basic-cluster-legend i {
    width: 13px;
    height: 13px;
    flex: 0 0 auto;
    border: 2px solid #ffffff;
    border-radius: 50%;
    box-shadow: 0 0 0 1px #cbd5e1;
}

.seg-basic-graph-stage,
.seg-basic-matrix-stage,
.seg-basic-concept-detail {
    min-width: 0;
    border: 1px solid #dbeafe;
    border-radius: 14px;
    padding: 7px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.055);
    display: flex;
    flex-direction: column;
}

/* graph 视图：算法中间量容器等高限制与内部滚动 */
.seg-basic-concept-view {
    align-items: stretch;
}

.seg-basic-concept-view .seg-basic-graph-stage,
.seg-basic-concept-view .seg-basic-matrix-stage,
.seg-basic-concept-view .seg-basic-concept-detail {
    min-height: 0;
    height: 100%;
}

.seg-basic-concept-view .seg-concept-card {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.seg-basic-concept-view .seg-concept-card h4 {
    flex-shrink: 0;
}

.seg-basic-concept-view .seg-analysis-metrics {
    flex: 1;
    align-content: start;
}

.seg-basic-concept-view .seg-algo-bars {
    gap: 6px;
    overflow-y: auto;
    max-height: 220px;
    flex: 1;
    padding-right: 4px;
}

.seg-basic-concept-view .seg-algo-bars::-webkit-scrollbar {
    width: 4px;
}
.seg-basic-concept-view .seg-algo-bars::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 99px;
}

/* graph 视图：当条目较多（>=5 条）时自动紧凑排列 */
.seg-basic-concept-view .seg-algo-bars:has(span:nth-child(5)) span {
    min-height: 22px;
    padding: 3px 6px;
    gap: 6px;
}

.seg-basic-concept-view .seg-algo-bars:has(span:nth-child(5)) span b,
.seg-basic-concept-view .seg-algo-bars:has(span:nth-child(5)) span em {
    font-size: 10px;
}

.seg-basic-concept-view .seg-algo-bars span {
    min-height: 30px;
    box-sizing: border-box;
}

.seg-basic-compare-view {
    grid-column: 1 / -1;
    display: grid;
    gap: 16px;
}

.seg-basic-compare-view[hidden] {
    display: none;
}

.seg-compare-slider-figure {
    display: grid;
    gap: 10px;
    margin: 0;
    border: 1px solid #bfdbfe;
    border-radius: 16px;
    padding: 12px;
    background:
        linear-gradient(180deg, rgba(239, 246, 255, 0.96), rgba(255, 255, 255, 0.94));
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.08);
}

.seg-compare-slider-figure figcaption {
    color: #1e3a8a;
    font-size: 11px;
    font-weight: 950;
}

.seg-compare-slider {
    justify-self: center;
    width: 100%;
    max-width: calc(380px * 16 / 9);
    position: relative;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #e2e8f0;
    cursor: col-resize;
    aspect-ratio: 16 / 9;
    max-height: 380px;
}

.seg-compare-slider canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.seg-compare-slider-left {
    z-index: 1;
}

.seg-compare-slider-right {
    z-index: 0;
}

.seg-compare-slider-divider {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 2px;
    z-index: 2;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 0 10px rgba(15, 23, 42, 0.25);
    pointer-events: none;
}

.seg-compare-slider-handle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 34px;
    height: 34px;
    z-index: 3;
    transform: translate(-50%, -50%);
    display: grid;
    place-items: center;
    grid-auto-flow: column;
    gap: 3px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    background: #2563eb;
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.35);
    cursor: col-resize;
    outline: none;
}

.seg-compare-slider-handle:focus-visible {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.35);
}

.seg-compare-slider-handle span {
    display: block;
    width: 2px;
    height: 10px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 1px;
}

.seg-compare-label {
    position: absolute;
    bottom: 10px;
    z-index: 2;
    padding: 4px 10px;
    border-radius: 7px;
    color: #1e3a8a;
    font-size: 10px;
    font-weight: 950;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.1);
    pointer-events: none;
}

.seg-compare-label-left {
    left: 10px;
}

.seg-compare-label-right {
    right: 10px;
}

.seg-compare-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.seg-compare-card {
    min-width: 0;
    border: 1px solid #dbeafe;
    border-radius: 14px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.055);
}

.seg-compare-card h4 {
    margin: 0 0 10px;
    color: #1e3a8a;
    font-size: 13px;
    font-weight: 950;
}

.seg-compare-card ul {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.seg-compare-card li {
    position: relative;
    padding-left: 14px;
    color: #334155;
    font-size: 11px;
    line-height: 1.5;
}

.seg-compare-card li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 7px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #60a5fa;
}

.seg-compare-card.is-rgbxy li::before {
    background: #34d399;
}

.seg-compare-card strong {
    display: inline-block;
    margin-right: 6px;
    padding: 1px 5px;
    border-radius: 4px;
    color: #1e3a8a;
    font-size: 10px;
    font-weight: 900;
    background: #dbeafe;
}

@media (max-width: 1180px) {
    .seg-compare-cards {
        grid-template-columns: 1fr;
    }

    .seg-compare-slider {
        max-height: 300px;
    }
}

.seg-concept-svg {
    display: block;
    width: 100%;
    min-height: 154px;
}

.seg-pixel-svg,
.seg-cut-result-svg {
    min-height: 112px;
}

.seg-concept-svg text {
    fill: #0f172a;
    font-size: 12px;
    font-weight: 900;
}

.seg-svg-title {
    fill: #1d4ed8;
    font-size: 14px;
}

.seg-svg-note {
    fill: #64748b;
    font-size: 11px;
    font-weight: 700;
}

.seg-edge {
    fill: none;
    stroke: #94a3b8;
    stroke-width: 4;
    stroke-linecap: round;
}

.seg-edge.strong {
    stroke: #2563eb;
    stroke-width: 5;
}

.seg-cut-edge {
    fill: none;
    stroke: #ef4444;
    stroke-width: 5;
    stroke-linecap: round;
    stroke-dasharray: 9 7;
    animation: segCutDash 1.2s linear infinite;
}

.seg-ncut-divider {
    stroke: #ef4444;
    stroke-width: 3;
    stroke-dasharray: 7 7;
}

.seg-weight,
.seg-cut-label {
    fill: #dc2626;
    font-size: 11px;
}

.seg-concept-card {
    display: grid;
    gap: 6px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 8px;
    background: #ffffff;
    animation: segCardFadeIn 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}

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

.seg-concept-card + .seg-concept-card {
    margin-top: 8px;
}

.seg-concept-card h4 {
    margin: 0;
    color: #172554;
    font-size: 12.5px;
}

.seg-concept-card p {
    margin: 0;
    color: #64748b;
    font-size: 10.5px;
    line-height: 1.32;
}

.seg-mini-equation {
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    padding: 10px;
    color: #1e3a8a;
    font-size: 12px;
    font-weight: 950;
    background: #eff6ff;
}

.seg-matrix {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
}

.seg-matrix span {
    display: grid;
    min-height: 28px;
    place-items: center;
    border-radius: 8px;
    color: #1e40af;
    font-size: 10px;
    font-weight: 900;
    background: #eff6ff;
}

.seg-model-swatches {
    display: grid;
    gap: 8px;
}

.seg-model-swatches span {
    display: grid;
    gap: 3px;
    border: 1px solid #dbeafe;
    border-left: 5px solid var(--c, #2563eb);
    border-radius: 11px;
    padding: 10px;
    background: #f8fbff;
}

.seg-model-swatches b,
.seg-region-property-table strong,
.seg-region-bars b {
    color: #172554;
    font-size: 11px;
}

.seg-model-swatches em,
.seg-region-property-table span,
.seg-region-bars em {
    color: #64748b;
    font-size: 10px;
    font-style: normal;
    line-height: 1.45;
}

.seg-gradient-board {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
    min-height: 142px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 10px;
    background: #f8fafc;
}

.seg-gradient-board i {
    border-radius: 8px;
    background:
        radial-gradient(circle at 50% 22%, rgba(255, 255, 255, 0.9), transparent 18%),
        linear-gradient(180deg, #f8fafc, #94a3b8 48%, #0f172a);
    animation: methodBarRise 0.46s ease both;
}

.seg-gradient-board i:nth-child(2) {
    opacity: .8;
}

.seg-gradient-board i:nth-child(3) {
    opacity: .64;
}

.seg-gradient-board i:nth-child(4) {
    opacity: .86;
}

.seg-gradient-board i:nth-child(5) {
    opacity: .72;
}

.seg-region-property-table {
    display: grid;
    gap: 8px;
}

.seg-region-property-table div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 9px 10px;
    background: #f8fafc;
}

.seg-region-property-table strong {
    text-align: right;
}

.seg-region-bars {
    display: grid;
    gap: 10px;
}

.seg-region-bars span {
    position: relative;
    display: grid;
    gap: 4px;
    overflow: hidden;
    border: 1px solid #dbeafe;
    border-radius: 11px;
    padding: 10px 12px;
    background: #f8fbff;
}

.seg-region-bars span::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: var(--w, 40%);
    background: var(--c, #93c5fd);
    opacity: .24;
}

.seg-region-bars b,
.seg-region-bars em {
    position: relative;
}

/* ---- 区域属性饼图与统计卡片 ---- */
.seg-region-pie-chart {
    display: grid;
    grid-template-columns: minmax(110px, 1.2fr) minmax(0, 1fr);
    gap: 14px;
    align-items: center;
    border: 1px solid #dbeafe;
    border-radius: 13px;
    padding: 14px;
    background: linear-gradient(145deg, #ffffff, #f8fbff);
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.05);
}

.seg-region-pie-chart svg {
    width: 100%;
    height: auto;
    max-height: 170px;
    overflow: visible;
}

.seg-region-pie-chart path {
    transition: transform 0.22s ease, opacity 0.22s ease;
    transform-origin: center;
}

.seg-region-pie-chart path:hover {
    transform: scale(1.04);
    opacity: 0.92;
}

.seg-region-pie-center {
    fill: #1e3a8a;
    font-size: 22px;
    font-weight: 950;
}

.seg-region-pie-center-label {
    fill: #64748b;
    font-size: 8px;
    font-weight: 900;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.seg-region-pie-legend {
    display: grid;
    gap: 6px;
    align-content: center;
}

.seg-region-pie-legend__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
}

.seg-region-pie-legend__item::before {
    content: "";
    width: 9px;
    height: 9px;
    flex: 0 0 auto;
    border-radius: 3px;
    background: var(--dot, #93c5fd);
}

.seg-region-pie-legend__item b {
    min-width: 0;
    overflow: hidden;
    color: #334155;
    font-size: 12.5px;
    font-weight: 900;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.seg-region-pie-legend__item em {
    flex: 0 0 auto;
    color: var(--dot, #2563eb);
    font-size: 12.5px;
    font-weight: 950;
    font-style: normal;
}

.seg-region-stat-cards {
    display: none;
}

.seg-region-stat-card {
    display: none;
}

.seg-region-stat-card__label,
.seg-region-stat-card__grid,
.seg-region-stat-card__grid span,
.seg-region-stat-card__grid strong {
    display: none;
}

.seg-analysis-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    align-content: start;
}

.seg-analysis-metrics div {
    position: relative;
    display: grid;
    gap: 4px;
    min-width: 0;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    border-left: 3px solid #94a3b8;
    border-radius: 10px;
    padding: 9px 10px 9px 30px;
    background: #ffffff;
    box-shadow: 0 2px 5px rgba(15, 23, 42, 0.04);
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.seg-analysis-metrics div:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.08);
    border-color: #cbd5e1;
}

.seg-analysis-metrics div::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 9px;
    width: 14px;
    height: 14px;
    transform: translateY(-50%);
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    opacity: 0.85;
}

.seg-analysis-metrics span {
    color: #64748b;
    font-size: 9px;
    font-weight: 850;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.seg-analysis-metrics strong {
    min-width: 0;
    color: #172554;
    font-size: 11.5px;
    font-weight: 950;
    overflow-wrap: anywhere;
}

/* metric 卡片主题色：左边框 + 图标 */
.seg-analysis-metrics div.is-metric { border-left-color: #94a3b8; }
.seg-analysis-metrics div.is-metric::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Crect x='4' y='4' width='16' height='16' rx='2'/%3E%3Cpath d='M8 12h8M12 8v8'/%3E%3C/svg%3E"); }

.seg-analysis-metrics div.is-flow { border-left-color: #3b82f6; }
.seg-analysis-metrics div.is-flow::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%233b82f6' stroke-width='2'%3E%3Cpath d='M4 14h6l2-3 4 6 2-3h2'/%3E%3Cpath d='M4 18h3'/%3E%3C/svg%3E"); }

.seg-analysis-metrics div.is-cut { border-left-color: #ef4444; }
.seg-analysis-metrics div.is-cut::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ef4444' stroke-width='2'%3E%3Cpath d='M9 5l6 14M5 9h14'/%3E%3C/svg%3E"); }

.seg-analysis-metrics div.is-target { border-left-color: #22c55e; }
.seg-analysis-metrics div.is-target::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2322c55e' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Ccircle cx='12' cy='12' r='8'/%3E%3C/svg%3E"); }

.seg-analysis-metrics div.is-seed { border-left-color: #f59e0b; }
.seg-analysis-metrics div.is-seed::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f59e0b' stroke-width='2'%3E%3Cpath d='M12 2a7 7 0 0 1 7 7c0 4-5 8-7 13-2-5-7-9-7-13a7 7 0 0 1 7-7z'/%3E%3Ccircle cx='12' cy='9' r='2.5'/%3E%3C/svg%3E"); }

.seg-analysis-metrics div.is-loop { border-left-color: #8b5cf6; }
.seg-analysis-metrics div.is-loop::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b5cf6' stroke-width='2'%3E%3Cpath d='M21 12a9 9 0 1 1-3-6.7'/%3E%3Cpath d='M21 3v5h-5'/%3E%3C/svg%3E"); }

.seg-analysis-metrics div.is-percent { border-left-color: #06b6d4; }
.seg-analysis-metrics div.is-percent::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2306b6d4' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M9 9l6 6M15 9l-6 6'/%3E%3C/svg%3E"); }

.seg-analysis-metrics div.is-box { border-left-color: #f97316; }
.seg-analysis-metrics div.is-box::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f97316' stroke-width='2'%3E%3Crect x='3' y='5' width='18' height='14' rx='2'/%3E%3Cpath d='M3 10h18'/%3E%3C/svg%3E"); }

.seg-analysis-metrics div.is-image { border-left-color: #ec4899; }
.seg-analysis-metrics div.is-image::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ec4899' stroke-width='2'%3E%3Crect x='3' y='5' width='18' height='14' rx='2'/%3E%3Ccircle cx='8.5' cy='9.5' r='1.5'/%3E%3Cpath d='M21 15l-5-5L5 17'/%3E%3C/svg%3E"); }

.seg-analysis-metrics div.is-grid { border-left-color: #64748b; }
.seg-analysis-metrics div.is-grid::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M3 6h18M3 12h18M3 18h18M12 3v18'/%3E%3C/svg%3E"); }

.seg-analysis-metrics div.is-drop { border-left-color: #3b82f6; }
.seg-analysis-metrics div.is-drop::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%233b82f6' stroke-width='2'%3E%3Cpath d='M12 3c4 4 7 7 7 10a7 7 0 1 1-14 0c0-3 3-6 7-10z'/%3E%3C/svg%3E"); }

.seg-analysis-metrics div.is-ruler { border-left-color: #64748b; }
.seg-analysis-metrics div.is-ruler::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M3 7h18M5 7v10M9 7v4M13 7v7M17 7v3'/%3E%3C/svg%3E"); }

.seg-analysis-metrics div.is-help { border-left-color: #94a3b8; }
.seg-analysis-metrics div.is-help::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M9.5 9.5a2.5 2.5 0 1 1 3.5 2.3V15'/%3E%3Ccircle cx='12' cy='17.5' r='1'/%3E%3C/svg%3E"); }

.seg-analysis-metrics div.is-route { border-left-color: #3b82f6; }
.seg-analysis-metrics div.is-route::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%233b82f6' stroke-width='2'%3E%3Cpath d='M12 2l7 19-7-4-7 4 7-19z'/%3E%3C/svg%3E"); }

.seg-analysis-metrics div.is-flag { border-left-color: #f59e0b; }
.seg-analysis-metrics div.is-flag::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f59e0b' stroke-width='2'%3E%3Cpath d='M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z'/%3E%3Cpath d='M4 22v-7'/%3E%3C/svg%3E"); }

.seg-analysis-metrics div.is-link { border-left-color: #64748b; }
.seg-analysis-metrics div.is-link::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M10 13a5 5 0 0 0 7.5.5l3-3a5 5 0 0 0-7-7L11.5 5'/%3E%3Cpath d='M14 11a5 5 0 0 0-7.5-.5l-3 3a5 5 0 0 0 7 7l2-2'/%3E%3C/svg%3E"); }

.seg-analysis-metrics div.is-arrow { border-left-color: #94a3b8; }
.seg-analysis-metrics div.is-arrow::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M5 12h14M12 5l7 7-7 7'/%3E%3C/svg%3E"); }

.seg-analysis-metrics div.is-border { border-left-color: #ef4444; }
.seg-analysis-metrics div.is-border::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ef4444' stroke-width='2'%3E%3Crect x='3' y='3' width='18' height='18' rx='2'/%3E%3Cpath d='M3 9h18M9 21V9'/%3E%3C/svg%3E"); }

.seg-analysis-metrics div.is-doc { border-left-color: #64748b; }
.seg-analysis-metrics div.is-doc::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3Cpath d='M14 2v6h6M16 13H8M16 17H8M10 9H8'/%3E%3C/svg%3E"); }

.seg-analysis-metrics div.is-photo { border-left-color: #ec4899; }
.seg-analysis-metrics div.is-photo::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ec4899' stroke-width='2'%3E%3Crect x='3' y='6' width='18' height='12' rx='2'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M8 6l1.5-2h5L16 6'/%3E%3C/svg%3E"); }

.seg-analysis-metrics div.is-rule { border-left-color: #94a3b8; }
.seg-analysis-metrics div.is-rule::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E"); }

.seg-analysis-metrics div.is-nodes { border-left-color: #3b82f6; }
.seg-analysis-metrics div.is-nodes::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%233b82f6' stroke-width='2'%3E%3Ccircle cx='12' cy='5' r='2.5'/%3E%3Ccircle cx='6' cy='18' r='2.5'/%3E%3Ccircle cx='18' cy='18' r='2.5'/%3E%3Cpath d='M12 7.5l-4.5 9M12 7.5l4.5 9'/%3E%3C/svg%3E"); }

.seg-analysis-metrics div.is-signal { border-left-color: #8b5cf6; }
.seg-analysis-metrics div.is-signal::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b5cf6' stroke-width='2'%3E%3Cpath d='M2 12h2M7 8v8M12 5v14M17 8v8M22 12h-2'/%3E%3C/svg%3E"); }

.seg-analysis-metrics div.is-group { border-left-color: #3b82f6; }
.seg-analysis-metrics div.is-group::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%233b82f6' stroke-width='2'%3E%3Ccircle cx='9' cy='9' r='3'/%3E%3Ccircle cx='17' cy='17' r='3'/%3E%3Cpath d='M12 12l2 2'/%3E%3C/svg%3E"); }

.seg-analysis-metrics div.is-chart { border-left-color: #22c55e; }
.seg-analysis-metrics div.is-chart::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2322c55e' stroke-width='2'%3E%3Cpath d='M3 3v18h18'/%3E%3Cpath d='M18 17V9M13 17V5M8 17v-4'/%3E%3C/svg%3E"); }

.seg-analysis-metrics div.is-question { border-left-color: #94a3b8; }
.seg-analysis-metrics div.is-question::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M9.5 9.5a2.5 2.5 0 1 1 3.5 2.3V15'/%3E%3Ccircle cx='12' cy='17.5' r='1'/%3E%3C/svg%3E"); }

.seg-analysis-metrics div.is-check { border-left-color: #22c55e; }
.seg-analysis-metrics div.is-check::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2322c55e' stroke-width='2'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E"); }

.seg-analysis-metrics div.is-location { border-left-color: #f59e0b; }
.seg-analysis-metrics div.is-location::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f59e0b' stroke-width='2'%3E%3Cpath d='M12 2a7 7 0 0 1 7 7c0 4-5 8-7 13-2-5-7-9-7-13a7 7 0 0 1 7-7z'/%3E%3Ccircle cx='12' cy='9' r='2.5'/%3E%3C/svg%3E"); }

.seg-analysis-metrics div.is-layers { border-left-color: #64748b; }
.seg-analysis-metrics div.is-layers::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M12 2L2 7l10 5 10-5-10-5z'/%3E%3Cpath d='M2 17l10 5 10-5M2 12l10 5 10-5'/%3E%3C/svg%3E"); }

.seg-analysis-metrics div.is-star { border-left-color: #f59e0b; }
.seg-analysis-metrics div.is-star::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f59e0b' stroke-width='2'%3E%3Cpath d='M12 2l3 6h6l-5 4 2 6-6-4-6 4 2-6-5-4h6z'/%3E%3C/svg%3E"); }

.seg-analysis-metrics div.is-move { border-left-color: #8b5cf6; }
.seg-analysis-metrics div.is-move::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b5cf6' stroke-width='2'%3E%3Cpath d='M5 9l-3 3 3 3M19 9l3 3-3 3M9 5l3-3 3 3M9 19l3 3 3-3'/%3E%3C/svg%3E"); }

.seg-analysis-metrics div.is-stop { border-left-color: #ef4444; }
.seg-analysis-metrics div.is-stop::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ef4444' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Crect x='9' y='9' width='6' height='6'/%3E%3C/svg%3E"); }

.seg-analysis-metrics div.is-hash { border-left-color: #64748b; }
.seg-analysis-metrics div.is-hash::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M4 9h16M4 15h16M9 4v16M15 4v16'/%3E%3C/svg%3E"); }

.seg-graph-output-explain {
    display: grid;
    align-content: center;
    gap: 10px;
    min-height: 0;
    padding: 2px 0;
}

.seg-graph-ratio-bar {
    display: flex;
    overflow: hidden;
    height: 16px;
    border: 1px solid #dbeafe;
    border-radius: 999px;
    background: #eff6ff;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.7);
}

.seg-graph-ratio-bar span {
    width: var(--w, 50%);
    min-width: 0;
    animation: segGraphRatioGrow 0.55s ease both;
}

.seg-graph-ratio-bar .is-fg {
    background: linear-gradient(90deg, #86efac, #22c55e);
}

.seg-graph-ratio-bar .is-bg {
    background: linear-gradient(90deg, #bfdbfe, #60a5fa);
}

.seg-graph-output-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
}

.seg-graph-output-grid div {
    display: grid;
    gap: 3px;
    min-width: 0;
    border: 1px solid #e2e8f0;
    border-radius: 9px;
    padding: 7px 8px;
    background: #f8fbff;
}

.seg-graph-output-grid span {
    color: #64748b;
    font-size: 8px;
    font-weight: 900;
    text-transform: uppercase;
}

.seg-graph-output-grid strong {
    color: #172554;
    font-size: 13px;
    font-weight: 950;
}

.seg-graph-energy-flow {
    display: grid;
    grid-template-columns: auto minmax(16px, 1fr) auto minmax(16px, 1fr) auto;
    align-items: center;
    gap: 6px;
    color: #1e40af;
    font-size: 9px;
    font-weight: 900;
}

.seg-graph-energy-flow b {
    height: 2px;
    border-radius: 999px;
    background: linear-gradient(90deg, #bfdbfe, #2563eb, #bfdbfe);
    background-size: 180% 100%;
    animation: segGraphEnergyFlow 1.4s linear infinite;
}

.seg-graph-output-explain p {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 8px 9px;
    background: rgba(248, 251, 255, 0.9);
}

@keyframes segGraphRatioGrow {
    from { transform: scaleX(0); transform-origin: left; }
    to { transform: scaleX(1); transform-origin: left; }
}

@keyframes segGraphEnergyFlow {
    from { background-position: 180% 0; }
    to { background-position: 0 0; }
}

.seg-eigen-bars {
    display: flex;
    align-items: end;
    gap: 8px;
    min-height: 96px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px;
    background: #f8fafc;
}

.seg-eigen-bars i {
    flex: 1 1 0;
    min-width: 0;
    border-radius: 8px 8px 3px 3px;
    background: linear-gradient(180deg, #38bdf8, #2563eb);
    animation: methodBarRise 0.8s ease both;
}

.seg-eigen-bars i.neg {
    background: linear-gradient(180deg, #c4b5fd, #7c3aed);
}

.seg-algo-card {
    overflow: hidden;
}

.seg-algo-grid .seg-grid-cell {
    stroke: rgba(255, 255, 255, 0.9);
    stroke-width: 1.4;
    filter: drop-shadow(0 3px 4px rgba(15, 23, 42, 0.08));
    animation: segGridCellPop 0.42s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.seg-algo-grid .seg-grid-cell.is-active {
    stroke: #f97316;
    stroke-width: 3;
    animation: segGridCellPop 0.42s cubic-bezier(0.2, 0.8, 0.2, 1) both, segActiveCellPulse 0.9s ease-in-out infinite;
}

.seg-algo-grid .seg-grid-cell.is-boundary {
    stroke: #ffffff;
    stroke-width: 2;
}

.seg-algo-grid .seg-mode-badge rect {
    fill: rgba(239, 246, 255, 0.92);
    stroke: #bfdbfe;
}

.seg-algo-grid .seg-mode-badge text {
    fill: #1d4ed8;
    font-size: 10px;
    font-weight: 950;
}

.seg-algo-grid.is-rgbxy .seg-mode-badge rect {
    fill: rgba(240, 253, 244, 0.92);
    stroke: #86efac;
}

.seg-algo-grid.is-rgbxy .seg-mode-badge text {
    fill: #166534;
}

.seg-spatial-ring {
    fill: none;
    stroke: var(--c);
    stroke-width: 3;
    stroke-dasharray: 10 7;
    opacity: 0.38;
    animation: segSpatialRingPulse 1.8s ease-in-out infinite;
}

.seg-rgb-long-link {
    fill: none;
    stroke: var(--c);
    stroke-width: 3.2;
    stroke-linecap: round;
    stroke-dasharray: 9 7;
    opacity: 0.74;
    filter: drop-shadow(0 0 7px rgba(37, 99, 235, 0.24));
    animation: segRgbLongLinkFlow 1.65s linear infinite;
}

.seg-xy-axis-flow {
    fill: none;
    stroke: #22c55e;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-dasharray: 8 7;
    opacity: 0.7;
    animation: segXYAxisFlow 1.35s linear infinite;
}

.seg-grid-edge {
    stroke: #64748b;
    stroke-linecap: round;
    opacity: 0.32;
}

.seg-grid-cut {
    stroke: #ef4444;
    stroke-linecap: round;
    stroke-dasharray: 8 6;
    filter: drop-shadow(0 0 6px rgba(239, 68, 68, 0.5));
    animation: segCutDash 1s linear infinite;
}

.seg-grid-seed circle {
    stroke: #ffffff;
    stroke-width: 3;
    filter: drop-shadow(0 5px 10px rgba(15, 23, 42, 0.22));
    animation: segSeedPulse 1.1s ease-in-out infinite;
}

.seg-grid-seed.is-fg circle {
    fill: #16a34a;
}

.seg-grid-seed.is-bg circle {
    fill: #2563eb;
}

.seg-grid-seed text {
    fill: #ffffff;
    font-size: 11px;
    font-weight: 950;
}

.seg-grid-box,
.seg-grid-bbox {
    fill: none;
    stroke-width: 4;
    stroke-dasharray: 10 7;
}

.seg-grid-box {
    stroke: #2563eb;
    filter: drop-shadow(0 0 8px rgba(37, 99, 235, 0.32));
}

.seg-grid-bbox {
    stroke: var(--bbox, #f97316);
    animation: segBboxTrace 1.25s ease-in-out infinite;
}

.seg-grid-bbox-label {
    fill: #0f172a;
    font-size: 10px;
    font-weight: 950;
}

.seg-algo-matrix {
    display: grid;
    grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr));
    gap: 3px;
    overflow: hidden;
    border: 1px solid #dbeafe;
    border-radius: 12px;
    padding: 8px;
    background: #f8fafc;
}

.seg-algo-matrix span {
    display: grid;
    min-height: 21px;
    place-items: center;
    border-radius: 5px;
    color: #0f172a;
    font-size: 8px;
    font-weight: 850;
    background: rgba(37, 99, 235, calc(0.08 + var(--heat, 0) * 0.52));
    transition: background-color 0.45s ease, color 0.45s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease;
    animation: segGridCellPop 0.38s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.seg-algo-matrix span:hover {
    transform: scale(1.12);
    box-shadow: 0 0 10px rgba(37, 99, 235, 0.36);
    background: rgba(37, 99, 235, calc(0.24 + var(--heat, 0) * 0.48));
    z-index: 5;
}

.seg-algo-bars {
    display: grid;
    gap: 8px;
}

.seg-algo-bars span {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 34px;
    overflow: hidden;
    border: 1px solid #dbeafe;
    border-radius: 10px;
    padding: 8px 10px;
    background: #f8fbff;
    animation: segGridCellPop 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.seg-algo-bars span::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: var(--w, 0%);
    background: var(--c, #2563eb);
    opacity: 0.22;
    transition: width 0.72s cubic-bezier(0.16, 1, 0.3, 1);
}

.seg-algo-bars b,
.seg-algo-bars em {
    position: relative;
    min-width: 0;
    font-size: 10px;
    line-height: 1.35;
}

.seg-algo-bars b {
    color: #172554;
    font-weight: 950;
}

.seg-algo-bars em {
    color: #475569;
    font-style: normal;
    text-align: right;
    overflow-wrap: anywhere;
}

.seg-eigen-bars--signed i {
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    min-height: 24px;
    transition: height 0.75s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.4s ease;
    animation: methodBarRise 0.62s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.seg-eigen-bars--signed i span {
    position: absolute;
    bottom: 5px;
    color: #ffffff;
    font-size: 8px;
    font-weight: 950;
    writing-mode: vertical-rl;
    text-orientation: mixed;
}

.seg-eigen-bars--signed i.neg span {
    color: #ede9fe;
}

.seg-kmeans-line {
    animation: segKmeansLineFlow 1.2s linear infinite;
}

.seg-kmeans-sampling-svg .seg-sampling-pixel,
.seg-kmeans-sampling-svg .seg-sampling-vector {
    animation: segSamplingTileIn 0.55s ease both;
}

.seg-sampling-scan {
    fill: none;
    stroke: #2563eb;
    stroke-width: 4;
    stroke-linecap: round;
    stroke-dasharray: 18 12;
    opacity: 0.72;
    animation: segSamplingScan 1.55s ease-in-out infinite;
}

.seg-process-arrow {
    fill: none;
    stroke: #2563eb;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-dasharray: 8 7;
    animation: segKmeansLineFlow 1.15s linear infinite;
}

.seg-assign-ray {
    fill: none;
    stroke: var(--c);
    stroke-width: 2.4;
    stroke-linecap: round;
    stroke-dasharray: 8 7;
    opacity: 0.38;
    animation: segAssignRayFlow 1.4s linear infinite;
}

.seg-assign-ray.is-best {
    stroke-width: 4.4;
    opacity: 0.92;
}

.seg-assign-center circle {
    fill: var(--c);
    stroke: #ffffff;
    stroke-width: 3;
    filter: drop-shadow(0 8px 12px rgba(15, 23, 42, 0.16));
}

.seg-assign-center.is-best circle {
    animation: segSeedPulse 1.05s ease-in-out infinite;
}

.seg-assign-center text {
    fill: #ffffff;
    font-size: 10px;
    font-weight: 950;
}

.seg-assign-distance.is-best text {
    fill: #1d4ed8;
    font-weight: 950;
}

.seg-update-member {
    opacity: 0.52;
    animation: segUpdateMemberFlow 1.5s ease-in-out infinite;
}

.seg-update-old {
    opacity: 0.42;
    stroke: #64748b;
    stroke-width: 2;
}

.seg-update-new {
    stroke: #ffffff;
    stroke-width: 3;
    filter: drop-shadow(0 8px 14px rgba(37, 99, 235, 0.14));
    animation: segSeedPulse 1.2s ease-in-out infinite;
}

.seg-update-path {
    fill: none;
    stroke: var(--c);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-dasharray: 9 7;
    opacity: 0.8;
    animation: segUpdatePathFlow 1.35s linear infinite;
}

.seg-update-column text {
    fill: #ffffff;
    font-size: 10px;
    font-weight: 950;
}

.seg-update-column .seg-svg-note {
    fill: #64748b;
    font-size: 9px;
}

.seg-update-baseline {
    stroke: #bfdbfe;
    stroke-width: 2;
    stroke-dasharray: 6 7;
}

.seg-converge-line {
    stroke: #2563eb;
    stroke-width: 4;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 420;
    animation: segConvergeDraw 1.05s ease both;
}

.seg-converge-dot {
    fill: #93c5fd;
    stroke: #ffffff;
    stroke-width: 2;
    animation: segGridCellPop 0.42s ease both;
}

.seg-converge-dot.is-final {
    fill: #f97316;
    animation: segSeedPulse 1.1s ease-in-out infinite;
}

.seg-converge-threshold {
    stroke: #f97316;
    stroke-width: 2;
    stroke-dasharray: 6 6;
    opacity: 0.62;
}

.seg-stats-stack-cell,
.seg-stats-row {
    animation: segStatsGrow 0.58s ease both;
}

.seg-stats-bbox {
    fill: none;
    stroke: #2563eb;
    stroke-width: 3;
    stroke-dasharray: 7 5;
    animation: segBboxTrace 1.2s ease-in-out infinite;
}

.seg-basic-stepper {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

.segmentation-basic-workbench .vision-formula-card,
.segmentation-basic-workbench .vision-formula-card strong,
.segmentation-basic-workbench .vision-formula-card small,
.segmentation-basic-workbench .vision-formula-card span {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
}

@keyframes segCutDash {
    to {
        stroke-dashoffset: -32;
    }
}

@keyframes methodArrowFlow {
    0% {
        transform: translateX(-120%);
        opacity: 0.25;
    }
    45% {
        opacity: 1;
    }
    100% {
        transform: translateX(260%);
        opacity: 0.25;
    }
}

@keyframes methodBarGrow {
    from {
        width: 0;
    }
}

@keyframes methodBarRise {
    from {
        height: 12%;
        opacity: 0.35;
    }
}

@keyframes segGridCellPop {
    from {
        transform: scale(0.82);
        transform-origin: center;
        opacity: 0.2;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes segActiveCellPulse {
    0%, 100% {
        filter: drop-shadow(0 0 0 rgba(249, 115, 22, 0));
    }
    50% {
        filter: drop-shadow(0 0 10px rgba(249, 115, 22, 0.58));
    }
}

@keyframes segSeedPulse {
    0%, 100% {
        transform: scale(1);
        transform-origin: center;
    }
    50% {
        transform: scale(1.16);
        transform-origin: center;
    }
}

@keyframes segKmeansLineFlow {
    from {
        stroke-dashoffset: 20;
    }
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes segFrameProgress {
    from {
        transform: scaleX(0);
    }
    to {
        transform: scaleX(1);
    }
}

@keyframes segFeatureStageIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes segAlgoCanvasSweep {
    0%, 18% {
        transform: translateX(-82%);
        opacity: 0.35;
    }
    58% {
        opacity: 0.76;
    }
    100% {
        transform: translateX(82%);
        opacity: 0.32;
    }
}

@keyframes segSampleScanTint {
    0%, 100% {
        filter: saturate(0.92);
    }
    48% {
        filter: saturate(1.16) brightness(1.05);
    }
}

@keyframes segSamplingTileIn {
    from {
        opacity: 0;
        transform: translateY(5px) scale(0.9);
        transform-box: fill-box;
        transform-origin: center;
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes segSamplingScan {
    0%, 100% {
        stroke-dashoffset: 26;
        transform: translateX(0);
    }
    50% {
        stroke-dashoffset: -12;
        transform: translateX(158px);
    }
}

@keyframes segAssignRayFlow {
    to {
        stroke-dashoffset: -30;
    }
}

@keyframes segUpdateMemberFlow {
    0%, 100% {
        opacity: 0.38;
        transform: translateY(0);
        transform-box: fill-box;
        transform-origin: center;
    }
    50% {
        opacity: 0.88;
        transform: translateY(-8px);
    }
}

@keyframes segUpdatePathFlow {
    to {
        stroke-dashoffset: -32;
    }
}

@keyframes segConvergeDraw {
    from {
        stroke-dashoffset: 420;
    }
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes segStatsGrow {
    from {
        opacity: 0;
        transform: scaleX(0.2);
        transform-box: fill-box;
        transform-origin: left center;
    }
    to {
        opacity: 1;
        transform: scaleX(1);
    }
}

@keyframes segLabelCellDecode {
    0%, 100% {
        opacity: 0.64;
        transform: scale(0.92);
    }
    45% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes segDecodeArrowFlow {
    0% {
        transform: translateX(-80%);
    }
    100% {
        transform: translateX(168%);
    }
}

@keyframes segMaskLayerRise {
    0%, 18% {
        transform: translateY(24%);
        opacity: 0.2;
    }
    55%, 100% {
        transform: translateY(0);
        opacity: 0.48;
    }
}

@keyframes segBoundaryTrace {
    0%, 42% {
        opacity: 0;
        clip-path: inset(0 100% 0 0);
    }
    70% {
        opacity: 0.72;
        clip-path: inset(0 0 0 0);
    }
    100% {
        opacity: 0.58;
        clip-path: inset(0 0 0 0);
    }
}

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

@keyframes segProcessCardIn {
    from {
        transform: translateY(10px) scale(0.985);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

@keyframes segStepCardLift {
    from {
        transform: translateY(8px);
        filter: saturate(0.88);
    }
    to {
        transform: translateY(0);
        filter: saturate(1);
    }
}

@keyframes segInputScan {
    0%, 100% {
        left: 12px;
        opacity: 0.36;
    }
    50% {
        left: calc(100% - 16px);
        opacity: 0.92;
    }
}

@keyframes segOverlaySweep {
    0%, 18% {
        transform: translateX(-80%);
        opacity: 0.18;
    }
    55% {
        opacity: 0.68;
    }
    100% {
        transform: translateX(80%);
        opacity: 0.18;
    }
}

@keyframes segMaskFade {
    from {
        opacity: 0.45;
        filter: saturate(0.82);
    }
    to {
        opacity: 1;
        filter: saturate(1);
    }
}

@keyframes segMaskBreath {
    0%, 100% {
        filter: saturate(1) contrast(1);
    }
    50% {
        filter: saturate(1.08) contrast(1.04);
    }
}

@keyframes segRgbBeamFlow {
    0% {
        opacity: 0;
        transform: translateX(-18%) rotate(var(--r));
    }
    45% {
        opacity: 0.78;
    }
    100% {
        opacity: 0;
        transform: translateX(18%) rotate(var(--r));
    }
}

@keyframes segXYPlaneDrift {
    0%, 100% {
        filter: saturate(1);
        opacity: 0.62;
    }
    50% {
        filter: saturate(1.25);
        opacity: 0.9;
    }
}

@keyframes segSpatialRingPulse {
    0%, 100% {
        opacity: 0.25;
        transform-box: fill-box;
        transform-origin: center;
        transform: scale(0.88);
    }
    50% {
        opacity: 0.72;
        transform: scale(1.04);
    }
}

@keyframes segXYLocalPulse {
    0%, 100% {
        opacity: 0.25;
        transform: translate(-50%, -50%) scale(0.88);
    }
    50% {
        opacity: 0.72;
        transform: translate(-50%, -50%) scale(1.04);
    }
}

@keyframes segRgbLongLinkFlow {
    to {
        stroke-dashoffset: -32;
    }
}

@keyframes segXYAxisFlow {
    to {
        stroke-dashoffset: -30;
    }
}

@keyframes segOutputPulse {
    0%, 100% {
        box-shadow: 0 16px 30px rgba(37, 99, 235, 0.08);
        border-color: #dbeafe;
    }
    50% {
        box-shadow: 0 18px 36px rgba(37, 99, 235, 0.16);
        border-color: #93c5fd;
    }
}

@keyframes segCenterTrail {
    from {
        stroke-dashoffset: 18;
        opacity: 0.18;
    }
    to {
        stroke-dashoffset: 0;
        opacity: 0.82;
    }
}

@keyframes segCenterPulse {
    0% {
        transform: scale(0.72);
        opacity: 0.42;
    }
    72% {
        transform: scale(1.08);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes segCenterDot {
    from {
        transform: scale(0.5);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 0.5;
    }
}

@keyframes segSampleDotIn {
    from {
        transform: scale(0.35);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 0.72;
    }
}

@keyframes segLegendPulse {
    0%, 100% {
        box-shadow: 0 0 0 1px #93c5fd, 0 0 0 0 rgba(37, 99, 235, 0.22);
    }
    50% {
        box-shadow: 0 0 0 1px #2563eb, 0 0 0 5px rgba(37, 99, 235, 0.14);
    }
}

@keyframes segCubeRotate {
    0% {
        transform: rotateX(-18deg) rotateY(0deg) rotateZ(0deg);
    }
    100% {
        transform: rotateX(-18deg) rotateY(360deg) rotateZ(0deg);
    }
}

@keyframes segParticleFloat {
    0%, 100% {
        opacity: 0.48;
    }
    50% {
        opacity: 0.86;
    }
}

@keyframes segDataParticles {
    0% {
        background-position: 0 0, 0 0, 0 0;
    }
    100% {
        background-position: 190px 140px, -230px 170px, 170px -210px;
    }
}

@keyframes segGlassSweep {
    0%, 18% {
        transform: translateX(-75%);
    }
    70%, 100% {
        transform: translateX(75%);
    }
}

@keyframes segOverlayBadge {
    0%, 100% {
        opacity: 0.72;
        transform: translateY(0);
    }
    50% {
        opacity: 1;
        transform: translateY(-2px);
    }
}

@keyframes segTimelineOrb {
    0%, 100% {
        left: 18px;
    }
    50% {
        left: calc(100% - 27px);
    }
}

@keyframes segProcessGlow {
    from {
        box-shadow: 0 0 0 rgba(37, 99, 235, 0);
    }
    to {
        box-shadow: 0 12px 26px rgba(37, 99, 235, 0.13);
    }
}

@keyframes segRegionTint {
    from {
        transform: translateY(4px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes segNotesFlowDot {
    0% {
        left: 4px;
        opacity: 0.35;
    }
    18% {
        opacity: 1;
    }
    82% {
        opacity: 1;
    }
    100% {
        left: calc(100% - 11px);
        opacity: 0.35;
    }
}

@keyframes segBboxTrace {
    to {
        stroke-dashoffset: -34;
    }
}

@media (max-width: 1180px) {
    .seg-basic-canvas-grid,
    .seg-basic-process-row,
    .seg-basic-kmeans-summary,
    .seg-basic-concept-view,
    .seg-basic-step-focus,
    .instance-compare-grid,
    .instance-output-compare-table {
        grid-template-columns: 1fr;
    }

    .seg-basic-step-visual {
        grid-row: auto;
    }

    .seg-basic-input-card,
    .seg-basic-output-card,
    .seg-basic-process-card {
        grid-column: auto;
        grid-row: auto;
    }

    .seg-basic-process-grid {
        grid-template-columns: 1fr;
    }

    .seg-basic-concept-result {
        grid-template-columns: 1fr;
    }

    .seg-basic-flow-band {
        grid-template-columns: 1fr;
    }
}


/* ==========================================================================
   Real segmentation comparison lab
   ========================================================================== */
.seg-lab-workbench {
    display: grid;
    grid-template-columns: minmax(250px, 280px) minmax(0, 1fr) minmax(284px, 326px);
    gap: 14px;
    align-items: start;
}

[data-segmentation-lab] [hidden] {
    display: none !important;
}

.seg-lab-control-panel,
.seg-lab-notes-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

@media (min-width: 1081px) {
    .seg-lab-control-panel,
    .seg-lab-notes-panel {
        position: sticky;
        top: 76px;
    }
}

.seg-lab-control-card,
.seg-lab-explain-card,
.seg-lab-inspector,
.seg-lab-model-stack article {
    border: 1px solid #dbeafe;
    border-radius: 14px;
    background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.seg-lab-control-card,
.seg-lab-explain-card,
.seg-lab-inspector {
    display: grid;
    gap: 8px;
    padding: 10px;
}

.seg-lab-mode-toggle,
.seg-lab-focus-toggle {
    grid-template-columns: 1fr;
}

.seg-lab-run-button {
    display: grid;
    gap: 2px;
    min-height: 48px;
    border: 1px solid #93c5fd;
    border-radius: 12px;
    padding: 9px 12px;
    color: #ffffff;
    text-align: left;
    cursor: pointer;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.22);
    transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.seg-lab-run-button:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 16px 30px rgba(37, 99, 235, 0.28);
}

.seg-lab-run-button:disabled {
    cursor: wait;
    opacity: 0.72;
}

.seg-lab-run-button span {
    font-size: 13px;
    font-weight: 950;
}

.seg-lab-run-button small {
    color: #dbeafe;
    font-size: 10px;
    font-weight: 800;
}

.seg-lab-run-button.is-loading {
    background-image:
        linear-gradient(90deg, rgba(255,255,255,0), rgba(255,255,255,0.28), rgba(255,255,255,0)),
        linear-gradient(135deg, #2563eb, #1d4ed8);
    background-size: 220% 100%, 100% 100%;
    animation: segLabButtonSheen 1.1s linear infinite;
}

.seg-lab-model-stack {
    display: grid;
    gap: 8px;
}

.seg-lab-model-stack article {
    display: grid;
    gap: 4px;
    padding: 10px 11px;
}

.seg-lab-model-stack span {
    color: #2563eb;
    font-size: 9px;
    font-weight: 950;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.seg-lab-model-stack strong {
    color: #172554;
    font-size: 13px;
}

.seg-lab-model-stack small {
    color: #64748b;
    font-size: 10px;
    line-height: 1.4;
}

.seg-lab-stage-panel {
    min-width: 0;
    overflow: hidden;
}

.seg-lab-stage-panel .seg-lab-proscons {
    border-width: 1px 0 0;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 0 0 18px 18px;
    box-shadow: none;
    padding: 16px 18px 18px;
}

.seg-lab-proscons .overview-section-heading {
    margin-bottom: 12px;
}

.seg-lab-proscons-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.seg-lab-proscons-grid article {
    display: grid;
    gap: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 13px;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.seg-lab-proscons-grid article.is-focused {
    border-color: #bfdbfe;
    background: linear-gradient(180deg, #ffffff, #f0f9ff);
    box-shadow: 0 0 0 1px #bfdbfe, 0 4px 12px rgba(59, 130, 246, 0.08);
}

.seg-lab-proscons-grid article header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f1f5f9;
}

.seg-lab-proscons-grid article header span {
    color: #64748b;
    font-size: 9px;
    font-weight: 950;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.seg-lab-proscons-grid article header strong {
    color: #1e293b;
    font-size: 14px;
    font-weight: 800;
}

.seg-lab-proscons-grid article div h5 {
    margin: 0 0 4px 0;
    color: #059669;
    font-size: 11px;
    font-weight: 800;
}

.seg-lab-proscons-grid article div:nth-of-type(2) h5 {
    color: #dc2626;
}

.seg-lab-proscons-grid article div p {
    margin: 0;
    color: #475569;
    font-size: 11px;
    line-height: 1.55;
}

.seg-lab-proscons-grid article footer {
    margin-top: 4px;
    padding-top: 10px;
    border-top: 1px dashed #e2e8f0;
    color: #64748b;
    font-size: 10px;
    line-height: 1.45;
}

@media (max-width: 920px) {
    .seg-lab-proscons-grid {
        grid-template-columns: 1fr;
    }
}

.seg-lab-stage-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    border-bottom: 1px solid #e8eef6;
    padding: 8px 12px;
    background: #f8fbff;
}

.seg-lab-stage-strip span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 24px;
    border: 1px solid #dbeafe;
    border-radius: 999px;
    padding: 2px 9px;
    color: #64748b;
    font-size: 10px;
    font-weight: 850;
    background: #ffffff;
}

.seg-lab-stage-strip strong {
    color: #1d4ed8;
}

.seg-lab-comparison-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 12px;
    background:
        linear-gradient(90deg, rgba(219, 234, 254, 0.52) 1px, transparent 1px),
        linear-gradient(180deg, rgba(219, 234, 254, 0.52) 1px, transparent 1px),
        #f8fbff;
    background-size: 26px 26px;
}

.seg-lab-input-proxy {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.seg-lab-result-card {
    --seg-card-accent: #2563eb;
    display: grid;
    grid-template-rows: auto auto minmax(90px, 1fr) auto;
    min-width: 0;
    height: 100%;
    overflow: hidden;
    border: 1px solid #dbeafe;
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.055);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}

.seg-lab-result-card--semantic {
    --seg-card-accent: #10b981;
}

.seg-lab-result-card--instance {
    --seg-card-accent: #8b5cf6;
}

.seg-lab-result-card.is-focused,
.seg-lab-result-card:hover {
    border-color: color-mix(in srgb, var(--seg-card-accent) 58%, #dbeafe);
    box-shadow: 0 16px 32px color-mix(in srgb, var(--seg-card-accent) 15%, transparent);
    transform: translateY(-1px);
}

.seg-lab-result-card[data-state="running"] {
    border-color: #93c5fd;
}

.seg-lab-result-card[data-state="fallback"] {
    border-color: #fed7aa;
}

.seg-lab-result-card header {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 55px;
    padding: 10px 11px;
    border-bottom: 1px solid #edf2f7;
}

.seg-lab-result-card header > span {
    display: grid;
    width: 27px;
    height: 27px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid color-mix(in srgb, var(--seg-card-accent) 42%, #dbeafe);
    border-radius: 50%;
    color: var(--seg-card-accent);
    font-size: 9px;
    font-weight: 950;
    background: color-mix(in srgb, var(--seg-card-accent) 8%, #ffffff);
}

.seg-lab-result-card header div {
    min-width: 0;
}

.seg-lab-result-card h4 {
    overflow: hidden;
    margin: 0;
    color: #172554;
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.seg-lab-result-card p {
    margin: 2px 0 0;
    color: #94a3b8;
    font-size: 10px;
    font-weight: 850;
}

.seg-lab-result-card header b {
    margin-left: auto;
    border: 1px solid color-mix(in srgb, var(--seg-card-accent) 35%, #dbeafe);
    border-radius: 999px;
    padding: 3px 7px;
    color: var(--seg-card-accent);
    font-size: 8px;
    font-weight: 950;
    background: color-mix(in srgb, var(--seg-card-accent) 8%, #ffffff);
}

.seg-lab-result-card[data-state="fallback"] header b {
    border-color: #fed7aa;
    color: #c2410c;
    background: #fff7ed;
}

.seg-lab-visual {
    position: relative;
    min-width: 0;
    overflow: hidden;
    border-bottom: 1px solid #edf2f7;
    background: #eaf2ff;
    height: clamp(200px, 28vw, 280px);
}

.seg-lab-visual img,
.seg-lab-visual canvas,
.seg-lab-visual svg {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
}

.seg-lab-visual img {
    object-fit: fill;
}

.seg-lab-visual canvas,
.seg-lab-visual svg {
    z-index: 3;
}

.seg-lab-visual svg {
    pointer-events: auto;
}

.seg-lab-visual svg g {
    cursor: pointer;
}

.seg-lab-visual svg rect {
    filter: drop-shadow(0 2px 4px rgba(15, 23, 42, 0.24));
}

.seg-lab-visual svg g.is-selected rect {
    stroke-width: 2.2;
}

.seg-lab-visual svg text {
    fill: #ffffff;
    paint-order: stroke;
    stroke: rgba(15, 23, 42, 0.82);
    stroke-width: 0.7px;
    font-size: 3.8px;
    font-weight: 950;
}

.seg-lab-scanline {
    position: absolute;
    inset: 0;
    z-index: 5;
    pointer-events: none;
    opacity: 0;
}

.seg-lab-scanline::before {
    content: "";
    position: absolute;
    right: 0;
    left: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(37, 99, 235, 0.86), transparent);
    box-shadow: 0 0 16px rgba(37, 99, 235, 0.48);
    animation: segLabScan 1.35s ease-in-out infinite;
}

.is-running .seg-lab-scanline,
.seg-lab-result-card[data-state="running"] .seg-lab-scanline {
    opacity: 1;
}

[data-segmentation-lab][data-mode="mask"] .seg-lab-visual img {
    opacity: 0.08;
}

.seg-lab-mini-legend {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    align-content: start;
    min-height: 90px;
    max-height: 150px;
    padding: 9px 10px;
    overflow-y: auto;
}

.seg-lab-mini-legend button,
.seg-lab-mini-legend > span {
    display: grid;
    grid-template-columns: 10px minmax(0, 1fr) auto;
    align-items: center;
    gap: 5px;
    min-width: 0;
    min-height: 28px;
    border: 1px solid #e2e8f0;
    border-radius: 9px;
    padding: 5px 7px;
    color: #334155;
    font: inherit;
    font-size: 9px;
    text-align: left;
    background: #f8fafc;
}

.seg-lab-mini-legend button.is-active,
.seg-lab-mini-legend button:hover {
    border-color: #93c5fd;
    background: #eff6ff;
}

.seg-lab-mini-legend i {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.seg-lab-mini-legend b,
.seg-lab-mini-legend em {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.seg-lab-mini-legend em {
    color: #64748b;
    font-style: normal;
}

.seg-lab-result-card footer {
    display: grid;
    gap: 4px;
    min-height: 58px;
    padding: 10px 11px;
    background: #fbfdff;
}

.seg-lab-result-card footer strong {
    color: #1d4ed8;
    font-size: 11px;
    overflow-wrap: anywhere;
}

.seg-lab-result-card footer span {
    color: #64748b;
    font-size: 10px;
    line-height: 1.45;
}

.seg-lab-pipeline {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
    border-top: 1px solid #e8eef6;
    padding: 11px 12px 12px;
    background: #ffffff;
}

.seg-lab-pipeline button {
    position: relative;
    display: grid;
    grid-template-columns: 27px minmax(0, 1fr);
    gap: 4px 8px;
    align-items: center;
    min-width: 0;
    min-height: 51px;
    border: 1px solid #dbeafe;
    border-radius: 12px;
    padding: 8px;
    color: #334155;
    cursor: pointer;
    text-align: left;
    background: #f8fbff;
}

.seg-lab-pipeline button::after {
    content: "";
    position: absolute;
    right: -10px;
    top: 50%;
    width: 10px;
    height: 1px;
    background: #bfdbfe;
}

.seg-lab-pipeline button:last-child::after {
    display: none;
}

.seg-lab-pipeline button.is-active {
    border-color: #93c5fd;
    background: #eff6ff;
    box-shadow: inset 3px 0 0 #2563eb;
}

.seg-lab-pipeline span {
    grid-row: span 2;
    display: grid;
    width: 27px;
    height: 27px;
    place-items: center;
    border-radius: 50%;
    color: #ffffff;
    font-size: 10px;
    font-weight: 950;
    background: #2563eb;
}

.seg-lab-pipeline strong {
    overflow: hidden;
    color: #172554;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.seg-lab-pipeline small {
    overflow: hidden;
    color: #64748b;
    font-size: 9px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.seg-lab-explain-card > span {
    color: #2563eb;
    font-size: 10px;
    font-weight: 950;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.seg-lab-explain-card h4 {
    margin: 0;
    color: #172554;
    font-size: 16px;
    line-height: 1.35;
}

.seg-lab-explain-card p {
    margin: 0;
    color: #475569;
    font-size: 12px;
    line-height: 1.65;
}

.seg-lab-explain-card dl,
.seg-lab-inspector-list {
    display: grid;
    gap: 5px;
    margin: 0;
}

.seg-lab-explain-card dl > div {
    display: grid;
    gap: 2px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 6px 8px;
    background: #f8fafc;
}

.seg-lab-inspector-list > div {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 6px 8px;
    background: #f8fafc;
}

.seg-lab-explain-card dt,
.seg-lab-explain-card dd,
.seg-lab-inspector-list dt,
.seg-lab-inspector-list dd {
    margin: 0;
}

.seg-lab-explain-card dt,
.seg-lab-inspector-list dt {
    color: #94a3b8;
    font-size: 11px;
    font-weight: 950;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.seg-lab-explain-card dd {
    overflow-wrap: anywhere;
    color: #0f172a;
    font-size: 14px;
    font-weight: 900;
}

.seg-lab-inspector-list dd {
    overflow-wrap: anywhere;
    color: #0f172a;
    font-size: 12px;
    font-weight: 900;
    text-align: right;
}

.seg-lab-proscons {
    display: grid;
    gap: 10px;
    border: 1px solid #dbeafe;
    border-radius: 18px;
    padding: 12px;
    background:
        linear-gradient(90deg, rgba(219, 234, 254, 0.48) 1px, transparent 1px),
        linear-gradient(180deg, rgba(219, 234, 254, 0.48) 1px, transparent 1px),
        rgba(255, 255, 255, 0.94);
    background-size: 28px 28px;
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.05);
}

.seg-lab-proscons-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.seg-lab-proscons-grid article {
    display: grid;
    gap: 8px;
    min-width: 0;
    border: 1px solid #dbeafe;
    border-radius: 13px;
    padding: 11px;
    background: #ffffff;
    box-shadow: 0 10px 22px rgba(37, 99, 235, 0.055);
    transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.seg-lab-proscons-grid article.is-focused {
    border-color: #93c5fd;
    transform: translateY(-1px);
    box-shadow: 0 16px 28px rgba(37, 99, 235, 0.12);
}

.seg-lab-proscons-grid header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    border-bottom: 1px solid #e8eef6;
    padding-bottom: 7px;
}

.seg-lab-proscons-grid header span {
    color: #2563eb;
    font-size: 10px;
    font-weight: 950;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.seg-lab-proscons-grid header strong {
    color: #172554;
    font-size: 15px;
}

.seg-lab-proscons-grid h5 {
    margin: 0 0 3px;
    color: #1e3a8a;
    font-size: 11px;
}

.seg-lab-proscons-grid p,
.seg-lab-proscons-grid footer {
    margin: 0;
    color: #475569;
    font-size: 11px;
    line-height: 1.55;
}

.seg-lab-proscons-grid footer {
    border-left: 3px solid #93c5fd;
    padding-left: 10px;
    color: #334155;
    background: #f8fbff;
}

@keyframes segLabButtonSheen {
    from { background-position: 120% 0, 0 0; }
    to { background-position: -120% 0, 0 0; }
}

@keyframes segLabScan {
    from { transform: translateY(-12px); opacity: 0; }
    20% { opacity: 1; }
    80% { opacity: 1; }
    to { transform: translateY(100%); opacity: 0; }
}

@media (max-width: 1280px) {
    .seg-lab-workbench {
        grid-template-columns: minmax(230px, 260px) minmax(0, 1fr);
    }

    .seg-lab-notes-panel {
        grid-column: 1 / -1;
        display: grid;
        grid-template-columns: minmax(260px, 0.8fr) minmax(0, 1.2fr);
    }

    .seg-lab-notes-panel .vision-panel-heading {
        grid-column: 1 / -1;
    }
}

@media (max-width: 1040px) {
    .seg-lab-comparison-grid {
        grid-template-columns: 1fr;
    }

    .seg-lab-result-card {
        grid-template-rows: auto auto auto auto;
    }

    .seg-lab-pipeline {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .seg-lab-pipeline button::after {
        display: none;
    }
}

@media (max-width: 820px) {
    .seg-lab-workbench,
    .seg-lab-notes-panel,
    .seg-lab-proscons-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .seg-lab-mini-legend,
    .seg-lab-pipeline {
        grid-template-columns: 1fr;
    }
}

/* --- Feature Metric Lens Modals & Triggers --- */

/* Adjust K-means compare card header to align trigger button */
.seg-compare-card h4 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap; /* Prevent wrapping overflow on tight screens */
}

/* Micro interaction premium button */
.seg-lens-btn {
    border: 1px solid rgba(37, 99, 235, 0.2);
    border-radius: 99px;
    padding: 3px 10px;
    background: linear-gradient(135deg, rgba(239, 246, 255, 0.8), rgba(219, 234, 254, 0.5));
    color: #1d4ed8;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 5px rgba(37, 99, 235, 0.05);
    line-height: 1;
}

.seg-lens-btn:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    border-color: #1d4ed8;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.25);
}

.seg-lens-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.15);
}

/* Modal Backdrop with blur and enter animation */
.seg-lens-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999; /* Ensure it floats above the header and panel */
    animation: segModalFadeIn 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Modal Content with Premium Glassmorphic style */
.seg-lens-modal-content {
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 24px;
    box-shadow:
        0 25px 50px -12px rgba(15, 23, 42, 0.15),
        inset 0 0 0 1px rgba(255, 255, 255, 0.8);
    padding: 28px 24px 24px;
    position: relative;
    max-width: 420px;
    width: 90%;
    backdrop-filter: blur(8px);
    animation: segModalScaleIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Close Button styling */
.seg-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 26px;
    height: 26px;
    border: 1px solid rgba(226, 232, 240, 0.8);
    background: rgba(248, 250, 252, 0.9);
    border-radius: 50%;
    color: #64748b;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    line-height: 1;
    z-index: 10;
}

.seg-modal-close:hover {
    background: #ef4444;
    border-color: #ef4444;
    color: #ffffff;
    transform: rotate(90deg);
}

/* Cloned Inner Card Styles */
.seg-lens-modal-content .seg-mode-lens-card {
    display: flex !important; /* Force display since original container is hidden */
    flex-direction: column;
    gap: 16px;
    text-align: left;
}

/* Formula container */
.seg-mode-lens-card div:first-child {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.seg-mode-lens-card strong {
    font-size: 17px;
    font-weight: 900;
    color: #0f172a;
    letter-spacing: -0.02em;
}

.seg-mode-lens-card span {
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 13px;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 8px;
    display: inline-block;
    align-self: flex-start;
}

.seg-mode-lens-card.is-rgb span {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #dbeafe;
}

.seg-mode-lens-card.is-rgbxy span {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #d1fae5;
}

/* Paragraph text */
.seg-mode-lens-card p {
    font-size: 12.5px;
    line-height: 1.6;
    color: #475569;
    margin: 0;
    padding: 10px 14px;
    border-radius: 8px;
    background: rgba(248, 250, 252, 0.6);
    border-left: 4px solid #3b82f6;
}

.seg-mode-lens-card.is-rgbxy p {
    border-left-color: #10b981;
}

/* Visual Playground Container */
.seg-mode-lens-visual {
    position: relative;
    height: 110px;
    background: radial-gradient(circle at 50% 50%, rgba(248, 250, 252, 0.9), rgba(241, 245, 249, 0.8));
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
    overflow: hidden;
    margin: 4px 0;
}

/* Visual node dots */
.seg-mode-lens-visual i {
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    z-index: 3;
}

/* Node A: Blue */
.seg-mode-lens-visual i.is-a {
    left: 40px;
    top: 48px;
    background: #3b82f6;
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.85);
}

/* Node B: Blue (Color matches A, but far spatially) */
.seg-mode-lens-visual i.is-b {
    right: 40px;
    top: 48px;
    background: #3b82f6;
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.85);
}

/* Node C: Orange (Middle spatial distance, completely different color) */
.seg-mode-lens-visual i.is-c {
    left: 50%;
    top: 72px;
    transform: translateX(-50%);
    background: #f97316;
    box-shadow: 0 0 12px rgba(249, 115, 22, 0.85);
}

/* Label descriptors inside the canvas (Optional fallback representation) */
.seg-mode-lens-visual i.is-a::after {
    content: "A";
    position: absolute;
    bottom: -16px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 9px;
    color: #64748b;
    font-weight: 700;
}

.seg-mode-lens-visual i.is-b::after {
    content: "B";
    position: absolute;
    bottom: -16px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 9px;
    color: #64748b;
    font-weight: 700;
}

.seg-mode-lens-visual i.is-c::after {
    content: "C";
    position: absolute;
    bottom: -16px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 9px;
    color: #94a3b8;
    font-weight: 700;
}

/* RGB mode animation details */
.seg-mode-lens-card.is-rgb i.is-a {
    animation: segAttractLeft 4s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.seg-mode-lens-card.is-rgb i.is-b {
    animation: segAttractRight 4s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

/* Connective flow line for RGB */
.seg-mode-lens-card.is-rgb .is-link-one {
    position: absolute;
    left: 48px;
    right: 48px;
    top: 54px;
    height: 2px;
    background: linear-gradient(90deg, #3b82f6 20%, #60a5fa 50%, #3b82f6 80%);
    background-size: 200% 100%;
    z-index: 1;
    animation:
        segPulseLink 1.8s infinite linear,
        segLinkScale 4s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    transform-origin: center;
}
/* RGB+XY mode spatial boundary animation details */
/* Pulse Rings around A and B indicating spatial constraint limits */
.seg-mode-lens-card.is-rgbxy .is-ring-one {
    position: absolute;
    left: 27px;
    top: 35px;
    width: 40px;
    height: 40px;
    border: 2px solid rgba(59, 130, 246, 0.35);
    border-radius: 50%;
    z-index: 1;
    animation: segRadiusPulse 2.4s cubic-bezier(0.25, 0.8, 0.25, 1) infinite;
}

.seg-mode-lens-card.is-rgbxy .is-ring-two {
    position: absolute;
    right: 27px;
    top: 35px;
    width: 40px;
    height: 40px;
    border: 2px solid rgba(59, 130, 246, 0.35);
    border-radius: 50%;
    z-index: 1;
    animation: segRadiusPulse 2.4s cubic-bezier(0.25, 0.8, 0.25, 1) infinite 1.2s;
}

/* Broken link showing separation constraint */
.seg-mode-lens-card.is-rgbxy::after {
    /* Subtle dashed barrier line in the middle */
    content: "";
    position: absolute;
    left: 50%;
    top: 25px;
    bottom: 25px;
    width: 1px;
    border-left: 1px dashed rgba(239, 68, 68, 0.35);
    z-index: 1;
}

/* Keyframes */
@keyframes segModalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes segModalScaleIn {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(12px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes segPulseLink {
    0% { background-position: 200% 0; }
    100% { background-position: 0 0; }
}

@keyframes segRadiusPulse {
    0% {
        transform: scale(0.5);
        opacity: 0.85;
    }
    100% {
        transform: scale(1.6);
        opacity: 0;
    }
}

@keyframes segAttractLeft {
    0%, 100% {
        transform: translateX(0);
    }
    40%, 60% {
        transform: translateX(35px); /* Move towards center */
        background: #1d4ed8;
    }
}

@keyframes segAttractRight {
    0%, 100% {
        transform: translateX(0);
    }
    40%, 60% {
        transform: translateX(-35px); /* Move towards center */
        background: #1d4ed8;
    }
}

@keyframes segLinkScale {
    0%, 100% {
        transform: scaleX(1);
        opacity: 0.6;
    }
    40%, 60% {
        transform: scaleX(0.48); /* Shorten as nodes approach */
        opacity: 1;
        background: linear-gradient(90deg, #1d4ed8, #60a5fa, #1d4ed8);
    }
}

/* ============================================================
   Segmentation Lab Enhancements (2026-06-25)
   - Real-pill status badges
   - Unified player (step-info-bar + progress dots + controls + speed)
   - Mask linkage modes (hover/click/blink)
   - Compact pros/cons strip
   - Compare output structure animation
   - Pixel inspector tooltip
   ============================================================ */

/* ---- Real-pill status badges ---- */
.seg-lab-real-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}
.seg-lab-real-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.seg-lab-real-pill.is-real {
    color: #047857;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.32);
}
.seg-lab-real-pill.is-demo {
    color: #b45309;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.32);
}
.seg-lab-real-pill.is-pending {
    color: #64748b;
    background: rgba(148, 163, 184, 0.1);
    border: 1px solid rgba(148, 163, 184, 0.25);
}
.seg-lab-real-pill > i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 8px currentColor;
}
.seg-lab-real-pill.is-demo > i { animation: segPillPulse 1.6s ease-in-out infinite; }
@keyframes segPillPulse {
    0%, 100% { opacity: 0.55; }
    50% { opacity: 1; }
}

/* ---- Unified player ---- */
.seg-lab-player {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    gap: 10px 18px;
    align-items: center;
    padding: 12px 16px;
    margin-top: 10px;
    border: 1px solid #dbeafe;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(239, 246, 255, 0.9), rgba(248, 250, 252, 0.85));
    box-shadow: 0 8px 22px rgba(37, 99, 235, 0.08);
}
.seg-lab-step-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    grid-column: 1;
    grid-row: 1;
}
.seg-lab-step-name {
    font-size: 13px;
    font-weight: 800;
    color: #172554;
    letter-spacing: -0.01em;
}
.seg-lab-step-principle {
    font-size: 11.5px;
    color: #475569;
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.seg-lab-progress {
    display: flex;
    align-items: center;
    gap: 4px;
    grid-column: 1;
    grid-row: 2;
    flex-wrap: wrap;
}
.seg-lab-progress-dot {
    width: 16px;
    height: 16px;
    padding: 0;
    border: 2px solid rgba(148, 163, 184, 0.4);
    background: #ffffff;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.22, 0.61, 0.36, 1);
    position: relative;
    display: grid;
    place-items: center;
    font-size: 0;
    color: transparent;
}
.seg-lab-progress-dot > span { display: none; }
.seg-lab-progress-dot.is-done {
    background: #2563eb;
    border-color: #2563eb;
}
.seg-lab-progress-dot.is-current {
    width: 20px;
    height: 20px;
    background: #ffffff;
    border-color: #2563eb;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.22), 0 0 14px rgba(37, 99, 235, 0.45);
    animation: segDotPulse 1.4s ease-in-out infinite;
}
@keyframes segDotPulse {
    0%, 100% { box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.22), 0 0 14px rgba(37, 99, 235, 0.45); }
    50% { box-shadow: 0 0 0 6px rgba(37, 99, 235, 0.12), 0 0 18px rgba(37, 99, 235, 0.6); }
}
.seg-lab-progress-line {
    width: 22px;
    height: 2px;
    background: rgba(148, 163, 184, 0.3);
    border-radius: 1px;
    transition: background 0.3s ease;
}
.seg-lab-progress-line.is-done {
    background: linear-gradient(90deg, #2563eb, #60a5fa);
}
.seg-lab-progress-text {
    margin-left: 10px;
    font-size: 11px;
    color: #64748b;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}
.seg-lab-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    grid-column: 2;
    grid-row: 1 / span 2;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.seg-lab-ctrl {
    padding: 7px 14px;
    border-radius: 10px;
    border: 1px solid #dbeafe;
    background: #ffffff;
    color: #1e293b;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 64px;
}
.seg-lab-ctrl:hover:not(:disabled) {
    border-color: #2563eb;
    color: #2563eb;
    background: #eff6ff;
}
.seg-lab-ctrl:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.seg-lab-ctrl--play {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
    font-weight: 800;
    min-width: 76px;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.28);
}
.seg-lab-ctrl--play:hover:not(:disabled) {
    background: #1d4ed8;
    color: #ffffff;
}
.seg-lab-speed {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #64748b;
}
.seg-lab-speed input[type="range"] {
    width: 80px;
    accent-color: #2563eb;
}
.seg-lab-speed b {
    color: #172554;
    font-size: 11.5px;
    font-variant-numeric: tabular-nums;
    min-width: 34px;
    text-align: right;
}
@media (max-width: 760px) {
    .seg-lab-player {
        grid-template-columns: 1fr;
    }
    .seg-lab-controls {
        grid-column: 1;
        grid-row: auto;
        justify-content: flex-start;
    }
}

/* ---- Mask linkage modes ---- */
[data-segmentation-lab][data-link-mode="hover"] .seg-lab-result-card.is-dimmed {
    opacity: 0.45;
    transition: opacity 0.3s ease;
}
[data-segmentation-lab][data-link-mode="hover"] .seg-lab-result-card.is-spotlight {
    opacity: 1;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.45), 0 12px 28px rgba(37, 99, 235, 0.22);
    transition: all 0.3s ease;
}
[data-segmentation-lab][data-link-mode="click"] .seg-lab-result-card.is-locked {
    box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.5), 0 14px 32px rgba(168, 85, 247, 0.2);
    transition: all 0.3s ease;
}
[data-segmentation-lab][data-link-mode="blink"] .seg-lab-result-card--semantic {
    animation: segBlinkSem 1.4s ease-in-out infinite;
}
[data-segmentation-lab][data-link-mode="blink"] .seg-lab-result-card--instance {
    animation: segBlinkInst 1.4s ease-in-out infinite;
}
@keyframes segBlinkSem {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0.32; }
}
@keyframes segBlinkInst {
    0%, 49% { opacity: 0.32; }
    50%, 100% { opacity: 1; }
}

/* Linkage mode toggle */
.seg-lab-link-modes {
    display: flex;
    gap: 6px;
    margin-top: 10px;
}
.seg-lab-link-mode-btn {
    padding: 5px 10px;
    border-radius: 8px;
    border: 1px solid #dbeafe;
    background: #f8fbff;
    color: #475569;
    font-size: 10.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}
.seg-lab-link-mode-btn:hover {
    border-color: #2563eb;
    color: #2563eb;
}
.seg-lab-link-mode-btn.is-active {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
}

/* ---- Compact pros/cons strip ---- */
.seg-lab-proscons-compact {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
    padding: 12px;
    border: 1px solid #dbeafe;
    border-radius: 12px;
    background: rgba(248, 250, 252, 0.6);
    margin-top: 10px;
}
.seg-lab-proscons-compact article {
    padding: 10px 12px;
    border-radius: 10px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.04);
}
.seg-lab-proscons-compact article header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.seg-lab-proscons-compact article header span {
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.1em;
    color: #2563eb;
    text-transform: uppercase;
}
.seg-lab-proscons-compact article header strong {
    font-size: 12.5px;
    color: #172554;
}
.seg-lab-proscons-compact article ul {
    margin: 0;
    padding-left: 14px;
    color: #475569;
    font-size: 11px;
    line-height: 1.55;
}
.seg-lab-proscons-compact article li::marker {
    color: #2563eb;
}

/* Right-panel pros/cons summary (compact list) */
.seg-lab-notes-panel .seg-lab-proscons-mini {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(248, 250, 252, 0.5);
    border: 1px solid #e2e8f0;
}
.seg-lab-notes-panel .seg-lab-proscons-mini h5 {
    margin: 0 0 6px;
    font-size: 11px;
    color: #2563eb;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.seg-lab-notes-panel .seg-lab-proscons-mini dl {
    margin: 0;
    display: grid;
    gap: 4px;
}
.seg-lab-notes-panel .seg-lab-proscons-mini dt {
    font-size: 10.5px;
    color: #64748b;
    font-weight: 600;
}
.seg-lab-notes-panel .seg-lab-proscons-mini dd {
    margin: 0 0 6px;
    font-size: 11px;
    color: #334155;
    line-height: 1.5;
}

/* ---- Compare output structure animation ---- */
.seg-lab-compare-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 5;
    display: grid;
    place-items: center;
    opacity: 0;
    transition: opacity 0.4s ease;
}
[data-segmentation-lab][data-step="compare"] .seg-lab-compare-overlay.is-active {
    opacity: 1;
}
.seg-lab-compare-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 2px;
    width: 120px;
    height: 120px;
    animation: segCompareRise 0.8s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}
.seg-lab-compare-grid i {
    background: rgba(37, 99, 235, 0.6);
    border-radius: 2px;
    animation: segCompareDye 0.6s ease forwards;
}
@keyframes segCompareRise {
    0% { transform: translateY(20px) scale(0.85); opacity: 0; }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}
@keyframes segCompareDye {
    0% { background: rgba(148, 163, 184, 0.2); }
    100% { background: rgba(37, 99, 235, 0.6); }
}
.seg-lab-compare-inst {
    position: absolute;
    display: flex;
    gap: 6px;
    animation: segCompareInstFly 0.9s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
    animation-delay: 0.2s;
    opacity: 0;
}
.seg-lab-compare-inst i {
    width: 28px;
    height: 28px;
    border: 2px solid #a855f7;
    border-radius: 6px;
    background: rgba(168, 85, 247, 0.12);
    animation: segCompareInstPulse 0.5s ease forwards;
    animation-delay: 0.6s;
}
@keyframes segCompareInstFly {
    0% { transform: translateY(30px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}
@keyframes segCompareInstPulse {
    0% { box-shadow: 0 0 0 0 rgba(168, 85, 247, 0); }
    50% { box-shadow: 0 0 0 6px rgba(168, 85, 247, 0.3); }
    100% { box-shadow: 0 0 0 0 rgba(168, 85, 247, 0); }
}

/* ---- Pixel inspector tooltip ---- */
.seg-lab-inspector-tooltip {
    position: fixed;
    z-index: 9999;
    pointer-events: none;
    padding: 8px 12px;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.94);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(148, 163, 184, 0.22);
    color: #e2e8f0;
    font-size: 11.5px;
    line-height: 1.55;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
    opacity: 0;
    transition: opacity 0.15s ease;
    font-family: "Cascadia Code", "Fira Code", Consolas, monospace;
    min-width: 160px;
}
.seg-lab-inspector-tooltip.is-visible {
    opacity: 1;
}
.seg-lab-inspector-tooltip .tip-title {
    color: #67e8f9;
    font-weight: 800;
    font-size: 11px;
    margin-bottom: 4px;
    letter-spacing: 0.04em;
}
.seg-lab-inspector-tooltip .tip-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    color: #94a3b8;
}
.seg-lab-inspector-tooltip .tip-row b {
    color: #e2e8f0;
    font-weight: 700;
}
.seg-lab-inspector-tooltip .tip-row b.tip-sem { color: #60a5fa; }
.seg-lab-inspector-tooltip .tip-row b.tip-inst { color: #c084fc; }

/* ---- Figure cards (image as explanation card, switched by focus) ---- */
.seg-lab-figure-card {
    display: none;
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
    transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}
.seg-lab-figure-card.is-active {
    display: block;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25), 0 8px 20px rgba(37, 99, 235, 0.15);
    animation: segFigureFadeIn 0.35s cubic-bezier(0.22, 0.61, 0.36, 1);
}
[data-seg-figure="instance"].is-active {
    border-color: #a855f7;
    box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.25), 0 8px 20px rgba(168, 85, 247, 0.15);
}
.seg-lab-figure-card img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
}
@keyframes segFigureFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Region 子页小字放大（不增加占用空间，同步压缩 padding/间距）
   ========================================================================== */
[data-seg-basic-lab][data-segb-family="region"] .method-stage-strip span {
    font-size: 11.5px !important;
    padding: 0 9px !important;
}

[data-seg-basic-lab][data-segb-family="region"] .seg-basic-concept-result figcaption,
[data-seg-basic-lab][data-segb-family="region"] .seg-basic-concept-result p {
    font-size: 12px !important;
}

[data-seg-basic-lab][data-segb-family="region"] .seg-basic-frame-strip strong {
    font-size: 11.5px !important;
}

[data-seg-basic-lab][data-segb-family="region"] .seg-basic-frame-strip span {
    font-size: 11px !important;
}

[data-seg-basic-lab][data-segb-family="region"] .seg-concept-card h4 {
    font-size: 13px !important;
}

[data-seg-basic-lab][data-segb-family="region"] .seg-concept-card p {
    font-size: 11.5px !important;
}

[data-seg-basic-lab][data-segb-family="region"] .seg-basic-step-focus .seg-concept-card p {
    font-size: 11px !important;
    line-height: 1.36 !important;
}

[data-seg-basic-lab][data-segb-family="region"] .seg-analysis-metrics span {
    font-size: 10.5px !important;
}

[data-seg-basic-lab][data-segb-family="region"] .seg-analysis-metrics strong {
    font-size: 12.5px !important;
}

[data-seg-basic-lab][data-segb-family="region"] .seg-analysis-metrics div {
    padding: 7px 9px 7px 28px !important;
    gap: 3px !important;
}

[data-seg-basic-lab][data-segb-family="region"] .seg-algo-bars b,
[data-seg-basic-lab][data-segb-family="region"] .seg-algo-bars em {
    font-size: 11px !important;
}

[data-seg-basic-lab][data-segb-family="region"] .seg-basic-step-focus .seg-algo-bars:has(span:nth-child(5)) span b,
[data-seg-basic-lab][data-segb-family="region"] .seg-basic-step-focus .seg-algo-bars:has(span:nth-child(5)) span em {
    font-size: 11.5px !important;
}

[data-seg-basic-lab][data-segb-family="region"] .seg-basic-region-row strong {
    font-size: 11.5px !important;
}

[data-seg-basic-lab][data-segb-family="region"] .seg-basic-region-row em {
    font-size: 11.5px !important;
}

[data-seg-basic-lab][data-segb-family="region"] .seg-basic-region-row {
    min-height: 30px !important;
    padding: 5px !important;
    gap: 6px !important;
}

[data-seg-basic-lab][data-segb-family="region"] .seg-basic-region-popover {
    font-size: 11.5px !important;
    padding: 8px 9px !important;
}

[data-seg-basic-lab][data-segb-family="region"] .seg-basic-region-popover strong {
    font-size: 12px !important;
}

[data-seg-basic-lab][data-segb-family="region"] .seg-basic-iteration-monitor p {
    font-size: 11px !important;
}

[data-seg-basic-lab][data-segb-family="region"] .seg-basic-movement-bars span {
    font-size: 9.5px !important;
}

[data-seg-basic-lab][data-segb-family="region"] .seg-notes-flowline span {
    font-size: 10.5px !important;
    min-height: 30px !important;
    padding: 4px !important;
}

[data-seg-basic-lab][data-segb-family="region"] .seg-notes-stat-grid span {
    font-size: 10px !important;
}

[data-seg-basic-lab][data-segb-family="region"] .seg-notes-stat-grid strong {
    font-size: 11.5px !important;
}

[data-seg-basic-lab][data-segb-family="region"] .seg-notes-stat-grid div {
    padding: 5px 6px !important;
}

[data-seg-basic-lab][data-segb-family="region"] .seg-notes-current p {
    font-size: 12px !important;
}

[data-seg-basic-lab][data-segb-family="region"] .seg-concept-analogy strong {
    font-size: 11px !important;
}

[data-seg-basic-lab][data-segb-family="region"] .seg-concept-analogy p {
    font-size: 12px !important;
}

[data-seg-basic-lab][data-segb-family="region"] .seg-notes-compact dt {
    font-size: 12.5px !important;
}

[data-seg-basic-lab][data-segb-family="region"] .seg-notes-compact dd {
    font-size: 12px !important;
}

[data-seg-basic-lab][data-segb-family="region"] .seg-notes-compact > div {
    padding: 9px 11px 9px 13px !important;
}

[data-seg-basic-lab][data-segb-family="region"] .seg-basic-note-current span {
    font-size: 10.5px !important;
}

[data-seg-basic-lab][data-segb-family="region"] .seg-basic-note-current p {
    font-size: 11.5px !important;
}

[data-seg-basic-lab][data-segb-family="region"] .seg-notes-mini-flow span {
    font-size: 10.5px !important;
    min-height: 26px !important;
}

[data-seg-basic-lab][data-segb-family="region"] .seg-notes-cluster-bars div {
    font-size: 10.5px !important;
}

[data-seg-basic-lab][data-segb-family="region"] .seg-notes-focus-list dt {
    font-size: 10.5px !important;
}

[data-seg-basic-lab][data-segb-family="region"] .seg-notes-focus-list dd {
    font-size: 11px !important;
}

